]> git.puffer.fish Git - matthieu/frr.git/commitdiff
partial merge: revert "LabNConsulting/working/2.0/afi-safi-vty/c"
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 13 Jan 2017 14:10:05 +0000 (15:10 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 13 Jan 2017 14:12:28 +0000 (15:12 +0100)
Unfortunately, the CLI changes need to be redone on master since the CLI
has massively changed there.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_mplsvpn.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_vty.c
bgpd/bgp_vty.h

index b710e0b03bcd92235d6aeca6a3954face1e84642..d55acdd5129bc0320d2515b73a67bb4deaefbf19 100644 (file)
@@ -35,7 +35,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "bgpd/bgp_attr.h"
 #include "bgpd/bgp_mplsvpn.h"
 #include "bgpd/bgp_packet.h"
-#include "bgpd/bgp_vty.h"
 
 #if ENABLE_BGP_VNC
 #include "bgpd/rfapi/rfapi_backend.h"
@@ -199,7 +198,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
 
       if (prefixlen < VPN_PREFIXLEN_MIN_BYTES*8)
        {
-         zlog_err ("%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)",
+         zlog_err ("%s [Error] Update packet error / VPNv4 (prefix length %d less than VPNv4 min length)",
                    peer->host, prefixlen);
          return -1;
        }
@@ -207,7 +206,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
       /* sanity check against packet data */
       if ((pnt + psize) > lim)
         {
-          zlog_err ("%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)",
+          zlog_err ("%s [Error] Update packet error / VPNv4 (prefix length %d exceeds packet size %u)",
                     peer->host,
                     prefixlen, (uint)(lim-pnt));
           return -1;
@@ -216,7 +215,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
       /* sanity check against storage for the IP address portion */
       if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t) sizeof(p.u))
         {
-          zlog_err ("%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)",
+          zlog_err ("%s [Error] Update packet error / VPNv4 (psize %d exceeds storage size %zu)",
                     peer->host,
                     prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, sizeof(p.u));
           return -1;
@@ -225,7 +224,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
       /* Sanity check against max bitlen of the address family */
       if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen (&p))
         {
-          zlog_err ("%s [Error] Update packet error / VPN (psize %d exceeds family (%u) max byte len %u)",
+          zlog_err ("%s [Error] Update packet error / VPNv4 (psize %d exceeds family (%u) max byte len %u)",
                     peer->host,
                     prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, 
                     p.family, prefix_blen (&p));
@@ -296,7 +295,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
   /* Packet length consistency check. */
   if (pnt != lim)
     {
-      zlog_err ("%s [Error] Update packet error / VPN (%zu data remaining after parsing)",
+      zlog_err ("%s [Error] Update packet error / VPNv4 (%zu data remaining after parsing)",
                 peer->host, lim - pnt);
       return -1;
     }
@@ -486,7 +485,7 @@ DEFUN (no_vpnv4_network,
 }
 
 static int
-show_adj_route_vpn (struct vty *vty, struct peer *peer, afi_t afi, struct prefix_rd *prd, u_char use_json)
+show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json)
 {
   struct bgp *bgp;
   struct bgp_table *table;
@@ -529,7 +528,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, afi_t afi, struct prefix
       json_object_string_add(json_ocode, "incomplete", "?");
     }
 
-  for (rn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); rn;
+  for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rn;
        rn = bgp_route_next (rn))
     {
       if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
@@ -955,25 +954,25 @@ DEFUN (show_bgp_ipv6_vpn_rd,
   return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
 }
 
-DEFUN (show_bgp_ip_vpn_all,
-       show_bgp_ip_vpn_all_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn all",
+DEFUN (show_ip_bgp_vpnv4_all,
+       show_ip_bgp_vpnv4_all_cmd,
+       "show ip bgp vpnv4 all",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
-       "Display information about all VPN NLRIs\n")
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n")
 {
-  return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), NULL, bgp_show_type_normal, NULL, 0, 0);
+  return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0);
 }
 
-DEFUN (show_bgp_ip_vpn_rd,
-       show_bgp_ip_vpn_rd_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn",
+DEFUN (show_ip_bgp_vpnv4_rd,
+       show_ip_bgp_vpnv4_rd_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information for a route distinguisher\n"
        "VPN Route Distinguisher\n")
 {
@@ -986,29 +985,29 @@ DEFUN (show_bgp_ip_vpn_rd,
       vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
-  return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), &prd, bgp_show_type_normal, NULL, 0, 0);
+  return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, 0);
 }
 
-DEFUN (show_bgp_ip_vpn_all_tags,
-       show_bgp_ip_vpn_all_tags_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn all tags",
+DEFUN (show_ip_bgp_vpnv4_all_tags,
+       show_ip_bgp_vpnv4_all_tags_cmd,
+       "show ip bgp vpnv4 all tags",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information about all VPNv4 NLRIs\n"
        "Display BGP tags for prefixes\n")
 {
-  return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), NULL, bgp_show_type_normal, NULL,  1, 0);
+  return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL,  1, 0);
 }
 
-DEFUN (show_bgp_ip_vpn_rd_tags,
-       show_bgp_ip_vpn_rd_tags_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn tags",
+DEFUN (show_ip_bgp_vpnv4_rd_tags,
+       show_ip_bgp_vpnv4_rd_tags_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information for a route distinguisher\n"
        "VPN Route Distinguisher\n"
        "Display BGP tags for prefixes\n")
@@ -1016,26 +1015,25 @@ DEFUN (show_bgp_ip_vpn_rd_tags,
   int ret;
   struct prefix_rd prd;
 
-  ret = str2prefix_rd (argv[1], &prd);
+  ret = str2prefix_rd (argv[0], &prd);
   if (! ret)
     {
       vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
-  return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), &prd, bgp_show_type_normal, NULL, 1, 0);
+  return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1, 0);
 }
 
-DEFUN (show_bgp_ip_vpn_all_neighbor_routes,
-       show_bgp_ip_vpn_all_neighbor_routes_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn all neighbors (A.B.C.D|X:X::X:X) routes {json}",
+DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
+       show_ip_bgp_vpnv4_all_neighbor_routes_cmd,
+       "show ip bgp vpnv4 all neighbors A.B.C.D routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information about all VPNv4 NLRIs\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
-       "Neighbor to display information about\n"
        "Display routes learned from neighbor\n"
        "JavaScript Object Notation\n")
 {
@@ -1043,9 +1041,8 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_routes,
   struct peer *peer;
   int ret;
   u_char uj = use_json(argc, argv);
-  afi_t afi = bgp_vty_afi_from_arg(argv[0]);
 
-  ret = str2sockunion (argv[1], &su);
+  ret = str2sockunion (argv[0], &su);
   if (ret < 0)
     {
       if (uj)
@@ -1062,7 +1059,7 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_routes,
     }
 
   peer = peer_lookup (NULL, &su);
-  if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
+  if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
     {
       if (uj)
         {
@@ -1077,21 +1074,20 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_routes,
       return CMD_WARNING;
     }
 
-  return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_neighbor, &su, 0, uj);
+  return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0, uj);
 }
 
-DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
-       show_bgp_ip_vpn_rd_neighbor_routes_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes {json}",
+DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
+       show_ip_bgp_vpnv4_rd_neighbor_routes_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information for a route distinguisher\n"
        "VPN Route Distinguisher\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
-       "Neighbor to display information about\n"
        "Display routes learned from neighbor\n"
        "JavaScript Object Notation\n")
 {
@@ -1100,9 +1096,8 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
   struct peer *peer;
   struct prefix_rd prd;
   u_char uj = use_json(argc, argv);
-  afi_t afi = bgp_vty_afi_from_arg(argv[0]);
 
-  ret = str2prefix_rd (argv[1], &prd);
+  ret = str2prefix_rd (argv[0], &prd);
   if (! ret)
     {
       if (uj)
@@ -1118,7 +1113,7 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
       return CMD_WARNING;
     }
 
-  ret = str2sockunion (argv[2], &su);
+  ret = str2sockunion (argv[1], &su);
   if (ret < 0)
     {
       if (uj)
@@ -1135,7 +1130,7 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
     }
 
   peer = peer_lookup (NULL, &su);
-  if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
+  if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
     {
       if (uj)
         {
@@ -1150,20 +1145,19 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
       return CMD_WARNING;
     }
 
-  return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_neighbor, &su, 0, uj);
+  return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0, uj);
 }
 
-DEFUN (show_bgp_ip_vpn_all_neighbor_advertised_routes,
-       show_bgp_ip_vpn_all_neighbor_advertised_routes_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn all neighbors (A.B.C.D|X:X::X:X) advertised-routes {json}",
+DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
+       show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd,
+       "show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
-       "Display information about all VPN NLRIs\n"
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
-       "Neighbor to display information about\n"
        "Display the routes advertised to a BGP neighbor\n"
        "JavaScript Object Notation\n")
 {
@@ -1171,9 +1165,8 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_advertised_routes,
   struct peer *peer;
   union sockunion su;
   u_char uj = use_json(argc, argv);
-  afi_t afi = bgp_vty_afi_from_arg(argv[0]);
 
-  ret = str2sockunion (argv[1], &su);
+  ret = str2sockunion (argv[0], &su);
   if (ret < 0)
     {
       if (uj)
@@ -1189,7 +1182,7 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_advertised_routes,
       return CMD_WARNING;
     }
   peer = peer_lookup (NULL, &su);
-  if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
+  if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
     {
       if (uj)
         {
@@ -1204,21 +1197,20 @@ DEFUN (show_bgp_ip_vpn_all_neighbor_advertised_routes,
       return CMD_WARNING;
     }
 
-  return show_adj_route_vpn (vty, peer, afi, NULL, uj);
+  return show_adj_route_vpn (vty, peer, NULL, uj);
 }
 
-DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
-       show_bgp_ip_vpn_rd_neighbor_advertised_routes_cmd,
-       "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes {json}",
+DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
+       show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
        "Display information for a route distinguisher\n"
        "VPN Route Distinguisher\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
-       "Neighbor to display information about\n"
        "Display the routes advertised to a BGP neighbor\n"
        "JavaScript Object Notation\n")
 {
@@ -1227,9 +1219,8 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
   struct prefix_rd prd;
   union sockunion su;
   u_char uj = use_json(argc, argv);
-  afi_t afi = bgp_vty_afi_from_arg(argv[0]);
 
-  ret = str2sockunion (argv[2], &su);
+  ret = str2sockunion (argv[1], &su);
   if (ret < 0)
     {
       if (uj)
@@ -1241,11 +1232,11 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
           json_object_free(json_no);
         }
       else
-        vty_out (vty, "Malformed address: %s%s", argv[2], VTY_NEWLINE);
+        vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
       return CMD_WARNING;
     }
   peer = peer_lookup (NULL, &su);
-  if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
+  if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
     {
       if (uj)
         {
@@ -1260,7 +1251,7 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
       return CMD_WARNING;
     }
 
-  ret = str2prefix_rd (argv[1], &prd);
+  ret = str2prefix_rd (argv[0], &prd);
   if (! ret)
     {
       if (uj)
@@ -1276,7 +1267,7 @@ DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
       return CMD_WARNING;
     }
 
-  return show_adj_route_vpn (vty, peer, afi, &prd, uj);
+  return show_adj_route_vpn (vty, peer, &prd, uj);
 }
 
 void
@@ -1290,12 +1281,12 @@ bgp_mplsvpn_init (void)
   install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
   install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd);
   install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_all_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_all_tags_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_tags_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_all_neighbor_routes_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_neighbor_routes_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_all_neighbor_advertised_routes_cmd);
