Line data Source code
1 : /* 2 : * Copyright (c) 2016 Cisco and/or its affiliates. 3 : * Licensed under the Apache License, Version 2.0 (the "License"); 4 : * you may not use this file except in compliance with the License. 5 : * You may obtain a copy of the License at: 6 : * 7 : * http://www.apache.org/licenses/LICENSE-2.0 8 : * 9 : * Unless required by applicable law or agreed to in writing, software 10 : * distributed under the License is distributed on an "AS IS" BASIS, 11 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : * See the License for the specific language governing permissions and 13 : * limitations under the License. 14 : */ 15 : /* 16 : *------------------------------------------------------------------ 17 : * vxlan_gpe_ioam_export_test.c - test harness plugin 18 : *------------------------------------------------------------------ 19 : */ 20 : 21 : #include <vat/vat.h> 22 : #include <vlibapi/api.h> 23 : #include <vlibmemory/api.h> 24 : #include <vppinfra/error.h> 25 : #include <vnet/format_fns.h> 26 : 27 : #define __plugin_msg_base vxlan_gpe_ioam_export_test_main.msg_id_base 28 : #include <vlibapi/vat_helper_macros.h> 29 : 30 : /* Declare message IDs */ 31 : #include <ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api_enum.h> 32 : #include <ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api_types.h> 33 : 34 : typedef struct 35 : { 36 : /* API message ID base */ 37 : u16 msg_id_base; 38 : vat_main_t *vat_main; 39 : } vxlan_gpe_ioam_export_test_main_t; 40 : 41 : vxlan_gpe_ioam_export_test_main_t vxlan_gpe_ioam_export_test_main; 42 : 43 : static int 44 0 : api_vxlan_gpe_ioam_export_enable_disable (vat_main_t * vam) 45 : { 46 0 : unformat_input_t *i = vam->input; 47 0 : int is_disable = 0; 48 : vl_api_vxlan_gpe_ioam_export_enable_disable_t *mp; 49 : int ret; 50 : 51 : /* Parse args required to build the message */ 52 0 : while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) 53 : { 54 0 : if (unformat (i, "disable")) 55 0 : is_disable = 1; 56 : else 57 0 : break; 58 : } 59 : 60 : /* Construct the API message */ 61 0 : M (VXLAN_GPE_IOAM_EXPORT_ENABLE_DISABLE, mp); 62 0 : mp->is_disable = is_disable; 63 : 64 : /* send it... */ 65 0 : S (mp); 66 : 67 : /* Wait for a reply... */ 68 0 : W (ret); 69 0 : return ret; 70 : } 71 : 72 : /* Override generated plugin register symbol */ 73 : #define vat_plugin_register vxlan_gpe_ioam_export_vat_plugin_register 74 : #include <ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api_test.c> 75 : 76 : /* 77 : * fd.io coding-style-patch-verification: ON 78 : * 79 : * Local Variables: 80 : * eval: (c-set-style "gnu") 81 : * End: 82 : */