X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_papi_provider.py;h=d84012b2d2b931fe09adf5c095fc7ba9034b5c9f;hb=57938f63cc6743193c76d4fa89ad3250a5f76b56;hp=c3127f84022390636bb1c8c84cf5d7aeefd53c93;hpb=b598f1d3d7d4ace9a29c01d93a8d1ba616a91e15;p=vpp.git diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index c3127f84022..d84012b2d2b 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -195,7 +195,7 @@ class VppPapiProvider(object): 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): """ """ @@ -747,7 +747,7 @@ class VppPapiProvider(object): is_classify=0, is_multipath=0, is_l2_bridged=0, - not_last=0): + is_source_lookup=0): """ :param dst_address_length: @@ -766,7 +766,8 @@ class VppPapiProvider(object): :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) """ @@ -788,7 +789,7 @@ class VppPapiProvider(object): '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, @@ -1020,8 +1021,7 @@ class VppPapiProvider(object): is_drop=0, is_multipath=0, classify_table_index=0xFFFFFFFF, - is_classify=0, - not_last=0): + is_classify=0): """ :param dst_address_length: @@ -1041,7 +1041,6 @@ class VppPapiProvider(object): :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) """ @@ -1324,7 +1323,7 @@ class VppPapiProvider(object): protocol, vrf_id=0, local_num=0, - locals=None, + locals=[], is_add=1): """Add/delete NAT44 load balancing static mapping @@ -1347,6 +1346,29 @@ class VppPapiProvider(object): """ 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, @@ -2038,7 +2060,7 @@ class VppPapiProvider(object): eid, eid_prefix_len=0, vni=0, - rlocs=None, + rlocs=[], rlocs_num=0, is_src_dst=0, is_add=1): @@ -2422,3 +2444,60 @@ class VppPapiProvider(object): 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})