mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
tests: Adding ospfv3 asbr summarisation
Total cases 9. Authored-by: nguggarigoud <nguggarigoud@vmware.com> Signed-off-by: nguggarigoud <nguggarigoud@vmware.com> Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
This commit is contained in:
parent
ad21f6c285
commit
8a86be272f
@ -1491,7 +1491,7 @@ def verify_ospf_database(tgen, topo, dut, input_dict, expected=True):
|
|||||||
|
|
||||||
|
|
||||||
@retry(retry_timeout=20)
|
@retry(retry_timeout=20)
|
||||||
def verify_ospf_summary(tgen, topo, dut, input_dict, expected=True):
|
def verify_ospf_summary(tgen, topo, dut, input_dict, ospf=None, expected=True):
|
||||||
"""
|
"""
|
||||||
This API is to verify ospf routes by running
|
This API is to verify ospf routes by running
|
||||||
show ip ospf interface command.
|
show ip ospf interface command.
|
||||||
@ -1502,7 +1502,6 @@ def verify_ospf_summary(tgen, topo, dut, input_dict, expected=True):
|
|||||||
* `topo` : topology descriptions
|
* `topo` : topology descriptions
|
||||||
* `dut`: device under test
|
* `dut`: device under test
|
||||||
* `input_dict` : Input dict data, required when configuring from testcase
|
* `input_dict` : Input dict data, required when configuring from testcase
|
||||||
* `expected` : expected results from API, by-default True
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
@ -1522,18 +1521,30 @@ def verify_ospf_summary(tgen, topo, dut, input_dict, expected=True):
|
|||||||
True or False (Error Message)
|
True or False (Error Message)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger.debug("Entering lib API: verify_ospf_summary()")
|
logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name))
|
||||||
result = False
|
result = False
|
||||||
router = dut
|
router = dut
|
||||||
|
|
||||||
logger.info("Verifying OSPF summary on router %s:", router)
|
logger.info("Verifying OSPF summary on router %s:", router)
|
||||||
|
|
||||||
if "ospf" not in topo["routers"][dut]:
|
|
||||||
errormsg = "[DUT: {}] OSPF is not configured on the router.".format(router)
|
|
||||||
return errormsg
|
|
||||||
|
|
||||||
rnode = tgen.routers()[dut]
|
rnode = tgen.routers()[dut]
|
||||||
show_ospf_json = run_frr_cmd(rnode, "show ip ospf summary detail json", isjson=True)
|
|
||||||
|
if ospf:
|
||||||
|
if 'ospf6' not in topo['routers'][dut]:
|
||||||
|
errormsg = "[DUT: {}] OSPF6 is not configured on the router.".format(
|
||||||
|
router)
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
show_ospf_json = run_frr_cmd(rnode, "show ipv6 ospf summary detail json",
|
||||||
|
isjson=True)
|
||||||
|
else:
|
||||||
|
if 'ospf' not in topo['routers'][dut]:
|
||||||
|
errormsg = "[DUT: {}] OSPF is not configured on the router.".format(
|
||||||
|
router)
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
show_ospf_json = run_frr_cmd(rnode, "show ip ospf summary detail json",
|
||||||
|
isjson=True)
|
||||||
|
|
||||||
# Verifying output dictionary show_ospf_json is empty or not
|
# Verifying output dictionary show_ospf_json is empty or not
|
||||||
if not bool(show_ospf_json):
|
if not bool(show_ospf_json):
|
||||||
@ -1542,35 +1553,31 @@ def verify_ospf_summary(tgen, topo, dut, input_dict, expected=True):
|
|||||||
|
|
||||||
# To find neighbor ip type
|
# To find neighbor ip type
|
||||||
ospf_summary_data = input_dict
|
ospf_summary_data = input_dict
|
||||||
|
|
||||||
|
if ospf:
|
||||||
|
show_ospf_json = show_ospf_json['default']
|
||||||
|
|
||||||
for ospf_summ, summ_data in ospf_summary_data.items():
|
for ospf_summ, summ_data in ospf_summary_data.items():
|
||||||
if ospf_summ not in show_ospf_json:
|
if ospf_summ not in show_ospf_json:
|
||||||
continue
|
continue
|
||||||
summary = ospf_summary_data[ospf_summ]["Summary address"]
|
summary = ospf_summary_data[ospf_summ]['Summary address']
|
||||||
|
|
||||||
if summary in show_ospf_json:
|
if summary in show_ospf_json:
|
||||||
for summ in summ_data:
|
for summ in summ_data:
|
||||||
if summ_data[summ] == show_ospf_json[summary][summ]:
|
if summ_data[summ] == show_ospf_json[summary][summ]:
|
||||||
logger.info(
|
logger.info("[DUT: %s] OSPF summary %s:%s is %s",
|
||||||
"[DUT: %s] OSPF summary %s:%s is %s",
|
router, summary, summ, summ_data[summ])
|
||||||
router,
|
|
||||||
summary,
|
|
||||||
summ,
|
|
||||||
summ_data[summ],
|
|
||||||
)
|
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
errormsg = (
|
errormsg = ("[DUT: {}] OSPF summary {} : {} is {}, "
|
||||||
"[DUT: {}] OSPF summary {}:{} is %s, "
|
"Expected is {}".format(router, summary, summ,show_ospf_json[
|
||||||
"Expected is {}".format(
|
summary][summ], summ_data[summ] ))
|
||||||
router, summary, summ, show_ospf_json[summary][summ]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return errormsg
|
return errormsg
|
||||||
|
|
||||||
logger.debug("Exiting API: verify_ospf_summary()")
|
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@retry(retry_timeout=30)
|
@retry(retry_timeout=30)
|
||||||
def verify_ospf6_rib(tgen, dut, input_dict, next_hop=None,
|
def verify_ospf6_rib(tgen, dut, input_dict, next_hop=None,
|
||||||
tag=None, metric=None, fib=None):
|
tag=None, metric=None, fib=None):
|
||||||
|
@ -0,0 +1,198 @@
|
|||||||
|
{
|
||||||
|
"address_types": [
|
||||||
|
"ipv6"
|
||||||
|
],
|
||||||
|
"ipv6base": "fd00::",
|
||||||
|
"ipv6mask": 64,
|
||||||
|
"link_ip_start": {
|
||||||
|
"ipv6": "fd00::",
|
||||||
|
"v6mask": 64
|
||||||
|
},
|
||||||
|
"lo_prefix": {
|
||||||
|
"ipv6": "2001:db8:f::",
|
||||||
|
"v6mask": 128
|
||||||
|
},
|
||||||
|
"routers": {
|
||||||
|
"r0": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r1": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4,
|
||||||
|
"network": "point-to-point"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3-link0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"description": "DummyIntftoR3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ospf6": {
|
||||||
|
"router_id": "100.1.1.0",
|
||||||
|
"neighbors": {
|
||||||
|
"r1": {},
|
||||||
|
"r2": {},
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r1": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3-link0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"description": "DummyIntftoR3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ospf6": {
|
||||||
|
"router_id": "100.1.1.1",
|
||||||
|
"neighbors": {
|
||||||
|
"r0": {},
|
||||||
|
"r2": {},
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r1": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ospf6": {
|
||||||
|
"router_id": "100.1.1.2",
|
||||||
|
"neighbors": {
|
||||||
|
"r1": {},
|
||||||
|
"r0": {},
|
||||||
|
"r3": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r3": {
|
||||||
|
"links": {
|
||||||
|
"lo": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"type": "loopback"
|
||||||
|
},
|
||||||
|
"r0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4,
|
||||||
|
"network": "point-to-point"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r0-link0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"description": "DummyIntftoR0"
|
||||||
|
},
|
||||||
|
"r1": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r2": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0",
|
||||||
|
"hello_interval": 1,
|
||||||
|
"dead_interval": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"r1-link0": {
|
||||||
|
"ipv6": "auto",
|
||||||
|
"description": "DummyIntftoR1",
|
||||||
|
"ospf6": {
|
||||||
|
"area": "0.0.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ospf6": {
|
||||||
|
"router_id": "100.1.1.3",
|
||||||
|
"neighbors": {
|
||||||
|
"r0": {},
|
||||||
|
"r1": {},
|
||||||
|
"r2": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user