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 """Test variables for LISP test suite."""
16 from copy import deepcopy
20 remote_bd_subtable = {
21 "virtual-network-identifier": 3,
22 "bridge-domain-subtable": {
23 "bridge-domain-ref": "bd_lisp",
26 "id": "remote_map_l2",
28 "virtual-network-id": 3,
29 "address-type": "ietf-lisp-address-types:mac-afi",
30 "mac": "aa:aa:aa:aa:aa:ab",
34 "address": "192.168.0.3",
44 remote_vrf_subtable = {
45 "virtual-network-identifier": 4,
50 "id": "remote_map_vrf",
52 "virtual-network-id": 4,
53 "address-type": "ietf-lisp-address-types:ipv4-afi",
58 "address": "192.168.0.3",
70 "virtual-network-identifier": 5,
71 "bridge-domain-subtable": {
72 "bridge-domain-ref": "bd2_lisp",
77 "address-type": "ietf-lisp-address-types:mac-afi",
78 "virtual-network-id": 5,
79 "mac": "ba:aa:aa:aa:aa:aa"
81 "locator-set": locator_set
87 local_vrf_subtable = {
88 "virtual-network-identifier": 6,
93 "id": "local_map_vrf",
95 "virtual-network-id": 6,
96 "address-type": "ietf-lisp-address-types:ipv4-afi",
99 "locator-set": locator_set
105 lisp_settings_enable = {
111 prepare_vrf_adjacency = {
112 "virtual-network-identifier": 7,
117 "id": "local_map_vrf",
119 "virtual-network-id": 7,
120 "address-type": "ietf-lisp-address-types:ipv4-afi",
121 "ipv4": "192.168.1.1"
123 "locator-set": locator_set
128 "id": "remote_map_vrf",
130 "virtual-network-id": 7,
131 "address-type": "ietf-lisp-address-types:ipv4-afi",
132 "ipv4": "192.168.0.2"
136 "address": "192.168.0.3",
151 "virtual-network-id": 7,
152 "address-type": "ietf-lisp-address-types:ipv4-afi",
153 "ipv4": "192.168.1.1"
156 "virtual-network-id": 7,
157 "address-type": "ietf-lisp-address-types:ipv4-afi",
158 "ipv4": "192.168.0.2"
163 adj_subtable = deepcopy(prepare_vrf_adjacency)
164 adj_subtable["vrf-subtable"]["remote-mappings"]\
165 ["remote-mapping"][0]["adjacencies"] = deepcopy(vrf_adjacency)
168 def create_settings_dict(subtable):
171 "vni-table": [subtable]
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)
185 "vni": remote_bd_subtable["virtual-network-identifier"],
186 "eid": remote_bd_subtable["bridge-domain-subtable"]["remote-mappings"][
187 "remote-mapping"][0]["eid"]["mac"],
192 "vni": remote_vrf_subtable["virtual-network-identifier"],
193 "eid": remote_vrf_subtable["vrf-subtable"]["remote-mappings"][
194 "remote-mapping"][0]["eid"]["ipv4"]+"/32",
199 "vni": local_bd_subtable["virtual-network-identifier"],
200 "eid": local_bd_subtable["bridge-domain-subtable"]["local-mappings"][
201 "local-mapping"][0]["eid"]["mac"]
206 "vni": local_vrf_subtable["virtual-network-identifier"],
207 "eid": local_vrf_subtable["vrf-subtable"]["local-mappings"][
208 "local-mapping"][0]["eid"]["ipv4"]+"/32"
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"
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
224 lisp_traffic_table_ip4 = {
225 "virtual-network-identifier": 0,
230 "id": "local_map_vrf",
232 "virtual-network-id": 0,
233 "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
234 "ipv4-prefix": local_eid4
236 "locator-set": locator_set
241 "id": "remote_map_vrf",
243 "virtual-network-id": 0,
244 "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
245 "ipv4-prefix": remote_eid4
249 "address": tg_to_dut_if2_ip4,
258 "virtual-network-id": 0,
260 "ietf-lisp-address-types:ipv4-prefix-afi",
261 "ipv4-prefix": local_eid4
264 "virtual-network-id": 0,
266 "ietf-lisp-address-types:ipv4-prefix-afi",
267 "ipv4-prefix": remote_eid4
276 dut_to_tg_if1_ip6 = "10::1"
277 dut_to_tg_if2_ip6 = "11::1"
278 tg_to_dut_if2_ip6 = "11::2"
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
288 lisp_traffic_table_ip6 = {
289 "virtual-network-identifier": 0,
294 "id": "local_map_vrf",
296 "virtual-network-id": 0,
297 "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
298 "ipv6-prefix": local_eid6
300 "locator-set": locator_set
305 "id": "remote_map_vrf",
307 "virtual-network-id": 0,
308 "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
309 "ipv6-prefix": remote_eid6
313 "address": tg_to_dut_if2_ip6,
322 "virtual-network-id": 0,
324 "ietf-lisp-address-types:ipv6-prefix-afi",
325 "ipv6-prefix": local_eid6
328 "virtual-network-id": 0,
330 "ietf-lisp-address-types:ipv6-prefix-afi",
331 "ipv6-prefix": remote_eid6
340 lisp_traffic_ip4 = create_settings_dict(lisp_traffic_table_ip4)
341 lisp_traffic_ip6 = create_settings_dict(lisp_traffic_table_ip6)