+
+ @staticmethod
+ def configure_interface_unnumbered(node, interface, interface_src=None):
+ """Configure the specified interface as unnumbered. The interface
+ borrows IP address from the specified source interface. If not source
+ interface is provided, unnumbered configuration will be removed.
+
+ :param node: Honeycomb node.
+ :param interface: Name, link name or sw_if_index of an interface.
+ :param interface_src: Name of source interface.
+ :type node: dict
+ :type interface: str or int
+ :type interface_src: str
+ :raises HoneycombError: If the configuration fails.
+ """
+
+ interface = InterfaceKeywords.handle_interface_reference(
+ node, interface)
+
+ path = "/interface/{0}/unnumbered-interfaces:unnumbered"\
+ .format(interface)
+
+ if interface_src:
+ data = {
+ "unnumbered": {
+ "use": interface_src
+ }
+ }
+ status_code, _ = HcUtil.put_honeycomb_data(
+ node, "config_vpp_interfaces", data, path)
+ else:
+ status_code, _ = HcUtil.delete_honeycomb_data(
+ node, "config_vpp_interfaces", path)
+
+ if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED):
+ raise HoneycombError(
+ "Configuring unnumbered interface failed. "
+ "Status code:{0}".format(status_code))
+
+ @staticmethod
+ def handle_interface_reference(node, interface):
+ """Convert any interface reference to interface name used by Honeycomb.
+
+ :param node: Honeycomb node.
+ :param interface: Name, link name or sw_if_index of an interface,
+ name of a custom interface or name of a sub-interface.
+ :type node: Honeycomb node.
+ :type interface: str or int
+ :returns: Name of interface that can be used in Honeycomb requests.
+ :rtype: str
+ """
+
+ try:
+ interface = Topology.convert_interface_reference(
+ node, interface, "name")
+ interface = interface.replace("/", "%2F")
+ except RuntimeError:
+ # interface is not in topology
+ if "." in interface:
+ # Assume it's the name of a sub-interface
+ interface, index = interface.split(".")
+ interface = interface.replace("/", "%2F")
+ interface = "{0}/vpp-vlan:sub-interfaces/sub-interface/{1}".\
+ format(interface, index)
+ else:
+ # Assume it's the name of a custom interface (pbb, vxlan, etc.)
+ interface = interface.replace("/", "%2F")
+
+ return interface