]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Convert vrf.c to use new error-code subsystem
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 20 Aug 2018 14:39:44 +0000 (10:39 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Sep 2018 20:50:58 +0000 (20:50 +0000)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/lib_errors.c
lib/lib_errors.h
lib/vrf.c

index 3ab8ac80f396431210dd37c186c50e03b7bce045..b27f9391adf5ff1c9f7882cfefe3918e1b424ff2 100644 (file)
@@ -58,6 +58,12 @@ static struct log_ref ferr_lib_warn[] = {
                .description = "The config subsystem attempted to read in it's configuration file which failed, so we are falling back to the backup config file to see if it is available",
                .suggestion = "Create configuration file",
        },
+       {
+               .code = LIB_WARN_VRF_LENGTH,
+               .title = "The VRF subsystem has encountered a parsing error",
+               .description = "The VRF subsystem, during initialization, has found a parsing error with input it has received",
+               .suggestion = "Check the length of the vrf name and adjust accordingly",
+       },
        {
                .code = END_FERR,
        },
index a157cc731bbb590a8e7d7c4e51afb1d1ded538bf..dcaf888e1b97b327aa5e3ef141c8405a3c97deb9 100644 (file)
@@ -44,6 +44,7 @@ enum lib_log_refs {
        LIB_WARN_SLOW_THREAD,
        LIB_WARN_RMAP_RECURSION_LIMIT,
        LIB_WARN_BACKUP_CONFIG,
+       LIB_WARN_VRF_LENGTH,
 };
 
 extern void lib_error_init(void);
index 1fb1b786c7d4d26d92cb3bf32b4acb14b06952b1..18314b4f3207092940da68d5f55baa21348bb174 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -624,7 +624,8 @@ int vrf_handler_create(struct vty *vty, const char *vrfname,
                                "%% VRF name %s invalid: length exceeds %d bytes\n",
                                vrfname, VRF_NAMSIZ);
                else
-                       zlog_warn(
+                       flog_warn(
+                               LIB_WARN_VRF_LENGTH,
                                "%% VRF name %s invalid: length exceeds %d bytes\n",
                                vrfname, VRF_NAMSIZ);
                return CMD_WARNING_CONFIG_FAILED;
@@ -653,7 +654,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
                                "VRF %u is already configured with VRF %s\n",
                                vrf->vrf_id, vrf->name);
                else
-                       zlog_warn("VRF %u is already configured with VRF %s\n",
+                       zlog_info("VRF %u is already configured with VRF %s\n",
                                  vrf->vrf_id, vrf->name);
                return CMD_WARNING_CONFIG_FAILED;
        }
@@ -665,9 +666,9 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
                                        "VRF %u already configured with NETNS %s\n",
                                        vrf->vrf_id, ns->name);
                        else
-                               zlog_warn(
-                                       "VRF %u already configured with NETNS %s",
-                                       vrf->vrf_id, ns->name);
+                               zlog_info(
+                                         "VRF %u already configured with NETNS %s",
+                                         vrf->vrf_id, ns->name);
                        return CMD_WARNING_CONFIG_FAILED;
                }
        }
@@ -683,7 +684,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
                                " with VRF %u(%s)\n",
                                ns->name, vrf2->vrf_id, vrf2->name);
                else
-                       zlog_warn("NS %s is already configured with VRF %u(%s)",
+                       zlog_info("NS %s is already configured with VRF %u(%s)",
                                  ns->name, vrf2->vrf_id, vrf2->name);
                return CMD_WARNING_CONFIG_FAILED;
        }
@@ -699,7 +700,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
                        vty_out(vty, "Can not associate NS %u with NETNS %s\n",
                                ns->ns_id, ns->name);
                else
-                       zlog_warn("Can not associate NS %u with NETNS %s",
+                       zlog_info("Can not associate NS %u with NETNS %s",
                                  ns->ns_id, ns->name);
                return CMD_WARNING_CONFIG_FAILED;
        }