]> git.ipfire.org Git - thirdparty/lldpd.git/blob - tests/integration/test_basic.py
9dd34803be1b992f4cff41ae51ab87e76ac96977
[thirdparty/lldpd.git] / tests / integration / test_basic.py
1 import time
2 import pytest
3 import pyroute2
4 import scapy.all
5 import scapy.contrib.lldp
6
7
8 def test_one_neighbor(lldpd1, lldpd, lldpcli, namespaces):
9 with namespaces(2):
10 lldpd()
11 with namespaces(1):
12 out = lldpcli("-f", "keyvalue", "show", "neighbors")
13 assert out["lldp.eth0.age"].startswith("0 day, 00:00:")
14 assert out["lldp.eth0.chassis.descr"].startswith(
15 "Spectacular GNU/Linux 2016 Linux"
16 )
17 assert "lldp.eth0.chassis.Router.enabled" in out
18 assert "lldp.eth0.chassis.Station.enabled" in out
19 del out["lldp.eth0.age"]
20 del out["lldp.eth0.chassis.descr"]
21 del out["lldp.eth0.chassis.Router.enabled"]
22 del out["lldp.eth0.chassis.Station.enabled"]
23 assert out == {
24 "lldp.eth0.via": "LLDP",
25 "lldp.eth0.rid": "1",
26 "lldp.eth0.chassis.mac": "00:00:00:00:00:02",
27 "lldp.eth0.chassis.name": "ns-2.example.com",
28 "lldp.eth0.chassis.mgmt-ip": "fe80::200:ff:fe00:2",
29 "lldp.eth0.chassis.mgmt-iface": "2",
30 "lldp.eth0.chassis.Bridge.enabled": "off",
31 "lldp.eth0.chassis.Wlan.enabled": "off",
32 "lldp.eth0.port.mac": "00:00:00:00:00:02",
33 "lldp.eth0.port.descr": "eth1",
34 "lldp.eth0.port.ttl": "120",
35 }
36
37
38 @pytest.mark.parametrize("neighbors", (5, 10, 20))
39 def test_several_neighbors(lldpd, lldpcli, links, namespaces, neighbors):
40 for i in range(2, neighbors + 1):
41 links(namespaces(1), namespaces(i))
42 for i in range(1, neighbors + 1):
43 with namespaces(i):
44 lldpd(sleep=(i == 1 and 2 or 0), silent=True)
45 time.sleep(10)
46 with namespaces(1):
47 out = lldpcli("-f", "keyvalue", "show", "neighbors")
48 for i in range(2, neighbors + 1):
49 assert out[
50 "lldp.eth{}.chassis.name".format((i - 2) * 2)
51 ] == "ns-{}.example.com".format(i)
52
53
54 def test_one_interface(lldpd1, lldpd, lldpcli, namespaces):
55 with namespaces(2):
56 lldpd()
57 with namespaces(1):
58 out = lldpcli("-f", "keyvalue", "show", "interfaces")
59 assert out["lldp.eth0.chassis.descr"].startswith(
60 "Spectacular GNU/Linux 2016 Linux"
61 )
62 assert "lldp.eth0.chassis.Router.enabled" in out
63 assert "lldp.eth0.chassis.Station.enabled" in out
64 del out["lldp.eth0.chassis.descr"]
65 del out["lldp.eth0.chassis.Router.enabled"]
66 del out["lldp.eth0.chassis.Station.enabled"]
67 assert out == {
68 "lldp.eth0.status": "RX and TX",
69 "lldp.eth0.chassis.mac": "00:00:00:00:00:01",
70 "lldp.eth0.chassis.name": "ns-1.example.com",
71 "lldp.eth0.chassis.mgmt-ip": "fe80::200:ff:fe00:1",
72 "lldp.eth0.chassis.mgmt-iface": "3",
73 "lldp.eth0.chassis.Bridge.enabled": "off",
74 "lldp.eth0.chassis.Wlan.enabled": "off",
75 "lldp.eth0.port.mac": "00:00:00:00:00:01",
76 "lldp.eth0.port.descr": "eth0",
77 "lldp.eth0.ttl.ttl": "120",
78 }
79
80
81 @pytest.mark.parametrize("interfaces", (5, 10, 20))
82 def test_several_interfaces(lldpd, lldpcli, links, namespaces, interfaces):
83 for i in range(2, interfaces + 1):
84 links(namespaces(1), namespaces(i))
85 for i in range(1, interfaces + 1):
86 with namespaces(i):
87 lldpd()
88 with namespaces(1):
89 out = lldpcli("-f", "keyvalue", "show", "interfaces")
90 for i in range(2, interfaces + 1):
91 assert (
92 out["lldp.eth{}.chassis.mac".format((i - 2) * 2)] == "00:00:00:00:00:01"
93 )
94 assert out[
95 "lldp.eth{}.port.mac".format((i - 2) * 2)
96 ] == "00:00:00:00:00:{num:02x}".format(num=(i - 2) * 2 + 1)
97
98
99 def test_different_mtu(lldpd, lldpcli, links, namespaces):
100 links(namespaces(1), namespaces(2), mtu=1500)
101 links(namespaces(1), namespaces(2), mtu=9000)
102 with namespaces(1):
103 lldpd()
104 with namespaces(2):
105 lldpd()
106 with namespaces(1):
107 out = lldpcli("-f", "keyvalue", "show", "interfaces")
108 assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:01"
109 assert out["lldp.eth2.chassis.mac"] == "00:00:00:00:00:01"
110
111
112 def test_overrided_description(lldpd1, lldpd, lldpcli, namespaces):
113 with namespaces(2):
114 lldpd("-S", "Modified description")
115 with namespaces(1):
116 out = lldpcli("-f", "keyvalue", "show", "neighbors")
117 assert out["lldp.eth0.chassis.descr"] == "Modified description"
118
119
120 def test_overrided_description2(lldpd1, lldpd, lldpcli, namespaces):
121 with namespaces(2):
122 lldpd()
123 lldpcli("configure", "system", "description", "Modified description")
124 lldpcli("update")
125 time.sleep(1)
126 with namespaces(1):
127 out = lldpcli("-f", "keyvalue", "show", "neighbors")
128 assert out["lldp.eth0.chassis.descr"] == "Modified description"
129
130
131 def test_overrided_chassisid(lldpd1, lldpd, lldpcli, namespaces):
132 with namespaces(2):
133 lldpd()
134 lldpcli("configure", "system", "chassisid", "Modified chassis ID")
135 lldpcli("update")
136 time.sleep(1)
137 with namespaces(1):
138 out = lldpcli("-f", "keyvalue", "show", "neighbors")
139 assert out["lldp.eth0.chassis.local"] == "Modified chassis ID"
140
141
142 def test_overrided_chassisid_kept(lldpd1, lldpd, lldpcli, namespaces, links):
143 with namespaces(2):
144 lldpd()
145 lldpcli("configure", "system", "chassisid", "Modified chassis ID")
146 links.down("eth1")
147 time.sleep(1)
148 links.up("eth1")
149 time.sleep(1)
150 lldpcli("update")
151 time.sleep(1)
152 with namespaces(1):
153 out = lldpcli("-f", "keyvalue", "show", "neighbors")
154 assert out["lldp.eth0.chassis.local"] == "Modified chassis ID"
155
156
157 def test_overrided_chassisid_reverse(lldpd1, lldpd, lldpcli, namespaces):
158 with namespaces(2):
159 lldpd()
160 lldpcli("configure", "system", "chassisid", "Modified chassis ID")
161 lldpcli("unconfigure", "system", "chassisid")
162 lldpcli("update")
163 time.sleep(1)
164 with namespaces(1):
165 out = lldpcli("-f", "keyvalue", "show", "neighbors")
166 assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:02"
167
168
169 def test_hide_kernel(lldpd1, lldpd, lldpcli, namespaces):
170 with namespaces(2):
171 lldpd("-k")
172 with namespaces(1):
173 out = lldpcli("-f", "keyvalue", "show", "neighbors")
174 assert out["lldp.eth0.chassis.descr"] == "Spectacular GNU/Linux 2016"
175
176
177 def test_listen_only(lldpd1, lldpd, lldpcli, namespaces):
178 with namespaces(2):
179 lldpd("-r")
180 with namespaces(1):
181 out = lldpcli("-f", "keyvalue", "show", "neighbors")
182 assert out == {}
183
184
185 def test_forced_unknown_management_address(lldpd1, lldpd, lldpcli, namespaces):
186 with namespaces(2):
187 lldpd("-m", "2001:db8::47")
188 with namespaces(1):
189 out = lldpcli("-f", "keyvalue", "show", "neighbors")
190 assert out["lldp.eth0.chassis.mgmt-ip"] == "2001:db8::47"
191 assert "lldp.eth0.chassis.mgmt-iface" not in out
192
193
194 def test_forced_known_management_address(lldpd1, lldpd, lldpcli, namespaces):
195 with namespaces(2):
196 with pyroute2.IPRoute() as ipr:
197 idx = ipr.link_lookup(ifname="eth1")[0]
198 ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24)
199 lldpd("-m", "192.168.14.2")
200 with namespaces(1):
201 out = lldpcli("-f", "keyvalue", "show", "neighbors")
202 assert out["lldp.eth0.chassis.mgmt-ip"] == "192.168.14.2"
203 assert out["lldp.eth0.chassis.mgmt-iface"] == "2"
204
205
206 def test_management_address(lldpd1, lldpd, lldpcli, links, namespaces):
207 with namespaces(2):
208 with pyroute2.IPRoute() as ipr:
209 idx = ipr.link_lookup(ifname="eth1")[0]
210 ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24)
211 ipr.addr("add", index=idx, address="172.25.21.47", prefixlen=24)
212 lldpd("-m", "172.25.*")
213 with namespaces(1):
214 out = lldpcli("-f", "keyvalue", "show", "neighbors")
215 assert out["lldp.eth0.chassis.mgmt-ip"] == "172.25.21.47"
216 assert out["lldp.eth0.chassis.mgmt-iface"] == "2"
217
218
219 def test_management_interface(lldpd1, lldpd, lldpcli, links, namespaces):
220 links(namespaces(1), namespaces(2), 4)
221 with namespaces(2):
222 with pyroute2.IPRoute() as ipr:
223 idx = ipr.link_lookup(ifname="eth1")[0]
224 ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24)
225 idx = ipr.link_lookup(ifname="eth3")[0]
226 ipr.addr("add", index=idx, address="172.25.21.47", prefixlen=24)
227 lldpd("-m", "eth3")
228 with namespaces(1):
229 out = lldpcli("-f", "keyvalue", "show", "neighbors")
230 assert out["lldp.eth0.chassis.mgmt-ip"] == [
231 "172.25.21.47",
232 "fe80::200:ff:fe00:4",
233 ]
234 assert out["lldp.eth0.chassis.mgmt-iface"] == ["4", "4"]
235
236
237 def test_change_management_address(lldpd1, lldpd, lldpcli, links, namespaces):
238 with namespaces(2):
239 with pyroute2.IPRoute() as ipr:
240 idx = ipr.link_lookup(ifname="eth1")[0]
241 ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24)
242 lldpd("-m", "192.168.*")
243 # We need a short TX interval as updating the IP address
244 # doesn't trigger a resend.
245 lldpcli("configure", "lldp", "tx-interval", "2")
246 with namespaces(1):
247 out = lldpcli("-f", "keyvalue", "show", "neighbors")
248 assert out["lldp.eth0.chassis.mgmt-ip"] == "192.168.14.2"
249 assert out["lldp.eth0.chassis.mgmt-iface"] == "2"
250 with namespaces(2):
251 with pyroute2.IPRoute() as ipr:
252 ipr.addr("del", index=idx, address="192.168.14.2", prefixlen=24)
253 ipr.addr("add", index=idx, address="192.168.14.5", prefixlen=24)
254 time.sleep(5)
255 with namespaces(1):
256 out = lldpcli("-f", "keyvalue", "show", "neighbors")
257 assert out["lldp.eth0.chassis.mgmt-ip"] == "192.168.14.5"
258 assert out["lldp.eth0.chassis.mgmt-iface"] == "2"
259
260
261 def test_portid_subtype_ifname(lldpd1, lldpd, lldpcli, namespaces):
262 with namespaces(2):
263 lldpd()
264 lldpcli("configure", "lldp", "portidsubtype", "ifname")
265 time.sleep(3)
266 with namespaces(1):
267 out = lldpcli("-f", "keyvalue", "show", "neighbors")
268 assert out["lldp.eth0.port.ifname"] == "eth1"
269 assert out["lldp.eth0.port.descr"] == "eth1"
270
271
272 def test_portid_subtype_with_alias(lldpd1, lldpd, lldpcli, links, namespaces):
273 with namespaces(2):
274 with pyroute2.IPRoute() as ipr:
275 idx = ipr.link_lookup(ifname="eth1")[0]
276 ipr.link("set", index=idx, ifalias="alias of eth1")
277 lldpd()
278 with namespaces(1):
279 out = lldpcli("-f", "keyvalue", "show", "neighbors")
280 assert out["lldp.eth0.port.ifname"] == "eth1"
281 assert out["lldp.eth0.port.descr"] == "alias of eth1"
282
283
284 def test_portid_subtype_macaddress(lldpd1, lldpd, lldpcli, links, namespaces):
285 with namespaces(2):
286 with pyroute2.IPRoute() as ipr:
287 idx = ipr.link_lookup(ifname="eth1")[0]
288 ipr.link("set", index=idx, ifalias="alias of eth1")
289 lldpd()
290 lldpcli("configure", "lldp", "portidsubtype", "macaddress")
291 time.sleep(3)
292 with namespaces(1):
293 out = lldpcli("-f", "keyvalue", "show", "neighbors")
294 assert out["lldp.eth0.port.mac"] == "00:00:00:00:00:02"
295 assert out["lldp.eth0.port.descr"] == "eth1"
296
297
298 def test_portid_subtype_local(lldpd1, lldpd, lldpcli, namespaces):
299 with namespaces(2):
300 lldpd()
301 lldpcli("configure", "lldp", "portidsubtype", "local", "localname")
302 time.sleep(3)
303 with namespaces(1):
304 out = lldpcli("-f", "keyvalue", "show", "neighbors")
305 assert out["lldp.eth0.port.local"] == "localname"
306 assert out["lldp.eth0.port.descr"] == "eth1"
307
308
309 def test_portid_subtype_local_with_description(lldpd1, lldpd, lldpcli, namespaces):
310 with namespaces(2):
311 lldpd()
312 lldpcli(
313 "configure",
314 "lldp",
315 "portidsubtype",
316 "local",
317 "localname",
318 "description",
319 "localdescription",
320 )
321 time.sleep(3)
322 with namespaces(1):
323 out = lldpcli("-f", "keyvalue", "show", "neighbors")
324 assert out["lldp.eth0.port.local"] == "localname"
325 assert out["lldp.eth0.port.descr"] == "localdescription"
326
327
328 def test_portdescription(lldpd1, lldpd, lldpcli, namespaces):
329 with namespaces(2):
330 lldpd()
331 lldpcli("configure", "lldp", "portdescription", "localdescription")
332 time.sleep(3)
333 with namespaces(1):
334 out = lldpcli("-f", "keyvalue", "show", "neighbors")
335 assert out["lldp.eth0.port.descr"] == "localdescription"
336
337
338 def test_portid_subtype_local_with_alias(lldpd1, lldpd, lldpcli, namespaces):
339 with namespaces(2):
340 with pyroute2.IPRoute() as ipr:
341 idx = ipr.link_lookup(ifname="eth1")[0]
342 ipr.link("set", index=idx, ifalias="alias of eth1")
343 lldpd()
344 lldpcli("configure", "lldp", "portidsubtype", "local", "localname")
345 time.sleep(3)
346 with namespaces(1):
347 out = lldpcli("-f", "keyvalue", "show", "neighbors")
348 assert out["lldp.eth0.port.local"] == "localname"
349 assert out["lldp.eth0.port.descr"] == "alias of eth1"
350
351
352 def test_port_status_txonly(lldpd, lldpcli, namespaces, links):
353 links(namespaces(1), namespaces(2))
354 with namespaces(1):
355 lldpd()
356 lldpcli("configure", "lldp", "status", "tx-only")
357 with namespaces(2):
358 lldpd()
359 with namespaces(1):
360 out = lldpcli("-f", "keyvalue", "show", "neighbors")
361 assert out == {}
362 lldpcli("update")
363 with namespaces(2):
364 out = lldpcli("-f", "keyvalue", "show", "neighbors")
365 assert out["lldp.eth1.chassis.mac"] == "00:00:00:00:00:01"
366
367
368 def test_port_status_rxonly(lldpd, lldpcli, namespaces, links):
369 links(namespaces(1), namespaces(2))
370 with namespaces(1):
371 lldpd()
372 lldpcli("configure", "lldp", "status", "rx-only")
373 with namespaces(2):
374 lldpd()
375 with namespaces(1):
376 out = lldpcli("-f", "keyvalue", "show", "neighbors")
377 assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:02"
378 lldpcli("update")
379 with namespaces(2):
380 out = lldpcli("-f", "keyvalue", "show", "neighbors")
381 assert out == {}
382
383
384 def test_port_status_rxandtx(lldpd, lldpcli, namespaces, links):
385 links(namespaces(1), namespaces(2))
386 with namespaces(1):
387 lldpd()
388 lldpcli("configure", "lldp", "status", "rx-and-tx") # noop
389 with namespaces(2):
390 lldpd()
391 with namespaces(1):
392 out = lldpcli("-f", "keyvalue", "show", "neighbors")
393 assert out["lldp.eth0.chassis.mac"] == "00:00:00:00:00:02"
394 lldpcli("update")
395 with namespaces(2):
396 out = lldpcli("-f", "keyvalue", "show", "neighbors")
397 assert out["lldp.eth1.chassis.mac"] == "00:00:00:00:00:01"
398
399
400 def test_port_status_disabled(lldpd, lldpcli, namespaces, links):
401 links(namespaces(1), namespaces(2))
402 with namespaces(1):
403 lldpd()
404 lldpcli("configure", "lldp", "status", "disabled")
405 with namespaces(2):
406 lldpd()
407 with namespaces(1):
408 out = lldpcli("-f", "keyvalue", "show", "neighbors")
409 assert out == {}
410 lldpcli("update")
411 with namespaces(2):
412 out = lldpcli("-f", "keyvalue", "show", "neighbors")
413 assert out == {}
414
415
416 def test_port_vlan_tx(lldpd1, lldpd, lldpcli, namespaces):
417 with namespaces(1):
418 lldpd()
419 lldpcli(
420 "configure",
421 "ports",
422 "eth0",
423 "lldp",
424 "vlan-tx",
425 "100",
426 "priority",
427 "5",
428 "dei",
429 "1",
430 )
431 out = lldpcli("-f", "keyvalue", "show", "interfaces", "ports", "eth0")
432 assert out["lldp.eth0.port.vlanTX.id"] == "100"
433 assert out["lldp.eth0.port.vlanTX.prio"] == "5"
434 assert out["lldp.eth0.port.vlanTX.dei"] == "1"
435 # unconfigure VLAN TX
436 lldpcli("unconfigure", "ports", "eth0", "lldp", "vlan-tx")
437 out = lldpcli("-f", "keyvalue", "show", "interfaces", "ports", "eth0")
438 assert "lldp.eth0.port.vlanTX.id" not in out
439 assert "lldp.eth0.port.vlanTX.prio" not in out
440 assert "lldp.eth0.port.vlanTX.dei" not in out
441
442
443 def test_set_interface_alias(lldpd1, lldpd, lldpcli, namespaces):
444 with namespaces(1):
445 lldpcli("configure", "system", "interface", "description")
446 with namespaces(2):
447 lldpd()
448 with namespaces(1):
449 with pyroute2.IPRoute() as ipr:
450 link = ipr.link("get", ifname="eth0")[0]
451 assert (
452 link.get_attr("IFLA_IFALIAS") == "lldpd: connected to ns-2.example.com"
453 )
454
455
456 def test_lldpdu_shutdown(lldpd, lldpcli, namespaces, links):
457 links(namespaces(1), namespaces(2))
458 links(namespaces(1), namespaces(2))
459 with namespaces(1):
460 lldpd()
461 # From https://github.com/lldpd/lldpd/issues/348
462 frm_fa01 = (
463 scapy.all.Ether(
464 src="04:fe:7f:00:00:01", dst=scapy.contrib.lldp.LLDP_NEAREST_BRIDGE_MAC
465 )
466 / scapy.contrib.lldp.LLDPDUChassisID(
467 subtype=scapy.contrib.lldp.LLDPDUChassisID.SUBTYPE_MAC_ADDRESS,
468 id=b"\x04\xfe\x7f\x00\x00\x00",
469 )
470 / scapy.contrib.lldp.LLDPDUPortID(
471 subtype=scapy.contrib.lldp.LLDPDUPortID.SUBTYPE_INTERFACE_NAME, id="Fa0/1"
472 )
473 / scapy.contrib.lldp.LLDPDUTimeToLive(ttl=65535)
474 / scapy.contrib.lldp.LLDPDUSystemName(
475 system_name="this info should not disappear"
476 )
477 / scapy.contrib.lldp.LLDPDUEndOfLLDPDU()
478 )
479 frm_fa01 = frm_fa01.build()
480 frm_fa01 = scapy.all.Ether(frm_fa01)
481
482 frm_fa02 = (
483 scapy.all.Ether(
484 src="04:fe:7f:00:00:02", dst=scapy.contrib.lldp.LLDP_NEAREST_BRIDGE_MAC
485 )
486 / scapy.contrib.lldp.LLDPDUChassisID(
487 subtype=scapy.contrib.lldp.LLDPDUChassisID.SUBTYPE_MAC_ADDRESS,
488 id=b"\x04\xfe\x7f\x00\x00\x00",
489 )
490 / scapy.contrib.lldp.LLDPDUPortID(
491 subtype=scapy.contrib.lldp.LLDPDUPortID.SUBTYPE_INTERFACE_NAME, id="Fa0/2"
492 )
493 / scapy.contrib.lldp.LLDPDUTimeToLive(ttl=65535)
494 / scapy.contrib.lldp.LLDPDUSystemName(
495 system_name="this info should not disappear"
496 )
497 / scapy.contrib.lldp.LLDPDUEndOfLLDPDU()
498 )
499 frm_fa02 = frm_fa02.build()
500 frm_fa02 = scapy.all.Ether(frm_fa02)
501
502 frm_shut_fa01 = (
503 scapy.all.Ether(
504 src="04:fe:7f:00:00:01", dst=scapy.contrib.lldp.LLDP_NEAREST_BRIDGE_MAC
505 )
506 / scapy.contrib.lldp.LLDPDUChassisID(
507 subtype=scapy.contrib.lldp.LLDPDUChassisID.SUBTYPE_MAC_ADDRESS,
508 id=b"\x04\xfe\x7f\x00\x00\x00",
509 )
510 / scapy.contrib.lldp.LLDPDUPortID(
511 subtype=scapy.contrib.lldp.LLDPDUPortID.SUBTYPE_INTERFACE_NAME, id="Fa0/1"
512 )
513 / scapy.contrib.lldp.LLDPDUTimeToLive(ttl=0)
514 / scapy.contrib.lldp.LLDPDUEndOfLLDPDU()
515 )
516 frm_shut_fa01 = frm_shut_fa01.build()
517 frm_shut_fa01 = scapy.all.Ether(frm_shut_fa01)
518
519 with namespaces(2):
520 scapy.all.sendp(frm_fa01, iface="eth1")
521 scapy.all.sendp(frm_fa02, iface="eth3")
522 time.sleep(2)
523 with namespaces(1):
524 out = lldpcli("-f", "keyvalue", "show", "neighbors")
525 del out["lldp.eth0.age"]
526 del out["lldp.eth2.age"]
527 assert out == {
528 "lldp.eth0.via": "LLDP",
529 "lldp.eth0.rid": "1",
530 "lldp.eth0.chassis.mac": "04:fe:7f:00:00:00",
531 "lldp.eth0.chassis.name": "this info should not disappear",
532 "lldp.eth0.port.ifname": "Fa0/1",
533 "lldp.eth0.port.ttl": "65535",
534 "lldp.eth2.via": "LLDP",
535 "lldp.eth2.rid": "1",
536 "lldp.eth2.chassis.mac": "04:fe:7f:00:00:00",
537 "lldp.eth2.chassis.name": "this info should not disappear",
538 "lldp.eth2.port.ifname": "Fa0/2",
539 "lldp.eth2.port.ttl": "65535",
540 }
541 with namespaces(2):
542 scapy.all.sendp(frm_shut_fa01, iface="eth1")
543 time.sleep(2)
544 with namespaces(1):
545 out = lldpcli("-f", "keyvalue", "show", "neighbors")
546 del out["lldp.eth2.age"]
547 assert out == {
548 "lldp.eth2.via": "LLDP",
549 "lldp.eth2.rid": "1",
550 "lldp.eth2.chassis.mac": "04:fe:7f:00:00:00",
551 "lldp.eth2.chassis.name": "this info should not disappear",
552 "lldp.eth2.port.ifname": "Fa0/2",
553 "lldp.eth2.port.ttl": "65535",
554 }