lib, zebra, vtysh: configure an interface in non-default VRF

Introduce a new command "interface IFNAME vrf N" to configure an
interface in the non-default VRF.

Till now, only zebra uses this command. Other daemons will install
the command when they support multiple VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index b33ac90..04ac550 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -35,6 +35,7 @@
 #include "vtysh/vtysh.h"
 #include "log.h"
 #include "bgpd/bgp_vty.h"
+#include "vrf.h"
 
 /* Struct VTY. */
 struct vty *vty;
@@ -1296,6 +1297,14 @@
   return CMD_SUCCESS;
 }
 
+ALIAS_SH (VTYSH_ZEBRA,
+	 vtysh_interface,
+	 vtysh_interface_vrf_cmd,
+	 "interface IFNAME " VRF_CMD_STR,
+	 "Select an interface to configure\n"
+	 "Interface's name\n"
+	 VRF_CMD_HELP_STR)
+
 /* TODO Implement "no interface command in isisd. */
 DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D,
        vtysh_no_interface_cmd,
@@ -1304,6 +1313,14 @@
        "Delete a pseudo interface's configuration\n"
        "Interface's name\n")
 
+DEFSH (VTYSH_ZEBRA,
+       vtysh_no_interface_vrf_cmd,
+       "no interface IFNAME " VRF_CMD_STR,
+       NO_STR
+       "Delete a pseudo interface's configuration\n"
+       "Interface's name\n"
+       VRF_CMD_HELP_STR)
+
 /* TODO Implement interface description commands in ripngd, ospf6d
  * and isisd. */
 DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD,
@@ -2381,6 +2398,8 @@
   install_element (KEYCHAIN_KEY_NODE, &key_chain_cmd);
   install_element (CONFIG_NODE, &vtysh_interface_cmd);
   install_element (CONFIG_NODE, &vtysh_no_interface_cmd);
+  install_element (CONFIG_NODE, &vtysh_interface_vrf_cmd);
+  install_element (CONFIG_NODE, &vtysh_no_interface_vrf_cmd);
   install_element (ENABLE_NODE, &vtysh_show_running_config_cmd);
   install_element (ENABLE_NODE, &vtysh_copy_runningconfig_startupconfig_cmd);
   install_element (ENABLE_NODE, &vtysh_write_file_cmd);