]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: replace ipv4-unicast with standard in config and oper contexts
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 1 Jun 2022 13:37:49 +0000 (15:37 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 2 Jun 2022 19:20:45 +0000 (21:20 +0200)
Only the multi-topology command can use 'ipv4-unicast' keyword to
configure standard topology.
The remaining code: dump from show commands, and yang definition,
uses 'standard' keyword instead.

The test have not been modified. The change would consists in
modifying test_fuzz_isis_tlv_tests.h.gz:
- replacing ipv4-unicast occurences with standard
\x69\x70\x76\x34\x2d\x75\x6e\x69\x63\x61\x73\x74
with
\x73\x74\x61\x6e\x64\x61\x72\x64

- align the buffer length by removing 4 bytes per occurence
Instead, a specific isis_mtid2str_fake() routing has been
put in place in isis_tlvs.c file.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
isisd/isis_cli.c
isisd/isis_mt.c
isisd/isis_mt.h
isisd/isis_nb.c
isisd/isis_nb.h
isisd/isis_nb_config.c
isisd/isis_tlvs.c
yang/frr-isisd.yang

index c23b0f0dc116f9d027a08591983f5dd2bdf4e19e..2bf9eadaba65e0d0d8a650bba0fcd26ff9847d97 100644 (file)
@@ -1348,26 +1348,30 @@ void cli_show_isis_redistribute_ipv6(struct vty *vty,
 /*
  * XPath: /frr-isisd:isis/instance/multi-topology
  */
-DEFPY_YANG(isis_topology, isis_topology_cmd,
-      "[no] topology <ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology [overload]$overload",
-      NO_STR
-      "Configure IS-IS topologies\n"
-      "IPv4 unicast topology\n"
-      "IPv4 management topology\n"
-      "IPv6 unicast topology\n"
-      "IPv4 multicast topology\n"
-      "IPv6 multicast topology\n"
-      "IPv6 management topology\n"
-      "IPv6 dst-src topology\n"
-      "Set overload bit for topology\n")
+DEFPY_YANG(
+       isis_topology, isis_topology_cmd,
+       "[no] topology <standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology [overload]$overload",
+       NO_STR
+       "Configure IS-IS topologies\n"
+       "standard topology\n"
+       "IPv4 unicast topology\n"
+       "IPv4 management topology\n"
+       "IPv6 unicast topology\n"
+       "IPv4 multicast topology\n"
+       "IPv6 multicast topology\n"
+       "IPv6 management topology\n"
+       "IPv6 dst-src topology\n"
+       "Set overload bit for topology\n")
 {
        char base_xpath[XPATH_MAXLEN];
 
-       /* Since IPv4-unicast is not configurable it is not present in the
+       /* Since standard is not configurable it is not present in the
         * YANG model, so we need to validate it here
         */
-       if (strmatch(topology, "ipv4-unicast")) {
-               vty_out(vty, "Cannot configure IPv4 unicast topology\n");
+       if (strmatch(topology, "standard") ||
+           strmatch(topology, "ipv4-unicast")) {
+               vty_out(vty,
+                       "Cannot configure IPv4 unicast (Standard) topology\n");
                return CMD_WARNING_CONFIG_FAILED;
        }
 
@@ -2333,10 +2337,11 @@ void cli_show_ip_isis_psnp_interval(struct vty *vty,
  * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology
  */
 DEFPY_YANG(circuit_topology, circuit_topology_cmd,
-      "[no] isis topology<ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology",
+      "[no] isis topology<standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology",
       NO_STR
       "IS-IS routing protocol\n"
       "Configure interface IS-IS topologies\n"
+      "Standard topology\n"
       "IPv4 unicast topology\n"
       "IPv4 management topology\n"
       "IPv6 unicast topology\n"
@@ -2353,18 +2358,20 @@ DEFPY_YANG(circuit_topology, circuit_topology_cmd,
        else if (strmatch(topology, "ipv6-mgmt"))
                return nb_cli_apply_changes(
                        vty, "./frr-isisd:isis/multi-topology/ipv6-management");
+       if (strmatch(topology, "ipv4-unicast"))
+               return nb_cli_apply_changes(
+                       vty, "./frr-isisd:isis/multi-topology/standard");
        else
                return nb_cli_apply_changes(
                        vty, "./frr-isisd:isis/multi-topology/%s", topology);
 }
 
-void cli_show_ip_isis_mt_ipv4_unicast(struct vty *vty,
-                                     const struct lyd_node *dnode,
-                                     bool show_defaults)
+void cli_show_ip_isis_mt_standard(struct vty *vty, const struct lyd_node *dnode,
+                                 bool show_defaults)
 {
        if (!yang_dnode_get_bool(dnode, NULL))
                vty_out(vty, " no");
-       vty_out(vty, " isis topology ipv4-unicast\n");
+       vty_out(vty, " isis topology standard\n");
 }
 
 void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty,
index f937bdf55c388dad9c0b25a97a9c89a6e1d477dc..6bbb01c30764ee72feff1aaf4cf015666f09b58c 100644 (file)
@@ -56,8 +56,8 @@ const char *isis_mtid2str(uint16_t mtid)
        static char buf[sizeof("65535")];
 
        switch (mtid) {
-       case ISIS_MT_IPV4_UNICAST:
-               return "ipv4-unicast";
+       case ISIS_MT_STANDARD:
+               return "standard";
        case ISIS_MT_IPV4_MGMT:
                return "ipv4-mgmt";
        case ISIS_MT_IPV6_UNICAST:
@@ -80,6 +80,8 @@ uint16_t isis_str2mtid(const char *name)
 {
        if (!strcmp(name, "ipv4-unicast"))
                return ISIS_MT_IPV4_UNICAST;
+       if (!strcmp(name, "standard"))
+               return ISIS_MT_STANDARD;
        if (!strcmp(name, "ipv4-mgmt"))
                return ISIS_MT_IPV4_MGMT;
        if (!strcmp(name, "ipv6-unicast"))
index d431d34a08ff6a9ae29bf6544db06c149b8b4b6e..13e508451b65e830772c136ee71e40163e48a694 100644 (file)
@@ -38,7 +38,7 @@
 #define ISIS_MT_DISABLE        4096
 
 #define ISIS_MT_NAMES                                                          \
-       "<ipv4-unicast"                                                        \
+       "<standard"                                                            \
        "|ipv4-mgmt"                                                           \
        "|ipv6-unicast"                                                        \
        "|ipv4-multicast"                                                      \
index 20e48065250ba27d8fbdfff6f6b6527e1eeb5104..a2ba33d0782ac1cba7c910371f7fa97f2e098f6b 100644 (file)
@@ -899,10 +899,10 @@ const struct frr_yang_module_info frr_isisd_info = {
                        },
                },
                {
-                       .xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast",
+                       .xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard",
                        .cbs = {
-                               .cli_show = cli_show_ip_isis_mt_ipv4_unicast,
-                               .modify = lib_interface_isis_multi_topology_ipv4_unicast_modify,
+                               .cli_show = cli_show_ip_isis_mt_standard,
+                               .modify = lib_interface_isis_multi_topology_standard_modify,
                        },
                },
                {
index 96de64a68bb27761bc9e9978697955f33ca4981c..00ca8be3b0518bfe74561d2f0efc5b29f2b687a5 100644 (file)
@@ -291,7 +291,7 @@ int lib_interface_isis_password_password_type_modify(
        struct nb_cb_modify_args *args);
 int lib_interface_isis_disable_three_way_handshake_modify(
        struct nb_cb_modify_args *args);
-int lib_interface_isis_multi_topology_ipv4_unicast_modify(
+int lib_interface_isis_multi_topology_standard_modify(
        struct nb_cb_modify_args *args);
 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
        struct nb_cb_modify_args *args);
@@ -543,9 +543,8 @@ void cli_show_ip_isis_csnp_interval(struct vty *vty,
 void cli_show_ip_isis_psnp_interval(struct vty *vty,
                                    const struct lyd_node *dnode,
                                    bool show_defaults);
-void cli_show_ip_isis_mt_ipv4_unicast(struct vty *vty,
-                                     const struct lyd_node *dnode,
-                                     bool show_defaults);
+void cli_show_ip_isis_mt_standard(struct vty *vty, const struct lyd_node *dnode,
+                                 bool show_defaults);
 void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty,
                                        const struct lyd_node *dnode,
                                        bool show_defaults);
index cf4c2aea0a1a721f53f200ce82b6e9cdbb16202a..79b167718b8f5e042c51cbe26e1044a8d2f13fbe 100644 (file)
@@ -3070,10 +3070,6 @@ int lib_interface_isis_disable_three_way_handshake_modify(
        return NB_OK;
 }
 
-/*
- * XPath:
- * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast
- */
 static int lib_interface_isis_multi_topology_common(
        enum nb_event event, const struct lyd_node *dnode, char *errmsg,
        size_t errmsg_len, uint16_t mtid)
@@ -3104,12 +3100,16 @@ static int lib_interface_isis_multi_topology_common(
        return NB_OK;
 }
 
-int lib_interface_isis_multi_topology_ipv4_unicast_modify(
+/*
+ * XPath:
+ * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard
+ */
+int lib_interface_isis_multi_topology_standard_modify(
        struct nb_cb_modify_args *args)
 {
        return lib_interface_isis_multi_topology_common(
                args->event, args->dnode, args->errmsg, args->errmsg_len,
-               ISIS_MT_IPV4_UNICAST);
+               ISIS_MT_STANDARD);
 }
 
 /*
index 3ba5c6ccfa53d0f0ba332172b598649e29875018..11be3c3a7159ed7a9793bde1c98070ea2c504518 100644 (file)
@@ -119,6 +119,14 @@ static const struct tlv_ops *const tlv_table[ISIS_CONTEXT_MAX][ISIS_TLV_MAX];
 static void append_item(struct isis_item_list *dest, struct isis_item *item);
 static void init_item_list(struct isis_item_list *items);
 
+/* For tests/isisd, TLV text requires ipv4-unicast instead of standard */
+static const char *isis_mtid2str_fake(uint16_t mtid)
+{
+       if (mtid == ISIS_MT_STANDARD)
+               return "ipv4-unicast";
+       return isis_mtid2str(mtid);
+}
+
 /* Functions for Extended IS Reachability SubTLVs a.k.a Traffic Engineering */
 struct isis_ext_subtlvs *isis_alloc_ext_subtlvs(void)
 {
@@ -2391,7 +2399,7 @@ static void format_item_mt_router_info(uint16_t mtid, struct isis_item *i,
                json_object_string_add(mt_json, "attached", info->attached?"true":"false");
        } else
                sbuf_push(buf, indent, "MT Router Info: %s%s%s\n",
-                         isis_mtid2str(info->mtid),
+                         isis_mtid2str_fake(info->mtid),
                          info->overload ? " Overload" : "",
                          info->attached ? " Attached" : "");
 }
@@ -4306,7 +4314,7 @@ static int unpack_tlv_with_items(enum isis_tlv_context context,
                mtid = stream_getw(s) & ISIS_MT_MASK;
                tlv_pos += 2;
                sbuf_push(log, indent, "Unpacking as MT %s item TLV...\n",
-                         isis_mtid2str(mtid));
+                         isis_mtid2str_fake(mtid));
        } else {
                sbuf_push(log, indent, "Unpacking as item TLV...\n");
                mtid = ISIS_MT_IPV4_UNICAST;
index defb2b2038beb963164bb96861c5bb1d1cbe90c3..0812c86facf65da3b5ad313be8f8201cc0ac2592 100644 (file)
@@ -733,11 +733,11 @@ module frr-isisd {
     container multi-topology {
       description
         "IS-IS topologies configured on this circuit.";
-      leaf ipv4-unicast {
+      leaf standard {
         type boolean;
         default "true";
         description
-          "IPv4 unicast topology.";
+          "Standard (IPV4 unicast) topology.";
       }
 
       leaf ipv4-multicast {