Dedicated SW Interface Event
[vpp.git] / test / vpp_papi_provider.py
index 4f7e9fe..c99d458 100644 (file)
@@ -411,6 +411,14 @@ class VppPapiProvider(object):
                          'arp_term': arp_term,
                          'is_add': is_add})
 
+    def bd_ip_mac_add_del(self, bd_id, mac, ip, is_ipv6=0, is_add=1):
+        return self.api(self.papi.bd_ip_mac_add_del,
+                        {'bd_id': bd_id,
+                         'is_add': is_add,
+                         'is_ipv6': is_ipv6,
+                         'ip_address': ip,
+                         'mac_address': mac})
+
     def l2fib_add_del(self, mac, bd_id, sw_if_index, is_add=1, static_mac=0,
                       filter_mac=0, bvi_mac=0):
         """Create/delete L2 FIB entry.
@@ -542,21 +550,16 @@ class VppPapiProvider(object):
                          'tag1': tag1,
                          'tag2': tag2})
 
-    def sw_interface_set_flags(self, sw_if_index, admin_up_down,
-                               link_up_down=0, deleted=0):
+    def sw_interface_set_flags(self, sw_if_index, admin_up_down):
         """
 
         :param admin_up_down:
         :param sw_if_index:
-        :param link_up_down:  (Default value = 0)
-        :param deleted:  (Default value = 0)
 
         """
         return self.api(self.papi.sw_interface_set_flags,
                         {'sw_if_index': sw_if_index,
-                         'admin_up_down': admin_up_down,
-                         'link_up_down': link_up_down,
-                         'deleted': deleted})
+                         'admin_up_down': admin_up_down})
 
     def create_subif(self, sw_if_index, sub_id, outer_vlan, inner_vlan,
                      no_tags=0, one_tag=0, two_tags=0, dot1ad=0, exact_match=0,
@@ -593,6 +596,19 @@ class VppPapiProvider(object):
              'outer_vlan_id': outer_vlan,
              'inner_vlan_id': inner_vlan})
 
+    def create_p2pethernet_subif(self, sw_if_index, remote_mac, subif_id):
+        """Create p2p ethernet subinterface
+
+        :param sw_if_index: main (parent) interface
+        :param remote_mac: client (remote) mac address
+
+        """
+        return self.api(
+            self.papi.p2p_ethernet_add,
+            {'parent_if_index': sw_if_index,
+             'remote_mac': remote_mac,
+             'subif_id': subif_id})
+
     def delete_subif(self, sw_if_index):
         """Delete subinterface
 
@@ -601,6 +617,18 @@ class VppPapiProvider(object):
         return self.api(self.papi.delete_subif,
                         {'sw_if_index': sw_if_index})
 
+    def delete_p2pethernet_subif(self, sw_if_index, remote_mac):
+        """Delete p2p ethernet subinterface
+
+        :param sw_if_index: main (parent) interface
+        :param remote_mac: client (remote) mac address
+
+        """
+        return self.api(
+            self.papi.p2p_ethernet_del,
+            {'parent_if_index': sw_if_index,
+             'remote_mac': remote_mac})
+
     def create_vlan_subif(self, sw_if_index, vlan):
         """
 
@@ -839,17 +867,20 @@ class VppPapiProvider(object):
         )
 
     def sw_interface_span_enable_disable(
-            self, sw_if_index_from, sw_if_index_to, state=1):
+            self, sw_if_index_from, sw_if_index_to, state=1, is_l2=0):
         """
 
         :param sw_if_index_from:
         :param sw_if_index_to:
         :param state:
