/*
 * 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.0.0";

import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";

/** \brief Create a point-to-point (p2p) Ethernet sub-interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param parent_if_index - index of the parent interface
    @param subif_id - subinterface index identifier
    @param remote_mac - client MAC address
    @retval VNET_API_ERROR_INVALID_SW_IF_INDEX on invalid parent_if_index
    @retval VNET_API_ERROR_INVALID_SW_IF_INDEX_2 on invalid subif_id
    @retval VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED
    @retval VNET_API_ERROR_SUBIF_ALREADY_EXISTS
    @retval VNET_API_ERROR_SUBIF_CREATE_FAILED
*/
define p2p_ethernet_add
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t parent_if_index;
  u32 subif_id;
  vl_api_mac_address_t remote_mac;
};

define p2p_ethernet_add_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Delete a point-to-point (p2p) Ethernet sub-interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param parent_if_index - index of the parent interface
    @param remote_mac - client MAC address
    @retval VNET_API_ERROR_SUBIF_DOESNT_EXIST
*/
define p2p_ethernet_del
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t parent_if_index;
  vl_api_mac_address_t remote_mac;
};

define p2p_ethernet_del_reply
{
  u32 context;
  i32 retval;
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
