[FIT/IOTlab] TIG & TPG stack: agents not started and multiple IPv6 addresses
1. Context:
TIG / TPG stack
-
Issue: IPv6 network has 2 IP addresses returned by host.filter_addresses. As a result, the method _get_address
raises ValueError()
.
IPAddress(
network=<enoslib.infra.enos_g5k.objects.G5kEnosProd6Network object at 0x7ff31e4559a0>,
ip=IPv6Interface('2001:660:4406:700:1::2d/128')
)
IPAddress(
network=<enoslib.infra.enos_g5k.objects.G5kEnosProd6Network object at 0x7ff31e4559a0>,
ip=IPv6Interface('2001:660:4406:700:eef4:bbff:fed0:ee20/64')
)
NOTE:
this IP will be used by telegraf agents. So, it must be 2001:660:4406:700:1::2d instead of 2001:660:4406:700:eef4:bbff:fed0:ee20
root@node-rpi3-1:~# cat /builds/monitoring/telegraf.conf
[[outputs.influxdb]]
urls = ["http://2001:660:4406:700:1::2d:8086"]
2. Reproducing the issue
Example based on this tutorial
- TIG: You can use enos_tpg-monit_g5k_fit.py
- TPG: You can use enos_tig-monit_g5k_fit.py
3. Solution idea
Add here the code below:
from ipaddress import IPv6Interface
if len(address) > 1:
filtered_addresses = [
addr for addr in address
if isinstance(addr.ip, IPv6Interface)
if addr.ip.with_prefixlen.endswith("/128")
]
address = filtered_addresses
With that code, I've tested the following cases and all works:
G5K only (TIG + TPG):
- using IPv4Network for monitoring
- using IPv6Network for monitoring
- using IPv6Network for monitoring + (dhclient -6): it results in 2 scope global IPv6 addresses. In this case, scope global prefixlen 128 is used.
G5K + FIT (TIG + TPG):
- using IPv6Network for monitoring + (dhclient -6): it results in 2 scope global IPv6 addresses. In this case, scope global prefixlen 128
must be
used (firewall rule).
Edited by ROSENDO Daniel