+        :param is_l2:
         """
         return self.api(self.papi.sw_interface_span_enable_disable,
                         {'sw_if_index_from': sw_if_index_from,
                          'sw_if_index_to': sw_if_index_to,
-                         'state': state})
+                         'state': state,
+                         'is_l2': is_l2,
+                         })
 
     def gre_tunnel_add_del(self,
                            src_address,
@@ -885,7 +916,7 @@ class VppPapiProvider(object):
             self,
             label,
             eos,
-            next_hop_proto_is_ip4,
+            next_hop_proto,
             next_hop_address,
             next_hop_sw_if_index=0xFFFFFFFF,
             table_id=0,
@@ -946,7 +977,7 @@ class VppPapiProvider(object):
              'mr_is_resolve_attached': is_resolve_attached,
              'mr_is_interface_rx': is_interface_rx,
              'mr_is_rpf_id': is_rpf_id,
-             'mr_next_hop_proto_is_ip4': next_hop_proto_is_ip4,
+             'mr_next_hop_proto': next_hop_proto,
              'mr_next_hop_weight': next_hop_weight,
              'mr_next_hop': next_hop_address,
              'mr_next_hop_n_out_labels': next_hop_n_out_labels,
@@ -1047,6 +1078,23 @@ class VppPapiProvider(object):
              'is_inside': is_inside,
              'sw_if_index': sw_if_index})
 
+    def snat_interface_add_del_output_feature(
+            self,
+            sw_if_index,
+            is_inside=1,
+            is_add=1):
+        """Enable/disable S-NAT output feature on the interface
+
+        :param sw_if_index: Software index of the interface
+        :param is_inside: 1 if inside, 0 if outside (Default value = 1)
+        :param is_add: 1 if add, 0 if delete (Default value = 1)
+        """
+        return self.api(
+            self.papi.snat_interface_add_del_output_feature,
+            {'is_add': is_add,
+             'is_inside': is_inside,
+             'sw_if_index': sw_if_index})
+
     def snat_add_static_mapping(
             self,
             local_ip,
@@ -1120,6 +1168,12 @@ class VppPapiProvider(object):
         """
         return self.api(self.papi.snat_interface_dump, {})
 
+    def snat_interface_output_feature_dump(self):
+        """Dump interfaces with S-NAT output feature
+        :return: Dictionary of interfaces with S-NAT output feature
+        """
+        return self.api(self.papi.snat_interface_output_feature_dump, {})
+
     def snat_static_mapping_dump(self):
         """Dump S-NAT static mappings
         :return: Dictionary of S-NAT static mappings
@@ -1747,6 +1801,23 @@ class VppPapiProvider(object):
                 'oui': oui,
             })
 
+    def dhcp_client(self,
+                    sw_if_index,
+                    hostname,
+                    client_id='',
+                    is_add=1,
+                    want_dhcp_events=0):
+        return self.api(
+            self.papi.dhcp_client_config,
+            {
+                'sw_if_index': sw_if_index,
+                'hostname': hostname,
+                'client_id': client_id,
+                'is_add': is_add,
+                'want_dhcp_event': want_dhcp_events,
+                'pid': os.getpid(),
+            })
+
     def ip_mroute_add_del(self,
                           src_address,
                           grp_address,
@@ -2011,3 +2082,29 @@ class VppPapiProvider(object):
                          'decap_vrf_id': decap_vrf_id,
                          'protocol': protocol,
                          'vni': vni})
+
+    def pppoe_add_del_session(
+            self,
+            client_ip,
+            client_mac,
+            session_id=0,
+            is_add=1,
+            is_ipv6=0,
+            decap_vrf_id=0):
+        """
+
+        :param is_add:  (Default value = 1)
+        :param is_ipv6:  (Default value = 0)
+        :param client_ip:
+        :param session_id:  (Default value = 0)
+        :param client_mac:
+        :param decap_vrf_id:  (Default value = 0)
+
+        """
+        return self.api(self.papi.pppoe_add_del_session,
+                        {'is_add': is_add,
+                         'is_ipv6': is_ipv6,
+                         'session_id': session_id,
+                         'client_ip': client_ip,
+                         'decap_vrf_id': decap_vrf_id,
+                         'client_mac': client_mac})