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;
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;
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;
}
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,
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,
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;
}
struct prefix p;
uint8_t le, ge;
- if (type == 0 /* ipv4 */) {
+ if (type == YPLT_IPV4) {
yang_dnode_get_prefix(&p, dnode, "../ipv4-prefix");
xpath_le = "../ipv4-prefix-length-lesser-or-equal";
xpath_ge = "../ipv4-prefix-length-greater-or-equal";
acl_name = yang_dnode_get_string(args->dnode, "./name");
switch (type) {
- case 0: /* ipv4 */
+ case YALT_IPV4:
acl = access_list_get(AFI_IP, acl_name);
break;
- case 1: /* ipv6 */
+ case YALT_IPV6:
acl = access_list_get(AFI_IP6, acl_name);
break;
- case 2: /* mac */
+ case YALT_MAC:
acl = access_list_get(AFI_L2VPN, acl_name);
break;
}
type = yang_dnode_get_enum(args->dnode, "../../type");
switch (type) {
- case 0: /* ipv4 */
+ case YALT_IPV4:
fz->prefix.family = AF_INET;
break;
- case 1: /* ipv6 */
+ case YALT_IPV6:
fz->prefix.family = AF_INET6;
break;
- case 2: /* mac */
+ case YALT_MAC:
fz->prefix.family = AF_ETHERNET;
break;
}
static int lib_prefix_list_entry_action_modify(struct nb_cb_modify_args *args)
{
struct prefix_list_entry *ple;
- const char *action_str;
+ int action_type;
if (args->event != NB_EV_APPLY)
return NB_OK;
/* Start prefix entry update procedure. */
prefix_list_entry_update_start(ple);
- action_str = yang_dnode_get_string(args->dnode, NULL);
- if (strcmp(action_str, "permit") == 0)
+ action_type = yang_dnode_get_enum(args->dnode, NULL);
+ if (action_type == YPLA_PERMIT)
ple->type = PREFIX_PERMIT;
else
ple->type = PREFIX_DENY;
type = yang_dnode_get_enum(args->dnode, "../../type");
switch (type) {
- case 0: /* ipv4 */
+ case YPLT_IPV4:
ple->prefix.family = AF_INET;
ple->ge = 0;
ple->le = IPV4_MAX_BITLEN;
break;
- case 1: /* ipv6 */
+ case YPLT_IPV6:
ple->prefix.family = AF_INET6;
ple->ge = 0;
ple->le = IPV6_MAX_BITLEN;