diff --git a/tests/topotests/bgp_remote_as_auto/r1/frr.conf b/tests/topotests/bgp_remote_as_auto/r1/frr.conf index aec0e76a3fd3..2f1bcd275f1a 100644 --- a/tests/topotests/bgp_remote_as_auto/r1/frr.conf +++ b/tests/topotests/bgp_remote_as_auto/r1/frr.conf @@ -2,6 +2,9 @@ int r1-eth0 ip address 192.168.1.1/24 ! +int r1-eth1 + ip address 192.168.14.1/24 +! router bgp 65001 no bgp ebgp-requires-policy no bgp network import-check @@ -11,6 +14,9 @@ router bgp 65001 neighbor 192.168.1.3 remote-as auto neighbor 192.168.1.3 timers 1 3 neighbor 192.168.1.3 timers connect 1 + neighbor r1-eth1 interface remote-as auto + neighbor r1-eth1 timers 1 3 + neighbor r1-eth1 timers connect 1 address-family ipv4 unicast network 10.0.0.1/32 exit-address-family diff --git a/tests/topotests/bgp_remote_as_auto/r4/frr.conf b/tests/topotests/bgp_remote_as_auto/r4/frr.conf new file mode 100644 index 000000000000..e280a6c6e884 --- /dev/null +++ b/tests/topotests/bgp_remote_as_auto/r4/frr.conf @@ -0,0 +1,10 @@ +! +int r4-eth0 + ip address 192.168.14.4/24 +! +router bgp 65004 + no bgp ebgp-requires-policy + neighbor r4-eth0 interface remote-as auto + neighbor r4-eth0 timers 1 3 + neighbor r4-eth0 timers connect 1 +! diff --git a/tests/topotests/bgp_remote_as_auto/test_bgp_remote_as_auto.py b/tests/topotests/bgp_remote_as_auto/test_bgp_remote_as_auto.py index b932920e09d4..1db6d98a42e7 100644 --- a/tests/topotests/bgp_remote_as_auto/test_bgp_remote_as_auto.py +++ b/tests/topotests/bgp_remote_as_auto/test_bgp_remote_as_auto.py @@ -23,7 +23,7 @@ def setup_module(mod): - topodef = {"s1": ("r1", "r2", "r3")} + topodef = {"s1": ("r1", "r2", "r3"), "s2": ("r1", "r4")} tgen = Topogen(topodef, mod.__name__) tgen.start_topology() @@ -49,11 +49,18 @@ def test_bgp_remote_as_auto(): r1 = tgen.gears["r1"] r2 = tgen.gears["r2"] r3 = tgen.gears["r3"] + r4 = tgen.gears["r4"] def _bgp_converge(): output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast summary json")) expected = { "peers": { + "r1-eth1": { + "hostname": "r4", + "remoteAs": 65004, + "localAs": 65001, + "state": "Established", + }, "192.168.1.2": { "hostname": "r2", "remoteAs": 65001, @@ -124,6 +131,30 @@ def _bgp_converge_external(): _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assert result is None, "Can't see automatic eBGP peering" + def _bgp_converge_external_unnumbered(): + output = json.loads(r4.vtysh_cmd("show bgp ipv4 unicast 10.0.0.1/32 json")) + expected = { + "paths": [ + { + "aspath": { + "string": "65001", + }, + "valid": True, + "peer": { + "hostname": "r1", + "type": "external", + }, + } + ] + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial( + _bgp_converge_external_unnumbered, + ) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert result is None, "Can't see automatic unnumbered eBGP peering" + if __name__ == "__main__": args = ["-s"] + sys.argv[1:]