assert out['lldp.eth0.port.descr'] == 'eth1'
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])
def test_bridge_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links, when):
['100', '200', '300']
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])
def test_bond(lldpd1, lldpd, lldpcli, namespaces, links, when):
assert out['lldp.eth0.port.mac'] == '00:00:00:00:00:02'
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])
def test_team(lldpd1, lldpd, lldpcli, namespaces, links, when):
assert out['lldp.eth0.port.mac'] == '00:00:00:00:00:02'
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])
def test_bond_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links, when):
['300', '301', '302', '303']
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])
def test_just_vlan(lldpd1, lldpd, lldpcli, namespaces, links, when):
assert out['lldp.eth0.vlan.vlan-id'] == ['300', '400']
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
@pytest.mark.parametrize('kind', ['plain', 'bridge', 'bond'])
def test_remove_vlan(lldpd1, lldpd, lldpcli, namespaces, links, kind):
assert out['lldp.eth0.vlan.vlan-id'] == ['400', '500']
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_unenslave_bond(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
assert 'lldp.eth0.port.aggregation' not in out
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
def test_unenslave_bond_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
assert out['lldp.eth0.port.descr'] == 'eth1'
-@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot1' not in config.lldpd.features",
reason="Dot1 not supported")
def test_down_then_up_with_vlan(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
TTL: 120
-------------------------------------------------------------------------------
""")], ids=["neighbors", "interfaces"])
-def test_text_output(lldpd1, lldpd, lldpcli, namespaces, uname, command,
- expected):
+def test_text_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
+ command, expected):
with namespaces(2):
lldpd()
with namespaces(1):
assert result.returncode == 0
out = result.stdout.decode('ascii')
- if 'Dot3' in pytest.config.lldpd.features:
+ if 'Dot3' in request.config.lldpd.features:
dot3 = """
PMD autoneg: supported: no, enabled: no
MAU oper type: 10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable"""
uname=uname,
dot3=dot3)
-@pytest.mark.skipif('JSON' not in pytest.config.lldpcli.outputs,
+@pytest.mark.skipif("'JSON' not in config.lldpcli.outputs",
reason="JSON not supported")
@pytest.mark.parametrize("command, expected", [
("neighbors",
"descr": "eth0"},
"ttl": {
"ttl": "120"}}}}})], ids=["neighbors", "interfaces"])
-def test_json_output(lldpd1, lldpd, lldpcli, namespaces, uname, command,
- expected):
+def test_json_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
+ command, expected):
with namespaces(2):
lldpd()
with namespaces(1):
descr = "Spectacular GNU/Linux 2016 {}".format(uname)
expected['lldp']['interface']['eth0']['chassis'][name]["descr"] = descr
- if 'Dot3' in pytest.config.lldpd.features:
+ if 'Dot3' in request.config.lldpd.features:
expected['lldp']['interface']['eth0']['port']['auto-negotiation'] = {
"enabled": False,
"supported": False,
assert j == expected
-@pytest.mark.skipif('JSON' not in pytest.config.lldpcli.outputs,
+@pytest.mark.skipif("'JSON' not in config.lldpcli.outputs",
reason="JSON not supported")
@pytest.mark.parametrize("command, expected", [
("neighbors",
"ttl": [{"ttl": "120"}]
}]}
]})], ids=["neighbors", "interfaces"])
-def test_json0_output(lldpd1, lldpd, lldpcli, namespaces, uname, command,
- expected):
+def test_json0_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
+ command, expected):
with namespaces(2):
lldpd()
with namespaces(1):
descr = "Spectacular GNU/Linux 2016 {}".format(uname)
expected['lldp'][0]['interface'][0]['chassis'][0]["descr"][0]['value'] = descr
- if 'Dot3' in pytest.config.lldpd.features:
+ if 'Dot3' in request.config.lldpd.features:
expected['lldp'][0]['interface'][0]['port'][0]['auto-negotiation'] = [{
"enabled": False,
"supported": False,
assert j == expected
-@pytest.mark.skipif('XML' not in pytest.config.lldpcli.outputs,
+@pytest.mark.skipif("'XML' not in config.lldpcli.outputs",
reason="XML not supported")
@pytest.mark.parametrize("command, expected", [
("neighbors",
</interface>
</lldp>
""")], ids=["neighbors", "interfaces"])
-def test_xml_output(lldpd1, lldpd, lldpcli, namespaces, uname, command,
- expected):
+def test_xml_output(request, lldpd1, lldpd, lldpcli, namespaces, uname,
+ command, expected):
with namespaces(2):
lldpd()
with namespaces(1):
"capability[@type='Router']")[0].attrib['enabled']
station = xml.findall("./interface[1]/chassis/"
"capability[@type='Station']")[0].attrib['enabled']
- if 'Dot3' in pytest.config.lldpd.features:
+ if 'Dot3' in request.config.lldpd.features:
dot3 = """
<auto-negotiation enabled="no" label="PMD autoneg" supported="no">
<current label="MAU oper type">10GigBaseCX4 - X copper over 8 pair 100-Ohm balanced cable</current>
assert ET.tostring(xml) == ET.tostring(expected)
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_configure_one_port(lldpd1, lldpd, lldpcli, namespaces, links):
links(namespaces(1), namespaces(2))
assert out['lldp.eth2.port.power.device-type'] == 'PSE'
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_new_port_take_default(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
assert out['lldp.eth3.port.power.device-type'] == 'PSE'
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_port_keep_configuration_when_down(lldpd, lldpcli, namespaces, links):
with namespaces(1):
assert out['lldp.eth3.port.power.device-type'] == 'PSE'
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_port_forget_configuration(lldpd, lldpcli,
namespaces, links):
assert 'lldp.eth3.port.power.device-type' not in out
-@pytest.mark.skipif('Dot3' not in pytest.config.lldpd.features,
+@pytest.mark.skipif("'Dot3' not in config.lldpd.features",
reason="Dot3 not supported")
def test_port_keep_configuration_of_permanent_ports(lldpd, lldpcli,
namespaces, links):
assert got == expected
-@pytest.mark.skipif('XML' not in pytest.config.lldpcli.outputs,
+@pytest.mark.skipif("'XML' not in config.lldpcli.outputs",
reason="XML not supported")
def test_watch_xml(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
assert ET.tostring(got) == ET.tostring(expected)
-@pytest.mark.skipif('JSON' not in pytest.config.lldpcli.outputs,
+@pytest.mark.skipif("'JSON' not in config.lldpcli.outputs",
reason="JSON not supported")
def test_watch_json(lldpd1, lldpd, lldpcli, namespaces, links):
with namespaces(2):
("configure lldp portidsubtype ifname", "lldp-portid-type", "ifname"),
pytest.param("unconfigure med fast-start",
"lldpmed-faststart", "no",
- marks=pytest.mark.skipif('LLDP-MED'
- not in pytest.config.lldpd.features,
- reason="LLDP-MED not supported")),
+ marks=pytest.mark.skipif(
+ "'LLDP-MED' not in config.lldpd.features",
+ reason="LLDP-MED not supported")),
pytest.param("configure med fast-start tx-interval 2",
"lldpmed-faststart-interval", 2,
- marks=pytest.mark.skipif('LLDP-MED'
- not in pytest.config.lldpd.features,
- reason="LLDP-MED not supported")),
+ marks=pytest.mark.skipif(
+ "'LLDP-MED' not in config.lldpd.features",
+ reason="LLDP-MED not supported")),
("configure system interface pattern eth*", "iface-pattern", "eth*"),
("configure system interface permanent eth*",
"perm-iface-pattern", "eth*"),