assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
write_test_footer(tc_name)
# Verifying RIB routes
dut = "r3"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r4"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r3"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r3"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r4"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r4"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
# Verifying RIB routes
dut = "r4"
protocol = "bgp"
- result = verify_rib(tgen, "ipv4", dut, input_dict_1, protocol=protocol)
+ result = verify_rib(tgen, "ipv4", dut, input_dict_1, protocol=protocol, expected=False)
assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
return True
-def verify_rib(tgen, addr_type, dut, input_dict, next_hop=None, protocol=None):
- "Wrapper function for `_verify_rib` that tries multiple time to get results."
+def verify_rib(tgen, addr_type, dut, input_dict, next_hop=None, protocol=None, expected=True):
+ """
+ Wrapper function for `_verify_rib` that tries multiple time to get results.
+
+ When the expected result is `False` we actually should expect for an string instead.
+ """
# Use currying to hide the parameters and create a test function.
test_func = partial(_verify_rib, tgen, addr_type, dut, input_dict, next_hop, protocol)
# Call the test function and expect it to return True, otherwise try it again.
- _, result = topotest.run_and_expect(test_func, True, count=20, wait=6)
+ if expected is True:
+ _, result = topotest.run_and_expect(test_func, True, count=20, wait=6)
+ else:
+ _, result = topotest.run_and_expect_type(test_func, str, count=20, wait=6)
# Return as normal.
return result