diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-06-05 15:05:34 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-06-05 16:42:11 -0300 |
| commit | be96651c937848aa4f8a1fae14090788becdbc11 (patch) | |
| tree | 13364e1c72a6c8a6c5a1aa5cd50831e23e88566d /lib/filter_cli.c | |
| parent | fb7f5aa8d6437458e6aa53fdd4298ffb8e435452 (diff) | |
lib: add YANG model enumerations for filter
Avoid magic numbers by using enumerations.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/filter_cli.c')
| -rw-r--r-- | lib/filter_cli.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/filter_cli.c b/lib/filter_cli.c index a7d6b7b6e4..7800db6e0f 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1161,14 +1161,14 @@ void access_list_show(struct vty *vty, struct lyd_node *dnode, is_any = yang_dnode_exists(dnode, "./any"); switch (type) { - case 0: /* ipv4 */ + case YALT_IPV4: if (is_any) break; yang_dnode_get_prefix(&p, dnode, "./ipv4-prefix"); is_exact = yang_dnode_get_bool(dnode, "./ipv4-exact-match"); break; - case 1: /* ipv6 */ + case YALT_IPV6: /* ipv6 */ vty_out(vty, "ipv6 "); if (is_any) break; @@ -1176,7 +1176,7 @@ void access_list_show(struct vty *vty, struct lyd_node *dnode, yang_dnode_get_prefix(&p, dnode, "./ipv6-prefix"); is_exact = yang_dnode_get_bool(dnode, "./ipv6-exact-match"); break; - case 2: /* mac */ + case YALT_MAC: /* mac */ vty_out(vty, "mac "); if (is_any) break; @@ -1212,12 +1212,12 @@ void access_list_remark_show(struct vty *vty, struct lyd_node *dnode, int type = yang_dnode_get_enum(dnode, "../type"); switch (type) { - case 0: /* ipv4 */ + case YALT_IPV4: break; - case 1: /* ipv6 */ + case YALT_IPV6: vty_out(vty, "ipv6 "); break; - case 2: /* mac */ + case YALT_MAC: vty_out(vty, "mac "); break; } @@ -1693,7 +1693,7 @@ void prefix_list_show(struct vty *vty, struct lyd_node *dnode, is_any = yang_dnode_exists(dnode, "./any"); switch (type) { - case 0: /* ipv4 */ + case YPLT_IPV4: if (!is_any) yang_dnode_get_prefix(&p, dnode, "./ipv4-prefix"); if (yang_dnode_exists(dnode, @@ -1707,7 +1707,7 @@ void prefix_list_show(struct vty *vty, struct lyd_node *dnode, vty_out(vty, "ip "); break; - case 1: /* ipv6 */ + case YPLT_IPV6: if (!is_any) yang_dnode_get_prefix(&p, dnode, "ipv6-prefix"); if (yang_dnode_exists(dnode, @@ -1748,10 +1748,10 @@ void prefix_list_remark_show(struct vty *vty, struct lyd_node *dnode, int type = yang_dnode_get_enum(dnode, "../type"); switch (type) { - case 0: /* ipv4 */ + case YPLT_IPV4: vty_out(vty, "ip "); break; - case 1: /* ipv6 */ + case YPLT_IPV6: vty_out(vty, "ipv6 "); break; } |
