]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: install MPLS CLI commands only if MPLS is enabled.
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 14 Sep 2016 20:55:21 +0000 (17:55 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Sep 2016 13:31:20 +0000 (09:31 -0400)
To keep things simple, zebra's code should be the same whether MPLS
is enabled or not. Then, when MPLS is not enabled, we just disable all
MPLS CLI commands. This way we don't need to add a lot of #ifdef cruft
in zebra's core, improving code readability.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
vtysh/Makefile.am
zebra/Makefile.am
zebra/main.c
zebra/zebra_mpls_vty.c [new file with mode: 0644]
zebra/zebra_static.h
zebra/zebra_vty.c
zebra/zserv.h

index 77d374a6e83312d77b493b214aba728ba9366b1b..71fb0ae53e6a391d868869bb64e80548cfb9f69d 100644 (file)
@@ -67,7 +67,8 @@ vtysh_cmd_FILES = $(vtysh_scan) \
                  $(top_srcdir)/zebra/zserv.c $(top_srcdir)/zebra/router-id.c \
                  $(top_srcdir)/zebra/zebra_routemap.c \
                  $(top_srcdir)/zebra/zebra_fpm.c \
-                 $(top_srcdir)/zebra/zebra_ptm.c
+                 $(top_srcdir)/zebra/zebra_ptm.c \
+                 $(top_srcdir)/zebra/zebra_mpls_vty.c
 
 vtysh_cmd.c: $(vtysh_cmd_FILES) extract.pl
        ./extract.pl $(vtysh_cmd_FILES) > vtysh_cmd.c
index b08c37f55e52b667263f81edb9a07ea54aa328e6..851e597796dfe9ee3b50adbc379fb66c32bcc588 100644 (file)
@@ -33,13 +33,13 @@ zebra_SOURCES = \
        redistribute.c debug.c rtadv.c zebra_snmp.c zebra_vty.c \
        irdp_main.c irdp_interface.c irdp_packet.c router-id.c zebra_fpm.c \
        $(othersrc) zebra_ptm.c zebra_rnh.c zebra_ptm_redistribute.c \
-       zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls.c
+       zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls.c zebra_mpls_vty.c
 
 testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
        zebra_vty.c zebra_ptm.c zebra_routemap.c zebra_ns.c zebra_vrf.c \
        kernel_null.c  redistribute_null.c ioctl_null.c misc_null.c zebra_rnh_null.c \
        zebra_ptm_null.c rtadv_null.c if_null.c zserv_null.c zebra_static.c \
-       zebra_memory.c zebra_mpls.c zebra_mpls_null.c
+       zebra_memory.c zebra_mpls.c zebra_mpls_vty.c zebra_mpls_null.c
 
 noinst_HEADERS = \
        zebra_memory.h \
index e06a17ca42c0553deab7e47cc80aee397994172c..dd7e9d9ec3631cd448c9a8cbecdabb5c02f73245 100644 (file)
@@ -350,6 +350,9 @@ main (int argc, char **argv)
   zebra_debug_init ();
   router_id_cmd_init ();
   zebra_vty_init ();
+#if defined(HAVE_MPLS)
+  zebra_mpls_vty_init ();
+#endif
   access_list_init ();
   prefix_list_init ();
 #if defined (HAVE_RTADV)
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
new file mode 100644 (file)
index 0000000..6975ba5
--- /dev/null
@@ -0,0 +1,861 @@
+/* Zebra MPLS VTY functions
+ * Copyright (C) 2002 Kunihiro Ishiguro
+ *
+ * This file is part of GNU Zebra.
+ *
+ * GNU Zebra is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * GNU Zebra is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Zebra; see the file COPYING.  If not, write to the 
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
+ * Boston, MA 02111-1307, USA.  
+ */
+
+#include <zebra.h>
+
+#if defined(HAVE_MPLS)
+
+#include "memory.h"
+#include "if.h"
+#include "prefix.h"
+#include "command.h"
+#include "table.h"
+#include "rib.h"
+#include "nexthop.h"
+#include "vrf.h"
+#include "mpls.h"
+#include "lib/json.h"
+
+#include "zebra/zserv.h"
+#include "zebra/zebra_vrf.h"
+#include "zebra/zebra_mpls.h"
+#include "zebra/zebra_rnh.h"
+#include "zebra/redistribute.h"
+#include "zebra/zebra_routemap.h"
+#include "zebra/zebra_static.h"
+
+static int
+zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
+                       const char *gate_str, const char *outlabel_str,
+                        const char *flag_str)
+{
+  struct zebra_vrf *zvrf;
+  int ret;
+  enum nexthop_types_t gtype;
+  union g_addr gate;
+  mpls_label_t label;
+  mpls_label_t in_label, out_label;
+
+  zvrf = vrf_info_lookup(VRF_DEFAULT);
+  if (!zvrf)
+    {
+      vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
+  if (!inlabel_str)
+    {
+      vty_out (vty, "%% No Label Information%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
+  out_label = MPLS_IMP_NULL_LABEL; /* as initialization */
+  label = atoi(inlabel_str);
+  if (!IS_MPLS_UNRESERVED_LABEL(label))
+    {
+      vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
+  if (add_cmd)
+    {
+      if (!gate_str)
+        {
+          vty_out (vty, "%% No Nexthop Information%s", VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+      if (!outlabel_str)
+        {
+          vty_out (vty, "%% No Outgoing label Information%s", VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+    }
+
+  in_label = label;
+  gtype = NEXTHOP_TYPE_BLACKHOLE; /* as initialization */
+
+  if (gate_str)
+    {
+      /* Gateway is a IPv4 or IPv6 nexthop. */
+      ret = inet_pton (AF_INET6, gate_str, &gate.ipv6);
+      if (ret)
+        gtype = NEXTHOP_TYPE_IPV6;
+      else
+        {
+          ret = inet_pton (AF_INET, gate_str, &gate.ipv4);
+          if (ret)
+            gtype = NEXTHOP_TYPE_IPV4;
+          else
+            {
+              vty_out (vty, "%% Invalid nexthop%s", VTY_NEWLINE);
+              return CMD_WARNING;
+            }
+        }
+    }
+
+  if (outlabel_str)
+    {
+      if (outlabel_str[0] == 'i')
+        out_label = MPLS_IMP_NULL_LABEL;
+      else
+        out_label = atoi(outlabel_str);
+    }
+
+  if (add_cmd)
+    {
+#if defined(HAVE_CUMULUS)
+      /* Check that label value is consistent. */
+      if (!zebra_mpls_lsp_label_consistent (zvrf, in_label, out_label, gtype,
+                                            &gate, NULL, 0))
+        {
+          vty_out (vty, "%% Label value not consistent%s",
+                   VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+#endif /* HAVE_CUMULUS */
+
+      ret = zebra_mpls_static_lsp_add (zvrf, in_label, out_label, gtype,
+                                       &gate, NULL, 0);
+    }
+  else
+    ret = zebra_mpls_static_lsp_del (zvrf, in_label, gtype, &gate, NULL, 0);
+
+  if (ret)
+    {
+      vty_out (vty, "%% LSP cannot be %s%s",
+               add_cmd ? "added" : "deleted", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
+  return CMD_SUCCESS;
+}
+
+DEFUN (mpls_transit_lsp,
+       mpls_transit_lsp_cmd,
+       "mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
+       MPLS_STR
+       "Establish label switched path\n"
+       "Incoming MPLS label\n"
+       "IPv4 gateway address\n"
+       "IPv6 gateway address\n"
+       "Outgoing MPLS label\n"
+       "Use Implicit-Null label\n")
+{
+  return zebra_mpls_transit_lsp (vty, 1, argv[0], argv[1], argv[2], NULL);
+}
+
+DEFUN (no_mpls_transit_lsp,
+       no_mpls_transit_lsp_cmd,
+       "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X)",
+       NO_STR
+       MPLS_STR
+       "Establish label switched path\n"
+       "Incoming MPLS label\n"
+       "IPv4 gateway address\n"
+       "IPv6 gateway address\n")
+{
+  return zebra_mpls_transit_lsp (vty, 0, argv[0], argv[1], NULL, NULL);
+}
+
+ALIAS (no_mpls_transit_lsp,
+       no_mpls_transit_lsp_out_label_cmd,
+       "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
+       NO_STR
+       MPLS_STR
+       "Establish label switched path\n"
+       "Incoming MPLS label\n"
+       "IPv4 gateway address\n"
+       "IPv6 gateway address\n"
+       "Outgoing MPLS label\n"
+       "Use Implicit-Null label\n")
+DEFUN (no_mpls_transit_lsp_all,
+       no_mpls_transit_lsp_all_cmd,
+       "no mpls lsp <16-1048575>",
+       NO_STR
+       MPLS_STR
+       "Establish label switched path\n"
+       "Incoming MPLS label\n")
+{
+  return zebra_mpls_transit_lsp (vty, 0, argv[0], NULL, NULL, NULL);
+}
+
+/* Static route configuration.  */
+DEFUN (ip_route_label,
+       ip_route_label_cmd,
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
+                            NULL, NULL, argv[2]);
+}
+
+DEFUN (ip_route_tag_label,
+       ip_route_tag_label_cmd,
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
+                            NULL, NULL, argv[3]);
+}
+
+/* Mask as A.B.C.D format.  */
+DEFUN (ip_route_mask_label,
+       ip_route_mask_label_cmd,
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
+                            NULL, NULL, argv[3]);
+}
+
+DEFUN (ip_route_mask_tag_label,
+       ip_route_mask_tag_label_cmd,
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
+                            NULL, NULL, argv[4]);
+}
+
+/* Distance option value.  */
+DEFUN (ip_route_distance_label,
+       ip_route_distance_label_cmd,
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
+                            argv[2], NULL, argv[3]);
+}
+
+DEFUN (ip_route_tag_distance_label,
+       ip_route_tag_distance_label_cmd,
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
+                            argv[3], NULL, argv[4]);
+}
+
+DEFUN (ip_route_mask_distance_label,
+       ip_route_mask_distance_label_cmd,
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
+                            argv[3], NULL, argv[4]);
+}
+
+DEFUN (ip_route_mask_tag_distance_label,
+       ip_route_mask_tag_distance_label_cmd,
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
+                            argv[4], NULL, argv[5]);
+}
+
+DEFUN (no_ip_route_label,
+       no_ip_route_label_cmd,
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
+                            NULL, NULL, argv[2]);
+}
+
+DEFUN (no_ip_route_tag_label,
+       no_ip_route_tag_label_cmd,
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Tag of this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
+                            NULL, NULL, argv[3]);
+}
+
+DEFUN (no_ip_route_mask_label,
+       no_ip_route_mask_label_cmd,
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
+                            NULL, NULL, argv[3]);
+}
+
+DEFUN (no_ip_route_mask_tag_label,
+       no_ip_route_mask_tag_label_cmd,
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Tag of this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
+                            NULL, NULL, argv[4]);
+}
+
+DEFUN (no_ip_route_distance_label,
+       no_ip_route_distance_label_cmd,
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
+                            argv[2], NULL, argv[3]);
+}
+
+DEFUN (no_ip_route_tag_distance_label,
+       no_ip_route_tag_distance_label_cmd,
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Tag of this route\n"
+       "Tag value\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
+                            argv[3], NULL, argv[4]);
+}
+
+DEFUN (no_ip_route_mask_distance_label,
+       no_ip_route_mask_distance_label_cmd,
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
+                            argv[3], NULL, argv[5]);
+}
+
+DEFUN (no_ip_route_mask_tag_distance_label,
+       no_ip_route_mask_tag_distance_label_cmd,
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IP destination prefix\n"
+       "IP destination prefix mask\n"
+       "IP gateway address\n"
+       "IP gateway interface name\n"
+       "Null interface\n"
+       "Tag of this route\n"
+       "Tag value\n"
+       "Distance value for this route\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
+                            argv[4], NULL, argv[5]);
+}
+
+DEFUN (ipv6_route_label,
+       ipv6_route_label_cmd,
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+}
+
+DEFUN (ipv6_route_tag_label,
+       ipv6_route_tag_label_cmd,
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+}
+
+DEFUN (ipv6_route_ifname_label,
+       ipv6_route_ifname_label_cmd,
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+}
+DEFUN (ipv6_route_ifname_tag_label,
+       ipv6_route_ifname_tag_label_cmd,
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+}
+
+DEFUN (ipv6_route_pref_label,
+       ipv6_route_pref_label_cmd,
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+}
+
+DEFUN (ipv6_route_pref_tag_label,
+       ipv6_route_pref_tag_label_cmd,
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+}
+
+DEFUN (ipv6_route_ifname_pref_label,
+       ipv6_route_ifname_pref_label_cmd,
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+}
+
+DEFUN (ipv6_route_ifname_pref_tag_label,
+       ipv6_route_ifname_pref_tag_label_cmd,
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> label WORD",
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+}
+
+DEFUN (no_ipv6_route_label,
+       no_ipv6_route_label_cmd,
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+}
+
+DEFUN (no_ipv6_route_tag_label,
+       no_ipv6_route_tag_label_cmd,
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+}
+
+DEFUN (no_ipv6_route_ifname_label,
+       no_ipv6_route_ifname_label_cmd,
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+}
+
+DEFUN (no_ipv6_route_ifname_tag_label,
+       no_ipv6_route_ifname_tag_label_cmd,
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+}
+
+DEFUN (no_ipv6_route_pref_label,
+       no_ipv6_route_pref_label_cmd,
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+}
+
+DEFUN (no_ipv6_route_pref_tag_label,
+       no_ipv6_route_pref_tag_label_cmd,
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+}
+
+DEFUN (no_ipv6_route_ifname_pref_label,
+       no_ipv6_route_ifname_pref_label_cmd,
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+}
+
+DEFUN (no_ipv6_route_ifname_pref_tag_label,
+       no_ipv6_route_ifname_pref_tag_label_cmd,
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> label WORD",
+       NO_STR
+       IP_STR
+       "Establish static routes\n"
+       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
+       "IPv6 gateway address\n"
+       "IPv6 gateway interface name\n"
+       "Set tag for this route\n"
+       "Tag value\n"
+       "Distance value for this prefix\n"
+       "Specify label(s) for this route\n"
+       "One or more labels separated by '/'\n")
+{
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+}
+
+/* MPLS LSP configuration write function. */
+static int
+zebra_mpls_config (struct vty *vty)
+{
+  int write = 0;
+  struct zebra_vrf *zvrf;
+
+  zvrf = vrf_info_lookup(VRF_DEFAULT);
+  if (!zvrf)
+    return 0;
+
+  write += zebra_mpls_write_lsp_config(vty, zvrf);
+  return write;
+}
+
+DEFUN (show_mpls_table,
+       show_mpls_table_cmd,
+       "show mpls table {json}",
+       SHOW_STR
+       MPLS_STR
+       "MPLS table\n"
+       "JavaScript Object Notation\n")
+{
+  struct zebra_vrf *zvrf;
+  u_char use_json = (argv[0] != NULL);
+
+  zvrf = vrf_info_lookup(VRF_DEFAULT);
+  zebra_mpls_print_lsp_table(vty, zvrf, use_json);
+  return CMD_SUCCESS;
+}
+
+DEFUN (show_mpls_table_lsp,
+       show_mpls_table_lsp_cmd,
+       "show mpls table <16-1048575> {json}",
+       SHOW_STR
+       MPLS_STR
+       "MPLS table\n"
+       "LSP to display information about\n"
+       "JavaScript Object Notation\n")
+{
+  u_int32_t label;
+  struct zebra_vrf *zvrf;
+  u_char use_json = (argv[1] != NULL);
+
+  zvrf = vrf_info_lookup(VRF_DEFAULT);
+  label = atoi(argv[0]);
+  zebra_mpls_print_lsp (vty, zvrf, label, use_json);
+  return CMD_SUCCESS;
+}
+
+/* MPLS node for MPLS LSP. */
+static struct cmd_node mpls_node = { MPLS_NODE,  "",  1 };
+
+/* MPLS VTY.  */
+void
+zebra_mpls_vty_init (void)
+{
+  install_node (&mpls_node, zebra_mpls_config);
+
+  install_element (CONFIG_NODE, &ip_route_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_tag_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_mask_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_mask_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_mask_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_mask_tag_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_distance_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_tag_distance_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_mask_distance_label_cmd);
+  install_element (CONFIG_NODE, &ip_route_mask_tag_distance_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_distance_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_tag_distance_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_mask_distance_label_cmd);
+  install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_label_cmd);
+
+  install_element (CONFIG_NODE, &ipv6_route_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_ifname_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_ifname_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_pref_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_ifname_pref_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_pref_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_tag_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_ifname_tag_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_pref_tag_label_cmd);
+  install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_label_cmd);
+  install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_label_cmd);
+
+  install_element (CONFIG_NODE, &mpls_transit_lsp_cmd);
+  install_element (CONFIG_NODE, &no_mpls_transit_lsp_cmd);
+  install_element (CONFIG_NODE, &no_mpls_transit_lsp_out_label_cmd);
+  install_element (CONFIG_NODE, &no_mpls_transit_lsp_all_cmd);
+
+  install_element (VIEW_NODE, &show_mpls_table_cmd);
+  install_element (ENABLE_NODE, &show_mpls_table_cmd);
+  install_element (VIEW_NODE, &show_mpls_table_lsp_cmd);
+  install_element (ENABLE_NODE, &show_mpls_table_lsp_cmd);
+}
+
+#endif /* HAVE_MPLS */
index 9178a6dd45e018470e526e8b351a6894889000f6..8c55ea84c01b8d36436b300d77b1a4466d6cfe8a 100644 (file)
@@ -97,5 +97,18 @@ static_delete_route (afi_t, safi_t safi, u_char type, struct prefix *p,
                     u_char distance, struct zebra_vrf *zvrf,
                     struct static_nh_label *snh_label);
 
+int
+zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
+                  const char *dest_str, const char *mask_str,
+                  const char *gate_str, const char *flag_str,
+                  const char *tag_str, const char *distance_str,
+                  const char *vrf_id_str, const char *label_str);
+
+int
+static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
+                 const char *gate_str, const char *ifname,
+                 const char *flag_str, const char *tag_str,
+                  const char *distance_str, const char *vrf_id_str,
+                 const char *label_str);
 
 #endif
index aa3da71ce554605a3f37980f59c243909b5b4e25..e76e4ab8fa6e972f87200acdc71d323568ecb755 100644 (file)
@@ -53,7 +53,7 @@ static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
 #define ONE_WEEK_SECOND 60*60*24*7
 
 /* General function for static route. */
-static int
+int
 zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
                   const char *dest_str, const char *mask_str,
                   const char *gate_str, const char *flag_str,
@@ -351,23 +351,21 @@ DEFUN (show_ip_rpf_addr,
 /* Static route configuration.  */
 DEFUN (ip_route, 
        ip_route_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
-       "Null interface\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Null interface\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
-                            NULL, NULL, argv[2]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_tag,
        ip_route_tag_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -375,34 +373,30 @@ DEFUN (ip_route_tag,
        "IP gateway interface name\n"
        "Null interface\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
        "One or more labels separated by '/'\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
-                            NULL, NULL, argv[3]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_flags,
        ip_route_flags_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
        "Emit an ICMP unreachable when matched\n"
-       "Silently discard pkts when matched\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Silently discard pkts when matched\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], NULL,
-                            NULL, NULL, argv[3]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_flags_tag,
        ip_route_flags_tag_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535> {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-65535>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -411,13 +405,11 @@ DEFUN (ip_route_flags_tag,
        "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], argv[2], argv[3],
-                            NULL, NULL, argv[4]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_flags2,
@@ -452,24 +444,22 @@ DEFUN (ip_route_flags2_tag,
 /* Mask as A.B.C.D format.  */
 DEFUN (ip_route_mask,
        ip_route_mask_cmd,
-       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) {label WORD}",
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
        "IP destination prefix mask\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
-       "Null interface\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Null interface\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
-                            NULL, NULL, argv[3]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_mask_tag,
        ip_route_mask_tag_cmd,
-       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> {label WORD}",
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
@@ -478,13 +468,11 @@ DEFUN (ip_route_mask_tag,
        "IP gateway interface name\n"
        "Null interface\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
-                            NULL, NULL, argv[4]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (ip_route_mask_flags,
@@ -555,24 +543,22 @@ DEFUN (ip_route_mask_flags2_tag,
 /* Distance option value.  */
 DEFUN (ip_route_distance,
        ip_route_distance_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
        "Null interface\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
-                            argv[2], NULL, argv[3]);
+                            argv[2], NULL, NULL);
 }
 
 DEFUN (ip_route_tag_distance,
        ip_route_tag_distance_cmd,
-       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> {label WORD}",
+       "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -581,13 +567,11 @@ DEFUN (ip_route_tag_distance,
        "Null interface\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
-                            argv[3], NULL, argv[4]);
+                            argv[3], NULL, NULL);
 }
 
 DEFUN (ip_route_flags_distance,
@@ -656,7 +640,7 @@ DEFUN (ip_route_flags_tag_distance2,
 
 DEFUN (ip_route_mask_distance,
        ip_route_mask_distance_cmd,
-       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> {label WORD}",
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
@@ -664,17 +648,15 @@ DEFUN (ip_route_mask_distance,
        "IP gateway address\n"
        "IP gateway interface name\n"
        "Null interface\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
-                            argv[3], NULL, argv[4]);
+                            argv[3], NULL, NULL);
 }
 
 DEFUN (ip_route_mask_tag_distance,
        ip_route_mask_tag_distance_cmd,
-       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> {label WORD}",
+       "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
@@ -684,12 +666,10 @@ DEFUN (ip_route_mask_tag_distance,
        "Null interface\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
-                            argv[4], NULL, argv[5]);
+                            argv[4], NULL, NULL);
 }
 
 DEFUN (ip_route_mask_flags_tag_distance,
@@ -763,24 +743,22 @@ DEFUN (ip_route_mask_flags_tag_distance2,
 
 DEFUN (no_ip_route, 
        no_ip_route_cmd,
-       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) {label WORD}",
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
-       "Null interface\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Null interface\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
-                            NULL, NULL, argv[2]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (no_ip_route_tag,
        no_ip_route_tag_cmd,
-       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> {label WORD}",
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -789,12 +767,10 @@ DEFUN (no_ip_route_tag,
        "IP gateway interface name\n"
        "Null interface\n"
        "Tag of this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
-                            NULL, NULL, argv[3]);
+                            NULL, NULL, NULL);
 }
 
 ALIAS (no_ip_route,
@@ -855,7 +831,7 @@ DEFUN (no_ip_route_flags2_tag,
 
 DEFUN (no_ip_route_mask,
        no_ip_route_mask_cmd,
-       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) {label WORD}",
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -863,17 +839,15 @@ DEFUN (no_ip_route_mask,
        "IP destination prefix mask\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
-       "Null interface\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Null interface\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
-                            NULL, NULL, argv[3]);
+                            NULL, NULL, NULL);
 }
 
 DEFUN (no_ip_route_mask_tag,
        no_ip_route_mask_tag_cmd,
-       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> {label WORD}",
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -883,12 +857,10 @@ DEFUN (no_ip_route_mask_tag,
        "IP gateway interface name\n"
        "Null interface\n"
        "Tag of this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
-                            NULL, NULL, argv[4]);
+                            NULL, NULL, NULL);
 }
 
 ALIAS (no_ip_route_mask,
@@ -953,7 +925,7 @@ DEFUN (no_ip_route_mask_flags2_tag,
 
 DEFUN (no_ip_route_distance,
        no_ip_route_distance_cmd,
-       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> {label WORD}",
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -961,17 +933,15 @@ DEFUN (no_ip_route_distance,
        "IP gateway address\n"
        "IP gateway interface name\n"
        "Null interface\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
-                            argv[2], NULL, argv[3]);
+                            argv[2], NULL, NULL);
 }
 
 DEFUN (no_ip_route_tag_distance,
        no_ip_route_tag_distance_cmd,
-       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> {label WORD}",
+       "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -981,12 +951,10 @@ DEFUN (no_ip_route_tag_distance,
        "Null interface\n"
        "Tag of this route\n"
        "Tag value\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
-                            argv[3], NULL, argv[4]);
+                            argv[3], NULL, NULL);
 }
 
 DEFUN (no_ip_route_flags_distance,
@@ -1042,7 +1010,7 @@ DEFUN (no_ip_route_flags_distance2,
 
 DEFUN (no_ip_route_flags_tag_distance2,
        no_ip_route_flags_tag_distance2_cmd,
-       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> {label WORD}",
+       "no ip route A.B.C.D/M (reject|blackhole) tag <1-65535> <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -1051,17 +1019,15 @@ DEFUN (no_ip_route_flags_tag_distance2,
        "Silently discard pkts when matched\n"
        "Tag of this route\n"
        "Tag value\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL, argv[1], argv[2],
-                            argv[3], NULL, argv[4]);
+                            argv[3], NULL, NULL);
 }
 
 DEFUN (no_ip_route_mask_distance,
        no_ip_route_mask_distance_cmd,
-       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> {label WORD}",
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -1070,17 +1036,15 @@ DEFUN (no_ip_route_mask_distance,
        "IP gateway address\n"
        "IP gateway interface name\n"
        "Null interface\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
-  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
-                            argv[4], NULL, argv[5]);
+  return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
+                            argv[3], NULL, NULL);
 }
 
 DEFUN (no_ip_route_mask_tag_distance,
        no_ip_route_mask_tag_distance_cmd,
-       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> {label WORD}",
+       "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -1091,12 +1055,10 @@ DEFUN (no_ip_route_mask_tag_distance,
        "Null interface\n"
        "Tag of this route\n"
        "Tag value\n"
-       "Distance value for this route\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
-                            argv[4], NULL, argv[5]);
+                            argv[4], NULL, NULL);
 }
 
 DEFUN (no_ip_route_mask_flags_distance,
@@ -2021,162 +1983,6 @@ DEFUN (no_ip_route_mask_flags_tag_distance2_vrf,
                            argv[2], argv[3], argv[4], argv[5], NULL);
 }
 
-static int
-zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
-                       const char *gate_str, const char *outlabel_str,
-                        const char *flag_str)
-{
-  struct zebra_vrf *zvrf;
-  int ret;
-  enum nexthop_types_t gtype;
-  union g_addr gate;
-  mpls_label_t label;
-  mpls_label_t in_label, out_label;
-
-  zvrf = vrf_info_lookup(VRF_DEFAULT);
-  if (!zvrf)
-    {
-      vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (!inlabel_str)
-    {
-      vty_out (vty, "%% No Label Information%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  out_label = MPLS_IMP_NULL_LABEL; /* as initialization */
-  label = atoi(inlabel_str);
-  if (!IS_MPLS_UNRESERVED_LABEL(label))
-    {
-      vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  if (add_cmd)
-    {
-      if (!gate_str)
-        {
-          vty_out (vty, "%% No Nexthop Information%s", VTY_NEWLINE);
-          return CMD_WARNING;
-        }
-      if (!outlabel_str)
-        {
-          vty_out (vty, "%% No Outgoing label Information%s", VTY_NEWLINE);
-          return CMD_WARNING;
-        }
-    }
-
-  in_label = label;
-  gtype = NEXTHOP_TYPE_BLACKHOLE; /* as initialization */
-
-  if (gate_str)
-    {
-      /* Gateway is a IPv4 or IPv6 nexthop. */
-      ret = inet_pton (AF_INET6, gate_str, &gate.ipv6);
-      if (ret)
-        gtype = NEXTHOP_TYPE_IPV6;
-      else
-        {
-          ret = inet_pton (AF_INET, gate_str, &gate.ipv4);
-          if (ret)
-            gtype = NEXTHOP_TYPE_IPV4;
-          else
-            {
-              vty_out (vty, "%% Invalid nexthop%s", VTY_NEWLINE);
-              return CMD_WARNING;
-            }
-        }
-    }
-
-  if (outlabel_str)
-    {
-      if (outlabel_str[0] == 'i')
-        out_label = MPLS_IMP_NULL_LABEL;
-      else
-        out_label = atoi(outlabel_str);
-    }
-
-  if (add_cmd)
-    {
-#if defined(HAVE_CUMULUS)
-      /* Check that label value is consistent. */
-      if (!zebra_mpls_lsp_label_consistent (zvrf, in_label, out_label, gtype,
-                                            &gate, NULL, 0))
-        {
-          vty_out (vty, "%% Label value not consistent%s",
-                   VTY_NEWLINE);
-          return CMD_WARNING;
-        }
-#endif /* HAVE_CUMULUS */
-
-      ret = zebra_mpls_static_lsp_add (zvrf, in_label, out_label, gtype,
-                                       &gate, NULL, 0);
-    }
-  else
-    ret = zebra_mpls_static_lsp_del (zvrf, in_label, gtype, &gate, NULL, 0);
-
-  if (ret)
-    {
-      vty_out (vty, "%% LSP cannot be %s%s",
-               add_cmd ? "added" : "deleted", VTY_NEWLINE);
-      return CMD_WARNING;
-    }
-
-  return CMD_SUCCESS;
-}
-
-DEFUN (mpls_transit_lsp,
-       mpls_transit_lsp_cmd,
-       "mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
-       MPLS_STR
-       "Establish label switched path\n"
-       "Incoming MPLS label\n"
-       "IPv4 gateway address\n"
-       "IPv6 gateway address\n"
-       "Outgoing MPLS label\n"
-       "Use Implicit-Null label\n")
-{
-  return zebra_mpls_transit_lsp (vty, 1, argv[0], argv[1], argv[2], NULL);
-}
-
-DEFUN (no_mpls_transit_lsp,
-       no_mpls_transit_lsp_cmd,
-       "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X)",
-       NO_STR
-       MPLS_STR
-       "Establish label switched path\n"
-       "Incoming MPLS label\n"
-       "IPv4 gateway address\n"
-       "IPv6 gateway address\n")
-{
-  return zebra_mpls_transit_lsp (vty, 0, argv[0], argv[1], NULL, NULL);
-}
-
-ALIAS (no_mpls_transit_lsp,
-       no_mpls_transit_lsp_out_label_cmd,
-       "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
-       NO_STR
-       MPLS_STR
-       "Establish label switched path\n"
-       "Incoming MPLS label\n"
-       "IPv4 gateway address\n"
-       "IPv6 gateway address\n"
-       "Outgoing MPLS label\n"
-       "Use Implicit-Null label\n")
-DEFUN (no_mpls_transit_lsp_all,
-       no_mpls_transit_lsp_all_cmd,
-       "no mpls lsp <16-1048575>",
-       NO_STR
-       MPLS_STR
-       "Establish label switched path\n"
-       "Incoming MPLS label\n")
-{
-  return zebra_mpls_transit_lsp (vty, 0, argv[0], NULL, NULL, NULL);
-}
 /* New RIB.  Detailed information for IPv4 route. */
 static void
 vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
@@ -3919,7 +3725,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
 
 #ifdef HAVE_IPV6
 /* General fucntion for IPv6 static route. */
-static int
+int
 static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
                  const char *gate_str, const char *ifname,
                  const char *flag_str, const char *tag_str,
@@ -3976,7 +3782,6 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
   if (tag_str)
     tag = atoi(tag_str);
 
-
   /* When gateway is valid IPv6 addrees, then gate is treated as
      nexthop address other case gate is treated as interface name. */
   ret = inet_pton (AF_INET6, gate_str, &gate_addr);
@@ -4055,32 +3860,28 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
 
 DEFUN (ipv6_route,
        ipv6_route_cmd,
-       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) {label WORD}",
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
-       "IPv6 gateway interface name\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "IPv6 gateway interface name\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
 DEFUN (ipv6_route_tag,
        ipv6_route_tag_cmd,
-       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> {label WORD}",
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, NULL);
 }
 
 DEFUN (ipv6_route_flags,
@@ -4115,31 +3916,27 @@ DEFUN (ipv6_route_flags_tag,
 
 DEFUN (ipv6_route_ifname,
        ipv6_route_ifname_cmd,
-       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE {label WORD}",
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
-       "IPv6 gateway interface name\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "IPv6 gateway interface name\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, NULL);
 }
 DEFUN (ipv6_route_ifname_tag,
        ipv6_route_ifname_tag_cmd,
-       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> {label WORD}",
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, NULL);
 }
 
 DEFUN (ipv6_route_ifname_flags,
@@ -4174,22 +3971,20 @@ DEFUN (ipv6_route_ifname_flags_tag,
 
 DEFUN (ipv6_route_pref,
        ipv6_route_pref_cmd,
-       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> {label WORD}",
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, NULL);
 }
 
 DEFUN (ipv6_route_pref_tag,
        ipv6_route_pref_tag_cmd,
-       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> {label WORD}",
+       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -4197,11 +3992,9 @@ DEFUN (ipv6_route_pref_tag,
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, NULL);
 }
 
 DEFUN (ipv6_route_flags_pref,
@@ -4238,22 +4031,20 @@ DEFUN (ipv6_route_flags_pref_tag,
 
 DEFUN (ipv6_route_ifname_pref,
        ipv6_route_ifname_pref_cmd,
-       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> {label WORD}",
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, NULL);
 }
 
 DEFUN (ipv6_route_ifname_pref_tag,
        ipv6_route_ifname_pref_tag_cmd,
-       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> {label WORD}",
+       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
@@ -4261,11 +4052,9 @@ DEFUN (ipv6_route_ifname_pref_tag,
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, NULL);
 }
 
 DEFUN (ipv6_route_ifname_flags_pref,
@@ -4302,22 +4091,20 @@ DEFUN (ipv6_route_ifname_flags_pref_tag,
 
 DEFUN (no_ipv6_route,
        no_ipv6_route_cmd,
-       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) {label WORD}",
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
-       "IPv6 gateway interface name\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "IPv6 gateway interface name\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_tag,
        no_ipv6_route_tag_cmd,
-       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> {label WORD}",
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -4325,11 +4112,9 @@ DEFUN (no_ipv6_route_tag,
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_flags,
@@ -4366,22 +4151,20 @@ DEFUN (no_ipv6_route_flags_tag,
 
 DEFUN (no_ipv6_route_ifname,
        no_ipv6_route_ifname_cmd,
-       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE {label WORD}",
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
-       "IPv6 gateway interface name\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "IPv6 gateway interface name\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_ifname_tag,
        no_ipv6_route_ifname_tag_cmd,
-       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> {label WORD}",
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -4389,11 +4172,9 @@ DEFUN (no_ipv6_route_ifname_tag,
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
-       "Tag value\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Tag value\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_ifname_flags,
@@ -4430,23 +4211,21 @@ DEFUN (no_ipv6_route_ifname_flags_tag,
 
 DEFUN (no_ipv6_route_pref,
        no_ipv6_route_pref_cmd,
-       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> {label WORD}",
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_pref_tag,
        no_ipv6_route_pref_tag_cmd,
-       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> {label WORD}",
+       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -4455,11 +4234,9 @@ DEFUN (no_ipv6_route_pref_tag,
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_flags_pref,
@@ -4500,23 +4277,21 @@ DEFUN (no_ipv6_route_flags_pref_tag,
 
 DEFUN (no_ipv6_route_ifname_pref,
        no_ipv6_route_ifname_pref_cmd,
-       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> {label WORD}",
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_ifname_pref_tag,
        no_ipv6_route_ifname_pref_tag_cmd,
-       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> {label WORD}",
+       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255>",
        NO_STR
        IP_STR
        "Establish static routes\n"
@@ -4525,11 +4300,9 @@ DEFUN (no_ipv6_route_ifname_pref_tag,
        "IPv6 gateway interface name\n"
        "Set tag for this route\n"
        "Tag value\n"
-       "Distance value for this prefix\n"
-       "Specify label(s) for this route\n"
-       "One or more labels separated by '/'\n")
+       "Distance value for this prefix\n")
 {
-  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
+  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, NULL);
 }
 
 DEFUN (no_ipv6_route_ifname_flags_pref,
@@ -6083,56 +5856,6 @@ zebra_ip_config (struct vty *vty)
   return write;
 }
 
-/* MPLS LSP configuration write function. */
-static int
-zebra_mpls_config (struct vty *vty)
-{
-  int write = 0;
-  struct zebra_vrf *zvrf;
-
-  zvrf = vrf_info_lookup(VRF_DEFAULT);
-  if (!zvrf)
-    return 0;
-
-  write += zebra_mpls_write_lsp_config(vty, zvrf);
-  return write;
-}
-
-DEFUN (show_mpls_table,
-       show_mpls_table_cmd,
-       "show mpls table {json}",
-       SHOW_STR
-       MPLS_STR
-       "MPLS table\n"
-       "JavaScript Object Notation\n")
-{
-  struct zebra_vrf *zvrf;
-  u_char use_json = (argv[0] != NULL);
-
-  zvrf = vrf_info_lookup(VRF_DEFAULT);
-  zebra_mpls_print_lsp_table(vty, zvrf, use_json);
-  return CMD_SUCCESS;
-}
-
-DEFUN (show_mpls_table_lsp,
-       show_mpls_table_lsp_cmd,
-       "show mpls table <16-1048575> {json}",
-       SHOW_STR
-       MPLS_STR
-       "MPLS table\n"
-       "LSP to display information about\n"
-       "JavaScript Object Notation\n")
-{
-  u_int32_t label;
-  struct zebra_vrf *zvrf;
-  u_char use_json = (argv[1] != NULL);
-
-  zvrf = vrf_info_lookup(VRF_DEFAULT);
-  label = atoi(argv[0]);
-  zebra_mpls_print_lsp (vty, zvrf, label, use_json);
-  return CMD_SUCCESS;
-}
-
 DEFUN (ip_zebra_import_table_distance,
        ip_zebra_import_table_distance_cmd,
        "ip import-table <1-252> distance <1-255>",
@@ -6300,16 +6023,12 @@ config_write_protocol (struct vty *vty)
 static struct cmd_node ip_node = { IP_NODE,  "",  1 };
 static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
 
-/* MPLS node for MPLS LSP. */
-static struct cmd_node mpls_node = { MPLS_NODE,  "",  1 };
-
 /* Route VTY.  */
 void
 zebra_vty_init (void)
 {
   install_node (&ip_node, zebra_ip_config);
   install_node (&protocol_node, config_write_protocol);
-  install_node (&mpls_node, zebra_mpls_config);
 
   install_element (CONFIG_NODE, &allow_external_route_update_cmd);
   install_element (CONFIG_NODE, &no_allow_external_route_update_cmd);
@@ -6637,14 +6356,4 @@ zebra_vty_init (void)
   install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
   install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd);
 #endif /* HAVE_IPV6 */
-
-  install_element (CONFIG_NODE, &mpls_transit_lsp_cmd);
-  install_element (CONFIG_NODE, &no_mpls_transit_lsp_cmd);
-  install_element (CONFIG_NODE, &no_mpls_transit_lsp_out_label_cmd);
-  install_element (CONFIG_NODE, &no_mpls_transit_lsp_all_cmd);
-
-  install_element (VIEW_NODE, &show_mpls_table_cmd);
-  install_element (ENABLE_NODE, &show_mpls_table_cmd);
-  install_element (VIEW_NODE, &show_mpls_table_lsp_cmd);
-  install_element (ENABLE_NODE, &show_mpls_table_lsp_cmd);
 }
index ce243dd6ac8a2d94670aa5179fd272c629923914..ceff6a96ae7cd19cf43d1bc8fe40b8ac3c7e3d43 100644 (file)
@@ -149,6 +149,9 @@ extern void kernel_terminate (struct zebra_ns *);
 extern void zebra_route_map_init (void);
 extern void zebra_snmp_init (void);
 extern void zebra_vty_init (void);
+#if defined(HAVE_MPLS)
+extern void zebra_mpls_vty_init (void);
+#endif
 
 extern int zsend_vrf_add (struct zserv *, struct zebra_vrf *);
 extern int zsend_vrf_delete (struct zserv *, struct zebra_vrf *);