return cli + "\n" + str(self.cli(cli))
def _convert_mac(self, mac):
- return int(mac.replace(":", ""), 16) << 16
+ return mac.replace(':', '').decode('hex')
def show_version(self):
""" """
is_classify=0,
is_multipath=0,
is_l2_bridged=0,
- not_last=0):
+ is_source_lookup=0):
"""
:param dst_address_length:
:param is_multipath: (Default value = 0)
:param is_resolve_host: (Default value = 0)
:param is_resolve_attached: (Default value = 0)
- :param not_last: (Default value = 0)
+ :param is_l2_bridged: (Default value = 0)
+ :param is_source_lookup: (Default value = 0)
:param next_hop_weight: (Default value = 1)
"""
'is_resolve_host': is_resolve_host,
'is_resolve_attached': is_resolve_attached,
'is_l2_bridged': is_l2_bridged,
- 'not_last': not_last,
+ 'is_source_lookup': is_source_lookup,
'next_hop_weight': next_hop_weight,
'dst_address_length': dst_address_length,
'dst_address': dst_address,
is_drop=0,
is_multipath=0,
classify_table_index=0xFFFFFFFF,
- is_classify=0,
- not_last=0):
+ is_classify=0):
"""
:param dst_address_length:
:param is_multicast: (Default value = 0)
:param is_resolve_host: (Default value = 0)
:param is_resolve_attached: (Default value = 0)
- :param not_last: (Default value = 0)
:param next_hop_weight: (Default value = 1)
"""
protocol,
vrf_id=0,
local_num=0,
- locals=None,
+ locals=[],
is_add=1):
"""Add/delete NAT44 load balancing static mapping
"""
return self.api(self.papi.nat44_lb_static_mapping_dump, {})
+ def nat44_del_session(
+ self,
+ addr,
+ port,
+ protocol,
+ vrf_id=0,
+ is_in=1):
+ """Delete NAT44 session
+
+ :param addr: IPv4 address
+ :param por: port number
+ :param protocol: IP protocol number
+ :param vrf_id: VRF ID
+ :param is_in: 1 if inside network addres and port pari, 0 if outside
+ """
+ return self.api(
+ self.papi.nat44_del_session,
+ {'address': addr,
+ 'port': port,
+ 'protocol': protocol,
+ 'vrf_id': vrf_id,
+ 'is_in': is_in})
+
def nat_det_add_del_map(
self,
in_addr,
eid,
eid_prefix_len=0,
vni=0,
- rlocs=None,
+ rlocs=[],
rlocs_num=0,
is_src_dst=0,
is_add=1):
return self.api(
self.papi.macip_acl_dump, {'acl_index': acl_index})
+
+ def policer_add_del(self,
+ name,
+ cir,
+ eir,
+ cb,
+ eb,
+ is_add=1,
+ rate_type=0,
+ round_type=0,
+ ptype=0,
+ color_aware=0,
+ conform_action_type=1,
+ conform_dscp=0,
+ exceed_action_type=0,
+ exceed_dscp=0,
+ violate_action_type=0,
+ violate_dscp=0):
+ return self.api(self.papi.policer_add_del,
+ {'name': name,
+ 'cir': cir,
+ 'eir': eir,
+ 'cb': cb,
+ 'eb': eb,
+ 'is_add': is_add,
+ 'rate_type': rate_type,
+ 'round_type': round_type,
+ 'type': ptype,
+ 'color_aware': color_aware,
+ 'conform_action_type': conform_action_type,
+ 'conform_dscp': conform_dscp,
+ 'exceed_action_type': exceed_action_type,
+ 'exceed_dscp': exceed_dscp,
+ 'violate_action_type': violate_action_type,
+ 'violate_dscp': violate_dscp})
+
+ def ip_punt_police(self,
+ policer_index,
+ is_ip6=0,
+ is_add=1):
+ return self.api(self.papi.ip_punt_police,
+ {'policer_index': policer_index,
+ 'is_add': is_add,
+ 'is_ip6': is_ip6})
+
+ def ip_punt_redirect(self,
+ rx_sw_if_index,
+ tx_sw_if_index,
+ nh,
+ is_ip6=0,
+ is_add=1):
+ return self.api(self.papi.ip_punt_redirect,
+ {'rx_sw_if_index': rx_sw_if_index,
+ 'tx_sw_if_index': tx_sw_if_index,
+ 'nh': nh,
+ 'is_add': is_add,
+ 'is_ip6': is_ip6})