mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 00:41:20 +00:00
pimd: Moving pim_cli_get_vrf_name function to common file
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
This commit is contained in:
parent
26cd3d6612
commit
2328b7ef1e
@ -3761,31 +3761,6 @@ static void clear_interfaces(struct pim_instance *pim)
|
||||
return CMD_WARNING_CONFIG_FAILED; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current node VRF name.
|
||||
*
|
||||
* NOTE:
|
||||
* In case of failure it will print error message to user.
|
||||
*
|
||||
* \returns name or NULL if failed to get VRF.
|
||||
*/
|
||||
static const char *pim_cli_get_vrf_name(struct vty *vty)
|
||||
{
|
||||
const struct lyd_node *vrf_node;
|
||||
|
||||
/* Not inside any VRF context. */
|
||||
if (vty->xpath_index == 0)
|
||||
return VRF_DEFAULT_NAME;
|
||||
|
||||
vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
|
||||
if (vrf_node == NULL) {
|
||||
vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return yang_dnode_get_string(vrf_node, "./name");
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility function to keep the legacy mesh group CLI behavior:
|
||||
* Delete group when there are no more configurations in it.
|
||||
|
@ -37,4 +37,28 @@
|
||||
#include "pim_errors.h"
|
||||
#include "pim_nb.h"
|
||||
|
||||
/**
|
||||
* Get current node VRF name.
|
||||
*
|
||||
* NOTE:
|
||||
* In case of failure it will print error message to user.
|
||||
*
|
||||
* \returns name or NULL if failed to get VRF.
|
||||
*/
|
||||
const char *pim_cli_get_vrf_name(struct vty *vty)
|
||||
{
|
||||
const struct lyd_node *vrf_node;
|
||||
|
||||
/* Not inside any VRF context. */
|
||||
if (vty->xpath_index == 0)
|
||||
return VRF_DEFAULT_NAME;
|
||||
|
||||
vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
|
||||
if (vrf_node == NULL) {
|
||||
vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return yang_dnode_get_string(vrf_node, "./name");
|
||||
}
|
||||
|
||||
|
@ -19,4 +19,6 @@
|
||||
*/
|
||||
#ifndef PIM_CMD_COMMON_H
|
||||
#define PIM_CMD_COMMON_H
|
||||
|
||||
const char *pim_cli_get_vrf_name(struct vty *vty);
|
||||
#endif /* PIM_CMD_COMMON_H */
|
||||
|
Loading…
Reference in New Issue
Block a user