int r2-eth0
ip address 192.168.1.2/24
!
+int r2-eth1
+ ip address 192.168.2.2/24
+!
router bgp 65000
no bgp ebgp-requires-policy
neighbor 192.168.1.1 remote-as internal
neighbor 192.168.1.1 timers 1 3
neighbor 192.168.1.1 timers connect 1
+ neighbor 192.168.2.1 remote-as external
+ neighbor 192.168.2.1 timers 1 3
+ neighbor 192.168.2.1 timers connect 1
!
--- /dev/null
+!
+int r3-eth0
+ ip address 192.168.2.1/24
+!
+int r3-eth1
+ ip address 192.168.3.1/24
+!
+router bgp 65003
+ no bgp ebgp-requires-policy
+ neighbor 192.168.2.2 remote-as external
+ neighbor 192.168.2.2 timers 1 3
+ neighbor 192.168.2.2 timers connect 1
+ neighbor 192.168.3.2 remote-as external
+ neighbor 192.168.3.2 timers 1 3
+ neighbor 192.168.3.2 timers connect 1
+!
def setup_module(mod):
- topodef = {"s1": ("r1", "r2")}
+ topodef = {"s1": ("r1", "r2"), "s2": ("r2", "r3"), "s3": ("r3", "r4")}
tgen = Topogen(topodef, mod.__name__)
tgen.start_topology()
pytest.skip(tgen.errors)
r2 = tgen.gears["r2"]
+ r3 = tgen.gears["r3"]
+ r4 = tgen.gears["r4"]
- def _bgp_converge():
- output = json.loads(r2.vtysh_cmd("show bgp ipv4 unicast json detail"))
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast json detail"))
expected = {
"routes": {
"10.10.10.40/32": {
test_func = functools.partial(
_bgp_converge,
+ r2,
)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
- assert result is None, "Can't see link bandwidths as expected"
+ assert result is None, "r2 (iBGP) should see link bandwidth extended communities"
+
+ test_func = functools.partial(
+ _bgp_converge,
+ r3,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert (
+ result is None
+ ), "r3 (eBGP) should see link bandwidth extended communities (including non-transitive)"
+
+ def _bgp_check_non_transitive_extended_communities():
+ output = json.loads(r4.vtysh_cmd("show bgp ipv4 unicast json detail"))
+ expected = {
+ "routes": {
+ "10.10.10.40/32": {
+ "paths": [
+ {
+ "extendedIpv6Community": None,
+ }
+ ]
+ },
+ "10.10.10.100/32": {
+ "paths": [
+ {
+ "extendedIpv6Community": {
+ "string": "LB:65000:12500000000 (100.000 Gbps)",
+ }
+ }
+ ]
+ },
+ "10.10.10.200/32": {
+ "paths": [
+ {
+ "extendedIpv6Community": {
+ "string": "LB:65000:25000000000 (200.000 Gbps)",
+ }
+ }
+ ]
+ },
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(
+ _bgp_check_non_transitive_extended_communities,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert (
+ result is None
+ ), "r4 (eBGP) should NOT see non-transitive link bandwidth extended communities"
if __name__ == "__main__":