sr: support define src ipv6 per encap policy
[vpp.git] / src / vnet / srv6 / sr.api
index 543f3fd..8bebcd1 100644 (file)
  * limitations under the License.
  */
 
-option version = "1.2.1";
+option version = "2.1.0";
 
-/** \brief SRv6 SID
-*/
-typedef srv6_sid
+import "vnet/interface_types.api";
+import "vnet/ip/ip_types.api";
+import "vnet/srv6/sr_types.api";
+
+
+typedef srv6_sid_list
 {
-  u8 addr[16];
+  u8 num_sids;
+  u32 weight;
+  vl_api_ip6_address_t sids[16];
 };
 
-typedef srv6_sid_list
+typedef srv6_sid_list_with_sl_index
 {
   u8 num_sids;
   u32 weight;
-  vl_api_srv6_sid_t sids[16];
+  u32 sl_index;
+  vl_api_ip6_address_t sids[16];
 };
 
 /** \brief IPv6 SR LocalSID add/del request
@@ -38,30 +44,76 @@ typedef srv6_sid_list
     @param end_psp Boolean of whether decapsulation is allowed in this function
     @param behavior Type of behavior (function) for this localsid
     @param sw_if_index Only for L2/L3 xconnect. OIF. In VRF variant the
-     fib_table.
+     fib_table. Default:0xffffffff
     @param vlan_index Only for L2 xconnect. Outgoing VLAN tag.
     @param fib_table  FIB table in which we should install the localsid entry
-    @param nh_addr6 Next Hop IPv6 address. Only for L2/L3 xconnect.
-    @param nh_addr4 Next Hop IPv4 address. Only for L2/L3 xconnect.
+    @param nh_addr Next Hop IPv46 address. Only for L2/L3 xconnect.
 */
 autoreply define sr_localsid_add_del
 {
   u32 client_index;
   u32 context;
-  u8 is_del;
-  vl_api_srv6_sid_t localsid;
-  u8 end_psp;
-  u8 behavior;
-  u32 sw_if_index;
+  bool is_del [default=false];
+  vl_api_ip6_address_t localsid;
+  bool end_psp;
+  vl_api_sr_behavior_t behavior;
+  vl_api_interface_index_t sw_if_index [default=0xffffffff];
   u32 vlan_index;
   u32 fib_table;
-  u8 nh_addr6[16];
-  u8 nh_addr4[4];
+  vl_api_address_t nh_addr;
+};
+
+/** \brief IPv6 SR policy add
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param bsid is the bindingSID of the SR Policy
+    @param weight is the weight of the sid list. optional.
+    @param is_encap is the behavior of the SR policy. (0.SRH insert // 1.Encapsulation)
+    @param is_spray is the type of the SR policy. (0.Default // 1.Spray)
+    @param fib_table is the VRF where to install the FIB entry for the BSID
+    @param sids is a srv6_sid_list object
+*/
+autoreply define sr_policy_add
+{
+  u32 client_index;
+  u32 context;
+  vl_api_ip6_address_t bsid_addr;
+  u32 weight;
+  bool is_encap;
+  bool is_spray;
+  u32 fib_table;
+  vl_api_srv6_sid_list_t sids;
 };
 
-typedef sr_ip6_address
+/** \brief IPv6 SR policy modification
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param bsid is the bindingSID of the SR Policy
+    @param sr_policy_index is the index of the SR policy
+    @param fib_table is the VRF where to install the FIB entry for the BSID
+    @param operation is the operation to perform (among the top ones)
+    @param sl_index is the index of the Segment List to modify/delete
+    @param weight is the weight of the sid list. optional.
+    @param sids is a srv6_sid_list object
+*/
+autoreply define sr_policy_mod
 {
-  u8 data[16];
+  u32 client_index;
+  u32 context;
+  vl_api_ip6_address_t bsid_addr;
+  u32 sr_policy_index;
+  u32 fib_table;
+  vl_api_sr_policy_op_t operation;
+  u32 sl_index;
+  u32 weight;
+  vl_api_srv6_sid_list_t sids;
+};
+
+enum sr_policy_type : u8
+{
+  SR_API_POLICY_TYPE_DEFAULT = 0,
+  SR_API_POLICY_TYPE_SPRAY = 1,
+  SR_API_POLICY_TYPE_TEF = 2,
 };
 
 /** \brief IPv6 SR policy add
@@ -70,20 +122,23 @@ typedef sr_ip6_address
     @param bsid is the bindingSID of the SR Policy
     @param weight is the weight of the sid list. optional.
     @param is_encap is the behavior of the SR policy. (0.SRH insert // 1.Encapsulation)
-    @param type is the type of the SR policy. (0.Default // 1.Spray)
+    @param type is the SR policy param. (0.Default // 1.Spray // 2.Tef)
     @param fib_table is the VRF where to install the FIB entry for the BSID
     @param sids is a srv6_sid_list object
+    @param encap_src is a encaps IPv6 source addr. optional.
 */
-autoreply define sr_policy_add
+autoreply define sr_policy_add_v2
 {
   u32 client_index;
   u32 context;
-  u8 bsid_addr[16];
+  vl_api_ip6_address_t bsid_addr;
   u32 weight;
-  u8 is_encap;
-  u8 type;
+  bool is_encap;
+  vl_api_sr_policy_type_t type [default=0x0];
   u32 fib_table;
   vl_api_srv6_sid_list_t sids;
+  vl_api_ip6_address_t encap_src;
+  option status="in_progress";
 };
 
 /** \brief IPv6 SR policy modification
@@ -96,18 +151,21 @@ autoreply define sr_policy_add
     @param sl_index is the index of the Segment List to modify/delete
     @param weight is the weight of the sid list. optional.
     @param sids is a srv6_sid_list object
+    @param encap_src is a encaps IPv6 source addr. optional.
 */
