- if vxlan_count > 10:
- commands = list()
- for i in range(0, vxlan_count):
- vxlan_subif_key = Topology.add_new_port(node, u"vxlan_tunnel")
- vxlan_subif_name = f"vxlan_tunnel{i}"
- founds = dict(vxlan=False, vlan=False)
- vxlan_subif_idx = None
- vlan_subif_key = Topology.add_new_port(node, u"vlan_subif")
- vlan_subif_name = \
- f"{Topology.get_interface_name(node, node_vlan_if)}.{i + 1}"
- vlan_idx = None
- for data in if_data:
- if_name = data[u"interface_name"]
- if not founds[u"vxlan"] and if_name == vxlan_subif_name:
- vxlan_subif_idx = data[u"sw_if_index"]
- founds[u"vxlan"] = True
- elif not founds[u"vlan"] and if_name == vlan_subif_name:
- vlan_idx = data[u"sw_if_index"]
- founds[u"vlan"] = True
- if founds[u"vxlan"] and founds[u"vlan"]:
- break
- Topology.update_interface_sw_if_index(
- node, vxlan_subif_key, vxlan_subif_idx)
- Topology.update_interface_name(
- node, vxlan_subif_key, vxlan_subif_name)
- commands.append(
- f"sw_interface_set_flags sw_if_index {vxlan_subif_idx} "
- f"admin-up link-up\n"
- )
- Topology.update_interface_sw_if_index(
- node, vlan_subif_key, vlan_idx
- )
- Topology.update_interface_name(
- node, vlan_subif_key, vlan_subif_name
- )
- commands.append(
- f"sw_interface_set_flags sw_if_index {vlan_idx} admin-up "
- f"link-up\n"
- )
- VatExecutor().write_and_execute_script(
- node, u"/tmp/put_subinterfaces_up.config", commands
- )
- return
-