HC Test: cleanup known test failures
[csit.git] / resources / test_data / honeycomb / l2_fib.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 Honeycomb L2 FIB test suite."""
15
16 from resources.libraries.python.topology import Topology
17
18
19 def get_variables(node, interface, interface2):
20     """Creates and returns dictionary of test variables.
21
22     :param node: A Honeycomb node.
23     :param interface: Name of an interface on the specified node.
24     :param interface: Name of another interface on the specified node.
25     :type node: dict
26     :type interface: str
27     :type interface2: str
28     :return: Dictionary of test variables.
29     :rtype: dict
30     """
31     # Interface sw_if_index
32     sw_if_index = Topology.get_interface_sw_index_by_name(node, interface)
33     sw_if_index2 = Topology.get_interface_sw_index_by_name(node, interface2)
34
35     # Bridge domain name.
36     bd_name = 'test-l2-bd'
37
38     # L2 FIB MACs used in configuration.
39     notstatic = "aa:bb:cc:dd:ee:ff"
40     static = "22:22:33:44:55:66"
41     filtered = "00:01:02:03:04:05"
42
43     variables = {
44         'bd_name': bd_name,
45         # Bridge domain settings used while creating a test bridge domain.
46         'bd_settings': {
47             'flood': True,
48             'forward': True,
49             'learn': True,
50             'unknown-unicast-flood': True,
51             'arp-termination': True
52         },
53
54         # Index of created bridge domain.
55         'bd_index': 1,
56
57         # Bridge domain configuration used while adding the bridge domain to an
58         # interface.
59         'if_bd_settings': {
60             'bridge-domain': bd_name,
61             'split-horizon-group': 1,
62             'bridged-virtual-interface': False
63         },
64
65         # Add L2 FIB entry (forward).
66         # Configuration data:
67         'l2_fib_forward_cfg': {
68             "phys-address": notstatic,
69             "outgoing-interface": interface,
70             "action": "l2-fib-forward"
71         },
72
73         # Expected operational data:
74         'l2_fib_forward_oper': {
75             "phys-address": notstatic,
76             "outgoing-interface": interface,
77             "bridged-virtual-interface": False,
78             "action": "v3po:l2-fib-forward",
79             "static-config": False
80         },
81
82         # Expected VAT data:
83         'l2_fib_forward_vat': {
84             "mac": [int(x, 16) for x in notstatic.split(":")],
85             "sw_if_index": sw_if_index,
86             "static_mac": 0,
87             "filter_mac": 0,
88             "bvi_mac": 0
89           },
90
91         # Add L2 FIB entry (static, forward).
92         # Configuration data:
93         'l2_fib_static_forward_cfg': {
94             "phys-address": static,
95             "outgoing-interface": interface,
96             "static-config": True,
97             "action": "l2-fib-forward"
98         },
99
100         # Expected operational data:
101         'l2_fib_static_forward_oper': {
102             "phys-address": static,
103             "outgoing-interface": interface,
104             "bridged-virtual-interface": False,
105             "action": "v3po:l2-fib-forward",
106             "static-config": True
107         },
108
109         # Expected VAT data:
110         'l2_fib_static_forward_vat': {
111             "mac": [int(x, 16) for x in static.split(":")],
112             "sw_if_index": sw_if_index,
113             "static_mac": 1,
114             "filter_mac": 0,
115             "bvi_mac": 0
116         },
117
118         # Add L2 FIB entry (filter).
119         # Configuration data:
120         'l2_fib_filter_cfg': {
121             "phys-address": filtered,
122             "static-config": True,
123             "action": "l2-fib-filter"
124         },
125
126         # Expected operational data:
127         'l2_fib_filter_oper': {
128             "phys-address": filtered,
129             "bridged-virtual-interface": False,
130             "action": "v3po:l2-fib-filter",
131             "static-config": True
132         },
133
134         # Expected VAT data:
135         'l2_fib_filter_vat': {
136             "mac": [int(x, 16) for x in filtered.split(":")],
137             "static_mac": 1,
138             "filter_mac": 1,
139             "bvi_mac": 0
140         },
141
142         # WRONG configuration data - Add L2 FIB entry.
143         'l2_fib_forward_cfg_wrong_mac': {
144             "phys-address": "WRONG-MAC",
145             "outgoing-interface": interface,
146             "action": "l2-fib-forward"
147         },
148
149         'l2_fib_forward_cfg_wrong_if': {
150             "phys-address": notstatic,
151             "outgoing-interface": "WRONG-INTERFACE",
152             "action": "l2-fib-forward"
153         },
154
155         'l2_fib_forward_cfg_wrong_action': {
156             "phys-address": notstatic,
157             "outgoing-interface": interface,
158             "action": "WRONG-ACTION"
159         },
160
161         # Modify L2 FIB entry (forward).
162         # Configuration data:
163         'l2_fib_forward_modified_cfg': {
164             "phys-address": notstatic,
165             "outgoing-interface": sw_if_index2,
166             "action": "l2-fib-forward"
167         }
168     }
169     return variables