/src/frr/zebra/zebra_evpn_mh_clippy.c
Line  | Count  | Source  | 
1  |  | /* zebra_evpn_es_bypass => "[no] evpn mh bypass" */  | 
2  |  | DEFUN_CMD_FUNC_DECL(zebra_evpn_es_bypass)  | 
3  |  | #define funcdecl_zebra_evpn_es_bypass static int zebra_evpn_es_bypass_magic(\  | 
4  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
5  |  |   struct vty *vty __attribute__ ((unused)),\  | 
6  |  |   int argc __attribute__ ((unused)),\  | 
7  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
8  |  |   const char * no)  | 
9  |  | funcdecl_zebra_evpn_es_bypass;  | 
10  |  | DEFUN_CMD_FUNC_TEXT(zebra_evpn_es_bypass)  | 
11  | 0  | { | 
12  | 0  | #if 1 /* anything to parse? */  | 
13  | 0  |   int _i;  | 
14  |  | #if 0 /* anything that can fail? */  | 
15  |  |   unsigned _fail = 0, _failcnt = 0;  | 
16  |  | #endif  | 
17  | 0  |   const char *no = NULL;  | 
18  |  | 
  | 
19  | 0  |   for (_i = 0; _i < argc; _i++) { | 
20  | 0  |     if (!argv[_i]->varname)  | 
21  | 0  |       continue;  | 
22  |  | #if 0 /* anything that can fail? */  | 
23  |  |     _fail = 0;  | 
24  |  | #endif  | 
25  |  |  | 
26  | 0  |     if (!strcmp(argv[_i]->varname, "no")) { | 
27  | 0  |       no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
28  | 0  |     }  | 
29  |  | #if 0 /* anything that can fail? */  | 
30  |  |     if (_fail)  | 
31  |  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
32  |  |            argv[_i]->varname, argv[_i]->arg);  | 
33  |  |     _failcnt += _fail;  | 
34  |  | #endif  | 
35  | 0  |   }  | 
36  |  | #if 0 /* anything that can fail? */  | 
37  |  |   if (_failcnt)  | 
38  |  |     return CMD_WARNING;  | 
39  |  | #endif  | 
40  | 0  | #endif  | 
41  |  | 
  | 
