/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2019 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.
 */

/** \file
    This file defines the vpp control-plane API messages
    used to control the ABF plugin
*/

option version = "1.0.0";

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

/** \brief Proxy ARP configuration type
    @param table_id - VRF / Fib table ID
    @param low - Low address of the Proxy ARP range
    @param hi - High address of the Proxy ARP range
*/
typedef proxy_arp
{
  u32 table_id;
  vl_api_ip4_address_t low;
  vl_api_ip4_address_t hi;
};

/** \brief Proxy ARP add / del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
    @param proxy - Proxy configuration
*/
autoreply define proxy_arp_add_del
{
  u32 client_index;
  u32 context;
  bool is_add;
  vl_api_proxy_arp_t proxy;
};

/** \brief Proxy ARP dump request
 */
define proxy_arp_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Proxy ARP dump details reply
 * @param proxy - Same data as used to configure
 */
define proxy_arp_details
{
  u32 context;
  vl_api_proxy_arp_t proxy;
};

/** \brief Proxy ARP add / del interface request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - Which interface to enable / disable Proxy Arp on
    @param enable - 1 to enable Proxy ARP on interface, 0 to disable
*/
autoreply define proxy_arp_intfc_enable_disable
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  bool enable;
};

/** \brief Proxy ARP interface dump request
 */
define proxy_arp_intfc_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Proxy ARP interface dump details reply
 * @param sw_if_index The interface on which ARP proxy is enabled.
 */
define proxy_arp_intfc_details
{
  u32 context;
  u32 sw_if_index;
};

counters arp {
  replies_sent {
    severity info;
    type counter64;
    units "packets";
    description "ARP replies sent";
  };
  disabled {
    severity error;
    type counter64;
    units "packets";
    description "ARP Disabled";
  };
  l2_type_not_ethernet {
    severity error;
    type counter64;
    units "packets";
    description "L2 type not ethernet";
  };
  l3_type_not_ip4 {
    severity error;
    type counter64;
    units "packets";
    description "L3 type not IP4";
  };
  l3_src_address_not_local {
    severity error;
    type counter64;
    units "packets";
    description "IP4 source address not local to subnet";
  };
  l3_dst_address_not_local {
    severity error;
    type counter64;
    units "packets";
    description "IP4 destination address not local to subnet";
  };
  l3_dst_address_unset {
    severity error;
    type counter64;
    units "packets";
    description "IP4 destination address is unset";
  };
  l3_src_address_is_local {
    severity error;
    type counter64;
    units "packets";
    description "IP4 source address matches local interface";
  };
  l3_src_address_learned {
    severity info;
    type counter64;
    units "packets";
    description "ARP request IP4 source address learned";
  };
  replies_received {
    severity info;
    type counter64;
    units "packets";
    description "ARP replies received";
  };
  opcode_not_request {
    severity error;
    type counter64;
    units "packets";
    description "ARP opcode not request";
  };
  proxy_arp_replies_sent {
    severity info;
    type counter64;
    units "packets";
    description "Proxy ARP replies sent";
  };
  l2_address_mismatch {
    severity error;
    type counter64;
    units "packets";
    description "ARP hw addr does not match L2 frame src addr";
  };
  gratuitous_arp {
    severity error;
    type counter64;
    units "packets";
    description "ARP probe or announcement dropped";
  };
  interface_no_table {
    severity error;
    type counter64;
    units "packets";
    description "Interface is not mapped to an IP table";
  };
  interface_not_ip_enabled {
    severity error;
    type counter64;
    units "packets";
    description "Interface is not IP enabled";
  };
  unnumbered_mismatch {
    severity error;
    type counter64;
    units "packets";
    description "RX interface is unnumbered to different subnet";
  };
};

paths {
  "/err/arp-reply" "arp";
  "/err/arp-disabled" "arp";
  "/err/arp-input" "arp";
  "/err/arp-proxy" "arp";
};

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