]> git.ipfire.org Git - thirdparty/lldpd.git/blob - tests/integration/test_dot1.py
tests: replace integration test by py.test+namespace tests
[thirdparty/lldpd.git] / tests / integration / test_dot1.py
1 import pytest
2
3
4 @pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
5 reason="Dot1 not supported")
6 class TestLldpDot1(object):
7
8 def test_one_vlan(self, lldpd1, lldpd, lldpcli, namespaces, links):
9 with namespaces(2):
10 links.vlan('vlan100', 100, 'eth1')
11 lldpd()
12 with namespaces(1):
13 out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
14 assert out['lldp.eth0.vlan'] == 'vlan100'
15 assert out['lldp.eth0.vlan.vlan-id'] == '100'
16
17 def test_several_vlans(self, lldpd1, lldpd, lldpcli, namespaces, links):
18 with namespaces(2):
19 for v in [100, 200, 300, 4000]:
20 links.vlan('vlan{}'.format(v), v, 'eth1')
21 lldpd()
22 with namespaces(1):
23 out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
24 # We know that lldpd is walking interfaces in index order
25 assert out['lldp.eth0.vlan'] == \
26 ['vlan100', 'vlan200', 'vlan300', 'vlan4000']
27 assert out['lldp.eth0.vlan.vlan-id'] == \
28 ['100', '200', '300', '4000']
29
30 # TODO: PI and PPVID (but lldpd doesn't know how to generate them)