]> git.ipfire.org Git - thirdparty/lldpd.git/blobdiff - tests/integration/test_interfaces.py
tests: enable test for team device
[thirdparty/lldpd.git] / tests / integration / test_interfaces.py
index d2252f65af8964303be45049e02f88871c545676..4adbc0ea3f63d1a4276e062942e404fc44583ecf 100644 (file)
@@ -29,7 +29,6 @@ def test_bridge_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links, when):
         if when == 'before':
             lldpd()
         else:
-            # IPv6 DAD may kick in
             time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
@@ -56,7 +55,6 @@ def test_bond(lldpd1, lldpd, lldpcli, namespaces, links, when):
         if when == 'before':
             lldpd()
         else:
-            # IPv6 DAD may kick in
             time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
@@ -66,6 +64,28 @@ def test_bond(lldpd1, lldpd, lldpcli, namespaces, links, when):
         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.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 succeed by chance.
+        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,
@@ -84,7 +104,6 @@ def test_bond_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links, when):
         if when == 'before':
             lldpd()
         else:
-            # IPv6 DAD may kick in
             time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
@@ -134,7 +153,7 @@ def test_remove_vlan(lldpd1, lldpd, lldpcli, namespaces, links, kind):
         links.vlan('vlan500', 500, iface)
         lldpd()
         links.remove('vlan300')
-        time.sleep(4)
+        time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'
@@ -150,7 +169,7 @@ def test_unenslave_bond(lldpd1, lldpd, lldpcli, namespaces, links):
         lldpd()
         links.remove('bond42')
         links.up('eth1')
-        time.sleep(4)
+        time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'
@@ -167,7 +186,7 @@ def test_unenslave_bond_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
         lldpd()
         links.remove('bond42')
         links.up('eth1')
-        time.sleep(4)
+        time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'
@@ -184,12 +203,14 @@ def test_down_then_up(lldpd1, lldpd, lldpcli, namespaces, links):
         assert out == {}
     with namespaces(2):
         links.up('eth1')
-        time.sleep(2)
+        time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'
 
 
+@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+                    reason="Dot1 not supported")
 def test_down_then_up_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
     with namespaces(2):
         links.vlan('vlan300', 300, 'eth1')
@@ -197,7 +218,7 @@ def test_down_then_up_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
         links.down('eth1')
         lldpd()
         links.up('eth1')
-        time.sleep(2)
+        time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'
@@ -208,8 +229,8 @@ def test_down_then_up_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
 def test_new_interface(lldpd1, lldpd, lldpcli, namespaces, links):
     with namespaces(2):
         lldpd()
-        links(namespaces(1), namespaces(2))
-        time.sleep(2)
+    links(namespaces(1), namespaces(2), 4)
+    time.sleep(6)
     with namespaces(1):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
         assert out['lldp.eth0.port.descr'] == 'eth1'