+
+ if if_type == "key":
+ if isinstance(interface, basestring):
+ sw_if_index = Topology.get_interface_sw_index(node, interface)
+ iface_name = Topology.get_interface_name(node, interface)
+ else:
+ sw_if_index = interface
+ elif if_type == "name":
+ iface_key = Topology.get_interface_by_name(node, interface)
+ if iface_key is not None:
+ sw_if_index = Topology.get_interface_sw_index(node, iface_key)
+ iface_name = interface
+ else:
+ raise ValueError("if_type unknown: {}".format(if_type))
+