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 # IPv4 route for testing Update operation
123 route_data_ipv4_update = {
124 "bgp-inet:ipv4-route": [{
125 "route-key": route_address_ipv4,
126 "path-id": route_id_ipv4,
127 "prefix": route_address_ipv4,
137 "global": "192.168.1.2"
143 # IPv4 route for testing multiple routes
144 route_address_ipv4_2 = "192.168.0.6/32"
146 route_data_ipv4_2 = {
147 "bgp-inet:ipv4-route": [{
148 "route-key": route_address_ipv4_2,
149 "path-id": route_id_ipv4_2,
150 "prefix": route_address_ipv4_2,
160 "global": "192.168.1.2"
166 # IPv6 route for CRUD test
167 route_address_ipv6 = "3ffe:62::1/64"
170 "bgp-inet:ipv6-route": [{
171 "route-key": route_address_ipv6,
172 "path-id": route_id_ipv6,
173 "prefix": route_address_ipv6,
183 "global": "3ffe:63::1"
189 # IPv4 route operational data in routing table
191 "destination-prefix": route_address_ipv4,
192 "next-hop": "192.168.1.1",
193 "vpp-ipv4-unicast-routing:vpp-ipv4-route": {}
196 # Peer configurations for traffic test
198 "bgp-openconfig-extensions:neighbor": [{
199 "neighbor-address": "192.168.1.1",
201 "peer-type": "INTERNAL"
212 "passive-mode": False
218 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
221 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
224 "afi-safi-name": "LINKSTATE"
232 "bgp-openconfig-extensions:neighbor": [{
233 "neighbor-address": "192.168.1.2",
235 "peer-type": "INTERNAL"
252 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
255 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
258 "afi-safi-name": "LINKSTATE"
265 # IPv4 route for traffic test
266 dut1_route_address = "192.168.0.5/32"
269 "bgp-inet:ipv4-route": [{
270 "route-key": dut1_route_address,
271 "path-id": dut1_route_id,
272 "prefix": dut1_route_address,
282 "global": "192.168.1.3"
288 # IPv4 route in peer operational data
290 "loc-rib": {"tables": [
292 "afi": "bgp-types:ipv4-address-family",
293 "safi": "bgp-types:unicast-subsequent-address-family",
294 "bgp-inet:ipv4-routes": {
295 "ipv4-route": dut1_route["bgp-inet:ipv4-route"]
301 route_operational = {
302 "next-hop": {"next-hop-address": "192.168.1.3"},
303 "vpp-ipv4-unicast-routing:vpp-ipv4-route": {},
304 "destination-prefix": dut1_route_address
307 # IPv6 route for traffic test
308 dut1_route_ip6_prefix = "3ffe:62::/64"
309 dut1_route_ip6_id = 0
311 "bgp-inet:ipv6-route": [{
312 "route-key": dut1_route_ip6_prefix,
313 "path-id": dut1_route_ip6_id,
314 "prefix": dut1_route_ip6_prefix,
324 "global": "3ffe:63::1"
330 # IPv6 route in peer operational data
331 rib_ip6_operational = {
332 "loc-rib": {"tables": [
334 "afi": "bgp-types:ipv6-address-family",
335 "safi": "bgp-types:unicast-subsequent-address-family",
336 "bgp-inet:ipv6-routes": {
337 "ipv6-route": dut1_route_ip6["bgp-inet:ipv6-route"]
343 route_ip6_operational = {
344 "next-hop": {"next-hop-address": "3ffe:63::1"},
345 "vpp-ipv6-unicast-routing:vpp-ipv6-route": {},
346 "destination-prefix": dut1_route_ip6_prefix