+ otherwise 0. (int)
+
+ :type node: dict
+ :type kwargs: dict
+ :returns: Nothing.
+ :raises ValueError: If the node has an unknown node type.
+ """
+ if node[u"type"] == NodeType.DUT:
+ cmd = u"lb_add_del_as"
+ err_msg = f"Failed to add lb as on host {node[u'host']}"
+
+ vip_addr = kwargs.pop(u"vip_addr", "0.0.0.0")
+ protocol = kwargs.pop(u"protocol", 255)
+ port = kwargs.pop(u"port", 0)
+ as_addr = kwargs.pop(u"as_addr", u"0.0.0.0")
+ is_del = kwargs.pop(u"is_del", 0)
+ is_flush = kwargs.pop(u"is_flush", 0)
+
+ vip_addr = ip_address(vip_addr).packed
+ as_addr = ip_address(as_addr).packed
+
+ args = dict(
+ pfx={
+ u"len": 128,
+ u"address": {u"un": {u"ip4": vip_addr}, u"af": 0}
+ },
+ protocol=protocol,
+ port=port,
+ as_address={u"un": {u"ip4": as_addr}, u"af": 0},
+ is_del=is_del,
+ is_flush=is_flush
+ )
+
+ with PapiSocketExecutor(node) as papi_exec:
+ papi_exec.add(cmd, **args).get_reply(err_msg)
+ else:
+ raise ValueError(
+ f"Node {node[u'host']} has unknown NodeType: '{node[u'type']}'"
+ )
+
+ @staticmethod
+ def vpp_lb_add_del_intf_nat4(node, **kwargs):
+ """Enable/disable NAT4 feature on the interface.
+
+ :param node: Node where the interface is.
+ :param kwargs: Optional key-value arguments:
+
+ is_add: true if add, false if delete. (bool)
+ interface: software index of the interface. (int)