/*
 * Copyright (c) 2017 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 configure global parameter for LLDP
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param system_name - VPP system name
    @param tx_hold - multiplier for tx_interval when setting time-to-live (TTL)
                     value in the LLDP packets
    @param tx_interval - time interval, in seconds, between each LLDP frames
*/
autoreply define lldp_config
{
  u32 client_index;
  u32 context;
  u32 tx_hold;
  u32 tx_interval;
  string system_name[];
};

/** \brief Interface set LLDP request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface for which to enable/disable LLDP
    @param mgmt_ip4_addr - management ip4 address of the interface
    @param mgmt_ip6_addr - management ip6 address of the interface
    @param mgmt_oid - OID(Object Identifier) of the interface
    @param enable - if non-zero enable, else disable
    @param port_desc - local port description
*/
autoreply define sw_interface_set_lldp
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_ip4_address_t mgmt_ip4;
  vl_api_ip6_address_t mgmt_ip6;
  u8 mgmt_oid[128];
  bool enable [default=true];
  string port_desc[];
};
