]>
Commit | Line | Data |
---|---|---|
ece1209a | 1 | import scapy.all |
2063390b VB |
2 | |
3 | ||
4 | def send_pcap(location, interface): | |
ece1209a VB |
5 | packets = scapy.all.rdpcap(location) |
6 | print(packets) | |
7 | scapy.all.sendp(packets, iface=interface) | |
2063390b VB |
8 | |
9 | ||
ece1209a VB |
10 | def test_cisco_sg200(request, lldpd1, lldpcli, namespaces): |
11 | with namespaces(2): | |
12 | send_pcap('data/sg200.pcap', 'eth1') | |
13 | with namespaces(1): | |
14 | out = lldpcli("-f", "keyvalue", "show", "neighbors", "details") | |
15 | assert out['lldp.eth0.age'].startswith('0 day, 00:00:') | |
16 | del out['lldp.eth0.age'] | |
17 | expected = { | |
18 | "lldp.eth0.via": "LLDP", | |
19 | "lldp.eth0.rid": "1", | |
20 | "lldp.eth0.chassis.mac": "00:35:35:35:35:35", | |
21 | "lldp.eth0.port.ttl": "120", | |
22 | "lldp.eth0.port.ifname": "g1", | |
23 | } | |
24 | if 'Dot3' in request.config.lldpd.features: | |
25 | expected.update({ | |
26 | "lldp.eth0.port.auto-negotiation.supported": "yes", | |
27 | "lldp.eth0.port.auto-negotiation.enabled": "yes", | |
28 | "lldp.eth0.port.auto-negotiation.1000Base-T.hd": "no", | |
29 | "lldp.eth0.port.auto-negotiation.1000Base-T.fd": "yes", | |
30 | "lldp.eth0.port.auto-negotiation.current": "unknown", | |
31 | }) | |
32 | if 'LLDP-MED' in request.config.lldpd.features: | |
33 | expected.update({ | |
34 | "lldp.eth0.lldp-med.device-type": | |
35 | "Network Connectivity Device", | |
36 | "lldp.eth0.lldp-med.Capabilities.available": "yes", | |
37 | "lldp.eth0.lldp-med.Policy.available": "yes", | |
38 | "lldp.eth0.lldp-med.Location.available": "yes", | |
39 | "lldp.eth0.lldp-med.MDI/PSE.available": "yes", | |
40 | "lldp.eth0.lldp-med.Inventory.available": "yes", | |
41 | "lldp.eth0.lldp-med.Civic address.country": "DE", | |
42 | "lldp.eth0.lldp-med.Civic address.city": "Berlin", | |
43 | "lldp.eth0.lldp-med.Civic address.street": | |
44 | "Karl-Liebknecht-Strase", | |
45 | "lldp.eth0.lldp-med.Civic address.building": "42", | |
46 | "lldp.eth0.lldp-med.inventory.hardware": "V02", | |
47 | "lldp.eth0.lldp-med.inventory.software": "1.0.8.3", | |
48 | "lldp.eth0.lldp-med.inventory.firmware": "1.0.8.3", | |
49 | "lldp.eth0.lldp-med.inventory.serial": "XXX11111ZZZ", | |
50 | "lldp.eth0.lldp-med.inventory.manufacturer": "0xbc00", | |
51 | "lldp.eth0.lldp-med.inventory.model": "SG 200-08P", | |
52 | "lldp.eth0.lldp-med.inventory.asset": "1" | |
53 | }) | |
54 | assert out == expected |