From ae253f502eff939c52a9b2a2993962754804bbdb Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Mon, 22 Mar 2021 23:25:05 +0300 Subject: lib: sort access-list commands by sequence-number in running-config Signed-off-by: Igor Ryzhov --- lib/filter_cli.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/filter_cli.c') diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 5d66a9fc73..fd20ffc36e 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1072,6 +1072,14 @@ ALIAS( ACCESS_LIST_REMARK_STR ACCESS_LIST_REMARK_LINE_STR) +int access_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) +{ + uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); + uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); + + return seq1 - seq2; +} + void access_list_show(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { -- cgit v1.2.3 From 73695730f55a25cae086cec02c29482f8d296739 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Mon, 22 Mar 2021 23:25:28 +0300 Subject: lib: sort prefix-list commands by sequence-number in running-config Signed-off-by: Igor Ryzhov --- lib/filter.h | 1 + lib/filter_cli.c | 8 ++++++++ lib/filter_nb.c | 1 + 3 files changed, 10 insertions(+) (limited to 'lib/filter_cli.c') diff --git a/lib/filter.h b/lib/filter.h index d5a7e7d5e2..c7108b26ba 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -239,6 +239,7 @@ extern void access_list_show(struct vty *vty, struct lyd_node *dnode, bool show_defaults); extern void access_list_remark_show(struct vty *vty, struct lyd_node *dnode, bool show_defaults); +extern int prefix_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2); extern void prefix_list_show(struct vty *vty, struct lyd_node *dnode, bool show_defaults); extern void prefix_list_remark_show(struct vty *vty, struct lyd_node *dnode, diff --git a/lib/filter_cli.c b/lib/filter_cli.c index fd20ffc36e..893981ffab 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1701,6 +1701,14 @@ ALIAS( ACCESS_LIST_REMARK_STR ACCESS_LIST_REMARK_LINE_STR) +int prefix_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) +{ + uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); + uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); + + return seq1 - seq2; +} + void prefix_list_show(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { diff --git a/lib/filter_nb.c b/lib/filter_nb.c index 717c56ee7c..3c05f10750 100644 --- a/lib/filter_nb.c +++ b/lib/filter_nb.c @@ -1691,6 +1691,7 @@ const struct frr_yang_module_info frr_filter_info = { .cbs = { .create = lib_prefix_list_entry_create, .destroy = lib_prefix_list_entry_destroy, + .cli_cmp = prefix_list_cmp, .cli_show = prefix_list_show, } }, -- cgit v1.2.3