protocol=0,
twice_nat=0,
out2in_only=0,
+ tag="",
is_add=1):
"""Add/delete NAT44 static mapping
:param protocol: IP protocol (Default value = 0)
:param twice_nat: 1 if translate external host address and port
:param out2in_only: if 1 rule is matching only out2in direction
+ :param tag: Opaque string tag
:param is_add: 1 if add, 0 if delete (Default value = 1)
"""
return self.api(
'vrf_id': vrf_id,
'protocol': protocol,
'twice_nat': twice_nat,
- 'out2in_only': out2in_only})
+ 'out2in_only': out2in_only,
+ 'tag': tag})
def nat44_add_del_identity_mapping(
self,
addr_only=1,
vrf_id=0,
protocol=0,
+ tag='',
is_add=1):
"""Add/delete NAT44 identity mapping
:param addr_only: 1 if address only mapping, 0 if address and port
:param vrf_id: VRF ID
:param protocol: IP protocol (Default value = 0)
+ :param tag: Opaque string tag
:param is_add: 1 if add, 0 if delete (Default value = 1)
"""
return self.api(
'port': port,
'sw_if_index': sw_if_index,
'vrf_id': vrf_id,
+ 'tag': tag,
'protocol': protocol})
def nat44_add_del_address_range(
vrf_id=0,
twice_nat=0,
out2in_only=0,
+ tag='',
local_num=0,
locals=[],
is_add=1):
"""Add/delete NAT44 load balancing static mapping
:param twice_nat: 1 if translate external host address and port
+ :param tag: Opaque string tag
:param is_add - 1 if add, 0 if delete
"""
return self.api(
'vrf_id': vrf_id,
'twice_nat': twice_nat,
'out2in_only': out2in_only,
+ 'tag': tag,
'local_num': local_num,
'locals': locals})
'end_addr': end_addr,
'is_add': is_add})
+ def nat66_add_del_interface(
+ self,
+ sw_if_index,
+ is_inside=1,
+ is_add=1):
+ """Enable/disable NAT66 feature on the interface
+ :param sw_if_index: Index of the interface
+ :param is_inside: 1 if inside, 0 if outside (Default value = 1)
+ :param is_add: 1 if add, 0 if delete (Default value = 1)
+ """
+ return self.api(
+ self.papi.nat66_add_del_interface,
+ {'sw_if_index': sw_if_index,
+ 'is_inside': is_inside,
+ 'is_add': is_add})
+
+ def nat66_add_del_static_mapping(
+ self,
+ in_ip,
+ out_ip,
+ vrf_id=0,
+ is_add=1):
+ """Add/delete NAT66 static mapping
+
+ :param in_ip: Inside IPv6 address
+ :param out_ip: Outside IPv6 address
+ :param vrf_id: VRF ID (Default value = 0)
+ :param is_add: 1 if add, 0 if delete (Default value = 1)
+ """
+ return self.api(
+ self.papi.nat66_add_del_static_mapping,
+ {'local_ip_address': in_ip,
+ 'external_ip_address': out_ip,
+ 'vrf_id': vrf_id,
+ 'is_add': is_add})
+
+ def nat66_interface_dump(self):
+ """Dump interfaces with NAT66 feature
+ :return: Dictionary of interfaces with NAT66 feature
+ """
+ return self.api(self.papi.nat66_interface_dump, {})
+
+ def nat66_static_mapping_dump(self):
+ """Dump NAT66 static mappings
+ :return: Dictionary of NAT66 static mappings
+ """
+ return self.api(self.papi.nat66_static_mapping_dump, {})
+
def control_ping(self):
self.api(self.papi.control_ping)