-class DhcpClient(object):
- """DHCP Client utilities."""
-
- @staticmethod
- def set_dhcp_client_on_interface(vpp_node, interface, hostname=None):
- """Set DHCP client on interface.
-
- :param vpp_node: VPP node to set DHCP client on.
- :param interface: Interface name to set DHCP client on.
- :param hostname: Hostname used in DHCP DISCOVER.
- :type vpp_node: dict
- :type interface: str
- :type hostname: str
- :raises RuntimeError: If unable to set DHCP client on interface.
- """
- sw_if_index = Topology.get_interface_sw_index(vpp_node, interface)
- interface = 'sw_if_index {}'.format(sw_if_index)
- hostname = 'hostname {}'.format(hostname) if hostname else ''
- output = VatExecutor.cmd_from_template(vpp_node,
- "dhcp_client.vat",
- interface=interface,
- hostname=hostname)
- output = output[0]
-
- if output["retval"] != 0:
- raise RuntimeError('Unable to set DHCP client on node {} and'
- ' interface {}.'
- .format(vpp_node, interface))
-
-
-class DhcpProxy(object):