]> git.proxmox.com Git - mirror_frr.git/blame - lib/routemap_cli.c
Merge pull request #9408 from mobash-rasool/ospfv2-bug-fixes-03
[mirror_frr.git] / lib / routemap_cli.c
CommitLineData
2b3e4807
RZ
1/*
2 * Route map northbound CLI implementation.
3 *
4 * Copyright (C) 2019 Network Device Education Foundation, Inc. ("NetDEF")
5 * Rafael Zalamena
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA.
21 */
22
23#include <zebra.h>
24
25#include "lib/command.h"
26#include "lib/northbound_cli.h"
27#include "lib/routemap.h"
71bdae66 28#include "bgpd/bgp_ecommunity.h"
2b3e4807
RZ
29
30#ifndef VTYSH_EXTRACT_PL
31#include "lib/routemap_cli_clippy.c"
32#endif /* VTYSH_EXTRACT_PL */
33
34#define ROUTE_MAP_CMD_STR \
35 "Create route-map or enter route-map command mode\n" \
36 "Route map tag\n"
37#define ROUTE_MAP_OP_CMD_STR \
38 "Route map denies set operations\n" \
39 "Route map permits set operations\n"
40#define ROUTE_MAP_SEQUENCE_CMD_STR \
41 "Sequence to insert to/delete from existing route-map entry\n"
42
ca77b518 43DEFPY_YANG_NOSH(
2b3e4807
RZ
44 route_map, route_map_cmd,
45 "route-map WORD$name <deny|permit>$action (1-65535)$sequence",
46 ROUTE_MAP_CMD_STR
47 ROUTE_MAP_OP_CMD_STR
48 ROUTE_MAP_SEQUENCE_CMD_STR)
49{
50 char xpath_action[XPATH_MAXLEN + 64];
51 char xpath_index[XPATH_MAXLEN + 32];
52 char xpath[XPATH_MAXLEN];
53 int rv;
54
55 snprintf(xpath, sizeof(xpath),
56 "/frr-route-map:lib/route-map[name='%s']", name);
57 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
58
59 snprintf(xpath_index, sizeof(xpath_index), "%s/entry[sequence='%lu']",
60 xpath, sequence);
61 nb_cli_enqueue_change(vty, xpath_index, NB_OP_CREATE, NULL);
62
63 snprintf(xpath_action, sizeof(xpath_action), "%s/action", xpath_index);
64 nb_cli_enqueue_change(vty, xpath_action, NB_OP_MODIFY, action);
65
66 rv = nb_cli_apply_changes(vty, NULL);
d5d737a2 67 if (rv == CMD_SUCCESS)
2b3e4807
RZ
68 VTY_PUSH_XPATH(RMAP_NODE, xpath_index);
69
70 return rv;
71}
72
ca77b518 73DEFPY_YANG(
2b3e4807
RZ
74 no_route_map_all, no_route_map_all_cmd,
75 "no route-map WORD$name",
76 NO_STR
77 ROUTE_MAP_CMD_STR)
78{
79 char xpath[XPATH_MAXLEN];
80
81 snprintf(xpath, sizeof(xpath),
82 "/frr-route-map:lib/route-map[name='%s']", name);
83 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
84
85 return nb_cli_apply_changes(vty, NULL);
86}
87
ca77b518 88DEFPY_YANG(
2b3e4807
RZ
89 no_route_map, no_route_map_cmd,
90 "no route-map WORD$name <deny|permit>$action (1-65535)$sequence",
91 NO_STR
92 ROUTE_MAP_CMD_STR
93 ROUTE_MAP_OP_CMD_STR
94 ROUTE_MAP_SEQUENCE_CMD_STR)
95{
96 char xpath[XPATH_MAXLEN];
97
98 snprintf(xpath, sizeof(xpath),
99 "/frr-route-map:lib/route-map[name='%s']/entry[sequence='%lu']",
100 name, sequence);
d5d737a2 101
2b3e4807
RZ
102 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
103
104 return nb_cli_apply_changes(vty, NULL);
105}
106
de8936be
IR
107int route_map_instance_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2)
108{
109 uint16_t seq1 = yang_dnode_get_uint16(dnode1, "./sequence");
110 uint16_t seq2 = yang_dnode_get_uint16(dnode2, "./sequence");
111
112 return seq1 - seq2;
113}
114
2b3e4807
RZ
115void route_map_instance_show(struct vty *vty, struct lyd_node *dnode,
116 bool show_defaults)
117{
118 const char *name = yang_dnode_get_string(dnode, "../name");
119 const char *action = yang_dnode_get_string(dnode, "./action");
120 const char *sequence = yang_dnode_get_string(dnode, "./sequence");
121
122 vty_out(vty, "route-map %s %s %s\n", name, action, sequence);
e324ef43 123
2b3e4807
RZ
124}
125
126void route_map_instance_show_end(struct vty *vty, struct lyd_node *dnode)
127{
128 vty_out(vty, "!\n");
129}
130
ca77b518 131DEFPY_YANG(
2b3e4807
RZ
132 match_interface, match_interface_cmd,
133 "match interface IFNAME",
134 MATCH_STR
135 "Match first hop interface of route\n"
136 INTERFACE_STR)
137{
d5d737a2
SP
138 const char *xpath =
139 "./match-condition[condition='frr-route-map:interface']";
2b3e4807
RZ
140 char xpath_value[XPATH_MAXLEN];
141
142 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
143 snprintf(xpath_value, sizeof(xpath_value),
144 "%s/rmap-match-condition/interface", xpath);
2b3e4807
RZ
145 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, ifname);
146
147 return nb_cli_apply_changes(vty, NULL);
148}
149
ca77b518 150DEFPY_YANG(
2b3e4807
RZ
151 no_match_interface, no_match_interface_cmd,
152 "no match interface [IFNAME]",
153 NO_STR
154 MATCH_STR
155 "Match first hop interface of route\n"
156 INTERFACE_STR)
157{
d5d737a2
SP
158 const char *xpath =
159 "./match-condition[condition='frr-route-map:interface']";
2b3e4807
RZ
160
161 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
162
163 return nb_cli_apply_changes(vty, NULL);
164}
165
ca77b518 166DEFPY_YANG(
2b3e4807 167 match_ip_address, match_ip_address_cmd,
375d157f 168 "match ip address <(1-199)|(1300-2699)|WORD>$name",
2b3e4807
RZ
169 MATCH_STR
170 IP_STR
171 "Match address of route\n"
172 "IP access-list number\n"
173 "IP access-list number (expanded range)\n"
174 "IP Access-list name\n")
175{
d5d737a2
SP
176 const char *xpath =
177 "./match-condition[condition='frr-route-map:ipv4-address-list']";
2b3e4807 178 char xpath_value[XPATH_MAXLEN + 32];
2b3e4807
RZ
179
180 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
181 snprintf(xpath_value, sizeof(xpath_value),
182 "%s/rmap-match-condition/list-name", xpath);
375d157f 183 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
2b3e4807
RZ
184
185 return nb_cli_apply_changes(vty, NULL);
186}
187
ca77b518 188DEFPY_YANG(
2b3e4807
RZ
189 no_match_ip_address, no_match_ip_address_cmd,
190 "no match ip address [<(1-199)|(1300-2699)|WORD>]",
191 NO_STR
192 MATCH_STR
193 IP_STR
194 "Match address of route\n"
195 "IP access-list number\n"
196 "IP access-list number (expanded range)\n"
197 "IP Access-list name\n")
198{
d5d737a2
SP
199 const char *xpath =
200 "./match-condition[condition='frr-route-map:ipv4-address-list']";
2b3e4807
RZ
201
202 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
203
204 return nb_cli_apply_changes(vty, NULL);
205}
206
ca77b518 207DEFPY_YANG(
2b3e4807
RZ
208 match_ip_address_prefix_list,
209 match_ip_address_prefix_list_cmd,
210 "match ip address prefix-list WORD$name",
211 MATCH_STR
212 IP_STR
213 "Match address of route\n"
214 "Match entries of prefix-lists\n"
215 "IP prefix-list name\n")
216{
d5d737a2
SP
217 const char *xpath =
218 "./match-condition[condition='frr-route-map:ipv4-prefix-list']";
2b3e4807
RZ
219 char xpath_value[XPATH_MAXLEN];
220
221 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
222 snprintf(xpath_value, sizeof(xpath_value),
223 "%s/rmap-match-condition/list-name", xpath);
2b3e4807
RZ
224 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
225
226 return nb_cli_apply_changes(vty, NULL);
227}
228
ca77b518 229DEFPY_YANG(
2b3e4807
RZ
230 no_match_ip_address_prefix_list, no_match_ip_address_prefix_list_cmd,
231 "no match ip address prefix-list [WORD]",
232 NO_STR
233 MATCH_STR
234 IP_STR
235 "Match address of route\n"
236 "Match entries of prefix-lists\n"
237 "IP prefix-list name\n")
238{
d5d737a2
SP
239 const char *xpath =
240 "./match-condition[condition='frr-route-map:ipv4-prefix-list']";
2b3e4807
RZ
241
242 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
243
244 return nb_cli_apply_changes(vty, NULL);
245}
246
ca77b518 247DEFPY_YANG(
2b3e4807 248 match_ip_next_hop, match_ip_next_hop_cmd,
375d157f 249 "match ip next-hop <(1-199)|(1300-2699)|WORD>$name",
2b3e4807
RZ
250 MATCH_STR
251 IP_STR
252 "Match next-hop address of route\n"
253 "IP access-list number\n"
254 "IP access-list number (expanded range)\n"
255 "IP Access-list name\n")
256{
d5d737a2
SP
257 const char *xpath =
258 "./match-condition[condition='frr-route-map:ipv4-next-hop-list']";
2b3e4807 259 char xpath_value[XPATH_MAXLEN + 32];
2b3e4807
RZ
260
261 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
262 snprintf(xpath_value, sizeof(xpath_value),
263 "%s/rmap-match-condition/list-name", xpath);
375d157f 264 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
2b3e4807
RZ
265
266 return nb_cli_apply_changes(vty, NULL);
267}
268
ca77b518 269DEFPY_YANG(
2b3e4807
RZ
270 no_match_ip_next_hop, no_match_ip_next_hop_cmd,
271 "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]",
272 NO_STR
273 MATCH_STR
274 IP_STR
275 "Match address of route\n"
276 "IP access-list number\n"
277 "IP access-list number (expanded range)\n"
278 "IP Access-list name\n")
279{
d5d737a2
SP
280 const char *xpath =
281 "./match-condition[condition='frr-route-map:ipv4-next-hop-list']";
2b3e4807
RZ
282
283 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
284
285 return nb_cli_apply_changes(vty, NULL);
286}
287
ca77b518 288DEFPY_YANG(
2b3e4807
RZ
289 match_ip_next_hop_prefix_list,
290 match_ip_next_hop_prefix_list_cmd,
291 "match ip next-hop prefix-list WORD$name",
292 MATCH_STR
293 IP_STR
294 "Match next-hop address of route\n"
295 "Match entries of prefix-lists\n"
296 "IP prefix-list name\n")
297{
298 const char *xpath =
d5d737a2 299 "./match-condition[condition='frr-route-map:ipv4-next-hop-prefix-list']";
2b3e4807
RZ
300 char xpath_value[XPATH_MAXLEN];
301
302 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
303 snprintf(xpath_value, sizeof(xpath_value),
304 "%s/rmap-match-condition/list-name", xpath);
2b3e4807
RZ
305 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
306
307 return nb_cli_apply_changes(vty, NULL);
308}
309
ca77b518 310DEFPY_YANG(
2b3e4807
RZ
311 no_match_ip_next_hop_prefix_list,
312 no_match_ip_next_hop_prefix_list_cmd,
313 "no match ip next-hop prefix-list [WORD]",
314 NO_STR
315 MATCH_STR
316 IP_STR
317 "Match next-hop address of route\n"
318 "Match entries of prefix-lists\n"
319 "IP prefix-list name\n")
320{
321 const char *xpath =
d5d737a2 322 "./match-condition[condition='frr-route-map:ipv4-next-hop-prefix-list']";
2b3e4807
RZ
323
324 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
325
326 return nb_cli_apply_changes(vty, NULL);
327}
328
ca77b518 329DEFPY_YANG(
2b3e4807
RZ
330 match_ip_next_hop_type, match_ip_next_hop_type_cmd,
331 "match ip next-hop type <blackhole>$type",
332 MATCH_STR
333 IP_STR
334 "Match next-hop address of route\n"
335 "Match entries by type\n"
336 "Blackhole\n")
337{
d5d737a2
SP
338 const char *xpath =
339 "./match-condition[condition='frr-route-map:ipv4-next-hop-type']";
2b3e4807
RZ
340 char xpath_value[XPATH_MAXLEN];
341
342 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
343 snprintf(xpath_value, sizeof(xpath_value),
344 "%s/rmap-match-condition/ipv4-next-hop-type", xpath);
2b3e4807
RZ
345 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, type);
346
347 return nb_cli_apply_changes(vty, NULL);
348}
349
ca77b518 350DEFPY_YANG(
2b3e4807
RZ
351 no_match_ip_next_hop_type, no_match_ip_next_hop_type_cmd,
352 "no match ip next-hop type [<blackhole>]",
353 NO_STR MATCH_STR IP_STR
354 "Match next-hop address of route\n"
355 "Match entries by type\n"
356 "Blackhole\n")
357{
d5d737a2
SP
358 const char *xpath =
359 "./match-condition[condition='frr-route-map:ipv4-next-hop-type']";
2b3e4807
RZ
360
361 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
362
363 return nb_cli_apply_changes(vty, NULL);
364}
365
ca77b518 366DEFPY_YANG(
2b3e4807
RZ
367 match_ipv6_address, match_ipv6_address_cmd,
368 "match ipv6 address WORD$name",
369 MATCH_STR
370 IPV6_STR
371 "Match IPv6 address of route\n"
372 "IPv6 access-list name\n")
373{
d5d737a2
SP
374 const char *xpath =
375 "./match-condition[condition='frr-route-map:ipv6-address-list']";
2b3e4807
RZ
376 char xpath_value[XPATH_MAXLEN];
377
378 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
379 snprintf(xpath_value, sizeof(xpath_value),
380 "%s/rmap-match-condition/list-name", xpath);
2b3e4807
RZ
381 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
382
383 return nb_cli_apply_changes(vty, NULL);
384}
385
ca77b518 386DEFPY_YANG(
2b3e4807
RZ
387 no_match_ipv6_address, no_match_ipv6_address_cmd,
388 "no match ipv6 address [WORD]",
389 NO_STR
390 MATCH_STR
391 IPV6_STR
392 "Match IPv6 address of route\n"
393 "IPv6 access-list name\n")
394{
d5d737a2
SP
395 const char *xpath =
396 "./match-condition[condition='frr-route-map:ipv6-address-list']";
2b3e4807
RZ
397
398 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
399
400 return nb_cli_apply_changes(vty, NULL);
401}
402
ca77b518 403DEFPY_YANG(
2b3e4807
RZ
404 match_ipv6_address_prefix_list, match_ipv6_address_prefix_list_cmd,
405 "match ipv6 address prefix-list WORD$name",
406 MATCH_STR
407 IPV6_STR
408 "Match address of route\n"
409 "Match entries of prefix-lists\n"
410 "IP prefix-list name\n")
411{
d5d737a2
SP
412 const char *xpath =
413 "./match-condition[condition='frr-route-map:ipv6-prefix-list']";
2b3e4807
RZ
414 char xpath_value[XPATH_MAXLEN];
415
416 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
417 snprintf(xpath_value, sizeof(xpath_value),
418 "%s/rmap-match-condition/list-name", xpath);
2b3e4807
RZ
419 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, name);
420
421 return nb_cli_apply_changes(vty, NULL);
422}
423
ca77b518 424DEFPY_YANG(
2b3e4807
RZ
425 no_match_ipv6_address_prefix_list,
426 no_match_ipv6_address_prefix_list_cmd,
427 "no match ipv6 address prefix-list [WORD]",
428 NO_STR
429 MATCH_STR
430 IPV6_STR
431 "Match address of route\n"
432 "Match entries of prefix-lists\n"
433 "IP prefix-list name\n")
434{
d5d737a2
SP
435 const char *xpath =
436 "./match-condition[condition='frr-route-map:ipv6-prefix-list']";
2b3e4807
RZ
437
438 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
439
440 return nb_cli_apply_changes(vty, NULL);
441}
442
ca77b518 443DEFPY_YANG(
2b3e4807
RZ
444 match_ipv6_next_hop_type, match_ipv6_next_hop_type_cmd,
445 "match ipv6 next-hop type <blackhole>$type",
446 MATCH_STR IPV6_STR
447 "Match next-hop address of route\n"
448 "Match entries by type\n"
449 "Blackhole\n")
450{
d5d737a2
SP
451 const char *xpath =
452 "./match-condition[condition='frr-route-map:ipv6-next-hop-type']";
2b3e4807
RZ
453 char xpath_value[XPATH_MAXLEN];
454
455 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
456 snprintf(xpath_value, sizeof(xpath_value),
457 "%s/rmap-match-condition/ipv6-next-hop-type", xpath);
2b3e4807
RZ
458 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, type);
459
460 return nb_cli_apply_changes(vty, NULL);
461}
462
ca77b518 463DEFPY_YANG(
2b3e4807
RZ
464 no_match_ipv6_next_hop_type, no_match_ipv6_next_hop_type_cmd,
465 "no match ipv6 next-hop type [<blackhole>]",
466 NO_STR MATCH_STR IPV6_STR
467 "Match address of route\n"
468 "Match entries by type\n"
469 "Blackhole\n")
470{
d5d737a2
SP
471 const char *xpath =
472 "./match-condition[condition='frr-route-map:ipv6-next-hop-type']";
2b3e4807
RZ
473
474 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
475
476 return nb_cli_apply_changes(vty, NULL);
477}
478
ca77b518 479DEFPY_YANG(
2b3e4807
RZ
480 match_metric, match_metric_cmd,
481 "match metric (0-4294967295)$metric",
482 MATCH_STR
483 "Match metric of route\n"
484 "Metric value\n")
485{
d5d737a2
SP
486 const char *xpath =
487 "./match-condition[condition='frr-route-map:match-metric']";
2b3e4807
RZ
488 char xpath_value[XPATH_MAXLEN];
489
490 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
491 snprintf(xpath_value, sizeof(xpath_value),
492 "%s/rmap-match-condition/metric", xpath);
2b3e4807
RZ
493 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, metric_str);
494
495 return nb_cli_apply_changes(vty, NULL);
496}
497
ca77b518 498DEFPY_YANG(
2b3e4807
RZ
499 no_match_metric, no_match_metric_cmd,
500 "no match metric [(0-4294967295)]",
501 NO_STR
502 MATCH_STR
503 "Match metric of route\n"
504 "Metric value\n")
505{
d5d737a2
SP
506 const char *xpath =
507 "./match-condition[condition='frr-route-map:match-metric']";
2b3e4807
RZ
508
509 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
510
511 return nb_cli_apply_changes(vty, NULL);
512}
513
ca77b518 514DEFPY_YANG(
2b3e4807
RZ
515 match_tag, match_tag_cmd,
516 "match tag (1-4294967295)$tag",
517 MATCH_STR
518 "Match tag of route\n"
519 "Tag value\n")
520{
d5d737a2
SP
521 const char *xpath =
522 "./match-condition[condition='frr-route-map:match-tag']";
2b3e4807
RZ
523 char xpath_value[XPATH_MAXLEN];
524
525 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
526 snprintf(xpath_value, sizeof(xpath_value),
527 "%s/rmap-match-condition/tag", xpath);
2b3e4807
RZ
528 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, tag_str);
529
530 return nb_cli_apply_changes(vty, NULL);
531}
532
ca77b518 533DEFPY_YANG(
2b3e4807
RZ
534 no_match_tag, no_match_tag_cmd,
535 "no match tag [(1-4294967295)]",
536 NO_STR
537 MATCH_STR
538 "Match tag of route\n"
539 "Tag value\n")
540{
d5d737a2
SP
541 const char *xpath =
542 "./match-condition[condition='frr-route-map:match-tag']";
2b3e4807
RZ
543
544 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
545
546 return nb_cli_apply_changes(vty, NULL);
547}
548
549void route_map_condition_show(struct vty *vty, struct lyd_node *dnode,
550 bool show_defaults)
551{
d5d737a2
SP
552 const char *condition = yang_dnode_get_string(dnode, "./condition");
553 struct lyd_node *ln;
554 const char *acl;
2b3e4807 555
d5d737a2 556 if (IS_MATCH_INTERFACE(condition)) {
2b3e4807 557 vty_out(vty, " match interface %s\n",
d5d737a2
SP
558 yang_dnode_get_string(
559 dnode, "./rmap-match-condition/interface"));
560 } else if (IS_MATCH_IPv4_ADDRESS_LIST(condition)
561 || IS_MATCH_IPv4_NEXTHOP_LIST(condition)) {
562 acl = NULL;
563 if ((ln = yang_dnode_get(dnode,
564 "./rmap-match-condition/list-name"))
565 != NULL)
566 acl = yang_dnode_get_string(ln, NULL);
567
568 assert(acl);
569
570 if (IS_MATCH_IPv4_ADDRESS_LIST(condition))
571 vty_out(vty, " match ip address %s\n", acl);
572 else
573 vty_out(vty, " match ip next-hop %s\n", acl);
574 } else if (IS_MATCH_IPv4_PREFIX_LIST(condition)) {
2b3e4807 575 vty_out(vty, " match ip address prefix-list %s\n",
d5d737a2
SP
576 yang_dnode_get_string(
577 dnode, "./rmap-match-condition/list-name"));
578 } else if (IS_MATCH_IPv4_NEXTHOP_PREFIX_LIST(condition)) {
2b3e4807 579 vty_out(vty, " match ip next-hop prefix-list %s\n",
d5d737a2
SP
580 yang_dnode_get_string(
581 dnode, "./rmap-match-condition/list-name"));
582 } else if (IS_MATCH_IPv6_ADDRESS_LIST(condition)) {
2b3e4807 583 vty_out(vty, " match ipv6 address %s\n",
d5d737a2
SP
584 yang_dnode_get_string(
585 dnode, "./rmap-match-condition/list-name"));
586 } else if (IS_MATCH_IPv6_PREFIX_LIST(condition)) {
2b3e4807 587 vty_out(vty, " match ipv6 address prefix-list %s\n",
d5d737a2
SP
588 yang_dnode_get_string(
589 dnode, "./rmap-match-condition/list-name"));
590 } else if (IS_MATCH_IPv4_NEXTHOP_TYPE(condition)) {
591 vty_out(vty, " match ip next-hop type %s\n",
592 yang_dnode_get_string(
593 dnode,
594 "./rmap-match-condition/ipv4-next-hop-type"));
595 } else if (IS_MATCH_IPv6_NEXTHOP_TYPE(condition)) {
2b3e4807 596 vty_out(vty, " match ipv6 next-hop type %s\n",
d5d737a2
SP
597 yang_dnode_get_string(
598 dnode,
599 "./rmap-match-condition/ipv6-next-hop-type"));
600 } else if (IS_MATCH_METRIC(condition)) {
2b3e4807 601 vty_out(vty, " match metric %s\n",
d5d737a2
SP
602 yang_dnode_get_string(dnode,
603 "./rmap-match-condition/metric"));
604 } else if (IS_MATCH_TAG(condition)) {
2b3e4807 605 vty_out(vty, " match tag %s\n",
d5d737a2
SP
606 yang_dnode_get_string(dnode,
607 "./rmap-match-condition/tag"));
608 } else if (IS_MATCH_IPv4_PREFIX_LEN(condition)) {
f42cc965 609 vty_out(vty, " match ip address prefix-len %s\n",
d5d737a2
SP
610 yang_dnode_get_string(
611 dnode,
612 "./rmap-match-condition/frr-zebra-route-map:ipv4-prefix-length"));
613 } else if (IS_MATCH_IPv6_PREFIX_LEN(condition)) {
f42cc965 614 vty_out(vty, " match ipv6 address prefix-len %s\n",
d5d737a2
SP
615 yang_dnode_get_string(
616 dnode,
617 "./rmap-match-condition/frr-zebra-route-map:ipv6-prefix-length"));
618 } else if (IS_MATCH_IPv4_NH_PREFIX_LEN(condition)) {
f42cc965 619 vty_out(vty, " match ip next-hop prefix-len %s\n",
d5d737a2
SP
620 yang_dnode_get_string(
621 dnode,
622 "./rmap-match-condition/frr-zebra-route-map:ipv4-prefix-length"));
623 } else if (IS_MATCH_SRC_PROTO(condition)) {
f42cc965 624 vty_out(vty, " match source-protocol %s\n",
d5d737a2
SP
625 yang_dnode_get_string(
626 dnode,
627 "./rmap-match-condition/frr-zebra-route-map:source-protocol"));
628 } else if (IS_MATCH_SRC_INSTANCE(condition)) {
f42cc965 629 vty_out(vty, " match source-instance %s\n",
d5d737a2
SP
630 yang_dnode_get_string(
631 dnode,
632 "./rmap-match-condition/frr-zebra-route-map:source-instance"));
633 } else if (IS_MATCH_LOCAL_PREF(condition)) {
634 vty_out(vty, " match local-preference %s\n",
635 yang_dnode_get_string(
636 dnode,
637 "./rmap-match-condition/frr-bgp-route-map:local-preference"));
2690f18c
DA
638 } else if (IS_MATCH_ALIAS(condition)) {
639 vty_out(vty, " match alias %s\n",
640 yang_dnode_get_string(
641 dnode,
642 "./rmap-match-condition/frr-bgp-route-map:alias"));
d5d737a2
SP
643 } else if (IS_MATCH_ORIGIN(condition)) {
644 vty_out(vty, " match origin %s\n",
645 yang_dnode_get_string(
646 dnode,
647 "./rmap-match-condition/frr-bgp-route-map:origin"));
648 } else if (IS_MATCH_RPKI(condition)) {
649 vty_out(vty, " match rpki %s\n",
650 yang_dnode_get_string(
651 dnode,
652 "./rmap-match-condition/frr-bgp-route-map:rpki"));
653 } else if (IS_MATCH_PROBABILITY(condition)) {
654 vty_out(vty, " match probability %s\n",
655 yang_dnode_get_string(
656 dnode,
657 "./rmap-match-condition/frr-bgp-route-map:probability"));
658 } else if (IS_MATCH_SRC_VRF(condition)) {
659 vty_out(vty, " match source-vrf %s\n",
660 yang_dnode_get_string(
661 dnode,
662 "./rmap-match-condition/frr-bgp-route-map:source-vrf"));
663 } else if (IS_MATCH_PEER(condition)) {
664 acl = NULL;
665 if ((ln = yang_dnode_get(
666 dnode,
667 "./rmap-match-condition/frr-bgp-route-map:peer-ipv4-address"))
668 != NULL)
669 acl = yang_dnode_get_string(ln, NULL);
670 else if (
671 (ln = yang_dnode_get(
672 dnode,
673 "./rmap-match-condition/frr-bgp-route-map:peer-ipv6-address"))
674 != NULL)
675 acl = yang_dnode_get_string(ln, NULL);
676 else if (
677 (ln = yang_dnode_get(
678 dnode,
679 "./rmap-match-condition/frr-bgp-route-map:peer-interface"))
680 != NULL)
681 acl = yang_dnode_get_string(ln, NULL);
682 else if (yang_dnode_get(
683 dnode,
684 "./rmap-match-condition/frr-bgp-route-map:peer-local")
685 != NULL)
686 acl = "local";
687
688 vty_out(vty, " match peer %s\n", acl);
689 } else if (IS_MATCH_AS_LIST(condition)) {
690 vty_out(vty, " match as-path %s\n",
691 yang_dnode_get_string(
692 dnode,
693 "./rmap-match-condition/frr-bgp-route-map:list-name"));
694 } else if (IS_MATCH_EVPN_ROUTE_TYPE(condition)) {
695 vty_out(vty, " match evpn route-type %s\n",
696 yang_dnode_get_string(
697 dnode,
698 "./rmap-match-condition/frr-bgp-route-map:evpn-route-type"));
699 } else if (IS_MATCH_EVPN_DEFAULT_ROUTE(condition)) {
700 vty_out(vty, " match evpn default-route\n");
701 } else if (IS_MATCH_EVPN_VNI(condition)) {
702 vty_out(vty, " match evpn vni %s\n",
703 yang_dnode_get_string(
704 dnode,
705 "./rmap-match-condition/frr-bgp-route-map:evpn-vni"));
706 } else if (IS_MATCH_EVPN_DEFAULT_ROUTE(condition)) {
707 vty_out(vty, " match evpn default-route %s\n",
708 yang_dnode_get_string(
709 dnode,
710 "./rmap-match-condition/frr-bgp-route-map:evpn-default-route"));
711 } else if (IS_MATCH_EVPN_RD(condition)) {
712 vty_out(vty, " match evpn rd %s\n",
713 yang_dnode_get_string(
714 dnode,
715 "./rmap-match-condition/frr-bgp-route-map:route-distinguisher"));
716 } else if (IS_MATCH_MAC_LIST(condition)) {
717 vty_out(vty, " match mac address %s\n",
718 yang_dnode_get_string(
719 dnode,
720 "./rmap-match-condition/frr-bgp-route-map:list-name"));
721 } else if (IS_MATCH_ROUTE_SRC(condition)) {
722 acl = NULL;
723 if ((ln = yang_dnode_get(
724 dnode,
725 "./rmap-match-condition/frr-bgp-route-map:list-name"))
726 != NULL)
727 acl = yang_dnode_get_string(ln, NULL);
728
729 assert(acl);
730
731 vty_out(vty, " match ip route-source %s\n", acl);
732 } else if (IS_MATCH_ROUTE_SRC_PL(condition)) {
733 vty_out(vty, " match ip route-source prefix-list %s\n",
734 yang_dnode_get_string(
735 dnode,
736 "./rmap-match-condition/frr-bgp-route-map:list-name"));
737 } else if (IS_MATCH_ROUTE_SRC(condition)) {
738 acl = NULL;
739 if ((ln = yang_dnode_get(
740 dnode,
741 "./rmap-match-condition/frr-bgp-route-map:list-name"))
742 != NULL)
743 acl = yang_dnode_get_string(ln, NULL);
744
745 assert(acl);
746
747 vty_out(vty, " match ip route-source %s\n", acl);
748 } else if (IS_MATCH_COMMUNITY(condition)) {
749 acl = NULL;
750 if ((ln = yang_dnode_get(
751 dnode,
752 "./rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name"))
753 != NULL) {
754 acl = yang_dnode_get_string(ln, NULL);
755
756 if (true
757 == yang_dnode_get_bool(
758 dnode,
759 "./rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name-exact-match"))
760 vty_out(vty,
761 " match community %s exact-match\n",
762 acl);
763 else
764 vty_out(vty, " match community %s\n", acl);
765 }
766
767 assert(acl);
768 } else if (IS_MATCH_LCOMMUNITY(condition)) {
769 acl = NULL;
770 if ((ln = yang_dnode_get(
771 dnode,
772 "./rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name"))
773 != NULL) {
774 acl = yang_dnode_get_string(ln, NULL);
775
776 if (true
777 == yang_dnode_get_bool(
778 dnode,
779 "./rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name-exact-match"))
780 vty_out(vty,
781 " match large-community %s exact-match\n",
782 acl);
783 else
784 vty_out(vty, " match large-community %s\n",
785 acl);
786 }
787
788 assert(acl);
789 } else if (IS_MATCH_EXTCOMMUNITY(condition)) {
790 acl = NULL;
791 if ((ln = yang_dnode_get(
792 dnode,
793 "./rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name"))
794 != NULL)
795 acl = yang_dnode_get_string(ln, NULL);
796
797 assert(acl);
798
799 vty_out(vty, " match extcommunity %s\n", acl);
800 } else if (IS_MATCH_IPV4_NH(condition)) {
801 vty_out(vty, " match ip next-hop %s\n",
802 yang_dnode_get_string(
803 dnode,
804 "./rmap-match-condition/frr-bgp-route-map:ipv4-address"));
805 } else if (IS_MATCH_IPV6_NH(condition)) {
806 vty_out(vty, " match ipv6 next-hop %s\n",
807 yang_dnode_get_string(
808 dnode,
809 "./rmap-match-condition/frr-bgp-route-map:ipv6-address"));
2b3e4807
RZ
810 }
811}
812
ca77b518 813DEFPY_YANG(
2b3e4807
RZ
814 set_ip_nexthop, set_ip_nexthop_cmd,
815 "set ip next-hop A.B.C.D$addr",
816 SET_STR
817 IP_STR
818 "Next hop address\n"
819 "IP address of next hop\n")
820{
d5d737a2
SP
821 const char *xpath =
822 "./set-action[action='frr-route-map:ipv4-next-hop']";
2b3e4807
RZ
823 char xpath_value[XPATH_MAXLEN];
824
825 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
826 snprintf(xpath_value, sizeof(xpath_value),
827 "%s/rmap-set-action/ipv4-address", xpath);
2b3e4807
RZ
828 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, addr_str);
829
830 return nb_cli_apply_changes(vty, NULL);
831}
832
ca77b518 833DEFPY_YANG(
2b3e4807
RZ
834 no_set_ip_nexthop, no_set_ip_nexthop_cmd,
835 "no set ip next-hop [A.B.C.D]",
836 NO_STR
837 SET_STR
838 IP_STR
839 "Next hop address\n"
840 "IP address of next hop\n")
841{
d5d737a2
SP
842 const char *xpath =
843 "./set-action[action='frr-route-map:ipv4-next-hop']";
2b3e4807
RZ
844
845 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
846
847 return nb_cli_apply_changes(vty, NULL);
848}
849
ca77b518 850DEFPY_YANG(
2b3e4807
RZ
851 set_ipv6_nexthop_local, set_ipv6_nexthop_local_cmd,
852 "set ipv6 next-hop local X:X::X:X$addr",
853 SET_STR
854 IPV6_STR
855 "IPv6 next-hop address\n"
856 "IPv6 local address\n"
857 "IPv6 address of next hop\n")
858{
d5d737a2
SP
859 const char *xpath =
860 "./set-action[action='frr-route-map:ipv6-next-hop']";
2b3e4807
RZ
861 char xpath_value[XPATH_MAXLEN];
862
863 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
864 snprintf(xpath_value, sizeof(xpath_value),
865 "%s/rmap-set-action/ipv6-address", xpath);
2b3e4807
RZ
866 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, addr_str);
867
868 return nb_cli_apply_changes(vty, NULL);
869}
870
ca77b518 871DEFPY_YANG(
2b3e4807
RZ
872 no_set_ipv6_nexthop_local, no_set_ipv6_nexthop_local_cmd,
873 "no set ipv6 next-hop local [X:X::X:X]",
874 NO_STR
875 SET_STR
876 IPV6_STR
877 "IPv6 next-hop address\n"
878 "IPv6 local address\n"
879 "IPv6 address of next hop\n")
880{
d5d737a2
SP
881 const char *xpath =
882 "./set-action[action='frr-route-map:ipv6-next-hop']";
2b3e4807
RZ
883
884 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
885
886 return nb_cli_apply_changes(vty, NULL);
887}
888
ca77b518 889DEFPY_YANG(
2b3e4807 890 set_metric, set_metric_cmd,
add39cde 891 "set metric <(-4294967295-4294967295)$metric|rtt$rtt|+rtt$artt|-rtt$srtt>",
2b3e4807
RZ
892 SET_STR
893 "Metric value for destination routing protocol\n"
add39cde 894 "Metric value (use +/- for additions or subtractions)\n"
2b3e4807
RZ
895 "Assign round trip time\n"
896 "Add round trip time\n"
add39cde 897 "Subtract round trip time\n")
2b3e4807 898{
d5d737a2 899 const char *xpath = "./set-action[action='frr-route-map:set-metric']";
2b3e4807
RZ
900 char xpath_value[XPATH_MAXLEN];
901 char value[64];
902
903 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
904 if (rtt) {
905 snprintf(xpath_value, sizeof(xpath_value),
d5d737a2 906 "%s/rmap-set-action/use-round-trip-time", xpath);
2b3e4807
RZ
907 snprintf(value, sizeof(value), "true");
908 } else if (artt) {
909 snprintf(xpath_value, sizeof(xpath_value),
d5d737a2 910 "%s/rmap-set-action/add-round-trip-time", xpath);
2b3e4807
RZ
911 snprintf(value, sizeof(value), "true");
912 } else if (srtt) {
913 snprintf(xpath_value, sizeof(xpath_value),
d5d737a2 914 "%s/rmap-set-action/subtract-round-trip-time", xpath);
2b3e4807 915 snprintf(value, sizeof(value), "true");
add39cde 916 } else if (metric_str && metric_str[0] == '+') {
d5d737a2
SP
917 snprintf(xpath_value, sizeof(xpath_value),
918 "%s/rmap-set-action/add-metric", xpath);
add39cde
RW
919 snprintf(value, sizeof(value), "%s", ++metric_str);
920 } else if (metric_str && metric_str[0] == '-') {
d5d737a2
SP
921 snprintf(xpath_value, sizeof(xpath_value),
922 "%s/rmap-set-action/subtract-metric", xpath);
add39cde 923 snprintf(value, sizeof(value), "%s", ++metric_str);
2b3e4807 924 } else {
d5d737a2
SP
925 snprintf(xpath_value, sizeof(xpath_value),
926 "%s/rmap-set-action/value", xpath);
add39cde 927 snprintf(value, sizeof(value), "%s", metric_str);
2b3e4807
RZ
928 }
929 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, value);
930
931 return nb_cli_apply_changes(vty, NULL);
932}
933
ca77b518 934DEFPY_YANG(
2b3e4807 935 no_set_metric, no_set_metric_cmd,
12488d7c 936 "no set metric [OPTVAL]",
2b3e4807
RZ
937 NO_STR
938 SET_STR
939 "Metric value for destination routing protocol\n"
940 "Metric value\n")
941{
d5d737a2 942 const char *xpath = "./set-action[action='frr-route-map:set-metric']";
2b3e4807
RZ
943
944 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
945 return nb_cli_apply_changes(vty, NULL);
946}
947
ca77b518 948DEFPY_YANG(
2b3e4807
RZ
949 set_tag, set_tag_cmd,
950 "set tag (1-4294967295)$tag",
951 SET_STR
952 "Tag value for routing protocol\n"
953 "Tag value\n")
954{
d5d737a2 955 const char *xpath = "./set-action[action='frr-route-map:set-tag']";
2b3e4807
RZ
956 char xpath_value[XPATH_MAXLEN];
957
958 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
d5d737a2
SP
959 snprintf(xpath_value, sizeof(xpath_value), "%s/rmap-set-action/tag",
960 xpath);
2b3e4807
RZ
961 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, tag_str);
962
963 return nb_cli_apply_changes(vty, NULL);
964}
965
ca77b518 966DEFPY_YANG(
2b3e4807
RZ
967 no_set_tag, no_set_tag_cmd,
968 "no set tag [(1-4294967295)]",
969 NO_STR
970 SET_STR
971 "Tag value for routing protocol\n"
972 "Tag value\n")
973{
d5d737a2
SP
974 const char *xpath = "./set-action[action='frr-route-map:set-tag']";
975
976 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
977
978 return nb_cli_apply_changes(vty, NULL);
979}
980
981DEFUN_YANG (set_srte_color,
982 set_srte_color_cmd,
983 "set sr-te color (1-4294967295)",
984 SET_STR
985 SRTE_STR
986 SRTE_COLOR_STR
987 "Color of the SR-TE Policies to match with\n")
988{
989 const char *xpath =
990 "./set-action[action='frr-route-map:set-sr-te-color']";
991 char xpath_value[XPATH_MAXLEN];
992 int idx = 0;
993
994 char *arg = argv_find(argv, argc, "(1-4294967295)", &idx)
995 ? argv[idx]->arg
996 : NULL;
997
998 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
999 snprintf(xpath_value, sizeof(xpath_value),
1000 "%s/rmap-set-action/policy", xpath);
1001 nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, arg);
1002
1003 return nb_cli_apply_changes(vty, NULL);
1004}
1005
1006DEFUN_YANG (no_set_srte_color,
1007 no_set_srte_color_cmd,
1008 "no set sr-te color [(1-4294967295)]",
1009 NO_STR
1010 SET_STR
1011 SRTE_STR
1012 SRTE_COLOR_STR
1013 "Color of the SR-TE Policies to match with\n")
1014{
1015 const char *xpath =
1016 "./set-action[action='frr-route-map:set-sr-te-color']";
2b3e4807
RZ
1017
1018 nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
1019
1020 return nb_cli_apply_changes(vty, NULL);
1021}
1022
d5d737a2 1023
2b3e4807
RZ
1024void route_map_action_show(struct vty *vty, struct lyd_node *dnode,
1025 bool show_defaults)
1026{
d5d737a2
SP
1027 const char *action = yang_dnode_get_string(dnode, "./action");
1028 struct lyd_node *ln;
1029 const char *acl;
2b3e4807 1030
d5d737a2 1031 if (IS_SET_IPv4_NH(action)) {
2b3e4807 1032 vty_out(vty, " set ip next-hop %s\n",
d5d737a2
SP
1033 yang_dnode_get_string(
1034 dnode, "./rmap-set-action/ipv4-address"));
1035 } else if (IS_SET_IPv6_NH(action)) {
2b3e4807 1036 vty_out(vty, " set ipv6 next-hop local %s\n",
d5d737a2
SP
1037 yang_dnode_get_string(
1038 dnode, "./rmap-set-action/ipv6-address"));
1039 } else if (IS_SET_METRIC(action)) {
1040 if (yang_dnode_get(dnode,
1041 "./rmap-set-action/use-round-trip-time")) {
2b3e4807 1042 vty_out(vty, " set metric rtt\n");
d5d737a2
SP
1043 } else if (yang_dnode_get(
1044 dnode,
1045 "./rmap-set-action/add-round-trip-time")) {
2b3e4807 1046 vty_out(vty, " set metric +rtt\n");
d5d737a2
SP
1047 } else if (
1048 yang_dnode_get(
1049 dnode,
1050 "./rmap-set-action/subtract-round-trip-time")) {
2b3e4807 1051 vty_out(vty, " set metric -rtt\n");
d5d737a2
SP
1052 } else if (yang_dnode_get(dnode,
1053 "./rmap-set-action/add-metric")) {
add39cde 1054 vty_out(vty, " set metric +%s\n",
d5d737a2
SP
1055 yang_dnode_get_string(
1056 dnode, "./rmap-set-action/add-metric"));
1057 } else if (yang_dnode_get(
1058 dnode,
1059 "./rmap-set-action/subtract-metric")) {
add39cde 1060 vty_out(vty, " set metric -%s\n",
d5d737a2
SP
1061 yang_dnode_get_string(
1062 dnode,
1063 "./rmap-set-action/subtract-metric"));
2b3e4807
RZ
1064 } else {
1065 vty_out(vty, " set metric %s\n",
d5d737a2
SP
1066 yang_dnode_get_string(
1067 dnode, "./rmap-set-action/value"));
2b3e4807 1068 }
d5d737a2 1069 } else if (IS_SET_TAG(action)) {
2b3e4807 1070 vty_out(vty, " set tag %s\n",
d5d737a2
SP
1071 yang_dnode_get_string(dnode, "./rmap-set-action/tag"));
1072 } else if (IS_SET_SR_TE_COLOR(action)) {
1073 vty_out(vty, " set sr-te color %s\n",
1074 yang_dnode_get_string(dnode,
1075 "./rmap-set-action/policy"));
1076 } else if (IS_SET_SRC(action)) {
1077 if (yang_dnode_exists(
1078 dnode,
1079 "./rmap-set-action/frr-zebra-route-map:ipv4-src-address"))
f42cc965 1080 vty_out(vty, " set src %s\n",
d5d737a2
SP
1081 yang_dnode_get_string(
1082 dnode,
1083 "./rmap-set-action/frr-zebra-route-map:ipv4-src-address"));
f42cc965
RZ
1084 else
1085 vty_out(vty, " set src %s\n",
d5d737a2
SP
1086 yang_dnode_get_string(
1087 dnode,
1088 "./rmap-set-action/frr-zebra-route-map:ipv6-src-address"));
1089 } else if (IS_SET_METRIC_TYPE(action)) {
1090 vty_out(vty, " set metric-type %s\n",
1091 yang_dnode_get_string(
1092 dnode,
1093 "./rmap-set-action/frr-ospf-route-map:metric-type"));
1094 } else if (IS_SET_FORWARDING_ADDR(action)) {
1095 vty_out(vty, " set forwarding-address %s\n",
1096 yang_dnode_get_string(
1097 dnode,
1098 "./rmap-set-action/frr-ospf6-route-map:ipv6-address"));
1099 } else if (IS_SET_WEIGHT(action)) {
1100 vty_out(vty, " set weight %s\n",
1101 yang_dnode_get_string(
1102 dnode,
1103 "./rmap-set-action/frr-bgp-route-map:weight"));
1104 } else if (IS_SET_TABLE(action)) {
1105 vty_out(vty, " set table %s\n",
1106 yang_dnode_get_string(
1107 dnode,
1108 "./rmap-set-action/frr-bgp-route-map:table"));
1109 } else if (IS_SET_LOCAL_PREF(action)) {
1110 vty_out(vty, " set local-preference %s\n",
1111 yang_dnode_get_string(
1112 dnode,
1113 "./rmap-set-action/frr-bgp-route-map:local-pref"));
1114 } else if (IS_SET_LABEL_INDEX(action)) {
1115 vty_out(vty, " set label-index %s\n",
1116 yang_dnode_get_string(
1117 dnode,
1118 "./rmap-set-action/frr-bgp-route-map:label-index"));
1119 } else if (IS_SET_DISTANCE(action)) {
1120 vty_out(vty, " set distance %s\n",
1121 yang_dnode_get_string(
1122 dnode,
1123 "./rmap-set-action/frr-bgp-route-map:distance"));
1124 } else if (IS_SET_ORIGIN(action)) {
1125 vty_out(vty, " set origin %s\n",
1126 yang_dnode_get_string(
1127 dnode,
1128 "./rmap-set-action/frr-bgp-route-map:origin"));
1129 } else if (IS_SET_ATOMIC_AGGREGATE(action)) {
1130 vty_out(vty, " set atomic-aggregate\n");
1131 } else if (IS_SET_ORIGINATOR_ID(action)) {
1132 vty_out(vty, " set originator-id %s\n",
1133 yang_dnode_get_string(
1134 dnode,
1135 "./rmap-set-action/frr-bgp-route-map:originator-id"));
1136 } else if (IS_SET_COMM_LIST_DEL(action)) {
1137 acl = NULL;
1138 if ((ln = yang_dnode_get(
1139 dnode,
1140 "./rmap-set-action/frr-bgp-route-map:comm-list-name"))
1141 != NULL)
1142 acl = yang_dnode_get_string(ln, NULL);
1143
1144 assert(acl);
1145
1146 vty_out(vty, " set comm-list %s delete\n", acl);
1147 } else if (IS_SET_LCOMM_LIST_DEL(action)) {
1148 acl = NULL;
1149 if ((ln = yang_dnode_get(
1150 dnode,
1151 "./rmap-set-action/frr-bgp-route-map:comm-list-name"))
1152 != NULL)
1153 acl = yang_dnode_get_string(ln, NULL);
1154
1155 assert(acl);
1156
1157 vty_out(vty, " set large-comm-list %s delete\n", acl);
1158 } else if (IS_SET_LCOMMUNITY(action)) {
1159 if (yang_dnode_exists(
1160 dnode,
1161 "./rmap-set-action/frr-bgp-route-map:large-community-string"))
1162 vty_out(vty, " set large-community %s\n",
1163 yang_dnode_get_string(
1164 dnode,
1165 "./rmap-set-action/frr-bgp-route-map:large-community-string"));
1166 else {
1167 if (true
1168 == yang_dnode_get_bool(
1169 dnode,
1170 "./rmap-set-action/frr-bgp-route-map:large-community-none"))
1171 vty_out(vty, " set large-community none\n");
1172 }
1173 } else if (IS_SET_COMMUNITY(action)) {
1174 if (yang_dnode_exists(
1175 dnode,
1176 "./rmap-set-action/frr-bgp-route-map:community-string"))
1177 vty_out(vty, " set community %s\n",
1178 yang_dnode_get_string(
1179 dnode,
1180 "./rmap-set-action/frr-bgp-route-map:community-string"));
1181 else {
1182 if (true
1183 == yang_dnode_get_bool(
1184 dnode,
1185 "./rmap-set-action/frr-bgp-route-map:community-none"))
1186 vty_out(vty, " set community none\n");
1187 }
1188 } else if (IS_SET_EXTCOMMUNITY_RT(action)) {
1189 vty_out(vty, " set extcommunity rt %s\n",
1190 yang_dnode_get_string(
1191 dnode,
1192 "./rmap-set-action/frr-bgp-route-map:extcommunity-rt"));
1193 } else if (IS_SET_EXTCOMMUNITY_SOO(action)) {
1194 vty_out(vty, " set extcommunity soo %s\n",
1195 yang_dnode_get_string(
1196 dnode,
1197 "./rmap-set-action/frr-bgp-route-map:extcommunity-soo"));
71bdae66
DA
1198 } else if (IS_SET_EXTCOMMUNITY_LB(action)) {
1199 enum ecommunity_lb_type lb_type;
1200 char str[VTY_BUFSIZ];
1201 uint16_t bandwidth;
1202
1203 lb_type = yang_dnode_get_enum(
1204 dnode,
1205 "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type");
1206 switch (lb_type) {
1207 case EXPLICIT_BANDWIDTH:
1208 bandwidth = yang_dnode_get_uint16(
1209 dnode,
1210 "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth");
1211 snprintf(str, sizeof(str), "%d", bandwidth);
1212 break;
1213 case CUMULATIVE_BANDWIDTH:
1214 snprintf(str, sizeof(str), "%s", "cumulative");
1215 break;
1216 case COMPUTED_BANDWIDTH:
1217 snprintf(str, sizeof(str), "%s", "num-multipaths");
1218 }
1219
1220 if (yang_dnode_get_bool(
1221 dnode,
1222 "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific"))
1223 strlcat(str, " non-transitive", sizeof(str));
1224
1225 vty_out(vty, " set extcommunity bandwidth %s\n", str);
d5d737a2
SP
1226 } else if (IS_SET_AGGREGATOR(action)) {
1227 vty_out(vty, " set aggregator as %s %s\n",
1228 yang_dnode_get_string(
1229 dnode,
1230 "./rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn"),
1231 yang_dnode_get_string(
1232 dnode,
1233 "./rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address"));
1234 } else if (IS_SET_AS_EXCLUDE(action)) {
1235 vty_out(vty, " set as-path exclude %s\n",
1236 yang_dnode_get_string(
1237 dnode,
1238 "./rmap-set-action/frr-bgp-route-map:exclude-as-path"));
1239 } else if (IS_SET_AS_PREPEND(action)) {
1240 if (yang_dnode_exists(
1241 dnode,
1242 "./rmap-set-action/frr-bgp-route-map:prepend-as-path"))
1243 vty_out(vty, " set as-path prepend %s\n",
1244 yang_dnode_get_string(
1245 dnode,
1246 "./rmap-set-action/frr-bgp-route-map:prepend-as-path"));
1247 else {
1248 vty_out(vty, " set as-path prepend last-as %u\n",
1249 yang_dnode_get_uint8(
1250 dnode,
1251 "./rmap-set-action/frr-bgp-route-map:last-as"));
1252 }
1253 } else if (IS_SET_IPV6_NH_GLOBAL(action)) {
1254 vty_out(vty, " set ipv6 next-hop global %s\n",
1255 yang_dnode_get_string(
1256 dnode,
1257 "./rmap-set-action/frr-bgp-route-map:ipv6-address"));
1258 } else if (IS_SET_IPV6_VPN_NH(action)) {
1259 vty_out(vty, " set ipv6 vpn next-hop %s\n",
1260 yang_dnode_get_string(
1261 dnode,
1262 "./rmap-set-action/frr-bgp-route-map:ipv6-address"));
1263 } else if (IS_SET_IPV6_PEER_ADDR(action)) {
1264 if (true
1265 == yang_dnode_get_bool(
1266 dnode,
1267 "./rmap-set-action/frr-bgp-route-map:preference"))
1268 vty_out(vty, " set ipv6 next-hop peer-address\n");
1269 } else if (IS_SET_IPV6_PREFER_GLOBAL(action)) {
1270 if (true
1271 == yang_dnode_get_bool(
1272 dnode,
1273 "./rmap-set-action/frr-bgp-route-map:preference"))
1274 vty_out(vty, " set ipv6 next-hop prefer-global\n");
1275 } else if (IS_SET_IPV4_VPN_NH(action)) {
1276 vty_out(vty, " set ipv4 vpn next-hop %s\n",
1277 yang_dnode_get_string(
1278 dnode,
1279 "./rmap-set-action/frr-bgp-route-map:ipv4-address"));
1280 } else if (IS_SET_BGP_IPV4_NH(action)) {
1281 vty_out(vty, " set ip next-hop %s\n",
1282 yang_dnode_get_string(
1283 dnode,
1284 "./rmap-set-action/frr-bgp-route-map:ipv4-nexthop"));
d0a4ee60
AD
1285 } else if (IS_SET_BGP_EVPN_GATEWAY_IP_IPV4(action)) {
1286 vty_out(vty, " set evpn gateway-ip ipv4 %s\n",
1287 yang_dnode_get_string(
1288 dnode,
1289 "./rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv4"));
1290 } else if (IS_SET_BGP_EVPN_GATEWAY_IP_IPV6(action)) {
1291 vty_out(vty, " set evpn gateway-ip ipv6 %s\n",
1292 yang_dnode_get_string(
1293 dnode,
1294 "./rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv6"));
2b3e4807
RZ
1295 }
1296}
1297
ca77b518 1298DEFPY_YANG(
2b3e4807
RZ
1299 rmap_onmatch_next, rmap_onmatch_next_cmd,
1300 "on-match next",
1301 "Exit policy on matches\n"
1302 "Next clause\n")
1303{
1304 nb_cli_enqueue_change(vty, "./exit-policy", NB_OP_MODIFY, "next");
1305
1306 return nb_cli_apply_changes(vty, NULL);
1307}
1308
ca77b518 1309DEFPY_YANG(
2b3e4807
RZ
1310 no_rmap_onmatch_next,
1311 no_rmap_onmatch_next_cmd,
1312 "no on-match next",
1313 NO_STR
1314 "Exit policy on matches\n"
1315 "Next clause\n")
1316{
1317 nb_cli_enqueue_change(vty, "./exit-policy", NB_OP_DESTROY, NULL);
1318
1319 return nb_cli_apply_changes(vty, NULL);
1320}
1321
ca77b518 1322DEFPY_YANG(
2b3e4807
RZ
1323 rmap_onmatch_goto, rmap_onmatch_goto_cmd,
1324 "on-match goto (1-65535)$rm_num",
1325 "Exit policy on matches\n"
1326 "Goto Clause number\n"
1327 "Number\n")
1328{
1329 nb_cli_enqueue_change(vty, "./exit-policy", NB_OP_MODIFY, "goto");
1330 nb_cli_enqueue_change(vty, "./goto-value", NB_OP_MODIFY, rm_num_str);
1331
1332 return nb_cli_apply_changes(vty, NULL);
1333}
1334
ca77b518 1335DEFPY_YANG(
2b3e4807
RZ
1336 no_rmap_onmatch_goto, no_rmap_onmatch_goto_cmd,
1337 "no on-match goto",
1338 NO_STR
1339 "Exit policy on matches\n"
1340 "Goto Clause number\n")
1341{
1342 nb_cli_enqueue_change(vty, "./exit-policy", NB_OP_DESTROY, NULL);
1343
1344 return nb_cli_apply_changes(vty, NULL);
1345}
1346
1347/* Cisco/GNU Zebra compatibility aliases */
ca77b518 1348ALIAS_YANG(
2b3e4807
RZ
1349 rmap_onmatch_goto, rmap_continue_cmd,
1350 "continue (1-65535)$rm_num",
1351 "Continue on a different entry within the route-map\n"
1352 "Route-map entry sequence number\n")
1353
ca77b518 1354ALIAS_YANG(
2b3e4807
RZ
1355 no_rmap_onmatch_goto, no_rmap_continue_cmd,
1356 "no continue [(1-65535)]",
1357 NO_STR
1358 "Continue on a different entry within the route-map\n"
1359 "Route-map entry sequence number\n")
1360
1361void route_map_exit_policy_show(struct vty *vty, struct lyd_node *dnode,
1362 bool show_defaults)
1363{
1364 int exit_policy = yang_dnode_get_enum(dnode, NULL);
1365
1366 switch (exit_policy) {
1367 case 0: /* permit-or-deny */
1368 /* NOTHING: default option. */
1369 break;
1370 case 1: /* next */
1371 vty_out(vty, " on-match next\n");
1372 break;
1373 case 2: /* goto */
1374 vty_out(vty, " on-match goto %s\n",
1375 yang_dnode_get_string(dnode, "../goto-value"));
1376 break;
1377 }
1378}
1379
ca77b518 1380DEFPY_YANG(
2b3e4807
RZ
1381 rmap_call, rmap_call_cmd,
1382 "call WORD$name",
1383 "Jump to another Route-Map after match+set\n"
1384 "Target route-map name\n")
1385{
1386 nb_cli_enqueue_change(vty, "./call", NB_OP_MODIFY, name);
1387
1388 return nb_cli_apply_changes(vty, NULL);
1389}
1390
ca77b518 1391DEFPY_YANG(
2b3e4807 1392 no_rmap_call, no_rmap_call_cmd,
680b9b62 1393 "no call [NAME]",
2b3e4807 1394 NO_STR
20684537
RZ
1395 "Jump to another Route-Map after match+set\n"
1396 "Target route-map name\n")
2b3e4807
RZ
1397{
1398 nb_cli_enqueue_change(vty, "./call", NB_OP_DESTROY, NULL);
1399
1400 return nb_cli_apply_changes(vty, NULL);
1401}
1402
1403void route_map_call_show(struct vty *vty, struct lyd_node *dnode,
1404 bool show_defaults)
1405{
1406 vty_out(vty, " call %s\n", yang_dnode_get_string(dnode, NULL));
1407}
1408
ca77b518 1409DEFPY_YANG(
2b3e4807
RZ
1410 rmap_description, rmap_description_cmd,
1411 "description LINE...",
1412 "Route-map comment\n"
1413 "Comment describing this route-map rule\n")
1414{
1415 char *desc;
1416 int rv;
1417
1418 desc = argv_concat(argv, argc, 1);
1419 nb_cli_enqueue_change(vty, "./description", NB_OP_MODIFY, desc);
1420 rv = nb_cli_apply_changes(vty, NULL);
1421 XFREE(MTYPE_TMP, desc);
1422
1423 return rv;
1424}
1425
ca77b518 1426DEFUN_YANG (no_rmap_description,
2b3e4807
RZ
1427 no_rmap_description_cmd,
1428 "no description",
1429 NO_STR
1430 "Route-map comment\n")
1431{
1432 nb_cli_enqueue_change(vty, "./description", NB_OP_DESTROY, NULL);
1433
1434 return nb_cli_apply_changes(vty, NULL);
1435}
1436
1437void route_map_description_show(struct vty *vty, struct lyd_node *dnode,
1438 bool show_defaults)
1439{
1440 vty_out(vty, " description %s\n", yang_dnode_get_string(dnode, NULL));
1441}
1442
38133c4a
IR
1443DEFPY_YANG(
1444 route_map_optimization, route_map_optimization_cmd,
1445 "[no] route-map WORD$name optimization",
1446 NO_STR
1447 ROUTE_MAP_CMD_STR
1448 "Configure route-map optimization\n")
1449{
1450 char xpath[XPATH_MAXLEN];
1451
1452 snprintf(xpath, sizeof(xpath),
1453 "/frr-route-map:lib/route-map[name='%s']", name);
1454 nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
1455
1456 snprintf(
1457 xpath, sizeof(xpath),
1458 "/frr-route-map:lib/route-map[name='%s']/optimization-disabled",
1459 name);
1460 nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, no ? "true" : "false");
1461
1462 return nb_cli_apply_changes(vty, NULL);
1463}
1464
1465void route_map_optimization_disabled_show(struct vty *vty,
1466 struct lyd_node *dnode,
1467 bool show_defaults)
1468{
1469 const char *name = yang_dnode_get_string(dnode, "../name");
1470 const bool disabled = yang_dnode_get_bool(dnode, NULL);
1471
1472 vty_out(vty, "%sroute-map %s optimization\n", disabled ? "no " : "",
1473 name);
1474}
1475
1476#if CONFDATE > 20220409
1477CPP_NOTICE("Time to remove old route-map optimization command")
1478#endif
1479
1480DEFPY_HIDDEN(
1481 routemap_optimization, routemap_optimization_cmd,
1482 "[no] route-map optimization",
1483 NO_STR
1484 "route-map\n"
1485 "optimization\n")
3ebeec94
IR
1486{
1487 const struct lyd_node *rmi_dnode;
1488 const char *rm_name;
1489 char xpath[XPATH_MAXLEN];
1490
38133c4a
IR
1491 vty_out(vty,
1492 "%% This command is deprecated. Please, use `route-map NAME optimization` from the config node.\n");
1493
3ebeec94
IR
1494 rmi_dnode =
1495 yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
1496 if (!rmi_dnode) {
1497 vty_out(vty, "%% Failed to get RMI dnode in candidate DB\n");
1498 return CMD_WARNING_CONFIG_FAILED;
1499 }
1500
1501 rm_name = yang_dnode_get_string(rmi_dnode, "../name");
1502
1503 snprintf(
1504 xpath, sizeof(xpath),
1505 "/frr-route-map:lib/route-map[name='%s']/optimization-disabled",
1506 rm_name);
1507 nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, no ? "true" : "false");
1508 return nb_cli_apply_changes(vty, NULL);
1509}
1510
2b3e4807
RZ
1511static int route_map_config_write(struct vty *vty)
1512{
1513 struct lyd_node *dnode;
1514 int written = 0;
1515
1516 dnode = yang_dnode_get(running_config->dnode,
1517 "/frr-route-map:lib");
1518 if (dnode) {
1519 nb_cli_show_dnode_cmds(vty, dnode, false);
1520 written = 1;
1521 }
1522
1523 return written;
1524}
1525
1526/* Route map node structure. */
612c2c15 1527static int route_map_config_write(struct vty *vty);
62b346ee 1528static struct cmd_node rmap_node = {
f4b8291f 1529 .name = "routemap",
62b346ee 1530 .node = RMAP_NODE,
24389580 1531 .parent_node = CONFIG_NODE,
62b346ee 1532 .prompt = "%s(config-route-map)# ",
612c2c15 1533 .config_write = route_map_config_write,
62b346ee 1534};
2b3e4807
RZ
1535
1536static void rmap_autocomplete(vector comps, struct cmd_token *token)
1537{
1538 struct route_map *map;
1539
1540 for (map = route_map_master.head; map; map = map->next)
1541 vector_set(comps, XSTRDUP(MTYPE_COMPLETION, map->name));
1542}
1543
1544static const struct cmd_variable_handler rmap_var_handlers[] = {
1545 {.varname = "route_map", .completions = rmap_autocomplete},
1546 {.tokenname = "ROUTEMAP_NAME", .completions = rmap_autocomplete},
1547 {.tokenname = "RMAP_NAME", .completions = rmap_autocomplete},
1548 {.completions = NULL}
1549};
1550
1551void route_map_cli_init(void)
1552{
1553 /* Auto complete handler. */
1554 cmd_variable_handler_register(rmap_var_handlers);
1555
1556 /* CLI commands. */
612c2c15 1557 install_node(&rmap_node);
2b3e4807
RZ
1558 install_default(RMAP_NODE);
1559 install_element(CONFIG_NODE, &route_map_cmd);
1560 install_element(CONFIG_NODE, &no_route_map_cmd);
1561 install_element(CONFIG_NODE, &no_route_map_all_cmd);
38133c4a 1562 install_element(CONFIG_NODE, &route_map_optimization_cmd);
2b3e4807
RZ
1563
1564 /* Install the on-match stuff */
2b3e4807
RZ
1565 install_element(RMAP_NODE, &rmap_onmatch_next_cmd);
1566 install_element(RMAP_NODE, &no_rmap_onmatch_next_cmd);
1567 install_element(RMAP_NODE, &rmap_onmatch_goto_cmd);
1568 install_element(RMAP_NODE, &no_rmap_onmatch_goto_cmd);
1569 install_element(RMAP_NODE, &rmap_continue_cmd);
1570 install_element(RMAP_NODE, &no_rmap_continue_cmd);
1571
1572 /* Install the call stuff. */
1573 install_element(RMAP_NODE, &rmap_call_cmd);
1574 install_element(RMAP_NODE, &no_rmap_call_cmd);
1575
1576 /* Install description commands. */
1577 install_element(RMAP_NODE, &rmap_description_cmd);
1578 install_element(RMAP_NODE, &no_rmap_description_cmd);
1579
1580 /* Install 'match' commands. */
1581 install_element(RMAP_NODE, &match_interface_cmd);
1582 install_element(RMAP_NODE, &no_match_interface_cmd);
1583
1584 install_element(RMAP_NODE, &match_ip_address_cmd);
1585 install_element(RMAP_NODE, &no_match_ip_address_cmd);
1586
1587 install_element(RMAP_NODE, &match_ip_address_prefix_list_cmd);
1588 install_element(RMAP_NODE, &no_match_ip_address_prefix_list_cmd);
1589
1590 install_element(RMAP_NODE, &match_ip_next_hop_cmd);
1591 install_element(RMAP_NODE, &no_match_ip_next_hop_cmd);
1592
1593 install_element(RMAP_NODE, &match_ip_next_hop_prefix_list_cmd);
1594 install_element(RMAP_NODE, &no_match_ip_next_hop_prefix_list_cmd);
1595
1596 install_element(RMAP_NODE, &match_ip_next_hop_type_cmd);
1597 install_element(RMAP_NODE, &no_match_ip_next_hop_type_cmd);
1598
1599 install_element(RMAP_NODE, &match_ipv6_address_cmd);
1600 install_element(RMAP_NODE, &no_match_ipv6_address_cmd);
1601
1602 install_element(RMAP_NODE, &match_ipv6_address_prefix_list_cmd);
1603 install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd);
1604
1605 install_element(RMAP_NODE, &match_ipv6_next_hop_type_cmd);
1606 install_element(RMAP_NODE, &no_match_ipv6_next_hop_type_cmd);
1607
1608 install_element(RMAP_NODE, &match_metric_cmd);
1609 install_element(RMAP_NODE, &no_match_metric_cmd);
1610
1611 install_element(RMAP_NODE, &match_tag_cmd);
1612 install_element(RMAP_NODE, &no_match_tag_cmd);
1613
1614 /* Install 'set' commands. */
1615 install_element(RMAP_NODE, &set_ip_nexthop_cmd);
1616 install_element(RMAP_NODE, &no_set_ip_nexthop_cmd);
1617
1618 install_element(RMAP_NODE, &set_ipv6_nexthop_local_cmd);
1619 install_element(RMAP_NODE, &no_set_ipv6_nexthop_local_cmd);
1620
1621 install_element(RMAP_NODE, &set_metric_cmd);
1622 install_element(RMAP_NODE, &no_set_metric_cmd);
1623
1624 install_element(RMAP_NODE, &set_tag_cmd);
1625 install_element(RMAP_NODE, &no_set_tag_cmd);
d5d737a2
SP
1626
1627 install_element(RMAP_NODE, &set_srte_color_cmd);
1628 install_element(RMAP_NODE, &no_set_srte_color_cmd);
3ebeec94
IR
1629
1630 install_element(RMAP_NODE, &routemap_optimization_cmd);
2b3e4807 1631}