42  | 0  |   return zebra_evpn_es_bypass_magic(self, vty, argc, argv, no);  | 
43  | 0  | }  | 
44  |  |  | 
45  |  | /* zebra_evpn_es_pref => "[no$no] evpn mh es-df-pref [(1-65535)$df_pref]" */  | 
46  |  | DEFUN_CMD_FUNC_DECL(zebra_evpn_es_pref)  | 
47  |  | #define funcdecl_zebra_evpn_es_pref static int zebra_evpn_es_pref_magic(\  | 
48  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
49  |  |   struct vty *vty __attribute__ ((unused)),\  | 
50  |  |   int argc __attribute__ ((unused)),\  | 
51  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
52  |  |   const char * no,\  | 
53  |  |   long df_pref,\  | 
54  |  |   const char * df_pref_str __attribute__ ((unused)))  | 
55  |  | funcdecl_zebra_evpn_es_pref;  | 
56  |  | DEFUN_CMD_FUNC_TEXT(zebra_evpn_es_pref)  | 
57  | 0  | { | 
58  | 0  | #if 2 /* anything to parse? */  | 
59  | 0  |   int _i;  | 
60  | 0  | #if 1 /* anything that can fail? */  | 
61  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
62  | 0  | #endif  | 
63  | 0  |   const char *no = NULL;  | 
64  | 0  |   long df_pref = 0;  | 
65  | 0  |   const char *df_pref_str = NULL;  | 
66  |  | 
  | 
67  | 0  |   for (_i = 0; _i < argc; _i++) { | 
68  | 0  |     if (!argv[_i]->varname)  | 
69  | 0  |       continue;  | 
70  | 0  | #if 1 /* anything that can fail? */  | 
71  | 0  |     _fail = 0;  | 
72  | 0  | #endif  | 
73  |  | 
  | 
74  | 0  |     if (!strcmp(argv[_i]->varname, "no")) { | 
75  | 0  |       no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
76  | 0  |     }  | 
77  | 0  |     if (!strcmp(argv[_i]->varname, "df_pref")) { | 
78  | 0  |       df_pref_str = argv[_i]->arg;  | 
79  | 0  |       char *_end;  | 
80  | 0  |       df_pref = strtol(argv[_i]->arg, &_end, 10);  | 
81  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
82  | 0  |     }  | 
83  | 0  | #if 1 /* anything that can fail? */  | 
84  | 0  |     if (_fail)  | 
85  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
86  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
87  | 0  |     _failcnt += _fail;  | 
88  | 0  | #endif  | 
89  | 0  |   }  | 
90  | 0  | #if 1 /* anything that can fail? */  | 
91  | 0  |   if (_failcnt)  | 
92  | 0  |     return CMD_WARNING;  | 
93  | 0  | #endif  | 
94  | 0  | #endif  | 
95  |  |  | 
96  | 0  |   return zebra_evpn_es_pref_magic(self, vty, argc, argv, no, df_pref, df_pref_str);  | 
97  | 0  | }  | 
98  |  |  | 
99  |  | /* zebra_evpn_es_sys_mac => "[no$no] evpn mh es-sys-mac [X:X:X:X:X:X$mac]" */  | 
100  |  | DEFUN_CMD_FUNC_DECL(zebra_evpn_es_sys_mac)  | 
101  |  | #define funcdecl_zebra_evpn_es_sys_mac static int zebra_evpn_es_sys_mac_magic(\  | 
102  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
103  |  |   struct vty *vty __attribute__ ((unused)),\  | 
104  |  |   int argc __attribute__ ((unused)),\  | 
105  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
106  |  |   const char * no,\  | 
107  |  |   struct prefix_eth * mac,\  | 
108  |  |   const char * mac_str __attribute__ ((unused)))  | 
109  |  | funcdecl_zebra_evpn_es_sys_mac;  | 
110  |  | DEFUN_CMD_FUNC_TEXT(zebra_evpn_es_sys_mac)  | 
111  | 0  | { | 
112  | 0  | #if 2 /* anything to parse? */  | 
113  | 0  |   int _i;  | 
114  | 0  | #if 1 /* anything that can fail? */  | 
115  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
116  | 0  | #endif  | 
117  | 0  |   const char *no = NULL;  | 
118  | 0  |   struct prefix_eth mac = { }; | 
119  | 0  |   const char *mac_str = NULL;  | 
120  |  | 
  | 
121  | 0  |   for (_i = 0; _i < argc; _i++) { | 
122  | 0  |     if (!argv[_i]->varname)  | 
123  | 0  |       continue;  | 
124  | 0  | #if 1 /* anything that can fail? */  | 
125  | 0  |     _fail = 0;  | 
126  | 0  | #endif  | 
127  |  | 
  | 
128  | 0  |     if (!strcmp(argv[_i]->varname, "no")) { | 
129  | 0  |       no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
130  | 0  |     }  | 
131  | 0  |     if (!strcmp(argv[_i]->varname, "mac")) { | 
132  | 0  |       mac_str = argv[_i]->arg;  | 
133  | 0  |       _fail = !str2prefix_eth(argv[_i]->arg, &mac);  | 
134  | 0  |     }  | 
135  | 0  | #if 1 /* anything that can fail? */  | 
136  | 0  |     if (_fail)  | 
137  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
138  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
139  | 0  |     _failcnt += _fail;  | 
140  | 0  | #endif  | 
141  | 0  |   }  | 
142  | 0  | #if 1 /* anything that can fail? */  | 
143  | 0  |   if (_failcnt)  | 
144  | 0  |     return CMD_WARNING;  | 
145  | 0  | #endif  | 
146  | 0  | #endif  | 
147  |  |  | 
148  | 0  |   return zebra_evpn_es_sys_mac_magic(self, vty, argc, argv, no, &mac, mac_str);  | 
149  | 0  | }  | 
150  |  |  | 
151  |  | /* zebra_evpn_es_id => "[no$no] evpn mh es-id [(1-16777215)$es_lid | NAME$esi_str]" */  | 
152  |  | DEFUN_CMD_FUNC_DECL(zebra_evpn_es_id)  | 
153  |  | #define funcdecl_zebra_evpn_es_id static int zebra_evpn_es_id_magic(\  | 
154  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
155  |  |   struct vty *vty __attribute__ ((unused)),\  | 
156  |  |   int argc __attribute__ ((unused)),\  | 
157  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
158  |  |   const char * no,\  | 
159  |  |   long es_lid,\  | 
160  |  |   const char * es_lid_str __attribute__ ((unused)),\  | 
161  |  |   const char * esi_str)  | 
162  |  | funcdecl_zebra_evpn_es_id;  | 
163  |  | DEFUN_CMD_FUNC_TEXT(zebra_evpn_es_id)  | 
164  | 0  | { | 
165  | 0  | #if 3 /* anything to parse? */  | 
166  | 0  |   int _i;  | 
167  | 0  | #if 1 /* anything that can fail? */  | 
168  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
169  | 0  | #endif  | 
170  | 0  |   const char *no = NULL;  | 
171  | 0  |   long es_lid = 0;  | 
172  | 0  |   const char *es_lid_str = NULL;  | 
173  | 0  |   const char *esi_str = NULL;  | 
174  |  | 
  | 
175  | 0  |   for (_i = 0; _i < argc; _i++) { | 
176  | 0  |     if (!argv[_i]->varname)  | 
177  | 0  |       continue;  | 
178  | 0  | #if 1 /* anything that can fail? */  | 
179  | 0  |     _fail = 0;  | 
180  | 0  | #endif  | 
181  |  | 
  | 
182  | 0  |     if (!strcmp(argv[_i]->varname, "no")) { | 
183  | 0  |       no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
184  | 0  |     }  | 
185  | 0  |     if (!strcmp(argv[_i]->varname, "es_lid")) { | 
186  | 0  |       es_lid_str = argv[_i]->arg;  | 
187  | 0  |       char *_end;  | 
188  | 0  |       es_lid = strtol(argv[_i]->arg, &_end, 10);  | 
189  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
190  | 0  |     }  | 
191  | 0  |     if (!strcmp(argv[_i]->varname, "esi_str")) { | 
192  | 0  |       esi_str = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
193  | 0  |     }  | 
194  | 0  | #if 1 /* anything that can fail? */  | 
195  | 0  |     if (_fail)  | 
196  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
197  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
198  | 0  |     _failcnt += _fail;  | 
199  | 0  | #endif  | 
200  | 0  |   }  | 
201  | 0  | #if 1 /* anything that can fail? */  | 
202  | 0  |   if (_failcnt)  | 
203  | 0  |     return CMD_WARNING;  | 
204  | 0  | #endif  | 
205  | 0  | #endif  | 
206  |  |  | 
207  | 0  |   return zebra_evpn_es_id_magic(self, vty, argc, argv, no, es_lid, es_lid_str, esi_str);  | 
208  | 0  | }  | 
209  |  |  | 
210  |  | /* zebra_evpn_mh_uplink => "[no] evpn mh uplink" */  | 
211  |  | DEFUN_CMD_FUNC_DECL(zebra_evpn_mh_uplink)  | 
212  |  | #define funcdecl_zebra_evpn_mh_uplink static int zebra_evpn_mh_uplink_magic(\  | 
213  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
214  |  |   struct vty *vty __attribute__ ((unused)),\  | 
215  |  |   int argc __attribute__ ((unused)),\  | 
216  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
217  |  |   const char * no)  | 
218  |  | funcdecl_zebra_evpn_mh_uplink;  | 
219  |  | DEFUN_CMD_FUNC_TEXT(zebra_evpn_mh_uplink)  | 
220  | 0  | { | 
221  | 0  | #if 1 /* anything to parse? */  | 
222  | 0  |   int _i;  | 
223  |  | #if 0 /* anything that can fail? */  | 
224  |  |   unsigned _fail = 0, _failcnt = 0;  | 
225  |  | #endif  | 
226  | 0  |   const char *no = NULL;  | 
227  |  | 
  | 
228  | 0  |   for (_i = 0; _i < argc; _i++) { | 
229  | 0  |     if (!argv[_i]->varname)  | 
230  | 0  |       continue;  | 
231  |  | #if 0 /* anything that can fail? */  | 
232  |  |     _fail = 0;  | 
233  |  | #endif  | 
234  |  |  | 
235  | 0  |     if (!strcmp(argv[_i]->varname, "no")) { | 
236  | 0  |       no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
237  | 0  |     }  | 
238  |  | #if 0 /* anything that can fail? */  | 
239  |  |     if (_fail)  | 
240  |  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
241  |  |            argv[_i]->varname, argv[_i]->arg);  | 
242  |  |     _failcnt += _fail;  | 
243  |  | #endif  | 
244  | 0  |   }  | 
245  |  | #if 0 /* anything that can fail? */  | 
246  |  |   if (_failcnt)  | 
247  |  |     return CMD_WARNING;  | 
248  |  | #endif  | 
249  | 0  | #endif  | 
250  |  | 
  | 
251  | 0  |   return zebra_evpn_mh_uplink_magic(self, vty, argc, argv, no);  | 
252  | 0  | }  | 
253  |  |  |