/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 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.1.1";
import "vnet/ip/ip_types.api";
import "vnet/interface_types.api";

enum vxlan_gbp_api_tunnel_mode
{
  VXLAN_GBP_API_TUNNEL_MODE_L2,
  VXLAN_GBP_API_TUNNEL_MODE_L3,
};

/** \brief Definition of a VXLAN GBP tunnel
    @param instance - optional unique custom device instance, else ~0.
    @param src - Source IP address
    @param dst - Destination IP address, can be multicast
    @param mcast_sw_if_index - Interface for multicast destination
    @param encap_table_id - Encap route table
    @param vni - The VXLAN Network Identifier, uint24
    @param sw_ifindex - Ignored in add message, set in details
*/
typedef vxlan_gbp_tunnel
{
  u32 instance;
  vl_api_address_t src;
  vl_api_address_t dst;
  vl_api_interface_index_t mcast_sw_if_index;
  u32 encap_table_id;
  u32 vni;
  vl_api_interface_index_t sw_if_index;
  vl_api_vxlan_gbp_api_tunnel_mode_t mode;
};

/** \brief Create or delete a VXLAN-GBP tunnel
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - Use 1 to create the tunnel, 0 to remove it
*/
define vxlan_gbp_tunnel_add_del
{
  u32 client_index;
  u32 context;
  bool is_add [default=true];
  vl_api_vxlan_gbp_tunnel_t tunnel;
  option in_progress;
};

define vxlan_gbp_tunnel_add_del_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
  option in_progress;
};

define vxlan_gbp_tunnel_dump
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index [default=0xffffffff];
  option in_progress;
};

define vxlan_gbp_tunnel_details
{
  u32 context;
  vl_api_vxlan_gbp_tunnel_t tunnel;
  option in_progress;
};

/** \brief Interface set vxlan-bypass request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface used to reach neighbor
    @param is_ipv6 - if non-zero, enable ipv6-vxlan-bypass, else ipv4-vxlan-bypass
    @param enable - if non-zero enable, else disable
*/
autoreply define sw_interface_set_vxlan_gbp_bypass
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  bool is_ipv6;
  bool enable [default=true];
  option in_progress;
};
