IPSEC: Pass the algorithm salt (used in GCM) over the API
[vpp.git] / test / vpp_papi_provider.py
index ed2eee1..62175e2 100644 (file)
@@ -12,22 +12,9 @@ from collections import deque
 from six import moves, iteritems
 from vpp_papi import VPP, mac_pton
 from hook import Hook
-from vpp_l2 import L2_PORT_TYPE
 from vpp_ip_route import MPLS_IETF_MAX_LABEL, MPLS_LABEL_INVALID
 
 
-class L2_VTR_OP:
-    L2_DISABLED = 0
-    L2_PUSH_1 = 1
-    L2_PUSH_2 = 2
-    L2_POP_1 = 3
-    L2_POP_2 = 4
-    L2_TRANSLATE_1_1 = 5
-    L2_TRANSLATE_1_2 = 6
-    L2_TRANSLATE_2_1 = 7
-    L2_TRANSLATE_2_2 = 8
-
-
 class QOS_SOURCE:
     EXT = 0
     VLAN = 1
@@ -2370,6 +2357,7 @@ class VppPapiProvider(object):
                                 tunnel_src_address='',
                                 tunnel_dst_address='',
                                 flags=0,
+                                salt=0,
                                 is_add=1):
         """ IPSEC SA add/del
         :param sad_id: security association ID
@@ -2408,6 +2396,7 @@ class VppPapiProvider(object):
                             'data': crypto_key,
                         },
                         'flags': flags,
+                        'salt': salt,
                     }
             })
 
@@ -2485,7 +2474,7 @@ class VppPapiProvider(object):
     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,
+                                remote_integ_key, is_add=1, esn=0, salt=0,
                                 anti_replay=1, renumber=0, show_instance=0):
         return self.api(
             self.papi.ipsec_tunnel_if_add_del,
@@ -2508,9 +2497,23 @@ class VppPapiProvider(object):
                 'esn': esn,
                 'anti_replay': anti_replay,
                 'renumber': renumber,
-                'show_instance': show_instance
+                'show_instance': show_instance,
+                'salt': salt
             })
 
+    def ipsec_gre_tunnel_add_del(self, local_ip, remote_ip,
+                                 sa_out, sa_in, is_add=1):
+        return self.api(self.papi.ipsec_gre_tunnel_add_del,
+                        {
+                            'is_add': is_add,
+                            'tunnel': {
+                                'src': local_ip,
+                                'dst': remote_ip,
+                                'local_sa_id': sa_out,
+                                'remote_sa_id': sa_in
+                            }
+                        })
+
     def ipsec_select_backend(self, protocol, index):
         return self.api(self.papi.ipsec_select_backend,
                         {'protocol': protocol, 'index': index})