Tolerate failures when setting MTU
[csit.git] / resources / test_data / honeycomb / bgp.py
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:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
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.
13
14 from copy import deepcopy
15
16 """Test variables for BGP test suite."""
17
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
22 peer_internal = {
23     "bgp-openconfig-extensions:neighbor": [{
24         "neighbor-address": address_internal,
25         "config": {
26             "peer-type": "INTERNAL"
27         },
28         "timers": {
29             "config": {
30                 "connect-retry": 3,
31                 "hold-time": holdtime_internal
32             }
33         },
34         "transport": {
35             "config": {
36                 "remote-port": 179,
37                 "passive-mode": False
38             }
39         },
40         "afi-safis": {
41             "afi-safi": [{
42                 "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
43                 }]
44             }
45         }]
46     }
47
48 peer_internal_update = {
49     "bgp-openconfig-extensions:neighbor": [{
50         "neighbor-address": address_internal,
51         "config": {
52             "peer-type": "INTERNAL"
53         },
54         "timers": {
55             "config": {
56                 "connect-retry": 5,
57                 "hold-time": holdtime_internal*2
58             }
59         },
60         "transport": {
61             "config": {
62                 "remote-port": 180,
63                 "passive-mode": True
64             }
65         },
66         "afi-safis": {
67             "afi-safi": [{
68                 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
69                 }]
70             }
71         }]
72     }
73
74 peer_internal2 = deepcopy(peer_internal)
75 peer_internal2["bgp-openconfig-extensions:neighbor"][0]["neighbor-address"] = \
76     address_internal2
77
78 # Application BGP peer for CRUD test
79 address_application = "192.168.0.4"
80 peer_application = {
81     "bgp-openconfig-extensions:neighbor": [{
82         "neighbor-address": address_application,
83         "config": {
84             "peer-group": "application-peers"
85         },
86         "afi-safis": {
87             "afi-safi": [
88                 {
89                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
90                 },
91                 {
92                     "afi-safi-name":
93                         "openconfig-bgp-types:IPV4-LABELLED-UNICAST"
94                 }]
95             }
96         }]
97     }
98
99 # IPv4 route for CRUD test
100 route_address_ipv4 = "192.168.0.5/32"
101 route_id_ipv4 = 0
102 route_data_ipv4 = {
103     "bgp-inet:ipv4-route": [{
104         "route-key": route_address_ipv4,
105         "path-id": route_id_ipv4,
106         "prefix": route_address_ipv4,
107         "attributes": {
108             "as-path": {},
109             "origin": {
110                 "value": "igp"
111             },
112             "local-pref": {
113                 "pref": 100
114             },
115             "ipv4-next-hop": {
116                 "global": "192.168.1.1"
117             }
118         }
119     }]
120 }
121
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,
127         "attributes": {
128             "origin": {
129                 "value": "igp"
130             },
131             "local-pref": {
132                 "pref": 100
133             },
134             "ipv4-next-hop": {
135                 "global": "192.168.1.1"
136             }
137         }
138     }]
139 }
140
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,
147         "attributes": {
148             "as-path": {},
149             "origin": {
150                 "value": "egp"
151             },
152             "local-pref": {
153                 "pref": 200
154             },
155             "ipv4-next-hop": {
156                 "global": "192.168.1.2"
157             }
158         }
159     }]
160 }
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,
166         "attributes": {
167             "origin": {
168                 "value": "egp"
169             },
170             "local-pref": {
171                 "pref": 200
172             },
173             "ipv4-next-hop": {
174                 "global": "192.168.1.2"
175             }
176         }
177     }]
178 }
179
180 # IPv4 route for testing multiple routes
181 route_address_ipv4_2 = "192.168.0.6/32"
182 route_id_ipv4_2 = 1
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,
188         "attributes": {
189             "as-path": {},
190             "origin": {
191                 "value": "igp"
192             },
193             "local-pref": {
194                 "pref": 100
195             },
196             "ipv4-next-hop": {
197                 "global": "192.168.1.2"
198             }
199         }
200     }]
201 }
202
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,
208         "attributes": {
209             "origin": {
210                 "value": "igp"
211             },
212             "local-pref": {
213                 "pref": 100
214             },
215             "ipv4-next-hop": {
216                 "global": "192.168.1.2"
217             }
218         }
219     }]
220 }
221
222 # IPv6 route for CRUD test
223 route_address_ipv6 = "3ffe:62::1/64"
224 route_id_ipv6 = 0
225 route_data_ipv6 = {
226     "bgp-inet:ipv6-route": [{
227         "route-key": route_address_ipv6,
228         "path-id": route_id_ipv6,
229         "prefix": route_address_ipv6,
230         "attributes": {
231             "as-path": {},
232             "origin": {
233                 "value": "igp"
234             },
235             "local-pref": {
236                 "pref": 100
237             },
238             "ipv6-next-hop": {
239                 "global": "3ffe:63::1"
240             }
241         }
242     }]
243 }
244
245 # IPv4 route operational data in routing table
246 table1_oper = {
247     "destination-prefix": route_address_ipv4,
248     "next-hop": "192.168.1.1",
249     "vpp-ipv4-unicast-routing:vpp-ipv4-route": {}
250 }
251
252 # Peer configurations for traffic test
253 dut1_peer = {
254     "bgp-openconfig-extensions:neighbor": [{
255         "neighbor-address": "192.168.1.1",
256         "config": {
257             "peer-type": "INTERNAL"
258         },
259         "timers": {
260             "config": {
261                 "connect-retry": 3,
262                 "hold-time": 60
263             }
264         },
265         "transport": {
266             "config": {
267                 "remote-port": 179,
268                 "passive-mode": False
269             }
270         },
271         "afi-safis": {
272             "afi-safi": [
273                 {
274                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
275                 },
276                 {
277                     "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
278                 },
279                 {
280                     "afi-safi-name": "LINKSTATE"
281                 }
282             ]
283         }
284     }]
285 }
286
287 dut2_peer = {
288     "bgp-openconfig-extensions:neighbor": [{
289         "neighbor-address": "192.168.1.2",
290         "config": {
291             "peer-type": "INTERNAL"
292         },
293         "timers": {
294             "config": {
295                 "connect-retry": 3,
296                 "hold-time": 60
297             }
298         },
299         "transport": {
300             "config": {
301                 "remote-port": 179,
302                 "passive-mode": True
303             }
304         },
305         "afi-safis": {
306             "afi-safi": [
307                 {
308                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
309                 },
310                 {
311                     "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
312                 },
313                 {
314                     "afi-safi-name": "LINKSTATE"
315                 }
316             ]
317         }
318     }]
319 }
320
321 # IPv4 route for traffic test
322 dut1_route_address = "192.168.0.5/32"
323 dut1_route_id = 0
324 dut1_route = {
325     "bgp-inet:ipv4-route": [{
326         "route-key": dut1_route_address,
327         "path-id": dut1_route_id,
328         "prefix": dut1_route_address,
329         "attributes": {
330             "as-path": {},
331             "origin": {
332                 "value": "igp"
333             },
334             "local-pref": {
335                 "pref": 100
336             },
337             "ipv4-next-hop": {
338                 "global": "192.168.1.3"
339             }
340         }
341     }]
342 }
343
344 dut1_route_oper = {
345     "bgp-inet:ipv4-route": [{
346         "route-key": dut1_route_address,
347         "path-id": dut1_route_id,
348         "prefix": dut1_route_address,
349         "attributes": {
350             "origin": {
351                 "value": "igp"
352             },
353             "local-pref": {
354                 "pref": 100
355             },
356             "ipv4-next-hop": {
357                 "global": "192.168.1.3"
358             }
359         }
360     }]
361 }
362
363 # IPv4 route in peer operational data
364 rib_operational = {
365     "loc-rib": {"tables": [
366         {
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"]
371             }
372         }
373     ]}
374 }
375
376 route_operational = {
377     "next-hop": {"next-hop-address": "192.168.1.3"},
378     "destination-prefix": dut1_route_address
379 }
380
381 # IPv6 route for traffic test
382 dut1_route_ip6_prefix = "3ffe:62::/64"
383 dut1_route_ip6_id = 0
384 dut1_route_ip6 = {
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,
389         "attributes": {
390             "as-path": {},
391             "origin": {
392                 "value": "igp"
393             },
394             "local-pref": {
395                 "pref": 100
396             },
397             "ipv6-next-hop": {
398                 "global": "3ffe:63::1"
399             }
400         }
401     }]
402 }
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,
408         "attributes": {
409             "origin": {
410                 "value": "igp"
411             },
412             "local-pref": {
413                 "pref": 100
414             },
415             "ipv6-next-hop": {
416                 "global": "3ffe:63::1"
417             }
418         }
419     }]
420 }
421
422 # IPv6 route in peer operational data
423 rib_ip6_operational = {
424     "loc-rib": {"tables": [
425         {
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"]
430             }
431         }
432     ]}
433 }
434
435 route_ip6_operational = {
436     "next-hop": {"next-hop-address": "3ffe:63::1"},
437     "destination-prefix": dut1_route_ip6_prefix
438 }