Merge pull request #7782 from kuldeepkash/multicast_pim_sm_topo2

tests: Add new scenarios to test multicast-pim-sm
This commit is contained in:
Donald Sharp 2021-01-21 09:45:38 -05:00 committed by GitHub
commit 8cf7ab7539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6114 additions and 49 deletions

View File

@ -539,7 +539,8 @@ def configure_pim_force_expire(tgen, topo, input_dict, build=False):
#############################################
# Verification APIs
#############################################
def verify_pim_neighbors(tgen, topo, dut=None, iface=None):
@retry(attempts=6, wait=2, return_is_str=True)
def verify_pim_neighbors(tgen, topo, dut=None, iface=None, nbr_ip=None):
"""
Verify all PIM neighbors are up and running, config is verified
using "show ip pim neighbor" cli
@ -550,10 +551,11 @@ def verify_pim_neighbors(tgen, topo, dut=None, iface=None):
* `topo` : json file data
* `dut` : dut info
* `iface` : link for which PIM nbr need to check
* `nbr_ip` : neighbor ip of interface
Usage
-----
result = verify_pim_neighbors(tgen, topo, dut, link)
result = verify_pim_neighbors(tgen, topo, dut, iface=ens192, nbr_ip=20.1.1.2)
Returns
-------
@ -1530,8 +1532,8 @@ def verify_pim_interface_traffic(tgen, input_dict):
return output_dict
@retry(attempts=31, wait=2, return_is_str=True)
def verify_pim_interface(tgen, topo, dut):
@retry(attempts=21, wait=2, return_is_str=True)
def verify_pim_interface(tgen, topo, dut, interface=None, interface_ip=None):
"""
Verify all PIM interface are up and running, config is verified
using "show ip pim interface" cli
@ -1541,10 +1543,12 @@ def verify_pim_interface(tgen, topo, dut):
* `tgen`: topogen object
* `topo` : json file data
* `dut` : device under test
* `interface` : interface name
* `interface_ip` : interface ip address
Usage
-----
result = verify_pim_interfacetgen, topo, dut)
result = verify_pim_interfacetgen, topo, dut, interface=ens192, interface_ip=20.1.1.1)
Returns
-------
@ -1560,10 +1564,28 @@ def verify_pim_interface(tgen, topo, dut):
logger.info("[DUT: %s]: Verifying PIM interface status:", dut)
rnode = tgen.routers()[dut]
show_ip_pim_interface_json = run_frr_cmd(
rnode, "show ip pim interface json", isjson=True
)
show_ip_pim_interface_json = rnode.\
vtysh_cmd("show ip pim interface json", isjson=True)
logger.info("show_ip_pim_interface_json: \n %s",
show_ip_pim_interface_json)
if interface_ip:
if interface in show_ip_pim_interface_json:
pim_intf_json = show_ip_pim_interface_json[interface]
if pim_intf_json["address"] != interface_ip:
errormsg = ("[DUT %s]: PIM interface "
"ip is not correct "
"[FAILED]!! Expected : %s, Found : %s"
%(dut, pim_intf_json["address"],interface_ip))
return errormsg
else:
logger.info("[DUT %s]: PIM interface "
"ip is correct "
"[Passed]!! Expected : %s, Found : %s"
%(dut, pim_intf_json["address"],interface_ip))
return True
else:
for destLink, data in topo["routers"][dut]["links"].items():
if "type" in data and data["type"] == "loopback":
continue
@ -1573,43 +1595,24 @@ def verify_pim_interface(tgen, topo, dut):
pim_intf_ip = data["ipv4"].split("/")[0]
if pim_interface in show_ip_pim_interface_json:
pim_intf_json = show_ip_pim_interface_json[pim_interface]
pim_intf_json = show_ip_pim_interface_json\
[pim_interface]
# Verifying PIM interface
if (
pim_intf_json["address"] != pim_intf_ip
and pim_intf_json["state"] != "up"
):
errormsg = (
"[DUT %s]: PIM interface: %s "
if pim_intf_json["address"] != pim_intf_ip and \
pim_intf_json["state"] != "up":
errormsg = ("[DUT %s]: PIM interface: %s "
"PIM interface ip: %s, status check "
"[FAILED]!! Expected : %s, Found : %s"
% (
dut,
pim_interface,
pim_intf_ip,
pim_interface,
pim_intf_json["state"],
)
)
%(dut, pim_interface, pim_intf_ip,
pim_interface, pim_intf_json["state"]))
return errormsg
logger.info(
"[DUT %s]: PIM interface: %s, "
logger.info("[DUT %s]: PIM interface: %s, "
"interface ip: %s, status: %s"
" [PASSED]!!",
dut,
pim_interface,
pim_intf_ip,
pim_intf_json["state"],
)
else:
errormsg = (
"[DUT %s]: PIM interface: %s "
"PIM interface ip: %s, is not present "
% (dut, pim_interface, pim_intf_ip,)
)
return errormsg
dut, pim_interface, pim_intf_ip,
pim_intf_json["state"])
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
return True
@ -1846,7 +1849,6 @@ def clear_ip_mroute_verify(tgen, dut):
rnode = tgen.routers()[dut]
# sleep(60)
logger.info("[DUT: %s]: IP mroutes uptime before clear", dut)
mroute_json_1 = run_frr_cmd(rnode, "show ip mroute json", isjson=True)
@ -3387,3 +3389,62 @@ def verify_multicast_flag_state(tgen, dut, src_address, group_addresses, flag):
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
return True
@retry(attempts=21, wait=2, return_is_str=True)
def verify_igmp_interface(tgen, topo, dut, igmp_iface, interface_ip):
"""
Verify all IGMP interface are up and running, config is verified
using "show ip igmp interface" cli
Parameters
----------
* `tgen`: topogen object
* `topo` : json file data
* `dut` : device under test
* `igmp_iface` : interface name
* `interface_ip` : interface ip address
Usage
-----
result = verify_igmp_interface(tgen, topo, dut, igmp_iface, interface_ip)
Returns
-------
errormsg(str) or True
"""
logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name))
for router in tgen.routers():
if router != dut:
continue
logger.info("[DUT: %s]: Verifying PIM interface status:",
dut)
rnode = tgen.routers()[dut]
show_ip_igmp_interface_json = \
run_frr_cmd(rnode, "show ip igmp interface json", isjson=True)
if igmp_iface in show_ip_igmp_interface_json:
igmp_intf_json = show_ip_igmp_interface_json[igmp_iface]
# Verifying igmp interface
if igmp_intf_json["address"] != interface_ip:
errormsg = ("[DUT %s]: igmp interface ip is not correct "
"[FAILED]!! Expected : %s, Found : %s"
%(dut, igmp_intf_json["address"], interface_ip))
return errormsg
logger.info("[DUT %s]: igmp interface: %s, "
"interface ip: %s"
" [PASSED]!!",
dut, igmp_iface, interface_ip)
else:
errormsg = ("[DUT %s]: igmp interface: %s "
"igmp interface ip: %s, is not present "
%(dut, igmp_iface, interface_ip))
return errormsg
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
return True

