]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
tests: fix previous commit by making LLDP-MED part optional
authorVincent Bernat <vincent@bernat.im>
Fri, 25 Nov 2016 22:44:06 +0000 (23:44 +0100)
committerVincent Bernat <vincent@bernat.im>
Fri, 25 Nov 2016 22:44:06 +0000 (23:44 +0100)
tests/integration/test_pcap.py

index 1bab143465477c8befe9bead23163e234ba0a913..ef8bf833be3d5a382244a1d6878f1b4ef5e86dcc 100644 (file)
@@ -1,3 +1,4 @@
+import pytest
 import socket
 import struct
 
@@ -31,7 +32,7 @@ class TestPcapCaptures(object):
             out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
             assert out['lldp.eth0.age'].startswith('0 day, 00:00:')
             del out['lldp.eth0.age']
-            assert out == {
+            expected = {
                 "lldp.eth0.via": "LLDP",
                 "lldp.eth0.rid": "1",
                 "lldp.eth0.chassis.mac": "00:35:35:35:35:35",
@@ -42,22 +43,27 @@ class TestPcapCaptures(object):
                 "lldp.eth0.port.auto-negotiation.1000Base-T.hd": "no",
                 "lldp.eth0.port.auto-negotiation.1000Base-T.fd": "yes",
                 "lldp.eth0.port.auto-negotiation.current": "unknown",
-                "lldp.eth0.lldp-med.device-type":
-                "Network Connectivity Device",
-                "lldp.eth0.lldp-med.Capabilities.available": "yes",
-                "lldp.eth0.lldp-med.Policy.available": "yes",
-                "lldp.eth0.lldp-med.Location.available": "yes",
-                "lldp.eth0.lldp-med.MDI/PSE.available": "yes",
-                "lldp.eth0.lldp-med.Inventory.available": "yes",
-                "lldp.eth0.lldp-med.Civic address.country": "DE",
-                "lldp.eth0.lldp-med.Civic address.city": "Berlin",
-                "lldp.eth0.lldp-med.Civic address.street":
-                "Karl-Liebknecht-Strase",
-                "lldp.eth0.lldp-med.Civic address.building": "42",
-                "lldp.eth0.lldp-med.inventory.hardware": "V02",
-                "lldp.eth0.lldp-med.inventory.software": "1.0.8.3",
-                "lldp.eth0.lldp-med.inventory.firmware": "1.0.8.3",
-                "lldp.eth0.lldp-med.inventory.serial": "XXX11111ZZZ",
-                "lldp.eth0.lldp-med.inventory.manufacturer": "0xbc00",
-                "lldp.eth0.lldp-med.inventory.model": "SG 200-08P",
-                "lldp.eth0.lldp-med.inventory.asset": "1"}
+            }
+            if 'LLDP-MED' in pytest.config.lldpd.features:
+                expected.update({
+                    "lldp.eth0.lldp-med.device-type":
+                    "Network Connectivity Device",
+                    "lldp.eth0.lldp-med.Capabilities.available": "yes",
+                    "lldp.eth0.lldp-med.Policy.available": "yes",
+                    "lldp.eth0.lldp-med.Location.available": "yes",
+                    "lldp.eth0.lldp-med.MDI/PSE.available": "yes",
+                    "lldp.eth0.lldp-med.Inventory.available": "yes",
+                    "lldp.eth0.lldp-med.Civic address.country": "DE",
+                    "lldp.eth0.lldp-med.Civic address.city": "Berlin",
+                    "lldp.eth0.lldp-med.Civic address.street":
+                    "Karl-Liebknecht-Strase",
+                    "lldp.eth0.lldp-med.Civic address.building": "42",
+                    "lldp.eth0.lldp-med.inventory.hardware": "V02",
+                    "lldp.eth0.lldp-med.inventory.software": "1.0.8.3",
+                    "lldp.eth0.lldp-med.inventory.firmware": "1.0.8.3",
+                    "lldp.eth0.lldp-med.inventory.serial": "XXX11111ZZZ",
+                    "lldp.eth0.lldp-med.inventory.manufacturer": "0xbc00",
+                    "lldp.eth0.lldp-med.inventory.model": "SG 200-08P",
+                    "lldp.eth0.lldp-med.inventory.asset": "1"
+                })
+            assert out == expected