summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/debian/Dockerfile17
-rwxr-xr-xtests/topotests/bgp-ecmp-topo2/ebgp_ecmp_topo2.json234
-rwxr-xr-xtests/topotests/bgp-ecmp-topo2/ibgp_ecmp_topo2.json234
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf8
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine1/show_ip_route.json_ref162
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine1/staticd.conf1
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine1/zebra.conf9
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine2/bgpd.conf8
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine2/show_ip_route.json_ref162
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine2/staticd.conf1
-rw-r--r--tests/topotests/bgp_rr_ibgp/spine2/zebra.conf9
-rwxr-xr-xtests/topotests/bgp_rr_ibgp/test_bgp_rr_ibgp_topo1.py245
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf5
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor1/show_ip_route.json_ref169
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor1/staticd.conf1
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor1/zebra.conf12
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf5
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor2/show_ip_route.json_ref169
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor2/staticd.conf1
-rw-r--r--tests/topotests/bgp_rr_ibgp/tor2/zebra.conf13
-rw-r--r--tests/topotests/lib/bgp.py4
-rw-r--r--tests/topotests/lib/common_config.py80
-rw-r--r--tests/topotests/pytest.ini2
23 files changed, 1406 insertions, 145 deletions
diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile
index 6ffdd0ccb3..3f830348bc 100644
--- a/docker/debian/Dockerfile
+++ b/docker/debian/Dockerfile
@@ -1,13 +1,20 @@
FROM debian:buster
MAINTAINER Rob Gil (rob@rem5.com)
+
ENV DEBIAN_FRONTEND noninteractive
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
-RUN apt-get update
-RUN apt-get install -y libpcre3-dev apt-transport-https ca-certificates curl wget logrotate \
- libc-ares2 libjson-c3 vim systemd procps libreadline7 gnupg2 lsb-release apt-utils
+
+RUN apt-get update && \
+ apt-get install -y libpcre3-dev apt-transport-https ca-certificates curl wget logrotate \
+ libc-ares2 libjson-c3 vim procps libreadline7 gnupg2 lsb-release apt-utils && \
+ rm -rf /var/lib/apt/lists/*
+
RUN curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add -
RUN echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) frr-stable | tee -a /etc/apt/sources.list.d/frr.list
-RUN apt-get update
-RUN apt-get install -y frr frr-pythontools
+
+RUN apt-get update && \
+ apt-get install -y frr frr-pythontools && \
+ rm -rf /var/lib/apt/lists/*
+
ADD docker-start /usr/sbin/docker-start
ENTRYPOINT ["/usr/sbin/docker-start"]
diff --git a/tests/topotests/bgp-ecmp-topo2/ebgp_ecmp_topo2.json b/tests/topotests/bgp-ecmp-topo2/ebgp_ecmp_topo2.json
index 50797f130a..34f11c0a29 100755
--- a/tests/topotests/bgp-ecmp-topo2/ebgp_ecmp_topo2.json
+++ b/tests/topotests/bgp-ecmp-topo2/ebgp_ecmp_topo2.json
@@ -564,6 +564,16 @@
"ipv6": "auto"
}
},
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ },
"bgp": {
"local_as": "300",
"address_family": {
@@ -620,38 +630,198 @@
"neighbor": {
"r2": {
"dest_link": {
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {},
- "r3-link8": {},
- "r3-link9": {},
- "r3-link10": {},
- "r3-link11": {},
- "r3-link12": {},
- "r3-link13": {},
- "r3-link14": {},
- "r3-link15": {},
- "r3-link16": {},
- "r3-link17": {},
- "r3-link18": {},
- "r3-link19": {},
- "r3-link20": {},
- "r3-link21": {},
- "r3-link22": {},
- "r3-link23": {},
- "r3-link24": {},
- "r3-link25": {},
- "r3-link26": {},
- "r3-link27": {},
- "r3-link28": {},
- "r3-link29": {},
- "r3-link30": {},
- "r3-link31": {},
- "r3-link32": {}
+ "r3-link1": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link2": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link3": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link4": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link5": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link6": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link7": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link8": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link9": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link10": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link11": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link12": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link13": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link14": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link15": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link16": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link17": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link18": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link19": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link20": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link21": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link22": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link23": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link24": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link25": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link26": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link27": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link28": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link29": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link30": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link31": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link32": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
}
}
}
diff --git a/tests/topotests/bgp-ecmp-topo2/ibgp_ecmp_topo2.json b/tests/topotests/bgp-ecmp-topo2/ibgp_ecmp_topo2.json
index 9010b8c273..9eea9073c7 100755
--- a/tests/topotests/bgp-ecmp-topo2/ibgp_ecmp_topo2.json
+++ b/tests/topotests/bgp-ecmp-topo2/ibgp_ecmp_topo2.json
@@ -574,6 +574,16 @@
"ipv6": "auto"
}
},
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ },
"bgp": {
"local_as": "100",
"address_family": {
@@ -630,38 +640,198 @@
"neighbor": {
"r2": {
"dest_link": {
- "r3-link1": {},
- "r3-link2": {},
- "r3-link3": {},
- "r3-link4": {},
- "r3-link5": {},
- "r3-link6": {},
- "r3-link7": {},
- "r3-link8": {},
- "r3-link9": {},
- "r3-link10": {},
- "r3-link11": {},
- "r3-link12": {},
- "r3-link13": {},
- "r3-link14": {},
- "r3-link15": {},
- "r3-link16": {},
- "r3-link17": {},
- "r3-link18": {},
- "r3-link19": {},
- "r3-link20": {},
- "r3-link21": {},
- "r3-link22": {},
- "r3-link23": {},
- "r3-link24": {},
- "r3-link25": {},
- "r3-link26": {},
- "r3-link27": {},
- "r3-link28": {},
- "r3-link29": {},
- "r3-link30": {},
- "r3-link31": {},
- "r3-link32": {}
+ "r3-link1": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link2": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link3": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link4": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link5": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link6": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link7": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link8": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link9": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link10": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link11": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link12": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link13": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link14": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link15": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link16": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link17": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link18": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link19": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link20": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link21": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link22": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link23": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link24": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link25": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link26": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link27": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link28": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link29": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link30": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link31": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ },
+ "r3-link32": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
}
}
}
diff --git a/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf b/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf
new file mode 100644
index 0000000000..29a119c291
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf
@@ -0,0 +1,8 @@
+hostname spine1
+router bgp 99
+ neighbor 192.168.2.1 remote-as internal
+ neighbor 192.168.4.2 remote-as internal
+ address-family ipv4 uni
+ redistribute connected
+ neighbor 192.168.2.1 route-reflector-client
+ neighbor 192.168.4.2 route-reflector-client
diff --git a/tests/topotests/bgp_rr_ibgp/spine1/show_ip_route.json_ref b/tests/topotests/bgp_rr_ibgp/spine1/show_ip_route.json_ref
new file mode 100644
index 0000000000..552e96ddb9
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine1/show_ip_route.json_ref
@@ -0,0 +1,162 @@
+{
+ "192.168.1.0\/24":[
+ {
+ "prefix":"192.168.1.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.2.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"spine1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.2.0\/24":[
+ {
+ "prefix":"192.168.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"spine1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.3.0\/24":[
+ {
+ "prefix":"192.168.3.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.4.2",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"spine1-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.4.0\/24":[
+ {
+ "prefix":"192.168.4.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"spine1-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.5.0\/24":[
+ {
+ "prefix":"192.168.5.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.2.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"spine1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.6.0\/24":[
+ {
+ "prefix":"192.168.6.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.4.2",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"spine1-eth1",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_rr_ibgp/spine1/staticd.conf b/tests/topotests/bgp_rr_ibgp/spine1/staticd.conf
new file mode 100644
index 0000000000..6d8f0952d3
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine1/staticd.conf
@@ -0,0 +1 @@
+hostname spine1
diff --git a/tests/topotests/bgp_rr_ibgp/spine1/zebra.conf b/tests/topotests/bgp_rr_ibgp/spine1/zebra.conf
new file mode 100644
index 0000000000..ea25462d53
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine1/zebra.conf
@@ -0,0 +1,9 @@
+hostname spine1
+ip forwarding
+ipv6 forwarding
+
+int spine1-eth0
+ ip addr 192.168.2.3/24
+
+int spine1-eth1
+ ip addr 192.168.4.3/24
diff --git a/tests/topotests/bgp_rr_ibgp/spine2/bgpd.conf b/tests/topotests/bgp_rr_ibgp/spine2/bgpd.conf
new file mode 100644
index 0000000000..a865b388ac
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine2/bgpd.conf
@@ -0,0 +1,8 @@
+hostname spine2
+router bgp 99
+ neighbor 192.168.5.1 remote-as internal
+ neighbor 192.168.6.2 remote-as internal
+ address-family ipv4 uni
+ redistribute connected
+ neighbor 192.168.5.1 route-reflector-client
+ neighbor 192.168.6.2 route-reflector-client
diff --git a/tests/topotests/bgp_rr_ibgp/spine2/show_ip_route.json_ref b/tests/topotests/bgp_rr_ibgp/spine2/show_ip_route.json_ref
new file mode 100644
index 0000000000..c428a8832f
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine2/show_ip_route.json_ref
@@ -0,0 +1,162 @@
+{
+ "192.168.1.0\/24":[
+ {
+ "prefix":"192.168.1.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.5.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"spine2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.2.0\/24":[
+ {
+ "prefix":"192.168.2.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.5.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"spine2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.3.0\/24":[
+ {
+ "prefix":"192.168.3.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.6.2",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"spine2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.4.0\/24":[
+ {
+ "prefix":"192.168.4.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.6.2",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"spine2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.5.0\/24":[
+ {
+ "prefix":"192.168.5.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"spine2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.6.0\/24":[
+ {
+ "prefix":"192.168.6.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"spine2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_rr_ibgp/spine2/staticd.conf b/tests/topotests/bgp_rr_ibgp/spine2/staticd.conf
new file mode 100644
index 0000000000..3ee14d262c
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine2/staticd.conf
@@ -0,0 +1 @@
+hostname spine2
diff --git a/tests/topotests/bgp_rr_ibgp/spine2/zebra.conf b/tests/topotests/bgp_rr_ibgp/spine2/zebra.conf
new file mode 100644
index 0000000000..a06681fbc4
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/spine2/zebra.conf
@@ -0,0 +1,9 @@
+hostname spine2
+ip forwarding
+ipv6 forwarding
+
+int spine2-eth0
+ ip addr 192.168.5.4/24
+
+int spine2-eth1
+ ip addr 192.168.6.4/24
diff --git a/tests/topotests/bgp_rr_ibgp/test_bgp_rr_ibgp_topo1.py b/tests/topotests/bgp_rr_ibgp/test_bgp_rr_ibgp_topo1.py
new file mode 100755
index 0000000000..c28394a7a7
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/test_bgp_rr_ibgp_topo1.py
@@ -0,0 +1,245 @@
+#!/usr/bin/env python
+
+#
+# test_bgp_rr_ibgp_topo1.py
+#
+# Copyright (c) 2019 by
+# Cumulus Networks, Inc.
+# Donald Sharp
+#
+# 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 NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF 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.
+#
+
+"""
+test_bgp_rr_ibgp_topo1.py: Testing IBGP with RR and no IGP
+
+
+ In a leaf/spine topology with only IBGP connections, where
+ the same network is being redistributed at multiple points
+ in the network ( say a redistribute connected at both leaf and spines )
+ we end up in a state where zebra gets very confused.
+
+ eva# show ip route
+ Codes: K - kernel route, C - connected, S - static, R - RIP,
+ O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
+ T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
+ F - PBR, f - OpenFabric,
+ > - selected route, * - FIB route, q - queued route, r - rejected route
+
+ C>* 192.168.1.0/24 is directly connected, tor1-eth0, 00:00:30
+ C>* 192.168.2.0/24 is directly connected, tor1-eth1, 00:00:30
+ B 192.168.3.0/24 [200/0] via 192.168.4.2 inactive, 00:00:25
+ via 192.168.6.2 inactive, 00:00:25
+ B>* 192.168.4.0/24 [200/0] via 192.168.2.3, tor1-eth1, 00:00:25
+ * via 192.168.6.2 inactive, 00:00:25
+ C>* 192.168.5.0/24 is directly connected, tor1-eth2, 00:00:30
+ B>* 192.168.6.0/24 [200/0] via 192.168.4.2 inactive, 00:00:25
+ * via 192.168.5.4, tor1-eth2, 00:00:25
+
+ Effectively we have ibgp routes recursing through ibgp routes
+ and there is no metric to discern whom to listen to.
+
+ This draft:
+ https://tools.ietf.org/html/draft-ietf-idr-bgp-optimal-route-reflection-19
+
+ appears to address this issue. From looking at both cisco and arista
+ deployments they are handling this issue by having the route reflector
+ prefer the localy learned routes over from their clients.
+
+ Add this topology, in a broken state, so that when we do fix this issue
+ it is a simple matter of touching this topology up and re-adding it
+ to the normal daily builds. I also wanted to add this topology
+ since it is in a state of `doneness` and I wanted to move onto
+ my normal day job without having to remember about this test.
+
+ This topology is not configured to be run as part of the normal
+ topotests.
+
+"""
+
+import os
+import re
+import sys
+import pytest
+import json
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, '../'))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+from mininet.topo import Topo
+
+#####################################################
+##
+## Network Topology Definition
+##
+#####################################################
+
+class NetworkTopo(Topo):
+ "BGP_RR_IBGP Topology 1"
+
+ def build(self, **_opts):
+ "Build function"
+
+ tgen = get_topogen(self)
+
+ tgen.add_router('tor1')
+ tgen.add_router('tor2')
+ tgen.add_router('spine1')
+ tgen.add_router('spine2')
+
+ # First switch is for a dummy interface (for local network)
+ # on tor1
+ # 192.168.1.0/24
+ switch = tgen.add_switch('sw1')
+ switch.add_link(tgen.gears['tor1'])
+
+ # 192.168.2.0/24 - tor1 <-> spine1 connection
+ switch = tgen.add_switch('sw2')
+ switch.add_link(tgen.gears['tor1'])
+ switch.add_link(tgen.gears['spine1'])
+
+ # 3rd switch is for a dummy interface (for local netwokr)
+ # 192.168.3.0/24 - tor2
+ switch = tgen.add_switch('sw3')
+ switch.add_link(tgen.gears['tor2'])
+
+ # 192.168.4.0/24 - tor2 <-> spine1 connection
+ switch = tgen.add_switch('sw4')
+ switch.add_link(tgen.gears['tor2'])
+ switch.add_link(tgen.gears['spine1'])
+
+ # 192.168.5.0/24 - tor1 <-> spine2 connection
+ switch = tgen.add_switch('sw5')
+ switch.add_link(tgen.gears['tor1'])
+ switch.add_link(tgen.gears['spine2'])
+
+ # 192.168.6.0/24 - tor2 <-> spine2 connection
+ switch = tgen.add_switch('sw6')
+ switch.add_link(tgen.gears['tor2'])
+ switch.add_link(tgen.gears['spine2'])
+
+#####################################################
+##
+## Tests starting
+##
+#####################################################
+
+def setup_module(module):
+ "Setup topology"
+ tgen = Topogen(NetworkTopo, module.__name__)
+ tgen.start_topology()
+
+ # This is a sample of configuration loading.
+ router_list = tgen.routers()
+ for rname, router in router_list.iteritems():
+ router.load_config(
+ TopoRouter.RD_ZEBRA,
+ os.path.join(CWD, '{}/zebra.conf'.format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_BGP,
+ os.path.join(CWD, '{}/bgpd.conf'.format(rname))
+ )
+
+ tgen.start_router()
+ # tgen.mininet_cli()
+
+
+def teardown_module(_mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ # This function tears down the whole topology.
+ tgen.stop_topology()
+
+
+def test_converge_protocols():
+ "Wait for protocol convergence"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ topotest.sleep(5, 'Waiting for BGP_RR_IBGP convergence')
+
+
+def test_bgp_rr_ibgp_routes():
+ "Test Route Reflection"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Verify BGP_RR_IBGP Status
+ logger.info("Verifying BGP_RR_IBGP routes")
+
+def test_zebra_ipv4_routingTable():
+ "Test 'show ip route'"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ failures = 0
+ router_list = tgen.routers().values()
+ for router in router_list:
+ output = router.vtysh_cmd('show ip route json', isjson=True)
+ refTableFile = '{}/{}/show_ip_route.json_ref'.format(CWD, router.name)
+ expected = json.loads(open(refTableFile).read())
+
+ assertmsg = 'Zebra IPv4 Routing Table verification failed for router {}'.format(router.name)
+ assert topotest.json_cmp(output, expected) is None, assertmsg
+
+def test_shutdown_check_stderr():
+ if os.environ.get('TOPOTESTS_CHECK_STDERR') is None:
+ pytest.skip('Skipping test for Stderr output and memory leaks')
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Verifying unexpected STDERR output from daemons")
+
+ router_list = tgen.routers().values()
+ for router in router_list:
+ router.stop()
+
+ log = tgen.net[router.name].getStdErr('bgpd')
+ if log:
+ logger.error('BGPd StdErr Log:' + log)
+ log = tgen.net[router.name].getStdErr('zebra')
+ if log:
+ logger.error('Zebra StdErr Log:' + log)
+
+
+if __name__ == '__main__':
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
+
+#
+# Auxiliary Functions
+#
diff --git a/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf b/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf
new file mode 100644
index 0000000000..44a78dffd7
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf
@@ -0,0 +1,5 @@
+hostname tor1
+router bgp 99
+ neighbor 192.168.2.3 remote-as internal
+ neighbor 192.168.5.4 remote-as internal
+ redistribute connected
diff --git a/tests/topotests/bgp_rr_ibgp/tor1/show_ip_route.json_ref b/tests/topotests/bgp_rr_ibgp/tor1/show_ip_route.json_ref
new file mode 100644
index 0000000000..223dcebbca
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor1/show_ip_route.json_ref
@@ -0,0 +1,169 @@
+{
+ "192.168.1.0\/24":[
+ {
+ "prefix":"192.168.1.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"tor1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.2.0\/24":[
+ {
+ "prefix":"192.168.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"tor1-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.3.0\/24":[
+ {
+ "prefix":"192.168.3.0\/24",
+ "protocol":"bgp",
+ "distance":200,
+ "metric":0,
+ "table":254,
+ "internalStatus":0,
+ "internalFlags":5,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":0,
+ "nexthops":[
+ {
+ "flags":0,
+ "ip":"192.168.4.2",
+ "afi":"ipv4"
+ },
+ {
+ "flags":0,
+ "ip":"192.168.6.2",
+ "afi":"ipv4"
+ }
+ ]
+ }
+ ],
+ "192.168.4.0\/24":[
+ {
+ "prefix":"192.168.4.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"tor1-eth1",
+ "active":true
+ },
+ {
+ "flags":0,
+ "ip":"192.168.6.2",
+ "afi":"ipv4"
+ }
+ ]
+ }
+ ],
+ "192.168.5.0\/24":[
+ {
+ "prefix":"192.168.5.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":4,
+ "interfaceName":"tor1-eth2",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.6.0\/24":[
+ {
+ "prefix":"192.168.6.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":0,
+ "ip":"192.168.4.2",
+ "afi":"ipv4"
+ },
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.5.4",
+ "afi":"ipv4",
+ "interfaceIndex":4,
+ "interfaceName":"tor1-eth2",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_rr_ibgp/tor1/staticd.conf b/tests/topotests/bgp_rr_ibgp/tor1/staticd.conf
new file mode 100644
index 0000000000..bb8d510b01
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor1/staticd.conf
@@ -0,0 +1 @@
+hostname tor1
diff --git a/tests/topotests/bgp_rr_ibgp/tor1/zebra.conf b/tests/topotests/bgp_rr_ibgp/tor1/zebra.conf
new file mode 100644
index 0000000000..f2fa713507
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor1/zebra.conf
@@ -0,0 +1,12 @@
+hostname tor1
+ip forwarding
+ipv6 forwarding
+
+int tor1-eth0
+ ip addr 192.168.1.1/24
+
+int tor1-eth1
+ ip addr 192.168.2.1/24
+
+int tor1-eth2
+ ip addr 192.168.5.1/24
diff --git a/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf b/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf
new file mode 100644
index 0000000000..5ef1de260e
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf
@@ -0,0 +1,5 @@
+hostname tor2
+router bgp 99
+ neighbor 192.168.4.3 remote-as internal
+ neighbor 192.168.6.4 remote-as internal
+ redistribute connected
diff --git a/tests/topotests/bgp_rr_ibgp/tor2/show_ip_route.json_ref b/tests/topotests/bgp_rr_ibgp/tor2/show_ip_route.json_ref
new file mode 100644
index 0000000000..5f041b8c62
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor2/show_ip_route.json_ref
@@ -0,0 +1,169 @@
+{
+ "192.168.1.0\/24":[
+ {
+ "prefix":"192.168.1.0\/24",
+ "protocol":"bgp",
+ "distance":200,
+ "metric":0,
+ "table":254,
+ "internalStatus":0,
+ "internalFlags":5,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":0,
+ "nexthops":[
+ {
+ "flags":0,
+ "ip":"192.168.2.1",
+ "afi":"ipv4"
+ },
+ {
+ "flags":0,
+ "ip":"192.168.5.1",
+ "afi":"ipv4"
+ }
+ ]
+ }
+ ],
+ "192.168.2.0\/24":[
+ {
+ "prefix":"192.168.2.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.4.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"tor2-eth1",
+ "active":true
+ },
+ {
+ "flags":0,
+ "ip":"192.168.5.1",
+ "afi":"ipv4"
+ }
+ ]
+ }
+ ],
+ "192.168.3.0\/24":[
+ {
+ "prefix":"192.168.3.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"tor2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.4.0\/24":[
+ {
+ "prefix":"192.168.4.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"tor2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.5.0\/24":[
+ {
+ "prefix":"192.168.5.0\/24",
+ "protocol":"bgp",
+ "selected":true,
+ "destSelected":true,
+ "distance":200,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":13,
+ "internalNextHopNum":2,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":0,
+ "ip":"192.168.2.1",
+ "afi":"ipv4"
+ },
+ {
+ "flags":3,
+ "fib":true,
+ "ip":"192.168.6.4",
+ "afi":"ipv4",
+ "interfaceIndex":4,
+ "interfaceName":"tor2-eth2",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "192.168.6.0\/24":[
+ {
+ "prefix":"192.168.6.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "table":254,
+ "internalStatus":16,
+ "internalFlags":8,
+ "internalNextHopNum":1,
+ "internalNextHopActiveNum":1,
+ "nexthops":[
+ {
+ "flags":3,
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":4,
+ "interfaceName":"tor2-eth2",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_rr_ibgp/tor2/staticd.conf b/tests/topotests/bgp_rr_ibgp/tor2/staticd.conf
new file mode 100644
index 0000000000..03098e75d9
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor2/staticd.conf
@@ -0,0 +1 @@
+hostname tor2
diff --git a/tests/topotests/bgp_rr_ibgp/tor2/zebra.conf b/tests/topotests/bgp_rr_ibgp/tor2/zebra.conf
new file mode 100644
index 0000000000..3318cbb196
--- /dev/null
+++ b/tests/topotests/bgp_rr_ibgp/tor2/zebra.conf
@@ -0,0 +1,13 @@
+hostname tor2
+ip forwarding
+ipv6 forwarding
+
+int tor2-eth0
+ ip addr 192.168.3.2/24
+
+int tor2-eth1
+ ip addr 192.168.4.2/24
+
+
+int tor2-eth2
+ ip addr 192.168.6.2/24
diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py
index bfc34c25e4..41d6a326cf 100644
--- a/tests/topotests/lib/bgp.py
+++ b/tests/topotests/lib/bgp.py
@@ -445,10 +445,10 @@ def __create_bgp_unicast_address_family(topo, input_dict, router, addr_type,
bgp_data = input_dict[router]["bgp"]["address_family"]
neigh_data = bgp_data[addr_type]["unicast"]["neighbor"]
- for name, peer_dict in deepcopy(neigh_data).iteritems():
+ for peer_name, peer_dict in deepcopy(neigh_data).iteritems():
for dest_link, peer in peer_dict["dest_link"].iteritems():
deactivate = None
- nh_details = topo[name]
+ nh_details = topo[peer_name]
# Loopback interface
if "source_link" in peer and peer["source_link"] == "lo":
for destRouterLink, data in sorted(nh_details["links"].
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index ba8a4cb0f4..c413bf45c7 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -35,11 +35,7 @@ import ConfigParser
import traceback
import socket
import ipaddr
-import re
-from lib import topotest
-
-from functools import partial
from lib.topolog import logger, logger_config
from lib.topogen import TopoRouter
from lib.topotest import interface_set_status
@@ -736,62 +732,6 @@ def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0):
return _retry
-def disable_v6_link_local(tgen, router, intf_name=None):
- """
- Disables ipv6 link local addresses for a particular interface or
- all interfaces
-
- * `tgen`: tgen onject
- * `router` : router for which hightest interface should be
- calculated
- * `intf_name` : Interface name for which v6 link local needs to
- be disabled
- """
-
- router_list = tgen.routers()
- for rname, rnode in router_list.iteritems():
- if rname != router:
- continue
-
- linklocal = []
-
- ifaces = router_list[router].run('ip -6 address')
-
- # Fix newlines (make them all the same)
- ifaces = ('\n'.join(ifaces.splitlines()) + '\n').splitlines()
-
- interface = None
- ll_per_if_count = 0
- for line in ifaces:
- # Interface name
- m = re.search('[0-9]+: ([^:]+)[@if0-9:]+ <', line)
- if m:
- interface = m.group(1).split("@")[0]
- ll_per_if_count = 0
-
- # Interface ip
- m = re.search('inet6 (fe80::[0-9a-f]+:[0-9a-f]+:[0-9a-f]+'
- ':[0-9a-f]+[/0-9]*) scope link', line)
- if m:
- local = m.group(1)
- ll_per_if_count += 1
- if ll_per_if_count > 1:
- linklocal += [["%s-%s" % (interface, ll_per_if_count), local]]
- else:
- linklocal += [[interface, local]]
-
- if len(linklocal[0]) > 1:
- link_local_dict = {item[0]: item[1] for item in linklocal}
-
- for lname, laddr in link_local_dict.items():
-
- if intf_name is not None and lname != intf_name:
- continue
-
- cmd = "ip addr del {} dev {}".format(laddr, lname)
- router_list[router].run(cmd)
-
-
#############################################
# These APIs, will used by testcase
#############################################
@@ -821,8 +761,6 @@ def create_interfaces_cfg(tgen, topo, build=False):
interface_name = destRouterLink
else:
interface_name = data["interface"]
- if "ipv6" in data:
- disable_v6_link_local(tgen, c_router, interface_name)
interface_data.append("interface {}".format(
str(interface_name)
))
@@ -1302,13 +1240,15 @@ def create_route_maps(tgen, input_dict, build=False):
# Weight
if weight:
- rmap_data.append("set weight {} \n".format(
+ rmap_data.append("set weight {}".format(
weight))
if ipv6_data:
- nexthop = ipv6_data.setdefault("nexthop",None)
+ nexthop = ipv6_data.setdefault("nexthop", None)
if nexthop:
- rmap_data.append("set ipv6 next-hop \
- {}".format(nexthop))
+ rmap_data.append("set ipv6 next-hop {}".format(
+ nexthop
+ ))
+
# Adding MATCH and SET sequence to RMAP if defined
if "match" in rmap_dict:
match_data = rmap_dict["match"]
@@ -1569,19 +1509,13 @@ def shutdown_bringup_interface(tgen, dut, intf_name, ifaceaction=False):
errormsg(str) or True
"""
- from topotest import interface_set_status
router_list = tgen.routers()
if ifaceaction:
logger.info("Bringing up interface : {}".format(intf_name))
else:
logger.info("Shutting down interface : {}".format(intf_name))
- interface_set_status(router_list[dut], intf_name,
- ifaceaction)
-
- if ifaceaction:
- # Disabling v6 link local once interfac comes up back
- disable_v6_link_local(tgen, dut, intf_name=intf_name)
+ interface_set_status(router_list[dut], intf_name, ifaceaction)
#############################################
diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini
index b65f93856f..62c825341f 100644
--- a/tests/topotests/pytest.ini
+++ b/tests/topotests/pytest.ini
@@ -1,6 +1,6 @@
# Skip pytests example directory
[pytest]
-norecursedirs = .git example-test example-topojson-test lib docker bgp-ecmp-topo2
+norecursedirs = .git example-test example-topojson-test lib docker bgp_rr_ibgp
[topogen]
# Default configuration values