1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
/*
*------------------------------------------------------------------
* Copyright (c) 2021 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.
*------------------------------------------------------------------
*/
#include <vat/vat.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
#include <vppinfra/error.h>
#include <vpp/api/types.h>
#include <vnet/ip/ip_types_api.h>
#define __plugin_msg_base sr_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
/* Declare message IDs */
#include <vnet/format_fns.h>
#include <vnet/srv6/sr.api_enum.h>
#include <vnet/srv6/sr.api_types.h>
#define vl_endianfun /* define message structures */
#include <vnet/srv6/sr.api.h>
#undef vl_endianfun
typedef struct
{
/* API message ID base */
u16 msg_id_base;
u32 ping_id;
vat_main_t *vat_main;
} sr_test_main_t;
static sr_test_main_t sr_test_main;
static int
api_sr_steering_add_del (vat_main_t *vam)
{
return -1;
}
static int
api_sr_set_encap_hop_limit (vat_main_t *vam)
{
return -1;
}
static int
api_sr_set_encap_source (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policy_del (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policy_mod (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policy_add (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policy_mod_v2 (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policy_add_v2 (vat_main_t *vam)
{
return -1;
}
static int
api_sr_localsids_dump (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policies_dump (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policies_v2_dump (vat_main_t *vam)
{
return -1;
}
static int
api_sr_policies_with_sl_index_dump (vat_main_t *vam)
{
return -1;
}
static int
api_sr_steering_pol_dump (vat_main_t *vam)
{
return -1;
}
static void
vl_api_sr_policies_details_t_handler (vl_api_sr_policies_details_t *mp)
{
}
static void
vl_api_sr_policies_v2_details_t_handler (vl_api_sr_policies_v2_details_t *mp)
{
}
static void
vl_api_sr_localsids_details_t_handler (vl_api_sr_localsids_details_t *mp)
{
}
static void
vl_api_sr_policies_with_sl_index_details_t_handler (
vl_api_sr_policies_with_sl_index_details_t *mp)
{
}
static void
vl_api_sr_steering_pol_details_t_handler (vl_api_sr_steering_pol_details_t *mp)
{
}
static int
api_sr_localsid_add_del (vat_main_t *vam)
{
unformat_input_t *i = vam->input;
vl_api_sr_localsid_add_del_t *mp;
u8 is_del;
ip6_address_t localsid;
u8 end_psp = 0;
u8 behavior = ~0;
u32 sw_if_index;
u32 fib_table = ~(u32) 0;
ip46_address_t nh_addr;
clib_memset (&nh_addr, 0, sizeof (ip46_address_t));
bool nexthop_set = 0;
int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
if (unformat (i, "del"))
is_del = 1;
else if (unformat (i, "address %U", unformat_ip6_address, &localsid))
;
else if (unformat (i, "next-hop %U", unformat_ip46_address, &nh_addr))
nexthop_set = 1;
else if (unformat (i, "behavior %u", &behavior))
;
else if (unformat (i, "sw_if_index %u", &sw_if_index))
;
else if (unformat (i, "fib-table %u", &fib_table))
;
else if (unformat (i, "end.psp %u", &behavior))
;
else
break;
}
M (SR_LOCALSID_ADD_DEL, mp);
clib_memcpy (mp->localsid, &localsid, sizeof (mp->localsid));
if (nexthop_set)
{
clib_memcpy (&mp->nh_addr.un, &nh_addr, sizeof (mp->nh_addr.un));
}
mp->behavior = behavior;
mp->sw_if_index = ntohl (sw_if_index);
mp->fib_table = ntohl (fib_table);
mp->end_psp = end_psp;
mp->is_del = is_del;
S (mp);
W (ret);
return ret;
}
#include <vnet/srv6/sr.api_test.c>
VAT_REGISTER_FEATURE_FUNCTION (vat_sr_plugin_register);
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|