Skip to content

Commit

Permalink
tests: improve topotest bgp_dont_capability_negotiate
Browse files Browse the repository at this point in the history
add some steps for testing of add [no]neighbor dont-capability-negotiate
hostname command support.

Signed-off-by: Francois Dumontet <[email protected]>
  • Loading branch information
fdumontet6WIND committed Jan 22, 2024
1 parent 3d2f4df commit 44bf664
Showing 1 changed file with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def _bgp_check_fqdn(fqdn=None):
step("Wait to converge")
test_func = functools.partial(bgp_converge, r1)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Can't converge with dont-capability-negotiate"
assert result is None, "Can't converge with all capabilities"

step("Make sure FQDN capability is set")
test_func = functools.partial(_bgp_check_fqdn, "r2")
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "FQDN capability enabled, but r1 can't see it"
Expand All @@ -150,6 +151,47 @@ def _bgp_check_fqdn(fqdn=None):
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "FQDN capability disabled, but we still have a hostname"

step("re enable sending any capability from r2")
r2.vtysh_cmd(
"""
configure terminal
router bgp 65002
address-family ipv4 unicast
no neighbor 192.168.1.1 dont-capability-negotiate
end
clear bgp 192.168.1.1
"""
)
step("Wait to converge")
tgen = get_topogen()
test_func = functools.partial(bgp_converge, r1)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Can't converge with all capabilities re enabled"
step("Make sure FQDN capability is r2")
test_func = functools.partial(_bgp_check_fqdn, "r2")
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "FQDN capability enabled, but r1 can't see it"

step("Disable sending hostname capability")
r2.vtysh_cmd(
"""
configure terminal
router bgp 65002
no neighbor 192.168.1.1 capability hostname
end
clear bgp 192.168.1.1
"""
)
step("Wait to converge")
tgen = get_topogen()
test_func = functools.partial(bgp_converge, r1)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Can't converge with no capability hostname"

step("Make sure FQDN capability is reset")
test_func = functools.partial(_bgp_check_fqdn)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "FQDN capability disabled, but we still have a hostname"

if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
Expand Down

0 comments on commit 44bf664

Please sign in to comment.