aboutsummaryrefslogtreecommitdiffstats
path: root/resources/test_data/honeycomb/sub_interfaces.py
blob: 3955089b5602a3e0fe8149969e0a1a3d6b1236d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Test variables for Honeycomb sub-interface test suite."""

from copy import deepcopy

# Sub-interface 1 and its settings:
sub_if_1_settings = {
    "identifier": "1",
    "vlan-type": "802dot1q",
    "enabled": "false"
}

sub_if_1_tags = [
    {
        "index": "0",
        "dot1q-tag": {
            "tag-type": "dot1q-types:s-vlan",
            "vlan-id": "100"
        }
    },
    {
        "index": "1",
        "dot1q-tag": {
            "tag-type": "dot1q-types:c-vlan",
            "vlan-id": "any"
        }
    }
]

sub_if_1_match = "vlan-tagged"

# Expected operational data: sub-interface.
sub_if_1_oper = {
    "identifier": 1,
    "oper-status": "down",
    "admin-status": "down",
    "tags": {
        "tag": [
            {
                "index": 0,
                "dot1q-tag": {
                    "tag-type": "dot1q-types:s-vlan",
                    "vlan-id": 100
                }
            },
            {
                "index": 1,
                "dot1q-tag": {
                    "tag-type": "dot1q-types:c-vlan",
                    "vlan-id": "any"
                }
            },
        ]
    },
    "match": {
        "vlan-tagged": {
            "match-exact-tags": False
        }
    }
}

# Bridge domain name.
bd_name = 'test-sub-bd'

# Bridge domain settings used while creating a test bridge domain.
bd_settings = {
    'flood': True,
    'forward': True,
    'learn': True,
    'unknown-unicast-flood': True,
    'arp-termination': True
}

# Bridge domain configuration used while adding the sub-interface to the bridge
# domain.
sub_bd_settings = {
    'bridge-domain': bd_name,
    'split-horizon-group': 1,
    'bridged-virtual-interface': False
}

# Configuration data: Enable tag-rewrite push.
tag_rewrite_push = {
    "vlan-type": "vpp-vlan:802dot1q",
    "push-tags": [
        {
            "index": 0,
            "dot1q-tag": {
                "tag-type": "dot1q-types:s-vlan",
                "vlan-id": 123
            }
        },
        {
            "index": 1,
            "dot1q-tag": {
                "tag-type": "dot1q-types:c-vlan",
                "vlan-id": 456
            }
        }
    ]
}

# Expected operational data: tag-rewrite push.
tag_rewrite_push_oper = {
    "vlan-type": "vpp-vlan:802dot1q",
    "push-tags": [
        {
            "index": 0,
            "dot1q-tag": {
                "tag-type": "dot1q-types:s-vlan",
                "vlan-id": 123
            }
        },
        {
            "index": 1,
            "dot1q-tag": {
                "tag-type": "dot1q-types:c-vlan",
                "vlan-id": 456
            }
        }
    ]
}

# Expected VAT data: tag-rewrite push.
tag_rewrite_push_VAT = {
    'sub_default': 0,
    'sub_dot1ad': 0,
    'sub_exact_match': 0,
    'sub_inner_vlan_id': 0,
    'sub_inner_vlan_id_any': 1,
    'sub_number_of_tags': 2,
    'sub_outer_vlan_id': 100,
    'sub_outer_vlan_id_any': 0,
    'vtr_op': 2,
    'vtr_push_dot1q': 1,
    'vtr_tag1': 123,
    'vtr_tag2': 456
}

# Configuration data: Enable tag-rewrite pop 1.
tag_rewrite_pop_1 = {
    "pop-tags": "1"
}

# Expected operational data: tag-rewrite pop 1.
tag_rewrite_pop_1_oper = {
    "vlan-type": "vpp-vlan:802dot1ad",
    "pop-tags": 1
}

# Expected VAT data: tag-rewrite pop 1.
tag_rewrite_pop_1_VAT = {
    'sub_default': 0,
    'sub_dot1ad': 0,
    'sub_exact_match': 0,
    'sub_inner_vlan_id': 0,
    'sub_inner_vlan_id_any': 1,
    'sub_number_of_tags': 2,
    'sub_outer_vlan_id': 100,
    'sub_outer_vlan_id_any': 0,
    'vtr_op': 3,
    'vtr_push_dot1q': 0,
    'vtr_tag1': 0,
    'vtr_tag2': 0
}

# Configuration data: Enable tag-rewrite translate 1-2.
tag_rewrite_translate_1_2 = {
    "vlan-type": "vpp-vlan:802dot1q",
    "pop-tags": "1",
    "push-tags": [
        {
            "index": 0,
            "dot1q-tag": {
                "tag-type": "dot1q-types:s-vlan",
                "vlan-id": 111
            }
        },
        {
            "index": 1,
            "dot1q-tag": {
                "tag-type": "dot1q-types:c-vlan",
                "vlan-id": 222
            }
        }
    ]
}

# Expected operational data: tag-rewrite translate 1-2.
tag_rewrite_translate_1_2_oper = {
    "vlan-type": "vpp-vlan:802dot1q",
    "pop-tags": 1,
    "push-tags": [
        {
            "index": 0,
            "dot1q-tag": {
                "tag-type": "dot1q-types:s-vlan",
                "vlan-id": 111
            }
        },
        {
            "index": 1,
            "dot1q-tag": {
                "tag-type": "dot1q-types:c-vlan",
                "vlan-id": 222
            }
        },
    ]
}

# Expected VAT data: tag-rewrite translate 1-2.
tag_rewrite_translate_1_2_VAT = {
    'sub_default': 0,
    'sub_dot1ad': 0,
    'sub_exact_match': 0,
    'sub_inner_vlan_id': 0,
    'sub_inner_vlan_id_any': 1,
    'sub_number_of_tags': 2,
    'sub_outer_vlan_id': 100,
    'sub_outer_vlan_id_any': 0,
    'vtr_op': 6,
    'vtr_push_dot1q': 1,
    'vtr_tag1': 111,
    'vtr_tag2': 222
}

# Configuration data: Disable tag-rewrite.
tag_rewrite_disabled = {}

# Expected VAT data: Disable tag-rewrite.
tag_rewrite_disabled_VAT = {
    'sub_default': 0,
    'sub_dot1ad': 0,
    'sub_exact_match': 0,
    'sub_inner_vlan_id': 0,
    'sub_inner_vlan_id_any': 1,
    'sub_number_of_tags': 2,
    'sub_outer_vlan_id': 100,
    'sub_outer_vlan_id_any': 0,
    'vtr_op': 0,
    'vtr_push_dot1q': 0,
    'vtr_tag1': 0,
    'vtr_tag2': 0
}

# Configuration data:
# Wrong vlan-type for enable tag-rewrite translate 1-2.
tag_rewrite_translate_1_2_wrong = {
    "vlan-type": "vpp-vlan:WRONG",
    "pop-tags": "1",
    "push-tags": [
        {
            "index": 0,
            "dot1q-tag": {
                "tag-type": "dot1q-types:s-vlan",
                "vlan-id": 111
            }
        },
        {
            "index": 1,
            "dot1q-tag": {
                "tag-type": "dot1q-types:c-vlan",
                "vlan-id": 222
            }
        }
    ]
}

# IP addresses configured on sub-interface during tests
ipv4 = {
    "address": "192.168.0.4",
    "netmask": "255.255.255.0",
    "prefix-length": 24}
ipv4_2 = {
    "address": "192.168.0.5",
    "netmask": "255.255.0.0",
    "prefix-length": 16}

sub_if_2_settings = sub_if_1_settings
sub_if_2_tags = sub_if_1_tags
sub_if_2_match = "vlan-tagged-exact-match"
sub_if_2_oper = deepcopy(sub_if_1_oper)
sub_if_2_oper["match"]["vlan-tagged"]["match-exact-tags"] = True

ipv6 = {
    "address": "10::10",
    "prefix-length": 24}
ipv6_2 = {
    "address": "10::11",
    "prefix-length": 16}