summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorckishimo <carles.kishimoto@gmail.com>2021-01-25 14:36:38 +0100
committerckishimo <carles.kishimoto@gmail.com>2021-01-26 11:23:22 +0100
commit2718dd02515b97f12e85e27a466641862726a785 (patch)
treee30cc286c21480f7145eaa68124a9c85fee2389b /tests
parenttests: fix create_router_ospf6 to use ospf6 instead of ospf (diff)
downloadfrr-2718dd02515b97f12e85e27a466641862726a785.tar.xz
frr-2718dd02515b97f12e85e27a466641862726a785.zip
tests: support ospf6d area config
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/lib/ospf.py42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py
index e7e1209bc..1d756de19 100644
--- a/tests/topotests/lib/ospf.py
+++ b/tests/topotests/lib/ospf.py
@@ -94,7 +94,7 @@ def create_router_ospf(tgen, topo, input_dict=None, build=False, load_config=Tru
return result
-def __create_ospf_global(tgen, input_dict, router, build=False, load_config=True, ospf='ospf'):
+def __create_ospf_global(tgen, input_dict, router, build=False, load_config=True, ospf="ospf"):
"""
Helper API to create ospf global configuration.
@@ -107,6 +107,32 @@ def __create_ospf_global(tgen, input_dict, router, build=False, load_config=True
* `load_config` : Loading the config to router this is set as True.
* `ospf` : either 'ospf' or 'ospf6'
+ Usage
+ -----
+ input_dict = {
+ "routers": {
+ "r1": {
+ "links": {
+ "r3": {
+ "ipv6": "2013:13::1/64",
+ "ospf6": {
+ "hello_interval": 1,
+ "dead_interval": 4,
+ "network": "point-to-point"
+ }
+ }
+ },
+ "ospf6": {
+ "router_id": "1.1.1.1",
+ "neighbors": {
+ "r3": {
+ "area": "1.1.1.1"
+ }
+ }
+ }
+ }
+ }
+
Returns
-------
True or False
@@ -175,6 +201,20 @@ def __create_ospf_global(tgen, input_dict, router, build=False, load_config=True
cmd = "no {}".format(cmd)
config_data.append(cmd)
+ # area interface information for ospf6d only
+ if ospf == "ospf6":
+ area_iface = ospf_data.setdefault("neighbors", {})
+ if area_iface:
+ for neighbor in area_iface:
+ if "area" in area_iface[neighbor]:
+ iface = input_dict[router]["links"][neighbor]["interface"]
+ cmd = "interface {} area {}".format(
+ iface, area_iface[neighbor]["area"]
+ )
+ if area_iface[neighbor].setdefault("delete", False):
+ cmd = "no {}".format(cmd)
+ config_data.append(cmd)
+
# summary information
summary_data = ospf_data.setdefault("summary-address", {})
if summary_data: