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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 *------------------------------------------------------------------
17 * trace_test.c - test harness for trace plugin
18 *------------------------------------------------------------------
22 #include <vlibapi/api.h>
23 #include <vlibmemory/api.h>
25 #include <vppinfra/error.h>
27 #define __plugin_msg_base trace_test_main.msg_id_base
28 #include <vlibapi/vat_helper_macros.h>
30 /* Declare message IDs */
31 #include <ioam/lib-trace/trace.api_enum.h>
32 #include <ioam/lib-trace/trace.api_types.h>
36 /* API message ID base */
41 trace_test_main_t trace_test_main;
44 api_trace_profile_add (vat_main_t * vam)
46 unformat_input_t *input = vam->input;
47 vl_api_trace_profile_add_t *mp;
55 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
57 if (unformat (input, "trace-type 0x%x", &trace_type))
59 else if (unformat (input, "trace-elts %d", &num_elts))
61 else if (unformat (input, "trace-tsp %d", &trace_tsp))
63 else if (unformat (input, "node-id 0x%x", &node_id))
65 else if (unformat (input, "app-data 0x%x", &app_data))
73 M (TRACE_PROFILE_ADD, mp);
75 mp->trace_type = trace_type;
76 mp->trace_tsp = trace_tsp;
77 mp->node_id = htonl (node_id);
78 mp->app_data = htonl (app_data);
79 mp->num_elts = num_elts;
89 api_trace_profile_del (vat_main_t * vam)
91 vl_api_trace_profile_del_t *mp;
94 M (TRACE_PROFILE_DEL, mp);
101 api_trace_profile_show_config (vat_main_t * vam)
103 vl_api_trace_profile_show_config_t *mp;
106 M (TRACE_PROFILE_SHOW_CONFIG, mp);
113 vl_api_trace_profile_show_config_reply_t_handler (vat_main_t * vam)
118 /* Override generated plugin register symbol */
119 #define vat_plugin_register trace_vat_plugin_register
120 #include <ioam/lib-trace/trace.api_test.c>
123 * fd.io coding-style-patch-verification: ON
126 * eval: (c-set-style "gnu")