Skip to content

Commit

Permalink
topotests: use the Role field when testing ospf6
Browse files Browse the repository at this point in the history
To handle the future change of naming in the ospf6 state,
align the ospf6 tests with the new 'Role' nickname instead
of the old 'state' value.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND authored and fdumontet6WIND committed Dec 5, 2023
1 parent 2f6dbf8 commit e54d248
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 31 deletions.
14 changes: 7 additions & 7 deletions tests/topotests/lib/ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,16 +779,16 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False)
"ospf6": {
"neighbors": {
"r1": {
"state": "Full",
"role": "DR"
"role": "Full",
"nbrState": "DR"
},
"r2": {
"state": "Full",
"role": "DROther"
"role": "Full",
"nbrState": "DROther"
},
"r3": {
"state": "Full",
"role": "DROther"
"role": "Full",
"nbrState": "DROther"
}
}
}
Expand Down Expand Up @@ -970,7 +970,7 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False)
for (index, d) in enumerate(show_ospf_json["neighbors"])
)
try:
nh_state = get_index_val.get(neighbor_ip)["state"]
nh_state = get_index_val.get(neighbor_ip)["role"]
intf_state = get_index_val.get(neighbor_ip)["ifState"]
except TypeError:
errormsg = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def expect_neighbor_full(router, neighbor):
topotest.router_json_cmp,
tgen.gears[router],
"show ipv6 ospf6 neighbor json",
{"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
{"neighbors": [{"neighborId": neighbor, "role": "Full"}]},
)
_, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"neighborId":"2.2.2.2",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt2",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{
"neighborId":"3.3.3.3",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt3",
"interfaceState":"PointToPoint"
},
{
"neighborId":"1.1.1.1",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt1",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
{
"neighborId":"2.2.2.2",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt2",
"interfaceState":"PointToPoint"
},
{
"neighborId":"4.4.4.4",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt4",
"interfaceState":"PointToPoint"
},
{
"neighborId":"6.6.6.6",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt6",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{
"neighborId":"3.3.3.3",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt3",
"interfaceState":"PointToPoint"
},
{
"neighborId":"5.5.5.5",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt5",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"neighborId":"4.4.4.4",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt4",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{
"neighborId":"3.3.3.3",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt3",
"interfaceState":"PointToPoint"
},
{
"neighborId":"7.7.7.7",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt7",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"neighborId":"6.6.6.6",
"priority":1,
"state":"Full",
"role":"Full",
"ifState":"PointToPoint",
"interfaceName":"eth-rt6",
"interfaceState":"PointToPoint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def expect_neighbor_full(router, neighbor):
topotest.router_json_cmp,
tgen.gears[router],
"show ipv6 ospf6 neighbor json",
{"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
{"neighbors": [{"neighborId": neighbor, "role": "Full"}]},
)
_, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
Expand Down
7 changes: 1 addition & 6 deletions tests/topotests/ospf6_topo1/test_ospf6_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def expect_neighbor_full(router, neighbor):
topotest.router_json_cmp,
tgen.gears[router],
"show ipv6 ospf6 neighbor json",
{"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
{"neighbors": [{"neighborId": neighbor, "role": "Full"}]},
)
_, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
Expand Down Expand Up @@ -220,7 +220,6 @@ def compare_show_ipv6(rname, expected):


def test_ospfv3_routingTable():

tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip("skipped because of router(s) failure")
Expand All @@ -243,7 +242,6 @@ def test_ospfv3_routingTable():


def test_linux_ipv6_kernel_routingTable():

tgen = get_topogen()

if tgen.routers_have_failure():
Expand Down Expand Up @@ -335,7 +333,6 @@ def test_linux_ipv6_kernel_routingTable():


def test_ospfv3_routingTable_write_multiplier():

tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip("skipped because of router(s) failure")
Expand Down Expand Up @@ -365,7 +362,6 @@ def test_ospfv3_routingTable_write_multiplier():


def test_shutdown_check_stderr():

tgen = get_topogen()

if tgen.routers_have_failure():
Expand Down Expand Up @@ -413,7 +409,6 @@ def test_shutdown_check_memleak():


if __name__ == "__main__":

# To suppress tracebacks, either use the following pytest call or
# add "--tb=no" to cli
# retval = pytest.main(["-s", "--tb=no"])
Expand Down
3 changes: 1 addition & 2 deletions tests/topotests/ospf6_topo2/test_ospf6_topo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def setup_module(mod):

router_list = tgen.routers()
for rname, router in router_list.items():

daemon_file = "{}/{}/zebra.conf".format(CWD, rname)
if os.path.isfile(daemon_file):
router.load_config(TopoRouter.RD_ZEBRA, daemon_file)
Expand Down Expand Up @@ -157,7 +156,7 @@ def expect_neighbor_full(router, neighbor):
topotest.router_json_cmp,
tgen.gears[router],
"show ipv6 ospf6 neighbor json",
{"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
{"neighbors": [{"neighborId": neighbor, "role": "Full"}]},
)
_, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/ospf_topo1/test_ospf_topo1.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def expect_ospfv3_neighbor_full(router, neighbor):
topotest.router_json_cmp,
tgen.gears[router],
"show ipv6 ospf6 neighbor json",
{"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
{"neighbors": [{"neighborId": neighbor, "role": "Full"}]},
)
_, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
Expand Down
2 changes: 1 addition & 1 deletion tests/topotests/ospf_topo2/test_ospf_topo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def wait_for_ospf(router, ip_version, neighbors, timeout=60):
if ip_version == 4:
filter = {"converged": "Full"}
else:
filter = {"state": "Full"}
filter = {"role": "Full"}

def is_match(neighbor):
for k, v in filter.items():
Expand Down

0 comments on commit e54d248

Please sign in to comment.