X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_papi_provider.py;h=14cb72727b6576f14af9edf40ec83905e032913e;hb=75282457;hp=3130ad06c88c4a089daf455dbec08ce822ef67ff;hpb=e0d2bd6bd7fc59c0c6ac48195d7f825dc99bfd91;p=vpp.git diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 3130ad06c88..14cb72727b6 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -720,6 +720,18 @@ class VppPapiProvider(object): {'sw_if_index': sw_if_index, 'enable': enable}) + def sw_interface_set_ip_directed_broadcast( + self, + sw_if_index, + enable=1): + """IP Directed broadcast + :param sw_if_index - interface the operation is applied to + + """ + return self.api(self.papi.sw_interface_set_ip_directed_broadcast, + {'sw_if_index': sw_if_index, + 'enable': enable}) + def sw_interface_set_flags(self, sw_if_index, admin_up_down): """ @@ -1573,7 +1585,6 @@ class VppPapiProvider(object): external_addr, external_port, protocol, - vrf_id=0, twice_nat=0, self_twice_nat=0, out2in_only=0, @@ -1593,7 +1604,6 @@ 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, @@ -2220,6 +2230,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, @@ -2232,6 +2244,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( @@ -2255,6 +2268,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, @@ -2264,6 +2279,7 @@ class VppPapiProvider(object): 'advance': advance, 'action': action, 'metadata': metadata, + 'match_len': match_len, 'match': match}) def input_acl_set_interface( @@ -3163,53 +3179,28 @@ class VppPapiProvider(object): def ipsec_sad_add_del_entry(self, sad_id, spi, + integrity_algorithm, + integrity_key, + crypto_algorithm, + crypto_key, + protocol, tunnel_src_address='', tunnel_dst_address='', - protocol=0, - integrity_algorithm=2, - integrity_key_length=0, - integrity_key='C91KUR9GYMm5GfkEvNjX', - crypto_algorithm=1, - crypto_key_length=0, - crypto_key='JPjyOWBeVEQiMe7h', - is_add=1, is_tunnel=1, + is_add=1, udp_encap=0): """ IPSEC SA add/del - Sample CLI : 'ipsec sa add 10 spi 1001 esp \ - crypto-key 4a506a794f574265564551694d653768 \ - crypto-alg aes-cbc-128 \ - integ-key 4339314b55523947594d6d3547666b45764e6a58 \ - integ-alg sha1-96 tunnel-src 192.168.100.3 \ - tunnel-dst 192.168.100.2' - Sample CLI : 'ipsec sa add 20 spi 2001 \ - integ-key 4339314b55523947594d6d3547666b45764e6a58 \ - integ-alg sha1-96' - - :param sad_id - Security Association ID to be \ - created or deleted. mandatory - :param spi - security param index of the SA in decimal. mandatory - :param tunnel_src_address - incase of tunnel mode outer src address .\ - mandatory for tunnel mode - :param tunnel_dst_address - incase of transport mode \ - outer dst address. mandatory for tunnel mode - :param protocol - AH(0) or ESP(1) protocol (Default 0 - AH). optional - :param integrity_algorithm - value range 1-6 Default(2 - SHA1_96).\ - optional ** - :param integrity_key - value in string \ - (Default C91KUR9GYMm5GfkEvNjX).optional - :param integrity_key_length - length of the key string in bytes\ - (Default 0 - integrity disabled). optional - :param crypto_algorithm - value range 1-11 Default \ - (1- AES_CBC_128).optional ** - :param crypto_key - value in string(Default JPjyOWBeVEQiMe7h).optional - :param crypto_key_length - length of the key string in bytes\ - (Default 0 - crypto disabled). optional - :param is_add - add(1) or del(0) ipsec SA entry(Default 1 - add) .\ - optional - :param is_tunnel - tunnel mode (1) or transport mode(0) \ - (Default 1 - tunnel). optional - :returns: reply from the API + :param sad_id: security association ID + :param spi: security param index of the SA in decimal + :param integrity_algorithm: + :param integrity_key: + :param crypto_algorithm: + :param crypto_key: + :param protocol: AH(0) or ESP(1) protocol + :param tunnel_src_address: tunnel mode outer src address + :param tunnel_dst_address: tunnel mode outer dst address + :param is_add: + :param is_tunnel: :** reference /vpp/src/vnet/ipsec/ipsec.h file for enum values of crypto and ipsec algorithms """ @@ -3221,10 +3212,11 @@ class VppPapiProvider(object): 'tunnel_dst_address': tunnel_dst_address, 'protocol': protocol, 'integrity_algorithm': integrity_algorithm, - 'integrity_key_length': integrity_key_length, + 'integrity_key_length': len(integrity_key), 'integrity_key': integrity_key, 'crypto_algorithm': crypto_algorithm, - 'crypto_key_length': crypto_key_length, + 'crypto_key_length': len(crypto_key) if crypto_key is not None + else 0, 'crypto_key': crypto_key, 'is_add': is_add, 'is_tunnel': is_tunnel, @@ -3232,6 +3224,7 @@ class VppPapiProvider(object): def ipsec_spd_add_del_entry(self, spd_id, + sa_id, local_address_start, local_address_stop, remote_address_start, @@ -3241,7 +3234,6 @@ class VppPapiProvider(object): remote_port_start=0, remote_port_stop=65535, protocol=0, - sa_id=10, policy=0, priority=100, is_outbound=1, @@ -3249,35 +3241,28 @@ class VppPapiProvider(object): is_ip_any=0): """ IPSEC policy SPD add/del - Wrapper to configure ipsec SPD policy entries in VPP - Sample CLI : 'ipsec policy add spd 1 inbound priority 10 action \ - protect sa 20 local-ip-range 192.168.4.4 - 192.168.4.4 \ - remote-ip-range 192.168.3.3 - 192.168.3.3' - - :param spd_id - SPD ID for the policy . mandatory - :param local_address_start - local-ip-range start address . mandatory - :param local_address_stop - local-ip-range stop address . mandatory - :param remote_address_start - remote-ip-range start address . mandatory - :param remote_address_stop - remote-ip-range stop address . mandatory - :param local_port_start - (Default 0) . optional - :param local_port_stop - (Default 65535). optional - :param remote_port_start - (Default 0). optional - :param remote_port_stop - (Default 65535). optional - :param protocol - Any(0), AH(51) & ESP(50) protocol (Default 0 - Any). - optional - :param sa_id - Security Association ID for mapping it to SPD - (default 10). optional - :param policy - bypass(0), discard(1), resolve(2) or protect(3)action - (Default 0 - bypass). optional - :param priotity - value for the spd action (Default 100). optional - :param is_outbound - flag for inbound(0) or outbound(1) - (Default 1 - outbound). optional - :param is_add flag - for addition(1) or deletion(0) of the spd - (Default 1 - addtion). optional - :returns: reply from the API + :param spd_id: SPD ID for the policy + :param local_address_start: local-ip-range start address + :param local_address_stop : local-ip-range stop address + :param remote_address_start: remote-ip-range start address + :param remote_address_stop : remote-ip-range stop address + :param local_port_start: (Default value = 0) + :param local_port_stop: (Default value = 65535) + :param remote_port_start: (Default value = 0) + :param remote_port_stop: (Default value = 65535) + :param protocol: Any(0), AH(51) & ESP(50) protocol (Default value = 0) + :param sa_id: Security Association ID for mapping it to SPD + :param policy: bypass(0), discard(1), resolve(2) or protect(3) action + (Default value = 0) + :param priority: value for the spd action (Default value = 100) + :param is_outbound: flag for inbound(0) or outbound(1) + (Default value = 1) + :param is_add: (Default value = 1) """ return self.api( self.papi.ipsec_spd_add_del_entry, {'spd_id': spd_id, + 'sa_id': sa_id, 'local_address_start': local_address_start, 'local_address_stop': local_address_stop, 'remote_address_start': remote_address_start, @@ -3291,9 +3276,30 @@ class VppPapiProvider(object): 'policy': policy, 'priority': priority, 'is_outbound': is_outbound, - 'sa_id': sa_id, 'is_ip_any': is_ip_any}) + def ipsec_tunnel_if_add_del(self, local_ip, remote_ip, local_spi, + remote_spi, crypto_alg, local_crypto_key, + remote_crypto_key, integ_alg, local_integ_key, + remote_integ_key, is_add=1, esn=0, + anti_replay=1, renumber=0, show_instance=0): + return self.api( + self.papi.ipsec_tunnel_if_add_del, + {'local_ip': local_ip, 'remote_ip': remote_ip, + 'local_spi': local_spi, 'remote_spi': remote_spi, + 'crypto_alg': crypto_alg, + 'local_crypto_key_len': len(local_crypto_key), + 'local_crypto_key': local_crypto_key, + 'remote_crypto_key_len': len(remote_crypto_key), + 'remote_crypto_key': remote_crypto_key, 'integ_alg': integ_alg, + 'local_integ_key_len': len(local_integ_key), + 'local_integ_key': local_integ_key, + 'remote_integ_key_len': len(remote_integ_key), + 'remote_integ_key': remote_integ_key, 'is_add': is_add, + 'esn': esn, 'anti_replay': anti_replay, 'renumber': renumber, + 'show_instance': show_instance + }) + def app_namespace_add(self, namespace_id, ip4_fib_id=0, @@ -3484,7 +3490,14 @@ class VppPapiProvider(object): 'input_source': input_source, 'enable': enable}) - def igmp_listen(self, enable, sw_if_index, saddr, gaddr): + def igmp_enable_disable(self, sw_if_index, enable, host): + """ Enable/disable IGMP on a given interface """ + return self.api(self.papi.igmp_enable_disable, + {'enable': enable, + 'mode': host, + 'sw_if_index': sw_if_index}) + + def igmp_listen(self, filter, sw_if_index, saddrs, gaddr): """ Listen for new (S,G) on specified interface :param enable: add/del @@ -3493,20 +3506,26 @@ class VppPapiProvider(object): :param gaddr: group ip4 addr """ return self.api(self.papi.igmp_listen, - {'enable': enable, - 'sw_if_index': sw_if_index, - 'saddr': saddr, - 'gaddr': gaddr}) + { + 'group': + { + 'filter': filter, + 'sw_if_index': sw_if_index, + 'n_srcs': len(saddrs), + 'saddrs': saddrs, + 'gaddr': + { + 'address': gaddr + } + } + }) def igmp_dump(self, sw_if_index=None): """ Dump all (S,G) interface configurations """ if sw_if_index is None: - dump_all = 1 - sw_if_index = 0 - else: - dump_all = 0 - return self.api(self.papi.igmp_dump, {'sw_if_index': sw_if_index, - 'dump_all': dump_all}) + sw_if_index = 0xffffffff + return self.api(self.papi.igmp_dump, + {'sw_if_index': sw_if_index}) def igmp_clear_interface(self, sw_if_index): """ Remove all (S,G)s from specified interface @@ -3660,3 +3679,15 @@ class VppPapiProvider(object): def abf_itf_attach_dump(self): return self.api( self.papi.abf_itf_attach_dump, {}) + + def pipe_create(self, is_specified, user_instance): + return self.api(self.papi.pipe_create, + {'is_specified': is_specified, + 'user_instance': user_instance}) + + def pipe_delete(self, parent_sw_if_index): + return self.api(self.papi.pipe_delete, + {'parent_sw_if_index': parent_sw_if_index}) + + def pipe_dump(self): + return self.api(self.papi.pipe_dump, {})