View File

@ -0,0 +1,140 @@
{
"ipv4base": "10.0.0.0",
"ipv4mask": 24,
"link_ip_start": {"ipv4": "10.0.0.0", "v4mask": 24, "link_local": "disable"},
"lo_prefix": {"ipv4": "1.0.", "v4mask": 32},
"routers": {
"l1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"i1": {"ipv4": "auto", "pim": "enable"},
"i6": {"ipv4": "auto", "pim": "enable"},
"i7": {"ipv4": "auto", "pim": "enable"},
"r2": {"ipv4": "auto", "pim": "enable"},
"c1": {"ipv4": "auto", "pim": "enable"}
},
"igmp": {
"interfaces": {
"l1-i1-eth1" :{
"igmp":{
"version": "2"
}
}
}
},
"static_routes": [{
"network": ["1.0.5.17/32", "10.0.5.0/24", "10.0.6.0/24", "10.0.9.0/24", "1.0.3.5/32"],
"next_hop": "10.0.12.2"
},
{
"network": ["1.0.1.2/32", "1.0.3.5/32", "10.0.1.0/24", "1.0.2.2/32", "10.0.4.0/24"],
"next_hop": "10.0.2.1"
}]
},
"r2": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"l1": {"ipv4": "auto", "pim": "enable"},
"f1": {"ipv4": "auto", "pim": "enable"},
"i3": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["10.0.5.0/24", "10.0.6.0/24", "1.0.2.2/32", "10.0.1.0/24", "1.0.3.5/32"],
"next_hop": "10.0.7.1"
},
{
"network": ["1.0.1.2/32", "10.0.8.0/24", "10.0.10.0/24", "10.0.4.0/24", "10.0.11.0/24", "10.0.1.0/24"],
"next_hop": "10.0.12.1"
}]
},
"f1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"r2": {"ipv4": "auto", "pim": "enable"},
"c2": {"ipv4": "auto", "pim": "enable"},
"i2": {"ipv4": "auto", "pim": "enable"},
"i8": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["1.0.5.17/32", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24", "10.0.12.0/24"],
"next_hop": "10.0.7.2"
},
{
"network": ["1.0.2.2/32", "10.0.1.0/24", "10.0.4.0/24", "1.0.1.2/32"],
"next_hop": "10.0.3.1"
}]
},
"c1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"c2": {"ipv4": "auto", "pim": "enable"},
"l1": {"ipv4": "auto", "pim": "enable"},
"i4": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["1.0.5.17/32", "10.0.6.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24"],
"next_hop": "10.0.2.2"
},
{
"network": ["10.0.5.0/24", "10.0.7.0/24", "1.0.3.5/32", "10.0.6.0/24", "1.0.2.2/32", "10.0.1.0/24", "10.0.4.0/24"],
"next_hop": "10.0.0.2"
}]
},
"c2": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"c1": {"ipv4": "auto", "pim": "enable"},
"f1": {"ipv4": "auto", "pim": "enable"},
"i5": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["1.0.5.17/32", "10.0.5.0/24", "10.0.6.0/24", "10.0.7.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24"],
"next_hop": "10.0.3.2"
},
{
"network": ["1.0.1.2/32", "10.0.4.0/24"],
"next_hop": "10.0.0.1"
}]
},
"i1": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i2": {
"links": {
"f1": {"ipv4": "auto"}
}
},
"i3": {
"links": {
"r2": {"ipv4": "auto"}
}
},
"i4": {
"links": {
"c1": {"ipv4": "auto"}
}
},
"i5": {
"links": {
"c2": {"ipv4": "auto"}
}
},
"i6": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i7": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i8": {
"links": {
"f1": {"ipv4": "auto"}
}
}
}
}

