X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_papi_provider.py;h=61d80b21fb54024c80e0054f33d1dcd315c6fa50;hb=bb4e0225;hp=6ea1d2f3b3a2e875eaf4357d4d266ce326c47498;hpb=1855b8e48d95289cc9f0a6e339f2148d64ac705c;p=vpp.git diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 6ea1d2f3b3a..61d80b21fb5 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -275,6 +275,10 @@ class VppPapiProvider(object): 'unnumbered_sw_if_index': sw_if_index, 'is_add': is_add}) + def ip_unnumbered_dump(self, sw_if_index=0xffffffff): + return self.api(self.papi.ip_unnumbered_dump, + {'sw_if_index': sw_if_index}) + def sw_interface_enable_disable_mpls(self, sw_if_index, is_enable=1): """ @@ -1145,15 +1149,13 @@ class VppPapiProvider(object): 'session_id': session_id} ) - def udp_encap_add_del(self, - id, - src_ip, - dst_ip, - src_port, - dst_port, - table_id=0, - is_add=1, - is_ip6=0): + def udp_encap_add(self, + id, + src_ip, + dst_ip, + src_port, + dst_port, + table_id=0): """ Add a GRE tunnel :param id: user provided ID :param src_ip: @@ -1161,21 +1163,23 @@ class VppPapiProvider(object): :param src_port: :param dst_port: :param outer_fib_id: (Default value = 0) - :param is_add: (Default value = 1) - :param is_ipv6: (Default value = 0) """ return self.api( - self.papi.udp_encap_add_del, - {'id': id, - 'is_add': is_add, - 'is_ip6': is_ip6, - 'src_ip': src_ip, - 'dst_ip': dst_ip, - 'src_port': src_port, - 'dst_port': dst_port, - 'table_id': table_id} - ) + self.papi.udp_encap_add, + { + 'udp_encap': { + 'id': id, + 'src_ip': src_ip, + 'dst_ip': dst_ip, + 'src_port': src_port, + 'dst_port': dst_port, + 'table_id': table_id + } + }) + + def udp_encap_del(self, id): + return self.api(self.papi.udp_encap_del, {'id': id}) def udp_encap_dump(self): return self.api(self.papi.udp_encap_dump, {}) @@ -1341,6 +1345,7 @@ class VppPapiProvider(object): 'mt_next_hop_n_out_labels': next_hop_n_out_labels, 'mt_next_hop_sw_if_index': next_hop_sw_if_index, 'mt_next_hop_table_id': next_hop_table_id, + 'mt_next_hop_via_label': next_hop_via_label, 'mt_next_hop_out_label_stack': next_hop_out_label_stack}) def nat44_interface_add_del_feature( @@ -1585,11 +1590,11 @@ class VppPapiProvider(object): external_addr, external_port, protocol, - vrf_id=0, twice_nat=0, self_twice_nat=0, out2in_only=0, tag='', + affinity=0, local_num=0, locals=[], is_add=1): @@ -1597,6 +1602,7 @@ class VppPapiProvider(object): :param twice_nat: 1 if translate external host address and port :param tag: Opaque string tag + :param affinity: if 0 disabled, otherwise client IP affinity timeout :param is_add - 1 if add, 0 if delete """ return self.api( @@ -1605,11 +1611,11 @@ class VppPapiProvider(object): 'external_addr': external_addr, 'external_port': external_port, 'protocol': protocol, - 'vrf_id': vrf_id, 'twice_nat': twice_nat, 'self_twice_nat': self_twice_nat, 'out2in_only': out2in_only, 'tag': tag, + 'affinity': affinity, 'local_num': local_num, 'locals': locals}) @@ -1764,13 +1770,13 @@ class VppPapiProvider(object): """ return self.api(self.papi.nat_det_map_dump, {}) - def nat_det_set_timeouts( + def nat_set_timeouts( self, udp=300, tcp_established=7440, tcp_transitory=240, icmp=60): - """Set values of timeouts for deterministic NAT (in seconds) + """Set values of timeouts for NAT sessions (in seconds) :param udp - UDP timeout (Default value = 300) :param tcp_established - TCP established timeout (Default value = 7440) @@ -1778,18 +1784,62 @@ class VppPapiProvider(object): :param icmp - ICMP timeout (Default value = 60) """ return self.api( - self.papi.nat_det_set_timeouts, + self.papi.nat_set_timeouts, {'udp': udp, 'tcp_established': tcp_established, 'tcp_transitory': tcp_transitory, 'icmp': icmp}) - def nat_det_get_timeouts(self): - """Get values of timeouts for deterministic NAT + def nat_get_timeouts(self): + """Get values of timeouts for NAT sessions - :return: Timeouts for deterministic NAT (in seconds) + :return: Timeouts for NAT sessions (in seconds) """ - return self.api(self.papi.nat_det_get_timeouts, {}) + return self.api(self.papi.nat_get_timeouts, {}) + + def nat_set_addr_and_port_alloc_alg( + self, + alg=0, + psid_offset=0, + psid_length=0, + psid=0, + start_port=0, + end_port=0): + """Set address and port assignment algorithm + + :param alg: algorithm: 0 - default, 1 - MAP-E, 2 - port range + :param psid_offset: number of offset bits (valid only for MAP-E alg) + :param psid_length: length of PSID (valid only for MAP-E alg) + :param psid: Port Set Identifier value (valid only for MAP-E alg) + :param start_port: beginning of the port range + :param end_port: end of the port range + """ + return self.api( + self.papi.nat_set_addr_and_port_alloc_alg, + {'alg': alg, + 'psid_offset': psid_offset, + 'psid_length': psid_length, + 'psid': psid, + 'start_port': start_port, + 'end_port': end_port}) + + def nat_get_addr_and_port_alloc_alg(self): + """Get address and port assignment algorithm""" + return self.api(self.papi.nat_get_addr_and_port_alloc_alg, {}) + + def nat_set_mss_clamping(self, enable=0, mss_value=1500): + """Set TCP MSS rewriting configuration + + :param enable: disable(0)/enable(1) MSS rewriting feature + :param mss_value: MSS value to be used for MSS rewriting + """ + return self.api( + self.papi.nat_set_mss_clamping, + {'enable': enable, 'mss_value': mss_value}) + + def nat_get_mss_clamping(self): + """Get TCP MSS rewriting configuration""" + return self.api(self.papi.nat_get_mss_clamping, {}) def nat_det_close_session_out( self, @@ -2232,6 +2282,8 @@ class VppPapiProvider(object): :param current_data_offset: (Default value = 0) """ + mask_len = ((len(mask) - 1) / 16 + 1) * 16 + mask = mask + '\0' * (mask_len - len(mask)) return self.api( self.papi.classify_add_del_table, {'is_add': is_add, @@ -2244,6 +2296,7 @@ class VppPapiProvider(object): 'miss_next_index': miss_next_index, 'current_data_flag': current_data_flag, 'current_data_offset': current_data_offset, + 'mask_len': mask_len, 'mask': mask}) def classify_add_del_session( @@ -2267,6 +2320,8 @@ class VppPapiProvider(object): :param metadata: (Default value = 0) """ + match_len = ((len(match) - 1) / 16 + 1) * 16 + match = match + '\0' * (match_len - len(match)) return self.api( self.papi.classify_add_del_session, {'is_add': is_add, @@ -2276,6 +2331,7 @@ class VppPapiProvider(object): 'advance': advance, 'action': action, 'metadata': metadata, + 'match_len': match_len, 'match': match}) def input_acl_set_interface( @@ -2681,6 +2737,45 @@ class VppPapiProvider(object): 'protocol': protocol, 'vni': vni}) + def vxlan_gbp_tunnel_add_del( + self, + src, + dst, + mcast_sw_if_index=0xFFFFFFFF, + is_add=1, + is_ipv6=0, + encap_table_id=0, + decap_next_index=0xFFFFFFFF, + vni=0, + instance=0xFFFFFFFF): + """ + + :param dst_addr: + :param src_addr: + :param is_add: (Default value = 1) + :param is_ipv6: (Default value = 0) + :param encap_table_id: (Default value = 0) + :param decap_next_index: (Default value = 0xFFFFFFFF) + :param mcast_sw_if_index: (Default value = 0xFFFFFFFF) + :param vni: (Default value = 0) + :param instance: (Default value = 0xFFFFFFFF) + + """ + return self.api(self.papi.vxlan_gbp_tunnel_add_del, + {'is_add': is_add, + 'tunnel': { + 'src': src, + 'dst': dst, + 'mcast_sw_if_index': mcast_sw_if_index, + 'encap_table_id': encap_table_id, + 'decap_next_index': decap_next_index, + 'vni': vni, + 'instance': instance}}) + + def vxlan_gbp_tunnel_dump(self, sw_if_index=0xffffffff): + return self.api(self.papi.vxlan_gbp_tunnel_dump, + {'sw_if_index': sw_if_index}) + def pppoe_add_del_session( self, client_ip, @@ -2707,6 +2802,18 @@ class VppPapiProvider(object): 'decap_vrf_id': decap_vrf_id, 'client_mac': client_mac}) + def sr_mpls_policy_add(self, bsid, weight, type, segments): + return self.api(self.papi.sr_mpls_policy_add, + {'bsid': bsid, + 'weight': weight, + 'type': type, + 'n_segments': len(segments), + 'segments': segments}) + + def sr_mpls_policy_del(self, bsid): + return self.api(self.papi.sr_mpls_policy_del, + {'bsid': bsid}) + def sr_localsid_add_del(self, localsid, behavior, @@ -3343,15 +3450,20 @@ class VppPapiProvider(object): 'enable_ip6': 1 if enable_ip6 else 0, }) - def gbp_endpoint_add_del(self, is_add, sw_if_index, addr, is_ip6, epg): - """ GBP endpoint Add/Del """ - return self.api(self.papi.gbp_endpoint_add_del, - {'is_add': is_add, - 'endpoint': { - 'is_ip6': is_ip6, - 'sw_if_index': sw_if_index, - 'address': addr, - 'epg_id': epg}}) + def gbp_endpoint_add(self, sw_if_index, ips, mac, epg): + """ GBP endpoint Add """ + return self.api(self.papi.gbp_endpoint_add, + {'endpoint': { + 'sw_if_index': sw_if_index, + 'ips': ips, + 'n_ips': len(ips), + 'mac': mac, + 'epg_id': epg}}) + + def gbp_endpoint_del(self, handle): + """ GBP endpoint Del """ + return self.api(self.papi.gbp_endpoint_del, + {'handle': handle}) def gbp_endpoint_dump(self): """ GBP endpoint Dump """ @@ -3390,9 +3502,9 @@ class VppPapiProvider(object): def gbp_subnet_add_del(self, is_add, table_id, is_internal, - addr, addr_len, + prefix, sw_if_index=0xffffffff, - epg_id=0xffffffff, + epg_id=0xffff, is_ip6=False): """ GBP Subnet Add/Del """ return self.api(self.papi.gbp_subnet_add_del, @@ -3402,8 +3514,7 @@ class VppPapiProvider(object): 'is_ip6': is_ip6, 'sw_if_index': sw_if_index, 'epg_id': epg_id, - 'address': addr, - 'address_length': addr_len, + 'prefix': prefix, 'table_id': table_id}}) def gbp_subnet_dump(self): @@ -3423,12 +3534,13 @@ class VppPapiProvider(object): """ GBP contract Dump """ return self.api(self.papi.gbp_contract_dump, {}) - def ipip_6rd_add_tunnel(self, fib_index, ip6_prefix, ip6_prefix_len, - ip4_prefix, ip4_prefix_len, ip4_src, + def ipip_6rd_add_tunnel(self, ip6_table_id, ip6_prefix, ip6_prefix_len, + ip4_table_id, ip4_prefix, ip4_prefix_len, ip4_src, security_check): """ 6RD tunnel Add """ return self.api(self.papi.ipip_6rd_add_tunnel, - {'fib_index': fib_index, + {'ip4_table_id': ip4_table_id, + 'ip6_table_id': ip6_table_id, 'ip6_prefix': ip6_prefix, 'ip6_prefix_len': ip6_prefix_len, 'ip4_prefix': ip4_prefix, @@ -3442,14 +3554,14 @@ class VppPapiProvider(object): {'sw_if_index': sw_if_index}) def ipip_add_tunnel(self, src_address, dst_address, is_ipv6=1, - instance=0xFFFFFFFF, fib_index=0, tc_tos=0): + instance=0xFFFFFFFF, table_id=0, tc_tos=0): """ IPIP tunnel Add/Del """ return self.api(self.papi.ipip_add_tunnel, {'is_ipv6': is_ipv6, 'instance': instance, 'src_address': src_address, 'dst_address': dst_address, - 'fib_index': fib_index, + 'table_id': table_id, 'tc_tos': tc_tos}) def ipip_del_tunnel(self, sw_if_index):