CSIT-506: HC Test- Update and cleanup all suites
[csit.git] / resources / test_data / honeycomb / lisp.py
1 # Copyright (c) 2016 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 }