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:
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 Honeycomb L2 FIB test suite."""
16 from resources.libraries.python.topology import Topology
19 def get_variables(node, interface, interface2):
20 """Creates and returns dictionary of test variables.
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.
28 :return: Dictionary of test variables.
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)
36 bd_name = 'test-l2-bd'
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"
45 # Bridge domain settings used while creating a test bridge domain.
50 'unknown-unicast-flood': True,
51 'arp-termination': True
54 # Index of created bridge domain.
57 # Bridge domain configuration used while adding the bridge domain to an
60 'bridge-domain': bd_name,
61 'split-horizon-group': 1,
62 'bridged-virtual-interface': False
65 # Add L2 FIB entry (forward).
67 'l2_fib_forward_cfg': {
68 "phys-address": notstatic,
69 "outgoing-interface": interface,
70 "action": "l2-fib-forward"
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
83 'l2_fib_forward_vat': {
84 "mac": [int(x, 16) for x in notstatic.split(":")],
85 "sw_if_index": sw_if_index,
91 # Add L2 FIB entry (static, forward).
93 'l2_fib_static_forward_cfg': {
94 "phys-address": static,
95 "outgoing-interface": interface,
96 "static-config": True,
97 "action": "l2-fib-forward"
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
110 'l2_fib_static_forward_vat': {
111 "mac": [int(x, 16) for x in static.split(":")],
112 "sw_if_index": sw_if_index,
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"
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
135 'l2_fib_filter_vat': {
136 "mac": [int(x, 16) for x in filtered.split(":")],
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"
149 'l2_fib_forward_cfg_wrong_if': {
150 "phys-address": notstatic,
151 "outgoing-interface": "WRONG-INTERFACE",
152 "action": "l2-fib-forward"
155 'l2_fib_forward_cfg_wrong_action': {
156 "phys-address": notstatic,
157 "outgoing-interface": interface,
158 "action": "WRONG-ACTION"
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"