From 96c715f3024cf55fbfe5e4e6792506fcae242fa8 Mon Sep 17 00:00:00 2001 From: ckishimo Date: Tue, 23 Nov 2021 22:38:02 +0100 Subject: tests: verify no ospf6 neighbors Update verify_ospf6_neighbor() so we can verify there are no neighbors in a given router input_dict = { "r0": { "ospf6": { "neighbors": [] } } } result = verify_ospf6_neighbor(tgen, topo, dut, input_dict) Signed-off-by: ckishimo --- tests/topotests/lib/ospf.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/topotests/lib/ospf.py') diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index 52872ae1a1..92d29ad1ab 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -782,6 +782,16 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False) } result = verify_ospf6_neighbor(tgen, topo, dut, input_dict, lan=True) + 3. To check there are no neighbors. + input_dict = { + "r0": { + "ospf6": { + "neighbors": [] + } + } + } + result = verify_ospf6_neighbor(tgen, topo, dut, input_dict) + Returns ------- True or False (Error Message) @@ -812,6 +822,19 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False) ospf_data_list = input_dict[router]["ospf6"] ospf_nbr_list = ospf_data_list["neighbors"] + # Check if looking for no neighbors + if ospf_nbr_list == []: + if show_ospf_json["neighbors"] == []: + logger.info("[DUT: {}] OSPF6 no neighbors found".format(router)) + return True + else: + errormsg = ( + "[DUT: {}] OSPF6 active neighbors found, expected None".format( + router + ) + ) + return errormsg + for ospf_nbr, nbr_data in ospf_nbr_list.items(): try: -- cgit v1.2.3