1 # Copyright (c) 2017 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 data for Honeycomb routing test."""
16 from resources.libraries.python.topology import Topology
19 def get_variables(node, ip_version, out_interface):
21 out_interface = Topology.convert_interface_reference(
22 node, out_interface, "name")
24 ip_version = ip_version.lower()
27 # base network settings
29 "dut_to_tg_if1_ip": "16.0.0.1",
30 "dut_to_tg_if2_ip": "16.0.1.1",
33 "dst_net": "16.0.2.0",
35 "next_hop": "16.0.1.2",
36 "next_hop1": "16.0.1.3",
37 "next_hop2": "16.0.1.4",
38 "next_hop_mac1": "00:11:22:33:44:55",
39 "next_hop_mac2": "11:22:33:44:55:66"
43 "dut_to_tg_if1_ip": "10::1",
44 "dut_to_tg_if2_ip": "11::1",
52 "next_hop_mac1": "00:11:22:33:44:55",
53 "next_hop_mac2": "11:22:33:44:55:66"
56 if ip_version == "ipv4":
57 variables.update(ipv4_base)
58 elif ip_version == "ipv6":
59 variables.update(ipv6_base)
61 raise ValueError("IP version must be either IPv4 or IPv6.")
63 # route configuration used in tests
67 "description": "single hop ipv4",
69 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
70 "next-hop": ipv4_base["next_hop"],
71 "outgoing-interface": out_interface,
76 "description": "multi hop ipv4",
78 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
83 "address": ipv4_base["next_hop1"],
84 "outgoing-interface": out_interface,
89 "address": ipv4_base["next_hop2"],
90 "outgoing-interface": out_interface,
98 "description": "blackhole ipv4",
100 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
101 "special-next-hop": "receive"
105 "description": "single hop ipv6",
106 "destination-prefix":
107 "{0}/{1}".format(ipv6_base["dst_net"], ipv6_base["prefix_len"]),
108 "next-hop": ipv6_base["next_hop"],
109 "outgoing-interface": out_interface,
114 "description": "multi hop ipv6",
115 "destination-prefix":
116 "{0}/{1}".format(ipv6_base["dst_net"], ipv6_base["prefix_len"]),
121 "address": ipv6_base["next_hop1"],
122 "outgoing-interface": out_interface,
127 "address": ipv6_base["next_hop2"],
128 "outgoing-interface": out_interface,
136 "description": "blackhole ipv6",
137 "destination-prefix":
138 "{0}/{1}".format(ipv6_base["dst_net"], ipv6_base["prefix_len"]),
139 "special-next-hop": "blackhole"
143 # expected route operational data
146 "destination-prefix":
147 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
148 "next-hop": ipv4_base["next_hop"],
149 "outgoing-interface": out_interface,
150 "vpp-ipv4-route-state": {}
153 "destination-prefix":
154 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
158 "address": ipv4_base["next_hop1"],
159 "outgoing-interface": out_interface,
163 "address": ipv4_base["next_hop2"],
164 "outgoing-interface": out_interface,
169 'vpp-ipv4-route-state': {}
172 "destination-prefix":
173 "{0}/{1}".format(ipv4_base["dst_net"], ipv4_base["prefix_len"]),
174 "special-next-hop": "receive",
175 "vpp-ipv4-route-state": {}
178 "destination-prefix":
179 "{0}/{1}".format(ipv6_base["dst_net"],
180 ipv6_base["prefix_len"]),
181 "next-hop": ipv6_base["next_hop"],
182 "outgoing-interface": out_interface,
183 "vpp-ipv6-route-state": {}
186 "destination-prefix":
187 "{0}/{1}".format(ipv6_base["dst_net"],
188 ipv6_base["prefix_len"]),
192 "address": ipv6_base["next_hop1"],
193 "outgoing-interface": out_interface,
197 "address": ipv6_base["next_hop2"],
198 "outgoing-interface": out_interface,
203 "vpp-ipv6-route-state": {}
206 "destination-prefix":
207 "{0}/{1}".format(ipv6_base["dst_net"],
208 ipv6_base["prefix_len"]),
209 "special-next-hop": "blackhole",
210 'vpp-ipv6-route-state': {}
214 for item in tables_oper.values():
215 if "next-hop-list" in item.keys():
216 item["next-hop-list"]["next-hop"].sort()
218 variables.update(tables_cfg)
219 variables.update(tables_oper)