lib: fix prefix list description command

Changes:
- Use `description` on CLI but `remark` on YANG like access-list (also
  because `description` is a reserved word).
- Rename YANG model field and northbound code.
- Fix wrong sequence type get.
- Fix wrong action XPath in action callback.
- Fix wrong concat in (ipv6|mac) access-list.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2020-04-30 17:23:51 -03:00
parent 1d3c4b664d
commit cc82bcc161
3 changed files with 18 additions and 18 deletions

View File

@ -908,7 +908,7 @@ DEFPY(
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
snprintf(xpath_remark, sizeof(xpath_remark), "%s/remark", xpath);
remark = argv_concat(argv, argc, 3);
remark = argv_concat(argv, argc, 4);
nb_cli_enqueue_change(vty, xpath_remark, NB_OP_CREATE, remark);
rv = nb_cli_apply_changes(vty, NULL);
XFREE(MTYPE_TMP, remark);
@ -1084,7 +1084,7 @@ DEFPY(
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
snprintf(xpath_remark, sizeof(xpath_remark), "%s/remark", xpath);
remark = argv_concat(argv, argc, 3);
remark = argv_concat(argv, argc, 4);
nb_cli_enqueue_change(vty, xpath_remark, NB_OP_CREATE, remark);
rv = nb_cli_apply_changes(vty, NULL);
XFREE(MTYPE_TMP, remark);
@ -1366,7 +1366,7 @@ DEFPY(
DEFPY(
ip_prefix_list_remark, ip_prefix_list_remark_cmd,
"ip prefix-list WORD$name remark LINE...",
"ip prefix-list WORD$name description LINE...",
IP_STR
PREFIX_LIST_STR
PREFIX_LIST_NAME_STR
@ -1393,7 +1393,7 @@ DEFPY(
DEFPY(
no_ip_prefix_list_remark, no_ip_prefix_list_remark_cmd,
"no ip prefix-list WORD$name remark",
"no ip prefix-list WORD$name description",
NO_STR
IP_STR
PREFIX_LIST_STR
@ -1412,7 +1412,7 @@ DEFPY(
ALIAS(
no_ip_prefix_list_remark, no_ip_prefix_list_remark_line_cmd,
"no ip prefix-list WORD remark LINE...",
"no ip prefix-list WORD description LINE...",
NO_STR
IP_STR
PREFIX_LIST_STR
@ -1546,7 +1546,7 @@ DEFPY(
DEFPY(
ipv6_prefix_list_remark, ipv6_prefix_list_remark_cmd,
"ipv6 prefix-list WORD$name remark LINE...",
"ipv6 prefix-list WORD$name description LINE...",
IPV6_STR
PREFIX_LIST_STR
PREFIX_LIST_NAME_STR
@ -1573,7 +1573,7 @@ DEFPY(
DEFPY(
no_ipv6_prefix_list_remark, no_ipv6_prefix_list_remark_cmd,
"no ipv6 prefix-list WORD$name remark",
"no ipv6 prefix-list WORD$name description",
NO_STR
IPV6_STR
PREFIX_LIST_STR
@ -1592,7 +1592,7 @@ DEFPY(
ALIAS(
no_ipv6_prefix_list_remark, no_ipv6_prefix_list_remark_line_cmd,
"no ipv6 prefix-list WORD remark LINE...",
"no ipv6 prefix-list WORD description LINE...",
NO_STR
IPV6_STR
PREFIX_LIST_STR
@ -1673,7 +1673,7 @@ void prefix_list_remark_show(struct vty *vty, struct lyd_node *dnode,
break;
}
vty_out(vty, "prefix-list %s remark %s\n",
vty_out(vty, "prefix-list %s description %s\n",
yang_dnode_get_string(dnode, "../name"),
yang_dnode_get_string(dnode, NULL));
}

View File

@ -724,9 +724,9 @@ static int lib_prefix_list_destroy(struct nb_cb_destroy_args *args)
}
/*
* XPath: /frr-filter:lib/prefix-list/description
* XPath: /frr-filter:lib/prefix-list/remark
*/
static int lib_prefix_list_description_modify(struct nb_cb_modify_args *args)
static int lib_prefix_list_remark_modify(struct nb_cb_modify_args *args)
{
struct prefix_list *pl;
const char *remark;
@ -744,7 +744,7 @@ static int lib_prefix_list_description_modify(struct nb_cb_modify_args *args)
return NB_OK;
}
static int lib_prefix_list_description_destroy(struct nb_cb_destroy_args *args)
static int lib_prefix_list_remark_destroy(struct nb_cb_destroy_args *args)
{
struct prefix_list *pl;
@ -778,7 +778,7 @@ static int lib_prefix_list_entry_create(struct nb_cb_create_args *args)
ple = prefix_list_entry_new();
ple->pl = pl;
ple->any = 1;
ple->seq = yang_dnode_get_int64(args->dnode, "./sequence");
ple->seq = yang_dnode_get_uint32(args->dnode, "./sequence");
return NB_OK;
}
@ -808,7 +808,7 @@ static int lib_prefix_list_entry_action_modify(struct nb_cb_modify_args *args)
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
action_str = yang_dnode_get_string(args->dnode, "./action");
action_str = yang_dnode_get_string(args->dnode, NULL);
if (strcmp(action_str, "permit") == 0)
ple->type = PREFIX_PERMIT;
else
@ -1145,10 +1145,10 @@ const struct frr_yang_module_info frr_filter_info = {
}
},
{
.xpath = "/frr-filter:lib/prefix-list/description",
.xpath = "/frr-filter:lib/prefix-list/remark",
.cbs = {
.modify = lib_prefix_list_description_modify,
.destroy = lib_prefix_list_description_destroy,
.modify = lib_prefix_list_remark_modify,
.destroy = lib_prefix_list_remark_destroy,
.cli_show = prefix_list_remark_show,
}
},

View File

@ -299,7 +299,7 @@ module frr-filter {
type access-list-name;
}
leaf description {
leaf remark {
description "Prefix list user description";
type string;
}