From a5d7012ca0c04c97bd15b67e9f6e9211203b7c31 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 23 Aug 2022 12:22:08 -0400 Subject: [PATCH] bgpd: use DEFPY for new vrf rt auto commands Switch to using DEFPY for new vrf rt auto commands. Signed-off-by: Stephen Worley --- bgpd/bgp_evpn_vty.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index d703830f2f..0b3d601039 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -6014,9 +6014,9 @@ DEFUN (bgp_evpn_vrf_rt, return ret; } -DEFUN (bgp_evpn_vrf_rt_auto, +DEFPY (bgp_evpn_vrf_rt_auto, bgp_evpn_vrf_rt_auto_cmd, - "route-target auto", + "route-target $type auto", "Route Target\n" "import and export\n" "import\n" @@ -6029,11 +6029,11 @@ DEFUN (bgp_evpn_vrf_rt_auto, if (!bgp) return CMD_WARNING_CONFIG_FAILED; - if (!strcmp(argv[1]->arg, "import")) + if (strmatch(type, "import")) rt_type = RT_TYPE_IMPORT; - else if (!strcmp(argv[1]->arg, "export")) + else if (strmatch(type, "export")) rt_type = RT_TYPE_EXPORT; - else if (!strcmp(argv[1]->arg, "both")) + else if (strmatch(type, "both")) rt_type = RT_TYPE_BOTH; else { vty_out(vty, "%% Invalid Route Target type\n"); @@ -6119,9 +6119,9 @@ DEFUN (no_bgp_evpn_vrf_rt, return ret; } -DEFUN (no_bgp_evpn_vrf_rt_auto, +DEFPY (no_bgp_evpn_vrf_rt_auto, no_bgp_evpn_vrf_rt_auto_cmd, - "no route-target auto", + "no route-target $type auto", NO_STR "Route Target\n" "import and export\n" @@ -6135,11 +6135,11 @@ DEFUN (no_bgp_evpn_vrf_rt_auto, if (!bgp) return CMD_WARNING_CONFIG_FAILED; - if (!strcmp(argv[2]->arg, "import")) + if (strmatch(type, "import")) rt_type = RT_TYPE_IMPORT; - else if (!strcmp(argv[2]->arg, "export")) + else if (strmatch(type, "export")) rt_type = RT_TYPE_EXPORT; - else if (!strcmp(argv[2]->arg, "both")) + else if (strmatch(type, "both")) rt_type = RT_TYPE_BOTH; else { vty_out(vty, "%% Invalid Route Target type\n"); -- 2.39.5