2 * Copyright (c) 2018 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 #include <vlibapi/api.h>
17 #include <vlibmemory/api.h>
18 #include <vppinfra/error.h>
19 #include <vnet/format_fns.h>
22 #define __plugin_msg_base stn_test_main.msg_id_base
23 #include <vlibapi/vat_helper_macros.h>
25 /* Declare message IDs */
26 #include <vpp/api/vpe.api_types.h>
27 #include <stn/stn.api_enum.h>
28 #include <stn/stn.api_types.h>
32 /* API message ID base */
38 stn_test_main_t stn_test_main;
41 api_stn_add_del_rule (vat_main_t * vam)
43 // Not yet implemented
48 api_stn_rules_dump (vat_main_t * vam)
50 stn_test_main_t *sm = &stn_test_main;
51 vl_api_stn_rules_dump_t *mp;
52 vl_api_control_ping_t *mp_ping;
55 if (!vam->json_output)
57 print (vam->ofp, "%=20s", "STN Rules");
60 M (STN_RULES_DUMP, mp);
64 /* Use a control ping for synchronization */
65 mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping));
66 mp_ping->_vl_msg_id = htons (sm->ping_id);
67 mp_ping->client_index = vam->my_client_index;
69 fformat (vam->ofp, "Sending ping id=%d\n", sm->ping_id);
71 vam->result_ready = 0;
74 /* Wait for a reply... */
80 vl_api_stn_rules_details_t_handler (vl_api_stn_rules_details_t * mp)
82 vat_main_t *vam = stn_test_main.vat_main;
83 fformat (vam->ofp, "addr: %U sw_if_index: %u\n",
85 mp->ip_address, clib_net_to_host_u32 (mp->sw_if_index));
88 #include <stn/stn.api_test.c>
91 * fd.io coding-style-patch-verification: ON
94 * eval: (c-set-style "gnu")