View File

@ -0,0 +1,137 @@
{
"ipv4base": "10.0.0.0",
"ipv4mask": 24,
"link_ip_start": {"ipv4": "10.0.0.0", "v4mask": 24, "link_local": "disable"},
"lo_prefix": {"ipv4": "1.0.", "v4mask": 32},
"routers": {
"l1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"i1": {"ipv4": "auto", "pim": "enable"},
"i6": {"ipv4": "auto", "pim": "enable"},
"i7": {"ipv4": "auto", "pim": "enable"},
"r2": {"ipv4": "auto", "pim": "enable"},
"c1": {"ipv4": "auto", "pim": "enable"}
},
"igmp": {
"interfaces": {
"l1-i1-eth1" :{
"igmp":{
"version": "2"
}
}
}
},
"static_routes": [{
"network": ["10.0.4.0/24", "10.0.3.1/24"],
"next_hop": "10.0.12.2"
},
{
"network": ["10.0.1.2/24"],
"next_hop": "10.0.2.1"
}]
},
"r2": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"l1": {"ipv4": "auto", "pim": "enable"},
"f1": {"ipv4": "auto", "pim": "enable"},
"i3": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["10.0.4.0/24","10.0.3.1/24"],
"next_hop": "10.0.7.1"
},
{
"network": ["1.0.4.11/32", "10.0.2.1/24", "10.0.1.2/24"],
"next_hop": "10.0.12.1"
}]
},
"f1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"r2": {"ipv4": "auto", "pim": "enable"},
"c2": {"ipv4": "auto", "pim": "enable"},
"i2": {"ipv4": "auto", "pim": "enable"},
"i8": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["10.0.4.0/24","10.0.3.1/24"],
"next_hop": "10.0.3.1"
},
{
"network": ["1.0.4.11/32", "10.0.2.1/24", "10.0.1.2/24"],
"next_hop": "10.0.7.2"
}]
},
"c1": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"c2": {"ipv4": "auto", "pim": "enable"},
"l1": {"ipv4": "auto", "pim": "enable"},
"i4": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [{
"network": ["1.0.4.11/32","10.0.4.2/24", "10.0.3.1/24"],
"next_hop": "10.0.2.2"
}]
},
"c2": {
"links": {
"lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"},
"c1": {"ipv4": "auto", "pim": "enable"},
"f1": {"ipv4": "auto", "pim": "enable"},
"i5": {"ipv4": "auto", "pim": "enable"}
},
"static_routes": [
{
"network": ["1.0.4.11/32", "10.0.2.1/24", "10.0.1.2/24"],
"next_hop": "10.0.3.2"
}]
},
"i1": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i2": {
"links": {
"f1": {"ipv4": "auto"}
}
},
"i3": {
"links": {
"r2": {"ipv4": "auto"}
}
},
"i4": {
"links": {
"c1": {"ipv4": "auto"}
}
},
"i5": {
"links": {
"c2": {"ipv4": "auto"}
}
},
"i6": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i7": {
"links": {
"l1": {"ipv4": "auto"}
}
},
"i8": {
"links": {
"f1": {"ipv4": "auto"}
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff