049d222b7bba04937a4f25c74409cf016f762ea8
[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 remote_vrf_adjacency = {
112                     "adjacency": {
113                         "id": "adj01",
114                         "local-eid": {
115                             "virtual-network-id": 4,
116                             "address-type": "ietf-lisp-address-types:ipv4-afi",
117                             "ipv4": "192.168.1.1"
118                         },
119                         "remote-eid": {
120                             "virtual-network-id": 4,
121                             "address-type": "ietf-lisp-address-types:ipv4-afi",
122                             "ipv4": "192.168.0.2"
123                         },
124                     }
125                 }
126
127 remote_adj_subtable = deepcopy(remote_vrf_subtable)
128 remote_adj_subtable["vrf-subtable"]["remote-mappings"]\
129     ["remote-mapping"][0]["adjacencies"] = {}.update(remote_vrf_adjacency)
130
131
132 def create_settings_dict(subtable):
133     settings = {
134         "eid-table": {
135             "vni-table": [subtable]
136         }
137     }
138
139     return settings
140
141 lisp_settings_remote_bd = create_settings_dict(remote_bd_subtable)
142 lisp_settings_remote_vrf = create_settings_dict(remote_vrf_subtable)
143 lisp_settings_local_bd = create_settings_dict(local_bd_subtable)
144 lisp_settings_local_vrf = create_settings_dict(local_vrf_subtable)
145
146 vat_remote_bd = {
147     "is_local": 0,
148     "vni": remote_bd_subtable["virtual-network-identifier"],
149     "eid": remote_bd_subtable["bridge-domain-subtable"]["remote-mappings"][
150         "remote-mapping"][0]["eid"]["mac"],
151 }
152
153 vat_remote_vrf = {
154     "is_local": 0,
155     "vni": remote_vrf_subtable["virtual-network-identifier"],
156     "eid": remote_vrf_subtable["vrf-subtable"]["remote-mappings"][
157         "remote-mapping"][0]["eid"]["ipv4"]+"/32",
158 }
159
160 vat_local_bd = {
161     "is_local": 1,
162     "vni": local_bd_subtable["virtual-network-identifier"],
163     "eid": local_bd_subtable["bridge-domain-subtable"]["local-mappings"][
164         "local-mapping"][0]["eid"]["mac"]
165 }
166
167 vat_local_vrf = {
168     "is_local": 1,
169     "vni": local_vrf_subtable["virtual-network-identifier"],
170     "eid": local_vrf_subtable["vrf-subtable"]["local-mappings"][
171         "local-mapping"][0]["eid"]["ipv4"]+"/32"
172 }