From 16a1a7e64118ac91e16efdf56fc48525bd3d6eba Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 8 Dec 2022 19:08:04 +0100 Subject: [PATCH] tests: use prefixlen instead of mask with pyroute2 --- tests/integration/test_basic.py | 16 ++++++++-------- tests/integration/test_protocols.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index d237f219..9dd34803 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -195,7 +195,7 @@ def test_forced_known_management_address(lldpd1, lldpd, lldpcli, namespaces): with namespaces(2): with pyroute2.IPRoute() as ipr: idx = ipr.link_lookup(ifname="eth1")[0] - ipr.addr("add", index=idx, address="192.168.14.2", mask=24) + ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24) lldpd("-m", "192.168.14.2") with namespaces(1): out = lldpcli("-f", "keyvalue", "show", "neighbors") @@ -207,8 +207,8 @@ def test_management_address(lldpd1, lldpd, lldpcli, links, namespaces): with namespaces(2): with pyroute2.IPRoute() as ipr: idx = ipr.link_lookup(ifname="eth1")[0] - ipr.addr("add", index=idx, address="192.168.14.2", mask=24) - ipr.addr("add", index=idx, address="172.25.21.47", mask=24) + ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24) + ipr.addr("add", index=idx, address="172.25.21.47", prefixlen=24) lldpd("-m", "172.25.*") with namespaces(1): out = lldpcli("-f", "keyvalue", "show", "neighbors") @@ -221,9 +221,9 @@ def test_management_interface(lldpd1, lldpd, lldpcli, links, namespaces): with namespaces(2): with pyroute2.IPRoute() as ipr: idx = ipr.link_lookup(ifname="eth1")[0] - ipr.addr("add", index=idx, address="192.168.14.2", mask=24) + ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24) idx = ipr.link_lookup(ifname="eth3")[0] - ipr.addr("add", index=idx, address="172.25.21.47", mask=24) + ipr.addr("add", index=idx, address="172.25.21.47", prefixlen=24) lldpd("-m", "eth3") with namespaces(1): out = lldpcli("-f", "keyvalue", "show", "neighbors") @@ -238,7 +238,7 @@ def test_change_management_address(lldpd1, lldpd, lldpcli, links, namespaces): with namespaces(2): with pyroute2.IPRoute() as ipr: idx = ipr.link_lookup(ifname="eth1")[0] - ipr.addr("add", index=idx, address="192.168.14.2", mask=24) + ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24) lldpd("-m", "192.168.*") # We need a short TX interval as updating the IP address # doesn't trigger a resend. @@ -249,8 +249,8 @@ def test_change_management_address(lldpd1, lldpd, lldpcli, links, namespaces): assert out["lldp.eth0.chassis.mgmt-iface"] == "2" with namespaces(2): with pyroute2.IPRoute() as ipr: - ipr.addr("del", index=idx, address="192.168.14.2", mask=24) - ipr.addr("add", index=idx, address="192.168.14.5", mask=24) + ipr.addr("del", index=idx, address="192.168.14.2", prefixlen=24) + ipr.addr("add", index=idx, address="192.168.14.5", prefixlen=24) time.sleep(5) with namespaces(1): out = lldpcli("-f", "keyvalue", "show", "neighbors") diff --git a/tests/integration/test_protocols.py b/tests/integration/test_protocols.py index 6169cdfe..871649ae 100644 --- a/tests/integration/test_protocols.py +++ b/tests/integration/test_protocols.py @@ -68,7 +68,7 @@ def test_sonmp(lldpd, lldpcli, links, namespaces): with namespaces(2): with pyroute2.IPRoute() as ipr: idx = ipr.link_lookup(ifname="eth1")[0] - ipr.addr("add", index=idx, address="192.168.14.2", mask=24) + ipr.addr("add", index=idx, address="192.168.14.2", prefixlen=24) lldpd("-ss", "-ll") with namespaces(1): out = lldpcli("-f", "keyvalue", "show", "neighbors", "details") -- 2.39.5