#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
#
# Copyright (c) 2020 by VMware, Inc. ("VMware")
# Used Copyright (c) 2018 by Network Device Education Foundation,
# Inc. ("NetDEF") in this file.
#
-# Permission to use, copy, modify, and/or distribute this software
-# for any purpose with or without fee is hereby granted, provided
-# that the above copyright notice and this permission notice appear
-# in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-#
"""
Following tests are covered to test PIM BSM processing basic functionality:
reset_config_on_routers,
run_frr_cmd,
required_linux_kernel_version,
- topo_daemons,
verify_rib,
)
# Required linux kernel version for this suite to run.
result = required_linux_kernel_version("4.15")
if result is not True:
- pytest.skip("Kernel requirements are not met")
+ pytest.skip("Kernel version should be >= 4.15")
testsuite_run_time = time.asctime(time.localtime(time.time()))
logger.info("Testsuite start time: {}".format(testsuite_run_time))
topo = tgen.json_topo
# ... and here it calls Mininet initialization functions.
- # get list of daemons needs to be started for this suite.
- daemons = topo_daemons(tgen, topo)
-
# Starting topology, create tmp files which are loaded to routers
# to start daemons and then start routers
- start_topology(tgen, daemons)
+ start_topology(tgen)
# Don"t run this test if we have any failure.
if tgen.routers_have_failure():
# Add static routes
input_dict = {
- fhr: {"static_routes": [{"network": bsr_route, "next_hop": next_hop}]},
rp: {"static_routes": [{"network": bsr_route, "next_hop": next_hop_rp}]},
lhr: {"static_routes": [{"network": bsr_route, "next_hop": next_hop_lhr}]},
}
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
# Verifying static routes are installed
- for dut, _nexthop in zip([fhr, rp, lhr], [next_hop, next_hop_rp, next_hop_lhr]):
+ for dut, _nexthop in zip([rp, lhr], [next_hop_rp, next_hop_lhr]):
input_routes = {dut: input_dict[dut]}
- result = verify_rib(tgen, "ipv4", dut, input_routes, _nexthop)
+ result = verify_rib(
+ tgen, "ipv4", dut, input_routes, _nexthop, protocol="static"
+ )
assert result is True, "Testcase {} : Failed \n Error {}".format(
tc_name, result
)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
# Verifying static routes are installed
- result = verify_rib(tgen, "ipv4", fhr, input_dict, next_hop_fhr)
+ result = verify_rib(
+ tgen, "ipv4", fhr, input_dict, next_hop_fhr, protocol="static"
+ )
assert result is True, "Testcase {} : Failed \n Error {}".format(
tc_name, result
)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
# Verifying static routes are installed
- result = verify_rib(tgen, "ipv4", lhr, input_dict, next_hop_lhr)
+ result = verify_rib(
+ tgen, "ipv4", lhr, input_dict, next_hop_lhr, protocol="static"
+ )
assert result is True, "Testcase {} : Failed \n Error {}".format(
tc_name, result
)
result = verify_mroutes(
tgen, dut, src_addr, GROUP_ADDRESS, iif, oil, retry_timeout=20, expected=False
)
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "mroute installed in l1 \n Error: {}".format(
- tc_name, result
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "Expected: [{}]: mroute (S, G) should not be installed \n "
+ "Found: {}".format(tc_name, dut, result)
)
# Send BSM again to configure rp
# Verify bsr state in FHR
step("Verify if b2 is not chosen as bsr in f1")
result = verify_pim_bsr(tgen, topo, "f1", bsr_ip2, expected=False)
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "b2 is chosen as bsr in f1 \n Error: {}".format(
- tc_name, result
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "Expected: [{}]: b2 should not be chosen as bsr \n "
+ "Found: {}".format(tc_name, "f1", result)
)
# Verify if b1 is still chosen as bsr