]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
tests: also test if we send interface description if present
authorVincent Bernat <vincent@bernat.ch>
Sat, 30 Jan 2021 15:43:15 +0000 (16:43 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sat, 30 Jan 2021 15:43:15 +0000 (16:43 +0100)
tests/integration/test_interfaces.py

index 5e43752ecd74326b1c0341258ed97a3a207f37d4..04233cf301fa320c5650e2f81a3ce837a1f03dd9 100644 (file)
@@ -347,21 +347,27 @@ def test_new_interface(lldpd1, lldpd, lldpcli, namespaces, links):
 def test_set_interface_description(lldpd, lldpcli, namespaces, links):
     links(namespaces(1), namespaces(2))
     with namespaces(1):
+        # On namespace 1, put neighbor description in interface description
         lldpd()
         result = lldpcli("configure", "system", "interface", "description")
         assert result.returncode == 0
     with namespaces(2):
+        # On namespace 2, set an interface description
+        open("/sys/class/net/eth1/ifalias", "w").write("blip blop")
         lldpd()
     time.sleep(1)
     with namespaces(1):
         # Alias should be set
         alias = open("/sys/class/net/eth0/ifalias").read().strip()
         assert alias == "lldpd: connected to ns-2.example.com"
-        # Alias should not be sent to neighbor
+        # We should see neighbor interface description
+        out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
+        assert out['lldp.eth0.port.ifname'] == 'eth1'
+        assert out['lldp.eth0.port.descr'] == 'blip blop'
+        # Our new alias should not be sent to neighbor
         lldpcli("update")
     time.sleep(1)
     with namespaces(2):
         out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
-        print(out)
         assert out['lldp.eth1.port.descr'] == 'eth0'