-  install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_neighbor_advertised_routes_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd);
 }
index 9e1ae854d476777e4a7c63b924621f1cfbf0eea5..c717a930b11a924a32a1cd2f20ec6d60995bc8f4 100644 (file)
@@ -6416,8 +6416,7 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
                safi == SAFI_ENCAP ||
                !BGP_ATTR_NEXTHOP_AFI_IP6(attr)))
             {
-              if (attr->extra && 
-                  (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP))
+              if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
                 vty_out (vty, "%-16s",
                          inet_ntoa (attr->extra->mp_nexthop_global_in));
               else
@@ -6428,15 +6427,13 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
             {
               int len;
               char buf[BUFSIZ];
-              if (attr->extra)
-                {
-                  len = vty_out (vty, "%s",
-                                 inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
-                                            buf, BUFSIZ));
-                  len = 16 - len;
-                }
-              else
-                len = 0;
+
+              assert (attr->extra);
+
+              len = vty_out (vty, "%s",
+                             inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global,
+                             buf, BUFSIZ));
+              len = 16 - len;
               if (len < 1)
                 vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " ");
               else
@@ -8160,12 +8157,13 @@ DEFUN (show_ip_bgp,
 
 DEFUN (show_ip_bgp_ipv4,
        show_ip_bgp_ipv4_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" {json}",
+       "show ip bgp ipv4 (unicast|multicast) {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
@@ -8177,11 +8175,12 @@ DEFUN (show_ip_bgp_ipv4,
 
 ALIAS (show_ip_bgp_ipv4,
        show_bgp_ipv4_safi_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" {json}",
+       "show bgp ipv4 (unicast|multicast) {json}",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "JavaScript Object Notation\n")
 
 DEFUN (show_ip_bgp_route,
@@ -8217,10 +8216,10 @@ DEFUN (show_ip_bgp_route_pathtype,
 
 DEFUN (show_bgp_ipv4_safi_route_pathtype,
        show_bgp_ipv4_safi_route_pathtype_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D (bestpath|multipath) {json}",
+       "show bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D (bestpath|multipath) {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "Display only the bestpath\n"
        "Display only multipaths\n"
@@ -8276,11 +8275,11 @@ DEFUN (show_bgp_ipv6_prefix,
 
 DEFUN (show_ip_bgp_ipv4_route,
        show_ip_bgp_ipv4_route_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D {json}",
+       "show ip bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Network in the BGP routing table to display\n"
        "JavaScript Object Notation\n")
 {
@@ -8293,12 +8292,26 @@ DEFUN (show_ip_bgp_ipv4_route,
 
 ALIAS (show_ip_bgp_ipv4_route,
        show_bgp_ipv4_safi_route_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D {json}",
+       "show bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D {json}",
+       SHOW_STR
+       BGP_STR
+       AFI_SAFI_STR
+       "Network in the BGP routing table to display\n"
+       "JavaScript Object Notation\n")
+
+DEFUN (show_ip_bgp_vpnv4_all_route,
+       show_ip_bgp_vpnv4_all_route_cmd,
+       "show ip bgp vpnv4 all A.B.C.D {json}",
        SHOW_STR
+       IP_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
        "Network in the BGP routing table to display\n"
        "JavaScript Object Notation\n")
+{
+  return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv));
+}
 
 DEFUN (show_bgp_ipv4_safi_rd_route,
        show_bgp_ipv4_safi_rd_route_cmd,
@@ -8419,6 +8432,31 @@ DEFUN (show_bgp_ipv6_safi_rd_prefix,
   return bgp_show_route (vty, NULL, argv[2], AFI_IP6, safi, &prd, 1, BGP_PATH_ALL, use_json (argc, argv));
 }
 
+DEFUN (show_ip_bgp_vpnv4_rd_route,
+       show_ip_bgp_vpnv4_rd_route_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
+       "Network in the BGP routing table to display\n"
+       "JavaScript Object Notation\n")
+{
+  int ret;
+  struct prefix_rd prd;
+  u_char uj= use_json(argc, argv);
+
+  ret = str2prefix_rd (argv[0], &prd);
+  if (! ret)
+    {
+      vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+  return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, uj);
+}
+
 DEFUN (show_ip_bgp_prefix,
        show_ip_bgp_prefix_cmd,
        "show ip bgp A.B.C.D/M {json}",
@@ -8451,11 +8489,11 @@ DEFUN (show_ip_bgp_prefix_pathtype,
 
 DEFUN (show_ip_bgp_ipv4_prefix,
        show_ip_bgp_ipv4_prefix_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M {json}",
+       "show ip bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D/M {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "JavaScript Object Notation\n")
 {
@@ -8468,20 +8506,20 @@ DEFUN (show_ip_bgp_ipv4_prefix,
 
 ALIAS (show_ip_bgp_ipv4_prefix,
        show_bgp_ipv4_safi_prefix_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M {json}",
+       "show bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D/M {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "JavaScript Object Notation\n")
 
 DEFUN (show_ip_bgp_ipv4_prefix_pathtype,
        show_ip_bgp_ipv4_prefix_pathtype_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M (bestpath|multipath) {json}",
+       "show ip bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D/M (bestpath|multipath) {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "Display only the bestpath\n"
        "Display only multipaths\n"
@@ -8501,15 +8539,52 @@ DEFUN (show_ip_bgp_ipv4_prefix_pathtype,
 
 ALIAS (show_ip_bgp_ipv4_prefix_pathtype,
        show_bgp_ipv4_safi_prefix_pathtype_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M (bestpath|multipath) {json}",
+       "show bgp ipv4 (unicast|multicast|vpn|encap) A.B.C.D/M (bestpath|multipath) {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "Display only the bestpath\n"
        "Display only multipaths\n"
        "JavaScript Object Notation\n")
 
+DEFUN (show_ip_bgp_vpnv4_all_prefix,
+       show_ip_bgp_vpnv4_all_prefix_cmd,
+       "show ip bgp vpnv4 all A.B.C.D/M {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+       "JavaScript Object Notation\n")
+{
+  return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL, use_json(argc, argv));
+}
+
+DEFUN (show_ip_bgp_vpnv4_rd_prefix,
+       show_ip_bgp_vpnv4_rd_prefix_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D/M {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
+       "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+       "JavaScript Object Notation\n")
+{
+  int ret;
+  struct prefix_rd prd;
+
+  ret = str2prefix_rd (argv[0], &prd);
+  if (! ret)
+    {
+      vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+  return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json(argc, argv));
+}
 
 DEFUN (show_ip_bgp_view,
        show_ip_bgp_instance_cmd,
@@ -8635,11 +8710,13 @@ ALIAS (show_bgp,
 
 DEFUN (show_bgp_ipv6_safi,
        show_bgp_ipv6_safi_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" {json}",
+       "show bgp ipv6 (unicast|multicast) {json}",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       AFI_SAFI_STR
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
@@ -8684,10 +8761,10 @@ DEFUN (show_bgp_route,
 
 DEFUN (show_bgp_ipv6_safi_route,
        show_bgp_ipv6_safi_route_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" X:X::X:X {json}",
+       "show bgp ipv6 (unicast|multicast|vpn|encap) X:X::X:X {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Network in the BGP routing table to display\n"
        "JavaScript Object Notation\n")
 {
@@ -8728,10 +8805,10 @@ ALIAS (show_bgp_route_pathtype,
 
 DEFUN (show_bgp_ipv6_safi_route_pathtype,
        show_bgp_ipv6_safi_route_pathtype_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" X:X::X:X (bestpath|multipath) {json}",
+       "show bgp ipv6 (unicast|multicast|vpn|encap) X:X::X:X (bestpath|multipath) {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Network in the BGP routing table to display\n"
        "Display only the bestpath\n"
        "Display only multipaths\n"
@@ -8775,10 +8852,10 @@ DEFUN (show_bgp_prefix,
 
 DEFUN (show_bgp_ipv6_safi_prefix,
        show_bgp_ipv6_safi_prefix_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" X:X::X:X/M {json}",
+       "show bgp ipv6 (unicast|multicast|vpn|encap) X:X::X:X/M {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
        "JavaScript Object Notation\n")
 {
@@ -8819,10 +8896,10 @@ ALIAS (show_bgp_prefix_pathtype,
 
 DEFUN (show_bgp_ipv6_safi_prefix_pathtype,
        show_bgp_ipv6_safi_prefix_pathtype_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" X:X::X:X/M (bestpath|multipath) {json}",
+       "show bgp ipv6 (unicast|multicast|vpn|encap) X:X::X:X/M (bestpath|multipath) {json}",
        SHOW_STR
        BGP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
        "Display only the bestpath\n"
        "Display only multipaths\n"
@@ -9245,19 +9322,22 @@ ALIAS (show_ip_bgp_flap_regexp,
 
 DEFUN (show_ip_bgp_ipv4_regexp, 
        show_ip_bgp_ipv4_regexp_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" regexp .LINE",
+       "show ip bgp ipv4 (unicast|multicast) regexp .LINE",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the AS path regular expression\n"
        "A regular-expression to match the BGP AS paths\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_regexp (vty, argc, argv, AFI_IP, safi,
-                          bgp_show_type_regexp);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_MULTICAST,
+                           bgp_show_type_regexp);
+
+  return bgp_show_regexp (vty, argc, argv, AFI_IP, SAFI_UNICAST,
+                         bgp_show_type_regexp);
 }
 
 #ifdef HAVE_IPV6
@@ -9392,19 +9472,22 @@ ALIAS (show_ip_bgp_flap_prefix_list,
 
 DEFUN (show_ip_bgp_ipv4_prefix_list, 
        show_ip_bgp_ipv4_prefix_list_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" prefix-list WORD",
+       "show ip bgp ipv4 (unicast|multicast) prefix-list WORD",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes conforming to the prefix-list\n"
        "IP prefix-list name\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, safi,
-                               bgp_show_type_prefix_list);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST,
+                                bgp_show_type_prefix_list);
+
+  return bgp_show_prefix_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST,
+                              bgp_show_type_prefix_list);
 }
 
 #ifdef HAVE_IPV6
@@ -9538,19 +9621,22 @@ ALIAS (show_ip_bgp_flap_filter_list,
 
 DEFUN (show_ip_bgp_ipv4_filter_list, 
        show_ip_bgp_ipv4_filter_list_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" filter-list WORD",
+       "show ip bgp ipv4 (unicast|multicast) filter-list WORD",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes conforming to the filter-list\n"
        "Regular expression access list name\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, safi,
-                               bgp_show_type_filter_list);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST,
+                                bgp_show_type_filter_list);
+  
+  return bgp_show_filter_list (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST,
+                              bgp_show_type_filter_list);
 }
 
 #ifdef HAVE_IPV6
@@ -9621,53 +9707,61 @@ DEFUN (show_ip_bgp_dampening_info,
 
 DEFUN (show_ip_bgp_ipv4_dampening_parameters,
        show_ip_bgp_ipv4_dampening_parameters_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening parameters",
+       "show ip bgp ipv4 (unicast|multicast) dampening parameters",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display detailed information about dampening\n"
        "Display detail of configured dampening parameters\n")
 {
-    safi_t safi;
-    safi = bgp_vty_safi_from_arg(argv[0]);
-    return bgp_show_dampening_parameters (vty, AFI_IP, safi);
+    if (strncmp(argv[0], "m", 1) == 0)
+      return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_MULTICAST);
+
+    return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST);
 }
 
 
 DEFUN (show_ip_bgp_ipv4_dampening_flap_stats,
        show_ip_bgp_ipv4_dampening_flap_stats_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening flap-statistics",
+       "show ip bgp ipv4 (unicast|multicast) dampening flap-statistics",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display detailed information about dampening\n"
        "Display flap statistics of routes\n")
 {
-    safi_t safi;
-    safi = bgp_vty_safi_from_arg(argv[0]);
-    return bgp_show (vty, NULL, AFI_IP, safi,
+    if (strncmp(argv[0], "m", 1) == 0)
+      return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
                      bgp_show_type_flap_statistics, NULL, 0);
+
+    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
+                 bgp_show_type_flap_statistics, NULL, 0);
 }
 
 DEFUN (show_ip_bgp_ipv4_dampening_dampd_paths,
        show_ip_bgp_ipv4_dampening_dampd_paths_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" dampening dampened-paths",
+       "show ip bgp ipv4 (unicast|multicast) dampening dampened-paths",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display detailed information about dampening\n"
        "Display paths suppressed due to dampening\n")
 {
-    safi_t safi;
-    safi = bgp_vty_safi_from_arg(argv[0]);
-    return bgp_show (vty, NULL, AFI_IP, safi,
+    if (strncmp(argv[0], "m", 1) == 0)
+      return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
                      bgp_show_type_dampend_paths, NULL, 0);
+
+    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
+                 bgp_show_type_dampend_paths, NULL, 0);
 }
 
 static int
@@ -9749,19 +9843,22 @@ ALIAS (show_ip_bgp_flap_route_map,
 
 DEFUN (show_ip_bgp_ipv4_route_map, 
        show_ip_bgp_ipv4_route_map_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" route-map WORD",
+       "show ip bgp ipv4 (unicast|multicast) route-map WORD",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the route-map\n"
        "A route-map to match on\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, safi,
-                             bgp_show_type_route_map);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST,
+                              bgp_show_type_route_map);
+
+  return bgp_show_route_map (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST,
+                            bgp_show_type_route_map);
 }
 
 DEFUN (show_bgp_route_map, 
@@ -9822,18 +9919,21 @@ ALIAS (show_ip_bgp_flap_cidr_only,
 
 DEFUN (show_ip_bgp_ipv4_cidr_only,
        show_ip_bgp_ipv4_cidr_only_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" cidr-only",
+       "show ip bgp ipv4 (unicast|multicast) cidr-only",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display only routes with non-natural netmasks\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show (vty, NULL, AFI_IP, safi,
-                   bgp_show_type_cidr_only, NULL, 0);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
+                    bgp_show_type_cidr_only, NULL, 0);
+
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
+                  bgp_show_type_cidr_only, NULL, 0);
 }
 
 DEFUN (show_ip_bgp_community_all,
@@ -9850,18 +9950,21 @@ DEFUN (show_ip_bgp_community_all,
 
 DEFUN (show_ip_bgp_ipv4_community_all,
        show_ip_bgp_ipv4_community_all_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community",
+       "show ip bgp ipv4 (unicast|multicast) community",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show (vty, NULL, AFI_IP, safi,
-                   bgp_show_type_community_all, NULL, 0);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show (vty, NULL, AFI_IP, SAFI_MULTICAST,
+                    bgp_show_type_community_all, NULL, 0);
+  return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST,
+                  bgp_show_type_community_all, NULL, 0);
 }
 
 #ifdef HAVE_IPV6
@@ -10053,31 +10156,34 @@ ALIAS (show_ip_bgp_community,
 
 DEFUN (show_ip_bgp_ipv4_community,
        show_ip_bgp_ipv4_community_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
        "Do not advertise to any peer (well-known community)\n"
        "Do not export to next AS (well-known community)\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, safi);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_MULTICAST);
+  return bgp_show_community (vty, NULL, argc, argv, 0, AFI_IP, SAFI_UNICAST);
 }
 
 ALIAS (show_ip_bgp_ipv4_community,
        show_ip_bgp_ipv4_community2_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10090,12 +10196,13 @@ ALIAS (show_ip_bgp_ipv4_community,
        
 ALIAS (show_ip_bgp_ipv4_community,
        show_ip_bgp_ipv4_community3_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10112,12 +10219,13 @@ ALIAS (show_ip_bgp_ipv4_community,
        
 ALIAS (show_ip_bgp_ipv4_community,
        show_ip_bgp_ipv4_community4_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10138,11 +10246,14 @@ ALIAS (show_ip_bgp_ipv4_community,
 
 DEFUN (show_bgp_instance_afi_safi_community_all,
        show_bgp_instance_afi_safi_community_all_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
-       BGP_AFI_SAFI_HELP_STR
+       "Address family\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n")
 {
   int afi;
@@ -10157,14 +10268,14 @@ DEFUN (show_bgp_instance_afi_safi_community_all,
       return CMD_WARNING;
     }
 
-  afi = bgp_vty_safi_from_arg(argv[2]);
-  safi = bgp_vty_safi_from_arg(argv[3]);
+  afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
+  safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL, 0);
 }
 
 DEFUN (show_bgp_instance_afi_safi_community,
        show_bgp_instance_afi_safi_community_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export)",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -10181,14 +10292,14 @@ DEFUN (show_bgp_instance_afi_safi_community,
   int afi;
   int safi;
 
-  afi = bgp_vty_safi_from_arg(argv[2]);
-  safi = bgp_vty_safi_from_arg(argv[3]);
+  afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
+  safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   return bgp_show_community (vty, argv[1], argc-4, &argv[4], 0, afi, safi);
 }
 
 ALIAS (show_bgp_instance_afi_safi_community,
        show_bgp_instance_afi_safi_community2_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -10208,7 +10319,7 @@ ALIAS (show_bgp_instance_afi_safi_community,
 
 ALIAS (show_bgp_instance_afi_safi_community,
        show_bgp_instance_afi_safi_community3_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -10232,7 +10343,7 @@ ALIAS (show_bgp_instance_afi_safi_community,
 
 ALIAS (show_bgp_instance_afi_safi_community,
        show_bgp_instance_afi_safi_community4_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -10339,12 +10450,13 @@ ALIAS (show_ip_bgp_community_exact,
 
 DEFUN (show_ip_bgp_ipv4_community_exact,
        show_ip_bgp_ipv4_community_exact_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) exact-match",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10352,19 +10464,21 @@ DEFUN (show_ip_bgp_ipv4_community_exact,
        "Do not export to next AS (well-known community)\n"
        "Exact match of the communities")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, safi);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_MULTICAST);
+  return bgp_show_community (vty, NULL, argc, argv, 1, AFI_IP, SAFI_UNICAST);
 }
 
 ALIAS (show_ip_bgp_ipv4_community_exact,
        show_ip_bgp_ipv4_community2_exact_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10378,12 +10492,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact,
 
 ALIAS (show_ip_bgp_ipv4_community_exact,
        show_ip_bgp_ipv4_community3_exact_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -10401,12 +10516,13 @@ ALIAS (show_ip_bgp_ipv4_community_exact,
        
 ALIAS (show_ip_bgp_ipv4_community_exact,
        show_ip_bgp_ipv4_community4_exact_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
+       "show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the communities\n"
        COMMUNITY_AANN_STR
        "Do not send outside local AS (well-known community)\n"
@@ -11106,19 +11222,21 @@ DEFUN (show_ip_bgp_instance_community_list,
 
 DEFUN (show_ip_bgp_ipv4_community_list,
        show_ip_bgp_ipv4_community_list_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD)",
+       "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the community-list\n"
        "community-list number\n"
        "community-list name\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, safi);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_MULTICAST);
+  
+  return bgp_show_community_list (vty, NULL, argv[1], 0, AFI_IP, SAFI_UNICAST);
 }
 
 DEFUN (show_ip_bgp_community_list_exact,
@@ -11137,20 +11255,22 @@ DEFUN (show_ip_bgp_community_list_exact,
 
 DEFUN (show_ip_bgp_ipv4_community_list_exact,
        show_ip_bgp_ipv4_community_list_exact_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" community-list (<1-500>|WORD) exact-match",
+       "show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Display routes matching the community-list\n"
        "community-list number\n"
        "community-list name\n"
        "Exact match of the communities\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, safi);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_MULTICAST);
+  return bgp_show_community_list (vty, NULL, argv[1], 1, AFI_IP, SAFI_UNICAST);
 }
 
 #ifdef HAVE_IPV6
@@ -11342,19 +11462,22 @@ ALIAS (show_ip_bgp_flap_prefix_longer,
 
 DEFUN (show_ip_bgp_ipv4_prefix_longer,
        show_ip_bgp_ipv4_prefix_longer_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" A.B.C.D/M longer-prefixes",
+       "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M longer-prefixes",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
        "Display route and more specific routes\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, safi,
-                                 bgp_show_type_prefix_longer);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST,
+                                  bgp_show_type_prefix_longer);
+
+  return bgp_show_prefix_longer (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST,
+                                bgp_show_type_prefix_longer);
 }
 
 DEFUN (show_ip_bgp_flap_address,
@@ -11816,18 +11939,37 @@ bgp_table_stats_vty (struct vty *vty, const char *name,
       vty_out (vty, "%% No such BGP instance exists%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
-  afi  = bgp_vty_afi_from_arg(afi_str);
-  if (afi == AFI_MAX)
+  if (strncmp (afi_str, "ipv", 3) == 0)
     {
-      vty_out (vty, "%% Invalid address family \"%s\"%s",
-               afi_str, VTY_NEWLINE);
-      return CMD_WARNING;
+      if (strncmp (afi_str, "ipv4", 4) == 0)
+        afi = AFI_IP;
+      else if (strncmp (afi_str, "ipv6", 4) == 0)
+        afi = AFI_IP6;
+      else
+        {
+          vty_out (vty, "%% Invalid address family %s%s",
+                   afi_str, VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+      if (strncmp (safi_str, "m", 1) == 0)
+        safi = SAFI_MULTICAST;
+      else if (strncmp (safi_str, "u", 1) == 0)
+        safi = SAFI_UNICAST;
+      else if (strncmp (safi_str, "e", 1) == 0)
+        safi = SAFI_ENCAP;
+      else if (strncmp (safi_str, "vpnv4", 5) == 0 || strncmp (safi_str, "vpnv6", 5) == 0)
+        safi = SAFI_MPLS_VPN;
+      else
+        {
+          vty_out (vty, "%% Invalid subsequent address family %s%s",
+                   safi_str, VTY_NEWLINE);
+            return CMD_WARNING;
+      }
     }
-  safi = bgp_vty_safi_from_arg(safi_str);
-  if (safi == SAFI_MAX)
+  else
     {
-      vty_out (vty, "%% Invalid subsequent address family %s%s",
-               safi_str, VTY_NEWLINE);
+      vty_out (vty, "%% Invalid address family \"%s\"%s",
+               afi_str, VTY_NEWLINE);
       return CMD_WARNING;
     }
 
@@ -11836,10 +11978,15 @@ bgp_table_stats_vty (struct vty *vty, const char *name,
 
 DEFUN (show_bgp_statistics,
        show_bgp_statistics_cmd,
-       "show bgp "BGP_AFI_SAFI_CMD_STR" statistics",
+       "show bgp (ipv4|ipv6) (encap|multicast|unicast|vpn) statistics",
        SHOW_STR
        BGP_STR
-       BGP_INSTANCE_HELP_STR
+       "Address family\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "BGP RIB advertisement statistics\n")
 {
   return bgp_table_stats_vty (vty, NULL, argv[0], argv[1]);
@@ -11847,11 +11994,16 @@ DEFUN (show_bgp_statistics,
 
 DEFUN (show_bgp_statistics_view,
        show_bgp_statistics_view_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" statistics",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast|vpn|encap) statistics",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
-       BGP_AFI_SAFI_HELP_STR
+       "Address family\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "BGP RIB advertisement statistics\n")
 {
   return bgp_table_stats_vty (vty, NULL, argv[1], argv[2]);
@@ -12144,12 +12296,13 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts,
 
 DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts,
        show_ip_bgp_ipv4_neighbor_prefix_counts_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12164,9 +12317,36 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts,
   if (! peer)
     return CMD_WARNING;
 
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_peer_counts (vty, peer, AFI_IP, safi, uj);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MULTICAST, uj);
+
+  return bgp_peer_counts (vty, peer, AFI_IP, SAFI_UNICAST, uj);
+}
+
+DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
+       show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd,
+       "show ip bgp vpnv4 all neighbors (A.B.C.D|X:X::X:X|WORD) prefix-counts {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "Neighbor to display information about\n"
+       "Neighbor to display information about\n"
+       "Neighbor on bgp configured interface\n"
+       "Display detailed prefix count information\n"
+       "JavaScript Object Notation\n")
+{
+  struct peer *peer;
+  u_char uj = use_json(argc, argv);
+
+  peer = peer_lookup_in_view (vty, NULL, argv[0], uj);
+  if (! peer)
+    return CMD_WARNING;
+  
+  return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MPLS_VPN, uj);
 }
 
 static void
@@ -12494,12 +12674,13 @@ ALIAS (show_ip_bgp_instance_neighbor_advertised_route,
        "JavaScript Object Notation\n")
 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
        show_ip_bgp_ipv4_neighbor_advertised_route_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12509,8 +12690,6 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
 {
   struct peer *peer;
   const char *rmap_name = NULL;
-  safi_t safi;
-
   u_char uj = use_json(argc, argv); 
 
   peer = peer_lookup_in_view (vty, NULL, argv[1], uj);
@@ -12520,18 +12699,21 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
   if ((argc == 4) || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0))
     rmap_name = argv[2];
 
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return peer_adj_routes (vty, peer, AFI_IP, safi, 0, rmap_name, uj);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, rmap_name, uj);
+  else
+    return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, rmap_name, uj);
 }
 
 ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route,
        show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12783,12 +12965,13 @@ ALIAS (show_ip_bgp_instance_neighbor_received_routes,
 
 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
        show_ip_bgp_ipv4_neighbor_received_routes_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12798,7 +12981,6 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
 {
   struct peer *peer;
   const char *rmap_name = NULL;
-  safi_t safi;
   u_char uj = use_json(argc, argv);
 
   peer = peer_lookup_in_view (vty, NULL, argv[1], uj);
@@ -12808,18 +12990,21 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
   if (argc == 4 || (argc == 3 && argv[2] && strcmp(argv[2], "json") != 0))
     rmap_name = argv[2];
 
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return peer_adj_routes (vty, peer, AFI_IP, safi, 1, rmap_name, uj);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, rmap_name, uj);
+  else
+    return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, rmap_name, uj);
 }
 
 ALIAS (show_ip_bgp_ipv4_neighbor_received_routes,
        show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12829,11 +13014,14 @@ ALIAS (show_ip_bgp_ipv4_neighbor_received_routes,
 
 DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes,
        show_bgp_instance_afi_safi_neighbor_adv_recd_routes_cmd,
-       "show bgp " BGP_INSTANCE_CMD " "BGP_AFI_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}",
+       "show bgp " BGP_INSTANCE_CMD " (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes) {json}",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
-       BGP_AFI_SAFI_HELP_STR
+       "Address family\n"
+       "Address family\n"
+       "Address family modifier\n"
+       "Address family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -12853,8 +13041,8 @@ DEFUN (show_bgp_instance_afi_safi_neighbor_adv_recd_routes,
   if (! peer)
     return CMD_WARNING;
 
-  afi = bgp_vty_safi_from_arg(argv[2]);
-  safi = bgp_vty_safi_from_arg(argv[3]);
+  afi = (strncmp (argv[2], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
+  safi = (strncmp (argv[3], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   in = (strncmp (argv[5], "r", 1) == 0) ? 1 : 0;
 
   return peer_adj_routes (vty, peer, afi, safi, in, NULL, uj);
@@ -12949,12 +13137,13 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
 
 DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter,
        show_ip_bgp_ipv4_neighbor_received_prefix_filter_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -13011,16 +13200,38 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_prefix_filter,
         }
     }
 
+  if (strncmp (argv[0], "m", 1) == 0)
+    {
+      sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_MULTICAST);
+      count =  prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj);
+      if (count)
+        {
+          if (!uj)
+            vty_out (vty, "Address family: IPv4 Multicast%s", VTY_NEWLINE);
+          prefix_bgp_show_prefix_list (vty, AFI_IP, name, uj);
+        }
+      else
+        {
+          if (uj)
+            {
+              json_object *json_no = NULL;
+              json_no = json_object_new_object();
+              json_object_boolean_true_add(json_no, "noFuntionalOutput");
+              vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
+              json_object_free(json_no);
+            }
+          else
+            vty_out (vty, "No functional output%s", VTY_NEWLINE);
+        }
+    }
+  else 
     {
-      safi_t safi;
-      safi = bgp_vty_safi_from_arg(argv[0]);
-      sprintf (name, "%s.%d.%d", peer->host, AFI_IP, safi);
+      sprintf (name, "%s.%d.%d", peer->host, AFI_IP, SAFI_UNICAST);
       count =  prefix_bgp_show_prefix_list (NULL, AFI_IP, name, uj);
       if (count)
         {
           if (!uj)
-            vty_out (vty, "Address family: %s%s", 
-                     afi_safi_print (AFI_IP, safi), VTY_NEWLINE);
+            vty_out (vty, "Address family: IPv4 Unicast%s", VTY_NEWLINE);
           prefix_bgp_show_prefix_list (vty, AFI_IP, name, uj);
         }
       else
@@ -13449,12 +13660,13 @@ DEFUN (show_ip_bgp_neighbor_damp,
 
 DEFUN (show_ip_bgp_ipv4_neighbor_routes,
        show_ip_bgp_ipv4_neighbor_routes_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) routes {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
@@ -13463,16 +13675,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_routes,
        "JavaScript Object Notation\n")
 {
   struct peer *peer;
-  safi_t safi;
   u_char uj = use_json(argc, argv);
 
   peer = peer_lookup_in_view (vty, NULL, argv[1], uj);
   if (! peer)
     return CMD_WARNING;
  
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_show_neighbor_route (vty, peer, AFI_IP, safi,
-                                  bgp_show_type_neighbor, uj);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_MULTICAST,
+                                   bgp_show_type_neighbor, uj);
+
+  return bgp_show_neighbor_route (vty, peer, AFI_IP, SAFI_UNICAST,
+                                 bgp_show_type_neighbor, uj);
 }
 
 #ifdef HAVE_IPV6
@@ -14678,6 +14892,8 @@ bgp_route_init (void)
   install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_cmd);
   install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_route_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_prefix_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_cmd);
@@ -14686,6 +14902,8 @@ bgp_route_init (void)
   install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_prefix_pathtype_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_prefix_pathtype_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd);
 
   install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_regexp_cmd);
@@ -14790,6 +15008,7 @@ bgp_route_init (void)
   install_element (ENABLE_NODE, &show_ip_bgp_neighbor_prefix_counts_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_prefix_counts_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd);
+  install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd);
 #ifdef HAVE_IPV6
   install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_prefix_counts_cmd);
   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_prefix_counts_cmd);
index d0cce4a955f6585ef12389fc800e8ca1fd052f57..ea42cb57c98084e94458584630b6a1e4a0f00535 100644 (file)
@@ -2342,6 +2342,63 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd =
 
 #endif /* HAVE_IPV6 */
 
+/* `set vpnv4 nexthop A.B.C.D' */
+
+static route_map_result_t
+route_set_vpnv4_nexthop (void *rule, struct prefix *prefix, 
+                        route_map_object_t type, void *object)
+{
+  struct in_addr *address;
+  struct bgp_info *bgp_info;
+
+  if (type == RMAP_BGP)
+    {
+      /* Fetch routemap's rule information. */
+      address = rule;
+      bgp_info = object;
+    
+      /* Set next hop value. */ 
+      (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global_in = *address;
+      (bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_len = 4;
+    }
+
+  return RMAP_OKAY;
+}
+
+static void *
+route_set_vpnv4_nexthop_compile (const char *arg)
+{
+  int ret;
+  struct in_addr *address;
+
+  address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
+
+  ret = inet_aton (arg, address);
+
+  if (ret == 0)
+    {
+      XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
+      return NULL;
+    }
+
+  return address;
+}
+
+static void
+route_set_vpnv4_nexthop_free (void *rule)
+{
+  XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+/* Route map commands for ip nexthop set. */
+struct route_map_rule_cmd route_set_vpnv4_nexthop_cmd =
+{
+  "vpnv4 next-hop",
+  route_set_vpnv4_nexthop,
+  route_set_vpnv4_nexthop_compile,
+  route_set_vpnv4_nexthop_free
+};
+
 /* `set originator-id' */
 
 /* For origin set. */
@@ -4443,6 +4500,40 @@ ALIAS (no_set_ipv6_nexthop_local,
        "IPv6 address of next hop\n")
 #endif /* HAVE_IPV6 */
 
+DEFUN (set_vpnv4_nexthop,
+       set_vpnv4_nexthop_cmd,
+       "set vpnv4 next-hop A.B.C.D",
+       SET_STR
+       "VPNv4 information\n"
+       "VPNv4 next-hop address\n"
+       "IP address of next hop\n")
+{
+  return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[0]);
+}
+
+DEFUN (no_set_vpnv4_nexthop,
+       no_set_vpnv4_nexthop_cmd,
+       "no set vpnv4 next-hop",
+       NO_STR
+       SET_STR
+       "VPNv4 information\n"
+       "VPNv4 next-hop address\n")
+{
+  if (argc == 0)
+    return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
+
+  return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[0]);
+}
+
+ALIAS (no_set_vpnv4_nexthop,
+       no_set_vpnv4_nexthop_val_cmd,
+       "no set vpnv4 next-hop A.B.C.D",
+       NO_STR
+       SET_STR
+       "VPNv4 information\n"
+       "VPNv4 next-hop address\n"
+       "IP address of next hop\n")
+
 DEFUN (set_originator_id,
        set_originator_id_cmd,
        "set originator-id A.B.C.D",
@@ -4513,6 +4604,7 @@ bgp_route_map_init (void)
   route_map_install_set (&route_set_aggregator_as_cmd);
   route_map_install_set (&route_set_community_cmd);
   route_map_install_set (&route_set_community_delete_cmd);
+  route_map_install_set (&route_set_vpnv4_nexthop_cmd);
   route_map_install_set (&route_set_originator_id_cmd);
   route_map_install_set (&route_set_ecommunity_rt_cmd);
   route_map_install_set (&route_set_ecommunity_soo_cmd);
@@ -4618,6 +4710,9 @@ bgp_route_map_init (void)
   install_element (RMAP_NODE, &set_ecommunity_soo_cmd);
   install_element (RMAP_NODE, &no_set_ecommunity_soo_cmd);
   install_element (RMAP_NODE, &no_set_ecommunity_soo_val_cmd);
+  install_element (RMAP_NODE, &set_vpnv4_nexthop_cmd);
+  install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd);
+  install_element (RMAP_NODE, &no_set_vpnv4_nexthop_val_cmd);
   install_element (RMAP_NODE, &set_originator_id_cmd);
   install_element (RMAP_NODE, &no_set_originator_id_cmd);
   install_element (RMAP_NODE, &no_set_originator_id_val_cmd);
index a27a5f6b26a328c9ea997ea9707eec38d4c80cad..b435543e3945bc5f5fda792a49aa485b2d1837e5 100644 (file)
@@ -107,33 +107,22 @@ bgp_node_safi (struct vty *vty)
   return safi;
 }
 
-/* supports (ipv4|ipv6) */
-afi_t
-bgp_vty_afi_from_arg(const char *afi_str)
+int
+bgp_parse_afi(const char *str, afi_t *afi)
 {
-  afi_t afi = AFI_MAX;       /* unknown */
-  if (!strcmp(afi_str, "ipv4")) {
-    afi = AFI_IP;
+    if (!strcmp(str, "ipv4")) {
+       *afi = AFI_IP;
+       return 0;
     }
 #ifdef HAVE_IPV6
-  else if (!strcmp(afi_str, "ipv6")) {
-    afi = AFI_IP6;
-  }
+    if (!strcmp(str, "ipv6")) {
+       *afi = AFI_IP6;
+       return 0;
+    }
 #endif /* HAVE_IPV6 */
-  return afi;
-}
-
-int
-bgp_parse_afi(const char *str, afi_t *afi)
-{
-  *afi = bgp_vty_afi_from_arg(str);
-  if (*afi != AFI_MAX)
-    return 0;
-  else
     return -1;
 }
 
-
 /* supports (unicast|multicast|vpn|encap) */
 safi_t
 bgp_vty_safi_from_arg(const char *safi_str) 
@@ -146,7 +135,7 @@ bgp_vty_safi_from_arg(const char *safi_str)
   else if (strncmp (safi_str, "e", 1) == 0)
     safi = SAFI_ENCAP;
   else if (strncmp (safi_str, "v", 1) == 0)
-    safi = SAFI_MPLS_VPN;
+   safi = SAFI_MPLS_VPN;
   return safi;
 }
 
@@ -370,8 +359,10 @@ bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
     {
     case BGP_ERR_AF_UNCONFIGURED:
       vty_out (vty,
-              "%%BGP: Enable %s address family for the neighbor %s%s",
-              afi_safi_print(afi, safi), peer->host, VTY_NEWLINE);
+              "%%BGP: Enable %s %s address family for the neighbor %s%s",
+              afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
+              safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
+              peer->host, VTY_NEWLINE);
       break;
     case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
       vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s      has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE);
@@ -6066,10 +6057,9 @@ DEFUN (address_family_ipv4,
 
 DEFUN (address_family_ipv4_safi,
        address_family_ipv4_safi_cmd,
-       "address-family ipv4 "BGP_SAFI_CMD_STR,
+       "address-family ipv4 (unicast|multicast)",
        "Enter Address Family command mode\n"
-       "Address Family\n"
-       BGP_SAFI_HELP_STR)
+       AFI_SAFI_STR)
 {
   switch (bgp_vty_safi_from_arg(argv[0]))
     {
@@ -6103,28 +6093,16 @@ DEFUN (address_family_ipv6,
 
 DEFUN (address_family_ipv6_safi,
        address_family_ipv6_safi_cmd,
-       "address-family ipv6 "BGP_SAFI_CMD_STR,
+       "address-family ipv6 (unicast|multicast)",
        "Enter Address Family command mode\n"
-       "Address Family\n"
-       BGP_SAFI_HELP_STR)
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n")
 {
-  int idx_safi = 0;
-  switch (bgp_vty_safi_from_arg(argv[idx_safi]))
-    {
-    case SAFI_MULTICAST:
-      vty->node = BGP_IPV6M_NODE;
-      break;
-    case SAFI_ENCAP:
-      vty->node = BGP_ENCAPV6_NODE;
-      break;
-    case SAFI_MPLS_VPN:
-      vty->node = BGP_VPNV6_NODE;
-      break;
-    case SAFI_UNICAST:
-    default:
-      vty->node = BGP_IPV6_NODE;
-      break;
-    }
+  if (strncmp (argv[0], "m", 1) == 0)
+    vty->node = BGP_IPV6M_NODE;
+  else
+    vty->node = BGP_IPV6_NODE;
 
   return CMD_SUCCESS;
 }
@@ -6139,6 +6117,13 @@ DEFUN (address_family_vpnv4,
   return CMD_SUCCESS;
 }
 
+ALIAS (address_family_vpnv4,
+       address_family_vpnv4_unicast_cmd,
+       "address-family vpnv4 unicast",
+       "Enter Address Family command mode\n"
+       "Address family\n"
+       "Address Family Modifier\n")
+
 DEFUN (address_family_vpnv6,
        address_family_vpnv6_cmd,
        "address-family vpnv6",
@@ -6149,6 +6134,13 @@ DEFUN (address_family_vpnv6,
   return CMD_SUCCESS;
 }
 
+ALIAS (address_family_vpnv6,
+       address_family_vpnv6_unicast_cmd,
+       "address-family vpnv6 unicast",
+       "Enter Address Family command mode\n"
+       "Address family\n"
+       "Address Family Modifier\n")
+
 DEFUN (address_family_encap,
        address_family_encap_cmd,
        "address-family encap",
@@ -6659,63 +6651,125 @@ ALIAS (clear_ip_bgp_all_soft_out,
 
 DEFUN (clear_ip_bgp_all_ipv4_soft_out,
        clear_ip_bgp_all_ipv4_soft_out_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp * ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_all,
-                        BGP_CLEAR_SOFT_OUT, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
+                         BGP_CLEAR_SOFT_OUT, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
+                       BGP_CLEAR_SOFT_OUT, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
        clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_all,
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
+                          BGP_CLEAR_SOFT_OUT, NULL);
+
+  return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
                         BGP_CLEAR_SOFT_OUT, NULL);
 }
 
 ALIAS (clear_ip_bgp_all_ipv4_soft_out,
        clear_ip_bgp_all_ipv4_out_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp * ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out,
        clear_ip_bgp_instance_all_ipv4_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       BGP_SOFT_OUT_STR)
+
+DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
+       clear_ip_bgp_all_vpnv4_soft_out_cmd,
+       "clear ip bgp * vpnv4 unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR
+       BGP_SOFT_OUT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
+                       BGP_CLEAR_SOFT_OUT, NULL);
+}
+
+ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
+       clear_ip_bgp_all_vpnv4_out_cmd,
+       "clear ip bgp * vpnv4 unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
        BGP_SOFT_OUT_STR)
 
+DEFUN (clear_ip_bgp_all_encap_soft_out,
+       clear_ip_bgp_all_encap_soft_out_cmd,
+       "clear ip bgp * encap unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig outbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
+                       BGP_CLEAR_SOFT_OUT, NULL);
+}
+
+ALIAS (clear_ip_bgp_all_encap_soft_out,
+       clear_ip_bgp_all_encap_out_cmd,
+       "clear ip bgp * encap unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig outbound update\n")
+
 DEFUN (clear_bgp_all_soft_out,
        clear_bgp_all_soft_out_cmd,
        "clear bgp * soft out",
@@ -6802,7 +6856,7 @@ ALIAS (clear_bgp_all_soft_out,
 
 DEFUN (clear_bgp_ipv6_safi_prefix,
        clear_bgp_ipv6_safi_prefix_cmd,
-       "clear bgp ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M",
+       "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
        CLEAR_STR
        BGP_STR
        "Address family\n"
@@ -6810,14 +6864,15 @@ DEFUN (clear_bgp_ipv6_safi_prefix,
        "Clear bestpath and re-advertise\n"
        "IPv6 prefix <network>/<length>,  e.g.,  3ffe::/16\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, safi, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
+  else
+    return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
 }
 
 DEFUN (clear_bgp_instance_ipv6_safi_prefix,
        clear_bgp_instance_ipv6_safi_prefix_cmd,
-       "clear bgp " BGP_INSTANCE_CMD " ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M",
+       "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M",
        CLEAR_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -6826,9 +6881,10 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix,
        "Clear bestpath and re-advertise\n"
        "IPv6 prefix <network>/<length>,  e.g.,  3ffe::/16\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, safi, NULL);
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL);
+  else
+    return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL);
 }
 
 DEFUN (clear_ip_bgp_peer_soft_out,
@@ -6885,26 +6941,29 @@ ALIAS (clear_ip_bgp_peer_soft_out,
 
 DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
        clear_ip_bgp_peer_ipv4_soft_out_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_OUT, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_OUT, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out,
        clear_ip_bgp_instance_peer_ipv4_soft_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -6912,31 +6971,35 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out,
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_OUT, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_OUT, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_OUT, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
        clear_ip_bgp_peer_ipv4_out_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out,
        clear_ip_bgp_instance_peer_ipv4_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -6944,9 +7007,67 @@ ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out,
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       BGP_SOFT_OUT_STR)
+
+/* NOTE: WORD peers have not been tested for vpnv4 */
+DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
+       clear_ip_bgp_peer_vpnv4_soft_out_cmd,
+       "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "BGP neighbor on interface to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR
+       BGP_SOFT_OUT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
+       clear_ip_bgp_peer_vpnv4_out_cmd,
+       "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "BGP neighbor on interface to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
        BGP_SOFT_OUT_STR)
 
+DEFUN (clear_ip_bgp_peer_encap_soft_out,
+       clear_ip_bgp_peer_encap_soft_out_cmd,
+       "clear ip bgp A.B.C.D encap unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig outbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_peer_encap_soft_out,
+       clear_ip_bgp_peer_encap_out_cmd,
+       "clear ip bgp A.B.C.D encap unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig outbound update\n")
+
 DEFUN (clear_bgp_peer_soft_out,
        clear_bgp_peer_soft_out_cmd,
        "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
@@ -7101,26 +7222,29 @@ ALIAS (clear_ip_bgp_peer_group_soft_out,
 
 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
        clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_OUT, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_OUT, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
        clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -7128,31 +7252,35 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_OUT, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_OUT, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_OUT, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
        clear_ip_bgp_peer_group_ipv4_out_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
        clear_ip_bgp_instance_peer_group_ipv4_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -7160,7 +7288,8 @@ ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 DEFUN (clear_bgp_peer_group_soft_out,
@@ -7305,62 +7434,70 @@ ALIAS (clear_ip_bgp_external_soft_out,
 
 DEFUN (clear_ip_bgp_external_ipv4_soft_out,
        clear_ip_bgp_external_ipv4_soft_out_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp external ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_OUT, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_OUT, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_OUT, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out,
        clear_ip_bgp_instance_external_ipv4_soft_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_OUT, NULL);
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_OUT, NULL);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_OUT, NULL);
 }
 
 ALIAS (clear_ip_bgp_external_ipv4_soft_out,
        clear_ip_bgp_external_ipv4_out_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp external ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out,
        clear_ip_bgp_instance_external_ipv4_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 DEFUN (clear_bgp_external_soft_out,
@@ -7497,64 +7634,126 @@ ALIAS (clear_ip_bgp_as_soft_out,
 
 DEFUN (clear_ip_bgp_as_ipv4_soft_out,
        clear_ip_bgp_as_ipv4_soft_out_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_OUT, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_OUT, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out,
        clear_ip_bgp_instance_as_ipv4_soft_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft out",
+       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_OUT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_OUT, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_OUT, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_OUT, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_as_ipv4_soft_out,
        clear_ip_bgp_as_ipv4_out_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
 ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out,
        clear_ip_bgp_instance_as_ipv4_out_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" out",
+       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       BGP_SOFT_OUT_STR)
+
+DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
+       clear_ip_bgp_as_vpnv4_soft_out_cmd,
+       "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       BGP_SOFT_STR
+       BGP_SOFT_OUT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
+       clear_ip_bgp_as_vpnv4_out_cmd,
+       "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
        BGP_SOFT_OUT_STR)
 
+DEFUN (clear_ip_bgp_as_encap_soft_out,
+       clear_ip_bgp_as_encap_soft_out_cmd,
+       "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig outbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
+                       BGP_CLEAR_SOFT_OUT, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_as_encap_soft_out,
+       clear_ip_bgp_as_encap_out_cmd,
+       "clear ip bgp " CMD_AS_RANGE " encap unicast out",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Soft reconfig outbound update\n")
+
 DEFUN (clear_bgp_as_soft_out,
        clear_bgp_as_soft_out_cmd,
        "clear bgp " CMD_AS_RANGE " soft out",
@@ -7708,82 +7907,147 @@ DEFUN (clear_ip_bgp_all_in_prefix_filter,
 
 DEFUN (clear_ip_bgp_all_ipv4_soft_in,
        clear_ip_bgp_all_ipv4_soft_in_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp * ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_all,
-                        BGP_CLEAR_SOFT_IN, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
+                         BGP_CLEAR_SOFT_IN, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
+                       BGP_CLEAR_SOFT_IN, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
        clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_all,
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
+                          BGP_CLEAR_SOFT_IN, NULL);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
                         BGP_CLEAR_SOFT_IN, NULL);
 }
 
 ALIAS (clear_ip_bgp_all_ipv4_soft_in,
        clear_ip_bgp_all_ipv4_in_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp * ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in,
        clear_ip_bgp_instance_all_ipv4_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
        clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" in prefix-filter",
+       "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR
        "Push out prefix-list ORF and do inbound soft reconfig\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_all,
-                        BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
+                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
+                       BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
+}
+
+DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
+       clear_ip_bgp_all_vpnv4_soft_in_cmd,
+       "clear ip bgp * vpnv4 unicast soft in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR
+       BGP_SOFT_IN_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
+                       BGP_CLEAR_SOFT_IN, NULL);
+}
+
+ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
+       clear_ip_bgp_all_vpnv4_in_cmd,
+       "clear ip bgp * vpnv4 unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_IN_STR)
+
+DEFUN (clear_ip_bgp_all_encap_soft_in,
+       clear_ip_bgp_all_encap_soft_in_cmd,
+       "clear ip bgp * encap unicast soft in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig inbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
+                       BGP_CLEAR_SOFT_IN, NULL);
 }
 
+ALIAS (clear_ip_bgp_all_encap_soft_in,
+       clear_ip_bgp_all_encap_in_cmd,
+       "clear ip bgp * encap unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig inbound update\n")
+
 DEFUN (clear_bgp_all_soft_in,
        clear_bgp_all_soft_in_cmd,
        "clear bgp * soft in",
@@ -7960,26 +8224,29 @@ DEFUN (clear_ip_bgp_peer_in_prefix_filter,
 
 DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
        clear_ip_bgp_peer_ipv4_soft_in_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_IN, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_IN, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in,
        clear_ip_bgp_instance_peer_ipv4_soft_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -7987,31 +8254,35 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in,
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_IN, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_IN, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_IN, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
        clear_ip_bgp_peer_ipv4_in_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in,
        clear_ip_bgp_instance_peer_ipv4_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -8019,43 +8290,103 @@ ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in,
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
        clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" in prefix-filter",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter",
        CLEAR_STR
        IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
        "BGP neighbor on interface to clear\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR
        "Push out the existing ORF prefix-list\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
 }
 
-DEFUN (clear_bgp_peer_soft_in,
-       clear_bgp_peer_soft_in_cmd,
-       "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
+DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
+       clear_ip_bgp_peer_vpnv4_soft_in_cmd,
+       "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in",
        CLEAR_STR
+       IP_STR
        BGP_STR
        "BGP neighbor address to clear\n"
-       "BGP IPv6 neighbor to clear\n"
        "BGP neighbor on interface to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  if (argc == 3)
-    return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
-                          BGP_CLEAR_SOFT_IN, argv[2]);
-
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
+       clear_ip_bgp_peer_vpnv4_in_cmd,
+       "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "BGP neighbor on interface to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_IN_STR)
+
+DEFUN (clear_ip_bgp_peer_encap_soft_in,
+       clear_ip_bgp_peer_encap_soft_in_cmd,
+       "clear ip bgp A.B.C.D encap unicast soft in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig inbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_peer_encap_soft_in,
+       clear_ip_bgp_peer_encap_in_cmd,
+       "clear ip bgp A.B.C.D encap unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig inbound update\n")
+
+DEFUN (clear_bgp_peer_soft_in,
+       clear_bgp_peer_soft_in_cmd,
+       "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
+       CLEAR_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "BGP IPv6 neighbor to clear\n"
+       "BGP neighbor on interface to clear\n"
+       BGP_SOFT_STR
+       BGP_SOFT_IN_STR)
+{
+  if (argc == 3)
+    return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
+                          BGP_CLEAR_SOFT_IN, argv[2]);
+
   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
                        BGP_CLEAR_SOFT_IN, argv[0]);
 }
@@ -8237,26 +8568,29 @@ DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
 
 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
        clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_IN, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_IN, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
        clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -8264,31 +8598,35 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_IN, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_IN, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_IN, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
        clear_ip_bgp_peer_group_ipv4_in_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
        clear_ip_bgp_instance_peer_group_ipv4_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -8296,26 +8634,30 @@ ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
        clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" in prefix-filter",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR
        "Push out prefix-list ORF and do inbound soft reconfig\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
 }
 
 DEFUN (clear_bgp_peer_group_soft_in,
@@ -8499,80 +8841,91 @@ DEFUN (clear_ip_bgp_external_in_prefix_filter,
 
 DEFUN (clear_ip_bgp_external_ipv4_soft_in,
        clear_ip_bgp_external_ipv4_soft_in_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp external ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_IN, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_IN, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_IN, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in,
        clear_ip_bgp_instance_external_ipv4_soft_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_IN, NULL);
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_IN, NULL);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_IN, NULL);
 }
 
 ALIAS (clear_ip_bgp_external_ipv4_soft_in,
        clear_ip_bgp_external_ipv4_in_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp external ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in,
        clear_ip_bgp_instance_external_ipv4_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
        clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" in prefix-filter",
+       "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR
        "Push out prefix-list ORF and do inbound soft reconfig\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
 }
 
 DEFUN (clear_bgp_external_soft_in,
@@ -8746,82 +9099,147 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter,
 
 DEFUN (clear_ip_bgp_as_ipv4_soft_in,
        clear_ip_bgp_as_ipv4_soft_in_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_IN, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_IN, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in,
        clear_ip_bgp_instance_as_ipv4_soft_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft in",
+       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR
        BGP_SOFT_IN_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_IN, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_IN, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_IN, argv[2]);
 }
 
 ALIAS (clear_ip_bgp_as_ipv4_soft_in,
        clear_ip_bgp_as_ipv4_in_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in,
        clear_ip_bgp_instance_as_ipv4_in_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" in",
+       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR)
 
 DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
        clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" in prefix-filter",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear peers with the AS number\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_IN_STR
        "Push out prefix-list ORF and do inbound soft reconfig\n")
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
 }
 
+DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
+       clear_ip_bgp_as_vpnv4_soft_in_cmd,
+       "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       BGP_SOFT_STR
+       BGP_SOFT_IN_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
+       clear_ip_bgp_as_vpnv4_in_cmd,
+       "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       BGP_SOFT_IN_STR)
+
+DEFUN (clear_ip_bgp_as_encap_soft_in,
+       clear_ip_bgp_as_encap_soft_in_cmd,
+       "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Soft reconfig\n"
+       "Soft reconfig inbound update\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
+                       BGP_CLEAR_SOFT_IN, argv[0]);
+}
+
+ALIAS (clear_ip_bgp_as_encap_soft_in,
+       clear_ip_bgp_as_encap_in_cmd,
+       "clear ip bgp " CMD_AS_RANGE " encap unicast in",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family modifier\n"
+       "Soft reconfig inbound update\n")
+
 DEFUN (clear_bgp_as_soft_in,
        clear_bgp_as_soft_in_cmd,
        "clear bgp " CMD_AS_RANGE " soft in",
@@ -8960,7 +9378,7 @@ ALIAS (clear_ip_bgp_all_soft,
 
 DEFUN (clear_ip_bgp_all_ipv4_soft,
        clear_ip_bgp_all_ipv4_soft_cmd,
-       "clear ip bgp * ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp * ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -8970,15 +9388,17 @@ DEFUN (clear_ip_bgp_all_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_all,
-                        BGP_CLEAR_SOFT_BOTH, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
+                         BGP_CLEAR_SOFT_BOTH, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
+                       BGP_CLEAR_SOFT_BOTH, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
        clear_ip_bgp_instance_all_ipv4_soft_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -8989,12 +9409,44 @@ DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_all,
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
+                          BGP_CLEAR_SOFT_BOTH, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
                         BGP_CLEAR_SOFT_BOTH, NULL);
 }
 
+DEFUN (clear_ip_bgp_all_vpnv4_soft,
+       clear_ip_bgp_all_vpnv4_soft_cmd,
+       "clear ip bgp * vpnv4 unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
+}
+
+DEFUN (clear_ip_bgp_all_encap_soft,
+       clear_ip_bgp_all_encap_soft_cmd,
+       "clear ip bgp * encap unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear all peers\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
+}
+
 DEFUN (clear_bgp_all_soft,
        clear_bgp_all_soft_cmd,
        "clear bgp * soft",
@@ -9070,7 +9522,7 @@ ALIAS (clear_ip_bgp_peer_soft,
 
 DEFUN (clear_ip_bgp_peer_ipv4_soft,
        clear_ip_bgp_peer_ipv4_soft_cmd,
-       "clear ip bgp (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -9081,15 +9533,17 @@ DEFUN (clear_ip_bgp_peer_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_BOTH, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_BOTH, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_ipv4_soft,
        clear_ip_bgp_instance_peer_ipv4_soft_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -9101,10 +9555,43 @@ DEFUN (clear_ip_bgp_instance_peer_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_peer,
-                        BGP_CLEAR_SOFT_BOTH, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
+                         BGP_CLEAR_SOFT_BOTH, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
+                       BGP_CLEAR_SOFT_BOTH, argv[2]);
+}
+
+DEFUN (clear_ip_bgp_peer_vpnv4_soft,
+       clear_ip_bgp_peer_vpnv4_soft_cmd,
+       "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "BGP neighbor on interface to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
+}
+
+DEFUN (clear_ip_bgp_peer_encap_soft,
+       clear_ip_bgp_peer_encap_soft_cmd,
+       "clear ip bgp A.B.C.D encap unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "BGP neighbor address to clear\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
 }
 
 DEFUN (clear_bgp_peer_soft,
@@ -9190,25 +9677,28 @@ ALIAS (clear_ip_bgp_peer_group_soft,
 
 DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
        clear_ip_bgp_peer_group_ipv4_soft_cmd,
-       "clear ip bgp peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_BOTH, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_BOTH, argv[0]);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft,
        clear_ip_bgp_instance_peer_group_ipv4_soft_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -9216,13 +9706,16 @@ DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft,
        "Clear all members of peer-group\n"
        "BGP peer-group name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_group,
-                        BGP_CLEAR_SOFT_BOTH, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
+                         BGP_CLEAR_SOFT_BOTH, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
+                       BGP_CLEAR_SOFT_BOTH, argv[2]);
 }
 
 DEFUN (clear_bgp_peer_group_soft,
@@ -9302,37 +9795,43 @@ ALIAS (clear_ip_bgp_external_soft,
 
 DEFUN (clear_ip_bgp_external_ipv4_soft,
        clear_ip_bgp_external_ipv4_soft_cmd,
-       "clear ip bgp external ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp external ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[0]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_external,
-                        BGP_CLEAR_SOFT_BOTH, NULL);
+  if (strncmp (argv[0], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
+                         BGP_CLEAR_SOFT_BOTH, NULL);
+
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_BOTH, NULL);
 }
 
 DEFUN (clear_ip_bgp_instance_external_ipv4_soft,
        clear_ip_bgp_instance_external_ipv4_soft_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
        "Clear all external peers\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_external,
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
                          BGP_CLEAR_SOFT_BOTH, NULL);
+
+  return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
+                       BGP_CLEAR_SOFT_BOTH, NULL);
 }
 
 DEFUN (clear_bgp_external_soft,
@@ -9408,7 +9907,7 @@ ALIAS (clear_ip_bgp_as_soft,
 
 DEFUN (clear_ip_bgp_as_ipv4_soft,
        clear_ip_bgp_as_ipv4_soft_cmd,
-       "clear ip bgp " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -9418,15 +9917,17 @@ DEFUN (clear_ip_bgp_as_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_clear_vty (vty, NULL, AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_BOTH, argv[0]);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_BOTH, argv[0]);
+
+  return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
 }
 
 DEFUN (clear_ip_bgp_instance_as_ipv4_soft,
        clear_ip_bgp_instance_as_ipv4_soft_cmd,
-       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 "BGP_SAFI_CMD_STR" soft",
+       "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -9437,10 +9938,42 @@ DEFUN (clear_ip_bgp_instance_as_ipv4_soft,
        "Address Family Modifier\n"
        BGP_SOFT_STR)
 {
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[3]);
-  return bgp_clear_vty (vty, argv[1], AFI_IP, safi, clear_as,
-                        BGP_CLEAR_SOFT_BOTH, argv[2]);
+  if (strncmp (argv[3], "m", 1) == 0)
+    return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
+                         BGP_CLEAR_SOFT_BOTH, argv[2]);
+
+  return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as,
+                       BGP_CLEAR_SOFT_BOTH, argv[2]);
+}
+
+DEFUN (clear_ip_bgp_as_vpnv4_soft,
+       clear_ip_bgp_as_vpnv4_soft_cmd,
+       "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       BGP_SOFT_STR)
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
+}
+
+DEFUN (clear_ip_bgp_as_encap_soft,
+       clear_ip_bgp_as_encap_soft_cmd,
+       "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
+       CLEAR_STR
+       IP_STR
+       BGP_STR
+       "Clear peers with the AS number\n"
+       "Address family\n"
+       "Address Family Modifier\n"
+       "Soft reconfig\n")
+{
+  return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
+                       BGP_CLEAR_SOFT_BOTH, argv[0]);
 }
 
 DEFUN (clear_bgp_as_soft,
@@ -10101,10 +10634,10 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
         {
           if (use_json)
             vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
-                    afi_safi_print(afi, safi), VTY_NEWLINE);
+                    afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
           else
             vty_out (vty, "No %s neighbor is configured%s",
-                     afi_safi_print(afi, safi), VTY_NEWLINE);
+                     afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
         }
 
       if (dn_count && ! use_json)
@@ -10119,62 +10652,6 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
   return CMD_SUCCESS;
 }
 
-static void
-bgp_show_summary_afi_safi (struct vty *vty, struct bgp *bgp, int afi, int safi,
-                  u_char use_json, json_object *json)
-{
-  int is_first      = 1;
-  int afi_wildcard  = (afi == AFI_MAX);
-  int safi_wildcard = (safi == SAFI_MAX);
-  int is_wildcard   = (afi_wildcard || safi_wildcard);
-  if (use_json && is_wildcard)
-    vty_out (vty, "{%s", VTY_NEWLINE);
-  if (afi_wildcard)
-    afi = 1;                    /* AFI_IP */
-  while (afi < AFI_MAX)
-    {
-      if (safi_wildcard)
-        safi = 1;                 /* SAFI_UNICAST */
-      while (safi < SAFI_MAX)
-        {
-          if (is_wildcard)
-            {
-              if (use_json)
-                {
-                  json = json_object_new_object();
-
-                  if (! is_first)
-                    vty_out (vty, ",%s", VTY_NEWLINE);
-                  else
-                    is_first = 0;
-
-                  vty_out(vty, "\"%s\":", afi_safi_json(afi, safi));
-                }
-              else
-                {
-                  vty_out (vty, "%s%s Summary:%s",
-                           VTY_NEWLINE, afi_safi_print(afi, safi), VTY_NEWLINE);
-                }
-            }
-          bgp_show_summary (vty, bgp, afi, safi, use_json, json);
-          if (safi == SAFI_MPLS_VPN) /* handle special cases to match zebra.h */
-            safi = SAFI_ENCAP;
-          else
-              safi++;
-          if (! safi_wildcard)
-            safi = SAFI_MAX;
-        }
-      afi++;
-      if (! afi_wildcard ||
-          afi == AFI_ETHER)       /* special case, not handled yet */
-        afi = AFI_MAX;
-    }
-
-  if (use_json && is_wildcard)
-    vty_out (vty, "}%s", VTY_NEWLINE);
-
-}
-
 static int
 bgp_show_summary_vty (struct vty *vty, const char *name,
                       afi_t afi, safi_t safi, u_char use_json)
@@ -10191,14 +10668,14 @@ bgp_show_summary_vty (struct vty *vty, const char *name,
          return CMD_WARNING;
        }
 
-      bgp_show_summary_afi_safi (vty, bgp, afi, safi, use_json, NULL);
+      bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
       return CMD_SUCCESS;
     }
 
   bgp = bgp_get_default ();
 
   if (bgp)
-    bgp_show_summary_afi_safi (vty, bgp, afi, safi, use_json, NULL);
+    bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
 
   return CMD_SUCCESS;
 }
@@ -10243,7 +10720,7 @@ bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi,
                    (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
                    ? "Default" : bgp->name, VTY_NEWLINE);
         }
-      bgp_show_summary_afi_safi (vty, bgp, afi, safi, use_json, json);
+      bgp_show_summary (vty, bgp, afi, safi, use_json, json);
     }
 
   if (use_json)
@@ -10262,7 +10739,7 @@ DEFUN (show_ip_bgp_summary,
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
-  return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MAX, uj);
+  return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
 }
 
 DEFUN (show_ip_bgp_instance_summary,
@@ -10276,7 +10753,7 @@ DEFUN (show_ip_bgp_instance_summary,
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
-  return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_MAX, uj);
+  return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj);
 }
 
 DEFUN (show_ip_bgp_instance_all_summary,
@@ -10291,18 +10768,17 @@ DEFUN (show_ip_bgp_instance_all_summary,
 {
   u_char uj = use_json(argc, argv);
 
-  bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_MAX, uj);
+  bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj);
   return CMD_SUCCESS;
 }
 
 DEFUN (show_ip_bgp_ipv4_summary, 
        show_ip_bgp_ipv4_summary_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" summary {json}",
+       "show ip bgp ipv4 (unicast|multicast|vpn|encap) summary {json}",
        SHOW_STR
        IP_STR
        BGP_STR
-       "Address family\n"
-       BGP_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
@@ -10313,42 +10789,84 @@ DEFUN (show_ip_bgp_ipv4_summary,
 
 ALIAS (show_ip_bgp_ipv4_summary,
        show_bgp_ipv4_safi_summary_cmd,
-       "show bgp ipv4 "BGP_SAFI_CMD_STR" summary {json}",
+       "show bgp ipv4 (unicast|multicast|vpn|encap) summary {json}",
        SHOW_STR
        BGP_STR
-       "Address family\n"
-       BGP_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Summary of BGP neighbor status\n")
 
 DEFUN (show_ip_bgp_instance_ipv4_summary,
        show_ip_bgp_instance_ipv4_summary_cmd,
-       "show ip bgp view WORD ipv4 "BGP_SAFI_CMD_STR" summary {json}",
+       "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[1]);
-  return bgp_show_summary_vty (vty, argv[0], AFI_IP, safi, uj);
+  if (strncmp (argv[1], "m", 1) == 0)
+    return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj);
+  else
+    return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
 }
 
 ALIAS (show_ip_bgp_instance_ipv4_summary,
        show_bgp_instance_ipv4_safi_summary_cmd,
-       "show bgp view WORD ipv4 "BGP_SAFI_CMD_STR" summary {json}",
+       "show bgp view WORD ipv4 (unicast|multicast) summary {json}",
        SHOW_STR
        BGP_STR
        "BGP view\n"
        "View name\n"
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Summary of BGP neighbor status\n")
 
+DEFUN (show_ip_bgp_vpnv4_all_summary,
+       show_ip_bgp_vpnv4_all_summary_cmd,
+       "show ip bgp vpnv4 all summary {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Summary of BGP neighbor status\n"
+       "JavaScript Object Notation\n")
+{
+  u_char uj = use_json(argc, argv);
+  return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
+}
+
+DEFUN (show_ip_bgp_vpnv4_rd_summary,
+       show_ip_bgp_vpnv4_rd_summary_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
+       "Summary of BGP neighbor status\n"
+       "JavaScript Object Notation\n")
+{
+  int ret;
+  struct prefix_rd prd;
+  u_char uj = use_json(argc, argv);
+
+  ret = str2prefix_rd (argv[0], &prd);
+  if (! ret)
+    {
+      vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
+  return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
+}
+
 #ifdef HAVE_IPV6
 DEFUN (show_bgp_summary,
        show_bgp_summary_cmd,
@@ -10358,7 +10876,7 @@ DEFUN (show_bgp_summary,
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
-  return bgp_show_summary_vty (vty, NULL, AFI_MAX, SAFI_MAX, use_json(argc, argv));
+  return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
 }
 
 DEFUN (show_bgp_instance_summary,
@@ -10370,7 +10888,7 @@ DEFUN (show_bgp_instance_summary,
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
-  return bgp_show_summary_vty (vty, argv[1], AFI_MAX, SAFI_MAX, use_json(argc, argv));
+  return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
 }
 
 DEFUN (show_bgp_instance_all_summary,
@@ -10384,22 +10902,19 @@ DEFUN (show_bgp_instance_all_summary,
 {
   u_char uj = use_json(argc, argv);
 
-  bgp_show_all_instances_summary_vty (vty, AFI_MAX, SAFI_MAX, uj);
+  bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
   return CMD_SUCCESS;
 }
 
-DEFUN (show_bgp_ipv6_summary, 
+ALIAS (show_bgp_summary, 
        show_bgp_ipv6_summary_cmd,
        "show bgp ipv6 summary {json}",
        SHOW_STR
        BGP_STR
        "Address family\n"
        "Summary of BGP neighbor status\n")
-{
-  return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MAX, use_json(argc, argv));
-}
 
-DEFUN (show_bgp_instance_ipv6__summary,
+ALIAS (show_bgp_instance_summary,
        show_bgp_instance_ipv6_summary_cmd,
        "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}",
        SHOW_STR
@@ -10407,17 +10922,13 @@ DEFUN (show_bgp_instance_ipv6__summary,
        BGP_INSTANCE_HELP_STR
        "Address family\n"
        "Summary of BGP neighbor status\n")
-{
-  return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MAX, use_json(argc, argv));
-}
 
 DEFUN (show_bgp_ipv6_safi_summary,
        show_bgp_ipv6_safi_summary_cmd,
-       "show bgp ipv6 "BGP_SAFI_CMD_STR" summary {json}",
+       "show bgp ipv6 (unicast|multicast|vpn|encap) summary {json}",
        SHOW_STR
        BGP_STR
-       "Address family\n"
-       BGP_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
@@ -10428,18 +10939,19 @@ DEFUN (show_bgp_ipv6_safi_summary,
 
 DEFUN (show_bgp_instance_ipv6_safi_summary,
        show_bgp_instance_ipv6_safi_summary_cmd,
-       "show bgp " BGP_INSTANCE_CMD " ipv6 "BGP_SAFI_CMD_STR" summary {json}",
+       "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}",
        SHOW_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
-  safi_t safi;
-  safi = bgp_vty_safi_from_arg(argv[2]);
-  return bgp_show_summary_vty (vty, argv[1], AFI_IP6, safi, uj);
+  if (strncmp (argv[2], "m", 1) == 0)
+    return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj);
+
+  return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj);
 }
 
 /* old command */
@@ -10453,7 +10965,7 @@ DEFUN (show_ipv6_bgp_summary,
        "JavaScript Object Notation\n")
 {
   u_char uj = use_json(argc, argv);
-  return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MAX, uj);
+  return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
 }
 
 /* old command */
@@ -10479,40 +10991,17 @@ afi_safi_print (afi_t afi, safi_t safi)
   else if (afi == AFI_IP && safi == SAFI_MULTICAST)
     return "IPv4 Multicast";
   else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
-    return "IPv4 VPN";
+    return "VPN-IPv4 Unicast";
   else if (afi == AFI_IP && safi == SAFI_ENCAP)
-    return "IPv4 Encap";
+    return "ENCAP-IPv4 Unicast";
   else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
     return "IPv6 Unicast";
   else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
     return "IPv6 Multicast";
   else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
-    return "IPv6 VPN";
+    return "VPN-IPv6 Unicast";
   else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
-    return "IPv6 Encap";
-  else
-    return "Unknown";
-}
-
-const char *
-afi_safi_json (afi_t afi, safi_t safi)
-{
-  if (afi == AFI_IP && safi == SAFI_UNICAST)
-    return "IPv4Unicast";
-  else if (afi == AFI_IP && safi == SAFI_MULTICAST)
-    return "IPv4Multicast";
-  else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
-    return "IPv4VPN";
-  else if (afi == AFI_IP && safi == SAFI_ENCAP)
-    return "IPv4Encap";
-  else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
-    return "IPv6Unicast";
-  else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
-    return "IPv6Multicast";
-  else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
-    return "IPv6VPN";
-  else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
-    return "IPv6Encap";
+    return "ENCAP-IPv6 Unicast";
   else
     return "Unknown";
 }
@@ -12337,12 +12826,36 @@ DEFUN (show_ip_bgp_neighbors,
 
 ALIAS (show_ip_bgp_neighbors,
        show_ip_bgp_ipv4_neighbors_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "JavaScript Object Notation\n")
+
+ALIAS (show_ip_bgp_neighbors,
+       show_ip_bgp_vpnv4_all_neighbors_cmd,
+       "show ip bgp vpnv4 all neighbors {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "JavaScript Object Notation\n")
+
+ALIAS (show_ip_bgp_neighbors,
+       show_ip_bgp_vpnv4_rd_neighbors_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "JavaScript Object Notation\n")
 
@@ -12382,18 +12895,43 @@ DEFUN (show_ip_bgp_neighbors_peer,
 
 ALIAS (show_ip_bgp_neighbors_peer,
        show_ip_bgp_ipv4_neighbors_peer_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
+       "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
        "Neighbor on bgp configured interface\n"
        "JavaScript Object Notation\n")
 
+ALIAS (show_ip_bgp_neighbors_peer,
+       show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
+       "show ip bgp vpnv4 all neighbors A.B.C.D {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "Neighbor to display information about\n"
+       "JavaScript Object Notation\n")
+
+ALIAS (show_ip_bgp_neighbors_peer,
+       show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
+       "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Display VPNv4 NLRI specific information\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "Neighbor to display information about\n"
+       "JavaScript Object Notation\n")
+
 ALIAS (show_ip_bgp_neighbors_peer,
        show_bgp_neighbors_peer_cmd,
        "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
@@ -12528,12 +13066,13 @@ DEFUN (show_ip_bgp_paths,
 
 DEFUN (show_ip_bgp_ipv4_paths, 
        show_ip_bgp_ipv4_paths_cmd,
-       "show ip bgp ipv4 "BGP_SAFI_CMD_STR" paths",
+       "show ip bgp ipv4 (unicast|multicast) paths",
        SHOW_STR
        IP_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Path information\n")
 {
   vty_out (vty, "Address Refcnt Path\r\n");
@@ -12688,17 +13227,19 @@ DEFUN (show_bgp_instance_all_ipv6_updgrps,
 
 DEFUN (show_bgp_updgrps,
        show_bgp_updgrps_cmd,
-       "show bgp "BGP_AFI_SAFI_CMD_STR" update-groups",
+       "show bgp (ipv4|ipv6) (unicast|multicast|vpn|encap) update-groups",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       "Address family\n"
+       "Address Family modifier\n"
+       "Address Family modifier\n"
        "Detailed info about dynamic update groups\n")
 {
   afi_t afi;
   safi_t safi;
 
-  afi = bgp_vty_safi_from_arg(argv[0]);
+  afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
   safi = bgp_vty_safi_from_arg(argv[1]);
   return (bgp_show_update_groups(vty, NULL, afi, safi, 0));
 }
@@ -12764,11 +13305,11 @@ DEFUN (show_bgp_instance_ipv6_updgrps_s,
 
 DEFUN (show_bgp_updgrps_s,
        show_bgp_updgrps_s_cmd,
-       "show bgp "BGP_AFI_SAFI_CMD_STR" update-groups SUBGROUP-ID",
+       "show bgp (ipv4|ipv6) (unicast|multicast|vpn|encap) update-groups SUBGROUP-ID",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_AFI_SAFI_HELP_STR
+       AFI_SAFI_STR
        "Detailed info about v6 dynamic update groups\n"
        "Specific subgroup to display detailed info for")
 {
@@ -12776,7 +13317,7 @@ DEFUN (show_bgp_updgrps_s,
   safi_t safi;
   uint64_t subgrp_id;
 
-  afi = bgp_vty_safi_from_arg(argv[0]);
+  afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
   safi = bgp_vty_safi_from_arg(argv[1]);
   VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
   return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id));
@@ -12875,11 +13416,11 @@ DEFUN (show_ip_bgp_instance_updgrps_adj,
 
 DEFUN (show_bgp_updgrps_afi_adj,
        show_bgp_updgrps_afi_adj_cmd,
-       "show bgp "BGP_AFI_SAFI_CMD_STR" update-groups (advertise-queue|advertised-routes|packet-queue)",
+       "show bgp (ipv4|ipv6) (unicast|multicast|vpn|encap) update-groups (advertise-queue|advertised-routes|packet-queue)",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       AFI_SAFI_STR
        "BGP update groups\n"
        "Advertisement queue\n"
        "Announced routes\n"
@@ -12889,7 +13430,7 @@ DEFUN (show_bgp_updgrps_afi_adj,
   afi_t afi;
   safi_t safi;
 
-  afi = bgp_vty_safi_from_arg(argv[0]);
+  afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
   safi = bgp_vty_safi_from_arg(argv[1]);
   show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0);
   return CMD_SUCCESS;
@@ -12969,11 +13510,11 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s,
 
 DEFUN (show_bgp_updgrps_afi_adj_s,
        show_bgp_updgrps_afi_adj_s_cmd,
-       "show bgp "BGP_AFI_SAFI_CMD_STR" update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
+       "show bgp (ipv4|ipv6) (unicast|multicast|vpn|encap) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
        SHOW_STR
        BGP_STR
        "Address family\n"
-       BGP_SAFI_HELP_STR
+       AFI_SAFI_STR
        "BGP update groups\n"
        "Specific subgroup to display info for\n"
        "Advertisement queue\n"
@@ -12985,7 +13526,7 @@ DEFUN (show_bgp_updgrps_afi_adj_s,
   safi_t safi;
   uint64_t subgrp_id;
 
-  afi = bgp_vty_safi_from_arg(argv[0]);
+  afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
   safi = bgp_vty_safi_from_arg(argv[1]);
   VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
 
@@ -15095,7 +15636,11 @@ bgp_vty_init (void)
   install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
 #endif /* HAVE_IPV6 */
   install_element (BGP_NODE, &address_family_vpnv4_cmd);
+  install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
+
   install_element (BGP_NODE, &address_family_vpnv6_cmd);
+  install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
+
   install_element (BGP_NODE, &address_family_encap_cmd);
   install_element (BGP_NODE, &address_family_encapv4_cmd);
 #ifdef HAVE_IPV6
@@ -15196,6 +15741,18 @@ bgp_vty_init (void)
   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
   install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
   install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
@@ -15294,6 +15851,18 @@ bgp_vty_init (void)
   install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
   install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
   install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
@@ -15356,6 +15925,12 @@ bgp_vty_init (void)
   install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
   install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
+  install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
   install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
   install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
@@ -15407,6 +15982,8 @@ bgp_vty_init (void)
   install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
   install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
 #ifdef HAVE_IPV6
   install_element (VIEW_NODE, &show_bgp_summary_cmd);
   install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
@@ -15422,6 +15999,10 @@ bgp_vty_init (void)
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
index e3a51ac45025a2ef48909f94ec4bc30c17077672..6b4e51bc5055da74d64a806942575a0e658ece3a 100644 (file)
@@ -30,20 +30,15 @@ struct bgp;
 #define BGP_INSTANCE_ALL_CMD "(view|vrf) all"
 #define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n"
 
-#define BGP_AFI_CMD_STR         "(ipv4|ipv6)"
-#define BGP_AFI_HELP_STR        "Address Family\nAddress Family\n"
-#define BGP_SAFI_CMD_STR        "(unicast|multicast|vpn|encap)"
-#define BGP_SAFI_HELP_STR       \
-  "Address Family modifier\n"   \
-  "Address Family modifier\n"   \
-  "Address Family modifier\n"   \
+#define AFI_SAFI_STR \
+  "Address family\n" \
+  "Address Family modifier\n" \
+  "Address Family modifier\n" \
+  "Address Family modifier\n" \
   "Address Family modifier\n"
-#define BGP_AFI_SAFI_CMD_STR    BGP_AFI_CMD_STR" "BGP_SAFI_CMD_STR
-#define BGP_AFI_SAFI_HELP_STR   BGP_AFI_HELP_STR BGP_SAFI_HELP_STR
 
 extern void bgp_vty_init (void);
 extern const char *afi_safi_print (afi_t, safi_t);
-extern const char *afi_safi_json (afi_t, safi_t);
 extern int bgp_config_write_update_delay (struct vty *, struct bgp *);
 extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp);
 extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp);
@@ -58,9 +53,6 @@ bgp_parse_afi(const char *str, afi_t *afi);
 extern int
 bgp_parse_safi(const char *str, safi_t *safi);
 
-extern afi_t
-bgp_vty_afi_from_arg(const char *afi_str);
-
 extern safi_t
 bgp_vty_safi_from_arg(const char *safi_str);