]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: verify no ospf6 neighbors
authorckishimo <carles.kishimoto@gmail.com>
Tue, 23 Nov 2021 21:38:02 +0000 (22:38 +0100)
committerckishimo <carles.kishimoto@gmail.com>
Thu, 25 Nov 2021 11:59:09 +0000 (12:59 +0100)
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>
tests/topotests/lib/ospf.py

index 52872ae1a1558bbf3cd4d470effbfdfb5838c997..92d29ad1ab37a3fd42d5c126a63152191652ce15 100644 (file)
@@ -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: