summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/ospf.py
diff options
context:
space:
mode:
authorckishimo <carles.kishimoto@gmail.com>2021-11-23 22:38:02 +0100
committerckishimo <carles.kishimoto@gmail.com>2021-11-25 12:59:09 +0100
commit96c715f3024cf55fbfe5e4e6792506fcae242fa8 (patch)
tree76dcb58998b4c1b3ddd5333cbe9da551ead833f7 /tests/topotests/lib/ospf.py
parenta581473fbde8e790e74ce64ec2c39d37190113c8 (diff)
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 <carles.kishimoto@gmail.com>
Diffstat (limited to 'tests/topotests/lib/ospf.py')
-rw-r--r--tests/topotests/lib/ospf.py23
1 files changed, 23 insertions, 0 deletions
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: