]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
test: add tests for 802.3BT additions 350/head
authorVincent Bernat <vincent@bernat.ch>
Sat, 19 Oct 2019 20:02:47 +0000 (22:02 +0200)
committerVincent Bernat <vincent@bernat.ch>
Sat, 19 Oct 2019 20:02:47 +0000 (22:02 +0200)
src/lib/atoms/dot3.c
tests/integration/data/8023bt.pcap [new file with mode: 0644]
tests/integration/test_pcap.py

index 97a959dd2c82ab4dbc570cc69446be9c60cba74b..a9e456df807c8dd4ca3cd18f373ef82ae8e72d46 100644 (file)
@@ -183,9 +183,9 @@ static struct atom_map port_dot3_power_type_ext_map = {
 static struct atom_map port_dot3_power_pd_load_map = {
        .key = lldpctl_k_dot3_power_pd_load,
        .map = {
-               { 0, "PD is single- or dual-signature and power on the modes is not "
-                 "electrically isolated." },
-               { 1, "PD is dual-signature and power on the modes is electrically "
+               { 0, "PD is single- or dual-signature and power is not "
+                 "electrically isolated" },
+               { 1, "PD is dual-signature and power is electrically "
                  "isolated" },
        },
 };
diff --git a/tests/integration/data/8023bt.pcap b/tests/integration/data/8023bt.pcap
new file mode 100644 (file)
index 0000000..932b593
Binary files /dev/null and b/tests/integration/data/8023bt.pcap differ
index 8e2a3cb619da9d37c6f33ac000cad1aa869de20a..4befc48559fde297fc17b0ebcea16e5723e05660 100644 (file)
@@ -1,3 +1,4 @@
+import pytest
 import scapy.all
 
 
@@ -52,3 +53,44 @@ def test_cisco_sg200(request, lldpd1, lldpcli, namespaces):
                 "lldp.eth0.lldp-med.inventory.asset": "1"
             })
         assert out == expected
+
+
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
+                    readon="Dot3 not supported")
+def test_8023bt(lldpd1, lldpcli, namespaces):
+    with namespaces(2):
+        send_pcap('data/8023bt.pcap', 'eth1')
+    with namespaces(1):
+        out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
+        for k in list(out.keys()):
+            if not k.startswith("lldp.eth0.port.power."):
+                del out[k]
+        assert out == {
+            'lldp.eth0.port.power.supported': 'yes',
+            'lldp.eth0.port.power.enabled': 'yes',
+            'lldp.eth0.port.power.paircontrol': 'yes',
+            'lldp.eth0.port.power.device-type': 'PSE',
+            'lldp.eth0.port.power.pairs': 'signal',
+            'lldp.eth0.port.power.class': 'class 4',
+            'lldp.eth0.port.power.power-type': '2',
+            'lldp.eth0.port.power.source': 'PSE',
+            'lldp.eth0.port.power.priority': 'low',
+            'lldp.eth0.port.power.requested': '71000',
+            'lldp.eth0.port.power.allocated': '51000',
+            'lldp.eth0.port.power.requested-a': '35500',
+            'lldp.eth0.port.power.requested-b': '35500',
+            'lldp.eth0.port.power.allocated-a': '25500',
+            'lldp.eth0.port.power.allocated-b': '25500',
+            'lldp.eth0.port.power.pse-powering-status':
+            '4-pair powering single-signature PD',
+            'lldp.eth0.port.power.pd-powering-status': 'Unknown',
+            'lldp.eth0.port.power.power-pairs-ext': 'Both alternatives',
+            'lldp.eth0.port.power.power-class-ext-a': 'Class 4',
+            'lldp.eth0.port.power.power-class-ext-b': 'Class 4',
+            'lldp.eth0.port.power.power-class-ext': 'Dual-signature PD',
+            'lldp.eth0.port.power.power-type-ext': 'Type 3 PSE',
+            'lldp.eth0.port.power.pd-load':
+            ('PD is single- or dual-signature and power '
+             'is not electrically isolated'),
+            'lldp.eth0.port.power.max-power': '51000'
+        }