lldpd (0.9.8)
* Changes:
+ "Station" capability is only set if no other bit is set.
+ * Fixes:
+ + Handle team interfaces like a bond. Real MAC address cannot be
+ retrieved yet.
lldpd (0.9.7)
* Changes:
if ((master = iface->upper) == NULL || master->type != IFACE_BOND_T)
return;
+ if (master->driver == NULL || strcmp(master->driver, "bonding"))
+ /* Not a bond interface, maybe a team */
+ return;
/* We have a bond, we need to query it to get real MAC addresses */
if (snprintf(path, SYSFS_PATH_MAX, "/proc/net/bonding/%s",
log_debug("netlink", "interface %s is a bond",
iff->name);
iff->type |= IFACE_BOND_T;
+ } else if (!strcmp(kind, "team")) {
+ log_debug("netlink", "interface %s is a team",
+ iff->name);
+ iff->type |= IFACE_BOND_T;
}
}
}
ipr.link('set', index=idx, state='up')
return idx
- def bond(self, name, *ifaces):
- """Create a bond."""
+ def _bond_or_team(self, kind, name, *ifaces):
+ """Create a bond or a team."""
ipr = pyroute2.IPRoute()
# Create the bond
ipr.link_create(ifname=name,
- kind='bond')
+ kind=kind)
idx = ipr.link_lookup(ifname=name)[0]
# Attach interfaces
for iface in ifaces:
ipr.link('set', index=idx, state='up')
return idx
+ def team(self, name, *ifaces):
+ """Create a team."""
+ # Unfortunately, pyroute2 will try to run teamd too. This
+ # doesn't work.
+ return self._bond_or_team("team", name, *ifaces)
+
+ def bond(self, name, *ifaces):
+ """Create a bond."""
+ return self._bond_or_team("bond", name, *ifaces)
+
def vlan(self, name, id, iface):
"""Create a VLAN."""
ipr = pyroute2.IPRoute()
assert out['lldp.eth0.port.mac'] == '00:00:00:00:00:02'
+@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+ reason="Dot3 not supported")
+@pytest.mark.skip(reason="Cannot create a simple team interface without teamd")
+@pytest.mark.parametrize('when', ['before', 'after'])
+def test_team(lldpd1, lldpd, lldpcli, namespaces, links, when):
+ links(namespaces(3), namespaces(2)) # Another link to setup a bond
+ with namespaces(2):
+ if when == 'after':
+ lldpd()
+ idx = links.team('team42', 'eth3', 'eth1')
+ if when == 'before':
+ lldpd()
+ else:
+ time.sleep(6)
+ with namespaces(1):
+ out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
+ assert out['lldp.eth0.port.descr'] == 'eth1'
+ assert out['lldp.eth0.port.aggregation'] == str(idx)
+ # Unfortunately, we cannot get the right MAC currently... So,
+ # this bit will fail.
+ assert out['lldp.eth0.port.mac'] == '00:00:00:00:00:02'
+
+
@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
reason="Dot3 not supported")
@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,