CSIT-811 HC Test: BGP functional tests
[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                 "receive": True,
44                 "send-max": 0
45                 }]
46             }
47         }]
48     }
49
50 peer_internal_update = {
51     "bgp-openconfig-extensions:neighbor": [{
52         "neighbor-address": address_internal,
53         "config": {
54             "peer-type": "INTERNAL"
55         },
56         "timers": {
57             "config": {
58                 "connect-retry": 5,
59                 "hold-time": holdtime_internal*2
60             }
61         },
62         "transport": {
63             "config": {
64                 "remote-port": 180,
65                 "passive-mode": True
66             }
67         },
68         "afi-safis": {
69             "afi-safi": [{
70                 "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
71                 "receive": False,
72                 "send-max": 1
73                 }]
74             }
75         }]
76     }
77
78 peer_internal2 = deepcopy(peer_internal)
79 peer_internal2["bgp-openconfig-extensions:neighbor"][0]["neighbor-address"] = \
80     address_internal2
81
82 # Application BGP peer for CRUD test
83 address_application = "192.168.0.4"
84 peer_application = {
85     "bgp-openconfig-extensions:neighbor": [{
86         "neighbor-address": address_application,
87         "config": {
88             "peer-group": "application-peers"
89         },
90         "afi-safis": {
91             "afi-safi": [
92                 {
93                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
94                     "receive": True,
95                     "send-max": 0
96                 },
97                 {
98                     "afi-safi-name":
99                         "openconfig-bgp-types:IPV4-LABELLED-UNICAST",
100                     "receive": True,
101                     "send-max": 0
102                 }]
103             }
104         }]
105     }
106
107 # IPv4 route for CRUD test
108 route_address_ipv4 = "192.168.0.5/32"
109 route_id_ipv4 = 0
110 route_data_ipv4 = {
111     "bgp-inet:ipv4-route": [{
112         "path-id": route_id_ipv4,
113         "prefix": route_address_ipv4,
114         "attributes": {
115             "as-path": {},
116             "origin": {
117                 "value": "igp"
118             },
119             "local-pref": {
120                 "pref": 100
121             },
122             "ipv4-next-hop": {
123                 "global": "192.168.1.1"
124             }
125         }
126     }]
127 }
128
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,
134         "attributes": {
135             "as-path": {},
136             "origin": {
137                 "value": "egp"
138             },
139             "local-pref": {
140                 "pref": 200
141             },
142             "ipv4-next-hop": {
143                 "global": "192.168.1.2"
144             }
145         }
146     }]
147 }
148
149 # IPv4 route for testing multiple routes
150 route_address_ipv4_2 = "192.168.0.6/32"
151 route_id_ipv4_2 = 1
152 route_data_ipv4_2 = {
153     "bgp-inet:ipv4-route": [{
154         "path-id": route_id_ipv4_2,
155         "prefix": route_address_ipv4_2,
156         "attributes": {
157             "as-path": {},
158             "origin": {
159                 "value": "igp"
160             },
161             "local-pref": {
162                 "pref": 100
163             },
164             "ipv4-next-hop": {
165                 "global": "192.168.1.2"
166             }
167         }
168     }]
169 }
170
171 # IPv6 route for CRUD test
172 route_address_ipv6 = "3ffe:62::1/64"
173 route_id_ipv6 = 0
174 route_data_ipv6 = {
175     "bgp-inet:ipv6-route": [{
176         "path-id": route_id_ipv6,
177         "prefix": route_address_ipv6,
178         "attributes": {
179             "as-path": {},
180             "origin": {
181                 "value": "igp"
182             },
183             "local-pref": {
184                 "pref": 100
185             },
186             "ipv6-next-hop": {
187                 "global": "3ffe:63::1"
188             }
189         }
190     }]
191 }
192
193 # IPv4 route operational data in routing table
194 table1_oper = {
195     "destination-prefix": route_address_ipv4,
196     "next-hop": "192.168.1.1",
197     "vpp-ipv4-route-state": {}
198 }
199
200 # Peer configurations for traffic test
201 dut1_peer = {
202     "bgp-openconfig-extensions:neighbor": [{
203         "neighbor-address": "192.168.1.1",
204         "config": {
205             "peer-type": "INTERNAL"
206         },
207         "timers": {
208             "config": {
209                 "connect-retry": 3,
210                 "hold-time": 60
211             }
212         },
213         "transport": {
214             "config": {
215                 "remote-port": 179,
216                 "passive-mode": False
217             }
218         },
219         "afi-safis": {
220             "afi-safi": [
221                 {
222                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
223                     "receive": True,
224                     "send-max": 0},
225                 {
226                     "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
227                     "receive": True,
228                     "send-max": 0},
229                 {
230                     "afi-safi-name": "LINKSTATE"
231                 }
232             ]
233         }
234     }]
235 }
236
237 dut2_peer = {
238     "bgp-openconfig-extensions:neighbor": [{
239         "neighbor-address": "192.168.1.2",
240         "config": {
241             "peer-type": "INTERNAL"
242         },
243         "timers": {
244             "config": {
245                 "connect-retry": 3,
246                 "hold-time": 60
247             }
248         },
249         "transport": {
250             "config": {
251                 "remote-port": 179,
252                 "passive-mode": True
253             }
254         },
255         "afi-safis": {
256             "afi-safi": [
257                 {
258                     "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
259                     "receive": True,
260                     "send-max": 0},
261                 {
262                     "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
263                     "receive": True,
264                     "send-max": 0},
265                 {
266                     "afi-safi-name": "LINKSTATE"
267                 }
268             ]
269         }
270     }]
271 }
272
273 # IPv4 route for traffic test
274 dut1_route_address = "192.168.0.5/32"
275 dut1_route_id = 1
276 dut1_route = {
277     "bgp-inet:ipv4-route": [{
278         "path-id": dut1_route_id,
279         "prefix": dut1_route_address,
280         "attributes": {
281             "as-path": {},
282             "origin": {
283                 "value": "igp"
284             },
285             "local-pref": {
286                 "pref": 100
287             },
288             "ipv4-next-hop": {
289                 "global": "192.168.1.3"
290             }
291         }
292     }]
293 }
294
295 # IPv4 route in peer operational data
296 rib_operational = {
297     "loc-rib": {"tables": [
298         {
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"]
303             }
304         }
305     ]}
306 }
307
308 route_operational = {
309     "vpp-ipv4-route-state": {},
310     "next-hop": "192.168.1.3",
311     "destination-prefix": dut1_route_address
312 }
313
314 # IPv6 route for traffic test
315 dut1_route_ip6_address = "3ffe:62::1/64"
316 dut1_route_ip6_id = 1
317 dut1_route_ip6 = {
318     "bgp-inet:ipv6-route": [{
319         "path-id": dut1_route_ip6_id,
320         "prefix": dut1_route_ip6_address,
321         "attributes": {
322             "as-path": {},
323             "origin": {
324                 "value": "igp"
325             },
326             "local-pref": {
327                 "pref": 100
328             },
329             "ipv6-next-hop": {
330                 "global": "3ffe:63::1"
331             }
332         }
333     }]
334 }
335
336 # IPv6 route in peer operational data
337 rib_ip6_operational = {
338     "loc-rib": {"tables": [
339         {
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"]
344             }
345         }
346     ]}
347 }
348
349 route_ip6_operational = {
350     "vpp-ipv6-route-state": {},
351     "next-hop": "3ffe:63::1",
352     "destination-prefix": dut1_route_ip6_address
353 }

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.