hs-test: temp skip some tests
[vpp.git] / src / plugins / ioam / lib-trace / trace_test.c
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  * trace_test.c - test harness for trace plugin
18  *------------------------------------------------------------------
19  */
20
21 #include <vat/vat.h>
22 #include <vlibapi/api.h>
23 #include <vlibmemory/api.h>
24
25 #include <vppinfra/error.h>
26
27 #define __plugin_msg_base trace_test_main.msg_id_base
28 #include <vlibapi/vat_helper_macros.h>
29
30 /* Declare message IDs */
31 #include <ioam/lib-trace/trace.api_enum.h>
32 #include <ioam/lib-trace/trace.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 } trace_test_main_t;
40
41 trace_test_main_t trace_test_main;
42
43 static int
44 api_trace_profile_add (vat_main_t * vam)
45 {
46   unformat_input_t *input = vam->input;
47   vl_api_trace_profile_add_t *mp;
48   u8 trace_type = 0;
49   u8 num_elts = 0;
50   u32 node_id = 0;
51   u32 app_data = 0;
52   u8 trace_tsp = 0;
53   int ret;
54
55   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
56     {
57       if (unformat (input, "trace-type 0x%x", &trace_type))
58         ;
59       else if (unformat (input, "trace-elts %d", &num_elts))
60         ;
61       else if (unformat (input, "trace-tsp %d", &trace_tsp))
62         ;
63       else if (unformat (input, "node-id 0x%x", &node_id))
64         ;
65       else if (unformat (input, "app-data 0x%x", &app_data))
66         ;
67
68       else
69         break;
70     }
71
72
73   M (TRACE_PROFILE_ADD, mp);
74
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;
80
81   S (mp);
82   W (ret);
83   return ret;
84 }
85
86
87
88 static int
89 api_trace_profile_del (vat_main_t * vam)
90 {
91   vl_api_trace_profile_del_t *mp;
92   int ret;
93
94   M (TRACE_PROFILE_DEL, mp);
95   S (mp);
96   W (ret);
97   return ret;
98 }
99
100 static int
101 api_trace_profile_show_config (vat_main_t * vam)
102 {
103   vl_api_trace_profile_show_config_t *mp;
104   int ret;
105
106   M (TRACE_PROFILE_SHOW_CONFIG, mp);
107   S (mp);
108   W (ret);
109   return ret;
110 }
111
112 static int
113 vl_api_trace_profile_show_config_reply_t_handler (vat_main_t * vam)
114 {
115   return -1;
116 }
117
118 /* Override generated plugin register symbol */
119 #define vat_plugin_register trace_vat_plugin_register
120 #include <ioam/lib-trace/trace.api_test.c>
121
122 /*
123  * fd.io coding-style-patch-verification: ON
124  *
125  * Local Variables:
126  * eval: (c-set-style "gnu")
127  * End:
128  */