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

import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";
import "vnet/srv6/sr_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];
};

/** \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_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:
 */
