3 * Copyright (C) Cumulus Networks, Inc.
6 * This file is part of FRR.
8 * FRR is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * FRR is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include "nexthop_group.h"
32 #include "link_state.h"
34 #include "sharpd/sharp_globals.h"
35 #include "sharpd/sharp_zebra.h"
36 #include "sharpd/sharp_nht.h"
37 #include "sharpd/sharp_vty.h"
38 #ifndef VTYSH_EXTRACT_PL
39 #include "sharpd/sharp_vty_clippy.c"
42 DEFPY(watch_redistribute
, watch_redistribute_cmd
,
43 "sharp watch [vrf NAME$vrf_name] redistribute " FRR_REDIST_STR_SHARPD
,
44 "Sharp routing Protocol\n"
46 "The vrf we would like to watch if non-default\n"
47 "The NAME of the vrf\n"
48 "Redistribute into Sharp\n"
49 FRR_REDIST_HELP_STR_SHARPD
)
55 vrf_name
= VRF_DEFAULT_NAME
;
56 vrf
= vrf_lookup_by_name(vrf_name
);
58 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
63 source
= proto_redistnum(AFI_IP
, argv
[argc
-1]->text
);
64 sharp_redistribute_vrf(vrf
, source
);
69 DEFPY(watch_nexthop_v6
, watch_nexthop_v6_cmd
,
70 "sharp watch [vrf NAME$vrf_name] <nexthop$n X:X::X:X$nhop|import$import X:X::X:X/M$inhop> [connected$connected]",
71 "Sharp routing Protocol\n"
73 "The vrf we would like to watch if non-default\n"
74 "The NAME of the vrf\n"
75 "Watch for nexthop changes\n"
76 "The v6 nexthop to signal for watching\n"
77 "Watch for import check changes\n"
78 "The v6 prefix to signal for watching\n"
79 "Should the route be connected\n")
86 vrf_name
= VRF_DEFAULT_NAME
;
87 vrf
= vrf_lookup_by_name(vrf_name
);
89 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
94 memset(&p
, 0, sizeof(p
));
99 memcpy(&p
.u
.prefix6
, &nhop
, 16);
103 p
= *(const struct prefix
*)inhop
;
106 sharp_nh_tracker_get(&p
);
107 sharp_zebra_nexthop_watch(&p
, vrf
->vrf_id
, type_import
,
113 DEFPY(watch_nexthop_v4
, watch_nexthop_v4_cmd
,
114 "sharp watch [vrf NAME$vrf_name] <nexthop$n A.B.C.D$nhop|import$import A.B.C.D/M$inhop> [connected$connected]",
115 "Sharp routing Protocol\n"
116 "Watch for changes\n"
117 "The vrf we would like to watch if non-default\n"
118 "The NAME of the vrf\n"
119 "Watch for nexthop changes\n"
120 "The v4 address to signal for watching\n"
121 "Watch for import check changes\n"
122 "The v4 prefix for import check to watch\n"
123 "Should the route be connected\n")
130 vrf_name
= VRF_DEFAULT_NAME
;
131 vrf
= vrf_lookup_by_name(vrf_name
);
133 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
138 memset(&p
, 0, sizeof(p
));
148 p
= *(const struct prefix
*)inhop
;
151 sharp_nh_tracker_get(&p
);
152 sharp_zebra_nexthop_watch(&p
, vrf
->vrf_id
, type_import
,
158 DEFPY(sharp_nht_data_dump
,
159 sharp_nht_data_dump_cmd
,
160 "sharp data nexthop",
161 "Sharp routing Protocol\n"
162 "Data about what is going on\n"
163 "Nexthop information\n")
165 sharp_nh_tracker_dump(vty
);
170 DEFPY (install_routes_data_dump
,
171 install_routes_data_dump_cmd
,
173 "Sharp routing Protocol\n"
174 "Data about what is going on\n"
175 "Route Install/Removal Information\n")
179 timersub(&sg
.r
.t_end
, &sg
.r
.t_start
, &r
);
180 vty_out(vty
, "Prefix: %pFX Total: %u %u %u Time: %jd.%ld\n",
181 &sg
.r
.orig_prefix
, sg
.r
.total_routes
, sg
.r
.installed_routes
,
182 sg
.r
.removed_routes
, (intmax_t)r
.tv_sec
, (long)r
.tv_usec
);
187 DEFPY (install_routes
,
189 "sharp install routes [vrf NAME$vrf_name]\
190 <A.B.C.D$start4|X:X::X:X$start6>\
191 <nexthop <A.B.C.D$nexthop4|X:X::X:X$nexthop6>|\
192 nexthop-group NHGNAME$nexthop_group>\
193 [backup$backup <A.B.C.D$backup_nexthop4|X:X::X:X$backup_nexthop6>] \
194 (1-1000000)$routes [instance (0-255)$instance] [repeat (2-1000)$rpt] [opaque WORD]",
195 "Sharp routing Protocol\n"
196 "install some routes\n"
197 "Routes to install\n"
198 "The vrf we would like to install into if non-default\n"
199 "The NAME of the vrf\n"
200 "v4 Address to start /32 generation at\n"
201 "v6 Address to start /32 generation at\n"
202 "Nexthop to use(Can be an IPv4 or IPv6 address)\n"
203 "V4 Nexthop address to use\n"
204 "V6 Nexthop address to use\n"
205 "Nexthop-Group to use\n"
206 "The Name of the nexthop-group\n"
207 "Backup nexthop to use(Can be an IPv4 or IPv6 address)\n"
208 "Backup V4 Nexthop address to use\n"
209 "Backup V6 Nexthop address to use\n"
210 "How many to create\n"
213 "Should we repeat this command\n"
214 "How many times to repeat this command\n"
215 "What opaque data to send down\n"
219 struct prefix prefix
;
223 sg
.r
.total_routes
= routes
;
224 sg
.r
.installed_routes
= 0;
227 sg
.r
.repeat
= rpt
* 2;
231 memset(&prefix
, 0, sizeof(prefix
));
232 memset(&sg
.r
.orig_prefix
, 0, sizeof(sg
.r
.orig_prefix
));
233 memset(&sg
.r
.nhop
, 0, sizeof(sg
.r
.nhop
));
234 memset(&sg
.r
.nhop_group
, 0, sizeof(sg
.r
.nhop_group
));
235 memset(&sg
.r
.backup_nhop
, 0, sizeof(sg
.r
.nhop
));
236 memset(&sg
.r
.backup_nhop_group
, 0, sizeof(sg
.r
.nhop_group
));
238 if (start4
.s_addr
!= INADDR_ANY
) {
239 prefix
.family
= AF_INET
;
240 prefix
.prefixlen
= 32;
241 prefix
.u
.prefix4
= start4
;
243 prefix
.family
= AF_INET6
;
244 prefix
.prefixlen
= 128;
245 prefix
.u
.prefix6
= start6
;
247 sg
.r
.orig_prefix
= prefix
;
250 vrf_name
= VRF_DEFAULT_NAME
;
252 vrf
= vrf_lookup_by_name(vrf_name
);
254 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
259 /* Explicit backup not available with named nexthop-group */
260 if (backup
&& nexthop_group
) {
261 vty_out(vty
, "%% Invalid: cannot specify both nexthop-group and backup\n");
266 struct nexthop_group_cmd
*nhgc
= nhgc_find(nexthop_group
);
269 "Specified Nexthop Group: %s does not exist\n",
274 nhgid
= sharp_nhgroup_get_id(nexthop_group
);
276 sg
.r
.nhop_group
.nexthop
= nhgc
->nhg
.nexthop
;
278 /* Use group's backup nexthop info if present */
279 if (nhgc
->backup_list_name
[0]) {
280 struct nexthop_group_cmd
*bnhgc
=
281 nhgc_find(nhgc
->backup_list_name
);
284 vty_out(vty
, "%% Backup group %s not found for group %s\n",
285 nhgc
->backup_list_name
,
290 sg
.r
.backup_nhop
.vrf_id
= vrf
->vrf_id
;
291 sg
.r
.backup_nhop_group
.nexthop
= bnhgc
->nhg
.nexthop
;
294 if (nexthop4
.s_addr
!= INADDR_ANY
) {
295 sg
.r
.nhop
.gate
.ipv4
= nexthop4
;
296 sg
.r
.nhop
.type
= NEXTHOP_TYPE_IPV4
;
298 sg
.r
.nhop
.gate
.ipv6
= nexthop6
;
299 sg
.r
.nhop
.type
= NEXTHOP_TYPE_IPV6
;
302 sg
.r
.nhop
.vrf_id
= vrf
->vrf_id
;
303 sg
.r
.nhop_group
.nexthop
= &sg
.r
.nhop
;
306 /* Use single backup nexthop if specified */
308 /* Set flag and index in primary nexthop */
309 SET_FLAG(sg
.r
.nhop
.flags
, NEXTHOP_FLAG_HAS_BACKUP
);
310 sg
.r
.nhop
.backup_num
= 1;
311 sg
.r
.nhop
.backup_idx
[0] = 0;
313 if (backup_nexthop4
.s_addr
!= INADDR_ANY
) {
314 sg
.r
.backup_nhop
.gate
.ipv4
= backup_nexthop4
;
315 sg
.r
.backup_nhop
.type
= NEXTHOP_TYPE_IPV4
;
317 sg
.r
.backup_nhop
.gate
.ipv6
= backup_nexthop6
;
318 sg
.r
.backup_nhop
.type
= NEXTHOP_TYPE_IPV6
;
321 sg
.r
.backup_nhop
.vrf_id
= vrf
->vrf_id
;
322 sg
.r
.backup_nhop_group
.nexthop
= &sg
.r
.backup_nhop
;
326 strlcpy(sg
.r
.opaque
, opaque
, ZAPI_MESSAGE_OPAQUE_LENGTH
);
328 sg
.r
.opaque
[0] = '\0';
330 sg
.r
.inst
= instance
;
331 sg
.r
.vrf_id
= vrf
->vrf_id
;
333 sharp_install_routes_helper(&prefix
, sg
.r
.vrf_id
, sg
.r
.inst
, nhgid
,
334 &sg
.r
.nhop_group
, &sg
.r
.backup_nhop_group
,
340 DEFPY(vrf_label
, vrf_label_cmd
,
341 "sharp label <ip$ipv4|ipv6$ipv6> vrf NAME$vrf_name label (0-100000)$label",
342 "Sharp Routing Protocol\n"
343 "Give a vrf a label\n"
344 "Pop and forward for IPv4\n"
345 "Pop and forward for IPv6\n"
347 "The label to use, 0 specifies remove the label installed from previous\n"
348 "Specified range to use\n")
351 afi_t afi
= (ipv4
) ? AFI_IP
: AFI_IP6
;
353 if (strcmp(vrf_name
, "default") == 0)
354 vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
356 vrf
= vrf_lookup_by_name(vrf_name
);
359 vty_out(vty
, "Unable to find vrf you silly head");
360 return CMD_WARNING_CONFIG_FAILED
;
364 label
= MPLS_LABEL_NONE
;
366 vrf_label_add(vrf
->vrf_id
, afi
, label
);
370 DEFPY (remove_routes
,
372 "sharp remove routes [vrf NAME$vrf_name] <A.B.C.D$start4|X:X::X:X$start6> (1-1000000)$routes [instance (0-255)$instance]",
373 "Sharp Routing Protocol\n"
374 "Remove some routes\n"
376 "The vrf we would like to remove from if non-default\n"
377 "The NAME of the vrf\n"
380 "Routes to uninstall\n"
382 "Value of instance\n")
385 struct prefix prefix
;
387 sg
.r
.total_routes
= routes
;
388 sg
.r
.removed_routes
= 0;
391 memset(&prefix
, 0, sizeof(prefix
));
393 if (start4
.s_addr
!= INADDR_ANY
) {
394 prefix
.family
= AF_INET
;
395 prefix
.prefixlen
= 32;
396 prefix
.u
.prefix4
= start4
;
398 prefix
.family
= AF_INET6
;
399 prefix
.prefixlen
= 128;
400 prefix
.u
.prefix6
= start6
;
403 vrf
= vrf_lookup_by_name(vrf_name
? vrf_name
: VRF_DEFAULT_NAME
);
405 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
406 vrf_name
? vrf_name
: VRF_DEFAULT_NAME
);
410 sg
.r
.inst
= instance
;
411 sg
.r
.vrf_id
= vrf
->vrf_id
;
413 sharp_remove_routes_helper(&prefix
, sg
.r
.vrf_id
,
419 DEFUN_NOSH (show_debugging_sharpd
,
420 show_debugging_sharpd_cmd
,
421 "show debugging [sharp]",
424 "Sharp Information\n")
426 vty_out(vty
, "Sharp debugging status:\n");
431 DEFPY (sharp_lsp_prefix_v4
, sharp_lsp_prefix_v4_cmd
,
432 "sharp lsp [update]$update (0-100000)$inlabel\
433 nexthop-group NHGNAME$nhgname\
434 [prefix A.B.C.D/M$pfx\
435 " FRR_IP_REDIST_STR_ZEBRA
"$type_str [instance (0-255)$instance]]",
436 "Sharp Routing Protocol\n"
439 "The ingress label to use\n"
440 "Use nexthops from a nexthop-group\n"
441 "The nexthop-group name\n"
443 "The v4 prefix to label\n"
444 FRR_IP_REDIST_HELP_STR_ZEBRA
448 struct nexthop_group_cmd
*nhgc
= NULL
;
449 struct nexthop_group_cmd
*backup_nhgc
= NULL
;
450 struct nexthop_group
*backup_nhg
= NULL
;
451 struct prefix p
= {};
455 update_p
= (update
!= NULL
);
457 /* We're offered a v4 prefix */
458 if (pfx
->family
> 0 && type_str
) {
459 p
.family
= pfx
->family
;
460 p
.prefixlen
= pfx
->prefixlen
;
461 p
.u
.prefix4
= pfx
->prefix
;
463 type
= proto_redistnum(AFI_IP
, type_str
);
465 vty_out(vty
, "%% Unknown route type '%s'\n", type_str
);
468 } else if (pfx
->family
> 0 || type_str
) {
469 vty_out(vty
, "%% Must supply both prefix and type\n");
473 nhgc
= nhgc_find(nhgname
);
475 vty_out(vty
, "%% Nexthop-group '%s' does not exist\n",
480 if (nhgc
->nhg
.nexthop
== NULL
) {
481 vty_out(vty
, "%% Nexthop-group '%s' is empty\n", nhgname
);
485 /* Use group's backup nexthop info if present */
486 if (nhgc
->backup_list_name
[0]) {
487 backup_nhgc
= nhgc_find(nhgc
->backup_list_name
);
491 "%% Backup group %s not found for group %s\n",
492 nhgc
->backup_list_name
,
496 backup_nhg
= &(backup_nhgc
->nhg
);
499 if (sharp_install_lsps_helper(true /*install*/, update_p
,
500 pfx
->family
> 0 ? &p
: NULL
,
501 type
, instance
, inlabel
,
502 &(nhgc
->nhg
), backup_nhg
) == 0)
505 vty_out(vty
, "%% LSP install failed!\n");
510 DEFPY(sharp_remove_lsp_prefix_v4
, sharp_remove_lsp_prefix_v4_cmd
,
513 [nexthop-group NHGNAME$nhgname] \
514 [prefix A.B.C.D/M$pfx\
515 " FRR_IP_REDIST_STR_ZEBRA
"$type_str [instance (0-255)$instance]]",
516 "Sharp Routing Protocol\n"
519 "The ingress label\n"
520 "Use nexthops from a nexthop-group\n"
521 "The nexthop-group name\n"
522 "Specify a v4 prefix\n"
523 "The v4 prefix to label\n"
524 FRR_IP_REDIST_HELP_STR_ZEBRA
528 struct nexthop_group_cmd
*nhgc
= NULL
;
529 struct prefix p
= {};
531 struct nexthop_group
*nhg
= NULL
;
533 /* We're offered a v4 prefix */
534 if (pfx
->family
> 0 && type_str
) {
535 p
.family
= pfx
->family
;
536 p
.prefixlen
= pfx
->prefixlen
;
537 p
.u
.prefix4
= pfx
->prefix
;
539 type
= proto_redistnum(AFI_IP
, type_str
);
541 vty_out(vty
, "%% Unknown route type '%s'\n", type_str
);
544 } else if (pfx
->family
> 0 || type_str
) {
545 vty_out(vty
, "%% Must supply both prefix and type\n");
550 nhgc
= nhgc_find(nhgname
);
552 vty_out(vty
, "%% Nexthop-group '%s' does not exist\n",
557 if (nhgc
->nhg
.nexthop
== NULL
) {
558 vty_out(vty
, "%% Nexthop-group '%s' is empty\n",
565 if (sharp_install_lsps_helper(false /*!install*/, false,
566 pfx
->family
> 0 ? &p
: NULL
,
567 type
, instance
, inlabel
, nhg
, NULL
) == 0)
570 vty_out(vty
, "%% LSP remove failed!\n");
577 "sharp logpump duration (1-60) frequency (1-1000000) burst (1-1000)",
578 "Sharp Routing Protocol\n"
579 "Generate bulk log messages for testing\n"
580 "Duration of run (s)\n"
581 "Duration of run (s)\n"
582 "Frequency of bursts (s^-1)\n"
583 "Frequency of bursts (s^-1)\n"
584 "Number of log messages per each burst\n"
585 "Number of log messages per each burst\n")
587 sharp_logpump_run(vty
, duration
, frequency
, burst
);
591 DEFPY (create_session
,
593 "sharp create session (1-1024)",
594 "Sharp Routing Protocol\n"
596 "Create a test session\n"
599 if (sharp_zclient_create(session
) != 0) {
600 vty_out(vty
, "%% Client session error\n");
607 DEFPY (remove_session
,
609 "sharp remove session (1-1024)",
610 "Sharp Routing Protocol\n"
612 "Remove a test session\n"
615 sharp_zclient_delete(session
);
621 "sharp send opaque type (1-255) (1-1000)$count",
623 "Send messages for testing\n"
624 "Send opaque messages\n"
625 "Type code to send\n"
626 "Type code to send\n"
627 "Number of messages to send\n")
629 sharp_opaque_send(type
, 0, 0, 0, count
);
633 DEFPY (send_opaque_unicast
,
634 send_opaque_unicast_cmd
,
635 "sharp send opaque unicast type (1-255) \
636 " FRR_IP_REDIST_STR_ZEBRA
"$proto_str \
637 [{instance (0-1000) | session (1-1000)}] (1-1000)$count",
639 "Send messages for testing\n"
640 "Send opaque messages\n"
641 "Send unicast messages\n"
642 "Type code to send\n"
643 "Type code to send\n"
644 FRR_IP_REDIST_HELP_STR_ZEBRA
649 "Number of messages to send\n")
653 proto
= proto_redistnum(AFI_IP
, proto_str
);
655 sharp_opaque_send(type
, proto
, instance
, session
, count
);
660 DEFPY (send_opaque_reg
,
662 "sharp send opaque <reg$reg | unreg> \
663 " FRR_IP_REDIST_STR_ZEBRA
"$proto_str \
664 [{instance (0-1000) | session (1-1000)}] type (1-1000)",
666 "Send messages for testing\n"
667 "Send opaque messages\n"
668 "Send opaque registration\n"
669 "Send opaque unregistration\n"
670 FRR_IP_REDIST_HELP_STR_ZEBRA
675 "Opaque sub-type code\n"
676 "Opaque sub-type code\n")
680 proto
= proto_redistnum(AFI_IP
, proto_str
);
682 sharp_opaque_reg_send((reg
!= NULL
), proto
, instance
, session
, type
);
686 DEFPY (neigh_discover
,
688 "sharp neigh discover [vrf NAME$vrf_name] <A.B.C.D$dst4|X:X::X:X$dst6> IFNAME$ifname",
690 "Discover neighbours\n"
691 "Send an ARP/NDP request\n"
693 "v4 Destination address\n"
694 "v6 Destination address\n"
698 struct interface
*ifp
;
699 struct prefix prefix
;
701 memset(&prefix
, 0, sizeof(prefix
));
703 if (dst4
.s_addr
!= INADDR_ANY
) {
704 prefix
.family
= AF_INET
;
705 prefix
.prefixlen
= 32;
706 prefix
.u
.prefix4
= dst4
;
708 prefix
.family
= AF_INET6
;
709 prefix
.prefixlen
= 128;
710 prefix
.u
.prefix6
= dst6
;
713 vrf
= vrf_lookup_by_name(vrf_name
? vrf_name
: VRF_DEFAULT_NAME
);
715 vty_out(vty
, "The vrf NAME specified: %s does not exist\n",
716 vrf_name
? vrf_name
: VRF_DEFAULT_NAME
);
720 ifp
= if_lookup_by_name_vrf(ifname
, vrf
);
722 vty_out(vty
, "%% Can't find interface %s\n", ifname
);
726 sharp_zebra_send_arp(ifp
, &prefix
);
735 "Import Traffic Engineering\n")
737 sg
.ted
= ls_ted_new(1, "Sharp", 0);
738 sharp_zebra_register_te();
743 DEFUN (show_sharp_ted
,
745 "show sharp ted [<vertex [A.B.C.D]|edge [A.B.C.D]|subnet [A.B.C.D/M]>] [verbose|json]",
748 "Traffic Engineering Database\n"
750 "MPLS-TE router ID (as an IP address)\n"
752 "MPLS-TE Edge ID (as an IP address)\n"
754 "MPLS-TE Subnet ID (as an IP prefix)\n"
759 struct in_addr ip_addr
;
761 struct ls_vertex
*vertex
;
762 struct ls_edge
*edge
;
763 struct ls_subnet
*subnet
;
765 bool verbose
= false;
766 bool uj
= use_json(argc
, argv
);
767 json_object
*json
= NULL
;
769 if (sg
.ted
== NULL
) {
770 vty_out(vty
, "MPLS-TE import is not enabled\n");
775 json
= json_object_new_object();
777 if (argv
[argc
- 1]->arg
&& strmatch(argv
[argc
- 1]->text
, "verbose"))
780 if (argv_find(argv
, argc
, "vertex", &idx
)) {
782 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
783 if (!inet_aton(argv
[idx
+ 1]->arg
, &ip_addr
)) {
785 "Specified Router ID %s is invalid\n",
787 return CMD_WARNING_CONFIG_FAILED
;
789 /* Get the Vertex from the Link State Database */
790 key
= ((uint64_t)ip_addr
.s_addr
) & 0xffffffff;
791 vertex
= ls_find_vertex_by_key(sg
.ted
, key
);
793 vty_out(vty
, "No vertex found for ID %pI4\n",
801 ls_show_vertex(vertex
, vty
, json
, verbose
);
803 ls_show_vertices(sg
.ted
, vty
, json
, verbose
);
805 } else if (argv_find(argv
, argc
, "edge", &idx
)) {
807 if (argv_find(argv
, argc
, "A.B.C.D", &idx
)) {
808 if (!inet_aton(argv
[idx
]->arg
, &ip_addr
)) {
810 "Specified Edge ID %s is invalid\n",
812 return CMD_WARNING_CONFIG_FAILED
;
814 /* Get the Edge from the Link State Database */
815 key
= ((uint64_t)ip_addr
.s_addr
) & 0xffffffff;
816 edge
= ls_find_edge_by_key(sg
.ted
, key
);
818 vty_out(vty
, "No edge found for ID %pI4\n",
826 ls_show_edge(edge
, vty
, json
, verbose
);
828 ls_show_edges(sg
.ted
, vty
, json
, verbose
);
830 } else if (argv_find(argv
, argc
, "subnet", &idx
)) {
832 if (argv_find(argv
, argc
, "A.B.C.D/M", &idx
)) {
833 if (!str2prefix(argv
[idx
]->arg
, &pref
)) {
834 vty_out(vty
, "Invalid prefix format %s\n",
836 return CMD_WARNING_CONFIG_FAILED
;
838 /* Get the Subnet from the Link State Database */
839 subnet
= ls_find_subnet(sg
.ted
, pref
);
841 vty_out(vty
, "No subnet found for ID %pFX\n",
849 ls_show_subnet(subnet
, vty
, json
, verbose
);
851 ls_show_subnets(sg
.ted
, vty
, json
, verbose
);
854 /* Show the complete TED */
855 ls_show_ted(sg
.ted
, vty
, json
, verbose
);
860 json_object_to_json_string_ext(
861 json
, JSON_C_TO_STRING_PRETTY
));
862 json_object_free(json
);
867 void sharp_vty_init(void)
869 install_element(ENABLE_NODE
, &install_routes_data_dump_cmd
);
870 install_element(ENABLE_NODE
, &install_routes_cmd
);
871 install_element(ENABLE_NODE
, &remove_routes_cmd
);
872 install_element(ENABLE_NODE
, &vrf_label_cmd
);
873 install_element(ENABLE_NODE
, &sharp_nht_data_dump_cmd
);
874 install_element(ENABLE_NODE
, &watch_redistribute_cmd
);
875 install_element(ENABLE_NODE
, &watch_nexthop_v6_cmd
);
876 install_element(ENABLE_NODE
, &watch_nexthop_v4_cmd
);
877 install_element(ENABLE_NODE
, &sharp_lsp_prefix_v4_cmd
);
878 install_element(ENABLE_NODE
, &sharp_remove_lsp_prefix_v4_cmd
);
879 install_element(ENABLE_NODE
, &logpump_cmd
);
880 install_element(ENABLE_NODE
, &create_session_cmd
);
881 install_element(ENABLE_NODE
, &remove_session_cmd
);
882 install_element(ENABLE_NODE
, &send_opaque_cmd
);
883 install_element(ENABLE_NODE
, &send_opaque_unicast_cmd
);
884 install_element(ENABLE_NODE
, &send_opaque_reg_cmd
);
885 install_element(ENABLE_NODE
, &neigh_discover_cmd
);
886 install_element(ENABLE_NODE
, &import_te_cmd
);
888 install_element(ENABLE_NODE
, &show_debugging_sharpd_cmd
);
889 install_element(ENABLE_NODE
, &show_sharp_ted_cmd
);