+class LispStatus:
+ """Class for lisp API."""
+
+ @staticmethod
+ def vpp_lisp_enable_disable(node, state):
+ """Enable/Disable lisp in the VPP node in topology.
+
+ :param node: Node of the test topology.
+ :param state: State of the lisp, enable or disable.
+ :type node: dict
+ :type state: str
+ """
+ args = dict(is_en=0 if state == u"disable" else 1)
+
+ cmd = u"lisp_enable_disable"
+ err_msg = f"Failed to set LISP status on host {node[u'host']}"
+
+ with PapiSocketExecutor(node) as papi_exec:
+ papi_exec.add(cmd, **args).get_reply(err_msg)
+
+class LispRemoteMapping:
+ """Class for lisp remote mapping API."""
+
+ @staticmethod
+ def vpp_add_lisp_remote_mapping(
+ node, vni, deid, deid_prefix, seid, seid_prefix, rloc,
+ is_mac=False):
+ """Add lisp remote mapping on the VPP node in topology.
+
+ :param node: VPP node.
+ :param vni: Vni.
+ :param deid: Destination eid address.
+ :param deid_prefix: Destination eid address prefix_len.
+ :param seid: Source eid address.
+ :param seid_prefix: Source eid address prefix_len.
+ :param rloc: Receiver locator.
+ :param is_mac: Set to True if the deid/seid is MAC address.
+ :type node: dict
+ :type vni: int
+ :type deid: str
+ :type deid_prefix: int
+ :type seid: str
+ :type seid_prefix: int
+ :type rloc: str
+ :type is_mac: bool
+ """
+ if not is_mac:
+ eid_type = 0 if ip_address(deid).version == 4 else 1
+ eid_packed = ip_address(deid).packed
+ seid_packed = ip_address(seid).packed
+ eid_len = deid_prefix
+ seid_len = seid_prefix
+ else:
+ eid_type = 2
+ eid_packed = L2Util.mac_to_bin(deid)
+ seid_packed = L2Util.mac_to_bin(seid)
+ eid_len = 0
+ seid_len = 0
+
+ rlocs = [
+ dict(
+ is_ip4=1 if ip_address(rloc).version == 4 else 0,
+ addr=ip_address(rloc).packed
+ )
+ ]
+
+ args = dict(
+ is_add=1,
+ is_src_dst=1,
+ vni=int(vni),
+ eid_type=eid_type,
+ eid=eid_packed,
+ eid_len=eid_len,
+ seid=seid_packed,
+ seid_len=seid_len,
+ rloc_num=1,
+ rlocs=rlocs
+ )
+
+ cmd = u"lisp_add_del_remote_mapping"
+ err_msg = f"Failed to add remote mapping on host {node[u'host']}"
+
+ with PapiSocketExecutor(node) as papi_exec:
+ papi_exec.add(cmd, **args).get_reply(err_msg)
+
+ @staticmethod
+ def vpp_del_lisp_remote_mapping(
+ node, vni, deid, deid_prefix, seid, seid_prefix, rloc):
+ """Delete lisp remote mapping on the VPP node in topology.
+
+ :param node: VPP node.
+ :param vni: Vni.
+ :param deid: Destination eid address.
+ :param deid_prefix: Destination eid address prefix_len.
+ :param seid: Source eid address.
+ :param seid_prefix: Source eid address prefix_len.
+ :param rloc: Receiver locator.
+ :type node: dict
+ :type vni: int
+ :type deid: str
+ :type deid_prefix: int
+ :type seid: str
+ :type seid_prefix: int
+ :type rloc: str
+ """
+ # used only with IPs
+ is_mac = False
+
+ if not is_mac:
+ eid_type = 0 if ip_address(deid).version == 4 else 1
+ eid_packed = ip_address(deid).packed
+ seid_packed = ip_address(seid).packed
+ eid_len = deid_prefix
+ seid_len = seid_prefix
+ else:
+ eid_type = 2
+ eid_packed = L2Util.mac_to_bin(deid)
+ seid_packed = L2Util.mac_to_bin(seid)
+ eid_len = 0
+ seid_len = 0
+
+ rlocs = [
+ dict(
+ is_ip4=1 if ip_address(str(rloc)).version == 4 else 0,
+ addr=ip_address(str(rloc)).packed
+ )
+ ]
+
+ args = dict(
+ is_add=0,
+ is_src_dst=1,
+ vni=int(vni),
+ eid_type=eid_type,
+ eid=eid_packed,
+ eid_len=eid_len,
+ seid=seid_packed,
+ seid_len=seid_len,
+ rloc_num=1,
+ rlocs=rlocs
+ )
+
+ cmd = u"lisp_add_del_remote_mapping"
+ err_msg = f"Failed to delete remote mapping on host {node[u'host']}"
+
+ with PapiSocketExecutor(node) as papi_exec:
+ papi_exec.add(cmd, **args).get_reply(err_msg)
+
+class LispAdjacency:
+ """Class for lisp adjacency API."""