- @staticmethod
- def set_nat44_deterministic(node, ip_in, subnet_in, ip_out, subnet_out):
- """Set deterministic behaviour of NAT44.
-
- :param node: DUT node.
- :param ip_in: Inside IP.
- :param subnet_in: Inside IP subnet.
- :param ip_out: Outside IP.
- :param subnet_out: Outside IP subnet.
- :type node: dict
- :type ip_in: str
- :type subnet_in: str or int
- :type ip_out: str
- :type subnet_out: str or int
- """
- cmd = u"nat_det_add_del_map"
- err_msg = f"Failed to set deterministic behaviour of NAT " \
- f"on host {node[u'host']}"
- args_in = dict(
- is_add=True,
- in_addr=IPv4Address(str(ip_in)).packed,
- in_plen=int(subnet_in),
- out_addr=IPv4Address(str(ip_out)).packed,
- out_plen=int(subnet_out)
- )
-
- with PapiSocketExecutor(node) as papi_exec:
- papi_exec.add(cmd, **args_in).get_reply(err_msg)
-