-autoreply define sr_policy_mod
+autoreply define sr_policy_mod_v2
 {
   u32 client_index;
   u32 context;
-  u8 bsid_addr[16];
+  vl_api_ip6_address_t bsid_addr;
   u32 sr_policy_index;
   u32 fib_table;
-  u8 operation;
+  vl_api_sr_policy_op_t operation;
   u32 sl_index;
   u32 weight;
   vl_api_srv6_sid_list_t sids;
+  vl_api_ip6_address_t encap_src;
+  option status="in_progress";
 };
 
 /** \brief IPv6 SR policy deletion
@@ -120,7 +178,7 @@ autoreply define sr_policy_del
 {
   u32 client_index;
   u32 context;
-  vl_api_srv6_sid_t bsid_addr;
+  vl_api_ip6_address_t bsid_addr;
   u32 sr_policy_index;
 };
 
@@ -134,7 +192,7 @@ autoreply define sr_set_encap_source
 {
   u32 client_index;
   u32 context;
-  u8 encaps_source[16];
+  vl_api_ip6_address_t encaps_source;
 };
 
 /** \brief IPv6 SR Set SRv6 encapsulation hop-limit
@@ -165,14 +223,13 @@ autoreply define sr_steering_add_del
 {
   u32 client_index;
   u32 context;
-  u8 is_del;
-  u8 bsid_addr[16];
+  bool is_del [default=false];
+  vl_api_ip6_address_t bsid_addr;
   u32 sr_policy_index;
   u32 table_id;
-  u8 prefix_addr[16];
-  u32 mask_width;
-  u32 sw_if_index;
-  u8 traffic_type;
+  vl_api_prefix_t prefix;
+  vl_api_interface_index_t sw_if_index;
+  vl_api_sr_steer_t traffic_type;
 };
 
 /** \brief Dump the list of SR LocalSIDs
@@ -188,16 +245,46 @@ define sr_localsids_dump
 define sr_localsids_details
 {
   u32 context;
-  vl_api_srv6_sid_t addr;
-  u8 end_psp;
-  u16 behavior;
+  vl_api_ip6_address_t addr;
+  bool end_psp;
+  vl_api_sr_behavior_t behavior;
   u32 fib_table;
   u32 vlan_index;
-  u8 xconnect_nh_addr6[16];
-  u8 xconnect_nh_addr4[4];
+  vl_api_address_t xconnect_nh_addr;
   u32 xconnect_iface_or_vrf_table;
 };
 
+
+/** \brief Dump the list of SR LocalSIDs along with packet statistics
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define sr_localsids_with_packet_stats_dump
+{
+  u32 client_index;
+  u32 context;
+  option status="in_progress";
+};
+
+define sr_localsids_with_packet_stats_details
+{
+  u32 context;
+  vl_api_ip6_address_t addr;
+  bool end_psp;
+  vl_api_sr_behavior_t behavior;
+  u32 fib_table;
+  u32 vlan_index;
+  vl_api_address_t xconnect_nh_addr;
+  u32 xconnect_iface_or_vrf_table;
+  u64 good_traffic_bytes;
+  u64 good_traffic_pkt_count;
+  u64 bad_traffic_bytes;
+  u64 bad_traffic_pkt_count;
+  option status="in_progress";
+};
+
+
+
 /** \brief Dump the list of SR policies
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
@@ -208,17 +295,65 @@ define sr_policies_dump
   u32 context;
 };
 
+
 define sr_policies_details
 {
   u32 context;
-  vl_api_srv6_sid_t bsid;
-  u8 type;
-  u8 is_encap;
+  vl_api_ip6_address_t bsid;
+  bool is_spray;
+  bool is_encap;
   u32 fib_table;
   u8 num_sid_lists;
   vl_api_srv6_sid_list_t sid_lists[num_sid_lists];
 };
 
+/** \brief Dump the list of SR policies v2
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define sr_policies_v2_dump
+{
+  u32 client_index;
+  u32 context;
+};
+
+define sr_policies_v2_details
+{
+  u32 context;
+  vl_api_ip6_address_t bsid;
+  vl_api_ip6_address_t encap_src;
+  vl_api_sr_policy_type_t type;
+  bool is_encap;
+  u32 fib_table;
+  u8 num_sid_lists;
+  vl_api_srv6_sid_list_t sid_lists[num_sid_lists];
+  option in_progress;
+};
+
+/** \brief Dump the list of SR policies along with actual segment list index on VPP
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define sr_policies_with_sl_index_dump
+{
+  u32 client_index;
+  u32 context;
+  option status="in_progress";
+};
+
+
+define sr_policies_with_sl_index_details
+{
+  u32 context;
+  vl_api_ip6_address_t bsid;
+  bool is_spray;
+  bool is_encap;
+  u32 fib_table;
+  u8 num_sid_lists;
+  vl_api_srv6_sid_list_with_sl_index_t sid_lists[num_sid_lists];
+  option status="in_progress";
+};
+
 /** \brief Dump the steering policies
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
@@ -232,12 +367,11 @@ define sr_steering_pol_dump
 define sr_steering_pol_details
 {
   u32 context;
-  u8 traffic_type;
+  vl_api_sr_steer_t traffic_type;
   u32 fib_table;
-  u8 prefix_addr[16];
-  u32 mask_width;
-  u32 sw_if_index;
-  vl_api_srv6_sid_t bsid;
+  vl_api_prefix_t prefix;
+  vl_api_interface_index_t sw_if_index;
+  vl_api_ip6_address_t bsid;
 };
 
 /*