diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2022-06-01 15:37:49 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2022-06-02 21:20:45 +0200 |
commit | a15014f317409f20207644a6ae524fd86b295333 (patch) | |
tree | cf0716e4a18a414401bc059e536205ac167196dd | |
parent | isisd: add ISIS_MT_STANDARD define (diff) | |
download | frr-a15014f317409f20207644a6ae524fd86b295333.tar.xz frr-a15014f317409f20207644a6ae524fd86b295333.zip |
isisd: replace ipv4-unicast with standard in config and oper contexts
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>
-rw-r--r-- | isisd/isis_cli.c | 47 | ||||
-rw-r--r-- | isisd/isis_mt.c | 6 | ||||
-rw-r--r-- | isisd/isis_mt.h | 2 | ||||
-rw-r--r-- | isisd/isis_nb.c | 6 | ||||
-rw-r--r-- | isisd/isis_nb.h | 7 | ||||
-rw-r--r-- | isisd/isis_nb_config.c | 12 | ||||
-rw-r--r-- | isisd/isis_tlvs.c | 12 | ||||
-rw-r--r-- | yang/frr-isisd.yang | 4 |
8 files changed, 56 insertions, 40 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index c23b0f0dc..2bf9eadab 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -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, diff --git a/isisd/isis_mt.c b/isisd/isis_mt.c index f937bdf55..6bbb01c30 100644 --- a/isisd/isis_mt.c +++ b/isisd/isis_mt.c @@ -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")) diff --git a/isisd/isis_mt.h b/isisd/isis_mt.h index d431d34a0..13e508451 100644 --- a/isisd/isis_mt.h +++ b/isisd/isis_mt.h @@ -38,7 +38,7 @@ #define ISIS_MT_DISABLE 4096 #define ISIS_MT_NAMES \ - "<ipv4-unicast" \ + "<standard" \ "|ipv4-mgmt" \ "|ipv6-unicast" \ "|ipv4-multicast" \ diff --git a/isisd/isis_nb.c b/isisd/isis_nb.c index 20e480652..a2ba33d07 100644 --- a/isisd/isis_nb.c +++ b/isisd/isis_nb.c @@ -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, }, }, { diff --git a/isisd/isis_nb.h b/isisd/isis_nb.h index 96de64a68..00ca8be3b 100644 --- a/isisd/isis_nb.h +++ b/isisd/isis_nb.h @@ -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); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index cf4c2aea0..79b167718 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -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); } /* diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 3ba5c6ccf..11be3c3a7 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -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; diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index defb2b203..0812c86fa 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -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 { |