From fe0c6838c5dc781fd3f55783f9c9061e6803a502 Mon Sep 17 00:00:00 2001 From: Sai Gomathi N Date: Wed, 27 Apr 2022 08:07:53 -0700 Subject: [PATCH] pim6d: Adding pim_cmd_lookup api in pim_cmd_common file Adding pim_cmd_lookup function for clear CLIs Signed-off-by: Sai Gomathi N --- pimd/pim_cmd_common.c | 15 +++++++++++++++ pimd/pim_cmd_common.h | 1 + 2 files changed, 16 insertions(+) diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index f4479abfab..6f81862db4 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -3564,6 +3564,21 @@ void show_mroute_summary(struct pim_instance *pim, struct vty *vty, } } +struct vrf *pim_cmd_lookup(struct vty *vty, const char *name) +{ + struct vrf *vrf; + + if (name) + vrf = vrf_lookup_by_name(name); + else + vrf = vrf_lookup_by_id(VRF_DEFAULT); + + if (!vrf) + vty_out(vty, "Specified VRF: %s does not exist\n", name); + + return vrf; +} + void clear_mroute(struct pim_instance *pim) { struct pim_upstream *up; diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h index 1431ce32e1..b8264e24c4 100644 --- a/pimd/pim_cmd_common.h +++ b/pimd/pim_cmd_common.h @@ -121,6 +121,7 @@ void show_mroute_count(struct pim_instance *pim, struct vty *vty, json_object *json); void show_mroute_summary(struct pim_instance *pim, struct vty *vty, json_object *json); +struct vrf *pim_cmd_lookup(struct vty *vty, const char *name); void clear_mroute(struct pim_instance *pim); void clear_pim_statistics(struct pim_instance *pim); -- 2.39.5