/*
 * 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 = "2.0.0";

import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";

/** \brief MPLS 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. MPLS label (20bit)
    @param weight - is the weight of the sid list. optional.
    @param is_spray - is the type of the SR policy. (0.Default // 1.Spray)
    @param segments - vector of labels (20bit) composing the segment list
*/
autoreply define sr_mpls_policy_add
{
  u32 client_index;
  u32 context;
  u32 bsid;
  u32 weight;
  bool is_spray;
  u8 n_segments;
  u32 segments[n_segments];
};

enum sr_mpls_policy_op
{
  SR_MPLS_POLICY_OP_API_NONE = 0,
  SR_MPLS_POLICY_OP_API_ADD = 1,
  SR_MPLS_POLICY_OP_API_DEL = 2,
  SR_MPLS_POLICY_OP_API_MOD = 3,

};

/** \brief MPLS 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. MPLS label (20bit)
    @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 segments is a vector of MPLS labels composing the segment list
    @param sl_index is the index of the Segment List to modify/delete
    @param weight is the weight of the sid list. optional.
    @param is_encap Mode. Encapsulation or SRH insertion.
*/
autoreply define sr_mpls_policy_mod
{
  u32 client_index;
  u32 context;
  u32 bsid;
  vl_api_sr_mpls_policy_op_t operation;
  u32 sl_index;
  u32 weight;
  u8 n_segments;
  u32 segments[n_segments];
};

/** \brief MPLS 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. MPLS label (20bit)
*/
autoreply define sr_mpls_policy_del
{
  u32 client_index;
  u32 context;
  u32 bsid;
};

/** \brief MPLS 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 (~0 is no 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 next_hop - describes the next_hop (in case no BSID)
    @param color - describes the color
    @param co_bits - are the CO_bits of the steering policy
    @param vpn_label - is an additonal last VPN label. (~0 is no label)
*/
autoreply define sr_mpls_steering_add_del
{
  u32 client_index;
  u32 context;
  bool is_del[default = false];
  u32 bsid;
  u32 table_id;
  vl_api_prefix_t prefix;
  u32 mask_width;
  vl_api_address_t next_hop;
  u32 color;
  u8 co_bits;
  u32 vpn_label;
};

/** \brief MPLS SR steering add/del
    @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 endpoint is the endpoint of the SR policy
    @param color is the color of the sr policy
*/
autoreply define sr_mpls_policy_assign_endpoint_color
{
  u32 client_index;
  u32 context;
  u32 bsid;
  vl_api_address_t endpoint;
  u32 color;
};

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