/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2015-2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

option version = "1.2.0";

/** \brief SRv6 SID
*/
typedef srv6_sid
{
  u8 addr[16];
};

typedef srv6_sid_list
{
  u8 num_sids;
  u32 weight;
  vl_api_srv6_sid_t sids[16];
};

/** \brief IPv6 SR LocalSID add/del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_del Boolean of whether its a delete instruction
    @param localsid_addr IPv6 address of the localsid
    @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.
    @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.
*/
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;
  u32 vlan_index;
  u32 fib_table;
  u8 nh_addr6[16];
  u8 nh_addr4[4];
};

typedef sr_ip6_address
{
  u8 data[16];
};

/** \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 type 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;
  u8 bsid_addr[16];
  u32 weight;
  u8 is_encap;
  u8 type;
  u32 fib_table;
  vl_api_srv6_sid_list_t sids;
};

/** \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
{
  u32 client_index;
  u32 context;
  u8 bsid_addr[16];
  u32 sr_policy_index;
  u32 fib_table;
  u8 operation;
  u32 sl_index;
  u32 weight;
  vl_api_srv6_sid_list_t sids;
};

/** \brief IPv6 SR policy deletion
    @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 index is the index of the SR policy
*/
autoreply define sr_policy_del
{
  u32 client_index;
  u32 context;
  vl_api_srv6_sid_t bsid_addr;
  u32 sr_policy_index;
};

/** \brief IPv6 SR Set SRv6 encapsulation source
    @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 index is the index of the SR policy
*/
autoreply define sr_set_encap_source
{
  u32 client_index;
  u32 context;
  u8 encaps_source[16];
};

/** \brief IPv6 SR steering add/del
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_del
    @param bsid is the bindingSID of the SR Policy (alt to sr_policy_index)
    @param sr_policy is the index of the SR Policy (alt to bsid)
    @param table_id is the VRF where to install the FIB entry for the BSID
    @param prefix is the IPv4/v6 address for L3 traffic type
    @param mask_width is the mask for L3 traffic type
    @param sw_if_index is the incoming interface for L2 traffic
    @param traffic_type describes the type of traffic
*/
autoreply define sr_steering_add_del
{
  u32 client_index;
  u32 context;
  u8 is_del;
  u8 bsid_addr[16];
  u32 sr_policy_index;
  u32 table_id;
  u8 prefix_addr[16];
  u32 mask_width;
  u32 sw_if_index;
  u8 traffic_type;
};

/** \brief Dump the list of SR LocalSIDs
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sr_localsids_dump
{
  u32 client_index;
  u32 context;
};

define sr_localsids_details
{
  u32 context;
  vl_api_srv6_sid_t addr;
  u8 end_psp;
  u16 behavior;
  u32 fib_table;
  u32 vlan_index;
  u8 xconnect_nh_addr6[16];
  u8 xconnect_nh_addr4[4];
  u32 xconnect_iface_or_vrf_table;
};

/** \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
*/
define sr_policies_dump
{
  u32 client_index;
  u32 context;
};

define sr_policies_details
{
  u32 context;
  vl_api_srv6_sid_t bsid;
  u8 type;
  u8 is_encap;
  u32 fib_table;
  u8 num_sid_lists;
  vl_api_srv6_sid_list_t sid_lists[num_sid_lists];
};

/** \brief Dump the steering policies
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define sr_steering_pol_dump
{
  u32 client_index;
  u32 context;
};

define sr_steering_pol_details
{
  u32 context;
  u8 traffic_type;
  u32 fib_table;
  u8 prefix_addr[16];
  u32 mask_width;
  u32 sw_if_index;
  vl_api_srv6_sid_t bsid;
};

/*
 * fd.io coding-style-patch-verification: OFF
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
