From 9e6b5cf22f490505fffda1b53fbd5d49f87d04e2 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 25 Nov 2016 23:44:06 +0100 Subject: [PATCH] tests: fix previous commit by making LLDP-MED part optional --- tests/integration/test_pcap.py | 46 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/tests/integration/test_pcap.py b/tests/integration/test_pcap.py index 1bab1434..ef8bf833 100644 --- a/tests/integration/test_pcap.py +++ b/tests/integration/test_pcap.py @@ -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 -- 2.39.5