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"
48 peer_internal_update = {
49 "bgp-openconfig-extensions:neighbor": [{
50 "neighbor-address": address_internal,
52 "peer-type": "INTERNAL"
57 "hold-time": holdtime_internal*2
68 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
74 peer_internal2 = deepcopy(peer_internal)
75 peer_internal2["bgp-openconfig-extensions:neighbor"][0]["neighbor-address"] = \
78 # Application BGP peer for CRUD test
79 address_application = "192.168.0.4"
81 "bgp-openconfig-extensions:neighbor": [{
82 "neighbor-address": address_application,
84 "peer-group": "application-peers"
89 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
93 "openconfig-bgp-types:IPV4-LABELLED-UNICAST"
99 # IPv4 route for CRUD test
100 route_address_ipv4 = "192.168.0.5/32"
103 "bgp-inet:ipv4-route": [{
104 "route-key": route_address_ipv4,
105 "path-id": route_id_ipv4,
106 "prefix": route_address_ipv4,
116 "global": "192.168.1.1"
122 route_data_ipv4_oper = {
123 "bgp-inet:ipv4-route": [{
124 "route-key": route_address_ipv4,
125 "path-id": route_id_ipv4,
126 "prefix": route_address_ipv4,
135 "global": "192.168.1.1"
141 # IPv4 route for testing Update operation
142 route_data_ipv4_update = {
143 "bgp-inet:ipv4-route": [{
144 "route-key": route_address_ipv4,
145 "path-id": route_id_ipv4,
146 "prefix": route_address_ipv4,
156 "global": "192.168.1.2"
161 route_data_ipv4_update_oper = {
162 "bgp-inet:ipv4-route": [{
163 "route-key": route_address_ipv4,
164 "path-id": route_id_ipv4,
165 "prefix": route_address_ipv4,
174 "global": "192.168.1.2"
180 # IPv4 route for testing multiple routes
181 route_address_ipv4_2 = "192.168.0.6/32"
183 route_data_ipv4_2 = {
184 "bgp-inet:ipv4-route": [{
185 "route-key": route_address_ipv4_2,
186 "path-id": route_id_ipv4_2,
187 "prefix": route_address_ipv4_2,
197 "global": "192.168.1.2"
203 route_data_ipv4_2_oper = {
204 "bgp-inet:ipv4-route": [{
205 "route-key": route_address_ipv4_2,
206 "path-id": route_id_ipv4_2,
207 "prefix": route_address_ipv4_2,
216 "global": "192.168.1.2"
222 # IPv6 route for CRUD test
223 route_address_ipv6 = "3ffe:62::1/64"
226 "bgp-inet:ipv6-route": [{
227 "route-key": route_address_ipv6,
228 "path-id": route_id_ipv6,
229 "prefix": route_address_ipv6,
239 "global": "3ffe:63::1"
245 # IPv4 route operational data in routing table
247 "destination-prefix": route_address_ipv4,
248 "next-hop": "192.168.1.1",
249 "vpp-ipv4-unicast-routing:vpp-ipv4-route": {}
252 # Peer configurations for traffic test
254 "bgp-openconfig-extensions:neighbor": [{
255 "neighbor-address": "192.168.1.1",
257 "peer-type": "INTERNAL"
268 "passive-mode": False
274 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
277 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
280 "afi-safi-name": "LINKSTATE"
288 "bgp-openconfig-extensions:neighbor": [{
289 "neighbor-address": "192.168.1.2",
291 "peer-type": "INTERNAL"
308 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
311 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
314 "afi-safi-name": "LINKSTATE"
321 # IPv4 route for traffic test
322 dut1_route_address = "192.168.0.5/32"
325 "bgp-inet:ipv4-route": [{
326 "route-key": dut1_route_address,
327 "path-id": dut1_route_id,
328 "prefix": dut1_route_address,
338 "global": "192.168.1.3"
345 "bgp-inet:ipv4-route": [{
346 "route-key": dut1_route_address,
347 "path-id": dut1_route_id,
348 "prefix": dut1_route_address,
357 "global": "192.168.1.3"
363 # IPv4 route in peer operational data
365 "loc-rib": {"tables": [
367 "afi": "bgp-types:ipv4-address-family",
368 "safi": "bgp-types:unicast-subsequent-address-family",
369 "bgp-inet:ipv4-routes": {
370 "ipv4-route": dut1_route_oper["bgp-inet:ipv4-route"]
376 route_operational = {
377 "next-hop": {"next-hop-address": "192.168.1.3"},
378 "destination-prefix": dut1_route_address
381 # IPv6 route for traffic test
382 dut1_route_ip6_prefix = "3ffe:62::/64"
383 dut1_route_ip6_id = 0
385 "bgp-inet:ipv6-route": [{
386 "route-key": dut1_route_ip6_prefix,
387 "path-id": dut1_route_ip6_id,
388 "prefix": dut1_route_ip6_prefix,
398 "global": "3ffe:63::1"
403 dut1_route_ip6_oper = {
404 "bgp-inet:ipv6-route": [{
405 "route-key": dut1_route_ip6_prefix,
406 "path-id": dut1_route_ip6_id,
407 "prefix": dut1_route_ip6_prefix,
416 "global": "3ffe:63::1"
422 # IPv6 route in peer operational data
423 rib_ip6_operational = {
424 "loc-rib": {"tables": [
426 "afi": "bgp-types:ipv6-address-family",
427 "safi": "bgp-types:unicast-subsequent-address-family",
428 "bgp-inet:ipv6-routes": {
429 "ipv6-route": dut1_route_ip6_oper["bgp-inet:ipv6-route"]
435 route_ip6_operational = {
436 "next-hop": {"next-hop-address": "3ffe:63::1"},
437 "destination-prefix": dut1_route_ip6_prefix