HC Test: re-enable VxLAN GPE test suite
[csit.git] / resources / test_data / honeycomb / lisp / lisp.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 """Test variables for LISP test suite."""
15
16 from copy import deepcopy
17
18 locator_set = "loc01"
19
20 remote_bd_subtable = {
21     "virtual-network-identifier": 3,
22     "bridge-domain-subtable": {
23         "bridge-domain-ref": "bd_lisp",
24         "remote-mappings": {
25             "remote-mapping": [{
26                 "id": "remote_map_l2",
27                 "eid": {
28                     "virtual-network-id": 3,
29                     "address-type": "ietf-lisp-address-types:mac-afi",
30                     "mac": "aa:aa:aa:aa:aa:ab",
31                 },
32                 "rlocs": {
33                     "locator": [{
34                         "address": "192.168.0.3",
35                         "priority": 1,
36                         "weight": 1
37                     }]
38                 },
39             }]
40         },
41     }
42 }
43
44 remote_vrf_subtable = {
45     "virtual-network-identifier": 4,
46     "vrf-subtable": {
47         "table-id": 1,
48         "remote-mappings": {
49             "remote-mapping": [{
50                 "id": "remote_map_vrf",
51                 "eid": {
52                     "virtual-network-id": 4,
53                     "address-type": "ietf-lisp-address-types:ipv4-afi",
54                     "ipv4": "192.168.0.2"
55                 },
56                 "rlocs": {
57                     "locator": [{
58                         "address": "192.168.0.3",
59                         "priority": 1,
60                         "weight": 1
61                     }]
62                 },
63
64             }]
65         },
66     }
67 }
68
69 local_bd_subtable = {
70     "virtual-network-identifier": 5,
71     "bridge-domain-subtable": {
72         "bridge-domain-ref": "bd2_lisp",
73         "local-mappings": {
74             "local-mapping": [{
75                 "id": "local_map_l2",
76                 "eid": {
77                     "address-type": "ietf-lisp-address-types:mac-afi",
78                     "virtual-network-id": 5,
79                     "mac": "ba:aa:aa:aa:aa:aa"
80                 },
81                 "locator-set": locator_set
82             }]
83         },
84     }
85 }
86
87 local_vrf_subtable = {
88     "virtual-network-identifier": 6,
89     "vrf-subtable": {
90         "table-id": 2,
91         "local-mappings": {
92             "local-mapping": [{
93                 "id": "local_map_vrf",
94                 "eid": {
95                     "virtual-network-id": 6,
96                     "address-type": "ietf-lisp-address-types:ipv4-afi",
97                     "ipv4": "192.168.1.1"
98                 },
99                 "locator-set": locator_set
100             }]
101         },
102     }
103 }
104
105 lisp_settings_enable = {
106     "lisp": {
107         "enable": True
108     }
109 }
110
111 prepare_vrf_adjacency = {
112     "virtual-network-identifier": 7,
113     "vrf-subtable": {
114         "table-id": 3,
115         "local-mappings": {
116             "local-mapping": [{
117                 "id": "local_map_vrf",
118                 "eid": {
119                     "virtual-network-id": 7,
120                     "address-type": "ietf-lisp-address-types:ipv4-afi",
121                     "ipv4": "192.168.1.1"
122                 },
123                 "locator-set": locator_set
124             }]
125         },
126         "remote-mappings": {
127             "remote-mapping": [{
128                 "id": "remote_map_vrf",
129                 "eid": {
130                     "virtual-network-id": 7,
131                     "address-type": "ietf-lisp-address-types:ipv4-afi",
132                     "ipv4": "192.168.0.2"
133                 },
134                 "rlocs": {
135                     "locator": [{
136                         "address": "192.168.0.3",
137                         "priority": 1,
138                         "weight": 1
139                     }]
140                 },
141
142             }]
143         },
144     }
145 }
146
147 vrf_adjacency = {
148                     "adjacency": [{
149                         "id": "adj01",
150                         "local-eid": {
151                             "virtual-network-id": 7,
152                             "address-type": "ietf-lisp-address-types:ipv4-afi",
153                             "ipv4": "192.168.1.1"
154                         },
155                         "remote-eid": {
156                             "virtual-network-id": 7,
157                             "address-type": "ietf-lisp-address-types:ipv4-afi",
158                             "ipv4": "192.168.0.2"
159                         },
160                     }]
161                 }
162
163 adj_subtable = deepcopy(prepare_vrf_adjacency)
164 adj_subtable["vrf-subtable"]["remote-mappings"]\
165     ["remote-mapping"][0]["adjacencies"] = deepcopy(vrf_adjacency)
166
167
168 def create_settings_dict(subtable):
169     settings = {
170         "eid-table": {
171             "vni-table": [subtable]
172         }
173     }
174
175     return settings
176
177 lisp_settings_remote_bd = create_settings_dict(remote_bd_subtable)
178 lisp_settings_remote_vrf = create_settings_dict(remote_vrf_subtable)
179 lisp_settings_local_bd = create_settings_dict(local_bd_subtable)
180 lisp_settings_local_vrf = create_settings_dict(local_vrf_subtable)
181 lisp_settings_both_vrf = create_settings_dict(prepare_vrf_adjacency)
182
183 vat_remote_bd = {
184     "is_local": 0,
185     "vni": remote_bd_subtable["virtual-network-identifier"],
186     "eid": remote_bd_subtable["bridge-domain-subtable"]["remote-mappings"][
187         "remote-mapping"][0]["eid"]["mac"],
188 }
189
190 vat_remote_vrf = {
191     "is_local": 0,
192     "vni": remote_vrf_subtable["virtual-network-identifier"],
193     "eid": remote_vrf_subtable["vrf-subtable"]["remote-mappings"][
194         "remote-mapping"][0]["eid"]["ipv4"]+"/32",
195 }
196
197 vat_local_bd = {
198     "is_local": 1,
199     "vni": local_bd_subtable["virtual-network-identifier"],
200     "eid": local_bd_subtable["bridge-domain-subtable"]["local-mappings"][
201         "local-mapping"][0]["eid"]["mac"]
202 }
203
204 vat_local_vrf = {
205     "is_local": 1,
206     "vni": local_vrf_subtable["virtual-network-identifier"],
207     "eid": local_vrf_subtable["vrf-subtable"]["local-mappings"][
208         "local-mapping"][0]["eid"]["ipv4"]+"/32"
209 }
210
211 # variables for traffic test
212 dut_to_tg_if1_ip4 = "192.168.0.1"
213 dut_to_tg_if2_ip4 = "192.168.1.1"
214 tg_to_dut_if2_ip4 = "192.168.1.2"
215 src_ip4 = "192.168.0.2"
216 dst_ip4 = "192.168.2.2"
217 prefix_len4 = 24
218
219 local_eid4 = "192.168.0.0/24"
220 remote_eid4 = "192.168.2.0/24"
221 src_rloc4 = dut_to_tg_if2_ip4
222 dst_rloc4 = tg_to_dut_if2_ip4
223
224 lisp_traffic_table_ip4 = {
225     "virtual-network-identifier": 0,
226     "vrf-subtable": {
227         "table-id": 1,
228         "local-mappings": {
229             "local-mapping": [{
230                 "id": "local_map_vrf",
231                 "eid": {
232                     "virtual-network-id": 0,
233                     "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
234                     "ipv4-prefix": local_eid4
235                 },
236                 "locator-set": locator_set
237             }]
238         },
239         "remote-mappings": {
240             "remote-mapping": [{
241                 "id": "remote_map_vrf",
242                 "eid": {
243                     "virtual-network-id": 0,
244                     "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
245                     "ipv4-prefix": remote_eid4
246                 },
247                 "rlocs": {
248                     "locator": [{
249                         "address": tg_to_dut_if2_ip4,
250                         "priority": 1,
251                         "weight": 1
252                     }]
253                 },
254                 "adjacencies": {
255                     "adjacency": [{
256                         "id": "adj01",
257                         "local-eid": {
258                             "virtual-network-id": 0,
259                             "address-type":
260                                 "ietf-lisp-address-types:ipv4-prefix-afi",
261                             "ipv4-prefix": local_eid4
262                         },
263                         "remote-eid": {
264                             "virtual-network-id": 0,
265                             "address-type":
266                                 "ietf-lisp-address-types:ipv4-prefix-afi",
267                             "ipv4-prefix": remote_eid4
268                         },
269                     }]
270                 }
271             }]
272         },
273     }
274 }
275
276 dut_to_tg_if1_ip6 = "10::1"
277 dut_to_tg_if2_ip6 = "11::1"
278 tg_to_dut_if2_ip6 = "11::2"
279 src_ip6 = "10::2"
280 dst_ip6 = "12::2"
281 prefix_len6 = 64
282
283 local_eid6 = "10::/64"
284 remote_eid6 = "12::/64"
285 src_rloc6 = dut_to_tg_if2_ip6
286 dst_rloc6 = tg_to_dut_if2_ip6
287
288 lisp_traffic_table_ip6 = {
289     "virtual-network-identifier": 0,
290     "vrf-subtable": {
291         "table-id": 1,
292         "local-mappings": {
293             "local-mapping": [{
294                 "id": "local_map_vrf",
295                 "eid": {
296                     "virtual-network-id": 0,
297                     "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
298                     "ipv6-prefix": local_eid6
299                 },
300                 "locator-set": locator_set
301             }]
302         },
303         "remote-mappings": {
304             "remote-mapping": [{
305                 "id": "remote_map_vrf",
306                 "eid": {
307                     "virtual-network-id": 0,
308                     "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
309                     "ipv6-prefix": remote_eid6
310                 },
311                 "rlocs": {
312                     "locator": [{
313                         "address": tg_to_dut_if2_ip6,
314                         "priority": 1,
315                         "weight": 1
316                     }]
317                 },
318                 "adjacencies": {
319                     "adjacency": [{
320                         "id": "adj01",
321                         "local-eid": {
322                             "virtual-network-id": 0,
323                             "address-type":
324                                 "ietf-lisp-address-types:ipv6-prefix-afi",
325                             "ipv6-prefix": local_eid6
326                         },
327                         "remote-eid": {
328                             "virtual-network-id": 0,
329                             "address-type":
330                                 "ietf-lisp-address-types:ipv6-prefix-afi",
331                             "ipv6-prefix": remote_eid6
332                         },
333                     }]
334                 }
335             }]
336         },
337     }
338 }
339
340 lisp_traffic_ip4 = create_settings_dict(lisp_traffic_table_ip4)
341 lisp_traffic_ip6 = create_settings_dict(lisp_traffic_table_ip6)