1 # Copyright (c) 2017 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 from copy import deepcopy
16 """Test variables for BGP test suite."""
18 # Internal BGP peers for CRUD tests
19 address_internal = "192.168.0.2"
20 address_internal2 = "192.168.0.3"
21 holdtime_internal = 60
23 "bgp-openconfig-extensions:neighbor": [{
24 "neighbor-address": address_internal,
26 "peer-type": "INTERNAL"
31 "hold-time": holdtime_internal
42 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
50 peer_internal_update = {
51 "bgp-openconfig-extensions:neighbor": [{
52 "neighbor-address": address_internal,
54 "peer-type": "INTERNAL"
59 "hold-time": holdtime_internal*2
70 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
78 peer_internal2 = deepcopy(peer_internal)
79 peer_internal2["bgp-openconfig-extensions:neighbor"][0]["neighbor-address"] = \
82 # Application BGP peer for CRUD test
83 address_application = "192.168.0.4"
85 "bgp-openconfig-extensions:neighbor": [{
86 "neighbor-address": address_application,
88 "peer-group": "application-peers"
93 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
99 "openconfig-bgp-types:IPV4-LABELLED-UNICAST",
107 # IPv4 route for CRUD test
108 route_address_ipv4 = "192.168.0.5/32"
111 "bgp-inet:ipv4-route": [{
112 "path-id": route_id_ipv4,
113 "prefix": route_address_ipv4,
123 "global": "192.168.1.1"
129 # IPv4 route for testing Update operation
130 route_data_ipv4_update = {
131 "bgp-inet:ipv4-route": [{
132 "path-id": route_id_ipv4,
133 "prefix": route_address_ipv4,
143 "global": "192.168.1.2"
149 # IPv4 route for testing multiple routes
150 route_address_ipv4_2 = "192.168.0.6/32"
152 route_data_ipv4_2 = {
153 "bgp-inet:ipv4-route": [{
154 "path-id": route_id_ipv4_2,
155 "prefix": route_address_ipv4_2,
165 "global": "192.168.1.2"
171 # IPv6 route for CRUD test
172 route_address_ipv6 = "3ffe:62::1/64"
175 "bgp-inet:ipv6-route": [{
176 "path-id": route_id_ipv6,
177 "prefix": route_address_ipv6,
187 "global": "3ffe:63::1"
193 # IPv4 route operational data in routing table
195 "destination-prefix": route_address_ipv4,
196 "next-hop": "192.168.1.1",
197 "vpp-ipv4-route-state": {}
200 # Peer configurations for traffic test
202 "bgp-openconfig-extensions:neighbor": [{
203 "neighbor-address": "192.168.1.1",
205 "peer-type": "INTERNAL"
216 "passive-mode": False
222 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
226 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
230 "afi-safi-name": "LINKSTATE"
238 "bgp-openconfig-extensions:neighbor": [{
239 "neighbor-address": "192.168.1.2",
241 "peer-type": "INTERNAL"
258 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
262 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
266 "afi-safi-name": "LINKSTATE"
273 # IPv4 route for traffic test
274 dut1_route_address = "192.168.0.5/32"
277 "bgp-inet:ipv4-route": [{
278 "path-id": dut1_route_id,
279 "prefix": dut1_route_address,
289 "global": "192.168.1.3"
295 # IPv4 route in peer operational data
297 "loc-rib": {"tables": [
299 "afi": "bgp-types:ipv4-address-family",
300 "safi": "bgp-types:unicast-subsequent-address-family",
301 "bgp-inet:ipv4-routes": {
302 "ipv4-route": dut1_route["bgp-inet:ipv4-route"]
308 route_operational = {
309 "vpp-ipv4-route-state": {},
310 "next-hop": "192.168.1.3",
311 "destination-prefix": dut1_route_address
314 # IPv6 route for traffic test
315 dut1_route_ip6_address = "3ffe:62::1/64"
316 dut1_route_ip6_id = 1
318 "bgp-inet:ipv6-route": [{
319 "path-id": dut1_route_ip6_id,
320 "prefix": dut1_route_ip6_address,
330 "global": "3ffe:63::1"
336 # IPv6 route in peer operational data
337 rib_ip6_operational = {
338 "loc-rib": {"tables": [
340 "afi": "bgp-types:ipv6-address-family",
341 "safi": "bgp-types:unicast-subsequent-address-family",
342 "bgp-inet:ipv6-routes": {
343 "ipv6-route": dut1_route_ip6["bgp-inet:ipv6-route"]
349 route_ip6_operational = {
350 "vpp-ipv6-route-state": {},
351 "next-hop": "3ffe:63::1",
352 "destination-prefix": dut1_route_ip6_address