diff options
511 files changed, 38021 insertions, 12252 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index ae8b161b01..d37e0b608f 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -187,6 +187,7 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS) send_request(ifc->ifp, NULL, 0); send_update(ifc->ifp, 0, NULL, 0); + connected_free(&ifc); return 0; } diff --git a/bfdd/bfd.c b/bfdd/bfd.c index cb53d96bb9..c77b5cd1a2 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1743,9 +1743,12 @@ struct bfd_session *bfd_key_lookup(struct bfd_key key) /* Handle case where a context more complex ctx is present. * input has no iface nor local-address, but a context may - * exist + * exist. + * + * Only applies to IPv4, because IPv6 requires either + * local-address or interface. */ - if (!bs.key.mhop) { + if (!bs.key.mhop && bs.key.family == AF_INET) { ctx.result = NULL; ctx.given = &bs; hash_walk(bfd_key_hash, &bfd_key_lookup_ignore_partial_walker, diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 5cc47d5a44..0a71c18a42 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -80,7 +80,7 @@ int _ptm_bfd_send(struct bfd_session *bs, uint16_t *port, const void *data, memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family = AF_INET6; memcpy(&sin6.sin6_addr, &bs->key.peer, sizeof(sin6.sin6_addr)); - if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) + if (bs->ifp && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) sin6.sin6_scope_id = bs->ifp->ifindex; sin6.sin6_port = @@ -1051,7 +1051,7 @@ int bp_peer_socketv6(const struct bfd_session *bs) sin6.sin6_len = sizeof(sin6); #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ memcpy(&sin6.sin6_addr, &bs->key.local, sizeof(sin6.sin6_addr)); - if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) + if (bs->ifp && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) sin6.sin6_scope_id = bs->ifp->ifindex; pcount = 0; diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index a3f1638e5f..837a7b7d7d 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -447,7 +447,7 @@ static void _display_peers_counter(struct vty *vty, char *vrfname, bool use_json jo = json_object_new_array(); bvt.jo = jo; - bfd_id_iterate(_display_peer_counter_json_iter, jo); + bfd_id_iterate(_display_peer_counter_json_iter, &bvt); vty_out(vty, "%s\n", json_object_to_json_string_ext(jo, 0)); json_object_free(jo); diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index 3a80d9203b..90e2df2367 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -84,10 +84,11 @@ static void bfdd_client_deregister(struct stream *msg); static void debug_printbpc(const struct bfd_peer_cfg *bpc, const char *fmt, ...) { char timers[3][128] = {}; + char minttl_str[32] = {}; char addr[3][128] = {}; char profile[128] = {}; char cbit_str[32]; - char msgbuf[256]; + char msgbuf[512]; va_list vl; /* Avoid debug calculations if it's disabled. */ @@ -120,6 +121,10 @@ static void debug_printbpc(const struct bfd_peer_cfg *bpc, const char *fmt, ...) snprintf(cbit_str, sizeof(cbit_str), " cbit:0x%02x", bpc->bpc_cbit); + if (bpc->bpc_has_minimum_ttl) + snprintf(minttl_str, sizeof(minttl_str), " minimum-ttl:%d", + bpc->bpc_minimum_ttl); + if (bpc->bpc_has_profile) snprintf(profile, sizeof(profile), " profile:%s", bpc->bpc_profile); @@ -128,9 +133,10 @@ static void debug_printbpc(const struct bfd_peer_cfg *bpc, const char *fmt, ...) vsnprintf(msgbuf, sizeof(msgbuf), fmt, vl); va_end(vl); - zlog_debug("%s [mhop:%s %s%s%s%s%s%s%s%s]", msgbuf, + zlog_debug("%s [mhop:%s %s%s%s%s%s%s%s%s%s]", msgbuf, bpc->bpc_mhop ? "yes" : "no", addr[0], addr[1], addr[2], - timers[0], timers[1], timers[2], cbit_str, profile); + timers[0], timers[1], timers[2], cbit_str, minttl_str, + profile); } static void _ptm_bfd_session_del(struct bfd_session *bs, uint8_t diag) @@ -307,6 +313,8 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id, /* * Register/Deregister/Update Message format: + * + * Old format (being used by PTM BFD). * - header: Command, VRF * - l: pid * - w: family @@ -322,16 +330,37 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id, * - multihop: * - w: family * - AF_INET: - * - l: destination ipv4 + * - l: source IPv4 address * - AF_INET6: - * - 16 bytes: destination IPv6 + * - 16 bytes: source IPv6 address * - c: ttl * - no multihop * - AF_INET6: * - w: family - * - 16 bytes: ipv6 address + * - 16 bytes: source IPv6 address * - c: ifname length * - X bytes: interface name + * + * New format: + * - header: Command, VRF + * - l: pid + * - w: family + * - AF_INET: + * - l: destination IPv4 address + * - AF_INET6: + * - 16 bytes: destination IPv6 address + * - l: min_rx + * - l: min_tx + * - c: detect multiplier + * - c: is_multihop? + * - w: family + * - AF_INET: + * - l: source IPv4 address + * - AF_INET6: + * - 16 bytes: source IPv6 address + * - c: ttl + * - c: ifname length + * - X bytes: interface name * - c: bfd_cbit * - c: profile name length. * - X bytes: profile name. @@ -355,58 +384,50 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id, bpc->bpc_ipv4 = (bpc->bpc_peer.sa_sin.sin_family == AF_INET); /* Get peer configuration. */ - if (command != ZEBRA_BFD_DEST_DEREGISTER) { - STREAM_GETL(msg, bpc->bpc_recvinterval); - bpc->bpc_has_recvinterval = - (bpc->bpc_recvinterval != BPC_DEF_RECEIVEINTERVAL); - - STREAM_GETL(msg, bpc->bpc_txinterval); - bpc->bpc_has_txinterval = - (bpc->bpc_txinterval != BPC_DEF_TRANSMITINTERVAL); - - STREAM_GETC(msg, bpc->bpc_detectmultiplier); - bpc->bpc_has_detectmultiplier = - (bpc->bpc_detectmultiplier != BPC_DEF_DETECTMULTIPLIER); - } + STREAM_GETL(msg, bpc->bpc_recvinterval); + bpc->bpc_has_recvinterval = + (bpc->bpc_recvinterval != BPC_DEF_RECEIVEINTERVAL); + + STREAM_GETL(msg, bpc->bpc_txinterval); + bpc->bpc_has_txinterval = + (bpc->bpc_txinterval != BPC_DEF_TRANSMITINTERVAL); + + STREAM_GETC(msg, bpc->bpc_detectmultiplier); + bpc->bpc_has_detectmultiplier = + (bpc->bpc_detectmultiplier != BPC_DEF_DETECTMULTIPLIER); /* Read (single|multi)hop and its options. */ STREAM_GETC(msg, bpc->bpc_mhop); - if (bpc->bpc_mhop) { - /* Read multihop source address and TTL. */ - _ptm_msg_read_address(msg, &bpc->bpc_local); - STREAM_GETC(msg, bpc->bpc_minimum_ttl); - if (bpc->bpc_minimum_ttl >= BFD_TTL_VAL - || bpc->bpc_minimum_ttl == 0) { - zlog_warn("%s: received invalid TTL configuration %d", - __func__, bpc->bpc_has_minimum_ttl); - bpc->bpc_minimum_ttl = BFD_DEF_MHOP_TTL; - bpc->bpc_has_minimum_ttl = false; - } else { - bpc->bpc_minimum_ttl = - (BFD_TTL_VAL + 1) - bpc->bpc_minimum_ttl; - bpc->bpc_has_minimum_ttl = true; - } + + /* Read multihop source address and TTL. */ + _ptm_msg_read_address(msg, &bpc->bpc_local); + + /* Read the minimum TTL (0 means unset or invalid). */ + STREAM_GETC(msg, bpc->bpc_minimum_ttl); + if (bpc->bpc_minimum_ttl == 0) { + bpc->bpc_minimum_ttl = BFD_DEF_MHOP_TTL; + bpc->bpc_has_minimum_ttl = false; } else { - /* If target is IPv6, then we must obtain local address. */ - if (bpc->bpc_ipv4 == false) - _ptm_msg_read_address(msg, &bpc->bpc_local); + bpc->bpc_minimum_ttl = (BFD_TTL_VAL + 1) - bpc->bpc_minimum_ttl; + bpc->bpc_has_minimum_ttl = true; + } - /* - * Read interface name and make sure it fits our data - * structure, otherwise fail. - */ - STREAM_GETC(msg, ifnamelen); - if (ifnamelen >= sizeof(bpc->bpc_localif)) { - zlog_err("ptm-read: interface name is too big"); - return -1; - } + /* + * Read interface name and make sure it fits our data + * structure, otherwise fail. + */ + STREAM_GETC(msg, ifnamelen); + if (ifnamelen >= sizeof(bpc->bpc_localif)) { + zlog_err("ptm-read: interface name is too big"); + return -1; + } - bpc->bpc_has_localif = ifnamelen > 0; - if (bpc->bpc_has_localif) { - STREAM_GET(bpc->bpc_localif, msg, ifnamelen); - bpc->bpc_localif[ifnamelen] = 0; - } + bpc->bpc_has_localif = ifnamelen > 0; + if (bpc->bpc_has_localif) { + STREAM_GET(bpc->bpc_localif, msg, ifnamelen); + bpc->bpc_localif[ifnamelen] = 0; } + if (vrf_id != VRF_DEFAULT) { struct vrf *vrf; @@ -424,6 +445,7 @@ static int _ptm_msg_read(struct stream *msg, int command, vrf_id_t vrf_id, strlcpy(bpc->bpc_vrfname, VRF_DEFAULT_NAME, sizeof(bpc->bpc_vrfname)); } + /* Read control plane independant configuration. */ STREAM_GETC(msg, bpc->bpc_cbit); /* Handle profile names. */ @@ -794,7 +816,10 @@ static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS) : "delete", ifc->address); - bfdd_sessions_enable_address(ifc); + if (cmd == ZEBRA_INTERFACE_ADDRESS_ADD) + bfdd_sessions_enable_address(ifc); + else + connected_free(&ifc); return 0; } diff --git a/bgpd/bgp_addpath.c b/bgpd/bgp_addpath.c index d07d41bef8..d822f6e330 100644 --- a/bgpd/bgp_addpath.c +++ b/bgpd/bgp_addpath.c @@ -80,14 +80,12 @@ void bgp_addpath_init_bgp_data(struct bgp_addpath_bgp_data *d) afi_t afi; int i; - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - for (i = 0; i < BGP_ADDPATH_MAX; i++) { - d->id_allocators[afi][safi][i] = NULL; - d->peercount[afi][safi][i] = 0; - } - d->total_peercount[afi][safi] = 0; + FOREACH_AFI_SAFI (afi, safi) { + for (i = 0; i < BGP_ADDPATH_MAX; i++) { + d->id_allocators[afi][safi][i] = NULL; + d->peercount[afi][safi][i] = 0; } + d->total_peercount[afi][safi] = 0; } } diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index b94e24e870..ce22e8404d 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -257,9 +257,12 @@ void bgp_attr_flush_encap(struct attr *attr) attr->encap_subtlvs = NULL; } #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) { - encap_free(attr->vnc_subtlvs); - attr->vnc_subtlvs = NULL; + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs) { + encap_free(vnc_subtlvs); + bgp_attr_set_vnc_subtlvs(attr, NULL); } #endif } @@ -403,7 +406,9 @@ static bool overlay_index_same(const struct attr *a1, const struct attr *a2) return false; if (!a1 && !a2) return true; - return !memcmp(&(a1->evpn_overlay), &(a2->evpn_overlay), + + return !memcmp(bgp_attr_get_evpn_overlay(a1), + bgp_attr_get_evpn_overlay(a2), sizeof(struct bgp_route_evpn)); } @@ -663,17 +668,19 @@ unsigned int attrhash_key_make(const void *p) MIX(lcommunity_hash_make(attr->lcommunity)); if (attr->ecommunity) MIX(ecommunity_hash_make(attr->ecommunity)); - if (attr->ipv6_ecommunity) - MIX(ecommunity_hash_make(attr->ipv6_ecommunity)); - if (attr->cluster) - MIX(cluster_hash_key_make(attr->cluster)); - if (attr->transit) - MIX(transit_hash_key_make(attr->transit)); + if (bgp_attr_get_ipv6_ecommunity(attr)) + MIX(ecommunity_hash_make(bgp_attr_get_ipv6_ecommunity(attr))); + if (bgp_attr_get_cluster(attr)) + MIX(cluster_hash_key_make(bgp_attr_get_cluster(attr))); + if (bgp_attr_get_transit(attr)) + MIX(transit_hash_key_make(bgp_attr_get_transit(attr))); if (attr->encap_subtlvs) MIX(encap_hash_key_make(attr->encap_subtlvs)); #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) - MIX(encap_hash_key_make(attr->vnc_subtlvs)); + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + if (vnc_subtlvs) + MIX(encap_hash_key_make(vnc_subtlvs)); #endif MIX(attr->mp_nexthop_len); key = jhash(attr->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key); @@ -703,15 +710,19 @@ bool attrhash_cmp(const void *p1, const void *p2) && attr1->label_index == attr2->label_index && attr1->mp_nexthop_len == attr2->mp_nexthop_len && attr1->ecommunity == attr2->ecommunity - && attr1->ipv6_ecommunity == attr2->ipv6_ecommunity + && bgp_attr_get_ipv6_ecommunity(attr1) + == bgp_attr_get_ipv6_ecommunity(attr2) && attr1->lcommunity == attr2->lcommunity - && attr1->cluster == attr2->cluster - && attr1->transit == attr2->transit + && bgp_attr_get_cluster(attr1) + == bgp_attr_get_cluster(attr2) + && bgp_attr_get_transit(attr1) + == bgp_attr_get_transit(attr2) && attr1->rmap_table_id == attr2->rmap_table_id && (attr1->encap_tunneltype == attr2->encap_tunneltype) && encap_same(attr1->encap_subtlvs, attr2->encap_subtlvs) #ifdef ENABLE_BGP_VNC - && encap_same(attr1->vnc_subtlvs, attr2->vnc_subtlvs) + && encap_same(bgp_attr_get_vnc_subtlvs(attr1), + bgp_attr_get_vnc_subtlvs(attr2)) #endif && IPV6_ADDR_SAME(&attr1->mp_nexthop_global, &attr2->mp_nexthop_global) @@ -797,9 +808,11 @@ static void *bgp_attr_hash_alloc(void *p) val->encap_subtlvs = NULL; } #ifdef ENABLE_BGP_VNC - if (val->vnc_subtlvs) { - val->vnc_subtlvs = NULL; - } + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(val); + + if (vnc_subtlvs) + bgp_attr_set_vnc_subtlvs(val, NULL); #endif if (val->srv6_l3vpn) val->srv6_l3vpn = NULL; @@ -814,6 +827,7 @@ static void *bgp_attr_hash_alloc(void *p) struct attr *bgp_attr_intern(struct attr *attr) { struct attr *find; + struct ecommunity *ecomm; /* Intern referenced strucutre. */ if (attr->aspath) { @@ -836,12 +850,13 @@ struct attr *bgp_attr_intern(struct attr *attr) attr->ecommunity->refcnt++; } - if (attr->ipv6_ecommunity) { - if (!attr->ipv6_ecommunity->refcnt) - attr->ipv6_ecommunity = - ecommunity_intern(attr->ipv6_ecommunity); + ecomm = bgp_attr_get_ipv6_ecommunity(attr); + if (ecomm) { + if (!ecomm->refcnt) + bgp_attr_set_ipv6_ecommunity(attr, + ecommunity_intern(ecomm)); else - attr->ipv6_ecommunity->refcnt++; + ecomm->refcnt++; } if (attr->lcommunity) { @@ -850,17 +865,23 @@ struct attr *bgp_attr_intern(struct attr *attr) else attr->lcommunity->refcnt++; } - if (attr->cluster) { - if (!attr->cluster->refcnt) - attr->cluster = cluster_intern(attr->cluster); + + struct cluster_list *cluster = bgp_attr_get_cluster(attr); + + if (cluster) { + if (!cluster->refcnt) + bgp_attr_set_cluster(attr, cluster_intern(cluster)); else - attr->cluster->refcnt++; + cluster->refcnt++; } - if (attr->transit) { - if (!attr->transit->refcnt) - attr->transit = transit_intern(attr->transit); + + struct transit *transit = bgp_attr_get_transit(attr); + + if (transit) { + if (!transit->refcnt) + bgp_attr_set_transit(attr, transit_intern(transit)); else - attr->transit->refcnt++; + transit->refcnt++; } if (attr->encap_subtlvs) { if (!attr->encap_subtlvs->refcnt) @@ -882,12 +903,16 @@ struct attr *bgp_attr_intern(struct attr *attr) attr->srv6_vpn->refcnt++; } #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) { - if (!attr->vnc_subtlvs->refcnt) - attr->vnc_subtlvs = encap_intern(attr->vnc_subtlvs, - VNC_SUBTLV_TYPE); + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs) { + if (!vnc_subtlvs->refcnt) + bgp_attr_set_vnc_subtlvs( + attr, + encap_intern(vnc_subtlvs, VNC_SUBTLV_TYPE)); else - attr->vnc_subtlvs->refcnt++; + vnc_subtlvs->refcnt++; } #endif @@ -1003,8 +1028,7 @@ struct attr *bgp_attr_aggregate_intern( SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE); - ret = route_map_apply(aggregate->rmap.map, p, RMAP_BGP, - &rmap_path); + ret = route_map_apply(aggregate->rmap.map, p, &rmap_path); bgp->peer_self->rmap_type = 0; @@ -1036,6 +1060,9 @@ struct attr *bgp_attr_aggregate_intern( /* Unintern just the sub-components of the attr, but not the attr */ void bgp_attr_unintern_sub(struct attr *attr) { + struct ecommunity *ecomm; + struct cluster_list *cluster; + /* aspath refcount shoud be decrement. */ if (attr->aspath) aspath_unintern(&attr->aspath); @@ -1045,31 +1072,43 @@ void bgp_attr_unintern_sub(struct attr *attr) community_unintern(&attr->community); UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)); - if (attr->ecommunity) - ecommunity_unintern(&attr->ecommunity); + ecommunity_unintern(&attr->ecommunity); UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES)); - if (attr->ipv6_ecommunity) - ecommunity_unintern(&attr->ipv6_ecommunity); + ecomm = bgp_attr_get_ipv6_ecommunity(attr); + ecommunity_unintern(&ecomm); UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_IPV6_EXT_COMMUNITIES)); + bgp_attr_set_ipv6_ecommunity(attr, NULL); if (attr->lcommunity) lcommunity_unintern(&attr->lcommunity); UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)); - if (attr->cluster) - cluster_unintern(&attr->cluster); + cluster = bgp_attr_get_cluster(attr); + if (cluster) { + cluster_unintern(&cluster); + bgp_attr_set_cluster(attr, cluster); + } UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)); - if (attr->transit) - transit_unintern(&attr->transit); + struct transit *transit = bgp_attr_get_transit(attr); + + if (transit) { + transit_unintern(&transit); + bgp_attr_set_transit(attr, transit); + } if (attr->encap_subtlvs) encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE); #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) - encap_unintern(&attr->vnc_subtlvs, VNC_SUBTLV_TYPE); + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs) { + encap_unintern(&vnc_subtlvs, VNC_SUBTLV_TYPE); + bgp_attr_set_vnc_subtlvs(attr, vnc_subtlvs); + } #endif if (attr->srv6_l3vpn) @@ -1129,6 +1168,9 @@ void bgp_attr_unintern(struct attr **pattr) void bgp_attr_flush(struct attr *attr) { + struct ecommunity *ecomm; + struct cluster_list *cluster; + if (attr->aspath && !attr->aspath->refcnt) { aspath_free(attr->aspath); attr->aspath = NULL; @@ -1137,26 +1179,36 @@ void bgp_attr_flush(struct attr *attr) community_free(&attr->community); if (attr->ecommunity && !attr->ecommunity->refcnt) ecommunity_free(&attr->ecommunity); - if (attr->ipv6_ecommunity && !attr->ipv6_ecommunity->refcnt) - ecommunity_free(&attr->ipv6_ecommunity); + ecomm = bgp_attr_get_ipv6_ecommunity(attr); + if (ecomm && !ecomm->refcnt) + ecommunity_free(&ecomm); + bgp_attr_set_ipv6_ecommunity(attr, NULL); if (attr->lcommunity && !attr->lcommunity->refcnt) lcommunity_free(&attr->lcommunity); - if (attr->cluster && !attr->cluster->refcnt) { - cluster_free(attr->cluster); - attr->cluster = NULL; + + cluster = bgp_attr_get_cluster(attr); + if (cluster && !cluster->refcnt) { + cluster_free(cluster); + bgp_attr_set_cluster(attr, NULL); } - if (attr->transit && !attr->transit->refcnt) { - transit_free(attr->transit); - attr->transit = NULL; + + struct transit *transit = bgp_attr_get_transit(attr); + + if (transit && !transit->refcnt) { + transit_free(transit); + bgp_attr_set_transit(attr, NULL); } if (attr->encap_subtlvs && !attr->encap_subtlvs->refcnt) { encap_free(attr->encap_subtlvs); attr->encap_subtlvs = NULL; } #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs && !attr->vnc_subtlvs->refcnt) { - encap_free(attr->vnc_subtlvs); - attr->vnc_subtlvs = NULL; + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs && !vnc_subtlvs->refcnt) { + encap_free(vnc_subtlvs); + bgp_attr_set_vnc_subtlvs(attr, NULL); } #endif } @@ -1929,8 +1981,9 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args) args->total); } - attr->cluster = - cluster_parse((struct in_addr *)stream_pnt(peer->curr), length); + bgp_attr_set_cluster( + attr, cluster_parse((struct in_addr *)stream_pnt(peer->curr), + length)); /* XXX: Fix cluster_parse to use stream API and then remove this */ stream_forward_getp(peer->curr, length); @@ -2302,19 +2355,21 @@ bgp_attr_ipv6_ext_communities(struct bgp_attr_parser_args *args) struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; + struct ecommunity *ipv6_ecomm = NULL; if (length == 0) { - attr->ipv6_ecommunity = NULL; + bgp_attr_set_ipv6_ecommunity(attr, ipv6_ecomm); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, args->total); } - attr->ipv6_ecommunity = - ecommunity_parse_ipv6(stream_pnt(peer->curr), length); + ipv6_ecomm = ecommunity_parse_ipv6(stream_pnt(peer->curr), length); + bgp_attr_set_ipv6_ecommunity(attr, ipv6_ecomm); + /* XXX: fix ecommunity_parse to use stream API */ stream_forward_getp(peer->curr, length); - if (!attr->ipv6_ecommunity) + if (!ipv6_ecomm) return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, args->total); @@ -2419,15 +2474,17 @@ static int bgp_attr_encap(uint8_t type, struct peer *peer, /* IN */ #ifdef ENABLE_BGP_VNC } else { struct bgp_attr_encap_subtlv *stlv_last; - for (stlv_last = attr->vnc_subtlvs; + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + for (stlv_last = vnc_subtlvs; stlv_last && stlv_last->next; stlv_last = stlv_last->next) ; - if (stlv_last) { + if (stlv_last) stlv_last->next = tlv; - } else { - attr->vnc_subtlvs = tlv; - } + else + bgp_attr_set_vnc_subtlvs(attr, tlv); #endif } } @@ -2787,7 +2844,7 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) } attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); - attr->pmsi_tnl_type = tnl_type; + bgp_attr_set_pmsi_tnl_type(attr, tnl_type); stream_get(&attr->label, peer->curr, BGP_LABEL_BYTES); /* Forward read pointer of input stream. */ @@ -2837,10 +2894,9 @@ static bgp_attr_parse_ret_t bgp_attr_unknown(struct bgp_attr_parser_args *args) SET_FLAG(*startp, BGP_ATTR_FLAG_PARTIAL); /* Store transitive attribute to the end of attr->transit. */ - if (!attr->transit) - attr->transit = XCALLOC(MTYPE_TRANSIT, sizeof(struct transit)); - - transit = attr->transit; + transit = bgp_attr_get_transit(attr); + if (!transit) + transit = XCALLOC(MTYPE_TRANSIT, sizeof(struct transit)); if (transit->val) transit->val = XREALLOC(MTYPE_TRANSIT_VAL, transit->val, @@ -2850,6 +2906,7 @@ static bgp_attr_parse_ret_t bgp_attr_unknown(struct bgp_attr_parser_args *args) memcpy(transit->val + transit->length, startp, total); transit->length += total; + bgp_attr_set_transit(attr, transit); return BGP_ATTR_PARSE_PROCEED; } @@ -2922,6 +2979,7 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, struct aspath *as4_path = NULL; as_t as4_aggregator = 0; struct in_addr as4_aggregator_addr = {.s_addr = 0}; + struct transit *transit; /* Initialize bitmap. */ memset(seen, 0, BGP_ATTR_BITMAP_SIZE); @@ -3287,35 +3345,44 @@ done: aspath_unintern(&as4_path); } + transit = bgp_attr_get_transit(attr); if (ret != BGP_ATTR_PARSE_ERROR) { /* Finally intern unknown attribute. */ - if (attr->transit) - attr->transit = transit_intern(attr->transit); + if (transit) + bgp_attr_set_transit(attr, transit_intern(transit)); if (attr->encap_subtlvs) attr->encap_subtlvs = encap_intern(attr->encap_subtlvs, ENCAP_SUBTLV_TYPE); #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) - attr->vnc_subtlvs = encap_intern(attr->vnc_subtlvs, - VNC_SUBTLV_TYPE); + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs) + bgp_attr_set_vnc_subtlvs( + attr, + encap_intern(vnc_subtlvs, VNC_SUBTLV_TYPE)); #endif } else { - if (attr->transit) { - transit_free(attr->transit); - attr->transit = NULL; + if (transit) { + transit_free(transit); + bgp_attr_set_transit(attr, NULL); } bgp_attr_flush_encap(attr); }; /* Sanity checks */ - if (attr->transit) - assert(attr->transit->refcnt > 0); + transit = bgp_attr_get_transit(attr); + if (transit) + assert(transit->refcnt > 0); if (attr->encap_subtlvs) assert(attr->encap_subtlvs->refcnt > 0); #ifdef ENABLE_BGP_VNC - if (attr->vnc_subtlvs) - assert(attr->vnc_subtlvs->refcnt > 0); + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(attr); + + if (vnc_subtlvs) + assert(vnc_subtlvs->refcnt > 0); #endif return ret; @@ -3567,7 +3634,7 @@ static void bgp_packet_mpattr_tea(struct bgp *bgp, struct peer *peer, #ifdef ENABLE_BGP_VNC_ATTR case BGP_ATTR_VNC: attrname = "VNC"; - subtlvs = attr->vnc_subtlvs; + subtlvs = bgp_attr_get_vnc_subtlvs(attr); if (subtlvs == NULL) /* nothing to do */ return; attrlenfield = 0; /* no outer T + L */ @@ -3893,6 +3960,8 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, /* Route Reflector. */ if (peer->sort == BGP_PEER_IBGP && from && from->sort == BGP_PEER_IBGP) { + struct cluster_list *cluster = bgp_attr_get_cluster(attr); + /* Originator ID. */ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL); stream_putc(s, BGP_ATTR_ORIGINATOR_ID); @@ -3907,16 +3976,15 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, stream_putc(s, BGP_ATTR_FLAG_OPTIONAL); stream_putc(s, BGP_ATTR_CLUSTER_LIST); - if (attr->cluster) { - stream_putc(s, attr->cluster->length + 4); + if (cluster) { + stream_putc(s, cluster->length + 4); /* If this peer configuration's parent BGP has * cluster_id. */ if (bgp->config & BGP_CONFIG_CLUSTER_ID) stream_put_in_addr(s, &bgp->cluster_id); else stream_put_in_addr(s, &bgp->router_id); - stream_put(s, attr->cluster->list, - attr->cluster->length); + stream_put(s, cluster->list, cluster->length); } else { stream_putc(s, 4); /* If this peer configuration's parent BGP has @@ -4112,7 +4180,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, stream_putc(s, BGP_ATTR_PMSI_TUNNEL); stream_putc(s, 9); // Length stream_putc(s, 0); // Flags - stream_putc(s, attr->pmsi_tnl_type); + stream_putc(s, bgp_attr_get_pmsi_tnl_type(attr)); stream_put(s, &(attr->label), BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI stream_put_ipv4(s, attr->nexthop.s_addr); @@ -4120,8 +4188,10 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, } /* Unknown transit attribute. */ - if (attr->transit) - stream_put(s, attr->transit->val, attr->transit->length); + struct transit *transit = bgp_attr_get_transit(attr); + + if (transit) + stream_put(s, transit->val, transit->length); /* Return total size of attribute. */ return stream_get_endp(s) - cp; diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index ef0e74344a..1b176f8716 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -185,7 +185,7 @@ struct attr { struct lcommunity *lcommunity; /* Route-Reflector Cluster attribute */ - struct cluster_list *cluster; + struct cluster_list *cluster1; /* Unknown transitive attribute. */ struct transit *transit; @@ -331,7 +331,7 @@ struct transit { #define BGP_CLUSTER_LIST_LENGTH(attr) \ (((attr)->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) \ - ? (attr)->cluster->length \ + ? bgp_attr_get_cluster((attr))->length \ : 0) typedef enum { @@ -457,4 +457,81 @@ static inline uint32_t mac_mobility_seqnum(struct attr *attr) { return (attr) ? attr->mm_seqnum : 0; } + +static inline enum pta_type bgp_attr_get_pmsi_tnl_type(struct attr *attr) +{ + return attr->pmsi_tnl_type; +} + +static inline void bgp_attr_set_pmsi_tnl_type(struct attr *attr, + enum pta_type pmsi_tnl_type) +{ + attr->pmsi_tnl_type = pmsi_tnl_type; +} + +static inline struct ecommunity * +bgp_attr_get_ipv6_ecommunity(const struct attr *attr) +{ + return attr->ipv6_ecommunity; +} + +static inline void bgp_attr_set_ipv6_ecommunity(struct attr *attr, + struct ecommunity *ipv6_ecomm) +{ + attr->ipv6_ecommunity = ipv6_ecomm; +} + +static inline struct transit *bgp_attr_get_transit(const struct attr *attr) +{ + return attr->transit; +} + +static inline void bgp_attr_set_transit(struct attr *attr, + struct transit *transit) +{ + attr->transit = transit; +} + +static inline struct cluster_list *bgp_attr_get_cluster(const struct attr *attr) +{ + return attr->cluster1; +} + +static inline void bgp_attr_set_cluster(struct attr *attr, + struct cluster_list *cl) +{ + attr->cluster1 = cl; +} + +static inline const struct bgp_route_evpn * +bgp_attr_get_evpn_overlay(const struct attr *attr) +{ + return &attr->evpn_overlay; +} + +static inline void bgp_attr_set_evpn_overlay(struct attr *attr, + struct bgp_route_evpn *eo) +{ + memcpy(&attr->evpn_overlay, eo, sizeof(struct bgp_route_evpn)); +} + +static inline struct bgp_attr_encap_subtlv * +bgp_attr_get_vnc_subtlvs(const struct attr *attr) +{ +#ifdef ENABLE_BGP_VNC + return attr->vnc_subtlvs; +#else + return NULL; +#endif +} + +static inline void +bgp_attr_set_vnc_subtlvs(struct attr *attr, + struct bgp_attr_encap_subtlv *vnc_subtlvs) +{ +#ifdef ENABLE_BGP_VNC + attr->vnc_subtlvs = vnc_subtlvs; +#endif +} + #endif /* _QUAGGA_BGP_ATTR_H */ diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index af88547ca9..82e27884cf 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1329,6 +1329,33 @@ static int bmp_stats(struct thread *thread) return 0; } +/* read from the BMP socket to detect session termination */ +static int bmp_read(struct thread *t) +{ + struct bmp *bmp = THREAD_ARG(t); + char buf[1024]; + ssize_t n; + + bmp->t_read = NULL; + + n = read(bmp->socket, buf, sizeof(buf)); + if (n >= 1) { + zlog_info("bmp[%s]: unexpectedly received %zu bytes", bmp->remote, n); + } else if (n == 0) { + /* the TCP session was terminated by the far end */ + bmp_wrerr(bmp, NULL, true); + return 0; + } else if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) { + /* the TCP session experienced a fatal error, likely a timeout */ + bmp_wrerr(bmp, NULL, false); + return -1; + } + + thread_add_read(bm->master, bmp_read, bmp, bmp->socket, &bmp->t_read); + + return 0; +} + static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) { union sockunion su, *sumem; @@ -1349,9 +1376,11 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) set_nonblocking(bmp_sock); set_cloexec(bmp_sock); - shutdown(bmp_sock, SHUT_RD); - sockunion2hostprefix(&su, &p); + if (!sockunion2hostprefix(&su, &p)) { + close(bmp_sock); + return NULL; + } acl = NULL; switch (p.family) { @@ -1400,6 +1429,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) bmp->state = BMP_PeerUp; bmp->pullwr = pullwr_new(bm->master, bmp_sock, bmp, bmp_wrfill, bmp_wrerr); + thread_add_read(bm->master, bmp_read, bmp, bmp_sock, &bmp->t_read); bmp_send_initiation(bmp); return bmp; @@ -1432,6 +1462,8 @@ static void bmp_close(struct bmp *bmp) struct bmp_queue_entry *bqe; struct bmp_mirrorq *bmq; + THREAD_OFF(bmp->t_read); + if (bmp->active) bmp_active_disconnected(bmp->active); diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index 0731adcb84..b5cd1b52b7 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -47,10 +47,11 @@ bgp_check_rmap_prefixes_in_bgp_table(struct bgp_table *table, RESET_FLAG(dummy_attr.rmap_change_flags); - ret = route_map_apply(rmap, dest_p, RMAP_BGP, &path); + ret = route_map_apply(rmap, dest_p, &path); if (ret != RMAP_PERMITMATCH) bgp_attr_flush(&dummy_attr); else { + bgp_dest_unlock_node(dest); if (BGP_DEBUG(update, UPDATE_OUT)) zlog_debug( "%s: Condition map routes present in BGP table", @@ -112,7 +113,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi, RESET_FLAG(dummy_attr.rmap_change_flags); - if (route_map_apply(rmap, dest_p, RMAP_BGP, &path) + if (route_map_apply(rmap, dest_p, &path) != RMAP_PERMITMATCH) { bgp_attr_flush(&dummy_attr); continue; diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index a513bc493d..2c076fb80b 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -429,18 +429,21 @@ bool bgp_dump_attr(struct attr *attr, char *buf, size_t size) ", originator %pI4", &attr->originator_id); if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))) { + struct cluster_list *cluster; int i; snprintf(buf + strlen(buf), size - strlen(buf), ", clusterlist"); - for (i = 0; i < attr->cluster->length / 4; i++) + + cluster = bgp_attr_get_cluster(attr); + for (i = 0; i < cluster->length / 4; i++) snprintfrr(buf + strlen(buf), size - strlen(buf), - " %pI4", &attr->cluster->list[i]); + " %pI4", &cluster->list[i]); } if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) snprintf(buf + strlen(buf), size - strlen(buf), - ", pmsi tnltype %u", attr->pmsi_tnl_type); + ", pmsi tnltype %u", bgp_attr_get_pmsi_tnl_type(attr)); if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH))) snprintf(buf + strlen(buf), size - strlen(buf), ", path %s", @@ -904,8 +907,8 @@ DEFUN (debug_bgp_keepalive_peer, "debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>", DEBUG_STR BGP_STR - "BGP Neighbor Events\n" - "BGP neighbor IP address to debug\n" + "BGP keepalives\n" + "BGP IPv4 neighbor to debug\n" "BGP IPv6 neighbor to debug\n" "BGP neighbor on interface to debug\n") { diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index de3757aebb..43bfb3e2bc 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -327,6 +327,9 @@ void ecommunity_unintern(struct ecommunity **ecom) { struct ecommunity *ret; + if (!*ecom) + return; + if ((*ecom)->refcnt) (*ecom)->refcnt--; @@ -900,7 +903,7 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) int str_size; char *str_buf; - if (ecom->size == 0) + if (!ecom || ecom->size == 0) return XCALLOC(MTYPE_ECOMMUNITY_STR, 1); /* ecom strlen + space + null term */ diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index e9c52287f1..6318e7edb1 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -227,7 +227,7 @@ extern struct ecommunity *ecommunity_merge(struct ecommunity *, extern struct ecommunity *ecommunity_uniq_sort(struct ecommunity *); extern struct ecommunity *ecommunity_intern(struct ecommunity *); extern bool ecommunity_cmp(const void *arg1, const void *arg2); -extern void ecommunity_unintern(struct ecommunity **); +extern void ecommunity_unintern(struct ecommunity **ecommunity); extern unsigned int ecommunity_hash_make(const void *); extern struct ecommunity *ecommunity_str2com(const char *, int, int); extern struct ecommunity *ecommunity_str2com_ipv6(const char *str, int type, diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c index 8a33ce6789..0f9d5fc73a 100644 --- a/bgpd/bgp_errors.c +++ b/bgpd/bgp_errors.c @@ -463,6 +463,18 @@ static struct log_ref ferr_bgp_err[] = { .suggestion = "Change one of the two router-id's", }, { + .code = EC_BGP_INVALID_BGP_INSTANCE, + .title = "BGP instance for the specifc vrf is invalid", + .description = "Indicates that specified bgp instance is NULL", + .suggestion = "Get log files from router and open an issue", + }, + { + .code = EC_BGP_INVALID_ROUTE, + .title = "BGP route node is invalid", + .description = "BGP route for the specified AFI/SAFI is NULL", + .suggestion = "Get log files from router and open an issue", + }, + { .code = END_FERR, } }; diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h index 49c58ae6b0..20056d382a 100644 --- a/bgpd/bgp_errors.h +++ b/bgpd/bgp_errors.h @@ -99,6 +99,8 @@ enum bgp_log_refs { EC_BGP_INVALID_NEXTHOP_LENGTH, EC_BGP_DOPPELGANGER_CONFIG, EC_BGP_ROUTER_ID_SAME, + EC_BGP_INVALID_BGP_INSTANCE, + EC_BGP_INVALID_ROUTE, }; extern void bgp_error_init(void); diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 67d0a95cb6..15d647f4df 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -980,7 +980,7 @@ static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn, } else if (p->prefix.route_type == BGP_EVPN_AD_ROUTE) { ret = bgp_evpn_remote_es_evi_add(bgp, vpn, p); } else { - switch (pi->attr->pmsi_tnl_type) { + switch (bgp_attr_get_pmsi_tnl_type(pi->attr)) { case PMSI_TNLTYPE_INGR_REPL: flood_control = VXLAN_FLOOD_HEAD_END_REPL; break; @@ -1485,10 +1485,10 @@ static void update_evpn_route_entry_sync_info(struct bgp *bgp, * or the global route table. */ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, - afi_t afi, safi_t safi, struct bgp_dest *dest, - struct attr *attr, int add, - struct bgp_path_info **pi, uint8_t flags, - uint32_t seq, bool setup_sync, + afi_t afi, safi_t safi, + struct bgp_dest *dest, struct attr *attr, + int add, struct bgp_path_info **pi, + uint8_t flags, uint32_t seq, bool vpn_rt, bool *old_is_sync) { struct bgp_path_info *tmp_pi; @@ -1520,7 +1520,7 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, /* if a local path is being added with a non-zero esi look * for SYNC paths from ES peers and bubble up the sync-info */ - update_evpn_route_entry_sync_info(bgp, dest, attr, seq, setup_sync); + update_evpn_route_entry_sync_info(bgp, dest, attr, seq, vpn_rt); /* For non-GW MACs, update MAC mobility seq number, if needed. */ if (seq && !CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) @@ -1612,6 +1612,14 @@ static int update_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, } } + /* MAC-IP routes in the VNI route table are linked to the + * destination ES + */ + if (route_change && vpn_rt + && (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)) + bgp_evpn_path_es_link(tmp_pi, vpn->vni, + bgp_evpn_attr_get_esi(tmp_pi->attr)); + /* Return back the route entry. */ *pi = tmp_pi; return route_change; @@ -1711,7 +1719,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, /* PMSI is only needed for type-3 routes */ if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) { attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); - attr.pmsi_tnl_type = PMSI_TNLTYPE_INGR_REPL; + bgp_attr_set_pmsi_tnl_type(&attr, PMSI_TNLTYPE_INGR_REPL); } if (bgp_debug_zebra(NULL)) { @@ -2513,7 +2521,7 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, if (!pi) { /* Create an info */ - (void)bgp_create_evpn_bgp_path_info(parent_pi, dest, + pi = bgp_create_evpn_bgp_path_info(parent_pi, dest, parent_pi->attr); } else { if (attrhash_cmp(pi->attr, parent_pi->attr) @@ -2539,6 +2547,11 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn, pi->uptime = bgp_clock(); } + /* MAC-IP routes in the VNI table are linked to the destination ES */ + if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) + bgp_evpn_path_es_link(pi, vpn->vni, + bgp_evpn_attr_get_esi(pi->attr)); + /* Perform route selection and update zebra, if required. */ ret = evpn_route_select_install(bgp, vpn, dest); @@ -2852,6 +2865,55 @@ static int bgp_evpn_route_rmac_self_check(struct bgp *bgp_vrf, return 0; } +/* don't import hosts that are locally attached */ +static inline bool +bgp_evpn_skip_vrf_import_of_local_es(const struct prefix_evpn *evp, + struct bgp_path_info *pi, int install) +{ + esi_t *esi; + struct in_addr nh; + + if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) { + esi = bgp_evpn_attr_get_esi(pi->attr); + + /* Don't import routes that point to a local destination */ + if (bgp_evpn_attr_is_local_es(pi->attr)) { + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) { + char esi_buf[ESI_STR_LEN]; + + zlog_debug( + "vrf %s of evpn prefix %pFX skipped, local es %s", + install ? "import" : "unimport", evp, + esi_to_str(esi, esi_buf, + sizeof(esi_buf))); + } + return true; + } + + /* Don't import routes with ES as destination if the nexthop + * has not been advertised via the EAD-ES + */ + if (pi->attr) + nh = pi->attr->nexthop; + else + nh.s_addr = 0; + if (install && !bgp_evpn_es_is_vtep_active(esi, nh)) { + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) { + char esi_buf[ESI_STR_LEN]; + + zlog_debug( + "vrf %s of evpn prefix %pFX skipped, nh %pI4 inactive in es %s", + install ? "import" : "unimport", evp, + &nh, + esi_to_str(esi, esi_buf, + sizeof(esi_buf))); + } + return true; + } + } + return false; +} + /* * Install or uninstall mac-ip routes are appropriate for this * particular VRF. @@ -2909,6 +2971,12 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) && pi->sub_type == BGP_ROUTE_NORMAL)) continue; + /* don't import hosts that are locally attached + */ + if (bgp_evpn_skip_vrf_import_of_local_es( + evp, pi, install)) + continue; + if (is_route_matching_for_vrf(bgp_vrf, pi)) { if (bgp_evpn_route_rmac_self_check( bgp_vrf, evp, pi)) @@ -2930,6 +2998,8 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) evp, vrf_id_to_name( bgp_vrf->vrf_id)); + bgp_dest_unlock_node(rd_dest); + bgp_dest_unlock_node(dest); return ret; } } @@ -3009,6 +3079,9 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp, ? "MACIP" : "IMET", vpn->vni); + + bgp_dest_unlock_node(rd_dest); + bgp_dest_unlock_node(dest); return ret; } } @@ -3110,6 +3183,10 @@ static int install_uninstall_route_in_vrfs(struct bgp *bgp_def, afi_t afi, || is_evpn_prefix_ipaddr_v6(evp))) return 0; + /* don't import hosts that are locally attached */ + if (bgp_evpn_skip_vrf_import_of_local_es(evp, pi, install)) + return 0; + for (ALL_LIST_ELEMENTS(vrfs, node, nnode, bgp_vrf)) { int ret; @@ -3172,9 +3249,11 @@ static int install_uninstall_route_in_vnis(struct bgp *bgp, afi_t afi, /* * Install or uninstall route for appropriate VNIs/ESIs. */ -static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, - const struct prefix *p, - struct bgp_path_info *pi, int import) +static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi, + safi_t safi, const struct prefix *p, + struct bgp_path_info *pi, + int import, bool in_vni_rt, + bool in_vrf_rt) { struct prefix_evpn *evp = (struct prefix_evpn *)p; struct attr *attr = pi->attr; @@ -3236,13 +3315,13 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, evp->prefix.route_type == BGP_EVPN_AD_ROUTE || evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE) { - irt = lookup_import_rt(bgp, eval); + irt = in_vni_rt ? lookup_import_rt(bgp, eval) : NULL; if (irt) install_uninstall_route_in_vnis( bgp, afi, safi, evp, pi, irt->vnis, import); - vrf_irt = lookup_vrf_import_rt(eval); + vrf_irt = in_vrf_rt ? lookup_vrf_import_rt(eval) : NULL; if (vrf_irt) install_uninstall_route_in_vrfs( bgp, afi, safi, evp, pi, vrf_irt->vrfs, @@ -3261,8 +3340,11 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, || type == ECOMMUNITY_ENCODE_IP) { memcpy(&eval_tmp, eval, ecom->unit_size); mask_ecom_global_admin(&eval_tmp, eval); - irt = lookup_import_rt(bgp, &eval_tmp); - vrf_irt = lookup_vrf_import_rt(&eval_tmp); + if (in_vni_rt) + irt = lookup_import_rt(bgp, &eval_tmp); + if (in_vrf_rt) + vrf_irt = + lookup_vrf_import_rt(&eval_tmp); } if (irt) @@ -3292,6 +3374,31 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, } /* + * Install or uninstall route for appropriate VNIs/ESIs. + */ +static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, + const struct prefix *p, + struct bgp_path_info *pi, int import) +{ + return bgp_evpn_install_uninstall_table(bgp, afi, safi, p, pi, import, + true, true); +} + +/* Import the pi into vrf routing tables */ +void bgp_evpn_import_route_in_vrfs(struct bgp_path_info *pi, int import) +{ + struct bgp *bgp_evpn; + + bgp_evpn = bgp_get_evpn(); + if (!bgp_evpn) + return; + + bgp_evpn_install_uninstall_table(bgp_evpn, AFI_L2VPN, SAFI_EVPN, + &pi->net->p, pi, import, false /*vpn*/, + true /*vrf*/); +} + +/* * delete and withdraw all ipv4 and ipv6 routes in the vrf table as type-5 * routes */ @@ -3738,12 +3845,14 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, */ if (attr && (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) { - if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL && - attr->pmsi_tnl_type != PMSI_TNLTYPE_PIM_SM) { - flog_warn(EC_BGP_EVPN_PMSI_PRESENT, - "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", - peer->bgp->vrf_id, peer->host, - attr->pmsi_tnl_type); + enum pta_type pmsi_tnl_type = bgp_attr_get_pmsi_tnl_type(attr); + + if (pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL + && pmsi_tnl_type != PMSI_TNLTYPE_PIM_SM) { + flog_warn( + EC_BGP_EVPN_PMSI_PRESENT, + "%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", + peer->bgp->vrf_id, peer->host, pmsi_tnl_type); } } @@ -3942,11 +4051,13 @@ static void evpn_mpattr_encode_type5(struct stream *s, const struct prefix *p, else stream_put(s, &p_evpn_p->prefix_addr.ip.ipaddr_v6, 16); if (attr) { + const struct bgp_route_evpn *evpn_overlay = + bgp_attr_get_evpn_overlay(attr); + if (IS_IPADDR_V4(&p_evpn_p->prefix_addr.ip)) - stream_put_ipv4(s, - attr->evpn_overlay.gw_ip.ipv4.s_addr); + stream_put_ipv4(s, evpn_overlay->gw_ip.ipv4.s_addr); else - stream_put(s, &(attr->evpn_overlay.gw_ip.ipv6), 16); + stream_put(s, &(evpn_overlay->gw_ip.ipv6), 16); } else { if (IS_IPADDR_V4(&p_evpn_p->prefix_addr.ip)) stream_put_ipv4(s, 0); @@ -4201,7 +4312,7 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi, bgp_vrf->adv_cmd_rmap[afi][safi] .map, bgp_dest_get_prefix(dest), - RMAP_BGP, &tmp_pi); + &tmp_pi); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&tmp_attr); continue; diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index ba43191ebf..29d3d2c62f 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -77,17 +77,16 @@ static inline int advertise_type5_routes(struct bgp *bgp_vrf, } /* Flag if the route's parent is a EVPN route. */ -static inline int is_route_parent_evpn(struct bgp_path_info *ri) +static inline struct bgp_path_info * +get_route_parent_evpn(struct bgp_path_info *ri) { struct bgp_path_info *parent_ri; - struct bgp_table *table; - struct bgp_dest *dest; /* If not imported (or doesn't have a parent), bail. */ if (ri->sub_type != BGP_ROUTE_IMPORTED || !ri->extra || !ri->extra->parent) - return 0; + return NULL; /* Determine parent recursively */ for (parent_ri = ri->extra->parent; @@ -95,6 +94,20 @@ static inline int is_route_parent_evpn(struct bgp_path_info *ri) parent_ri = parent_ri->extra->parent) ; + return parent_ri; +} + +/* Flag if the route's parent is a EVPN route. */ +static inline int is_route_parent_evpn(struct bgp_path_info *ri) +{ + struct bgp_path_info *parent_ri; + struct bgp_table *table; + struct bgp_dest *dest; + + parent_ri = get_route_parent_evpn(ri); + if (!parent_ri) + return 0; + /* See if of family L2VPN/EVPN */ dest = parent_ri->net; if (!dest) diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 021e811147..4bc53b10e8 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -48,6 +48,8 @@ #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_addpath.h" #include "bgpd/bgp_label.h" +#include "bgpd/bgp_nht.h" +#include "bgpd/bgp_mpath.h" static void bgp_evpn_local_es_down(struct bgp *bgp, struct bgp_evpn_es *es); @@ -63,6 +65,12 @@ static void bgp_evpn_es_vtep_del(struct bgp *bgp, static void bgp_evpn_es_cons_checks_pend_add(struct bgp_evpn_es *es); static void bgp_evpn_es_cons_checks_pend_del(struct bgp_evpn_es *es); static void bgp_evpn_local_es_evi_do_del(struct bgp_evpn_es_evi *es_evi); +static uint32_t bgp_evpn_es_get_active_vtep_cnt(struct bgp_evpn_es *es); +static void bgp_evpn_l3nhg_update_on_vtep_chg(struct bgp_evpn_es *es); +static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi); +static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller); +static void bgp_evpn_es_path_all_update(struct bgp_evpn_es_vtep *es_vtep, + bool active); esi_t zero_esi_buf, *zero_esi = &zero_esi_buf; @@ -763,6 +771,9 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp, install ? "install" : "uninstall", evp, es->esi_str); + + bgp_dest_unlock_node(rd_dest); + bgp_dest_unlock_node(dest); return ret; } } @@ -1225,6 +1236,15 @@ static void bgp_evpn_es_vtep_re_eval_active(struct bgp *bgp, /* send remote ES to zebra */ bgp_zebra_send_remote_es_vtep(bgp, es_vtep, new_active); + /* The NHG is updated first for efficient failover handling. + * Note the NHG can be de-activated while there are bgp + * routes referencing it. Zebra is capable of handling that + * elegantly by holding the NHG till all routes using it are + * removed. + */ + bgp_evpn_l3nhg_update_on_vtep_chg(es_vtep->es); + bgp_evpn_es_path_all_update(es_vtep, new_active); + /* queue up the es for background consistency checks */ bgp_evpn_es_cons_checks_pend_add(es_vtep->es); } @@ -1300,6 +1320,164 @@ static void bgp_evpn_es_vtep_del(struct bgp *bgp, bgp_evpn_es_vtep_do_del(bgp, es_vtep, esr); } +bool bgp_evpn_es_is_vtep_active(esi_t *esi, struct in_addr nh) +{ + struct bgp_evpn_es *es; + struct bgp_evpn_es_vtep *es_vtep; + struct listnode *node = NULL; + bool rc = false; + + if (!memcmp(esi, zero_esi, sizeof(*esi)) || !nh.s_addr) + return true; + + es = bgp_evpn_es_find(esi); + if (!es) + return false; + + for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, es_vtep)) { + if (es_vtep->vtep_ip.s_addr == nh.s_addr) { + if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE)) + rc = true; + break; + } + } + return rc; +} + +/********************** ES MAC-IP paths ************************************* + * MAC-IP routes in the VNI routing table are linked to the destination + * ES for efficient updates on ES changes (such as VTEP add/del). + ****************************************************************************/ +void bgp_evpn_path_es_info_free(struct bgp_path_es_info *es_info) +{ + bgp_evpn_path_es_unlink(es_info); + XFREE(MTYPE_BGP_EVPN_PATH_ES_INFO, es_info); +} + +static struct bgp_path_es_info * +bgp_evpn_path_es_info_new(struct bgp_path_info *pi, vni_t vni) +{ + struct bgp_path_info_extra *e; + + e = bgp_path_info_extra_get(pi); + + /* If es_info doesn't exist allocate it */ + if (!e->es_info) { + e->es_info = XCALLOC(MTYPE_BGP_EVPN_PATH_ES_INFO, + sizeof(struct bgp_path_es_info)); + e->es_info->pi = pi; + e->es_info->vni = vni; + } + + return e->es_info; +} + +void bgp_evpn_path_es_unlink(struct bgp_path_es_info *es_info) +{ + struct bgp_evpn_es *es = es_info->es; + struct bgp_path_info *pi; + + if (!es) + return; + + pi = es_info->pi; + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) + zlog_debug("vni %u path %pFX unlinked from es %s", es_info->vni, + &pi->net->p, es->esi_str); + + list_delete_node(es->macip_path_list, &es_info->es_listnode); + es_info->es = NULL; + + /* if there are no other references against the ES it + * needs to be freed + */ + bgp_evpn_es_free(es, __func__); + + /* Note we don't free the path es_info on unlink; it will be freed up + * along with the path. + */ +} + +void bgp_evpn_path_es_link(struct bgp_path_info *pi, vni_t vni, esi_t *esi) +{ + struct bgp_path_es_info *es_info; + struct bgp_evpn_es *es; + struct bgp *bgp_evpn = bgp_get_evpn(); + + es_info = pi->extra ? pi->extra->es_info : NULL; + /* if the esi is zero just unlink the path from the old es */ + if (!esi || !memcmp(esi, zero_esi, sizeof(*esi))) { + if (es_info) + bgp_evpn_path_es_unlink(es_info); + return; + } + + if (!bgp_evpn) + return; + + /* setup es_info against the path if it doesn't aleady exist */ + if (!es_info) + es_info = bgp_evpn_path_es_info_new(pi, vni); + + /* find-create ES */ + es = bgp_evpn_es_find(esi); + if (!es) + es = bgp_evpn_es_new(bgp_evpn, esi); + + /* dup check */ + if (es_info->es == es) + return; + + /* unlink old ES if any */ + bgp_evpn_path_es_unlink(es_info); + + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) + zlog_debug("vni %u path %pFX linked to es %s", vni, &pi->net->p, + es->esi_str); + + /* link mac-ip path to the new destination ES */ + es_info->es = es; + listnode_init(&es_info->es_listnode, es_info); + listnode_add(es->macip_path_list, &es_info->es_listnode); +} + +static void bgp_evpn_es_path_all_update(struct bgp_evpn_es_vtep *es_vtep, + bool active) +{ + struct listnode *node; + struct bgp_path_es_info *es_info; + struct bgp_path_info *pi; + struct bgp_path_info *parent_pi; + struct bgp_evpn_es *es = es_vtep->es; + char prefix_buf[PREFIX_STRLEN]; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) + zlog_debug("update all paths linked to es %s", es->esi_str); + + for (ALL_LIST_ELEMENTS_RO(es->macip_path_list, node, es_info)) { + pi = es_info->pi; + if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)) + continue; + + if (pi->sub_type != BGP_ROUTE_IMPORTED) + continue; + + parent_pi = pi->extra ? pi->extra->parent : NULL; + if (!parent_pi || !parent_pi->attr) + continue; + + if (es_vtep->vtep_ip.s_addr != parent_pi->attr->nexthop.s_addr) + continue; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_RT)) + zlog_debug("update path %s linked to es %s", + prefix2str(&parent_pi->net->p, prefix_buf, + sizeof(prefix_buf)), + es->esi_str); + bgp_evpn_import_route_in_vrfs(parent_pi, active ? 1 : 0); + } +} + /* compare ES-IDs for the global ES RB tree */ static int bgp_es_rb_cmp(const struct bgp_evpn_es *es1, const struct bgp_evpn_es *es2) @@ -1348,6 +1526,14 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi) es->es_evi_list = list_new(); listset_app_node_mem(es->es_evi_list); + /* Initialise the ES-VRF list used for L3NHG management */ + es->es_vrf_list = list_new(); + listset_app_node_mem(es->es_vrf_list); + + /* Initialise the route list used for efficient event handling */ + es->macip_path_list = list_new(); + listset_app_node_mem(es->macip_path_list); + QOBJ_REG(es, bgp_evpn_es); return es; @@ -1359,7 +1545,8 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi) */ static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller) { - if (es->flags & (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) + if ((es->flags & (BGP_EVPNES_LOCAL | BGP_EVPNES_REMOTE)) + || listcount(es->macip_path_list)) return; if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) @@ -1367,7 +1554,9 @@ static void bgp_evpn_es_free(struct bgp_evpn_es *es, const char *caller) /* cleanup resources maintained against the ES */ list_delete(&es->es_evi_list); + list_delete(&es->es_vrf_list); list_delete(&es->es_vtep_list); + list_delete(&es->macip_path_list); bgp_table_unlock(es->route_table); /* remove the entry from various databases */ @@ -1806,6 +1995,10 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty, ip_buf, sizeof(ip_buf))); json_object_int_add(json, "remoteVniCount", es->remote_es_evi_cnt); + json_object_int_add(json, "vrfCount", + listcount(es->es_vrf_list)); + json_object_int_add(json, "macipPathCount", + listcount(es->macip_path_list)); json_object_int_add(json, "inconsistentVniVtepCount", es->incons_evi_vtep_cnt); if (listcount(es->es_vtep_list)) { @@ -1850,6 +2043,9 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty, vty_out(vty, " VNI Count: %d\n", listcount(es->es_evi_list)); vty_out(vty, " Remote VNI Count: %d\n", es->remote_es_evi_cnt); + vty_out(vty, " VRF Count: %d\n", listcount(es->es_vrf_list)); + vty_out(vty, " MACIP Path Count: %d\n", + listcount(es->macip_path_list)); vty_out(vty, " Inconsistent VNI VTEP Count: %d\n", es->incons_evi_vtep_cnt); if (es->inconsistencies) { @@ -1938,6 +2134,517 @@ void bgp_evpn_es_show_esi(struct vty *vty, esi_t *esi, bool uj) } /*****************************************************************************/ +/* Ethernet Segment to VRF association - + * 1. Each ES-EVI entry is associated with a tenant VRF. This associaton + * triggers the creation of an ES-VRF entry. + * 2. The ES-VRF entry is maintained for the purpose of L3-NHG creation + * 3. Type-2/MAC-IP routes are imported into a tenant VRF and programmed as + * a /32 or host route entry in the dataplane. If the destination of + * the host route is a remote-ES the route is programmed with the + * corresponding (keyed in by {vrf,ES-id}) L3-NHG. + * 4. The reason for this indirection (route->L3-NHG, L3-NHG->list-of-VTEPs) + * is to avoid route updates to the dplane when a remote-ES link flaps i.e. + * instead of updating all the dependent routes the NHG's contents are updated. + * This reduces the amount of datplane updates (nhg updates vs. route updates) + * allowing for a faster failover. + * + * XXX - can the L3 SVI index change without change in vpn->bgp_vrf + * association? If yes we need to handle that by updating all the L3 NHGs + * in that VRF. + */ +/******************************** L3 NHG management *************************/ +static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, + bool v4_nhg) +{ + uint32_t nhg_id = v4_nhg ? es_vrf->nhg_id : es_vrf->v6_nhg_id; + struct bgp_evpn_es *es = es_vrf->es; + struct listnode *node; + struct bgp_evpn_es_vtep *es_vtep; + struct nexthop nh; + struct zapi_nexthop *api_nh; + struct zapi_nhg api_nhg = {}; + + /* Skip installation of L3-NHG if host routes used */ + if (!nhg_id) + return; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u %s nhg %u to zebra", es->esi_str, + es_vrf->bgp_vrf->vrf_id, + v4_nhg ? "v4_nhg" : "v6_nhg", nhg_id); + + /* only the gateway ip changes for each NH. rest of the params + * are constant + */ + memset(&nh, 0, sizeof(nh)); + nh.vrf_id = es_vrf->bgp_vrf->vrf_id; + nh.flags = NEXTHOP_FLAG_ONLINK; + nh.ifindex = es_vrf->bgp_vrf->l3vni_svi_ifindex; + nh.weight = 1; + nh.type = + v4_nhg ? NEXTHOP_TYPE_IPV4_IFINDEX : NEXTHOP_TYPE_IPV6_IFINDEX; + + api_nhg.id = nhg_id; + for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, es_vtep)) { + if (!CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE)) + continue; + + /* overwrite the gw */ + if (v4_nhg) + nh.gate.ipv4 = es_vtep->vtep_ip; + else + ipv4_to_ipv4_mapped_ipv6(&nh.gate.ipv6, + es_vtep->vtep_ip); + + /* convert to zapi format */ + api_nh = &api_nhg.nexthops[api_nhg.nexthop_num]; + zapi_nexthop_from_nexthop(api_nh, &nh); + + ++api_nhg.nexthop_num; + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("nhg %u vtep %pI4 l3-svi %d", api_nhg.id, + &es_vtep->vtep_ip, + es_vrf->bgp_vrf->l3vni_svi_ifindex); + } + + if (!api_nhg.nexthop_num) + return; + + if (api_nhg.nexthop_num > MULTIPATH_NUM) + return; + + zclient_nhg_send(zclient, ZEBRA_NHG_ADD, &api_nhg); +} + +static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf) +{ + if (!bgp_mh_info->host_routes_use_l3nhg && !bgp_mh_info->install_l3nhg) + return false; + + /* Check socket. */ + if (!zclient || zclient->sock < 0) + return false; + + return true; +} + +static void bgp_evpn_l3nhg_zebra_add(struct bgp_evpn_es_vrf *es_vrf) +{ + if (!bgp_evpn_l3nhg_zebra_ok(es_vrf)) + return; + + bgp_evpn_l3nhg_zebra_add_v4_or_v6(es_vrf, true /*v4_nhg*/); + bgp_evpn_l3nhg_zebra_add_v4_or_v6(es_vrf, false /*v4_nhg*/); +} + +static void bgp_evpn_l3nhg_zebra_del_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, + bool v4_nhg) +{ + struct zapi_nhg api_nhg = {}; + + api_nhg.id = v4_nhg ? es_vrf->nhg_id : es_vrf->v6_nhg_id; + + /* Skip installation of L3-NHG if host routes used */ + if (!api_nhg.id) + return; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u %s nhg %u to zebra", + es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id, + v4_nhg ? "v4_nhg" : "v6_nhg", api_nhg.id); + + zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg); +} + +static void bgp_evpn_l3nhg_zebra_del(struct bgp_evpn_es_vrf *es_vrf) +{ + if (!bgp_evpn_l3nhg_zebra_ok(es_vrf)) + return; + + bgp_evpn_l3nhg_zebra_del_v4_or_v6(es_vrf, true /*v4_nhg*/); + bgp_evpn_l3nhg_zebra_del_v4_or_v6(es_vrf, false /*v4_nhg*/); +} + +static void bgp_evpn_l3nhg_deactivate(struct bgp_evpn_es_vrf *es_vrf) +{ + if (!(es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE)) + return; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u nhg %u de-activate", + es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id, + es_vrf->nhg_id); + bgp_evpn_l3nhg_zebra_del(es_vrf); + es_vrf->flags &= ~BGP_EVPNES_VRF_NHG_ACTIVE; +} + +static void bgp_evpn_l3nhg_activate(struct bgp_evpn_es_vrf *es_vrf, bool update) +{ + if (!bgp_evpn_es_get_active_vtep_cnt(es_vrf->es)) { + bgp_evpn_l3nhg_deactivate(es_vrf); + return; + } + + if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE) { + if (!update) + return; + } else { + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u nhg %u activate", + es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id, + es_vrf->nhg_id); + es_vrf->flags |= BGP_EVPNES_VRF_NHG_ACTIVE; + } + + bgp_evpn_l3nhg_zebra_add(es_vrf); +} + +/* when a VTEP is activated or de-activated against an ES associated + * VRFs' NHG needs to be updated + */ +static void bgp_evpn_l3nhg_update_on_vtep_chg(struct bgp_evpn_es *es) +{ + struct bgp_evpn_es_vrf *es_vrf; + struct listnode *es_vrf_node; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s nhg update on vtep chg", es->esi_str); + + for (ALL_LIST_ELEMENTS_RO(es->es_vrf_list, es_vrf_node, es_vrf)) + bgp_evpn_l3nhg_activate(es_vrf, true /* update */); +} + +/* compare ES-IDs for the ES-VRF RB tree maintained per-VRF */ +static int bgp_es_vrf_rb_cmp(const struct bgp_evpn_es_vrf *es_vrf1, + const struct bgp_evpn_es_vrf *es_vrf2) +{ + return memcmp(&es_vrf1->es->esi, &es_vrf2->es->esi, ESI_BYTES); +} +RB_GENERATE(bgp_es_vrf_rb_head, bgp_evpn_es_vrf, rb_node, bgp_es_vrf_rb_cmp); + +/* Initialize the ES tables maintained per-tenant vrf */ +void bgp_evpn_vrf_es_init(struct bgp *bgp_vrf) +{ + /* Initialize the ES-VRF RB tree */ + RB_INIT(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree); +} + +/* find the ES-VRF in the per-VRF RB tree */ +static struct bgp_evpn_es_vrf *bgp_evpn_es_vrf_find(struct bgp_evpn_es *es, + struct bgp *bgp_vrf) +{ + struct bgp_evpn_es_vrf es_vrf; + + es_vrf.es = es; + + return RB_FIND(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, &es_vrf); +} + +/* allocate a new ES-VRF and setup L3NHG for it */ +static struct bgp_evpn_es_vrf *bgp_evpn_es_vrf_create(struct bgp_evpn_es *es, + struct bgp *bgp_vrf) +{ + struct bgp_evpn_es_vrf *es_vrf; + + es_vrf = XCALLOC(MTYPE_BGP_EVPN_ES_VRF, sizeof(*es_vrf)); + + es_vrf->es = es; + es_vrf->bgp_vrf = bgp_vrf; + + /* insert into the VRF-ESI rb tree */ + if (RB_INSERT(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, es_vrf)) { + XFREE(MTYPE_BGP_EVPN_ES_VRF, es_vrf); + return NULL; + } + + /* add to the ES's VRF list */ + listnode_init(&es_vrf->es_listnode, es_vrf); + listnode_add(es->es_vrf_list, &es_vrf->es_listnode); + + /* setup the L3 NHG id for the ES */ + es_vrf->nhg_id = bgp_l3nhg_id_alloc(); + es_vrf->v6_nhg_id = bgp_l3nhg_id_alloc(); + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u nhg %u v6_nhg %d create", es->esi_str, + bgp_vrf->vrf_id, es_vrf->nhg_id, es_vrf->v6_nhg_id); + bgp_evpn_l3nhg_activate(es_vrf, false /* update */); + + return es_vrf; +} + +/* remove the L3-NHG associated with the ES-VRF and free it */ +static void bgp_evpn_es_vrf_delete(struct bgp_evpn_es_vrf *es_vrf) +{ + struct bgp_evpn_es *es = es_vrf->es; + struct bgp *bgp_vrf = es_vrf->bgp_vrf; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es %s vrf %u nhg %u delete", es->esi_str, + bgp_vrf->vrf_id, es_vrf->nhg_id); + + /* Remove the NHG resources */ + bgp_evpn_l3nhg_deactivate(es_vrf); + if (es_vrf->nhg_id) + bgp_l3nhg_id_free(es_vrf->nhg_id); + es_vrf->nhg_id = 0; + if (es_vrf->v6_nhg_id) + bgp_l3nhg_id_free(es_vrf->v6_nhg_id); + es_vrf->v6_nhg_id = 0; + + /* remove from the ES's VRF list */ + list_delete_node(es->es_vrf_list, &es_vrf->es_listnode); + + /* remove from the VRF-ESI rb tree */ + RB_REMOVE(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, es_vrf); + + XFREE(MTYPE_BGP_EVPN_ES_VRF, es_vrf); +} + +/* deref and delete if there are no references */ +void bgp_evpn_es_vrf_deref(struct bgp_evpn_es_evi *es_evi) +{ + struct bgp_evpn_es_vrf *es_vrf = es_evi->es_vrf; + + if (!es_vrf) + return; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es-evi %s vni %u vrf %u de-ref", + es_evi->es->esi_str, es_evi->vpn->vni, + es_vrf->bgp_vrf->vrf_id); + + es_evi->es_vrf = NULL; + if (es_vrf->ref_cnt) + --es_vrf->ref_cnt; + + if (!es_vrf->ref_cnt) + bgp_evpn_es_vrf_delete(es_vrf); +} + +/* find or create and reference */ +void bgp_evpn_es_vrf_ref(struct bgp_evpn_es_evi *es_evi, struct bgp *bgp_vrf) +{ + struct bgp_evpn_es *es = es_evi->es; + struct bgp_evpn_es_vrf *es_vrf = es_evi->es_vrf; + struct bgp *old_bgp_vrf = NULL; + + if (es_vrf) + old_bgp_vrf = es_vrf->bgp_vrf; + + if (old_bgp_vrf == bgp_vrf) + return; + + /* deref the old ES-VRF */ + bgp_evpn_es_vrf_deref(es_evi); + + if (!bgp_vrf) + return; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es-evi %s vni %u vrf %u ref", es_evi->es->esi_str, + es_evi->vpn->vni, bgp_vrf->vrf_id); + + /* find-create the new ES-VRF */ + es_vrf = bgp_evpn_es_vrf_find(es, bgp_vrf); + if (!es_vrf) + es_vrf = bgp_evpn_es_vrf_create(es, bgp_vrf); + if (!es_vrf) + return; + + es_evi->es_vrf = es_vrf; + ++es_vrf->ref_cnt; +} + +/* When the L2-VNI is associated with a L3-VNI/VRF update all the + * associated ES-EVI entries + */ +void bgp_evpn_es_evi_vrf_deref(struct bgpevpn *vpn) +{ + struct bgp_evpn_es_evi *es_evi; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es-vrf de-ref for vni %u", vpn->vni); + + RB_FOREACH (es_evi, bgp_es_evi_rb_head, &vpn->es_evi_rb_tree) + bgp_evpn_es_vrf_deref(es_evi); +} +void bgp_evpn_es_evi_vrf_ref(struct bgpevpn *vpn) +{ + struct bgp_evpn_es_evi *es_evi; + + if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("es-vrf ref for vni %u", vpn->vni); + + RB_FOREACH (es_evi, bgp_es_evi_rb_head, &vpn->es_evi_rb_tree) + bgp_evpn_es_vrf_ref(es_evi, vpn->bgp_vrf); +} + +/* returns false if legacy-exploded mp needs to be used for route install */ +bool bgp_evpn_path_es_use_nhg(struct bgp *bgp_vrf, struct bgp_path_info *pi, + uint32_t *nhg_p) +{ + esi_t *esi; + struct bgp_evpn_es *es; + struct bgp_evpn_es_vrf *es_vrf; + struct bgp_path_info *parent_pi; + struct bgp_node *rn; + struct prefix_evpn *evp; + struct bgp_path_info *mpinfo; + + *nhg_p = 0; + + /* L3NHG support is disabled, use legacy-exploded multipath */ + if (!bgp_mh_info->host_routes_use_l3nhg) + return false; + + parent_pi = get_route_parent_evpn(pi); + if (!parent_pi) + return false; + + rn = parent_pi->net; + if (!rn) + return false; + + evp = (struct prefix_evpn *)&rn->p; + if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE) + return false; + + /* non-es path, use legacy-exploded multipath */ + esi = bgp_evpn_attr_get_esi(parent_pi->attr); + if (!memcmp(esi, zero_esi, sizeof(*esi))) + return false; + + /* if the ES-VRF is not setup or if the NHG has not been installed + * we cannot install the route yet, return a 0-NHG to indicate + * that + */ + es = bgp_evpn_es_find(esi); + if (!es) + return true; + es_vrf = bgp_evpn_es_vrf_find(es, bgp_vrf); + if (!es_vrf || !(es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE)) + return true; + + /* this needs to be set the v6NHG if v6route */ + if (is_evpn_prefix_ipaddr_v6(evp)) + *nhg_p = es_vrf->v6_nhg_id; + else + *nhg_p = es_vrf->nhg_id; + + for (mpinfo = bgp_path_info_mpath_next(pi); mpinfo; + mpinfo = bgp_path_info_mpath_next(mpinfo)) { + /* if any of the paths of have a different ESI we can't use + * the NHG associated with the ES. fallback to legacy-exploded + * multipath + */ + if (memcmp(esi, bgp_evpn_attr_get_esi(mpinfo->attr), + sizeof(*esi))) + return false; + } + + return true; +} + +static void bgp_evpn_es_vrf_show_entry(struct vty *vty, + struct bgp_evpn_es_vrf *es_vrf, + json_object *json) +{ + struct bgp_evpn_es *es = es_vrf->es; + struct bgp *bgp_vrf = es_vrf->bgp_vrf; + + if (json) { + json_object *json_types; + + json_object_string_add(json, "esi", es->esi_str); + json_object_string_add(json, "vrf", bgp_vrf->name); + + if (es_vrf->flags & (BGP_EVPNES_VRF_NHG_ACTIVE)) { + json_types = json_object_new_array(); + if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE) + json_array_string_add(json_types, "active"); + json_object_object_add(json, "flags", json_types); + } + + json_object_int_add(json, "ipv4NHG", es_vrf->nhg_id); + json_object_int_add(json, "ipv6NHG", es_vrf->v6_nhg_id); + json_object_int_add(json, "refCount", es_vrf->ref_cnt); + } else { + char flags_str[4]; + + flags_str[0] = '\0'; + if (es_vrf->flags & BGP_EVPNES_VRF_NHG_ACTIVE) + strlcat(flags_str, "A", sizeof(flags_str)); + + vty_out(vty, "%-30s %-15s %-5s %-8u %-8u %u\n", es->esi_str, + bgp_vrf->name, flags_str, es_vrf->nhg_id, + es_vrf->v6_nhg_id, es_vrf->ref_cnt); + } +} + +static void bgp_evpn_es_vrf_show_es(struct vty *vty, json_object *json_array, + struct bgp_evpn_es *es) +{ + json_object *json = NULL; + struct listnode *es_vrf_node; + struct bgp_evpn_es_vrf *es_vrf; + + for (ALL_LIST_ELEMENTS_RO(es->es_vrf_list, es_vrf_node, es_vrf)) { + /* create a separate json object for each ES-VRF */ + if (json_array) + json = json_object_new_object(); + bgp_evpn_es_vrf_show_entry(vty, es_vrf, json); + /* add ES-VRF to the json array */ + if (json_array) + json_object_array_add(json_array, json); + } +} + +/* Display all ES VRFs */ +void bgp_evpn_es_vrf_show(struct vty *vty, bool uj, struct bgp_evpn_es *es) +{ + json_object *json_array = NULL; + + if (uj) { + /* create an array of ESs */ + json_array = json_object_new_array(); + } else { + vty_out(vty, "ES-VRF Flags: A Active\n"); + vty_out(vty, "%-30s %-15s %-5s %-8s %-8s %s\n", "ESI", "VRF", + "Flags", "IPv4-NHG", "IPv6-NHG", "Ref"); + } + + if (es) { + bgp_evpn_es_vrf_show_es(vty, json_array, es); + } else { + RB_FOREACH (es, bgp_es_rb_head, &bgp_mh_info->es_rb_tree) + bgp_evpn_es_vrf_show_es(vty, json_array, es); + } + + /* print the array of json-ESs */ + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json_array, JSON_C_TO_STRING_PRETTY)); + json_object_free(json_array); + } +} + +/* Display specific ES VRF */ +void bgp_evpn_es_vrf_show_esi(struct vty *vty, esi_t *esi, bool uj) +{ + struct bgp_evpn_es *es; + + es = bgp_evpn_es_find(esi); + if (es) { + bgp_evpn_es_vrf_show(vty, uj, es); + } else { + if (!uj) + vty_out(vty, "ESI not found\n"); + } +} + +/*****************************************************************************/ /* Ethernet Segment to EVI association - * 1. The ES-EVI entry is maintained as a RB tree per L2-VNI * (bgpevpn->es_evi_rb_tree). @@ -2149,6 +2856,8 @@ static struct bgp_evpn_es_evi *bgp_evpn_es_evi_new(struct bgp_evpn_es *es, listnode_init(&es_evi->es_listnode, es_evi); listnode_add(es->es_evi_list, &es_evi->es_listnode); + bgp_evpn_es_vrf_ref(es_evi, vpn->bgp_vrf); + return es_evi; } @@ -2166,6 +2875,8 @@ static void bgp_evpn_es_evi_free(struct bgp_evpn_es_evi *es_evi) if (es_evi->flags & (BGP_EVPNES_EVI_LOCAL | BGP_EVPNES_EVI_REMOTE)) return; + bgp_evpn_es_vrf_deref(es_evi); + /* remove from the ES's VNI list */ list_delete_node(es->es_evi_list, &es_evi->es_listnode); @@ -2992,6 +3703,8 @@ void bgp_evpn_mh_init(void) /* config knobs - XXX add cli to control it */ bgp_mh_info->ead_evi_adv_for_down_links = true; bgp_mh_info->consistency_checking = true; + bgp_mh_info->install_l3nhg = false; + bgp_mh_info->host_routes_use_l3nhg = BGP_EVPN_MH_USE_ES_L3NHG_DEF; if (bgp_mh_info->consistency_checking) thread_add_timer(bm->master, bgp_evpn_run_consistency_checks, diff --git a/bgpd/bgp_evpn_mh.h b/bgpd/bgp_evpn_mh.h index d719524bdd..d2f6a7b054 100644 --- a/bgpd/bgp_evpn_mh.h +++ b/bgpd/bgp_evpn_mh.h @@ -34,6 +34,7 @@ #define BGP_EVPN_CONS_CHECK_INTERVAL 60 +#define BGP_EVPN_MH_USE_ES_L3NHG_DEF true /* Ethernet Segment entry - * - Local and remote ESs are maintained in a global RB tree, @@ -96,6 +97,14 @@ struct bgp_evpn_es { /* List of ES-EVIs associated with this ES */ struct list *es_evi_list; + /* List of ES-VRFs associated with this ES */ + struct list *es_vrf_list; + + /* List of MAC-IP global routes using this ES as destination - + * element is bgp_path_info_extra->es_info + */ + struct list *macip_path_list; + /* Number of remote VNIs referencing this ES */ uint32_t remote_es_evi_cnt; @@ -142,6 +151,34 @@ struct bgp_evpn_es_vtep { struct listnode es_listnode; }; +/* ES-VRF element needed for managing L3 NHGs. It is implicitly created + * when an ES-EVI is associated with a tenant VRF + */ +struct bgp_evpn_es_vrf { + struct bgp_evpn_es *es; + struct bgp *bgp_vrf; + + uint32_t flags; +/* NHG can only be activated if there are active VTEPs in the ES and + * there is a valid L3-VNI associated with the VRF + */ +#define BGP_EVPNES_VRF_NHG_ACTIVE (1 << 0) + + /* memory used for adding the es_vrf to + * es_vrf->bgp_vrf->es_vrf_rb_tree + */ + RB_ENTRY(bgp_evpn_es_vrf) rb_node; + + /* memory used for linking the es_vrf to es_vrf->es->es_vrf_list */ + struct listnode es_listnode; + + uint32_t nhg_id; + uint32_t v6_nhg_id; + + /* Number of ES-EVI entries associated with this ES-VRF */ + uint32_t ref_cnt; +}; + /* ES per-EVI info * - ES-EVIs are maintained per-L2-VNI (vpn->es_evi_rb_tree) * - ES-EVIs are also linked to the parent ES (es->es_evi_list) @@ -175,6 +212,8 @@ struct bgp_evpn_es_evi { /* list of PEs (bgp_evpn_es_evi_vtep) attached to the ES for this VNI */ struct list *es_evi_vtep_list; + + struct bgp_evpn_es_vrf *es_vrf; }; /* PE attached to an ES for a VNI. This entry is created when an EAD-per-ES @@ -219,6 +258,9 @@ struct bgp_evpn_mh_info { bool ead_evi_adv_for_down_links; /* Enable ES consistency checking */ bool consistency_checking; + /* Use L3 NHGs for host routes in symmetric IRB */ + bool install_l3nhg; + bool host_routes_use_l3nhg; }; /****************************************************************************/ @@ -308,5 +350,19 @@ void bgp_evpn_es_evi_show_vni(struct vty *vty, vni_t vni, void bgp_evpn_es_evi_show(struct vty *vty, bool uj, bool detail); struct bgp_evpn_es *bgp_evpn_es_find(const esi_t *esi); extern bool bgp_evpn_is_esi_local(esi_t *esi); +extern void bgp_evpn_vrf_es_init(struct bgp *bgp_vrf); +extern void bgp_evpn_es_vrf_deref(struct bgp_evpn_es_evi *es_evi); +extern void bgp_evpn_es_vrf_ref(struct bgp_evpn_es_evi *es_evi, + struct bgp *bgp_vrf); +extern void bgp_evpn_path_es_info_free(struct bgp_path_es_info *es_info); +extern void bgp_evpn_path_es_unlink(struct bgp_path_es_info *es_info); +extern void bgp_evpn_path_es_link(struct bgp_path_info *pi, vni_t vni, + esi_t *esi); +extern bool bgp_evpn_es_is_vtep_active(esi_t *esi, struct in_addr nh); +extern bool bgp_evpn_path_es_use_nhg(struct bgp *bgp_vrf, + struct bgp_path_info *pi, uint32_t *nhg_p); +extern void bgp_evpn_es_vrf_show(struct vty *vty, bool uj, + struct bgp_evpn_es *es); +extern void bgp_evpn_es_vrf_show_esi(struct vty *vty, esi_t *esi, bool uj); #endif /* _FRR_BGP_EVPN_MH_H */ diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index c47576c00c..cd4920e3d0 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -218,6 +218,9 @@ static inline struct list *bgpevpn_get_vrf_import_rtl(struct bgpevpn *vpn) return vpn->bgp_vrf->vrf_import_rtl; } +extern void bgp_evpn_es_evi_vrf_ref(struct bgpevpn *vpn); +extern void bgp_evpn_es_evi_vrf_deref(struct bgpevpn *vpn); + static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn) { /* bail if vpn is not associated to bgp_vrf */ @@ -227,6 +230,8 @@ static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn) UNSET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS); listnode_delete(vpn->bgp_vrf->l2vnis, vpn); + bgp_evpn_es_evi_vrf_deref(vpn); + /* remove the backpointer to the vrf instance */ bgp_unlock(vpn->bgp_vrf); vpn->bgp_vrf = NULL; @@ -255,6 +260,8 @@ static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn) if (bgp_vrf->l3vni && !CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY)) SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS); + + bgp_evpn_es_evi_vrf_ref(vpn); } static inline int is_vni_configured(struct bgpevpn *vpn) @@ -623,4 +630,13 @@ extern struct bgp_dest * bgp_global_evpn_node_lookup(struct bgp_table *table, afi_t afi, safi_t safi, const struct prefix_evpn *evp, struct prefix_rd *prd); +extern struct bgp_node *bgp_global_evpn_node_get(struct bgp_table *table, + afi_t afi, safi_t safi, + const struct prefix_evpn *evp, + struct prefix_rd *prd); +extern struct bgp_node * +bgp_global_evpn_node_lookup(struct bgp_table *table, afi_t afi, safi_t safi, + const struct prefix_evpn *evp, + struct prefix_rd *prd); +extern void bgp_evpn_import_route_in_vrfs(struct bgp_path_info *pi, int import); #endif /* _BGP_EVPN_PRIVATE_H */ diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index e9e2aafebb..f957103df7 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -686,6 +686,78 @@ static void show_esi_routes(struct bgp *bgp, } } +/* Display all MAC-IP VNI routes linked to an ES */ +static void bgp_evpn_show_routes_mac_ip_es(struct vty *vty, esi_t *esi, + json_object *json, int detail) +{ + struct bgp_node *rn; + struct bgp_path_info *pi; + int header = detail ? 0 : 1; + uint32_t path_cnt; + struct listnode *node; + struct bgp_evpn_es *es; + struct bgp_path_es_info *es_info; + struct bgp *bgp = bgp_get_evpn(); + json_object *json_paths = NULL; + + if (!bgp) + return; + + path_cnt = 0; + + if (json) + json_paths = json_object_new_array(); + + RB_FOREACH (es, bgp_es_rb_head, &bgp_mh_info->es_rb_tree) { + + if (esi && memcmp(esi, &es->esi, sizeof(*esi))) + continue; + + for (ALL_LIST_ELEMENTS_RO(es->macip_path_list, node, es_info)) { + json_object *json_path = NULL; + + pi = es_info->pi; + rn = pi->net; + + if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)) + continue; + + /* Overall header/legend displayed once. */ + if (header) { + bgp_evpn_show_route_header(vty, bgp, 0, json); + header = 0; + } + + path_cnt++; + + if (json) + json_path = json_object_new_array(); + + if (detail) + route_vty_out_detail(vty, bgp, rn, pi, + AFI_L2VPN, SAFI_EVPN, + json_path); + else + route_vty_out(vty, &rn->p, pi, 0, SAFI_EVPN, + json_path, false); + + if (json) + json_object_array_add(json_paths, json_path); + } + } + + if (json) { + json_object_object_add(json, "paths", json_paths); + json_object_int_add(json, "numPaths", path_cnt); + } else { + if (path_cnt == 0) + vty_out(vty, "There are no MAC-IP ES paths"); + else + vty_out(vty, "\nDisplayed %u paths\n", path_cnt); + vty_out(vty, "\n"); + } +} + static void show_vni_routes(struct bgp *bgp, struct bgpevpn *vpn, int type, struct vty *vty, struct in_addr vtep_ip, json_object *json, int detail) @@ -3675,6 +3747,16 @@ DEFUN (no_bgp_evpn_advertise_type5, return CMD_SUCCESS; } +DEFPY (bgp_evpn_use_es_l3nhg, + bgp_evpn_use_es_l3nhg_cmd, + "[no$no] use-es-l3nhg", + NO_STR + "use L3 nexthop group for host routes with ES destination\n") +{ + bgp_mh_info->host_routes_use_l3nhg = no ? false :true; + return CMD_SUCCESS; +} + DEFPY (bgp_evpn_advertise_pip_ip_mac, bgp_evpn_advertise_pip_ip_mac_cmd, "[no$no] advertise-pip [ip <A.B.C.D> [mac <X:X:X:X:X:X|X:X:X:X:X:X/M>]]", @@ -3967,6 +4049,28 @@ DEFPY(show_bgp_l2vpn_evpn_es, return CMD_SUCCESS; } +DEFPY(show_bgp_l2vpn_evpn_es_vrf, show_bgp_l2vpn_evpn_es_vrf_cmd, + "show bgp l2vpn evpn es-vrf [NAME$esi_str] [json$uj]", + SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR + "Ethernet Segment\n" + "ES ID\n" JSON_STR) +{ + esi_t esi; + + if (esi_str) { + if (!str_to_esi(esi_str, &esi)) { + vty_out(vty, "%%Malformed ESI\n"); + return CMD_WARNING; + } + bgp_evpn_es_vrf_show_esi(vty, &esi, uj); + } else { + + bgp_evpn_es_vrf_show(vty, uj, NULL); + } + + return CMD_SUCCESS; +} + /* * Display EVPN neighbor summary. */ @@ -4517,6 +4621,43 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_all, return CMD_SUCCESS; } +DEFPY_HIDDEN( + show_bgp_l2vpn_evpn_route_mac_ip_es, + show_bgp_l2vpn_evpn_route_mac_ip_es_cmd, + "show bgp l2vpn evpn route mac-ip-es [NAME$esi_str|detail$detail] [json$uj]", + SHOW_STR BGP_STR L2VPN_HELP_STR EVPN_HELP_STR + "EVPN route information\n" + "MAC IP routes linked to the ES\n" + "ES ID\n" + "Detailed information\n" JSON_STR) +{ + esi_t esi; + esi_t *esi_p; + json_object *json = NULL; + + if (esi_str) { + if (!str_to_esi(esi_str, &esi)) { + vty_out(vty, "%%Malformed ESI\n"); + return CMD_WARNING; + } + esi_p = &esi; + } else { + esi_p = NULL; + } + + if (uj) + json = json_object_new_object(); + bgp_evpn_show_routes_mac_ip_es(vty, esi_p, json, !!detail); + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } + + return CMD_SUCCESS; +} + /* * Display EVPN import route-target hash table */ @@ -5602,6 +5743,14 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, if (bgp->evpn_info->advertise_svi_macip) vty_out(vty, " advertise-svi-ip\n"); + if (bgp_mh_info->host_routes_use_l3nhg != + BGP_EVPN_MH_USE_ES_L3NHG_DEF) { + if (bgp_mh_info->host_routes_use_l3nhg) + vty_out(vty, " use-es-l3nhg\n"); + else + vty_out(vty, " no use-es-l3nhg\n"); + } + if (!bgp->evpn_info->dup_addr_detect) vty_out(vty, " no dup-addr-detection\n"); @@ -5746,6 +5895,7 @@ void bgp_ethernetvpn_init(void) install_element(BGP_EVPN_NODE, &no_dup_addr_detection_cmd); install_element(BGP_EVPN_NODE, &bgp_evpn_flood_control_cmd); install_element(BGP_EVPN_NODE, &bgp_evpn_advertise_pip_ip_mac_cmd); + install_element(BGP_EVPN_NODE, &bgp_evpn_use_es_l3nhg_cmd); /* test commands */ install_element(BGP_EVPN_NODE, &test_es_add_cmd); @@ -5754,6 +5904,7 @@ void bgp_ethernetvpn_init(void) /* "show bgp l2vpn evpn" commands. */ install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_es_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_es_evi_cmd); + install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_es_vrf_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vni_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_summary_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_cmd); @@ -5765,6 +5916,7 @@ void bgp_ethernetvpn_init(void) &show_bgp_l2vpn_evpn_route_vni_multicast_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_vni_macip_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_vni_all_cmd); + install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_route_mac_ip_es_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_import_rt_cmd); install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vrf_import_rt_cmd); diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c index 55e7973f81..15b891f25a 100644 --- a/bgpd/bgp_flowspec_util.c +++ b/bgpd/bgp_flowspec_util.c @@ -229,9 +229,9 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type, case BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE: if (prefix) { if (prefix_local.family == AF_INET) - PREFIX_COPY_IPV4(prefix, &prefix_local) + PREFIX_COPY_IPV4(prefix, &prefix_local); else - PREFIX_COPY_IPV6(prefix, &prefix_local) + PREFIX_COPY_IPV6(prefix, &prefix_local); } break; case BGP_FLOWSPEC_VALIDATE_ONLY: diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c index 3b7fb649a9..57f212b05d 100644 --- a/bgpd/bgp_flowspec_vty.c +++ b/bgpd/bgp_flowspec_vty.c @@ -268,6 +268,7 @@ void route_vty_out_flowspec(struct vty *vty, const struct prefix *p, json_object *json_ecom_path = NULL; json_object *json_time_path = NULL; char timebuf[BGP_UPTIME_LEN]; + struct ecommunity *ipv6_ecomm = NULL; if (p == NULL || p->family != AF_FLOWSPEC) return; @@ -298,16 +299,19 @@ void route_vty_out_flowspec(struct vty *vty, const struct prefix *p, json_object_array_add(json_paths, json_nlri_path); if (!path) return; - if (path->attr && - (path->attr->ecommunity || path->attr->ipv6_ecommunity)) { + + if (path->attr) + ipv6_ecomm = bgp_attr_get_ipv6_ecommunity(path->attr); + + if (path->attr && (path->attr->ecommunity || ipv6_ecomm)) { /* Print attribute */ attr = path->attr; if (attr->ecommunity) s1 = ecommunity_ecom2str(attr->ecommunity, ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - if (attr->ipv6_ecommunity) - s2 = ecommunity_ecom2str(attr->ipv6_ecommunity, - ECOMMUNITY_FORMAT_ROUTE_MAP, 0); + if (ipv6_ecomm) + s2 = ecommunity_ecom2str( + ipv6_ecomm, ECOMMUNITY_FORMAT_ROUTE_MAP, 0); if (!s1 && !s2) return; if (display == NLRI_STRING_FORMAT_LARGE) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 4468408415..dd31a9b7cb 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -792,9 +792,13 @@ void bgp_adjust_routeadv(struct peer *peer) BGP_TIMER_OFF(peer->t_routeadv); peer->synctime = bgp_clock(); - thread_add_timer_msec(bm->master, bgp_generate_updgrp_packets, - peer, 0, - &peer->t_generate_updgrp_packets); + /* If suppress fib pending is enabled, route is advertised to + * peers when the status is received from the FIB. The delay + * is added to update group packet generate which will allow + * more routes to be sent in the update message + */ + BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets, + bgp_generate_updgrp_packets); return; } diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index b9156df617..cd464d8c58 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -47,6 +47,18 @@ thread_cancel_event(bm->master, (P)); \ } while (0) +#define BGP_UPDATE_GROUP_TIMER_ON(T, F) \ + do { \ + if (BGP_SUPPRESS_FIB_ENABLED(peer->bgp) && \ + PEER_ROUTE_ADV_DELAY(peer)) \ + thread_add_timer_msec(bm->master, (F), peer, \ + (BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME * 1000),\ + T); \ + else \ + thread_add_timer_msec(bm->master, (F), peer, \ + 0, T); \ + } while (0) \ + #define BGP_MSEC_JITTER 10 /* Status codes for bgp_event_update() */ diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 38455b5e02..53fd3b5fe3 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -149,12 +149,17 @@ static int bgp_process_writes(struct thread *thread) fatal = true; } + /* If suppress fib pending is enabled, route is advertised to peers when + * the status is received from the FIB. The delay is added + * to update group packet generate which will allow more routes to be + * sent in the update message + */ if (reschedule) { thread_add_write(fpt->master, bgp_process_writes, peer, peer->fd, &peer->t_write); } else if (!fatal) { - BGP_TIMER_ON(peer->t_generate_updgrp_packets, - bgp_generate_updgrp_packets, 0); + BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets, + bgp_generate_updgrp_packets); } return 0; diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index feda0328bd..e8d8167c35 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -392,8 +392,9 @@ void bgp_lp_get( if (lp_fifo_count(&lp->requests) > lp->pending_count) { if (!zclient || zclient->sock < 0) return; - if (!zclient_send_get_label_chunk(zclient, 0, LP_CHUNK_SIZE, - MPLS_LABEL_BASE_ANY)) + if (zclient_send_get_label_chunk(zclient, 0, LP_CHUNK_SIZE, + MPLS_LABEL_BASE_ANY) + == ZCLIENT_SEND_FAILURE) lp->pending_count += LP_CHUNK_SIZE; } } diff --git a/bgpd/bgp_mac.c b/bgpd/bgp_mac.c index 265b4568e5..ec73ebb296 100644 --- a/bgpd/bgp_mac.c +++ b/bgpd/bgp_mac.c @@ -34,7 +34,7 @@ #include "bgpd/bgp_evpn_private.h" DEFINE_MTYPE_STATIC(BGPD, BSM, "Mac Hash Entry"); -DEFINE_MTYPE_STATIC(BGPD, BSM_STRING, "Mac Hash Entry Interface String"); +DEFINE_MTYPE_STATIC(BGPD, BSM_STRING, "Mac Hash Entry Intf String"); struct bgp_self_mac { struct ethaddr macaddr; @@ -156,7 +156,7 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, struct prefix_rd prd; uint32_t num_labels = 0; mpls_label_t *label_pnt = NULL; - struct bgp_route_evpn evpn; + struct bgp_route_evpn *evpn; if (pevpn->family == AF_EVPN && pevpn->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE @@ -209,14 +209,15 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer, continue; } - memcpy(&evpn, &pi->attr->evpn_overlay, sizeof(evpn)); + memcpy(&evpn, bgp_attr_get_evpn_overlay(pi->attr), + sizeof(evpn)); int32_t ret = bgp_update(peer, p, pi->addpath_rx_id, pi->attr, AFI_L2VPN, SAFI_EVPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, label_pnt, num_labels, - 1, &evpn); + 1, evpn); if (ret < 0) bgp_dest_unlock_node(dest); diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 21c880e95b..f961647778 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -63,6 +63,7 @@ #include "lib/routing_nb.h" #include "bgpd/bgp_nb.h" #include "bgpd/bgp_evpn_mh.h" +#include "bgpd/bgp_nht.h" #ifdef ENABLE_BGP_VNC #include "bgpd/rfapi/rfapi_backend.h" @@ -209,6 +210,7 @@ static __attribute__((__noreturn__)) void bgp_exit(int status) bgp_delete(bgp_default); bgp_evpn_mh_finish(); + bgp_l3nhg_finish(); /* reverse bgp_dump_init */ bgp_dump_finish(); diff --git a/bgpd/bgp_memory.c b/bgpd/bgp_memory.c index 8bdab16680..f9aac35d05 100644 --- a/bgpd/bgp_memory.c +++ b/bgpd/bgp_memory.c @@ -116,11 +116,13 @@ DEFINE_MTYPE(BGPD, LCOMMUNITY_STR, "Large Community display string") DEFINE_MTYPE(BGPD, LCOMMUNITY_VAL, "Large Community value") DEFINE_MTYPE(BGPD, BGP_EVPN, "BGP EVPN Information") -DEFINE_MTYPE(BGPD, BGP_EVPN_MH_INFO, "BGP EVPN Multihoming Information") +DEFINE_MTYPE(BGPD, BGP_EVPN_MH_INFO, "BGP EVPN MH Information") DEFINE_MTYPE(BGPD, BGP_EVPN_ES_VTEP, "BGP EVPN ES VTEP") +DEFINE_MTYPE(BGPD, BGP_EVPN_PATH_ES_INFO, "BGP EVPN PATH ES Information") DEFINE_MTYPE(BGPD, BGP_EVPN_ES_EVI_VTEP, "BGP EVPN ES-EVI VTEP") DEFINE_MTYPE(BGPD, BGP_EVPN_ES, "BGP EVPN ESI Information") DEFINE_MTYPE(BGPD, BGP_EVPN_ES_EVI, "BGP EVPN ES-per-EVI Information") +DEFINE_MTYPE(BGPD, BGP_EVPN_ES_VRF, "BGP EVPN ES-per-VRF Information") DEFINE_MTYPE(BGPD, BGP_EVPN_IMPORT_RT, "BGP EVPN Import RT") DEFINE_MTYPE(BGPD, BGP_EVPN_VRF_IMPORT_RT, "BGP EVPN VRF Import RT") DEFINE_MTYPE(BGPD, BGP_EVPN_MACIP, "BGP EVPN MAC IP") diff --git a/bgpd/bgp_memory.h b/bgpd/bgp_memory.h index d1ae392c65..a95d9ef931 100644 --- a/bgpd/bgp_memory.h +++ b/bgpd/bgp_memory.h @@ -114,7 +114,9 @@ DECLARE_MTYPE(LCOMMUNITY_VAL) DECLARE_MTYPE(BGP_EVPN_MH_INFO) DECLARE_MTYPE(BGP_EVPN_ES) DECLARE_MTYPE(BGP_EVPN_ES_EVI) +DECLARE_MTYPE(BGP_EVPN_ES_VRF) DECLARE_MTYPE(BGP_EVPN_ES_VTEP) +DECLARE_MTYPE(BGP_EVPN_PATH_ES_INFO) DECLARE_MTYPE(BGP_EVPN_ES_EVI_VTEP) DECLARE_MTYPE(BGP_EVPN) diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index b7f516eaf7..ff5cfe05fb 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -412,8 +412,9 @@ static void bgp_path_info_mpath_lb_update(struct bgp_path_info *path, bool set, struct bgp_path_info_mpath *mpath; if ((mpath = path->mpath) == NULL) { - if (!set) + if (!set || (cum_bw == 0 && !all_paths_lb)) return; + mpath = bgp_path_info_mpath_get(path); if (!mpath) return; diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 0c527efb8c..3bc4c03233 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -265,7 +265,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, if (STREAM_READABLE(data) != 0) { flog_err( EC_BGP_UPDATE_RCV, - "%s [Error] Update packet error / VPN (%td data remaining after parsing)", + "%s [Error] Update packet error / VPN (%zu data remaining after parsing)", peer->host, STREAM_READABLE(data)); return BGP_NLRI_PARSE_ERROR_PACKET_LENGTH; } @@ -744,7 +744,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ info.attr = &static_attr; ret = route_map_apply( bgp_vrf->vpn_policy[afi].rmap[BGP_VPN_POLICY_DIR_TOVPN], - p, RMAP_BGP, &info); + p, &info); if (RMAP_DENYMATCH == ret) { bgp_attr_flush(&static_attr); /* free any added parts */ if (debug) @@ -1190,7 +1190,7 @@ vpn_leak_to_vrf_update_onevrf(struct bgp *bgp_vrf, /* to */ info.extra = path_vpn->extra; /* Used for source-vrf filter */ ret = route_map_apply(bgp_vrf->vpn_policy[afi] .rmap[BGP_VPN_POLICY_DIR_FROMVPN], - p, RMAP_BGP, &info); + p, &info); if (RMAP_DENYMATCH == ret) { bgp_attr_flush(&static_attr); /* free any added parts */ if (debug) @@ -1703,6 +1703,8 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (!is_inst_match) listnode_add(to_bgp->vpn_policy[afi].import_vrf, vname); + else + XFREE(MTYPE_TMP, vname); /* Check if the source vrf already exports to any vrf, * first time export requires to setup auto derived RD/RT values. @@ -1725,6 +1727,9 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (!is_inst_match) listnode_add(from_bgp->vpn_policy[afi].export_vrf, vname); + else + XFREE(MTYPE_TMP, vname); + /* Update import RT for current VRF using export RT of the VRF we're * importing from. First though, make sure "import_vrf" has that * set. @@ -1755,19 +1760,26 @@ void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, if (debug) { const char *from_name; + char *ecom1, *ecom2; from_name = from_bgp->name ? from_bgp->name : VRF_DEFAULT_NAME; - zlog_debug("%s from %s to %s first_export %u import-rt %s export-rt %s", - __func__, from_name, export_name, first_export, - to_bgp->vpn_policy[afi].rtlist[idir] ? - (ecommunity_ecom2str(to_bgp->vpn_policy[afi]. - rtlist[idir], - ECOMMUNITY_FORMAT_ROUTE_MAP, 0)) : " ", - to_bgp->vpn_policy[afi].rtlist[edir] ? - (ecommunity_ecom2str(to_bgp->vpn_policy[afi]. - rtlist[edir], - ECOMMUNITY_FORMAT_ROUTE_MAP, 0)) : " "); + + ecom1 = ecommunity_ecom2str( + to_bgp->vpn_policy[afi].rtlist[idir], + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); + + ecom2 = ecommunity_ecom2str( + to_bgp->vpn_policy[afi].rtlist[edir], + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); + + zlog_debug( + "%s from %s to %s first_export %u import-rt %s export-rt %s", + __func__, from_name, export_name, first_export, ecom1, + ecom2); + + ecommunity_strfree(&ecom1); + ecommunity_strfree(&ecom2); } /* Does "import_vrf" first need to export its routes or that diff --git a/bgpd/bgp_nb.c b/bgpd/bgp_nb.c index 333ca3cce9..f098332b29 100644 --- a/bgpd/bgp_nb.c +++ b/bgpd/bgp_nb.c @@ -607,9 +607,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as", + .cbs = { + .apply_finish = bgp_neighbors_neighbor_local_as_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/local-as", .cbs = { .modify = bgp_neighbors_neighbor_local_as_local_as_modify, + .destroy = bgp_neighbors_neighbor_local_as_local_as_destroy, } }, { @@ -667,9 +674,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/admin-shutdown", + .cbs = { + .apply_finish = bgp_neighbors_neighbor_admin_shutdown_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/admin-shutdown/enable", .cbs = { .modify = bgp_neighbors_neighbor_admin_shutdown_enable_modify, + .destroy = bgp_neighbors_neighbor_admin_shutdown_enable_destroy, } }, { @@ -737,6 +751,7 @@ const struct frr_yang_module_info frr_bgp_info = { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/enabled", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_destroy, } }, { @@ -843,9 +858,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/neighbor-remote-as", + .cbs = { + .apply_finish = bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/neighbor-remote-as/remote-as-type", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_destroy, } }, { @@ -876,9 +898,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as", + .cbs = { + .apply_finish = bgp_neighbors_unnumbered_neighbor_local_as_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/local-as", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_local_as_local_as_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_local_as_local_as_destroy, } }, { @@ -936,9 +965,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/admin-shutdown", + .cbs = { + .apply_finish = bgp_neighbors_unnumbered_neighbor_admin_shutdown_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/admin-shutdown/enable", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_destroy, } }, { @@ -1006,6 +1042,7 @@ const struct frr_yang_module_info frr_bgp_info = { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/enabled", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_destroy, } }, { @@ -1113,9 +1150,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/neighbor-remote-as", + .cbs = { + .apply_finish = bgp_peer_group_neighbor_remote_as_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/neighbor-remote-as/remote-as-type", .cbs = { .modify = bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_modify, + .destroy = bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_destroy, } }, { @@ -1146,9 +1190,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as", + .cbs = { + .apply_finish = bgp_peer_groups_peer_group_local_as_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/local-as", .cbs = { .modify = bgp_peer_groups_peer_group_local_as_local_as_modify, + .destroy = bgp_peer_groups_peer_group_local_as_local_as_destroy, } }, { @@ -1206,9 +1257,16 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/admin-shutdown", + .cbs = { + .apply_finish = bgp_peer_groups_peer_group_admin_shutdown_apply_finish, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/admin-shutdown/enable", .cbs = { .modify = bgp_peer_groups_peer_group_admin_shutdown_enable_modify, + .destroy = bgp_peer_groups_peer_group_admin_shutdown_enable_destroy, } }, { @@ -1276,6 +1334,7 @@ const struct frr_yang_module_info frr_bgp_info = { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/enabled", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_destroy, } }, { @@ -2512,16 +2571,22 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/originate", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy, } }, { @@ -2529,6 +2594,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -2538,52 +2604,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -2761,17 +2833,17 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy, } }, { @@ -2807,6 +2879,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify, @@ -2850,6 +2941,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -2859,52 +2951,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -3013,6 +3111,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify, @@ -3056,6 +3173,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -3065,52 +3183,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -3219,6 +3343,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify, @@ -3262,6 +3405,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -3271,52 +3415,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -3425,6 +3575,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -3468,6 +3637,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -3477,52 +3647,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -3631,6 +3807,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -3674,6 +3869,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -3683,52 +3879,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -3859,6 +4061,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -3868,52 +4071,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -4044,6 +4253,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -4053,52 +4263,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -4311,16 +4527,22 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/originate", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy, } }, { @@ -4328,6 +4550,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -4337,52 +4560,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -4560,17 +4789,17 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy, } }, { @@ -4606,6 +4835,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate", + .cbs = { + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify, @@ -4649,6 +4897,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -4658,52 +4907,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -4812,6 +5067,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate", + .cbs = { + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify, @@ -4864,52 +5138,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -5018,6 +5298,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate", + .cbs = { + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify, @@ -5070,52 +5369,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -5224,6 +5529,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -5267,6 +5591,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -5276,52 +5601,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -5430,6 +5761,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -5473,6 +5823,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -5482,52 +5833,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -5658,6 +6015,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -5667,52 +6025,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -5843,6 +6207,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish, } }, { @@ -5852,52 +6217,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -6110,16 +6481,22 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify, + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate/originate", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy, } }, { @@ -6127,6 +6504,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -6136,52 +6514,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -6359,17 +6743,17 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy, } }, { @@ -6405,6 +6789,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/default-originate", + .cbs = { + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/default-originate/originate", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify, @@ -6448,6 +6851,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -6457,52 +6861,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -6611,6 +7021,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/default-originate", + .cbs = { + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/default-originate/originate", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify, @@ -6654,6 +7083,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -6663,52 +7093,64 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -6817,6 +7259,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/default-originate", + .cbs = { + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/default-originate/originate", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify, @@ -6860,6 +7321,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -6869,52 +7331,64 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -7023,6 +7497,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -7066,6 +7559,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -7075,52 +7569,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -7229,6 +7729,25 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate", + .cbs = { + .apply_finish = bgp_peer_group_afi_safi_default_originate_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy, + } + }, + { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/attr-unchanged/as-path-unchanged", .cbs = { .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify, @@ -7272,6 +7791,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -7281,52 +7801,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -7457,6 +7983,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -7466,52 +7993,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { @@ -7642,6 +8175,7 @@ const struct frr_yang_module_info frr_bgp_info = { .cbs = { .create = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create, .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy, + .apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish, } }, { @@ -7651,52 +8185,58 @@ const struct frr_yang_module_info frr_bgp_info = { } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check", + .cbs = { + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy, } }, { - .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only", + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only", .cbs = { - .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify, - .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy, + .modify = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify, + .destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy, } }, { diff --git a/bgpd/bgp_nb.h b/bgpd/bgp_nb.h index 532021425f..f608d4f8c1 100644 --- a/bgpd/bgp_nb.h +++ b/bgpd/bgp_nb.h @@ -210,6 +210,8 @@ int bgp_neighbors_neighbor_update_source_interface_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_type_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_destroy( @@ -226,6 +228,8 @@ int bgp_neighbors_neighbor_ebgp_multihop_disable_connected_check_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_local_as_local_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_local_as_local_as_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_local_as_no_prepend_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_local_as_no_prepend_destroy( @@ -256,6 +260,8 @@ int bgp_neighbors_neighbor_bfd_options_check_cp_failure_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_admin_shutdown_enable_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_admin_shutdown_message_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_admin_shutdown_message_destroy( @@ -290,6 +296,8 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_create(struct nb_cb_create_args *args); int bgp_neighbors_unnumbered_neighbor_destroy(struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_v6only_modify( @@ -336,6 +344,8 @@ int bgp_neighbors_unnumbered_neighbor_update_source_interface_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_destroy( @@ -352,6 +362,8 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_disable_connected_check_modi struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_local_as_local_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_local_as_local_as_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_local_as_no_prepend_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_local_as_no_prepend_destroy( @@ -382,6 +394,8 @@ int bgp_neighbors_unnumbered_neighbor_bfd_options_check_cp_failure_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_admin_shutdown_message_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_admin_shutdown_message_destroy( @@ -416,6 +430,8 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_create(struct nb_cb_create_args *args); int bgp_peer_groups_peer_group_destroy(struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_ipv4_listen_range_create( @@ -462,6 +478,8 @@ int bgp_peer_groups_peer_group_update_source_interface_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_destroy( @@ -478,6 +496,8 @@ int bgp_peer_groups_peer_group_ebgp_multihop_disable_connected_check_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_local_as_local_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_local_as_local_as_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_local_as_no_prepend_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_local_as_no_prepend_destroy( @@ -508,6 +528,8 @@ int bgp_peer_groups_peer_group_bfd_options_check_cp_failure_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_admin_shutdown_enable_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_admin_shutdown_message_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_admin_shutdown_message_destroy( @@ -542,6 +564,8 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args); int bgp_global_afi_safis_afi_safi_ipv4_unicast_network_config_create( struct nb_cb_create_args *args); int bgp_global_afi_safis_afi_safi_ipv4_unicast_network_config_destroy( @@ -1076,11 +1100,11 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_options_allow struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create( struct nb_cb_create_args *args); @@ -1088,33 +1112,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1194,13 +1220,13 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_as_path struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_as_path_filter_list_export_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_local_unchanged_modify( struct nb_cb_modify_args *args); @@ -1216,6 +1242,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_options_allow struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -1240,33 +1272,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1308,6 +1342,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_options_all struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -1332,33 +1372,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1400,6 +1442,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_options_all struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -1424,33 +1472,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1492,6 +1542,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_optio struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -1516,33 +1572,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1584,6 +1642,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_optio struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -1608,33 +1672,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1688,33 +1754,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1768,33 +1836,35 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1874,11 +1944,11 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_op struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create( struct nb_cb_create_args *args); @@ -1886,33 +1956,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -1992,13 +2064,13 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_con struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_as_path_filter_list_export_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_local_unchanged_modify( struct nb_cb_modify_args *args); @@ -2014,6 +2086,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_op struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -2038,33 +2116,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2106,6 +2186,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_ struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -2130,33 +2216,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2198,6 +2286,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_ struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -2222,33 +2316,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2290,6 +2386,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -2314,33 +2416,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2382,6 +2486,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -2406,33 +2516,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2486,33 +2598,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2566,33 +2680,35 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2672,11 +2788,11 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_as_path_options_a struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create( struct nb_cb_create_args *args); @@ -2684,33 +2800,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2790,13 +2908,13 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_as_ struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_as_path_filter_list_export_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_nexthop_local_unchanged_modify( struct nb_cb_modify_args *args); @@ -2812,6 +2930,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_as_path_options_a struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -2836,33 +2960,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2904,6 +3030,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_as_path_options struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -2928,33 +3060,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -2996,6 +3130,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_as_path_options struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_next_hop_unchanged_modify( @@ -3020,33 +3160,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -3088,6 +3230,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_o struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -3112,33 +3260,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -3180,6 +3330,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_o struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_options_replace_peer_as_modify( struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_as_path_unchanged_modify( struct nb_cb_modify_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchanged_next_hop_unchanged_modify( @@ -3204,33 +3360,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -3284,33 +3442,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -3364,33 +3524,35 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_max_prefixes_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args); +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args); -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args); int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_self_next_hop_self_modify( struct nb_cb_modify_args *args); @@ -3577,6 +3739,34 @@ void bgp_global_afi_safi_ip_unicast_redistribution_list_apply_finish( struct nb_cb_apply_finish_args *args); void bgp_global_afi_safis_afi_safi_route_flap_dampening_apply_finish( struct nb_cb_apply_finish_args *args); +void bgp_neighbors_neighbor_local_as_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbors_unnumbered_neighbor_local_as_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_peer_group_neighbor_remote_as_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbors_neighbor_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbors_unnumbered_neighbor_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_peer_groups_peer_group_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_peer_groups_peer_group_local_as_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_peer_group_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_neighbor_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args); +void bgp_peer_group_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args); /* xpath macros */ /* route-list */ @@ -3592,5 +3782,17 @@ void bgp_global_afi_safis_afi_safi_route_flap_dampening_apply_finish( #define FRR_BGP_AFI_SAFI_REDIST_XPATH \ "./global/afi-safis/afi-safi[afi-safi-name='%s']/%s/" \ "redistribution-list[route-type='%s'][route-instance='%s']" +#define FRR_BGP_NEIGHBOR_NUM_XPATH "./neighbors/neighbor[remote-address='%s']%s" +#define FRR_BGP_NEIGHBOR_UNNUM_XPATH \ + "./neighbors/unnumbered-neighbor[interface='%s']%s" +#define FRR_BGP_PEER_GROUP_XPATH \ + "./peer-groups/peer-group[peer-group-name='%s']%s" +#define FRR_BGP_NEIGHBOR_NUM_AFI_SAFI_XPATH \ + "./neighbors/neighbor[remote-address='%s']/afi-safis/afi-safi[afi-safi-name='%s']" +#define FRR_BGP_NEIGHBOR_UNNUM_AFI_SAFI_XPATH \ + "./neighbors/neighbor[interface='%s']/afi-safis/afi-safi[afi-safi-name='%s']" +#define FRR_BGP_PEER_GROUP_AFI_SAFI_XPATH \ + "./peer-groups/peer-group[peer-group-name='%s']/afi-safis/afi-safi[afi-safi-name='%s']" +#define FRR_BGP_AF_XPATH "/afi-safis/afi-safi[afi-safi-name='%s']" #endif diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c index 66dfa2aea7..4cc92eed54 100644 --- a/bgpd/bgp_nb_config.c +++ b/bgpd/bgp_nb_config.c @@ -173,7 +173,6 @@ int bgp_router_destroy(struct nb_cb_destroy_args *args) case NB_EV_APPLY: bgp = nb_running_unset_entry(args->dnode); - bgp_vpn_leak_unimport(bgp); bgp_delete(bgp); break; @@ -2090,18 +2089,73 @@ int bgp_global_afi_safis_afi_safi_destroy(struct nb_cb_destroy_args *args) return NB_OK; } +static struct peer *bgp_neighbor_peer_lookup(struct bgp *bgp, + const char *peer_str, char *errmsg, + size_t errmsg_len) +{ + struct peer *peer = NULL; + union sockunion su; + + str2sockunion(peer_str, &su); + peer = peer_lookup(bgp, &su); + if (!peer) { + snprintf(errmsg, errmsg_len, + "Specify remote-as or peer-group commands first"); + return NULL; + } + if (peer_dynamic_neighbor(peer)) { + snprintf(errmsg, errmsg_len, + "Operation not allowed on a dynamic neighbor\n"); + return NULL; + } + return peer; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor */ int bgp_neighbors_neighbor_create(struct nb_cb_create_args *args) { + struct bgp *bgp; + const char *peer_str; + union sockunion su; + switch (args->event) { case NB_EV_VALIDATE: + + peer_str = + yang_dnode_get_string(args->dnode, "./remote-address"); + + bgp = nb_running_get_entry(args->dnode, NULL, false); + if (!bgp) + return NB_OK; + + str2sockunion(peer_str, &su); + if (peer_address_self_check(bgp, &su)) { + snprintf( + args->errmsg, args->errmsg_len, + "Can not configure the local system as neighbor"); + return NB_ERR_VALIDATION; + } + + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + /* Once bgp instance available check self peer addr */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + + peer_str = + yang_dnode_get_string(args->dnode, "./remote-address"); + str2sockunion(peer_str, &su); + if (peer_address_self_check(bgp, &su)) { + snprintf( + args->errmsg, args->errmsg_len, + "Can not configure the local system as neighbor"); + return NB_ERR_INCONSISTENCY; + } break; } @@ -2110,12 +2164,65 @@ int bgp_neighbors_neighbor_create(struct nb_cb_create_args *args) int bgp_neighbors_neighbor_destroy(struct nb_cb_destroy_args *args) { + + struct bgp *bgp; + const char *peer_str; + union sockunion su; + struct peer *peer = NULL; + struct peer *other; + switch (args->event) { case NB_EV_VALIDATE: + bgp = nb_running_get_entry(args->dnode, NULL, false); + if (!bgp) + return NB_OK; + peer_str = + yang_dnode_get_string(args->dnode, "./remote-address"); + str2sockunion(peer_str, &su); + + peer = peer_lookup(bgp, &su); + if (peer) { + if (peer_dynamic_neighbor(peer)) { + snprintf( + args->errmsg, args->errmsg_len, + "Operation not allowed on a dynamic neighbor"); + return NB_ERR_VALIDATION; + } + } + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + + bgp = nb_running_get_entry(args->dnode, NULL, true); + + peer_str = + yang_dnode_get_string(args->dnode, "./remote-address"); + str2sockunion(peer_str, &su); + + peer = peer_lookup(bgp, &su); + if (peer) { + if (peer_dynamic_neighbor(peer)) { + snprintf( + args->errmsg, args->errmsg_len, + "Operation not allowed on a dynamic neighbor"); + return NB_ERR_INCONSISTENCY; + } + + other = peer->doppelganger; + + if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + bgp_zebra_terminate_radv(peer->bgp, peer); + + peer_notify_unconfig(peer); + peer_delete(peer); + if (other && other->status != Deleted) { + peer_notify_unconfig(other); + peer_delete(other); + } + } + break; } @@ -2129,12 +2236,38 @@ int bgp_neighbors_neighbor_destroy(struct nb_cb_destroy_args *args) int bgp_neighbors_neighbor_local_interface_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *intf_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + if (peer->conf_if) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + intf_str = yang_dnode_get_string(args->dnode, NULL); + + peer_interface_set(peer, intf_str); + break; } @@ -2144,12 +2277,35 @@ int bgp_neighbors_neighbor_local_interface_modify( int bgp_neighbors_neighbor_local_interface_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + if (peer->conf_if) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + peer_interface_unset(peer); + break; } @@ -2162,12 +2318,31 @@ int bgp_neighbors_neighbor_local_interface_destroy( */ int bgp_neighbors_neighbor_local_port_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t port; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + port = yang_dnode_get_uint16(args->dnode, NULL); + peer_port_set(peer, port); + break; } @@ -2176,12 +2351,33 @@ int bgp_neighbors_neighbor_local_port_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_local_port_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t port; + struct servent *sp; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) { + snprintf(args->errmsg, args->errmsg_len, + "BGP invalid peer %s", peer_str); + return NB_ERR_INCONSISTENCY; + } + + sp = getservbyname("bgp", "tcp"); + port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs(sp->s_port); + peer_port_set(peer, port); + break; } @@ -2194,12 +2390,67 @@ int bgp_neighbors_neighbor_local_port_destroy(struct nb_cb_destroy_args *args) */ int bgp_neighbors_neighbor_peer_group_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *peer_grp_str; + struct peer *peer; + struct peer_group *group; + union sockunion su; + as_t as; + int ret = 0; + char prgrp_xpath[XPATH_MAXLEN]; + const struct lyd_node *bgp_dnode; + switch (args->event) { case NB_EV_VALIDATE: + peer_grp_str = yang_dnode_get_string(args->dnode, NULL); + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + FRR_BGP_PEER_GROUP_XPATH, peer_grp_str, ""); + + if (!yang_dnode_exists(bgp_dnode, prgrp_xpath)) { + snprintf(args->errmsg, args->errmsg_len, + "Configure the peer-group first %s", + peer_grp_str); + return NB_ERR_VALIDATION; + } + + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + str2sockunion(peer_str, &su); + + peer_grp_str = yang_dnode_get_string(args->dnode, NULL); + group = peer_group_lookup(bgp, peer_grp_str); + if (!group) { + snprintf(args->errmsg, args->errmsg_len, + "Configure the peer-group first %s", + peer_grp_str); + return NB_ERR_INCONSISTENCY; + } + + ret = peer_group_bind(bgp, &su, peer, group, &as); + + if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) { + snprintf( + args->errmsg, args->errmsg_len, + "Peer with AS %u cannot be in this peer-group, members must be all internal or all external\n", + as); + return NB_ERR_INCONSISTENCY; + } + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -2208,12 +2459,33 @@ int bgp_neighbors_neighbor_peer_group_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_peer_group_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + bgp_zebra_terminate_radv(peer->bgp, peer); + + peer_notify_unconfig(peer); + ret = peer_delete(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -2226,12 +2498,29 @@ int bgp_neighbors_neighbor_peer_group_destroy(struct nb_cb_destroy_args *args) */ int bgp_neighbors_neighbor_password_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *passwrd_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + passwrd_str = yang_dnode_get_string(args->dnode, NULL); + + peer_password_set(peer, passwrd_str); + break; } @@ -2240,12 +2529,26 @@ int bgp_neighbors_neighbor_password_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_password_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_password_unset(peer); + break; } @@ -2258,12 +2561,44 @@ int bgp_neighbors_neighbor_password_destroy(struct nb_cb_destroy_args *args) */ int bgp_neighbors_neighbor_ttl_security_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + uint8_t gtsm_hops; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + gtsm_hops = yang_dnode_get_uint8(args->dnode, NULL); + /* + * If 'neighbor swpX', then this is for directly connected + * peers, we should not accept a ttl-security hops value greater + * than 1. + */ + if (peer->conf_if && (gtsm_hops > BGP_GTSM_HOPS_CONNECTED)) { + snprintf( + args->errmsg, args->errmsg_len, + "%d is directly connected peer, hops cannot exceed 1\n", + gtsm_hops); + return NB_ERR_INCONSISTENCY; + } + + ret = peer_ttl_security_hops_set(peer, gtsm_hops); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret)) + return NB_ERR_INCONSISTENCY; + break; } @@ -2272,12 +2607,31 @@ int bgp_neighbors_neighbor_ttl_security_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_ttl_security_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ttl_security_hops_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; } @@ -2309,12 +2663,28 @@ int bgp_neighbors_neighbor_solo_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_enforce_first_as_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_ENFORCE_FIRST_AS, enable, + args->errmsg, args->errmsg_len); break; } @@ -2327,12 +2697,30 @@ int bgp_neighbors_neighbor_enforce_first_as_modify( */ int bgp_neighbors_neighbor_description_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *desc_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + desc_str = yang_dnode_get_string(args->dnode, NULL); + + peer_description_set(peer, desc_str); + break; } @@ -2341,12 +2729,26 @@ int bgp_neighbors_neighbor_description_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_description_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_description_unset(peer); + break; } @@ -2359,12 +2761,32 @@ int bgp_neighbors_neighbor_description_destroy(struct nb_cb_destroy_args *args) */ int bgp_neighbors_neighbor_passive_mode_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_PASSIVE, + set, args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -2378,12 +2800,29 @@ int bgp_neighbors_neighbor_passive_mode_modify(struct nb_cb_modify_args *args) int bgp_neighbors_neighbor_capability_options_dynamic_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DYNAMIC_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -2397,12 +2836,29 @@ int bgp_neighbors_neighbor_capability_options_dynamic_capability_modify( int bgp_neighbors_neighbor_capability_options_strict_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_STRICT_CAP_MATCH, enable, + args->errmsg, args->errmsg_len); + break; } @@ -2416,12 +2872,29 @@ int bgp_neighbors_neighbor_capability_options_strict_capability_modify( int bgp_neighbors_neighbor_capability_options_extended_nexthop_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_CAPABILITY_ENHE, enable, + args->errmsg, args->errmsg_len); + break; } @@ -2454,12 +2927,29 @@ int bgp_neighbors_neighbor_capability_options_capability_negotiate_modify( int bgp_neighbors_neighbor_capability_options_override_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_OVERRIDE_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -2473,12 +2963,30 @@ int bgp_neighbors_neighbor_capability_options_override_capability_modify( int bgp_neighbors_neighbor_update_source_ip_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + union sockunion su; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + str2sockunion(source_str, &su); + peer_update_source_addr_set(peer, &su); + break; } @@ -2488,12 +2996,26 @@ int bgp_neighbors_neighbor_update_source_ip_modify( int bgp_neighbors_neighbor_update_source_ip_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -2507,12 +3029,36 @@ int bgp_neighbors_neighbor_update_source_ip_destroy( int bgp_neighbors_neighbor_update_source_interface_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + struct prefix p; + switch (args->event) { case NB_EV_VALIDATE: + source_str = yang_dnode_get_string(args->dnode, NULL); + if (str2prefix(source_str, &p)) { + snprintf(args->errmsg, args->errmsg_len, + "Invalid update-source, remove prefix length"); + return NB_ERR_VALIDATION; + } + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + peer_update_source_if_set(peer, source_str); + break; } @@ -2522,12 +3068,26 @@ int bgp_neighbors_neighbor_update_source_interface_modify( int bgp_neighbors_neighbor_update_source_interface_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -2541,6 +3101,46 @@ int bgp_neighbors_neighbor_update_source_interface_destroy( int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_type_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + int as_type = AS_SPECIFIED; + union sockunion su; + int ret; + as_t as = 0; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + as_type = yang_dnode_get_enum(args->dnode, "../remote-as-type"); + /* When remote-as-type is as-specified, the peer will be + * created in remote_as_modify callback */ + if (yang_dnode_exists(args->dnode, "../remote-as")) + return NB_OK; + + str2sockunion(peer_str, &su); + ret = peer_remote_as(bgp, &su, NULL, &as, as_type, AFI_IP, + SAFI_UNICAST); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args) +{ switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: @@ -2560,12 +3160,34 @@ int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_type_modify( int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + int as_type = AS_SPECIFIED; + union sockunion su; + int ret; + as_t as = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + as_type = yang_dnode_get_enum(args->dnode, "../remote-as-type"); + as = yang_dnode_get_uint32(args->dnode, NULL); + + str2sockunion(peer_str, &su); + ret = peer_remote_as(bgp, &su, NULL, &as, as_type, AFI_IP, + SAFI_UNICAST); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; } @@ -2594,12 +3216,46 @@ int bgp_neighbors_neighbor_neighbor_remote_as_remote_as_destroy( int bgp_neighbors_neighbor_ebgp_multihop_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (set) + ret = peer_ebgp_multihop_set(peer, ttl); + else + ret = peer_ebgp_multihop_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; } @@ -2609,12 +3265,32 @@ int bgp_neighbors_neighbor_ebgp_multihop_enabled_modify( int bgp_neighbors_neighbor_ebgp_multihop_enabled_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; } @@ -2628,12 +3304,39 @@ int bgp_neighbors_neighbor_ebgp_multihop_enabled_destroy( int bgp_neighbors_neighbor_ebgp_multihop_multihop_ttl_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + ttl = yang_dnode_get_uint8(args->dnode, NULL); + + ret = peer_ebgp_multihop_set(peer, ttl); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -2643,12 +3346,29 @@ int bgp_neighbors_neighbor_ebgp_multihop_multihop_ttl_modify( int bgp_neighbors_neighbor_ebgp_multihop_multihop_ttl_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -2662,12 +3382,33 @@ int bgp_neighbors_neighbor_ebgp_multihop_multihop_ttl_destroy( int bgp_neighbors_neighbor_ebgp_multihop_disable_connected_check_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DISABLE_CONNECTED_CHECK, set, + args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -2676,6 +3417,41 @@ int bgp_neighbors_neighbor_ebgp_multihop_disable_connected_check_modify( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as + */ +void bgp_neighbors_neighbor_local_as_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + int ret; + as_t as = 0; + const char *peer_str; + struct peer *peer = NULL; + bool no_prepend = 0; + bool replace_as = 0; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (yang_dnode_exists(args->dnode, "./local-as")) + as = yang_dnode_get_uint32(args->dnode, "./local-as"); + if (yang_dnode_exists(args->dnode, "./no-prepend")) + no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend"); + if (yang_dnode_exists(args->dnode, "./no-replace-as")) + replace_as = + yang_dnode_get_bool(args->dnode, "./no-replace-as"); + + if (!as && !no_prepend && !replace_as) + ret = peer_local_as_unset(peer); + else + ret = peer_local_as_set(peer, as, no_prepend, replace_as); + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/local-as */ int bgp_neighbors_neighbor_local_as_local_as_modify( @@ -2693,6 +3469,40 @@ int bgp_neighbors_neighbor_local_as_local_as_modify( return NB_OK; } +int bgp_neighbors_neighbor_local_as_local_as_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + int ret; + const char *peer_str; + struct peer *peer; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + + + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + ret = peer_local_as_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/no-prepend @@ -2937,6 +3747,34 @@ int bgp_neighbors_neighbor_bfd_options_check_cp_failure_destroy( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/admin-shutdown + */ +void bgp_neighbors_neighbor_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + const char *message; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (yang_dnode_exists(args->dnode, "./message")) { + message = yang_dnode_get_string(args->dnode, "./message"); + peer_tx_shutdown_message_set(peer, message); + } + enable = yang_dnode_get_bool(args->dnode, "./enable"); + + peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_SHUTDOWN, enable, + args->errmsg, args->errmsg_len); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/admin-shutdown/enable */ int bgp_neighbors_neighbor_admin_shutdown_enable_modify( @@ -2954,6 +3792,21 @@ int bgp_neighbors_neighbor_admin_shutdown_enable_modify( return NB_OK; } +int bgp_neighbors_neighbor_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/admin-shutdown/message @@ -3097,12 +3950,30 @@ int bgp_neighbors_neighbor_graceful_restart_graceful_restart_disable_destroy( int bgp_neighbors_neighbor_timers_advertise_interval_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t routeadv; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + routeadv = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_advertise_interval_set(peer, routeadv); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3112,12 +3983,28 @@ int bgp_neighbors_neighbor_timers_advertise_interval_modify( int bgp_neighbors_neighbor_timers_advertise_interval_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + ret = peer_advertise_interval_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3131,12 +4018,30 @@ int bgp_neighbors_neighbor_timers_advertise_interval_destroy( int bgp_neighbors_neighbor_timers_connect_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t connect; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + connect = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_timers_connect_set(peer, connect); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3146,12 +4051,28 @@ int bgp_neighbors_neighbor_timers_connect_time_modify( int bgp_neighbors_neighbor_timers_connect_time_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + ret = peer_timers_connect_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3165,12 +4086,37 @@ int bgp_neighbors_neighbor_timers_connect_time_destroy( int bgp_neighbors_neighbor_timers_hold_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + keepalive = yang_dnode_get_uint16(args->dnode, "../keepalive"); + holdtime = yang_dnode_get_uint16(args->dnode, NULL); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3184,12 +4130,44 @@ int bgp_neighbors_neighbor_timers_hold_time_modify( int bgp_neighbors_neighbor_timers_keepalive_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0, curr_keep = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + keepalive = yang_dnode_get_uint16(args->dnode, NULL); + holdtime = yang_dnode_get_uint16(args->dnode, "../hold-time"); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + if (peer->holdtime == holdtime) { + curr_keep = (keepalive < holdtime / 3 + ? keepalive + : holdtime / 3); + if (curr_keep == keepalive) + return NB_OK; + } + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3237,6 +4215,49 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_destroy( int bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *af_name; + afi_t afi; + safi_t safi; + bool activate = false; + int ret = 0; + union sockunion su; + struct peer *peer; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + af_name = + yang_dnode_get_string(args->dnode, "../afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + peer_str = yang_dnode_get_string(args->dnode, + "../../../remote-address"); + str2sockunion(peer_str, &su); + peer = peer_lookup(bgp, &su); + + activate = yang_dnode_get_bool(args->dnode, NULL); + + if (activate) + ret = peer_activate(peer, afi, safi); + else + ret = peer_deactivate(peer, afi, safi); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args) +{ switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: @@ -3249,18 +4270,91 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_enabled_modify( return NB_OK; } +static struct peer *bgp_unnumbered_neighbor_peer_lookup(struct bgp *bgp, + const char *peer_str, + char *errmsg, + size_t errmsg_len) +{ + struct peer *peer = NULL; + + /* Not IP, could match either peer configured on interface or a + * group. */ + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) { + snprintf(errmsg, errmsg_len, + "Specify remote-as or peer-group commands first"); + return NULL; + } + if (peer_dynamic_neighbor(peer)) { + snprintf(errmsg, errmsg_len, + "Operation not allowed on a dynamic neighbor\n"); + return NULL; + } + + return peer; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor */ int bgp_neighbors_unnumbered_neighbor_create(struct nb_cb_create_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *peer_grp_str = NULL; + bool v6_only = false; + int as_type = AS_UNSPECIFIED; + as_t as = 0; + char prgrp_xpath[XPATH_MAXLEN]; + const struct lyd_node *bgp_dnode; + switch (args->event) { case NB_EV_VALIDATE: + peer_str = yang_dnode_get_string(args->dnode, "./interface"); + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + FRR_BGP_PEER_GROUP_XPATH, peer_str, ""); + + if (yang_dnode_exists(bgp_dnode, prgrp_xpath)) { + snprintf(args->errmsg, args->errmsg_len, + "Name conflict with peer-group: %s", peer_str); + return NB_ERR_VALIDATION; + } + + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "./interface"); + + if (yang_dnode_exists(args->dnode, "./peer-group")) + peer_grp_str = yang_dnode_get_string(args->dnode, + "./peer-group"); + + if (yang_dnode_exists(args->dnode, "./v6-only")) + v6_only = yang_dnode_get_bool(args->dnode, "./v6-only"); + + if (yang_dnode_exists(args->dnode, + "./neighbor-remote-as/remote-as-type")) { + as_type = yang_dnode_get_enum( + args->dnode, + "./neighbor-remote-as/remote-as-type"); + if (yang_dnode_exists(args->dnode, + "./neighbor-remote-as/remote-as")) + as = yang_dnode_get_uint32( + args->dnode, + "./neighbor-remote-as/remote-as"); + } + + if (peer_conf_interface_create(bgp, peer_str, AFI_IP, + SAFI_UNICAST, v6_only, + peer_grp_str, as_type, as, + args->errmsg, args->errmsg_len)) + return NB_ERR_INCONSISTENCY; + break; } @@ -3269,12 +4363,34 @@ int bgp_neighbors_unnumbered_neighbor_create(struct nb_cb_create_args *args) int bgp_neighbors_unnumbered_neighbor_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + + peer_str = yang_dnode_get_string(args->dnode, "./interface"); + /* look up for neighbor by interface name config. */ + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (peer) { + /* Request zebra to terminate IPv6 RAs on this + * interface. */ + if (peer->ifp) + bgp_zebra_terminate_radv(peer->bgp, peer); + peer_notify_unconfig(peer); + peer_delete(peer); + } else { + snprintf(args->errmsg, args->errmsg_len, + "Create the peer-group first"); + return NB_ERR_INCONSISTENCY; + } + break; } @@ -3288,12 +4404,26 @@ int bgp_neighbors_unnumbered_neighbor_destroy(struct nb_cb_destroy_args *args) int bgp_neighbors_unnumbered_neighbor_v6only_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + bool v6_only = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + + v6_only = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_conf_interface_create( + bgp, peer_str, AFI_IP, SAFI_UNICAST, v6_only, NULL, + AS_UNSPECIFIED, 0, args->errmsg, args->errmsg_len)) + return NB_ERR_INCONSISTENCY; + break; } @@ -3307,12 +4437,60 @@ int bgp_neighbors_unnumbered_neighbor_v6only_modify( int bgp_neighbors_unnumbered_neighbor_peer_group_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *peer_grp_str; + struct peer *peer; + struct peer_group *group; + union sockunion su; + as_t as; + int ret = 0; + char prgrp_xpath[XPATH_MAXLEN]; + const struct lyd_node *bgp_dnode; + switch (args->event) { case NB_EV_VALIDATE: + peer_grp_str = yang_dnode_get_string(args->dnode, NULL); + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + FRR_BGP_PEER_GROUP_XPATH, peer_grp_str, ""); + + if (!yang_dnode_exists(bgp_dnode, prgrp_xpath)) { + snprintf(args->errmsg, args->errmsg_len, + "Configure the peer-group first %s", + peer_grp_str); + return NB_ERR_VALIDATION; + } + + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + peer_grp_str = yang_dnode_get_string(args->dnode, NULL); + group = peer_group_lookup(bgp, peer_grp_str); + if (!group) { + snprintf(args->errmsg, args->errmsg_len, + "Configure the peer-group first\n"); + return NB_ERR_INCONSISTENCY; + } + + ret = peer_group_bind(bgp, &su, peer, group, &as); + if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) { + snprintf( + args->errmsg, args->errmsg_len, + "Peer with AS %u cannot be in this peer-group, members must be all internal or all external\n", + as); + return NB_ERR_INCONSISTENCY; + } + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3322,12 +4500,33 @@ int bgp_neighbors_unnumbered_neighbor_peer_group_modify( int bgp_neighbors_unnumbered_neighbor_peer_group_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../remote-address"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + bgp_zebra_terminate_radv(peer->bgp, peer); + + peer_notify_unconfig(peer); + ret = peer_delete(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3341,12 +4540,27 @@ int bgp_neighbors_unnumbered_neighbor_peer_group_destroy( int bgp_neighbors_unnumbered_neighbor_password_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *passwrd_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + passwrd_str = yang_dnode_get_string(args->dnode, NULL); + peer_password_set(peer, passwrd_str); + break; } @@ -3356,12 +4570,25 @@ int bgp_neighbors_unnumbered_neighbor_password_modify( int bgp_neighbors_unnumbered_neighbor_password_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_password_unset(peer); + break; } @@ -3375,12 +4602,44 @@ int bgp_neighbors_unnumbered_neighbor_password_destroy( int bgp_neighbors_unnumbered_neighbor_ttl_security_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + uint8_t gtsm_hops; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + gtsm_hops = yang_dnode_get_uint8(args->dnode, NULL); + /* + * If 'neighbor swpX', then this is for directly connected + * peers, we should not accept a ttl-security hops value greater + * than 1. + */ + if (peer->conf_if && (gtsm_hops > BGP_GTSM_HOPS_CONNECTED)) { + snprintf( + args->errmsg, args->errmsg_len, + "%d is directly connected peer, hops cannot exceed 1\n", + gtsm_hops); + return NB_ERR_INCONSISTENCY; + } + + ret = peer_ttl_security_hops_set(peer, gtsm_hops); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3390,12 +4649,27 @@ int bgp_neighbors_unnumbered_neighbor_ttl_security_modify( int bgp_neighbors_unnumbered_neighbor_ttl_security_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ttl_security_hops_unset(peer); + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3428,12 +4702,28 @@ int bgp_neighbors_unnumbered_neighbor_solo_modify( int bgp_neighbors_unnumbered_neighbor_enforce_first_as_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_ENFORCE_FIRST_AS, enable, + args->errmsg, args->errmsg_len); + break; } @@ -3447,12 +4737,29 @@ int bgp_neighbors_unnumbered_neighbor_enforce_first_as_modify( int bgp_neighbors_unnumbered_neighbor_description_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *desc_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + desc_str = yang_dnode_get_string(args->dnode, NULL); + + peer_description_set(peer, desc_str); + break; } @@ -3462,12 +4769,26 @@ int bgp_neighbors_unnumbered_neighbor_description_modify( int bgp_neighbors_unnumbered_neighbor_description_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_description_unset(peer); + break; } @@ -3481,12 +4802,31 @@ int bgp_neighbors_unnumbered_neighbor_description_destroy( int bgp_neighbors_unnumbered_neighbor_passive_mode_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_PASSIVE, + set, args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3500,12 +4840,31 @@ int bgp_neighbors_unnumbered_neighbor_passive_mode_modify( int bgp_neighbors_unnumbered_neighbor_capability_options_dynamic_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DYNAMIC_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -3519,12 +4878,31 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_dynamic_capability_modi int bgp_neighbors_unnumbered_neighbor_capability_options_strict_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_STRICT_CAP_MATCH, enable, + args->errmsg, args->errmsg_len); + break; } @@ -3538,12 +4916,31 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_strict_capability_modif int bgp_neighbors_unnumbered_neighbor_capability_options_extended_nexthop_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_CAPABILITY_ENHE, enable, + args->errmsg, args->errmsg_len); + break; } @@ -3576,12 +4973,29 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_capability_negotiate_mo int bgp_neighbors_unnumbered_neighbor_capability_options_override_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_OVERRIDE_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -3595,12 +5009,30 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_override_capability_mod int bgp_neighbors_unnumbered_neighbor_update_source_ip_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + union sockunion su; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + str2sockunion(source_str, &su); + peer_update_source_addr_set(peer, &su); + break; } @@ -3610,12 +5042,26 @@ int bgp_neighbors_unnumbered_neighbor_update_source_ip_modify( int bgp_neighbors_unnumbered_neighbor_update_source_ip_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -3629,12 +5075,36 @@ int bgp_neighbors_unnumbered_neighbor_update_source_ip_destroy( int bgp_neighbors_unnumbered_neighbor_update_source_interface_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + struct prefix p; + switch (args->event) { case NB_EV_VALIDATE: + source_str = yang_dnode_get_string(args->dnode, NULL); + if (str2prefix(source_str, &p)) { + snprintf(args->errmsg, args->errmsg_len, + "Invalid update-source, remove prefix length"); + return NB_ERR_VALIDATION; + } + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + peer_update_source_if_set(peer, source_str); + break; } @@ -3644,12 +5114,26 @@ int bgp_neighbors_unnumbered_neighbor_update_source_interface_modify( int bgp_neighbors_unnumbered_neighbor_update_source_interface_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -3658,6 +5142,41 @@ int bgp_neighbors_unnumbered_neighbor_update_source_interface_destroy( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/neighbor-remote-as + */ +void bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + int as_type = AS_SPECIFIED; + int ret; + as_t as = 0; + struct peer *peer = NULL; + afi_t afi = AFI_IP; + safi_t safi = SAFI_UNICAST; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + as_type = yang_dnode_get_enum(args->dnode, "./remote-as-type"); + if (yang_dnode_exists(args->dnode, "./remote-as")) + as = yang_dnode_get_uint32(args->dnode, "./remote-as"); + + peer = peer_lookup_by_conf_if(bgp, peer_str); + + ret = peer_remote_as(bgp, NULL, peer_str, &as, as_type, afi, safi); + + if (ret < 0 && !peer) { + snprintf(args->errmsg, args->errmsg_len, + "Create the peer-group or interface first"); + return; + } + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/neighbor-remote-as/remote-as-type */ int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_modify( @@ -3675,6 +5194,34 @@ int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_modify( return NB_OK; } +int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + + /* remote-as set to 0 and as_type to unspecified */ + if (peer) + peer_as_change(peer, 0, AS_UNSPECIFIED); + + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/neighbor-remote-as/remote-as @@ -3716,12 +5263,42 @@ int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_destroy( int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (set) + ret = peer_ebgp_multihop_set(peer, ttl); + else + ret = peer_ebgp_multihop_unset(peer); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3731,12 +5308,28 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_enabled_modify( int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_enabled_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3750,12 +5343,38 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_enabled_destroy( int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_multihop_ttl_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + ttl = yang_dnode_get_uint8(args->dnode, NULL); + + ret = peer_ebgp_multihop_set(peer, ttl); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3765,12 +5384,28 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_multihop_ttl_modify( int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_multihop_ttl_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -3784,12 +5419,32 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_multihop_ttl_destroy( int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_disable_connected_check_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = peer_lookup_by_conf_if(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DISABLE_CONNECTED_CHECK, set, + args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -3798,6 +5453,43 @@ int bgp_neighbors_unnumbered_neighbor_ebgp_multihop_disable_connected_check_modi /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as + */ +void bgp_neighbors_unnumbered_neighbor_local_as_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + int ret; + as_t as = 0; + const char *peer_str; + struct peer *peer = NULL; + bool no_prepend = 0; + bool replace_as = 0; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (yang_dnode_exists(args->dnode, "./local-as")) + as = yang_dnode_get_uint32(args->dnode, "./local-as"); + if (yang_dnode_exists(args->dnode, "./no-prepend")) + no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend"); + if (yang_dnode_exists(args->dnode, "./no-replace-as")) + replace_as = + yang_dnode_get_bool(args->dnode, "./no-replace-as"); + + if (!as && !no_prepend && !replace_as) + ret = peer_local_as_unset(peer); + else + ret = peer_local_as_set(peer, as, no_prepend, replace_as); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/local-as */ int bgp_neighbors_unnumbered_neighbor_local_as_local_as_modify( @@ -3815,6 +5507,21 @@ int bgp_neighbors_unnumbered_neighbor_local_as_local_as_modify( return NB_OK; } +int bgp_neighbors_unnumbered_neighbor_local_as_local_as_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/no-prepend @@ -4059,6 +5766,34 @@ int bgp_neighbors_unnumbered_neighbor_bfd_options_check_cp_failure_destroy( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/admin-shutdown + */ +void bgp_neighbors_unnumbered_neighbor_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + const char *message; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (yang_dnode_exists(args->dnode, "./message")) { + message = yang_dnode_get_string(args->dnode, "./message"); + peer_tx_shutdown_message_set(peer, message); + } + enable = yang_dnode_get_bool(args->dnode, "./enable"); + + peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_SHUTDOWN, enable, + args->errmsg, args->errmsg_len); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/admin-shutdown/enable */ int bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_modify( @@ -4076,6 +5811,21 @@ int bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_modify( return NB_OK; } +int bgp_neighbors_unnumbered_neighbor_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/admin-shutdown/message @@ -4219,12 +5969,28 @@ int bgp_neighbors_unnumbered_neighbor_graceful_restart_graceful_restart_disable_ int bgp_neighbors_unnumbered_neighbor_timers_advertise_interval_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t routeadv; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + routeadv = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_advertise_interval_set(peer, routeadv); + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -4234,12 +6000,26 @@ int bgp_neighbors_unnumbered_neighbor_timers_advertise_interval_modify( int bgp_neighbors_unnumbered_neighbor_timers_advertise_interval_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + ret = peer_advertise_interval_unset(peer); + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -4253,12 +6033,28 @@ int bgp_neighbors_unnumbered_neighbor_timers_advertise_interval_destroy( int bgp_neighbors_unnumbered_neighbor_timers_connect_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t connect; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + connect = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_timers_connect_set(peer, connect); + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); + break; } @@ -4268,12 +6064,27 @@ int bgp_neighbors_unnumbered_neighbor_timers_connect_time_modify( int bgp_neighbors_unnumbered_neighbor_timers_connect_time_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + ret = peer_timers_connect_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4287,12 +6098,38 @@ int bgp_neighbors_unnumbered_neighbor_timers_connect_time_destroy( int bgp_neighbors_unnumbered_neighbor_timers_hold_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + keepalive = yang_dnode_get_uint16(args->dnode, "../keepalive"); + holdtime = yang_dnode_get_uint16(args->dnode, NULL); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4306,12 +6143,45 @@ int bgp_neighbors_unnumbered_neighbor_timers_hold_time_modify( int bgp_neighbors_unnumbered_neighbor_timers_keepalive_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0, curr_keep = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = + yang_dnode_get_string(args->dnode, "../../interface"); + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + keepalive = yang_dnode_get_uint16(args->dnode, NULL); + holdtime = yang_dnode_get_uint16(args->dnode, "../hold-time"); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + if (peer->holdtime == holdtime) { + curr_keep = (keepalive < holdtime / 3 + ? keepalive + : holdtime / 3); + if (curr_keep == keepalive) + return NB_OK; + } + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4359,6 +6229,51 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_destroy( int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *af_name; + afi_t afi; + safi_t safi; + bool activate = false; + int ret = 0; + struct peer *peer; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + af_name = + yang_dnode_get_string(args->dnode, "../afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + peer_str = yang_dnode_get_string(args->dnode, + "../../../interface"); + + peer = bgp_unnumbered_neighbor_peer_lookup( + bgp, peer_str, args->errmsg, args->errmsg_len); + + activate = yang_dnode_get_bool(args->dnode, NULL); + + if (activate) + ret = peer_activate(peer, afi, safi); + else + ret = peer_deactivate(peer, afi, safi); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args) +{ switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: @@ -4371,18 +6286,64 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_enabled_modify( return NB_OK; } +static struct peer *bgp_peer_group_peer_lookup(struct bgp *bgp, + const char *peer_str) +{ + struct peer_group *group = NULL; + + group = peer_group_lookup(bgp, peer_str); + return group->conf; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group */ int bgp_peer_groups_peer_group_create(struct nb_cb_create_args *args) { + const char *peer_grp_str; + struct peer *peer; + struct peer_group *group; + struct bgp *bgp; + char unnbr_xpath[XPATH_MAXLEN]; + const struct lyd_node *bgp_dnode; + switch (args->event) { case NB_EV_VALIDATE: + peer_grp_str = + yang_dnode_get_string(args->dnode, "./peer-group-name"); + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + snprintf(unnbr_xpath, sizeof(unnbr_xpath), + FRR_BGP_NEIGHBOR_UNNUM_XPATH, peer_grp_str, ""); + + if (yang_dnode_exists(bgp_dnode, unnbr_xpath)) { + snprintf(args->errmsg, args->errmsg_len, + "Name conflict with interface: %s", + peer_grp_str); + return NB_ERR_VALIDATION; + } + + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_grp_str = + yang_dnode_get_string(args->dnode, "./peer-group-name"); + peer = peer_lookup_by_conf_if(bgp, peer_grp_str); + if (peer) { + snprintf(args->errmsg, args->errmsg_len, + "Name conflict with interface:"); + return NB_ERR_INCONSISTENCY; + } + + group = peer_group_get(bgp, peer_grp_str); + if (!group) { + snprintf(args->errmsg, args->errmsg_len, + "BGP failed to find or create peer-group"); + return NB_ERR_INCONSISTENCY; + } break; } @@ -4391,12 +6352,26 @@ int bgp_peer_groups_peer_group_create(struct nb_cb_create_args *args) int bgp_peer_groups_peer_group_destroy(struct nb_cb_destroy_args *args) { + const char *peer_grp_str; + struct peer_group *group; + struct bgp *bgp; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_grp_str = + yang_dnode_get_string(args->dnode, "./peer-group-name"); + + group = peer_group_lookup(bgp, peer_grp_str); + if (group) { + peer_group_notify_unconfig(group); + peer_group_delete(group); + } + break; } @@ -4477,12 +6452,25 @@ int bgp_peer_groups_peer_group_ipv6_listen_range_destroy( */ int bgp_peer_groups_peer_group_password_modify(struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *passwrd_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + passwrd_str = yang_dnode_get_string(args->dnode, NULL); + peer_password_set(peer, passwrd_str); + break; } @@ -4491,12 +6479,23 @@ int bgp_peer_groups_peer_group_password_modify(struct nb_cb_modify_args *args) int bgp_peer_groups_peer_group_password_destroy(struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + peer_password_unset(peer); + break; } @@ -4510,12 +6509,44 @@ int bgp_peer_groups_peer_group_password_destroy(struct nb_cb_destroy_args *args) int bgp_peer_groups_peer_group_ttl_security_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + uint8_t gtsm_hops; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + gtsm_hops = yang_dnode_get_uint8(args->dnode, NULL); + /* + * If 'neighbor swpX', then this is for directly connected + * peers, we should not accept a ttl-security hops value greater + * than 1. + */ + if (peer->conf_if && (gtsm_hops > BGP_GTSM_HOPS_CONNECTED)) { + snprintf( + args->errmsg, args->errmsg_len, + "%d is directly connected peer, hops cannot exceed 1\n", + gtsm_hops); + return NB_ERR_INCONSISTENCY; + } + + ret = peer_ttl_security_hops_set(peer, gtsm_hops); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4525,12 +6556,29 @@ int bgp_peer_groups_peer_group_ttl_security_modify( int bgp_peer_groups_peer_group_ttl_security_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ttl_security_hops_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4562,12 +6610,28 @@ int bgp_peer_groups_peer_group_solo_modify(struct nb_cb_modify_args *args) int bgp_peer_groups_peer_group_enforce_first_as_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_ENFORCE_FIRST_AS, enable, + args->errmsg, args->errmsg_len); + break; } @@ -4581,12 +6645,26 @@ int bgp_peer_groups_peer_group_enforce_first_as_modify( int bgp_peer_groups_peer_group_description_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *desc_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + desc_str = yang_dnode_get_string(args->dnode, NULL); + + peer_description_set(peer, desc_str); + break; } @@ -4596,12 +6674,25 @@ int bgp_peer_groups_peer_group_description_modify( int bgp_peer_groups_peer_group_description_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer = NULL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_description_unset(peer); + break; } @@ -4615,12 +6706,31 @@ int bgp_peer_groups_peer_group_description_destroy( int bgp_peer_groups_peer_group_passive_mode_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_PASSIVE, + set, args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4634,12 +6744,30 @@ int bgp_peer_groups_peer_group_passive_mode_modify( int bgp_peer_groups_peer_group_capability_options_dynamic_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DYNAMIC_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -4653,12 +6781,30 @@ int bgp_peer_groups_peer_group_capability_options_dynamic_capability_modify( int bgp_peer_groups_peer_group_capability_options_strict_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_STRICT_CAP_MATCH, enable, + args->errmsg, args->errmsg_len); + break; } @@ -4672,12 +6818,30 @@ int bgp_peer_groups_peer_group_capability_options_strict_capability_modify( int bgp_peer_groups_peer_group_capability_options_extended_nexthop_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_CAPABILITY_ENHE, enable, + args->errmsg, args->errmsg_len); + break; } @@ -4710,12 +6874,30 @@ int bgp_peer_groups_peer_group_capability_options_capability_negotiate_modify( int bgp_peer_groups_peer_group_capability_options_override_capability_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + enable = yang_dnode_get_bool(args->dnode, NULL); + + peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_OVERRIDE_CAPABILITY, enable, + args->errmsg, args->errmsg_len); + break; } @@ -4729,12 +6911,29 @@ int bgp_peer_groups_peer_group_capability_options_override_capability_modify( int bgp_peer_groups_peer_group_update_source_ip_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + union sockunion su; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + str2sockunion(source_str, &su); + peer_update_source_addr_set(peer, &su); + break; } @@ -4744,12 +6943,25 @@ int bgp_peer_groups_peer_group_update_source_ip_modify( int bgp_peer_groups_peer_group_update_source_ip_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -4763,12 +6975,35 @@ int bgp_peer_groups_peer_group_update_source_ip_destroy( int bgp_peer_groups_peer_group_update_source_interface_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str, *source_str; + struct peer *peer; + struct prefix p; + switch (args->event) { case NB_EV_VALIDATE: + source_str = yang_dnode_get_string(args->dnode, NULL); + if (str2prefix(source_str, &p)) { + snprintf(args->errmsg, args->errmsg_len, + "Invalid update-source, remove prefix length"); + return NB_ERR_VALIDATION; + } + break; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + source_str = yang_dnode_get_string(args->dnode, NULL); + + peer_update_source_if_set(peer, source_str); + break; } @@ -4778,12 +7013,25 @@ int bgp_peer_groups_peer_group_update_source_interface_modify( int bgp_peer_groups_peer_group_update_source_interface_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + peer_update_source_unset(peer); + break; } @@ -4792,6 +7040,33 @@ int bgp_peer_groups_peer_group_update_source_interface_destroy( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/neighbor-remote-as + */ +void bgp_peer_group_neighbor_remote_as_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + int as_type = AS_SPECIFIED; + int ret; + as_t as = 0; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../peer-group-name"); + as_type = yang_dnode_get_enum(args->dnode, "./remote-as-type"); + if (yang_dnode_exists(args->dnode, "./remote-as")) + as = yang_dnode_get_uint32(args->dnode, "./remote-as"); + + ret = peer_group_remote_as(bgp, peer_str, &as, as_type); + if (ret < 0) { + snprintf(args->errmsg, args->errmsg_len, + "Create the peer-group or interface first"); + return; + } +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/neighbor-remote-as/remote-as-type */ int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_modify( @@ -4809,6 +7084,32 @@ int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_modify( return NB_OK; } +int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_type_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer_group *group; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + group = peer_group_lookup(bgp, peer_str); + if (group) + peer_group_remote_as_delete(group); + + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/neighbor-remote-as/remote-as @@ -4850,12 +7151,44 @@ int bgp_peer_groups_peer_group_neighbor_remote_as_remote_as_destroy( int bgp_peer_groups_peer_group_ebgp_multihop_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (set) + ret = peer_ebgp_multihop_set(peer, ttl); + else + ret = peer_ebgp_multihop_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4865,12 +7198,30 @@ int bgp_peer_groups_peer_group_ebgp_multihop_enabled_modify( int bgp_peer_groups_peer_group_ebgp_multihop_enabled_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4884,12 +7235,40 @@ int bgp_peer_groups_peer_group_ebgp_multihop_enabled_destroy( int bgp_peer_groups_peer_group_ebgp_multihop_multihop_ttl_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + uint8_t ttl = MAXTTL; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + if (peer->conf_if) { + ret = BGP_ERR_INVALID_FOR_DIRECT_PEER; + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, + ret); + return NB_ERR_INCONSISTENCY; + } + + ttl = yang_dnode_get_uint8(args->dnode, NULL); + + ret = peer_ebgp_multihop_set(peer, ttl); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4899,12 +7278,30 @@ int bgp_peer_groups_peer_group_ebgp_multihop_multihop_ttl_modify( int bgp_peer_groups_peer_group_ebgp_multihop_multihop_ttl_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + ret = peer_ebgp_multihop_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4918,12 +7315,32 @@ int bgp_peer_groups_peer_group_ebgp_multihop_multihop_ttl_destroy( int bgp_peer_groups_peer_group_ebgp_multihop_disable_connected_check_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool set = false; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + set = yang_dnode_get_bool(args->dnode, NULL); + + if (peer_flag_modify_nb(bgp, peer_str, peer, + PEER_FLAG_DISABLE_CONNECTED_CHECK, set, + args->errmsg, args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -4932,6 +7349,45 @@ int bgp_peer_groups_peer_group_ebgp_multihop_disable_connected_check_modify( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as + */ +void bgp_peer_groups_peer_group_local_as_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + int ret; + as_t as = 0; + const char *peer_str; + struct peer *peer = NULL; + bool no_prepend = false; + bool replace_as = false; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../peer-group-name"); + + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + if (yang_dnode_exists(args->dnode, "./local-as")) + as = yang_dnode_get_uint32(args->dnode, "./local-as"); + + if (yang_dnode_exists(args->dnode, "./local-as")) + as = yang_dnode_get_uint32(args->dnode, "./local-as"); + if (yang_dnode_exists(args->dnode, "./no-prepend")) + no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend"); + if (yang_dnode_exists(args->dnode, "./no-replace-as")) + replace_as = + yang_dnode_get_bool(args->dnode, "./no-replace-as"); + + if (!as && !no_prepend && !replace_as) + ret = peer_local_as_unset(peer); + else + ret = peer_local_as_set(peer, as, no_prepend, replace_as); + + bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/local-as */ int bgp_peer_groups_peer_group_local_as_local_as_modify( @@ -4949,6 +7405,36 @@ int bgp_peer_groups_peer_group_local_as_local_as_modify( return NB_OK; } +int bgp_peer_groups_peer_group_local_as_local_as_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + ret = peer_local_as_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/no-prepend @@ -5193,6 +7679,33 @@ int bgp_peer_groups_peer_group_bfd_options_check_cp_failure_destroy( /* * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/admin-shutdown + */ +void bgp_peer_groups_peer_group_admin_shutdown_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + bool enable = false; + const char *message; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, "../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + if (yang_dnode_exists(args->dnode, "./message")) { + message = yang_dnode_get_string(args->dnode, "./message"); + peer_tx_shutdown_message_set(peer, message); + } + enable = yang_dnode_get_bool(args->dnode, "./enable"); + + peer_flag_modify_nb(bgp, peer_str, peer, PEER_FLAG_SHUTDOWN, enable, + args->errmsg, args->errmsg_len); +} + +/* + * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/admin-shutdown/enable */ int bgp_peer_groups_peer_group_admin_shutdown_enable_modify( @@ -5210,6 +7723,21 @@ int bgp_peer_groups_peer_group_admin_shutdown_enable_modify( return NB_OK; } +int bgp_peer_groups_peer_group_admin_shutdown_enable_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/admin-shutdown/message @@ -5353,12 +7881,29 @@ int bgp_peer_groups_peer_group_graceful_restart_graceful_restart_disable_destroy int bgp_peer_groups_peer_group_timers_advertise_interval_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t routeadv; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + routeadv = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_advertise_interval_set(peer, routeadv); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5368,12 +7913,27 @@ int bgp_peer_groups_peer_group_timers_advertise_interval_modify( int bgp_peer_groups_peer_group_timers_advertise_interval_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + ret = peer_advertise_interval_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5387,12 +7947,29 @@ int bgp_peer_groups_peer_group_timers_advertise_interval_destroy( int bgp_peer_groups_peer_group_timers_connect_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t connect; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + connect = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_timers_connect_set(peer, connect); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5402,12 +7979,27 @@ int bgp_peer_groups_peer_group_timers_connect_time_modify( int bgp_peer_groups_peer_group_timers_connect_time_destroy( struct nb_cb_destroy_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + int ret; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + ret = peer_timers_connect_unset(peer); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5421,12 +8013,37 @@ int bgp_peer_groups_peer_group_timers_connect_time_destroy( int bgp_peer_groups_peer_group_timers_hold_time_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + keepalive = yang_dnode_get_uint16(args->dnode, "../keepalive"); + holdtime = yang_dnode_get_uint16(args->dnode, NULL); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5440,12 +8057,49 @@ int bgp_peer_groups_peer_group_timers_hold_time_modify( int bgp_peer_groups_peer_group_timers_keepalive_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + uint16_t keepalive = 0, curr_keep = 0; + uint16_t holdtime = 0; + int ret = 0; + switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + bgp = nb_running_get_entry(args->dnode, NULL, true); + peer_str = yang_dnode_get_string(args->dnode, + "../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + keepalive = yang_dnode_get_uint16(args->dnode, NULL); + holdtime = yang_dnode_get_uint16(args->dnode, "../hold-time"); + + if (keepalive != BGP_DEFAULT_KEEPALIVE + && holdtime != BGP_DEFAULT_HOLDTIME) { + if (peer->holdtime == holdtime) { + curr_keep = (keepalive < holdtime / 3 + ? keepalive + : holdtime / 3); + if (curr_keep == keepalive) { + // zlog_debug("%s holdtime %u keepalive + // %u value is already set, skipping + // update.", + // __func__, holdtime, keepalive); + return NB_OK; + } + } + ret = peer_timers_set(peer, keepalive, holdtime); + } else + ret = peer_timers_unset(peer); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + break; } @@ -5493,6 +8147,48 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_destroy( int bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_modify( struct nb_cb_modify_args *args) { + struct bgp *bgp; + const char *peer_str; + const char *af_name; + afi_t afi; + safi_t safi; + bool activate = false; + int ret = 0; + struct peer *peer; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + bgp = nb_running_get_entry(args->dnode, NULL, true); + af_name = + yang_dnode_get_string(args->dnode, "../afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + peer_str = yang_dnode_get_string(args->dnode, + "../../../peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + activate = yang_dnode_get_bool(args->dnode, NULL); + if (activate) + ret = peer_activate(peer, afi, safi); + else + ret = peer_deactivate(peer, afi, safi); + + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) + < 0) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_enabled_destroy( + struct nb_cb_destroy_args *args) +{ switch (args->event) { case NB_EV_VALIDATE: case NB_EV_PREPARE: @@ -6149,7 +8845,7 @@ bgp_global_afi_safi_route_flap_validation(struct nb_cb_modify_args *args) int reuse; int suppress; - if (yang_dnode_exists(args->dnode, "../supress-above") + if (yang_dnode_exists(args->dnode, "../suppress-above") && yang_dnode_exists(args->dnode, "../reuse-above")) { suppress = yang_dnode_get_uint16(args->dnode, "../suppress-above"); @@ -6384,10 +9080,10 @@ int bgp_global_afi_safis_afi_safi_ipv4_unicast_use_multiple_paths_ebgp_maximum_p switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -6455,10 +9151,10 @@ int bgp_global_afi_safis_afi_safi_ipv4_unicast_use_multiple_paths_ibgp_maximum_p switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -8302,10 +10998,10 @@ int bgp_global_afi_safis_afi_safi_ipv6_unicast_use_multiple_paths_ebgp_maximum_p switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -9064,10 +11760,10 @@ int bgp_global_afi_safis_afi_safi_ipv4_labeled_unicast_use_multiple_paths_ebgp_m switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -9302,10 +11998,10 @@ int bgp_global_afi_safis_afi_safi_ipv6_labeled_unicast_use_multiple_paths_ebgp_m switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -9332,10 +12028,10 @@ int bgp_global_afi_safis_afi_safi_ipv6_labeled_unicast_use_multiple_paths_ibgp_m switch (args->event) { case NB_EV_VALIDATE: maxpaths = yang_dnode_get_uint16(args->dnode, NULL); - if (maxpaths > MULTIPATH_NUM) { + if (maxpaths > multipath_num) { snprintf(args->errmsg, args->errmsg_len, "maxpaths %u is out of range %u", maxpaths, - MULTIPATH_NUM); + multipath_num); return NB_ERR_VALIDATION; } break; @@ -11165,6 +13861,36 @@ int bgp_global_bmp_config_target_list_afi_safis_afi_safi_ipv6_multicast_common_c return NB_OK; } +static int bgp_neighbor_afi_safi_flag_modify(struct nb_cb_modify_args *args, + uint32_t flags, bool set) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (peer_af_flag_modify_nb(peer, afi, safi, flags, set, args->errmsg, + args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/add-paths/path-type @@ -11263,19 +13989,87 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_options_repla case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int +bgp_peer_afi_safi_default_originate_apply(struct nb_cb_apply_finish_args *args, + struct peer *peer, afi_t afi, + safi_t safi) +{ + bool originate = false; + int ret = 0; + struct route_map *route_map = NULL; + const char *rmap = NULL; + + originate = yang_dnode_get_bool(args->dnode, "./originate"); + + if (yang_dnode_exists(args->dnode, "./route-map")) { + rmap = yang_dnode_get_string(args->dnode, "./route-map"); + route_map = route_map_lookup_by_name(rmap); + if (!route_map) { + snprintf(args->errmsg, args->errmsg_len, + "The route-map '%s' does not exist.", rmap); + return -1; + } + } + + // zlog_debug("%s: originate %u route-map %s", __func__, originate, + // rmap); + if (originate) + ret = peer_default_originate_set(peer, afi, safi, rmap, + route_map); + else + ret = peer_default_originate_unset(peer, afi, safi); + + return bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret); +} + /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +void bgp_neighbor_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return; + + bgp_peer_afi_safi_default_originate_apply(args, peer, afi, safi); +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11292,9 +14086,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_opt /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11309,7 +14103,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_opt return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11324,6 +14118,46 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_opt return NB_OK; } +static int +bgp_neighbor_afi_safi_prefix_limit_list_destroy(struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int direction; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + direction = yang_dnode_get_enum(args->dnode, "./direction"); + + switch (direction) { + case 1: + peer_maximum_prefix_unset(peer, afi, safi); + break; + case 2: + UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); + peer->pmax_out[afi][safi] = 0; + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list @@ -11350,14 +14184,101 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; } +static void +bgp_peer_afi_safi_maximum_prefix_set(struct nb_cb_apply_finish_args *args, + struct peer *peer, afi_t afi, safi_t safi) +{ + int direction; + uint32_t max; + uint8_t threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; + uint16_t restart = 0; + bool warning = false; + bool force; + + max = yang_dnode_get_uint32(args->dnode, "./max-prefixes"); + direction = yang_dnode_get_enum(args->dnode, "./direction"); + switch (direction) { + case 1: + force = yang_dnode_get_bool(args->dnode, "./force-check"); + + if (yang_dnode_exists(args->dnode, + "./options/shutdown-threshold-pct")) + threshold = yang_dnode_get_uint8( + args->dnode, + "./options/shutdown-threshold-pct"); + if (yang_dnode_exists(args->dnode, + "./options/tw-shutdown-threshold-pct")) + threshold = yang_dnode_get_uint8( + args->dnode, + "./options/tw-shutdown-threshold-pct"); + if (yang_dnode_exists(args->dnode, + "./options/tr-shutdown-threshold-pct")) + threshold = yang_dnode_get_uint8( + args->dnode, + "./options/tr-shutdown-threshold-pct"); + + if (yang_dnode_exists(args->dnode, "./options/warning-only")) + warning = yang_dnode_get_bool(args->dnode, + "./options/warning-only"); + if (yang_dnode_exists(args->dnode, "./options/tw-warning-only")) + warning = yang_dnode_get_bool( + args->dnode, "./options/tw-warning-only"); + + if (yang_dnode_exists(args->dnode, "./options/restart-timer")) + restart = yang_dnode_get_uint16( + args->dnode, "./options/restart-timer"); + if (yang_dnode_exists(args->dnode, + "./options/tr-restart-timer")) + restart = yang_dnode_get_uint16( + args->dnode, "./options/tr-restart-timer"); + + peer_maximum_prefix_set(peer, afi, safi, max, threshold, + warning, restart, force); + + break; + case 2: + SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); + peer->pmax_out[afi][safi] = max; + + break; + } +} + +void bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return; + + bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi); +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes @@ -11379,9 +14300,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11396,7 +14317,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11413,9 +14353,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11430,7 +14370,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11447,9 +14387,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11464,7 +14404,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11481,9 +14421,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11498,7 +14438,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11515,9 +14455,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11532,7 +14472,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11549,9 +14489,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11566,7 +14506,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11583,9 +14523,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -11600,7 +14540,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -11626,8 +14566,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next_hop case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11645,8 +14589,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next_hop case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11664,8 +14612,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11683,8 +14635,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11702,8 +14658,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11721,14 +14681,79 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int bgp_neighbor_afi_safi_weight_modify(struct nb_cb_modify_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + uint16_t weight; + afi_t afi; + safi_t safi; + int ret; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + weight = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_weight_set(peer, afi, safi, weight); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + +static int bgp_neighbor_afi_safi_weight_destroy(struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int ret; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address"); + peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + ret = peer_weight_unset(peer, afi, safi); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/weight/weight-attribute @@ -11740,8 +14765,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_weight_weight_attribu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -11755,8 +14782,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_weight_weight_attribu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -11774,8 +14803,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_route_reflector_route case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11793,8 +14826,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_route_server_route_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11812,8 +14849,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_send_community_send_c case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11831,8 +14872,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_send_community_send_e case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11850,8 +14895,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_send_community_send_l case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11869,8 +14918,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_soft_reconfiguration_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11888,8 +14941,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_as_pat case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11907,8 +14964,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -11926,8 +14987,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_med_un case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -12310,9 +15375,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_as_path /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12327,7 +15392,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupre return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12344,9 +15409,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupre /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12361,7 +15426,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupre return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12493,6 +15558,63 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_options_repla case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -12512,8 +15634,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as_pat case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -12531,8 +15657,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -12550,8 +15680,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_med_un case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -12686,9 +15820,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -12715,9 +15849,28 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12732,7 +15885,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12749,9 +15902,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12766,7 +15919,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12783,9 +15936,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12800,7 +15953,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12817,9 +15970,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12834,7 +15987,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12851,9 +16004,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12868,7 +16021,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12885,9 +16038,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12902,7 +16055,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12919,9 +16072,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -12936,7 +16089,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -12962,8 +16115,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next_hop case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -12981,8 +16138,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next_hop case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13000,8 +16161,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13019,8 +16184,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13038,8 +16207,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13057,8 +16230,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as_remove_pri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13076,8 +16253,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_route_reflector_route case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13095,8 +16276,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_route_server_route_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13114,8 +16299,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_send_community_send_c case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13133,8 +16322,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_send_community_send_e case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13152,8 +16345,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_send_community_send_l case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13171,8 +16368,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_soft_reconfiguration_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13190,8 +16391,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_weight_weight_attribu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -13205,8 +16408,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_weight_weight_attribu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -13311,6 +16516,63 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_options_rep case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -13330,8 +16592,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_as_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13349,8 +16615,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13368,8 +16638,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_med_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13504,9 +16778,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -13533,9 +16807,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13550,7 +16824,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13567,9 +16860,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13584,7 +16877,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13601,9 +16894,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13618,7 +16911,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13635,9 +16928,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13652,7 +16945,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13669,9 +16962,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13686,7 +16979,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13703,9 +16996,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13720,7 +17013,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13737,9 +17030,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -13754,7 +17047,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -13780,8 +17073,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13799,8 +17096,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13818,8 +17119,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13837,8 +17142,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13856,8 +17165,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13875,8 +17188,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13894,8 +17211,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_route_reflector_rou case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13913,8 +17234,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_route_server_route_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13932,8 +17257,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13951,8 +17280,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13970,8 +17303,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -13989,8 +17326,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_soft_reconfiguratio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14008,8 +17349,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_weight_weight_attri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -14023,8 +17366,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_weight_weight_attri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -14129,6 +17474,63 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_options_rep case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -14148,8 +17550,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_as_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14167,8 +17573,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14186,8 +17596,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_med_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14322,9 +17736,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -14351,9 +17765,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14368,7 +17782,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14385,9 +17818,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14402,7 +17835,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14419,9 +17852,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14436,7 +17869,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14453,9 +17886,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14470,7 +17903,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14487,9 +17920,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14504,7 +17937,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14521,9 +17954,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14538,7 +17971,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14555,9 +17988,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -14572,7 +18005,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -14598,8 +18031,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14617,8 +18054,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14636,8 +18077,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14655,8 +18100,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14674,8 +18123,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14693,8 +18146,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_private_as_remove_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14712,8 +18169,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_route_reflector_rou case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14731,8 +18192,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_route_server_route_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14750,8 +18215,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14769,8 +18238,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14788,8 +18261,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_send_community_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14807,8 +18284,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_soft_reconfiguratio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14826,8 +18307,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_weight_weight_attri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -14841,8 +18324,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_weight_weight_attri case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -14947,6 +18432,63 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_optio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -14966,8 +18508,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -14985,8 +18531,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15004,8 +18554,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15140,9 +18694,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -15169,9 +18723,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15186,7 +18740,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15203,9 +18776,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15220,7 +18793,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15237,9 +18810,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15254,7 +18827,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15271,9 +18844,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15288,7 +18861,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15305,9 +18878,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15322,7 +18895,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15339,9 +18912,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15356,7 +18929,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15373,9 +18946,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -15390,7 +18963,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -15416,8 +18989,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_self_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15435,8 +19012,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_self_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15454,8 +19035,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15473,8 +19058,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15492,8 +19081,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15511,8 +19104,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15530,8 +19127,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_route_reflect case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15549,8 +19150,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_route_server_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15568,8 +19173,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15587,8 +19196,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15606,8 +19219,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15625,8 +19242,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_soft_reconfig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15644,8 +19265,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_weight_weight case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -15659,8 +19282,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_weight_weight case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -15765,6 +19390,63 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_optio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -15784,8 +19466,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15803,8 +19489,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15822,8 +19512,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unchange case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -15958,9 +19652,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -15987,9 +19681,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16004,7 +19698,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16021,9 +19734,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16038,7 +19751,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16055,9 +19768,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16072,7 +19785,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16089,9 +19802,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16106,7 +19819,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16123,9 +19836,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16140,7 +19853,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16157,9 +19870,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16174,7 +19887,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16191,9 +19904,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16208,7 +19921,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_ return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16234,8 +19947,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_self_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16253,8 +19970,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_self_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16272,8 +19993,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16291,8 +20016,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16310,8 +20039,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16329,8 +20062,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_private_as_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16348,8 +20085,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_route_reflect case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16367,8 +20108,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_route_server_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16386,8 +20131,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16405,8 +20154,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16424,8 +20177,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_send_communit case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16443,8 +20200,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_soft_reconfig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16462,8 +20223,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_weight_weight case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -16477,8 +20240,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_weight_weight case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -16583,8 +20348,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_as_path_options case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16602,8 +20371,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16621,8 +20394,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16640,8 +20417,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16674,9 +20455,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -16703,9 +20484,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16720,7 +20501,26 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16737,9 +20537,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16754,7 +20554,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16771,9 +20571,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16788,7 +20588,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16805,9 +20605,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16822,7 +20622,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16839,9 +20639,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16856,7 +20656,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16873,9 +20673,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16890,7 +20690,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16907,9 +20707,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -16924,7 +20724,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -16950,8 +20750,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16969,8 +20773,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -16988,8 +20796,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17007,8 +20819,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17026,8 +20842,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17045,8 +20865,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17064,8 +20888,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_route_reflector case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17083,8 +20911,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_route_server_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17102,8 +20934,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17121,8 +20957,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17140,8 +20980,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17159,8 +21003,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_soft_reconfigur case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17178,8 +21026,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -17193,8 +21043,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -17299,8 +21151,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_as_path_options case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17318,8 +21174,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17337,8 +21197,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17356,8 +21220,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17390,9 +21258,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -17419,9 +21287,28 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17436,7 +21323,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17453,9 +21340,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17470,7 +21357,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17487,9 +21374,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17504,7 +21391,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17521,9 +21408,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17538,7 +21425,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17555,9 +21442,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17572,7 +21459,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17589,9 +21476,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17606,7 +21493,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17623,9 +21510,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -17640,7 +21527,7 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di return NB_OK; } -int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -17666,8 +21553,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17685,8 +21576,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17704,8 +21599,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17723,8 +21622,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17742,8 +21645,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17761,8 +21668,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17780,8 +21691,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_route_reflector case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17799,8 +21714,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_route_server_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17818,8 +21737,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17837,8 +21760,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17856,8 +21783,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17875,8 +21806,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_soft_reconfigur case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -17894,8 +21829,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_modify(args); + break; } @@ -17909,8 +21846,10 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_weight_destroy(args); + break; } @@ -17996,8 +21935,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_as_path_options_replace case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18015,8 +21958,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_as_path_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18034,8 +21981,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_next_hop case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18053,8 +22004,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_med_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18072,8 +22027,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_nexthop_self_next_hop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18091,8 +22050,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_nexthop_self_next_hop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18110,8 +22073,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_route_reflector_route_r case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18129,8 +22096,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_route_server_route_serv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18148,8 +22119,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l2vpn_evpn_soft_reconfiguration_mo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18167,8 +22142,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_flowspec_route_reflector_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18186,8 +22165,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_flowspec_route_server_route_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18205,8 +22188,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_flowspec_soft_reconfiguration case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18224,8 +22211,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_flowspec_route_reflector_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18243,8 +22234,12 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_flowspec_route_server_route_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18262,14 +22257,49 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_flowspec_soft_reconfiguration case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int +bgp_unnumbered_neighbor_afi_safi_flag_modify(struct nb_cb_modify_args *args, + uint32_t flags, bool set) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + if (peer_af_flag_modify_nb(peer, afi, safi, flags, set, args->errmsg, + args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/add-paths/path-type @@ -18368,8 +22398,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_op case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18378,9 +22412,40 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_as_path_op /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate + */ +void bgp_unnumbered_neighbor_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return; + + bgp_peer_afi_safi_default_originate_apply(args, peer, afi, safi); +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/originate */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18397,9 +22462,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_or /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18414,7 +22479,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_or return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18429,6 +22494,46 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_or return NB_OK; } +static int bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int direction; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return NB_ERR_INCONSISTENCY; + + direction = yang_dnode_get_enum(args->dnode, "./direction"); + + switch (direction) { + case 1: + peer_maximum_prefix_unset(peer, afi, safi); + break; + case 2: + UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); + peer->pmax_out[afi][safi] = 0; + break; + } + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list @@ -18455,14 +22560,42 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; } +void bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + if (!peer) + return; + + bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi); +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes @@ -18484,9 +22617,28 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18501,7 +22653,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18518,9 +22670,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18535,7 +22687,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18552,9 +22704,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18569,7 +22721,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18586,9 +22738,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18603,7 +22755,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18620,9 +22772,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18637,7 +22789,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18654,9 +22806,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18671,7 +22823,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18688,9 +22840,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -18705,7 +22857,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -18731,8 +22883,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18750,8 +22906,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_nexthop_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18769,8 +22929,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18788,8 +22952,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18807,8 +22975,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18826,14 +22998,80 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int +bgp_unnumbered_neighbor_afi_safi_weight_modify(struct nb_cb_modify_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const char *af_name; + uint16_t weight; + afi_t afi; + safi_t safi; + const struct lyd_node *nbr_af_dnode; + int ret; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + + weight = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_weight_set(peer, afi, safi, weight); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + +static int +bgp_unnumbered_neighbor_afi_safi_weight_destroy(struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int ret; + + bgp = nb_running_get_entry(args->dnode, NULL, true); + nbr_dnode = yang_dnode_get_parent(args->dnode, "unnumbered-neighbor"); + peer_str = yang_dnode_get_string(nbr_dnode, "./interface"); + peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg, + args->errmsg_len); + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + ret = peer_weight_unset(peer, afi, safi); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/weight/weight-attribute @@ -18845,8 +23083,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_weight_wei case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -18860,8 +23100,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_weight_wei case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -18879,8 +23121,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_route_refl case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18898,8 +23144,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_route_serv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18917,8 +23167,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18936,8 +23190,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18955,8 +23213,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18974,8 +23236,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_soft_recon case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -18993,8 +23259,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19012,8 +23282,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19031,8 +23305,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19415,9 +23693,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_con /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19432,7 +23710,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_con return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19449,9 +23727,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_con /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19466,7 +23744,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_con return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19598,6 +23876,63 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_as_path_op case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/originate + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -19617,8 +23952,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19636,8 +23975,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19655,8 +23998,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_attr_uncha case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -19791,9 +24138,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -19820,9 +24168,28 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19837,7 +24204,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19854,9 +24221,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19871,7 +24238,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19888,9 +24255,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19905,7 +24272,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19922,9 +24289,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19939,7 +24306,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19956,9 +24323,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -19973,7 +24340,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -19990,9 +24357,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20007,7 +24374,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20024,9 +24391,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20041,7 +24408,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20067,8 +24434,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20086,8 +24457,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_nexthop_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20105,8 +24480,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20124,8 +24503,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20143,8 +24526,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20162,8 +24549,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_private_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20181,8 +24572,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_route_refl case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20200,8 +24595,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_route_serv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20219,8 +24618,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20238,8 +24641,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20257,8 +24664,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_send_commu case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20276,8 +24687,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_soft_recon case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20295,8 +24710,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_weight_wei case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -20310,8 +24727,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_weight_wei case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -20416,6 +24835,63 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_as_path_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/originate + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -20435,8 +24911,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20454,8 +24934,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20473,8 +24957,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20609,9 +25097,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -20638,9 +25127,28 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20655,7 +25163,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20672,9 +25180,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20689,7 +25197,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20706,9 +25214,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20723,7 +25231,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20740,9 +25248,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20757,7 +25265,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20774,9 +25282,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20791,7 +25299,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20808,9 +25316,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20825,7 +25333,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20842,9 +25350,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -20859,7 +25367,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -20885,8 +25393,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20904,8 +25416,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_nexthop_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20923,8 +25439,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20942,8 +25462,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20961,8 +25485,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20980,8 +25508,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -20999,8 +25531,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_route_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21018,8 +25554,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_route_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21037,8 +25577,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21056,8 +25600,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21075,8 +25623,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21094,8 +25646,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_soft_rec case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21113,8 +25669,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_weight_w case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -21128,8 +25686,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_weight_w case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -21234,6 +25794,63 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_as_path_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/originate + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -21253,8 +25870,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21272,8 +25893,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21291,8 +25916,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_attr_unc case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21427,9 +26056,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -21456,9 +26086,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21473,7 +26103,26 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21490,9 +26139,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21507,7 +26156,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21524,9 +26173,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21541,7 +26190,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21558,9 +26207,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21575,7 +26224,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21592,9 +26241,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21609,7 +26258,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21626,9 +26275,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21643,7 +26292,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21660,9 +26309,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -21677,7 +26326,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -21703,8 +26352,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21722,8 +26375,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_nexthop_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21741,8 +26398,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21760,8 +26421,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21779,8 +26444,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21798,8 +26467,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_private_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21817,8 +26490,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_route_re case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21836,8 +26513,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_route_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21855,8 +26536,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21874,8 +26559,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21893,8 +26582,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_send_com case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21912,8 +26605,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_soft_rec case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -21931,8 +26628,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_weight_w case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -21946,8 +26645,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_weight_w case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -22052,6 +26753,63 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -22071,8 +26829,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22090,8 +26852,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22109,8 +26875,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22245,9 +27015,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -22274,9 +27045,28 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22291,7 +27081,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22308,9 +27098,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22325,7 +27115,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22342,9 +27132,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22359,7 +27149,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22376,9 +27166,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22393,7 +27183,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22410,9 +27200,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22427,7 +27217,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22444,9 +27234,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22461,7 +27251,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22478,9 +27268,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -22495,7 +27285,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -22521,8 +27311,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22540,8 +27334,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22559,8 +27357,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22578,8 +27380,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22597,8 +27403,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22616,8 +27426,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22635,8 +27449,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22654,8 +27472,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22673,8 +27495,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22692,8 +27518,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22711,8 +27541,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22730,8 +27564,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_so case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22749,8 +27587,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -22764,8 +27604,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -22870,6 +27712,63 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -22889,8 +27788,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22908,8 +27811,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -22927,8 +27834,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_at case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23063,9 +27974,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -23092,9 +28004,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23109,7 +28021,26 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23126,9 +28057,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23143,7 +28074,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23160,9 +28091,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23177,7 +28108,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23194,9 +28125,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23211,7 +28142,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23228,9 +28159,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23245,7 +28176,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23262,9 +28193,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23279,7 +28210,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23296,9 +28227,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23313,7 +28244,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23339,8 +28270,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23358,8 +28293,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23377,8 +28316,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23396,8 +28339,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23415,8 +28362,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23434,8 +28385,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23453,8 +28408,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23472,8 +28431,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23491,8 +28454,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23510,8 +28477,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23529,8 +28500,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23548,8 +28523,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_so case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23567,8 +28546,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -23582,8 +28563,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -23688,8 +28671,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_as_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23707,8 +28694,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23726,8 +28717,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23745,8 +28740,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -23779,9 +28778,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -23808,9 +28808,28 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23825,7 +28844,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23842,9 +28861,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23859,7 +28878,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23876,9 +28895,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23893,7 +28912,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23910,9 +28929,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23927,7 +28946,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23944,9 +28963,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23961,7 +28980,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -23978,9 +28997,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -23995,7 +29014,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24012,9 +29031,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24029,7 +29048,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24055,8 +29074,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24074,8 +29097,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24093,8 +29120,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24112,8 +29143,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24131,8 +29166,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24150,8 +29189,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24169,8 +29212,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24188,8 +29235,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24207,8 +29258,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24226,8 +29281,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24245,8 +29304,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24264,8 +29327,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_soft case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24283,8 +29350,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -24298,8 +29367,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -24404,8 +29475,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_as_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24423,8 +29498,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24442,8 +29521,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24461,8 +29544,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24495,9 +29582,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy( + args); } return NB_OK; @@ -24524,9 +29612,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24541,7 +29629,26 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24558,9 +29665,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24575,7 +29682,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24592,9 +29699,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24609,7 +29716,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24626,9 +29733,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24643,7 +29750,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24660,9 +29767,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24677,7 +29784,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24694,9 +29801,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24711,7 +29818,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24728,9 +29835,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -24745,7 +29852,7 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref return NB_OK; } -int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -24771,8 +29878,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24790,8 +29901,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24809,8 +29924,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24828,8 +29947,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24847,8 +29970,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24866,8 +29993,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_priv case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24885,8 +30016,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24904,8 +30039,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24923,8 +30062,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24942,8 +30085,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24961,8 +30108,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_send case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24980,8 +30131,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_soft case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -24999,8 +30154,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_modify(args); + break; } @@ -25014,8 +30171,10 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_weight_destroy(args); + break; } @@ -25101,8 +30260,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_as_path_opti case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25120,8 +30283,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchang case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25139,8 +30306,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchang case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25158,8 +30329,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_attr_unchang case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25177,8 +30352,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_nexthop_self case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25196,8 +30375,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_nexthop_self case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25215,8 +30398,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_route_reflec case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25234,8 +30421,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_route_server case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25253,8 +30444,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l2vpn_evpn_soft_reconfi case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25272,8 +30467,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_flowspec_route_ref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25291,8 +30490,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_flowspec_route_ser case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25310,8 +30513,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_flowspec_soft_reco case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25329,8 +30536,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_flowspec_route_ref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25348,8 +30559,12 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_flowspec_route_ser case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25367,14 +30582,46 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_flowspec_soft_reco case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_unnumbered_neighbor_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int bgp_peer_group_afi_safi_flag_modify(struct nb_cb_modify_args *args, + uint32_t flags, bool set) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + if (peer_af_flag_modify_nb(peer, afi, safi, flags, set, args->errmsg, + args->errmsg_len) + < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/add-paths/path-type @@ -25473,8 +30720,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_as_path_options_r case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25483,9 +30734,39 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_as_path_options_r /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate-options/send-default-route + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/default-originate + */ +void bgp_peer_group_afi_safi_default_originate_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return; + + bgp_peer_afi_safi_default_originate_apply(args, peer, afi, safi); +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate/originate */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_send_default_route_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_originate_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25502,9 +30783,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate-options/rmap-policy-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/default-originate/route-map */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25519,7 +30800,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_options_rmap_policy_export_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate_route_map_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25534,6 +30815,44 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate return NB_OK; } +static int bgp_peer_group_afi_safi_prefix_limit_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int direction; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return NB_ERR_INCONSISTENCY; + + direction = yang_dnode_get_enum(args->dnode, "./direction"); + + switch (direction) { + case 1: + peer_maximum_prefix_unset(peer, afi, safi); + break; + case 2: + UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); + peer->pmax_out[afi][safi] = 0; + break; + } + + return NB_OK; +} /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list @@ -25560,14 +30879,39 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; } +void bgp_peer_group_afi_safi_prefix_limit_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + if (!peer) + return; + + bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi); +} /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes @@ -25589,9 +30933,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/force-check */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25606,7 +30950,26 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25623,9 +30986,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25640,7 +31003,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25657,9 +31020,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25674,7 +31037,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25691,9 +31054,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25708,7 +31071,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25725,9 +31088,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25742,7 +31105,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25759,9 +31122,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25776,7 +31139,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25793,9 +31156,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -25810,7 +31173,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -25836,8 +31199,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25855,8 +31222,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_nexthop_self_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25874,8 +31245,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25893,8 +31268,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25912,8 +31291,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -25931,14 +31314,77 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } return NB_OK; } +static int bgp_peer_group_afi_safi_weight_modify(struct nb_cb_modify_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + uint16_t weight; + afi_t afi; + safi_t safi; + int ret; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + + nbr_dnode = yang_dnode_get_parent(args->dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + weight = yang_dnode_get_uint16(args->dnode, NULL); + + ret = peer_weight_set(peer, afi, safi, weight); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + +static int +bgp_peer_group_afi_safi_weight_destroy(struct nb_cb_destroy_args *args) +{ + struct bgp *bgp; + const char *peer_str; + struct peer *peer; + const struct lyd_node *nbr_dnode; + const struct lyd_node *nbr_af_dnode; + const char *af_name; + afi_t afi; + safi_t safi; + int ret; + + nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi"); + af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name"); + yang_afi_safi_identity2value(af_name, &afi, &safi); + nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group"); + bgp = nb_running_get_entry(nbr_dnode, NULL, true); + peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name"); + peer = bgp_peer_group_peer_lookup(bgp, peer_str); + + ret = peer_weight_unset(peer, afi, safi); + if (bgp_nb_errmsg_return(args->errmsg, args->errmsg_len, ret) < 0) + return NB_ERR_INCONSISTENCY; + + return NB_OK; +} + /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/weight/weight-attribute @@ -25950,8 +31396,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_weight_weight_att case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -25965,8 +31413,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_weight_weight_att case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -25984,8 +31434,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_route_reflector_r case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26003,8 +31457,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_route_server_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26022,8 +31480,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26041,8 +31503,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26060,8 +31526,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26079,8 +31549,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_soft_reconfigurat case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26098,8 +31572,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26117,8 +31595,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26136,8 +31618,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_attr_unchanged_me case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26520,9 +32006,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_as_ /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-import + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-import */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -26537,7 +32023,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_uns return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_import_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_import_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -26554,9 +32040,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_uns /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsupress-map-export + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/filter-config/unsuppress-map-export */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -26571,7 +32057,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_uns return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsupress_map_export_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_filter_config_unsuppress_map_export_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -26703,6 +32189,63 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_as_path_options_r case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/default-originate/originate + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/default-originate/route-map + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -26722,8 +32265,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_as case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26741,8 +32288,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26760,8 +32311,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_attr_unchanged_me case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -26896,9 +32451,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -26925,9 +32480,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/force-check */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -26942,7 +32497,26 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -26959,9 +32533,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -26976,7 +32550,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -26993,9 +32567,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27010,7 +32584,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27027,9 +32601,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27044,7 +32618,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27061,9 +32635,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27078,7 +32652,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27095,9 +32669,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27112,7 +32686,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27129,9 +32703,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27146,7 +32720,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27172,8 +32746,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27191,8 +32769,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_nexthop_self_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27210,8 +32792,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27229,8 +32815,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27248,8 +32838,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27267,8 +32861,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_private_as_remove case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27286,8 +32884,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_route_reflector_r case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27305,8 +32907,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_route_server_rout case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27324,8 +32930,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27343,8 +32953,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27362,8 +32976,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_send_community_se case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27381,8 +32999,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_soft_reconfigurat case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27400,8 +33022,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_weight_weight_att case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -27415,8 +33039,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_weight_weight_att case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -27521,6 +33147,63 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_as_path_options case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/default-originate/originate + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/default-originate/route-map + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -27540,8 +33223,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27559,8 +33246,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27578,8 +33269,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -27714,9 +33409,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -27743,9 +33438,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/force-check */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27760,7 +33455,26 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27777,9 +33491,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27794,7 +33508,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27811,9 +33525,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27828,7 +33542,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27845,9 +33559,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27862,7 +33576,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27879,9 +33593,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27896,7 +33610,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27913,9 +33627,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27930,7 +33644,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27947,9 +33661,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -27964,7 +33678,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -27990,8 +33704,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28009,8 +33727,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28028,8 +33750,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28047,8 +33773,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28066,8 +33796,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28085,8 +33819,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28104,8 +33842,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_route_reflector case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28123,8 +33865,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_route_server_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28142,8 +33888,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28161,8 +33911,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28180,8 +33934,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28199,8 +33957,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_soft_reconfigur case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28218,8 +33980,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -28233,8 +33997,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -28339,6 +34105,63 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_as_path_options case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/default-originate/originate + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/default-originate/route-map + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -28358,8 +34181,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28377,8 +34204,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28396,8 +34227,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_attr_unchanged_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28532,9 +34367,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -28561,9 +34396,28 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/force-check + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28578,7 +34432,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28595,9 +34449,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28612,7 +34466,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28629,9 +34483,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28646,7 +34500,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28663,9 +34517,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28680,7 +34534,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28697,9 +34551,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28714,7 +34568,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28731,9 +34585,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28748,7 +34602,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28765,9 +34619,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-multicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -28782,7 +34636,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -28808,8 +34662,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28827,8 +34685,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_nexthop_self_ne case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28846,8 +34708,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28865,8 +34731,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28884,8 +34754,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28903,8 +34777,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_private_as_remo case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28922,8 +34800,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_route_reflector case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28941,8 +34823,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_route_server_ro case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28960,8 +34846,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28979,8 +34869,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -28998,8 +34892,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_send_community_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29017,8 +34915,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_soft_reconfigur case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29036,8 +34938,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -29051,8 +34955,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_weight_weight_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -29157,6 +35063,63 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_as_path_o case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/originate + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/default-originate/route-map + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -29176,8 +35139,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29195,8 +35162,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29214,8 +35185,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29350,9 +35325,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -29379,9 +35354,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/force-check */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29396,7 +35371,26 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29413,9 +35407,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29430,7 +35424,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29447,9 +35441,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29464,7 +35458,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29481,9 +35475,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29498,7 +35492,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29515,9 +35509,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29532,7 +35526,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29549,9 +35543,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29566,7 +35560,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29583,9 +35577,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -29600,7 +35594,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -29626,8 +35620,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29645,8 +35643,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_nexthop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29664,8 +35666,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29683,8 +35689,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29702,8 +35712,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29721,8 +35735,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29740,8 +35758,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_route_ref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29759,8 +35781,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_route_ser case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29778,8 +35804,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29797,8 +35827,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29816,8 +35850,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29835,8 +35873,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_soft_reco case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -29854,8 +35896,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_weight_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -29869,8 +35913,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_weight_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -29975,6 +36021,63 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_as_path_o case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; + case NB_EV_APPLY: + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/originate + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_originate_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/default-originate/route-map + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_default_originate_route_map_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: case NB_EV_APPLY: /* TODO: implement me. */ break; @@ -29994,8 +36097,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30013,8 +36120,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30032,8 +36143,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_attr_unch case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30168,9 +36283,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -30197,9 +36312,28 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/force-check + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30214,7 +36348,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30231,9 +36365,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30248,7 +36382,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30265,9 +36399,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30282,7 +36416,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30299,9 +36433,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30316,7 +36450,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30333,9 +36467,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30350,7 +36484,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30367,9 +36501,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30384,7 +36518,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30401,9 +36535,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv6-labeled-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30418,7 +36552,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30444,8 +36578,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30463,8 +36601,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_nexthop_s case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30482,8 +36624,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30501,8 +36647,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30520,8 +36670,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30539,8 +36693,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_private_a case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30558,8 +36716,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_route_ref case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30577,8 +36739,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_route_ser case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30596,8 +36762,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30615,8 +36785,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30634,8 +36808,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_send_comm case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30653,8 +36831,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_soft_reco case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30672,8 +36854,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_weight_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -30687,8 +36871,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_weight_we case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -30793,8 +36979,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_as_path_opt case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30812,8 +37002,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30831,8 +37025,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30850,8 +37048,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -30884,9 +37086,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -30913,9 +37115,28 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/force-check + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_force_check_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30930,7 +37151,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30947,9 +37168,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30964,7 +37185,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -30981,9 +37202,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -30998,7 +37219,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31015,9 +37236,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31032,7 +37253,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31049,9 +37270,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31066,7 +37287,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31083,9 +37304,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31100,7 +37321,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31117,9 +37338,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv4-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31134,7 +37355,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31160,8 +37381,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_sel case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31179,8 +37404,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_nexthop_sel case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31198,8 +37427,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31217,8 +37450,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31236,8 +37473,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31255,8 +37496,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31274,8 +37519,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_route_refle case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31293,8 +37542,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_route_serve case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31312,8 +37565,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31331,8 +37588,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31350,8 +37611,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31369,8 +37634,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_soft_reconf case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31388,8 +37657,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_weight_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -31403,8 +37674,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_weight_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -31509,8 +37782,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_as_path_opt case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31528,8 +37805,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31547,8 +37828,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31566,8 +37851,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_attr_unchan case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31600,9 +37889,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ - break; + return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args); } return NB_OK; @@ -31629,9 +37918,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/force-check */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_force_check_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31646,7 +37935,26 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_warning_only_destroy( +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/warning-only + */ +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31663,9 +37971,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31680,7 +37988,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31697,9 +38005,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31714,7 +38022,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31731,9 +38039,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31748,7 +38056,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31765,9 +38073,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tr-restart-timer + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tr-restart-timer */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31782,7 +38090,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tr_restart_timer_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tr_restart_timer_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31799,9 +38107,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-shutdown-threshold-pct + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-shutdown-threshold-pct */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31816,7 +38124,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_shutdown_threshold_pct_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_shutdown_threshold_pct_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31833,9 +38141,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi /* * XPath: - * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/prefix-limit-options/tw-warning-only + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/l3vpn-ipv6-unicast/prefix-limit/direction-list/options/tw-warning-only */ -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_modify( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_modify( struct nb_cb_modify_args *args) { switch (args->event) { @@ -31850,7 +38158,7 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi return NB_OK; } -int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_prefix_limit_options_tw_warning_only_destroy( +int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_options_tw_warning_only_destroy( struct nb_cb_destroy_args *args) { switch (args->event) { @@ -31876,8 +38184,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_sel case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31895,8 +38207,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_nexthop_sel case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31914,8 +38230,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31933,8 +38253,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31952,8 +38276,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31971,8 +38299,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_private_as_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -31990,8 +38322,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_route_refle case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32009,8 +38345,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_route_serve case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32028,8 +38368,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32047,8 +38391,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_EXT_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32066,8 +38414,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_send_commun case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SEND_LARGE_COMMUNITY, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32085,8 +38437,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_soft_reconf case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32104,8 +38460,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_weight_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_modify(args); + break; } @@ -32119,8 +38477,10 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_weight_weig case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_weight_destroy(args); + break; } @@ -32206,8 +38566,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_as_path_options_rep case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_OVERRIDE, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32225,8 +38589,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_as_p case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_AS_PATH_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32244,8 +38612,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_next case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32263,8 +38635,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_attr_unchanged_med_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_MED_UNCHANGED, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32282,8 +38658,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32301,8 +38681,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_nexthop_self_next_h case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_FORCE_NEXTHOP_SELF, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32320,8 +38704,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_route_reflector_rou case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32339,8 +38727,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_route_server_route_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32358,8 +38750,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l2vpn_evpn_soft_reconfiguratio case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32377,8 +38773,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_flowspec_route_reflector_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32396,8 +38796,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_flowspec_route_server_rou case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32415,8 +38819,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_flowspec_soft_reconfigura case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32434,8 +38842,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_flowspec_route_reflector_ case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_REFLECTOR_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32453,8 +38865,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_flowspec_route_server_rou case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_RSERVER_CLIENT, + yang_dnode_get_bool(args->dnode, NULL)); + break; } @@ -32472,8 +38888,12 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_flowspec_soft_reconfigura case NB_EV_VALIDATE: case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* TODO: implement me. */ + return bgp_peer_group_afi_safi_flag_modify( + args, PEER_FLAG_SOFT_RECONFIG, + yang_dnode_get_bool(args->dnode, NULL)); + break; } diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index cae11ae7bd..fcbdb2969f 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -639,7 +639,9 @@ static int bgp_update_address(struct interface *ifp, const union sockunion *dst, struct listnode *node; int common; - sockunion2hostprefix(dst, &d); + if (!sockunion2hostprefix(dst, &d)) + return 1; + sel = NULL; common = -1; diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 29cca99fd7..1a9f59db64 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -45,7 +45,7 @@ #include "bgpd/bgp_vty.h" #include "bgpd/bgp_rd.h" -DEFINE_MTYPE_STATIC(BGPD, MARTIAN_STRING, "BGP Martian Address Intf String"); +DEFINE_MTYPE_STATIC(BGPD, MARTIAN_STRING, "BGP Martian Addr Intf String"); int bgp_nexthop_cache_compare(const struct bgp_nexthop_cache *a, const struct bgp_nexthop_cache *b) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 64b10c0252..29ab3d9c6c 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -31,6 +31,7 @@ #include "nexthop.h" #include "vrf.h" #include "filter.h" +#include "nexthop_group.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" @@ -72,7 +73,7 @@ static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc) if (LIST_EMPTY(&(bnc->paths)) && !bnc->nht_info) { if (BGP_DEBUG(nht, NHT)) { char buf[PREFIX2STR_BUFFER]; - zlog_debug("bgp_unlink_nexthop: freeing bnc %s(%u)(%s)", + zlog_debug("%s: freeing bnc %s(%u)(%s)", __func__, bnc_str(bnc, buf, PREFIX2STR_BUFFER), bnc->srte_color, bnc->bgp->name_pretty); } @@ -624,7 +625,7 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command) ret = zclient_send_rnh(zclient, command, &bnc->prefix, exact_match, bnc->bgp->vrf_id); /* TBD: handle the failure */ - if (ret < 0) + if (ret == ZCLIENT_SEND_FAILURE) flog_warn(EC_BGP_ZEBRA_SEND, "sendmsg_nexthop: zclient_send_message() failed"); @@ -966,3 +967,83 @@ void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer) 0); } } + +/**************************************************************************** + * L3 NHGs are used for fast failover of nexthops in the dplane. These are + * the APIs for allocating L3 NHG ids. Management of the L3 NHG itself is + * left to the application using it. + * PS: Currently EVPN host routes is the only app using L3 NHG for fast + * failover of remote ES links. + ***************************************************************************/ +static bitfield_t bgp_nh_id_bitmap; +static uint32_t bgp_l3nhg_start; + +/* XXX - currently we do nothing on the callbacks */ +static void bgp_l3nhg_add_cb(const char *name) +{ +} +static void bgp_l3nhg_add_nexthop_cb(const struct nexthop_group_cmd *nhgc, + const struct nexthop *nhop) +{ +} +static void bgp_l3nhg_del_nexthop_cb(const struct nexthop_group_cmd *nhgc, + const struct nexthop *nhop) +{ +} +static void bgp_l3nhg_del_cb(const char *name) +{ +} + +static void bgp_l3nhg_zebra_init(void) +{ + static bool bgp_l3nhg_zebra_inited; + if (bgp_l3nhg_zebra_inited) + return; + + bgp_l3nhg_zebra_inited = true; + bgp_l3nhg_start = zclient_get_nhg_start(ZEBRA_ROUTE_BGP); + nexthop_group_init(bgp_l3nhg_add_cb, bgp_l3nhg_add_nexthop_cb, + bgp_l3nhg_del_nexthop_cb, bgp_l3nhg_del_cb); +} + + +#define min(A, B) ((A) < (B) ? (A) : (B)) +void bgp_l3nhg_init(void) +{ + uint32_t id_max; + + id_max = min(ZEBRA_NHG_PROTO_SPACING - 1, 16 * 1024); + bf_init(bgp_nh_id_bitmap, id_max); + bf_assign_zero_index(bgp_nh_id_bitmap); + + if (BGP_DEBUG(nht, NHT) || BGP_DEBUG(evpn_mh, EVPN_MH_ES)) + zlog_debug("bgp l3_nhg range %u - %u", bgp_l3nhg_start + 1, + bgp_l3nhg_start + id_max); +} + +void bgp_l3nhg_finish(void) +{ + bf_free(bgp_nh_id_bitmap); +} + +uint32_t bgp_l3nhg_id_alloc(void) +{ + uint32_t nhg_id = 0; + + bgp_l3nhg_zebra_init(); + bf_assign_index(bgp_nh_id_bitmap, nhg_id); + if (nhg_id) + nhg_id += bgp_l3nhg_start; + + return nhg_id; +} + +void bgp_l3nhg_id_free(uint32_t nhg_id) +{ + if (!nhg_id || (nhg_id <= bgp_l3nhg_start)) + return; + + nhg_id -= bgp_l3nhg_start; + + bf_release_index(bgp_nh_id_bitmap, nhg_id); +} diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h index 4e015e4aae..8451f0689d 100644 --- a/bgpd/bgp_nht.h +++ b/bgpd/bgp_nht.h @@ -90,4 +90,10 @@ extern void bgp_nht_register_nexthops(struct bgp *bgp); extern void bgp_nht_reg_enhe_cap_intfs(struct peer *peer); extern void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer); +/* APIs for setting up and allocating L3 nexthop group ids */ +extern uint32_t bgp_l3nhg_id_alloc(void); +extern void bgp_l3nhg_id_free(uint32_t nhg_id); +extern void bgp_l3nhg_init(void); +void bgp_l3nhg_finish(void); + #endif /* _BGP_NHT_H */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index a23acda0a8..cf7a265b11 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -279,18 +279,17 @@ static void bgp_update_explicit_eors(struct peer *peer) if (bgp_debug_neighbor_events(peer)) zlog_debug("Peer %s: Checking explicit EORs", peer->host); - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - if (peer->afc_nego[afi][safi] - && !CHECK_FLAG(peer->af_sflags[afi][safi], - PEER_STATUS_EOR_RECEIVED)) { - if (bgp_debug_neighbor_events(peer)) - zlog_debug( - " afi %d safi %d didn't receive EOR", - afi, safi); - return; - } + FOREACH_AFI_SAFI (afi, safi) { + if (peer->afc_nego[afi][safi] + && !CHECK_FLAG(peer->af_sflags[afi][safi], + PEER_STATUS_EOR_RECEIVED)) { + if (bgp_debug_neighbor_events(peer)) + zlog_debug( + " afi %d safi %d didn't receive EOR", + afi, safi); + return; } + } peer->update_delay_over = 1; peer->bgp->explicit_eors++; @@ -1394,13 +1393,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) || peer->afc_nego[AFI_IP][SAFI_ENCAP]) { if (peer->nexthop.v4.s_addr == INADDR_ANY) { #if defined(HAVE_CUMULUS) - flog_err( - EC_BGP_SND_FAIL, - "%s: No local IPv4 addr resetting connection, fd %d", - peer->host, peer->fd); - bgp_notify_send(peer, BGP_NOTIFY_CEASE, - BGP_NOTIFY_SUBCODE_UNSPECIFIC); - return BGP_Stop; + zlog_warn("%s: No local IPv4 addr, BGP routing may not work", + peer->host); #endif } } @@ -1411,13 +1405,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) || peer->afc_nego[AFI_IP6][SAFI_ENCAP]) { if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global)) { #if defined(HAVE_CUMULUS) - flog_err( - EC_BGP_SND_FAIL, - "%s: No local IPv6 addr resetting connection, fd %d", - peer->host, peer->fd); - bgp_notify_send(peer, BGP_NOTIFY_CEASE, - BGP_NOTIFY_SUBCODE_UNSPECIFIC); - return BGP_Stop; + zlog_warn("%s: No local IPv6 address, BGP routing may not work", + peer->host); #endif } } diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c index f7dd08443f..a3f1eb8401 100644 --- a/bgpd/bgp_pbr.c +++ b/bgpd/bgp_pbr.c @@ -915,10 +915,10 @@ int bgp_pbr_build_and_validate_entry(const struct prefix *p, api->action_num++; } } - if (path && path->attr && path->attr->ipv6_ecommunity) { + if (path && path->attr && bgp_attr_get_ipv6_ecommunity(path->attr)) { struct ecommunity_val_ipv6 *ipv6_ecom_eval; - ecom = path->attr->ipv6_ecommunity; + ecom = bgp_attr_get_ipv6_ecommunity(path->attr); for (i = 0; i < ecom->size; i++) { ipv6_ecom_eval = (struct ecommunity_val_ipv6 *) (ecom->val + (i * ecom->unit_size)); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 52e90f5c6a..db3eb95353 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -241,6 +241,12 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra) if (e->bgp_orig) bgp_unlock(e->bgp_orig); + if (e->aggr_suppressors) + list_delete(&e->aggr_suppressors); + + if (e->es_info) + bgp_evpn_path_es_info_free(e->es_info); + if ((*extra)->bgp_fs_iprule) list_delete(&((*extra)->bgp_fs_iprule)); if ((*extra)->bgp_fs_pbr) @@ -371,14 +377,12 @@ static int bgp_dest_set_defer_flag(struct bgp_dest *dest, bool delete) */ if (set_flag && table) { if (bgp && (bgp->gr_info[afi][safi].t_select_deferral)) { + if (!CHECK_FLAG(dest->flags, BGP_NODE_SELECT_DEFER)) + bgp->gr_info[afi][safi].gr_deferred++; SET_FLAG(dest->flags, BGP_NODE_SELECT_DEFER); - if (dest->rt_node == NULL) - dest->rt_node = listnode_add( - bgp->gr_info[afi][safi].route_list, - dest); if (BGP_DEBUG(update, UPDATE_OUT)) - zlog_debug("DEFER route %pBD, dest %p, node %p", - dest, dest, dest->rt_node); + zlog_debug("DEFER route %pBD, dest %p", dest, + dest); return 0; } } @@ -562,6 +566,7 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, bool same_esi; bool old_proxy; bool new_proxy; + bool new_origin, exist_origin; *paths_eq = 0; @@ -806,8 +811,12 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, * - BGP_ROUTE_AGGREGATE * - BGP_ROUTE_REDISTRIBUTE */ - if (!(new->sub_type == BGP_ROUTE_NORMAL || - new->sub_type == BGP_ROUTE_IMPORTED)) { + new_origin = !(new->sub_type == BGP_ROUTE_NORMAL || + new->sub_type == BGP_ROUTE_IMPORTED); + exist_origin = !(exist->sub_type == BGP_ROUTE_NORMAL || + exist->sub_type == BGP_ROUTE_IMPORTED); + + if (new_origin && !exist_origin) { *reason = bgp_path_selection_local_route; if (debug) zlog_debug( @@ -816,8 +825,7 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, return 1; } - if (!(exist->sub_type == BGP_ROUTE_NORMAL || - exist->sub_type == BGP_ROUTE_IMPORTED)) { + if (!new_origin && exist_origin) { *reason = bgp_path_selection_local_route; if (debug) zlog_debug( @@ -1437,14 +1445,15 @@ static bool bgp_community_filter(struct peer *peer, struct attr *attr) static bool bgp_cluster_filter(struct peer *peer, struct attr *attr) { struct in_addr cluster_id; + struct cluster_list *cluster = bgp_attr_get_cluster(attr); - if (attr->cluster) { + if (cluster) { if (peer->bgp->config & BGP_CONFIG_CLUSTER_ID) cluster_id = peer->bgp->cluster_id; else cluster_id = peer->bgp->router_id; - if (cluster_loop_check(attr->cluster, cluster_id)) + if (cluster_loop_check(cluster, cluster_id)) return true; } return false; @@ -1498,7 +1507,7 @@ static int bgp_input_modifier(struct peer *peer, const struct prefix *p, SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN); /* Apply BGP route map to the attribute. */ - ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path); + ret = route_map_apply(rmap, p, &rmap_path); peer->rmap_type = 0; @@ -1549,7 +1558,7 @@ static int bgp_output_modifier(struct peer *peer, const struct prefix *p, SET_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT); /* Apply BGP route map to the attribute. */ - ret = route_map_apply(rmap, p, RMAP_BGP, &rmap_path); + ret = route_map_apply(rmap, p, &rmap_path); peer->rmap_type = rmap_type; @@ -1687,7 +1696,7 @@ void bgp_notify_conditional_adv_scanner(struct update_subgroup *subgrp) } -static void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr) +void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr) { if (family == AF_INET) { attr->nexthop.s_addr = INADDR_ANY; @@ -1830,8 +1839,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, /* If community is not disabled check the no-export and local. */ if (!transparent && bgp_community_filter(peer, piattr)) { if (bgp_debug_update(NULL, p, subgrp->update_group, 0)) - zlog_debug( - "subgrpannouncecheck: community filter check fail"); + zlog_debug("%s: community filter check fail", __func__); return false; } @@ -2045,10 +2053,10 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi, if (bgp_path_suppressed(pi)) ret = route_map_apply(UNSUPPRESS_MAP(filter), p, - RMAP_BGP, &rmap_path); + &rmap_path); else ret = route_map_apply(ROUTE_MAP_OUT(filter), p, - RMAP_BGP, &rmap_path); + &rmap_path); peer->rmap_type = 0; @@ -2495,10 +2503,13 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp, struct attr attr; afi_t afi; safi_t safi; + struct bgp *bgp; + bool advertise; p = bgp_dest_get_prefix(dest); afi = SUBGRP_AFI(subgrp); safi = SUBGRP_SAFI(subgrp); + bgp = SUBGRP_INST(subgrp); onlypeer = ((SUBGRP_PCOUNT(subgrp) == 1) ? (SUBGRP_PFIRST(subgrp))->peer : NULL); @@ -2513,13 +2524,23 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp, memset(&attr, 0, sizeof(struct attr)); /* It's initialized in bgp_announce_check() */ - /* Announcement to the subgroup. If the route is filtered withdraw it. + /* Announcement to the subgroup. If the route is filtered withdraw it. + * If BGP_NODE_FIB_INSTALL_PENDING is set and data plane install status + * is pending (BGP_NODE_FIB_INSTALL_PENDING), do not advertise the + * route */ + advertise = bgp_check_advertise(bgp, dest); + if (selected) { if (subgroup_announce_check(dest, selected, subgrp, p, &attr, - false)) - bgp_adj_out_set_subgroup(dest, subgrp, &attr, selected); - else + false)) { + /* Route is selected, if the route is already installed + * in FIB, then it is advertised + */ + if (advertise) + bgp_adj_out_set_subgroup(dest, subgrp, &attr, + selected); + } else bgp_adj_out_unset_subgroup(dest, subgrp, 1, addpath_tx_id); } @@ -2618,7 +2639,7 @@ static void bgp_process_evpn_route_injection(struct bgp *bgp, afi_t afi, RESET_FLAG(dummy_attr.rmap_change_flags); ret = route_map_apply(bgp->adv_cmd_rmap[afi][safi].map, - p, RMAP_BGP, &rmap_path); + p, &rmap_path); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&dummy_attr); @@ -2700,7 +2721,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest, */ if (CHECK_FLAG(dest->flags, BGP_NODE_SELECT_DEFER)) { if (BGP_DEBUG(update, UPDATE_OUT)) - zlog_debug("SELECT_DEFER falg set for route %p", dest); + zlog_debug("SELECT_DEFER flag set for route %p", dest); return; } @@ -2916,37 +2937,40 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi) struct bgp_dest *dest; int cnt = 0; struct afi_safi_info *thread_info; - struct listnode *node = NULL, *nnode = NULL; - if (bgp->gr_info[afi][safi].t_route_select) + if (bgp->gr_info[afi][safi].t_route_select) { + struct thread *t = bgp->gr_info[afi][safi].t_route_select; + + thread_info = THREAD_ARG(t); + XFREE(MTYPE_TMP, thread_info); BGP_TIMER_OFF(bgp->gr_info[afi][safi].t_route_select); + } if (BGP_DEBUG(update, UPDATE_OUT)) { zlog_debug("%s: processing route for %s : cnt %d", __func__, get_afi_safi_str(afi, safi, false), - listcount(bgp->gr_info[afi][safi].route_list)); + bgp->gr_info[afi][safi].gr_deferred); } /* Process the route list */ - node = listhead(bgp->gr_info[afi][safi].route_list); - while (node) { - dest = listgetdata(node); - nnode = node->next; - list_delete_node(bgp->gr_info[afi][safi].route_list, node); - dest->rt_node = NULL; - - if (CHECK_FLAG(dest->flags, BGP_NODE_SELECT_DEFER)) { - UNSET_FLAG(dest->flags, BGP_NODE_SELECT_DEFER); - bgp_process_main_one(bgp, dest, afi, safi); - cnt++; - if (cnt >= BGP_MAX_BEST_ROUTE_SELECT) - break; + for (dest = bgp_table_top(bgp->rib[afi][safi]); + dest && bgp->gr_info[afi][safi].gr_deferred != 0; + dest = bgp_route_next(dest)) { + if (!CHECK_FLAG(dest->flags, BGP_NODE_SELECT_DEFER)) + continue; + + UNSET_FLAG(dest->flags, BGP_NODE_SELECT_DEFER); + bgp->gr_info[afi][safi].gr_deferred--; + bgp_process_main_one(bgp, dest, afi, safi); + cnt++; + if (cnt >= BGP_MAX_BEST_ROUTE_SELECT) { + bgp_dest_unlock_node(dest); + break; } - node = nnode; } /* Send EOR message when all routes are processed */ - if (list_isempty(bgp->gr_info[afi][safi].route_list)) { + if (!bgp->gr_info[afi][safi].gr_deferred) { bgp_send_delayed_eor(bgp); /* Send route processing complete message to RIB */ bgp_zebra_update(afi, safi, bgp->vrf_id, @@ -3283,13 +3307,7 @@ void bgp_rib_remove(struct bgp_dest *dest, struct bgp_path_info *pi, if (CHECK_FLAG(dest->flags, BGP_NODE_SELECT_DEFER)) { UNSET_FLAG(dest->flags, BGP_NODE_SELECT_DEFER); bgp = pi->peer->bgp; - if ((dest->rt_node) - && (bgp->gr_info[afi][safi].route_list)) { - list_delete_node(bgp->gr_info[afi][safi] - .route_list, - dest->rt_node); - dest->rt_node = NULL; - } + bgp->gr_info[afi][safi].gr_deferred--; } } } @@ -3371,17 +3389,22 @@ static void overlay_index_update(struct attr *attr, if (!attr) return; if (gw_ip == NULL) { - memset(&(attr->evpn_overlay.gw_ip), 0, sizeof(union gw_addr)); + struct bgp_route_evpn eo; + + memset(&eo, 0, sizeof(eo)); + bgp_attr_set_evpn_overlay(attr, &eo); } else { - memcpy(&(attr->evpn_overlay.gw_ip), gw_ip, - sizeof(union gw_addr)); + struct bgp_route_evpn eo = {.gw_ip = *gw_ip}; + + bgp_attr_set_evpn_overlay(attr, &eo); } } static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path, union gw_addr *gw_ip) { - union gw_addr *path_gw_ip, *path_gw_ip_remote; + const struct bgp_route_evpn *eo = bgp_attr_get_evpn_overlay(path->attr); + union gw_addr path_gw_ip, *path_gw_ip_remote; union { esi_t esi; union gw_addr ip; @@ -3390,7 +3413,7 @@ static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path, if (afi != AFI_L2VPN) return true; - path_gw_ip = &(path->attr->evpn_overlay.gw_ip); + path_gw_ip = eo->gw_ip; if (gw_ip == NULL) { memset(&temp, 0, sizeof(temp)); @@ -3398,7 +3421,7 @@ static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path, } else path_gw_ip_remote = gw_ip; - return !!memcmp(path_gw_ip, path_gw_ip_remote, sizeof(union gw_addr)); + return !!memcmp(&path_gw_ip, path_gw_ip_remote, sizeof(union gw_addr)); } /* Check if received nexthop is valid or not. */ @@ -3526,6 +3549,22 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, else has_valid_label = bgp_is_valid_label(label); + if (has_valid_label) + assert(label != NULL); + + /* The flag BGP_NODE_FIB_INSTALL_PENDING is for the following + * condition : + * Suppress fib is enabled + * BGP_OPT_NO_FIB is not enabled + * Route type is BGP_ROUTE_NORMAL (peer learnt routes) + * Route is being installed first time (BGP_NODE_FIB_INSTALLED not set) + */ + if (BGP_SUPPRESS_FIB_ENABLED(bgp) && + (sub_type == BGP_ROUTE_NORMAL) && + (!bgp_option_check(BGP_OPT_NO_FIB)) && + (!CHECK_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED))) + SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALL_PENDING); + /* When peer's soft reconfiguration enabled. Record input packet in Adj-RIBs-In. */ if (!soft_reconfig @@ -4481,7 +4520,8 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi, if (num_labels) label_pnt = &pi->extra->label[0]; if (pi) - memcpy(&evpn, &pi->attr->evpn_overlay, + memcpy(&evpn, + bgp_attr_get_evpn_overlay(pi->attr), sizeof(evpn)); else memset(&evpn, 0, sizeof(evpn)); @@ -5190,8 +5230,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p, SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK); - ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, - &rmap_path); + ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path); bgp->peer_self->rmap_type = 0; @@ -5510,8 +5549,7 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p, SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_NETWORK); - ret = route_map_apply(bgp_static->rmap.map, p, RMAP_BGP, - &rmap_path); + ret = route_map_apply(bgp_static->rmap.map, p, &rmap_path); bgp->peer_self->rmap_type = 0; @@ -6362,7 +6400,7 @@ static bool aggr_suppress_map_test(struct bgp *bgp, rmap_path.attr = &attr; SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_AGGREGATE); - rmr = route_map_apply(aggregate->suppress_map, p, RMAP_BGP, &rmap_path); + rmr = route_map_apply(aggregate->suppress_map, p, &rmap_path); bgp->peer_self->rmap_type = 0; bgp_attr_flush(&attr); @@ -6790,6 +6828,12 @@ void bgp_aggregate_route(struct bgp *bgp, const struct prefix *p, afi_t afi, if (dest_p->prefixlen <= p->prefixlen) continue; + /* If suppress fib is enabled and route not installed + * in FIB, skip the route + */ + if (!bgp_check_advertise(bgp, dest)) + continue; + match = 0; for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) { @@ -7285,6 +7329,12 @@ void bgp_aggregate_increment(struct bgp *bgp, const struct prefix *p, if (BGP_PATH_HOLDDOWN(pi)) return; + /* If suppress fib is enabled and route not installed + * in FIB, do not update the aggregate route + */ + if (!bgp_check_advertise(bgp, pi->net)) + return; + child = bgp_node_get(table, p); /* Aggregate address configuration check. */ @@ -7808,8 +7858,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_REDISTRIBUTE); - ret = route_map_apply(red->rmap.map, p, RMAP_BGP, - &rmap_path); + ret = route_map_apply(red->rmap.map, p, &rmap_path); bgp->peer_self->rmap_type = 0; @@ -8571,11 +8620,21 @@ void route_vty_out(struct vty *vty, const struct prefix *p, vty_out(vty, "\n"); if (safi == SAFI_EVPN) { + struct bgp_path_es_info *path_es_info = NULL; + + if (path->extra) + path_es_info = path->extra->es_info; + if (bgp_evpn_is_esi_valid(&attr->esi)) { + /* XXX - add these params to the json out */ vty_out(vty, "%*s", 20, " "); - vty_out(vty, "ESI:%s\n", - esi_to_str(&attr->esi, - esi_buf, sizeof(esi_buf))); + vty_out(vty, "ESI:%s", + esi_to_str(&attr->esi, esi_buf, + sizeof(esi_buf))); + if (path_es_info && path_es_info->es) + vty_out(vty, " VNI: %u", + path_es_info->vni); + vty_out(vty, "\n"); } if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES)) { @@ -8927,13 +8986,12 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p, } } - if (is_evpn_prefix_ipaddr_v4((struct prefix_evpn *)p)) { - inet_ntop(AF_INET, &(attr->evpn_overlay.gw_ip.ipv4), buf, - BUFSIZ); - } else if (is_evpn_prefix_ipaddr_v6((struct prefix_evpn *)p)) { - inet_ntop(AF_INET6, &(attr->evpn_overlay.gw_ip.ipv6), buf, - BUFSIZ); - } + const struct bgp_route_evpn *eo = bgp_attr_get_evpn_overlay(attr); + + if (is_evpn_prefix_ipaddr_v4((struct prefix_evpn *)p)) + inet_ntop(AF_INET, &eo->gw_ip.ipv4, buf, BUFSIZ); + else if (is_evpn_prefix_ipaddr_v6((struct prefix_evpn *)p)) + inet_ntop(AF_INET6, &eo->gw_ip.ipv6, buf, BUFSIZ); if (!json_path) vty_out(vty, "/%s", buf); @@ -9253,7 +9311,9 @@ static const char *bgp_path_selection_reason2str( } static void route_vty_out_detail_es_info(struct vty *vty, - struct attr *attr, json_object *json_path) + struct bgp_path_info *pi, + struct attr *attr, + json_object *json_path) { char esi_buf[ESI_STR_LEN]; bool es_local = !!CHECK_FLAG(attr->es_flags, ATTR_ES_IS_LOCAL); @@ -9263,7 +9323,6 @@ static void route_vty_out_detail_es_info(struct vty *vty, ATTR_ES_PEER_ACTIVE); bool peer_proxy = !!CHECK_FLAG(attr->es_flags, ATTR_ES_PEER_PROXY); - esi_to_str(&attr->esi, esi_buf, sizeof(esi_buf)); if (json_path) { json_object *json_es_info = NULL; @@ -9798,7 +9857,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, if (safi == SAFI_EVPN && bgp_evpn_is_esi_valid(&attr->esi)) { - route_vty_out_detail_es_info(vty, attr, json_path); + route_vty_out_detail_es_info(vty, path, attr, json_path); } /* Line 3 display Origin, Med, Locpref, Weight, Tag, valid, @@ -10019,6 +10078,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, } if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) { + struct cluster_list *cluster = + bgp_attr_get_cluster(attr); int i; if (json_paths) { @@ -10026,13 +10087,11 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, json_cluster_list_list = json_object_new_array(); - for (i = 0; i < attr->cluster->length / 4; - i++) { + for (i = 0; i < cluster->length / 4; i++) { json_string = json_object_new_string( - inet_ntop( - AF_INET, - &attr->cluster->list[i], - buf, sizeof(buf))); + inet_ntop(AF_INET, + &cluster->list[i], + buf, sizeof(buf))); json_object_array_add( json_cluster_list_list, json_string); @@ -10044,7 +10103,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, * do. Add this someday if someone asks * for it. * json_object_string_add(json_cluster_list, - * "string", attr->cluster->str); + * "string", cluster->str); */ json_object_object_add(json_cluster_list, "list", @@ -10054,10 +10113,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, } else { vty_out(vty, ", Cluster list: "); - for (i = 0; i < attr->cluster->length / 4; - i++) { + for (i = 0; i < cluster->length / 4; i++) { vty_out(vty, "%pI4 ", - &attr->cluster->list[i]); + &cluster->list[i]); } } } @@ -10184,9 +10242,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, /* Line 10 display PMSI tunnel attribute, if present */ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) { - const char *str = - lookup_msg(bgp_pmsi_tnltype_str, attr->pmsi_tnl_type, - PMSI_TNLTYPE_STR_DEFAULT); + const char *str = lookup_msg(bgp_pmsi_tnltype_str, + bgp_attr_get_pmsi_tnl_type(attr), + PMSI_TNLTYPE_STR_DEFAULT); if (json_paths) { json_pmsi = json_object_new_object(); @@ -10355,8 +10413,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi, path.peer = pi->peer; path.attr = &dummy_attr; - ret = route_map_apply(rmap, dest_p, RMAP_BGP, - &path); + ret = route_map_apply(rmap, dest_p, &path); if (ret == RMAP_DENYMATCH) continue; } @@ -11169,6 +11226,7 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, char *str; int first = 0; uint8_t show_flags = 0; + int ret; if (uj) SET_FLAG(show_flags, BGP_SHOW_OPT_JSON); @@ -11196,10 +11254,13 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, return CMD_WARNING; } - return bgp_show(vty, bgp, afi, safi, + ret = bgp_show(vty, bgp, afi, safi, (exact ? bgp_show_type_lcommunity_exact : bgp_show_type_lcommunity), lcom, show_flags); + + lcommunity_free(&lcom); + return ret; } static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp, @@ -12106,9 +12167,6 @@ static void bgp_table_stats_rn(struct bgp_dest *dest, struct bgp_dest *top, struct bgp_path_info *pi; const struct prefix *rn_p; - if (dest == top) - return; - if (!bgp_dest_has_bgp_path_info_data(dest)) return; @@ -13655,7 +13713,9 @@ uint8_t bgp_distance_apply(const struct prefix *p, struct bgp_path_info *pinfo, return pinfo->attr->distance; /* Check source address. */ - sockunion2hostprefix(&peer->su, &q); + if (!sockunion2hostprefix(&peer->su, &q)) + return 0; + dest = bgp_node_match(bgp_distance_table[afi][safi], &q); if (dest) { bdistance = bgp_dest_get_bgp_distance_info(dest); @@ -13822,7 +13882,8 @@ DEFPY_YANG(bgp_distance_source, NO_STR "Define an administrative distance\n" "Distance value\n" - "IP source prefix\n" + "IPv4 source prefix\n" + "IPv6 source prefix\n" "Access list name\n") { afi_t afi; @@ -13869,16 +13930,16 @@ void cli_show_bgp_global_afi_safi_unicast_admin_distance_route( : ""); } -DEFPY_YANG(bgp_dampening, - bgp_dampening_cmd, - "[no] bgp dampening [(1-45)$halflife [(1-20000)$reuse (1-20000)$suppress (1-255)$max_supress]]", - NO_STR - "BGP Specific commands\n" - "Enable route-flap dampening\n" - "Half-life time for the penalty\n" - "Value to start reusing a route\n" - "Value to start suppressing a route\n" - "Maximum duration to suppress a stable route\n") +DEFPY_YANG( + bgp_dampening, bgp_dampening_cmd, + "[no] bgp dampening [(1-45)$halflife [(1-20000)$reuse (1-20000)$suppress (1-255)$max_suppress]]", + NO_STR + "BGP Specific commands\n" + "Enable route-flap dampening\n" + "Half-life time for the penalty\n" + "Value to start reusing a route\n" + "Value to start suppressing a route\n" + "Maximum duration to suppress a stable route\n") { afi_t afi; safi_t safi; @@ -13897,7 +13958,7 @@ DEFPY_YANG(bgp_dampening, nb_cli_enqueue_change(vty, "./suppress-above", NB_OP_MODIFY, suppress_str); nb_cli_enqueue_change(vty, "./unreach-decay", - NB_OP_MODIFY, max_supress_str); + NB_OP_MODIFY, max_suppress_str); } if (argc == 3) { nb_cli_enqueue_change(vty, "./reach-decay", NB_OP_MODIFY, halflife_str); diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 43744044b4..17ca3f8b38 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -102,6 +102,19 @@ enum bgp_show_adj_route_type { #define BGP_NLRI_PARSE_ERROR_EVPN_TYPE1_SIZE -15 #define BGP_NLRI_PARSE_ERROR -32 +/* MAC-IP/type-2 path_info in the global routing table is linked to the + * destination ES + */ +struct bgp_path_es_info { + /* back pointer to the route */ + struct bgp_path_info *pi; + vni_t vni; + /* destination ES */ + struct bgp_evpn_es *es; + /* memory used for linking the path to the destination ES */ + struct listnode es_listnode; +}; + /* Ancillary information to struct bgp_path_info, * used for uncommonly used data (aggregation, MPLS, etc.) * and lazily allocated to save memory. @@ -188,6 +201,8 @@ struct bgp_path_info_extra { struct list *bgp_fs_pbr; /* presence of FS pbr iprule based entry */ struct list *bgp_fs_iprule; + /* Destination Ethernet Segment links for EVPN MH */ + struct bgp_path_es_info *es_info; }; struct bgp_path_info { @@ -524,6 +539,13 @@ static inline void prep_for_rmap_apply(struct bgp_path_info *dst_pi, } } +static inline bool bgp_check_advertise(struct bgp *bgp, struct bgp_dest *dest) +{ + return (!(BGP_SUPPRESS_FIB_ENABLED(bgp) && + CHECK_FLAG(dest->flags, BGP_NODE_FIB_INSTALL_PENDING) && + (!bgp_option_check(BGP_OPT_NO_FIB)))); +} + /* called before bgp_process() */ DECLARE_HOOK(bgp_process, (struct bgp * bgp, afi_t afi, safi_t safi, struct bgp_dest *bn, @@ -757,5 +779,5 @@ extern int bgp_distance_set(uint8_t distance, const char *ip_str, extern int bgp_distance_unset(uint8_t distance, const char *ip_str, const char *access_list_str, afi_t afi, safi_t safi, char *errmsg, size_t errmsg_len); - +extern void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr); #endif /* _QUAGGA_BGP_ROUTE_H */ diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e4a9c29000..637eaca397 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -244,8 +244,7 @@ struct bgp_match_peer_compiled { received in bgp_path_info->peer. If it is the same, or if the peer structure received is a peer_group containing it, returns RMAP_MATCH. */ static enum route_map_cmd_result_t -route_match_peer(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_peer(void *rule, const struct prefix *prefix, void *object) { struct bgp_match_peer_compiled *pc; union sockunion *su; @@ -255,56 +254,51 @@ route_match_peer(void *rule, const struct prefix *prefix, struct peer *peer; struct listnode *node, *nnode; - if (type == RMAP_BGP) { - pc = rule; - su = &pc->su; - peer = ((struct bgp_path_info *)object)->peer; + pc = rule; + su = &pc->su; + peer = ((struct bgp_path_info *)object)->peer; - if (pc->interface) { - if (!peer->conf_if) - return RMAP_NOMATCH; + if (pc->interface) { + if (!peer->conf_if) + return RMAP_NOMATCH; - if (strcmp(peer->conf_if, pc->interface) == 0) - return RMAP_MATCH; + if (strcmp(peer->conf_if, pc->interface) == 0) + return RMAP_MATCH; - return RMAP_NOMATCH; - } + return RMAP_NOMATCH; + } - /* If su='0.0.0.0' (command 'match peer local'), and it's a - NETWORK, - REDISTRIBUTE, AGGREGATE-ADDRESS or DEFAULT_GENERATED route - => return RMAP_MATCH - */ - if (sockunion_same(su, &su_def)) { - int ret; - if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_NETWORK) - || CHECK_FLAG(peer->rmap_type, - PEER_RMAP_TYPE_REDISTRIBUTE) - || CHECK_FLAG(peer->rmap_type, - PEER_RMAP_TYPE_AGGREGATE) - || CHECK_FLAG(peer->rmap_type, - PEER_RMAP_TYPE_DEFAULT)) - ret = RMAP_MATCH; - else - ret = RMAP_NOMATCH; - return ret; - } + /* If su='0.0.0.0' (command 'match peer local'), and it's a + NETWORK, + REDISTRIBUTE, AGGREGATE-ADDRESS or DEFAULT_GENERATED route + => return RMAP_MATCH + */ + if (sockunion_same(su, &su_def)) { + int ret; + if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_NETWORK) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_REDISTRIBUTE) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_AGGREGATE) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_DEFAULT)) + ret = RMAP_MATCH; + else + ret = RMAP_NOMATCH; + return ret; + } + + if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { + if (sockunion_same(su, &peer->su)) + return RMAP_MATCH; - if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { + return RMAP_NOMATCH; + } else { + group = peer->group; + for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) { if (sockunion_same(su, &peer->su)) return RMAP_MATCH; - - return RMAP_NOMATCH; - } else { - group = peer->group; - for (ALL_LIST_ELEMENTS(group->peer, node, nnode, - peer)) { - if (sockunion_same(su, &peer->su)) - return RMAP_MATCH; - } - return RMAP_NOMATCH; } + return RMAP_NOMATCH; } + return RMAP_NOMATCH; } @@ -345,8 +339,7 @@ static const struct route_map_rule_cmd route_match_peer_cmd = { #if defined(HAVE_LUA) static enum route_map_cmd_result_t -route_match_command(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_command(void *rule, const struct prefix *prefix, void *object) { int status = RMAP_NOMATCH; u_int32_t locpref = 0; @@ -443,12 +436,11 @@ static const struct route_map_rule_cmd route_match_command_cmd = { /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; - if (type == RMAP_BGP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { alist = access_list_lookup(AFI_IP, (char *)rule); if (alist == NULL) return RMAP_NOMATCH; @@ -485,14 +477,13 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_next_hop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; struct bgp_path_info *path; struct prefix_ipv4 p; - if (type == RMAP_BGP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { path = object; p.family = AF_INET; p.prefix = path->attr->nexthop; @@ -534,15 +525,14 @@ static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_route_source(void *rule, const struct prefix *pfx, - route_map_object_t type, void *object) +route_match_ip_route_source(void *rule, const struct prefix *pfx, void *object) { struct access_list *alist; struct bgp_path_info *path; struct peer *peer; struct prefix_ipv4 p; - if (type == RMAP_BGP && pfx->family == AF_INET) { + if (pfx->family == AF_INET) { path = object; peer = path->peer; @@ -624,14 +614,10 @@ route_match_prefix_list_flowspec(afi_t afi, struct prefix_list *plist, static enum route_map_cmd_result_t route_match_address_prefix_list(void *rule, afi_t afi, - const struct prefix *prefix, - route_map_object_t type, void *object) + const struct prefix *prefix, void *object) { struct prefix_list *plist; - if (type != RMAP_BGP) - return RMAP_NOMATCH; - plist = prefix_list_lookup(afi, (char *)rule); if (plist == NULL) return RMAP_NOMATCH; @@ -645,10 +631,9 @@ route_match_address_prefix_list(void *rule, afi_t afi, static enum route_map_cmd_result_t route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { - return route_match_address_prefix_list(rule, AFI_IP, prefix, type, - object); + return route_match_address_prefix_list(rule, AFI_IP, prefix, object); } static void *route_match_ip_address_prefix_list_compile(const char *arg) @@ -673,13 +658,13 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; struct bgp_path_info *path; struct prefix_ipv4 p; - if (type == RMAP_BGP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { path = object; p.family = AF_INET; p.prefix = path->attr->nexthop; @@ -718,11 +703,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct bgp_path_info *path; - if (type == RMAP_BGP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { path = (struct bgp_path_info *)object; if (!path) return RMAP_NOMATCH; @@ -759,16 +744,15 @@ static const struct route_map_rule_cmd /* `match ip route-source prefix-list PREFIX_LIST' */ static enum route_map_cmd_result_t -route_match_ip_route_source_prefix_list(void *rule, - const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_route_source_prefix_list(void *rule, const struct prefix *prefix, + void *object) { struct prefix_list *plist; struct bgp_path_info *path; struct peer *peer; struct prefix_ipv4 p; - if (type == RMAP_BGP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { path = object; peer = path->peer; @@ -812,10 +796,9 @@ static const struct route_map_rule_cmd /* Match function should return 1 if match is success else 0 */ static enum route_map_cmd_result_t -route_match_evpn_default_route(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_match_evpn_default_route(void *rule, const struct prefix *p, void *object) { - if (type == RMAP_BGP && is_evpn_prefix_default(p)) + if (is_evpn_prefix_default(p)) return RMAP_MATCH; return RMAP_NOMATCH; @@ -835,30 +818,24 @@ static const struct route_map_rule_cmd /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_mac_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_mac_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; struct prefix p; - if (type == RMAP_BGP) { - alist = access_list_lookup(AFI_L2VPN, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; - - if (prefix->u.prefix_evpn.route_type != BGP_EVPN_MAC_IP_ROUTE) - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_L2VPN, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - p.family = AF_ETHERNET; - p.prefixlen = ETH_ALEN * 8; - p.u.prefix_eth = prefix->u.prefix_evpn.macip_addr.mac; + if (prefix->u.prefix_evpn.route_type != BGP_EVPN_MAC_IP_ROUTE) + return RMAP_NOMATCH; - return (access_list_apply(alist, &p) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } + p.family = AF_ETHERNET; + p.prefixlen = ETH_ALEN * 8; + p.u.prefix_eth = prefix->u.prefix_evpn.macip_addr.mac; - return RMAP_NOMATCH; + return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `mac address' match statement. `arg' should be @@ -889,43 +866,42 @@ static const struct route_map_rule_cmd route_match_mac_address_cmd = { * ...RMAP_NOOP to ignore this match check. */ static enum route_map_cmd_result_t -route_match_vni(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_vni(void *rule, const struct prefix *prefix, void *object) { vni_t vni = 0; unsigned int label_cnt = 0; struct bgp_path_info *path = NULL; struct prefix_evpn *evp = (struct prefix_evpn *) prefix; - if (type == RMAP_BGP) { - vni = *((vni_t *)rule); - path = (struct bgp_path_info *)object; + vni = *((vni_t *)rule); + path = (struct bgp_path_info *)object; - /* - * This rmap filter is valid for vxlan tunnel type only. - * For any other tunnel type, return noop to ignore - * this check. - */ - if (path->attr->encap_tunneltype != BGP_ENCAP_TYPE_VXLAN) - return RMAP_NOOP; + /* + * This rmap filter is valid for vxlan tunnel type only. + * For any other tunnel type, return noop to ignore + * this check. + */ + if (path->attr->encap_tunneltype != BGP_ENCAP_TYPE_VXLAN) + return RMAP_NOOP; - /* - * Apply filter to type 1, 2, 5 routes only. - * Other route types do not have vni label. - */ - if (evp && (evp->prefix.route_type != BGP_EVPN_AD_ROUTE && - evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE && - evp->prefix.route_type != BGP_EVPN_IP_PREFIX_ROUTE)) - return RMAP_NOOP; + /* + * Apply filter to type 1, 2, 5 routes only. + * Other route types do not have vni label. + */ + if (evp + && (evp->prefix.route_type != BGP_EVPN_AD_ROUTE + && evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE + && evp->prefix.route_type != BGP_EVPN_IP_PREFIX_ROUTE)) + return RMAP_NOOP; - if (path->extra == NULL) - return RMAP_NOMATCH; + if (path->extra == NULL) + return RMAP_NOMATCH; - for ( ; label_cnt < BGP_MAX_LABELS && - label_cnt < path->extra->num_labels; label_cnt++) { - if (vni == label2vni(&path->extra->label[label_cnt])) - return RMAP_MATCH; - } + for (; + label_cnt < BGP_MAX_LABELS && label_cnt < path->extra->num_labels; + label_cnt++) { + if (vni == label2vni(&path->extra->label[label_cnt])) + return RMAP_MATCH; } return RMAP_NOMATCH; @@ -967,17 +943,14 @@ static const struct route_map_rule_cmd route_match_evpn_vni_cmd = { /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_evpn_route_type(void *rule, const struct prefix *pfx, - route_map_object_t type, void *object) +route_match_evpn_route_type(void *rule, const struct prefix *pfx, void *object) { uint8_t route_type = 0; - if (type == RMAP_BGP) { - route_type = *((uint8_t *)rule); + route_type = *((uint8_t *)rule); - if (route_type == pfx->u.prefix_evpn.route_type) - return RMAP_MATCH; - } + if (route_type == pfx->u.prefix_evpn.route_type) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -1017,28 +990,24 @@ static const struct route_map_rule_cmd route_match_evpn_route_type_cmd = { /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_rd(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_rd(void *rule, const struct prefix *prefix, void *object) { struct prefix_rd *prd_rule = NULL; const struct prefix_rd *prd_route = NULL; struct bgp_path_info *path = NULL; - if (type == RMAP_BGP) { - if (prefix->family != AF_EVPN) - return RMAP_NOMATCH; + if (prefix->family != AF_EVPN) + return RMAP_NOMATCH; - prd_rule = (struct prefix_rd *)rule; - path = (struct bgp_path_info *)object; + prd_rule = (struct prefix_rd *)rule; + path = (struct bgp_path_info *)object; - if (path->net == NULL || path->net->pdest == NULL) - return RMAP_NOMATCH; + if (path->net == NULL || path->net->pdest == NULL) + return RMAP_NOMATCH; - prd_route = (struct prefix_rd *)bgp_dest_get_prefix( - path->net->pdest); - if (memcmp(prd_route->val, prd_rule->val, ECOMMUNITY_SIZE) == 0) - return RMAP_MATCH; - } + prd_route = (struct prefix_rd *)bgp_dest_get_prefix(path->net->pdest); + if (memcmp(prd_route->val, prd_rule->val, ECOMMUNITY_SIZE) == 0) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -1077,26 +1046,24 @@ static const struct route_map_rule_cmd route_match_evpn_rd_cmd = { /* Route map commands for VRF route leak with source vrf matching */ static enum route_map_cmd_result_t route_match_vrl_source_vrf(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct bgp_path_info *path; char *vrf_name; - if (type == RMAP_BGP) { - vrf_name = rule; - path = (struct bgp_path_info *)object; + vrf_name = rule; + path = (struct bgp_path_info *)object; - if (strncmp(vrf_name, "n/a", VRF_NAMSIZ) == 0) - return RMAP_NOMATCH; + if (strncmp(vrf_name, "n/a", VRF_NAMSIZ) == 0) + return RMAP_NOMATCH; - if (path->extra == NULL) - return RMAP_NOMATCH; + if (path->extra == NULL) + return RMAP_NOMATCH; - if (strncmp(vrf_name, vrf_id_to_name( - path->extra->bgp_orig->vrf_id), VRF_NAMSIZ) - == 0) - return RMAP_MATCH; - } + if (strncmp(vrf_name, vrf_id_to_name(path->extra->bgp_orig->vrf_id), + VRF_NAMSIZ) + == 0) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -1127,22 +1094,18 @@ static const struct route_map_rule_cmd route_match_vrl_source_vrf_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_local_pref(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_local_pref(void *rule, const struct prefix *prefix, void *object) { uint32_t *local_pref; struct bgp_path_info *path; - if (type == RMAP_BGP) { - local_pref = rule; - path = object; + local_pref = rule; + path = object; - if (path->attr->local_pref == *local_pref) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } - return RMAP_NOMATCH; + if (path->attr->local_pref == *local_pref) + return RMAP_MATCH; + else + return RMAP_NOMATCH; } /* @@ -1188,18 +1151,14 @@ static const struct route_map_rule_cmd route_match_local_pref_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_metric(void *rule, const struct prefix *prefix, void *object) { struct rmap_value *rv; struct bgp_path_info *path; - if (type == RMAP_BGP) { - rv = rule; - path = object; - return route_value_match(rv, path->attr->med); - } - return RMAP_NOMATCH; + rv = rule; + path = object; + return route_value_match(rv, path->attr->med); } /* Route map commands for metric matching. */ @@ -1214,27 +1173,22 @@ static const struct route_map_rule_cmd route_match_metric_cmd = { /* Match function for as-path match. I assume given object is */ static enum route_map_cmd_result_t -route_match_aspath(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_aspath(void *rule, const struct prefix *prefix, void *object) { struct as_list *as_list; struct bgp_path_info *path; - if (type == RMAP_BGP) { - as_list = as_list_lookup((char *)rule); - if (as_list == NULL) - return RMAP_NOMATCH; + as_list = as_list_lookup((char *)rule); + if (as_list == NULL) + return RMAP_NOMATCH; - path = object; + path = object; - /* Perform match. */ - return ((as_list_apply(as_list, path->attr->aspath) - == AS_FILTER_DENY) - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + /* Perform match. */ + return ((as_list_apply(as_list, path->attr->aspath) == AS_FILTER_DENY) + ? RMAP_NOMATCH + : RMAP_MATCH); } /* Compile function for as-path match. */ @@ -1266,32 +1220,28 @@ struct rmap_community { /* Match function for community match. */ static enum route_map_cmd_result_t -route_match_community(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_community(void *rule, const struct prefix *prefix, void *object) { struct community_list *list; struct bgp_path_info *path; struct rmap_community *rcom = rule; - if (type == RMAP_BGP) { - path = object; - rcom = rule; + path = object; + rcom = rule; - list = community_list_lookup(bgp_clist, rcom->name, - rcom->name_hash, - COMMUNITY_LIST_MASTER); - if (!list) - return RMAP_NOMATCH; + list = community_list_lookup(bgp_clist, rcom->name, rcom->name_hash, + COMMUNITY_LIST_MASTER); + if (!list) + return RMAP_NOMATCH; - if (rcom->exact) { - if (community_list_exact_match(path->attr->community, - list)) - return RMAP_MATCH; - } else { - if (community_list_match(path->attr->community, list)) - return RMAP_MATCH; - } + if (rcom->exact) { + if (community_list_exact_match(path->attr->community, list)) + return RMAP_MATCH; + } else { + if (community_list_match(path->attr->community, list)) + return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -1355,34 +1305,27 @@ static const struct route_map_rule_cmd route_match_community_cmd = { /* Match function for lcommunity match. */ static enum route_map_cmd_result_t -route_match_lcommunity(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_lcommunity(void *rule, const struct prefix *prefix, void *object) { struct community_list *list; struct bgp_path_info *path; struct rmap_community *rcom = rule; - if (type == RMAP_BGP) { - path = object; + path = object; - list = community_list_lookup(bgp_clist, rcom->name, - rcom->name_hash, - LARGE_COMMUNITY_LIST_MASTER); - if (!list) - return RMAP_NOMATCH; + list = community_list_lookup(bgp_clist, rcom->name, rcom->name_hash, + LARGE_COMMUNITY_LIST_MASTER); + if (!list) + return RMAP_NOMATCH; - if (rcom->exact) { - if (lcommunity_list_exact_match( - path->attr->lcommunity, - list)) - return RMAP_MATCH; - } else { - if (lcommunity_list_match( - path->attr->lcommunity, - list)) - return RMAP_MATCH; - } + if (rcom->exact) { + if (lcommunity_list_exact_match(path->attr->lcommunity, list)) + return RMAP_MATCH; + } else { + if (lcommunity_list_match(path->attr->lcommunity, list)) + return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -1431,25 +1374,22 @@ static const struct route_map_rule_cmd route_match_lcommunity_cmd = { /* Match function for extcommunity match. */ static enum route_map_cmd_result_t -route_match_ecommunity(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ecommunity(void *rule, const struct prefix *prefix, void *object) { struct community_list *list; struct bgp_path_info *path; struct rmap_community *rcom = rule; - if (type == RMAP_BGP) { - path = object; + path = object; - list = community_list_lookup(bgp_clist, rcom->name, - rcom->name_hash, - EXTCOMMUNITY_LIST_MASTER); - if (!list) - return RMAP_NOMATCH; + list = community_list_lookup(bgp_clist, rcom->name, rcom->name_hash, + EXTCOMMUNITY_LIST_MASTER); + if (!list) + return RMAP_NOMATCH; + + if (ecommunity_list_match(path->attr->ecommunity, list)) + return RMAP_MATCH; - if (ecommunity_list_match(path->attr->ecommunity, list)) - return RMAP_MATCH; - } return RMAP_NOMATCH; } @@ -1487,19 +1427,16 @@ static const struct route_map_rule_cmd route_match_ecommunity_cmd = { /* `match origin' */ static enum route_map_cmd_result_t -route_match_origin(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_origin(void *rule, const struct prefix *prefix, void *object) { uint8_t *origin; struct bgp_path_info *path; - if (type == RMAP_BGP) { - origin = rule; - path = object; + origin = rule; + path = object; - if (path->attr->origin == *origin) - return RMAP_MATCH; - } + if (path->attr->origin == *origin) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -1537,8 +1474,7 @@ static const struct route_map_rule_cmd route_match_origin_cmd = { /* match probability { */ static enum route_map_cmd_result_t -route_match_probability(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_probability(void *rule, const struct prefix *prefix, void *object) { long r = frr_weak_random(); @@ -1594,26 +1530,22 @@ static const struct route_map_rule_cmd route_match_probability_cmd = { /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_interface(void *rule, const struct prefix *prefix, void *object) { struct interface *ifp; struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; + path = object; - if (!path) - return RMAP_NOMATCH; + if (!path) + return RMAP_NOMATCH; - ifp = if_lookup_by_name_all_vrf((char *)rule); + ifp = if_lookup_by_name_all_vrf((char *)rule); - if (ifp == NULL || ifp->ifindex != path->attr->nh_ifindex) - return RMAP_NOMATCH; + if (ifp == NULL || ifp->ifindex != path->attr->nh_ifindex) + return RMAP_NOMATCH; - return RMAP_MATCH; - } - return RMAP_NOMATCH; + return RMAP_MATCH; } /* Route map `interface' match statement. `arg' should be @@ -1643,20 +1575,15 @@ static const struct route_map_rule_cmd route_match_interface_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_tag(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct bgp_path_info *path; - if (type == RMAP_BGP) { - tag = rule; - path = object; - - return ((path->attr->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH); - } + tag = rule; + path = object; - return RMAP_NOMATCH; + return ((path->attr->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH); } @@ -1669,15 +1596,11 @@ static const struct route_map_rule_cmd route_match_tag_cmd = { }; static enum route_map_cmd_result_t -route_set_srte_color(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_srte_color(void *rule, const struct prefix *prefix, void *object) { uint32_t *srte_color = rule; struct bgp_path_info *path; - if (type != RMAP_BGP) - return RMAP_OKAY; - path = object; path->attr->srte_color = *srte_color; @@ -1716,16 +1639,12 @@ struct rmap_ip_nexthop_set { }; static enum route_map_cmd_result_t -route_set_ip_nexthop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_ip_nexthop(void *rule, const struct prefix *prefix, void *object) { struct rmap_ip_nexthop_set *rins = rule; struct bgp_path_info *path; struct peer *peer; - if (type != RMAP_BGP) - return RMAP_OKAY; - if (prefix->family == AF_INET6) return RMAP_OKAY; @@ -1824,26 +1743,22 @@ static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = { /* Set local preference. */ static enum route_map_cmd_result_t -route_set_local_pref(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_local_pref(void *rule, const struct prefix *prefix, void *object) { struct rmap_value *rv; struct bgp_path_info *path; uint32_t locpref = 0; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - rv = rule; - path = object; + /* Fetch routemap's rule information. */ + rv = rule; + path = object; - /* Set local preference value. */ - if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) - locpref = path->attr->local_pref; + /* Set local preference value. */ + if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) + locpref = path->attr->local_pref; - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF); - path->attr->local_pref = - route_value_adjust(rv, locpref, path->peer); - } + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF); + path->attr->local_pref = route_value_adjust(rv, locpref, path->peer); return RMAP_OKAY; } @@ -1860,20 +1775,17 @@ static const struct route_map_rule_cmd route_set_local_pref_cmd = { /* Set weight. */ static enum route_map_cmd_result_t -route_set_weight(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_weight(void *rule, const struct prefix *prefix, void *object) { struct rmap_value *rv; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - rv = rule; - path = object; + /* Fetch routemap's rule information. */ + rv = rule; + path = object; - /* Set weight value. */ - path->attr->weight = route_value_adjust(rv, 0, path->peer); - } + /* Set weight value. */ + path->attr->weight = route_value_adjust(rv, 0, path->peer); return RMAP_OKAY; } @@ -1888,15 +1800,11 @@ static const struct route_map_rule_cmd route_set_weight_cmd = { /* `set distance DISTANCE */ static enum route_map_cmd_result_t -route_set_distance(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_distance(void *rule, const struct prefix *prefix, void *object) { struct bgp_path_info *path = object; struct rmap_value *rv = rule; - if (type != RMAP_BGP) - return RMAP_OKAY; - path->attr->distance = rv->value; return RMAP_OKAY; @@ -1914,24 +1822,22 @@ static const struct route_map_rule_cmd route_set_distance_cmd = { /* Set metric to attribute. */ static enum route_map_cmd_result_t -route_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric(void *rule, const struct prefix *prefix, void *object) { struct rmap_value *rv; struct bgp_path_info *path; uint32_t med = 0; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - rv = rule; - path = object; + /* Fetch routemap's rule information. */ + rv = rule; + path = object; - if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) - med = path->attr->med; + if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) + med = path->attr->med; + + path->attr->med = route_value_adjust(rv, med, path->peer); + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC); - path->attr->med = route_value_adjust(rv, med, path->peer); - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC); - } return RMAP_OKAY; } @@ -1945,21 +1851,20 @@ static const struct route_map_rule_cmd route_set_metric_cmd = { /* `set table (1-4294967295)' */ -static enum route_map_cmd_result_t route_set_table_id(void *rule, - const struct prefix *prefix, - route_map_object_t type, - void *object) +static enum route_map_cmd_result_t +route_set_table_id(void *rule, const struct prefix *prefix, + + void *object) { struct rmap_value *rv; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - rv = rule; - path = object; + /* Fetch routemap's rule information. */ + rv = rule; + path = object; + + path->attr->rmap_table_id = rv->value; - path->attr->rmap_table_id = rv->value; - } return RMAP_OKAY; } @@ -1975,34 +1880,31 @@ static const struct route_map_rule_cmd route_set_table_id_cmd = { /* For AS path prepend mechanism. */ static enum route_map_cmd_result_t -route_set_aspath_prepend(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_aspath_prepend(void *rule, const struct prefix *prefix, void *object) { struct aspath *aspath; struct aspath *new; struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; - - if (path->attr->aspath->refcnt) - new = aspath_dup(path->attr->aspath); - else - new = path->attr->aspath; + path = object; - if ((uintptr_t)rule > 10) { - aspath = rule; - aspath_prepend(aspath, new); - } else { - as_t as = aspath_leftmost(new); - if (!as) - as = path->peer->as; - new = aspath_add_seq_n(new, as, (uintptr_t)rule); - } + if (path->attr->aspath->refcnt) + new = aspath_dup(path->attr->aspath); + else + new = path->attr->aspath; - path->attr->aspath = new; + if ((uintptr_t)rule > 10) { + aspath = rule; + aspath_prepend(aspath, new); + } else { + as_t as = aspath_leftmost(new); + if (!as) + as = path->peer->as; + new = aspath_add_seq_n(new, as, (uintptr_t)rule); } + path->attr->aspath = new; + return RMAP_OKAY; } @@ -2039,22 +1941,19 @@ static const struct route_map_rule_cmd route_set_aspath_prepend_cmd = { * Make a deep copy of existing AS_PATH, but for the first ASn only. */ static enum route_map_cmd_result_t -route_set_aspath_exclude(void *rule, const struct prefix *dummy, - route_map_object_t type, void *object) +route_set_aspath_exclude(void *rule, const struct prefix *dummy, void *object) { struct aspath *new_path, *exclude_path; struct bgp_path_info *path; - if (type == RMAP_BGP) { - exclude_path = rule; - path = object; - if (path->attr->aspath->refcnt) - new_path = aspath_dup(path->attr->aspath); - else - new_path = path->attr->aspath; - path->attr->aspath = - aspath_filter_exclude(new_path, exclude_path); - } + exclude_path = rule; + path = object; + if (path->attr->aspath->refcnt) + new_path = aspath_dup(path->attr->aspath); + else + new_path = path->attr->aspath; + path->attr->aspath = aspath_filter_exclude(new_path, exclude_path); + return RMAP_OKAY; } @@ -2075,8 +1974,7 @@ struct rmap_com_set { /* For community set mechanism. */ static enum route_map_cmd_result_t -route_set_community(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_community(void *rule, const struct prefix *prefix, void *object) { struct rmap_com_set *rcs; struct bgp_path_info *path; @@ -2085,44 +1983,42 @@ route_set_community(void *rule, const struct prefix *prefix, struct community *old; struct community *merge; - if (type == RMAP_BGP) { - rcs = rule; - path = object; - attr = path->attr; - old = attr->community; - - /* "none" case. */ - if (rcs->none) { - attr->flag &= ~(ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)); - attr->community = NULL; - /* See the longer comment down below. */ - if (old && old->refcnt == 0) - community_free(&old); - return RMAP_OKAY; - } + rcs = rule; + path = object; + attr = path->attr; + old = attr->community; + + /* "none" case. */ + if (rcs->none) { + attr->flag &= ~(ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES)); + attr->community = NULL; + /* See the longer comment down below. */ + if (old && old->refcnt == 0) + community_free(&old); + return RMAP_OKAY; + } - /* "additive" case. */ - if (rcs->additive && old) { - merge = community_merge(community_dup(old), rcs->com); + /* "additive" case. */ + if (rcs->additive && old) { + merge = community_merge(community_dup(old), rcs->com); - new = community_uniq_sort(merge); - community_free(&merge); - } else - new = community_dup(rcs->com); + new = community_uniq_sort(merge); + community_free(&merge); + } else + new = community_dup(rcs->com); - /* HACK: if the old community is not intern'd, - * we should free it here, or all reference to it may be - * lost. - * Really need to cleanup attribute caching sometime. - */ - if (old && old->refcnt == 0) - community_free(&old); + /* HACK: if the old community is not intern'd, + * we should free it here, or all reference to it may be + * lost. + * Really need to cleanup attribute caching sometime. + */ + if (old && old->refcnt == 0) + community_free(&old); - /* will be interned by caller if required */ - attr->community = new; + /* will be interned by caller if required */ + attr->community = new; - attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); - } + attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); return RMAP_OKAY; } @@ -2192,8 +2088,7 @@ struct rmap_lcom_set { /* For lcommunity set mechanism. */ static enum route_map_cmd_result_t -route_set_lcommunity(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_lcommunity(void *rule, const struct prefix *prefix, void *object) { struct rmap_lcom_set *rcs; struct bgp_path_info *path; @@ -2202,46 +2097,42 @@ route_set_lcommunity(void *rule, const struct prefix *prefix, struct lcommunity *old; struct lcommunity *merge; - if (type == RMAP_BGP) { - rcs = rule; - path = object; - attr = path->attr; - old = attr->lcommunity; - - /* "none" case. */ - if (rcs->none) { - attr->flag &= - ~(ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)); - attr->lcommunity = NULL; - - /* See the longer comment down below. */ - if (old && old->refcnt == 0) - lcommunity_free(&old); - return RMAP_OKAY; - } - - if (rcs->additive && old) { - merge = lcommunity_merge(lcommunity_dup(old), - rcs->lcom); + rcs = rule; + path = object; + attr = path->attr; + old = attr->lcommunity; - new = lcommunity_uniq_sort(merge); - lcommunity_free(&merge); - } else - new = lcommunity_dup(rcs->lcom); + /* "none" case. */ + if (rcs->none) { + attr->flag &= ~(ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES)); + attr->lcommunity = NULL; - /* HACK: if the old large-community is not intern'd, - * we should free it here, or all reference to it may be - * lost. - * Really need to cleanup attribute caching sometime. - */ + /* See the longer comment down below. */ if (old && old->refcnt == 0) lcommunity_free(&old); + return RMAP_OKAY; + } - /* will be intern()'d or attr_flush()'d by bgp_update_main() */ - attr->lcommunity = new; + if (rcs->additive && old) { + merge = lcommunity_merge(lcommunity_dup(old), rcs->lcom); - attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES); - } + new = lcommunity_uniq_sort(merge); + lcommunity_free(&merge); + } else + new = lcommunity_dup(rcs->lcom); + + /* HACK: if the old large-community is not intern'd, + * we should free it here, or all reference to it may be + * lost. + * Really need to cleanup attribute caching sometime. + */ + if (old && old->refcnt == 0) + lcommunity_free(&old); + + /* will be intern()'d or attr_flush()'d by bgp_update_main() */ + attr->lcommunity = new; + + attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES); return RMAP_OKAY; } @@ -2306,8 +2197,7 @@ static const struct route_map_rule_cmd route_set_lcommunity_cmd = { /* For large community set mechanism. */ static enum route_map_cmd_result_t -route_set_lcommunity_delete(void *rule, const struct prefix *pfx, - route_map_object_t type, void *object) +route_set_lcommunity_delete(void *rule, const struct prefix *pfx, void *object) { struct community_list *list; struct lcommunity *merge; @@ -2316,40 +2206,36 @@ route_set_lcommunity_delete(void *rule, const struct prefix *pfx, struct bgp_path_info *path; struct rmap_community *rcom = rule; - if (type == RMAP_BGP) { - if (!rcom) - return RMAP_OKAY; + if (!rcom) + return RMAP_OKAY; - path = object; - list = community_list_lookup(bgp_clist, rcom->name, - rcom->name_hash, - LARGE_COMMUNITY_LIST_MASTER); - old = path->attr->lcommunity; - - if (list && old) { - merge = lcommunity_list_match_delete( - lcommunity_dup(old), list); - new = lcommunity_uniq_sort(merge); - lcommunity_free(&merge); - - /* HACK: if the old community is not intern'd, - * we should free it here, or all reference to it may be - * lost. - * Really need to cleanup attribute caching sometime. - */ - if (old->refcnt == 0) - lcommunity_free(&old); - - if (new->size == 0) { - path->attr->lcommunity = NULL; - path->attr->flag &= ~ATTR_FLAG_BIT( - BGP_ATTR_LARGE_COMMUNITIES); - lcommunity_free(&new); - } else { - path->attr->lcommunity = new; - path->attr->flag |= ATTR_FLAG_BIT( - BGP_ATTR_LARGE_COMMUNITIES); - } + path = object; + list = community_list_lookup(bgp_clist, rcom->name, rcom->name_hash, + LARGE_COMMUNITY_LIST_MASTER); + old = path->attr->lcommunity; + + if (list && old) { + merge = lcommunity_list_match_delete(lcommunity_dup(old), list); + new = lcommunity_uniq_sort(merge); + lcommunity_free(&merge); + + /* HACK: if the old community is not intern'd, + * we should free it here, or all reference to it may be + * lost. + * Really need to cleanup attribute caching sometime. + */ + if (old->refcnt == 0) + lcommunity_free(&old); + + if (new->size == 0) { + path->attr->lcommunity = NULL; + path->attr->flag &= + ~ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES); + lcommunity_free(&new); + } else { + path->attr->lcommunity = new; + path->attr->flag |= + ATTR_FLAG_BIT(BGP_ATTR_LARGE_COMMUNITIES); } } @@ -2399,7 +2285,7 @@ static const struct route_map_rule_cmd route_set_lcommunity_delete_cmd = { /* For community set mechanism. */ static enum route_map_cmd_result_t route_set_community_delete(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct community_list *list; struct community *merge; @@ -2408,40 +2294,35 @@ route_set_community_delete(void *rule, const struct prefix *prefix, struct bgp_path_info *path; struct rmap_community *rcom = rule; - if (type == RMAP_BGP) { - if (!rcom) - return RMAP_OKAY; + if (!rcom) + return RMAP_OKAY; - path = object; - list = community_list_lookup(bgp_clist, rcom->name, - rcom->name_hash, - COMMUNITY_LIST_MASTER); - old = path->attr->community; - - if (list && old) { - merge = community_list_match_delete(community_dup(old), - list); - new = community_uniq_sort(merge); - community_free(&merge); - - /* HACK: if the old community is not intern'd, - * we should free it here, or all reference to it may be - * lost. - * Really need to cleanup attribute caching sometime. - */ - if (old->refcnt == 0) - community_free(&old); - - if (new->size == 0) { - path->attr->community = NULL; - path->attr->flag &= - ~ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); - community_free(&new); - } else { - path->attr->community = new; - path->attr->flag |= - ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); - } + path = object; + list = community_list_lookup(bgp_clist, rcom->name, rcom->name_hash, + COMMUNITY_LIST_MASTER); + old = path->attr->community; + + if (list && old) { + merge = community_list_match_delete(community_dup(old), list); + new = community_uniq_sort(merge); + community_free(&merge); + + /* HACK: if the old community is not intern'd, + * we should free it here, or all reference to it may be + * lost. + * Really need to cleanup attribute caching sometime. + */ + if (old->refcnt == 0) + community_free(&old); + + if (new->size == 0) { + path->attr->community = NULL; + path->attr->flag &= + ~ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); + community_free(&new); + } else { + path->attr->community = new; + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_COMMUNITIES); } } @@ -2489,42 +2370,39 @@ static const struct route_map_rule_cmd route_set_community_delete_cmd = { /* For community set mechanism. Used by _rt and _soo. */ static enum route_map_cmd_result_t -route_set_ecommunity(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_ecommunity(void *rule, const struct prefix *prefix, void *object) { struct ecommunity *ecom; struct ecommunity *new_ecom; struct ecommunity *old_ecom; struct bgp_path_info *path; - if (type == RMAP_BGP) { - ecom = rule; - path = object; + ecom = rule; + path = object; - if (!ecom) - return RMAP_OKAY; + if (!ecom) + return RMAP_OKAY; - /* We assume additive for Extended Community. */ - old_ecom = path->attr->ecommunity; + /* We assume additive for Extended Community. */ + old_ecom = path->attr->ecommunity; - if (old_ecom) { - new_ecom = ecommunity_merge(ecommunity_dup(old_ecom), - ecom); + if (old_ecom) { + new_ecom = ecommunity_merge(ecommunity_dup(old_ecom), ecom); - /* old_ecom->refcnt = 1 => owned elsewhere, e.g. - * bgp_update_receive() - * ->refcnt = 0 => set by a previous route-map - * statement */ - if (!old_ecom->refcnt) - ecommunity_free(&old_ecom); - } else - new_ecom = ecommunity_dup(ecom); + /* old_ecom->refcnt = 1 => owned elsewhere, e.g. + * bgp_update_receive() + * ->refcnt = 0 => set by a previous route-map + * statement */ + if (!old_ecom->refcnt) + ecommunity_free(&old_ecom); + } else + new_ecom = ecommunity_dup(ecom); - /* will be intern()'d or attr_flush()'d by bgp_update_main() */ - path->attr->ecommunity = new_ecom; + /* will be intern()'d or attr_flush()'d by bgp_update_main() */ + path->attr->ecommunity = new_ecom; + + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES); - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES); - } return RMAP_OKAY; } @@ -2588,8 +2466,7 @@ struct rmap_ecomm_lb_set { }; static enum route_map_cmd_result_t -route_set_ecommunity_lb(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_ecommunity_lb(void *rule, const struct prefix *prefix, void *object) { struct rmap_ecomm_lb_set *rels = rule; struct bgp_path_info *path; @@ -2602,9 +2479,6 @@ route_set_ecommunity_lb(void *rule, const struct prefix *prefix, struct ecommunity *old_ecom; as_t as; - if (type != RMAP_BGP) - return RMAP_OKAY; - path = object; peer = path->peer; if (!peer || !peer->bgp) @@ -2721,18 +2595,15 @@ struct route_map_rule_cmd route_set_ecommunity_lb_cmd = { /* For origin set. */ static enum route_map_cmd_result_t -route_set_origin(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_origin(void *rule, const struct prefix *prefix, void *object) { uint8_t *origin; struct bgp_path_info *path; - if (type == RMAP_BGP) { - origin = rule; - path = object; + origin = rule; + path = object; - path->attr->origin = *origin; - } + path->attr->origin = *origin; return RMAP_OKAY; } @@ -2772,15 +2643,12 @@ static const struct route_map_rule_cmd route_set_origin_cmd = { /* For atomic aggregate set. */ static enum route_map_cmd_result_t -route_set_atomic_aggregate(void *rule, const struct prefix *pfx, - route_map_object_t type, void *object) +route_set_atomic_aggregate(void *rule, const struct prefix *pfx, void *object) { struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE); - } + path = object; + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE); return RMAP_OKAY; } @@ -2812,20 +2680,17 @@ struct aggregator { }; static enum route_map_cmd_result_t -route_set_aggregator_as(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_aggregator_as(void *rule, const struct prefix *prefix, void *object) { struct bgp_path_info *path; struct aggregator *aggregator; - if (type == RMAP_BGP) { - path = object; - aggregator = rule; + path = object; + aggregator = rule; - path->attr->aggregator_as = aggregator->as; - path->attr->aggregator_addr = aggregator->address; - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR); - } + path->attr->aggregator_as = aggregator->as; + path->attr->aggregator_addr = aggregator->address; + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR); return RMAP_OKAY; } @@ -2867,19 +2732,16 @@ static const struct route_map_rule_cmd route_set_aggregator_as_cmd = { /* Set tag to object. object must be pointer to struct bgp_path_info */ static enum route_map_cmd_result_t -route_set_tag(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct bgp_path_info *path; - if (type == RMAP_BGP) { - tag = rule; - path = object; + tag = rule; + path = object; - /* Set tag value */ - path->attr->tag = *tag; - } + /* Set tag value */ + path->attr->tag = *tag; return RMAP_OKAY; } @@ -2894,24 +2756,21 @@ static const struct route_map_rule_cmd route_set_tag_cmd = { /* Set label-index to object. object must be pointer to struct bgp_path_info */ static enum route_map_cmd_result_t -route_set_label_index(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_label_index(void *rule, const struct prefix *prefix, void *object) { struct rmap_value *rv; struct bgp_path_info *path; uint32_t label_index; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - rv = rule; - path = object; + /* Fetch routemap's rule information. */ + rv = rule; + path = object; - /* Set label-index value. */ - label_index = rv->value; - if (label_index) { - path->attr->label_index = label_index; - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID); - } + /* Set label-index value. */ + label_index = rv->value; + if (label_index) { + path->attr->label_index = label_index; + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID); } return RMAP_OKAY; @@ -2928,12 +2787,11 @@ static const struct route_map_rule_cmd route_set_label_index_cmd = { /* `match ipv6 address IP_ACCESS_LIST' */ static enum route_map_cmd_result_t -route_match_ipv6_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; - if (type == RMAP_BGP && prefix->family == AF_INET6) { + if (prefix->family == AF_INET6) { alist = access_list_lookup(AFI_IP6, (char *)rule); if (alist == NULL) return RMAP_NOMATCH; @@ -2966,25 +2824,19 @@ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { /* `match ipv6 next-hop IP_ADDRESS' */ static enum route_map_cmd_result_t -route_match_ipv6_next_hop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ipv6_next_hop(void *rule, const struct prefix *prefix, void *object) { struct in6_addr *addr = rule; struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; - - if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr)) - return RMAP_MATCH; + path = object; - if (path->attr->mp_nexthop_len - == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL - && IPV6_ADDR_SAME(&path->attr->mp_nexthop_local, rule)) - return RMAP_MATCH; + if (IPV6_ADDR_SAME(&path->attr->mp_nexthop_global, addr)) + return RMAP_MATCH; - return RMAP_NOMATCH; - } + if (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL + && IPV6_ADDR_SAME(&path->attr->mp_nexthop_local, rule)) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -3020,22 +2872,17 @@ static const struct route_map_rule_cmd route_match_ipv6_next_hop_cmd = { /* `match ip next-hop IP_ADDRESS' */ static enum route_map_cmd_result_t -route_match_ipv4_next_hop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ipv4_next_hop(void *rule, const struct prefix *prefix, void *object) { struct in_addr *addr = rule; struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; - - if (path->attr->nexthop.s_addr == addr->s_addr || - (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4 && - IPV4_ADDR_SAME(&path->attr->mp_nexthop_global_in, addr))) - return RMAP_MATCH; + path = object; - return RMAP_NOMATCH; - } + if (path->attr->nexthop.s_addr == addr->s_addr + || (path->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4 + && IPV4_ADDR_SAME(&path->attr->mp_nexthop_global_in, addr))) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -3072,10 +2919,9 @@ static const struct route_map_rule_cmd route_match_ipv4_next_hop_cmd = { static enum route_map_cmd_result_t route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { - return route_match_address_prefix_list(rule, AFI_IP6, prefix, type, - object); + return route_match_address_prefix_list(rule, AFI_IP6, prefix, object); } static void *route_match_ipv6_address_prefix_list_compile(const char *arg) @@ -3100,12 +2946,12 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct bgp_path_info *path; struct in6_addr *addr = rule; - if (type == RMAP_BGP && prefix->family == AF_INET6) { + if (prefix->family == AF_INET6) { path = (struct bgp_path_info *)object; if (!path) return RMAP_NOMATCH; @@ -3114,6 +2960,7 @@ route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix, && !path->attr->nh_ifindex) return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -3150,27 +2997,24 @@ static const struct route_map_rule_cmd /* Set nexthop to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_ipv6_nexthop_global(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_set_ipv6_nexthop_global(void *rule, const struct prefix *p, void *object) { struct in6_addr *address; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - address = rule; - path = object; + /* Fetch routemap's rule information. */ + address = rule; + path = object; - /* Set next hop value. */ - path->attr->mp_nexthop_global = *address; + /* Set next hop value. */ + path->attr->mp_nexthop_global = *address; - /* Set nexthop length. */ - if (path->attr->mp_nexthop_len == 0) - path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; + /* Set nexthop length. */ + if (path->attr->mp_nexthop_len == 0) + path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED); - } + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_IPV6_GLOBAL_NHOP_CHANGED); return RMAP_OKAY; } @@ -3212,28 +3056,27 @@ static const struct route_map_rule_cmd /* Set next-hop preference value. */ static enum route_map_cmd_result_t route_set_ipv6_nexthop_prefer_global(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct bgp_path_info *path; struct peer *peer; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - path = object; - peer = path->peer; + /* Fetch routemap's rule information. */ + path = object; + peer = path->peer; - if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) - || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT)) { - /* Set next hop preference to global */ - path->attr->mp_nexthop_prefer_global = true; - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); - } else { - path->attr->mp_nexthop_prefer_global = false; - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); - } + if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT)) { + /* Set next hop preference to global */ + path->attr->mp_nexthop_prefer_global = true; + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); + } else { + path->attr->mp_nexthop_prefer_global = false; + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_IPV6_PREFER_GLOBAL_CHANGED); } + return RMAP_OKAY; } @@ -3266,29 +3109,24 @@ static const struct route_map_rule_cmd /* Set nexthop to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, void *object) { struct in6_addr *address; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - address = rule; - path = object; + /* Fetch routemap's rule information. */ + address = rule; + path = object; - /* Set next hop value. */ - path->attr->mp_nexthop_local = *address; + /* Set next hop value. */ + path->attr->mp_nexthop_local = *address; - /* Set nexthop length. */ - if (path->attr->mp_nexthop_len - != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) - path->attr->mp_nexthop_len = - BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; + /* Set nexthop length. */ + if (path->attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) + path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_IPV6_LL_NHOP_CHANGED); - } + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_IPV6_LL_NHOP_CHANGED); return RMAP_OKAY; } @@ -3331,55 +3169,52 @@ static const struct route_map_rule_cmd /* Set nexthop to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_ipv6_nexthop_peer(void *rule, const struct prefix *pfx, - route_map_object_t type, void *object) +route_set_ipv6_nexthop_peer(void *rule, const struct prefix *pfx, void *object) { struct in6_addr peer_address; struct bgp_path_info *path; struct peer *peer; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - path = object; - peer = path->peer; - - if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) - || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT)) - && peer->su_remote - && sockunion_family(peer->su_remote) == AF_INET6) { - peer_address = peer->su_remote->sin6.sin6_addr; - /* Set next hop value and length in attribute. */ - if (IN6_IS_ADDR_LINKLOCAL(&peer_address)) { - path->attr->mp_nexthop_local = peer_address; - if (path->attr->mp_nexthop_len - != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) - path->attr->mp_nexthop_len = - BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - } else { - path->attr->mp_nexthop_global = peer_address; - if (path->attr->mp_nexthop_len == 0) - path->attr->mp_nexthop_len = - BGP_ATTR_NHLEN_IPV6_GLOBAL; - } + /* Fetch routemap's rule information. */ + path = object; + peer = path->peer; - } else if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT)) { - /* The next hop value will be set as part of packet - * rewrite. - * Set the flags here to indicate that rewrite needs to - * be done. - * Also, clear the value - we clear both global and - * link-local - * nexthops, whether we send one or both is determined - * elsewhere. - */ - SET_FLAG(path->attr->rmap_change_flags, - BATTR_RMAP_NEXTHOP_PEER_ADDRESS); - /* clear next hop value. */ - memset(&(path->attr->mp_nexthop_global), 0, - sizeof(struct in6_addr)); - memset(&(path->attr->mp_nexthop_local), 0, - sizeof(struct in6_addr)); + if ((CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IN) + || CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_IMPORT)) + && peer->su_remote + && sockunion_family(peer->su_remote) == AF_INET6) { + peer_address = peer->su_remote->sin6.sin6_addr; + /* Set next hop value and length in attribute. */ + if (IN6_IS_ADDR_LINKLOCAL(&peer_address)) { + path->attr->mp_nexthop_local = peer_address; + if (path->attr->mp_nexthop_len + != BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) + path->attr->mp_nexthop_len = + BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; + } else { + path->attr->mp_nexthop_global = peer_address; + if (path->attr->mp_nexthop_len == 0) + path->attr->mp_nexthop_len = + BGP_ATTR_NHLEN_IPV6_GLOBAL; } + + } else if (CHECK_FLAG(peer->rmap_type, PEER_RMAP_TYPE_OUT)) { + /* The next hop value will be set as part of packet + * rewrite. + * Set the flags here to indicate that rewrite needs to + * be done. + * Also, clear the value - we clear both global and + * link-local + * nexthops, whether we send one or both is determined + * elsewhere. + */ + SET_FLAG(path->attr->rmap_change_flags, + BATTR_RMAP_NEXTHOP_PEER_ADDRESS); + /* clear next hop value. */ + memset(&(path->attr->mp_nexthop_global), 0, + sizeof(struct in6_addr)); + memset(&(path->attr->mp_nexthop_local), 0, + sizeof(struct in6_addr)); } return RMAP_OKAY; @@ -3414,21 +3249,18 @@ static const struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd = { /* `set ipv4 vpn next-hop A.B.C.D' */ static enum route_map_cmd_result_t -route_set_vpnv4_nexthop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_vpnv4_nexthop(void *rule, const struct prefix *prefix, void *object) { struct in_addr *address; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - address = rule; - path = object; + /* Fetch routemap's rule information. */ + address = rule; + path = object; - /* Set next hop value. */ - path->attr->mp_nexthop_global_in = *address; - path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; - } + /* Set next hop value. */ + path->attr->mp_nexthop_global_in = *address; + path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; return RMAP_OKAY; } @@ -3453,22 +3285,19 @@ static void *route_set_vpnv4_nexthop_compile(const char *arg) /* `set ipv6 vpn next-hop A.B.C.D' */ static enum route_map_cmd_result_t -route_set_vpnv6_nexthop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_vpnv6_nexthop(void *rule, const struct prefix *prefix, void *object) { struct in6_addr *address; struct bgp_path_info *path; - if (type == RMAP_BGP) { - /* Fetch routemap's rule information. */ - address = rule; - path = object; + /* Fetch routemap's rule information. */ + address = rule; + path = object; - /* Set next hop value. */ - memcpy(&path->attr->mp_nexthop_global, address, - sizeof(struct in6_addr)); - path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL; - } + /* Set next hop value. */ + memcpy(&path->attr->mp_nexthop_global, address, + sizeof(struct in6_addr)); + path->attr->mp_nexthop_len = BGP_ATTR_NHLEN_VPNV6_GLOBAL; return RMAP_OKAY; } @@ -3514,19 +3343,16 @@ static const struct route_map_rule_cmd route_set_vpnv6_nexthop_cmd = { /* For origin set. */ static enum route_map_cmd_result_t -route_set_originator_id(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_originator_id(void *rule, const struct prefix *prefix, void *object) { struct in_addr *address; struct bgp_path_info *path; - if (type == RMAP_BGP) { - address = rule; - path = object; + address = rule; + path = object; - path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID); - path->attr->originator_id = *address; - } + path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID); + path->attr->originator_id = *address; return RMAP_OKAY; } diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 0f0aff7eaa..6bb33ff859 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -124,7 +124,7 @@ static int is_running(void); static void route_match_free(void *rule); static enum route_map_cmd_result_t route_match(void *rule, const struct prefix *prefix, - route_map_object_t type, + void *object); static void *route_match_compile(const char *arg); static void revalidate_bgp_node(struct bgp_dest *dest, afi_t afi, safi_t safi); @@ -213,20 +213,18 @@ static void ipv6_addr_to_host_byte_order(const uint32_t *src, uint32_t *dest) static enum route_map_cmd_result_t route_match(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) { int *rpki_status = rule; struct bgp_path_info *path; - if (type == RMAP_BGP) { - path = object; + path = object; - if (rpki_validate_prefix(path->peer, path->attr, prefix) - == *rpki_status) { - return RMAP_MATCH; - } + if (rpki_validate_prefix(path->peer, path->attr, prefix) + == *rpki_status) { + return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -902,48 +900,47 @@ static int config_write(struct vty *vty) struct listnode *cache_node; struct cache *cache; - if (listcount(cache_list)) { - if (rpki_debug) - vty_out(vty, "debug rpki\n"); + if (!listcount(cache_list)) + return 0; - vty_out(vty, "!\n"); - vty_out(vty, "rpki\n"); - vty_out(vty, " rpki polling_period %d\n", polling_period); - for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) { - switch (cache->type) { - struct tr_tcp_config *tcp_config; + if (rpki_debug) + vty_out(vty, "debug rpki\n"); + + vty_out(vty, "!\n"); + vty_out(vty, "rpki\n"); + vty_out(vty, " rpki polling_period %d\n", polling_period); + for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) { + switch (cache->type) { + struct tr_tcp_config *tcp_config; #if defined(FOUND_SSH) - struct tr_ssh_config *ssh_config; + struct tr_ssh_config *ssh_config; #endif - case TCP: - tcp_config = cache->tr_config.tcp_config; - vty_out(vty, " rpki cache %s %s ", - tcp_config->host, tcp_config->port); - break; + case TCP: + tcp_config = cache->tr_config.tcp_config; + vty_out(vty, " rpki cache %s %s ", tcp_config->host, + tcp_config->port); + break; #if defined(FOUND_SSH) - case SSH: - ssh_config = cache->tr_config.ssh_config; - vty_out(vty, " rpki cache %s %u %s %s %s ", - ssh_config->host, ssh_config->port, - ssh_config->username, - ssh_config->client_privkey_path, - ssh_config->server_hostkey_path != NULL - ? ssh_config - ->server_hostkey_path - : " "); - break; + case SSH: + ssh_config = cache->tr_config.ssh_config; + vty_out(vty, " rpki cache %s %u %s %s %s ", + ssh_config->host, ssh_config->port, + ssh_config->username, + ssh_config->client_privkey_path, + ssh_config->server_hostkey_path != NULL + ? ssh_config->server_hostkey_path + : " "); + break; #endif - default: - break; - } - - vty_out(vty, "preference %hhu\n", cache->preference); + default: + break; } - vty_out(vty, " exit\n"); - return 1; - } else { - return 0; + + vty_out(vty, "preference %hhu\n", cache->preference); } + vty_out(vty, " exit\n"); + + return 1; } DEFUN_NOSH (rpki, @@ -1277,53 +1274,49 @@ DEFUN (show_rpki_cache_connection, RPKI_OUTPUT_STRING "Show to which RPKI Cache Servers we have a connection\n") { - if (is_synchronized()) { - struct listnode *cache_node; - struct cache *cache; - struct rtr_mgr_group *group = get_connected_group(); - - if (!group) { - vty_out(vty, "Cannot find a connected group.\n"); - return CMD_SUCCESS; - } - vty_out(vty, "Connected to group %d\n", group->preference); - for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) { - if (cache->preference == group->preference) { - struct tr_tcp_config *tcp_config; + if (!is_synchronized()) { + vty_out(vty, "No connection to RPKI cache server.\n"); + + return CMD_SUCCESS; + } + + struct listnode *cache_node; + struct cache *cache; + struct rtr_mgr_group *group = get_connected_group(); + + if (!group) { + vty_out(vty, "Cannot find a connected group.\n"); + return CMD_SUCCESS; + } + vty_out(vty, "Connected to group %d\n", group->preference); + for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) { + if (cache->preference == group->preference) { + struct tr_tcp_config *tcp_config; #if defined(FOUND_SSH) - struct tr_ssh_config *ssh_config; + struct tr_ssh_config *ssh_config; #endif - switch (cache->type) { - case TCP: - tcp_config = - cache->tr_config.tcp_config; - vty_out(vty, - "rpki tcp cache %s %s pref %hhu\n", - tcp_config->host, - tcp_config->port, - cache->preference); - break; + switch (cache->type) { + case TCP: + tcp_config = cache->tr_config.tcp_config; + vty_out(vty, "rpki tcp cache %s %s pref %hhu\n", + tcp_config->host, tcp_config->port, + cache->preference); + break; #if defined(FOUND_SSH) - case SSH: - ssh_config = - cache->tr_config.ssh_config; - vty_out(vty, - "rpki ssh cache %s %u pref %hhu\n", - ssh_config->host, - ssh_config->port, - cache->preference); - break; + case SSH: + ssh_config = cache->tr_config.ssh_config; + vty_out(vty, "rpki ssh cache %s %u pref %hhu\n", + ssh_config->host, ssh_config->port, + cache->preference); + break; #endif - default: - break; - } + default: + break; } } - } else { - vty_out(vty, "No connection to RPKI cache server.\n"); } return CMD_SUCCESS; diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 70e226b01b..022a6413e2 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -154,13 +154,8 @@ void bgp_delete_listnode(struct bgp_node *node) if (bgp && rn && rn->lock == 1) { /* Delete the route from the selection pending list */ - if ((node->rt_node) - && (bgp->gr_info[afi][safi].route_list)) { - list_delete_node( - bgp->gr_info[afi][safi].route_list, - node->rt_node); - node->rt_node = NULL; - } + bgp->gr_info[afi][safi].gr_deferred--; + UNSET_FLAG(node->flags, BGP_NODE_SELECT_DEFER); } } } diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 9dd27628ce..738d41ee6d 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -102,8 +102,9 @@ struct bgp_node { #define BGP_NODE_LABEL_CHANGED (1 << 2) #define BGP_NODE_REGISTERED_FOR_LABEL (1 << 3) #define BGP_NODE_SELECT_DEFER (1 << 4) - /* list node pointer */ - struct listnode *rt_node; +#define BGP_NODE_FIB_INSTALL_PENDING (1 << 5) +#define BGP_NODE_FIB_INSTALLED (1 << 6) + struct bgp_addpath_node_data tx_addpath; enum bgp_path_selection_reason reason; diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index ac77ccd8a4..da9e1f28ae 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -315,6 +315,7 @@ static void updgrp_show_adj(struct bgp *bgp, afi_t afi, safi_t safi, static int subgroup_coalesce_timer(struct thread *thread) { struct update_subgroup *subgrp; + struct bgp *bgp; subgrp = THREAD_ARG(thread); if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) @@ -323,6 +324,7 @@ static int subgroup_coalesce_timer(struct thread *thread) subgrp->v_coalesce); subgrp->t_coalesce = NULL; subgrp->v_coalesce = 0; + bgp = SUBGRP_INST(subgrp); subgroup_announce_route(subgrp); @@ -334,7 +336,8 @@ static int subgroup_coalesce_timer(struct thread *thread) * to * announce, this is the method currently employed to trigger the EOR. */ - if (!bgp_update_delay_active(SUBGRP_INST(subgrp))) { + if (!bgp_update_delay_active(SUBGRP_INST(subgrp)) && + !(BGP_SUPPRESS_FIB_ENABLED(bgp))) { struct peer_af *paf; struct peer *peer; @@ -458,10 +461,14 @@ void bgp_adj_out_set_subgroup(struct bgp_dest *dest, struct peer *peer; afi_t afi; safi_t safi; + struct peer *adv_peer; + struct peer_af *paf; + struct bgp *bgp; peer = SUBGRP_PEER(subgrp); afi = SUBGRP_AFI(subgrp); safi = SUBGRP_SAFI(subgrp); + bgp = SUBGRP_INST(subgrp); if (DISABLE_BGP_ANNOUNCE) return; @@ -504,9 +511,21 @@ void bgp_adj_out_set_subgroup(struct bgp_dest *dest, * mrai timers so the socket writes can happen. */ if (!bgp_adv_fifo_count(&subgrp->sync->update)) { - struct peer_af *paf; - SUBGRP_FOREACH_PEER (subgrp, paf) { + /* If there are no routes in the withdraw list, set + * the flag PEER_STATUS_ADV_DELAY which will allow + * more routes to be sent in the update message + */ + if (BGP_SUPPRESS_FIB_ENABLED(bgp)) { + adv_peer = PAF_PEER(paf); + if (!bgp_adv_fifo_count( + &subgrp->sync->withdraw)) + SET_FLAG(adv_peer->thread_flags, + PEER_THREAD_SUBGRP_ADV_DELAY); + else + UNSET_FLAG(adv_peer->thread_flags, + PEER_THREAD_SUBGRP_ADV_DELAY); + } bgp_adjust_routeadv(PAF_PEER(paf)); } } @@ -617,10 +636,13 @@ void subgroup_announce_table(struct update_subgroup *subgrp, afi_t afi; safi_t safi; int addpath_capable; + struct bgp *bgp; + bool advertise; peer = SUBGRP_PEER(subgrp); afi = SUBGRP_AFI(subgrp); safi = SUBGRP_SAFI(subgrp); + bgp = SUBGRP_INST(subgrp); addpath_capable = bgp_addpath_encode_tx(peer, afi, safi); if (safi == SAFI_LABELED_UNICAST) @@ -637,6 +659,9 @@ void subgroup_announce_table(struct update_subgroup *subgrp, for (dest = bgp_table_top(table); dest; dest = bgp_route_next(dest)) { const struct prefix *dest_p = bgp_dest_get_prefix(dest); + /* Check if the route can be advertised */ + advertise = bgp_check_advertise(bgp, dest); + for (ri = bgp_dest_get_bgp_path_info(dest); ri; ri = ri->next) if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED) @@ -646,10 +671,14 @@ void subgroup_announce_table(struct update_subgroup *subgrp, ri))) { if (subgroup_announce_check(dest, ri, subgrp, dest_p, &attr, - false)) - bgp_adj_out_set_subgroup(dest, subgrp, - &attr, ri); - else { + false)) { + /* Check if route can be advertised */ + if (advertise) + bgp_adj_out_set_subgroup(dest, + subgrp, + &attr, + ri); + } else { /* If default originate is enabled for * the peer, do not send explicit * withdraw. This will prevent deletion @@ -731,7 +760,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) struct bgp *bgp; struct attr attr; struct attr *new_attr = &attr; - struct aspath *aspath; struct prefix p; struct peer *from; struct bgp_dest *dest; @@ -756,7 +784,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) from = bgp->peer_self; bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); - aspath = attr.aspath; attr.local_pref = bgp->default_local_pref; @@ -772,12 +799,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) } if (peer->default_rmap[afi][safi].name) { - struct attr attr_tmp = attr; - struct bgp_path_info bpi_rmap = {0}; - - bpi_rmap.peer = bgp->peer_self; - bpi_rmap.attr = &attr_tmp; - SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_DEFAULT); /* Iterate over the RIB to see if we can announce @@ -789,20 +810,46 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) if (!bgp_dest_has_bgp_path_info_data(dest)) continue; - ret = route_map_apply(peer->default_rmap[afi][safi].map, - bgp_dest_get_prefix(dest), - RMAP_BGP, &bpi_rmap); + for (pi = bgp_dest_get_bgp_path_info(dest); pi; + pi = pi->next) { + struct attr tmp_attr; + struct bgp_path_info tmp_pi; + struct bgp_path_info_extra tmp_pie; + + tmp_attr = *pi->attr; + + prep_for_rmap_apply(&tmp_pi, &tmp_pie, dest, pi, + pi->peer, &tmp_attr); + + ret = route_map_apply( + peer->default_rmap[afi][safi].map, + bgp_dest_get_prefix(dest), &tmp_pi); + + if (ret == RMAP_DENYMATCH) { + bgp_attr_flush(&tmp_attr); + continue; + } else { + new_attr = bgp_attr_intern(&tmp_attr); + new_attr->aspath = attr.aspath; + + subgroup_announce_reset_nhop( + (peer_cap_enhe(peer, afi, safi) + ? AF_INET6 + : AF_INET), + new_attr); - if (ret != RMAP_DENYMATCH) + break; + } + } + if (ret == RMAP_PERMITMATCH) { + bgp_dest_unlock_node(dest); break; + } } bgp->peer_self->rmap_type = 0; - new_attr = bgp_attr_intern(&attr_tmp); - if (ret == RMAP_DENYMATCH) { - bgp_attr_flush(&attr_tmp); + if (ret == RMAP_DENYMATCH) withdraw = 1; - } } /* Check if the default route is in local BGP RIB which is @@ -881,8 +928,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw) subgroup_default_update_packet(subgrp, new_attr, from); } } - - aspath_unintern(&aspath); } /* @@ -929,6 +974,13 @@ void group_announce_route(struct bgp *bgp, afi_t afi, safi_t safi, struct updwalk_context ctx; ctx.pi = pi; ctx.dest = dest; + + /* If suppress fib is enabled, the route will be advertised when + * FIB status is received + */ + if (!bgp_check_advertise(bgp, dest)) + return; + update_group_af_walk(bgp, afi, safi, group_announce_route_walkcb, &ctx); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 00e781d804..1a7a3543f9 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -154,6 +154,10 @@ static int bgp_show_neighbor_graceful_restart_afi_all(struct vty *vty, const char *ip_str, afi_t afi, bool use_json); +static int peer_and_group_lookup_nb(struct vty *vty, const char *peer_str, + char *base_xpath, int xpath_len, + char *abs_xpath); + static enum node_type bgp_node_type(afi_t afi, safi_t safi) { switch (afi) { @@ -587,7 +591,7 @@ int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty, return *idx; } -static bool peer_address_self_check(struct bgp *bgp, union sockunion *su) +bool peer_address_self_check(struct bgp *bgp, union sockunion *su) { struct interface *ifp = NULL; @@ -604,49 +608,6 @@ static bool peer_address_self_check(struct bgp *bgp, union sockunion *su) return false; } -/* Utility function for looking up peer from VTY. */ -/* This is used only for configuration, so disallow if attempted on - * a dynamic neighbor. - */ -static struct peer *peer_lookup_vty(struct vty *vty, const char *ip_str) -{ - struct bgp *bgp = VTY_GET_CONTEXT(bgp); - int ret; - union sockunion su; - struct peer *peer; - - if (!bgp) { - return NULL; - } - - ret = str2sockunion(ip_str, &su); - if (ret < 0) { - peer = peer_lookup_by_conf_if(bgp, ip_str); - if (!peer) { - if ((peer = peer_lookup_by_hostname(bgp, ip_str)) - == NULL) { - vty_out(vty, - "%% Malformed address or name: %s\n", - ip_str); - return NULL; - } - } - } else { - peer = peer_lookup(bgp, &su); - if (!peer) { - vty_out(vty, - "%% Specify remote-as or peer-group commands first\n"); - return NULL; - } - if (peer_dynamic_neighbor(peer)) { - vty_out(vty, - "%% Operation not allowed on a dynamic neighbor\n"); - return NULL; - } - } - return peer; -} - /* Utility function for looking up peer or peer group. */ /* This is used only for configuration, so disallow if attempted on * a dynamic neighbor. @@ -693,6 +654,98 @@ struct peer *peer_and_group_lookup_vty(struct vty *vty, const char *peer_str) return NULL; } +int bgp_nb_errmsg_return(char *errmsg, size_t errmsg_len, int ret) +{ + const char *str = NULL; + + switch (ret) { + case BGP_ERR_INVALID_VALUE: + str = "Invalid value"; + break; + case BGP_ERR_INVALID_FLAG: + str = "Invalid flag"; + break; + case BGP_ERR_PEER_GROUP_SHUTDOWN: + str = "Peer-group has been shutdown. Activate the peer-group first"; + break; + case BGP_ERR_PEER_FLAG_CONFLICT: + str = "Can't set override-capability and strict-capability-match at the same time"; + break; + case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: + str = "Specify remote-as or peer-group remote AS first"; + break; + case BGP_ERR_PEER_GROUP_CANT_CHANGE: + str = "Cannot change the peer-group. Deconfigure first"; + break; + case BGP_ERR_PEER_GROUP_MISMATCH: + str = "Peer is not a member of this peer-group"; + break; + case BGP_ERR_PEER_FILTER_CONFLICT: + str = "Prefix/distribute list can not co-exist"; + break; + case BGP_ERR_NOT_INTERNAL_PEER: + str = "Invalid command. Not an internal neighbor"; + break; + case BGP_ERR_REMOVE_PRIVATE_AS: + str = "remove-private-AS cannot be configured for IBGP peers"; + break; + case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: + str = "Local-AS allowed only for EBGP peers"; + break; + case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: + str = "Cannot have local-as same as BGP AS number"; + break; + case BGP_ERR_TCPSIG_FAILED: + str = "Error while applying TCP-Sig to session(s)"; + break; + case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: + str = "ebgp-multihop and ttl-security cannot be configured together"; + break; + case BGP_ERR_NO_IBGP_WITH_TTLHACK: + str = "ttl-security only allowed for EBGP peers"; + break; + case BGP_ERR_AS_OVERRIDE: + str = "as-override cannot be configured for IBGP peers"; + break; + case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: + str = "Invalid limit for number of dynamic neighbors"; + break; + case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: + str = "Dynamic neighbor listen range already exists"; + break; + case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: + str = "Operation not allowed on a dynamic neighbor"; + break; + case BGP_ERR_INVALID_FOR_DIRECT_PEER: + str = "Operation not allowed on a directly connected neighbor"; + break; + case BGP_ERR_PEER_SAFI_CONFLICT: + str = GR_INVALID; + break; + case BGP_ERR_GR_INVALID_CMD: + str = "The Graceful Restart command used is not valid at this moment."; + break; + case BGP_ERR_GR_OPERATION_FAILED: + str = "The Graceful Restart Operation failed due to an err."; + break; + case BGP_GR_NO_OPERATION: + str = GR_NO_OPER; + break; + case BGP_ERR_PEER_GROUP_MEMBER: + str = "Peer-group member cannot override remote-as of peer-group"; + break; + case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: + str = "Peer-group members must be all internal or all external"; + break; + } + if (str) { + snprintf(errmsg, errmsg_len, "%s", str); + return -1; + } + + return 0; +} + int bgp_vty_return(struct vty *vty, int ret) { const char *str = NULL; @@ -1461,6 +1514,20 @@ void cli_show_router_bgp_router_id(struct vty *vty, struct lyd_node *dnode, vty_out(vty, " bgp router-id %s\n", yang_dnode_get_string(dnode, NULL)); } +DEFPY (bgp_suppress_fib_pending, + bgp_suppress_fib_pending_cmd, + "[no] bgp suppress-fib-pending", + NO_STR + BGP_STR + "Advertise only routes that are programmed in kernel to peers\n") +{ + VTY_DECLVAR_CONTEXT(bgp, bgp); + + bgp_suppress_fib_pending_set(bgp, !no); + return CMD_SUCCESS; +} + + /* BGP Cluster ID. */ DEFUN_YANG(bgp_cluster_id, bgp_cluster_id_cmd, @@ -2285,12 +2352,12 @@ ALIAS_HIDDEN(no_bgp_maxpaths_ibgp, no_bgp_maxpaths_ibgp_hidden_cmd, static void bgp_config_write_maxpaths(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi) { - if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) { + if (bgp->maxpaths[afi][safi].maxpaths_ebgp != multipath_num) { vty_out(vty, " maximum-paths %d\n", bgp->maxpaths[afi][safi].maxpaths_ebgp); } - if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) { + if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num) { vty_out(vty, " maximum-paths ibgp %d", bgp->maxpaths[afi][safi].maxpaths_ibgp); if (CHECK_FLAG(bgp->maxpaths[afi][safi].ibgp_flags, @@ -3609,12 +3676,12 @@ void cli_show_router_bgp_show_hostname(struct vty *vty, struct lyd_node *dnode, } /* Display hostname in certain command outputs */ -DEFUN (bgp_default_show_nexthop_hostname, - bgp_default_show_nexthop_hostname_cmd, - "bgp default show-nexthop-hostname", - "BGP specific commands\n" - "Configure BGP defaults\n" - "Show hostname for nexthop in certain command outputs\n") +DEFUN_YANG(bgp_default_show_nexthop_hostname, + bgp_default_show_nexthop_hostname_cmd, + "bgp default show-nexthop-hostname", + "BGP specific commands\n" + "Configure BGP defaults\n" + "Show hostname for nexthop in certain command outputs\n") { nb_cli_enqueue_change(vty, "./global/show-nexthop-hostname", NB_OP_MODIFY, "true"); @@ -4067,70 +4134,6 @@ void cli_show_router_global_ebgp_multihop_connected_route_check( vty_out(vty, " bgp disable-ebgp-connected-route-check\n"); } -static int peer_remote_as_vty(struct vty *vty, const char *peer_str, - const char *as_str, afi_t afi, safi_t safi) -{ - VTY_DECLVAR_CONTEXT(bgp, bgp); - int ret; - as_t as; - int as_type = AS_SPECIFIED; - union sockunion su; - - if (as_str[0] == 'i') { - as = 0; - as_type = AS_INTERNAL; - } else if (as_str[0] == 'e') { - as = 0; - as_type = AS_EXTERNAL; - } else { - /* Get AS number. */ - as = strtoul(as_str, NULL, 10); - } - - /* If peer is peer group or interface peer, call proper function. */ - ret = str2sockunion(peer_str, &su); - if (ret < 0) { - struct peer *peer; - - /* Check if existing interface peer */ - peer = peer_lookup_by_conf_if(bgp, peer_str); - - ret = peer_remote_as(bgp, NULL, peer_str, &as, as_type, afi, - safi); - - /* if not interface peer, check peer-group settings */ - if (ret < 0 && !peer) { - ret = peer_group_remote_as(bgp, peer_str, &as, as_type); - if (ret < 0) { - vty_out(vty, - "%% Create the peer-group or interface first\n"); - return CMD_WARNING_CONFIG_FAILED; - } - return CMD_SUCCESS; - } - } else { - if (peer_address_self_check(bgp, &su)) { - vty_out(vty, - "%% Can not configure the local system as neighbor\n"); - return CMD_WARNING_CONFIG_FAILED; - } - ret = peer_remote_as(bgp, &su, NULL, &as, as_type, afi, safi); - } - - /* This peer belongs to peer group. */ - switch (ret) { - case BGP_ERR_PEER_GROUP_MEMBER: - vty_out(vty, - "%% Peer-group member cannot override remote-as of peer-group\n"); - return CMD_WARNING_CONFIG_FAILED; - case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: - vty_out(vty, - "%% Peer-group members must be all internal or all external\n"); - return CMD_WARNING_CONFIG_FAILED; - } - return bgp_vty_return(vty, ret); -} - DEFUN_YANG(bgp_default_shutdown, bgp_default_shutdown_cmd, "[no] bgp default shutdown", @@ -4196,58 +4199,82 @@ ALIAS(no_bgp_shutdown, no_bgp_shutdown_msg_cmd, "Administrative shutdown of the BGP instance\n" "Add a shutdown message (RFC 8203)\n" "Shutdown message\n") -DEFUN (neighbor_remote_as, - neighbor_remote_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG(neighbor_remote_as, + neighbor_remote_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_peer = 1; int idx_remote_as = 3; - return peer_remote_as_vty(vty, argv[idx_peer]->arg, - argv[idx_remote_as]->arg, AFI_IP, - SAFI_UNICAST); + char base_xpath[XPATH_MAXLEN]; + char unnbr_xpath[XPATH_MAXLEN]; + char prgrp_xpath[XPATH_MAXLEN]; + union sockunion su; + const char *as_type_str = "as-specified"; + + if (str2sockunion(argv[idx_peer]->arg, &su) < 0) { + snprintf(unnbr_xpath, sizeof(unnbr_xpath), + FRR_BGP_NEIGHBOR_UNNUM_XPATH, argv[idx_peer]->arg, ""); + + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + FRR_BGP_PEER_GROUP_XPATH, argv[idx_peer]->arg, ""); + + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, unnbr_xpath + 1)) { + strlcpy(base_xpath, unnbr_xpath, sizeof(base_xpath)); + } else if (yang_dnode_exists(vty->candidate_config->dnode, + "%s%s", VTY_CURR_XPATH, + prgrp_xpath + 1)) { + snprintf(base_xpath, sizeof(base_xpath), + FRR_BGP_PEER_GROUP_XPATH, argv[idx_peer]->arg, + ""); + } else { + vty_out(vty, + "%% Create the peer-group or interface first\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } else { + snprintf(base_xpath, sizeof(base_xpath), + FRR_BGP_NEIGHBOR_NUM_XPATH, argv[idx_peer]->arg, ""); + } + + if (argv[idx_remote_as]->arg[0] == 'i') { + as_type_str = "internal"; + } else if (argv[idx_remote_as]->arg[0] == 'e') { + as_type_str = "external"; + } else { + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as", + NB_OP_MODIFY, argv[idx_remote_as]->arg); + } + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as-type", + NB_OP_MODIFY, as_type_str); + + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_conf_interface_get(struct vty *vty, const char *conf_if, - afi_t afi, safi_t safi, int v6only, - const char *peer_group_name, - const char *as_str) +int peer_conf_interface_create(struct bgp *bgp, const char *conf_if, afi_t afi, + safi_t safi, bool v6only, + const char *peer_group_name, int as_type, + as_t as, char *errmsg, size_t errmsg_len) { - VTY_DECLVAR_CONTEXT(bgp, bgp); - as_t as = 0; - int as_type = AS_UNSPECIFIED; struct peer *peer; struct peer_group *group; int ret = 0; - union sockunion su; group = peer_group_lookup(bgp, conf_if); if (group) { - vty_out(vty, "%% Name conflict with peer-group \n"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (as_str) { - if (as_str[0] == 'i') { - as_type = AS_INTERNAL; - } else if (as_str[0] == 'e') { - as_type = AS_EXTERNAL; - } else { - /* Get AS number. */ - as = strtoul(as_str, NULL, 10); - as_type = AS_SPECIFIED; - } + snprintf(errmsg, errmsg_len, + "Name conflict with peer-group \n"); + return -1; } peer = peer_lookup_by_conf_if(bgp, conf_if); if (peer) { - if (as_str) + if (as_type != AS_UNSPECIFIED) ret = peer_remote_as(bgp, NULL, conf_if, &as, as_type, afi, safi); } else { @@ -4260,8 +4287,9 @@ static int peer_conf_interface_get(struct vty *vty, const char *conf_if, as_type, afi, safi, NULL); if (!peer) { - vty_out(vty, "%% BGP failed to create peer\n"); - return CMD_WARNING_CONFIG_FAILED; + snprintf(errmsg, errmsg_len, + "BGP failed to create peer\n"); + return -1; } if (v6only) @@ -4304,374 +4332,389 @@ static int peer_conf_interface_get(struct vty *vty, const char *conf_if, if (peer_group_name) { group = peer_group_lookup(bgp, peer_group_name); if (!group) { - vty_out(vty, "%% Configure the peer-group first\n"); - return CMD_WARNING_CONFIG_FAILED; + snprintf(errmsg, errmsg_len, + "Configure the peer-group first\n"); + return -1; } - ret = peer_group_bind(bgp, &su, peer, group, &as); + ret = peer_group_bind(bgp, NULL, peer, group, &as); } - return bgp_vty_return(vty, ret); + return bgp_nb_errmsg_return(errmsg, errmsg_len, ret); } -DEFUN (neighbor_interface_config, - neighbor_interface_config_cmd, - "neighbor WORD interface [peer-group PGNAME]", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP on interface\n" - "Member of the peer-group\n" - "Peer-group name\n") +DEFUN_YANG(neighbor_interface_config, + neighbor_interface_config_cmd, + "neighbor WORD interface [peer-group PGNAME]", + NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Enable BGP on interface\n" + "Member of the peer-group\n" + "Peer-group name\n") { int idx_word = 1; int idx_peer_group_word = 4; + char base_xpath[XPATH_MAXLEN]; + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_word]->arg, ""); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); if (argc > idx_peer_group_word) - return peer_conf_interface_get( - vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 0, - argv[idx_peer_group_word]->arg, NULL); - else - return peer_conf_interface_get(vty, argv[idx_word]->arg, AFI_IP, - SAFI_UNICAST, 0, NULL, NULL); + nb_cli_enqueue_change(vty, "./peer-group", NB_OP_MODIFY, + argv[idx_peer_group_word]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_interface_config_v6only, - neighbor_interface_config_v6only_cmd, - "neighbor WORD interface v6only [peer-group PGNAME]", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP on interface\n" - "Enable BGP with v6 link-local only\n" - "Member of the peer-group\n" - "Peer-group name\n") +DEFUN_YANG(neighbor_interface_config_v6only, + neighbor_interface_config_v6only_cmd, + "neighbor WORD interface v6only [peer-group PGNAME]", + NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Enable BGP on interface\n" + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "Peer-group name\n") { int idx_word = 1; int idx_peer_group_word = 5; + char base_xpath[XPATH_MAXLEN]; + + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_word]->arg, ""); + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); if (argc > idx_peer_group_word) - return peer_conf_interface_get( - vty, argv[idx_word]->arg, AFI_IP, SAFI_UNICAST, 1, - argv[idx_peer_group_word]->arg, NULL); + nb_cli_enqueue_change(vty, "./peer-group", NB_OP_MODIFY, + argv[idx_peer_group_word]->arg); + + nb_cli_enqueue_change(vty, "./v6only", NB_OP_MODIFY, "true"); - return peer_conf_interface_get(vty, argv[idx_word]->arg, AFI_IP, - SAFI_UNICAST, 1, NULL, NULL); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_interface_config_remote_as, - neighbor_interface_config_remote_as_cmd, - "neighbor WORD interface remote-as <(1-4294967295)|internal|external>", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP on interface\n" - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG( + neighbor_interface_config_remote_as, + neighbor_interface_config_remote_as_cmd, + "neighbor WORD interface remote-as <(1-4294967295)|internal|external>", + NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Enable BGP on interface\n" + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 1; int idx_remote_as = 4; - return peer_conf_interface_get(vty, argv[idx_word]->arg, AFI_IP, - SAFI_UNICAST, 0, NULL, - argv[idx_remote_as]->arg); + char base_xpath[XPATH_MAXLEN]; + const char *as_type_str = "as-specified"; + + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_word]->arg, ""); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + if (argv[idx_remote_as]->arg[0] == 'i') { + as_type_str = "internal"; + } else if (argv[idx_remote_as]->arg[0] == 'e') { + as_type_str = "external"; + } else { + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as", + NB_OP_MODIFY, argv[idx_remote_as]->arg); + } + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as-type", + NB_OP_MODIFY, as_type_str); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_interface_v6only_config_remote_as, - neighbor_interface_v6only_config_remote_as_cmd, - "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Enable BGP with v6 link-local only\n" - "Enable BGP on interface\n" - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG( + neighbor_interface_v6only_config_remote_as, + neighbor_interface_v6only_config_remote_as_cmd, + "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>", + NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Enable BGP with v6 link-local only\n" + "Enable BGP on interface\n" + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 1; int idx_remote_as = 5; - return peer_conf_interface_get(vty, argv[idx_word]->arg, AFI_IP, - SAFI_UNICAST, 1, NULL, - argv[idx_remote_as]->arg); + char base_xpath[XPATH_MAXLEN]; + const char *as_type_str = "as-specified"; + + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_word]->arg, ""); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + nb_cli_enqueue_change(vty, "./v6only", NB_OP_MODIFY, "true"); + + if (argv[idx_remote_as]->arg[0] == 'i') { + as_type_str = "internal"; + } else if (argv[idx_remote_as]->arg[0] == 'e') { + as_type_str = "external"; + } else { + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as", + NB_OP_MODIFY, argv[idx_remote_as]->arg); + } + nb_cli_enqueue_change(vty, "./neighbor-remote-as/remote-as-type", + NB_OP_MODIFY, as_type_str); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_peer_group, - neighbor_peer_group_cmd, - "neighbor WORD peer-group", - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Configure peer-group\n") +DEFUN_YANG(neighbor_peer_group, neighbor_peer_group_cmd, + "neighbor WORD peer-group", + NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Configure peer-group\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); + char base_xpath[XPATH_MAXLEN]; int idx_word = 1; - struct peer *peer; - struct peer_group *group; - peer = peer_lookup_by_conf_if(bgp, argv[idx_word]->arg); - if (peer) { - vty_out(vty, "%% Name conflict with interface: \n"); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_PEER_GROUP_XPATH, + argv[idx_word]->arg, ""); - group = peer_group_get(bgp, argv[idx_word]->arg); - if (!group) { - vty_out(vty, "%% BGP failed to find or create peer-group\n"); - return CMD_WARNING_CONFIG_FAILED; - } + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor, - no_neighbor_cmd, - "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG(no_neighbor, + no_neighbor_cmd, + "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>", + NO_STR NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_peer = 2; - int ret; + char base_xpath[XPATH_MAXLEN]; + char num_xpath[XPATH_MAXLEN]; + char unnbr_xpath[XPATH_MAXLEN]; + char prgrp_xpath[XPATH_MAXLEN]; union sockunion su; - struct peer_group *group; - struct peer *peer; - struct peer *other; - ret = str2sockunion(argv[idx_peer]->arg, &su); - if (ret < 0) { - /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if(bgp, argv[idx_peer]->arg); - if (peer) { - /* Request zebra to terminate IPv6 RAs on this - * interface. */ - if (peer->ifp) - bgp_zebra_terminate_radv(peer->bgp, peer); - peer_notify_unconfig(peer); - peer_delete(peer); - return CMD_SUCCESS; + if (str2sockunion(argv[idx_peer]->arg, &su) == 0) { + snprintf(num_xpath, sizeof(num_xpath), + FRR_BGP_NEIGHBOR_NUM_XPATH, argv[idx_peer]->arg, ""); + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, num_xpath + 1)) { + strlcpy(base_xpath, num_xpath, sizeof(base_xpath)); } - - group = peer_group_lookup(bgp, argv[idx_peer]->arg); - if (group) { - peer_group_notify_unconfig(group); - peer_group_delete(group); + } else { + snprintf(unnbr_xpath, sizeof(unnbr_xpath), + FRR_BGP_NEIGHBOR_UNNUM_XPATH, argv[idx_peer]->arg, ""); + + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + FRR_BGP_PEER_GROUP_XPATH, argv[idx_peer]->arg, ""); + + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, unnbr_xpath + 1)) { + strlcpy(base_xpath, unnbr_xpath, sizeof(base_xpath)); + } else if (yang_dnode_exists(vty->candidate_config->dnode, + "%s%s", VTY_CURR_XPATH, + prgrp_xpath + 1)) { + strlcpy(base_xpath, prgrp_xpath, sizeof(base_xpath)); } else { - vty_out(vty, "%% Create the peer-group first\n"); + vty_out(vty, + "%% Create the peer-group or interface first\n"); return CMD_WARNING_CONFIG_FAILED; } - } else { - peer = peer_lookup(bgp, &su); - if (peer) { - if (peer_dynamic_neighbor(peer)) { - vty_out(vty, - "%% Operation not allowed on a dynamic neighbor\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - other = peer->doppelganger; - - if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)) - bgp_zebra_terminate_radv(peer->bgp, peer); - - peer_notify_unconfig(peer); - peer_delete(peer); - if (other && other->status != Deleted) { - peer_notify_unconfig(other); - peer_delete(other); - } - } } - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, base_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); } -DEFUN (no_neighbor_interface_config, - no_neighbor_interface_config_cmd, - "no neighbor WORD interface [v6only] [peer-group PGNAME] [remote-as <(1-4294967295)|internal|external>]", - NO_STR - NEIGHBOR_STR - "Interface name\n" - "Configure BGP on interface\n" - "Enable BGP with v6 link-local only\n" - "Member of the peer-group\n" - "Peer-group name\n" - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG(no_neighbor_interface_config, + no_neighbor_interface_config_cmd, + "no neighbor WORD interface [v6only] [peer-group PGNAME] [remote-as <(1-4294967295)|internal|external>]", + NO_STR NEIGHBOR_STR + "Interface name\n" + "Configure BGP on interface\n" + "Enable BGP with v6 link-local only\n" + "Member of the peer-group\n" + "Peer-group name\n" + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_word = 2; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; - /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if(bgp, argv[idx_word]->arg); - if (peer) { - /* Request zebra to terminate IPv6 RAs on this interface. */ - if (peer->ifp) - bgp_zebra_terminate_radv(peer->bgp, peer); - peer_notify_unconfig(peer); - peer_delete(peer); - } else { - vty_out(vty, "%% Create the bgp interface first\n"); - return CMD_WARNING_CONFIG_FAILED; - } - return CMD_SUCCESS; + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_word]->arg, ""); + + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_peer_group, - no_neighbor_peer_group_cmd, - "no neighbor WORD peer-group", - NO_STR - NEIGHBOR_STR - "Neighbor tag\n" - "Configure peer-group\n") +DEFUN_YANG(no_neighbor_peer_group, + no_neighbor_peer_group_cmd, + "no neighbor WORD peer-group", + NO_STR NEIGHBOR_STR + "Neighbor tag\n" + "Configure peer-group\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); + char base_xpath[XPATH_MAXLEN]; int idx_word = 2; - struct peer_group *group; - group = peer_group_lookup(bgp, argv[idx_word]->arg); - if (group) { - peer_group_notify_unconfig(group); - peer_group_delete(group); - } else { - vty_out(vty, "%% Create the peer-group first\n"); - return CMD_WARNING_CONFIG_FAILED; - } - return CMD_SUCCESS; + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_PEER_GROUP_XPATH, + argv[idx_word]->arg, ""); + + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_interface_peer_group_remote_as, - no_neighbor_interface_peer_group_remote_as_cmd, - "no neighbor WORD remote-as <(1-4294967295)|internal|external>", - NO_STR - NEIGHBOR_STR - "Interface name or neighbor tag\n" - "Specify a BGP neighbor\n" - AS_STR - "Internal BGP peer\n" - "External BGP peer\n") +DEFUN_YANG(no_neighbor_interface_peer_group_remote_as, + no_neighbor_interface_peer_group_remote_as_cmd, + "no neighbor WORD remote-as <(1-4294967295)|internal|external>", + NO_STR NEIGHBOR_STR + "Interface name or neighbor tag\n" + "Specify a BGP neighbor\n" AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); - int idx_word = 2; - struct peer_group *group; - struct peer *peer; + int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; + char unnbr_xpath[XPATH_MAXLEN]; + char prgrp_xpath[XPATH_MAXLEN]; - /* look up for neighbor by interface name config. */ - peer = peer_lookup_by_conf_if(bgp, argv[idx_word]->arg); - if (peer) { - peer_as_change(peer, 0, AS_UNSPECIFIED); - return CMD_SUCCESS; - } + snprintf(unnbr_xpath, sizeof(unnbr_xpath), FRR_BGP_NEIGHBOR_UNNUM_XPATH, + argv[idx_peer]->arg, ""); - group = peer_group_lookup(bgp, argv[idx_word]->arg); - if (group) - peer_group_remote_as_delete(group); - else { + snprintf(prgrp_xpath, sizeof(prgrp_xpath), FRR_BGP_PEER_GROUP_XPATH, + argv[idx_peer]->arg, ""); + + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, unnbr_xpath + 1)) { + strlcpy(base_xpath, unnbr_xpath, sizeof(base_xpath)); + } else if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, prgrp_xpath + 1)) { + strlcpy(base_xpath, prgrp_xpath, sizeof(base_xpath)); + } else { vty_out(vty, "%% Create the peer-group or interface first\n"); return CMD_WARNING_CONFIG_FAILED; } - return CMD_SUCCESS; + + strlcat(base_xpath, "/neighbor-remote-as/remote-as-type", + sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, base_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); } -DEFUN (neighbor_local_as, - neighbor_local_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n") +DEFUN_YANG(neighbor_local_as, + neighbor_local_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Specify a local-as number\n" + "AS number used as local AS\n") { int idx_peer = 1; int idx_number = 3; - struct peer *peer; - int ret; - as_t as; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - as = strtoul(argv[idx_number]->arg, NULL, 10); - ret = peer_local_as_set(peer, as, 0, 0); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./local-as/local-as", NB_OP_MODIFY, + argv[idx_number]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_local_as_no_prepend, - neighbor_local_as_no_prepend_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n" - "Do not prepend local-as to updates from ebgp peers\n") +DEFUN_YANG( + neighbor_local_as_no_prepend, neighbor_local_as_no_prepend_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Specify a local-as number\n" + "AS number used as local AS\n" + "Do not prepend local-as to updates from ebgp peers\n") { int idx_peer = 1; int idx_number = 3; - struct peer *peer; - int ret; - as_t as; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - as = strtoul(argv[idx_number]->arg, NULL, 10); - ret = peer_local_as_set(peer, as, 1, 0); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./local-as/local-as", NB_OP_MODIFY, + argv[idx_number]->arg); + nb_cli_enqueue_change(vty, "./local-as/no-prepend", NB_OP_MODIFY, + "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_local_as_no_prepend_replace_as, - neighbor_local_as_no_prepend_replace_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n" - "Do not prepend local-as to updates from ebgp peers\n" - "Do not prepend local-as to updates from ibgp peers\n") +DEFUN_YANG( + neighbor_local_as_no_prepend_replace_as, + neighbor_local_as_no_prepend_replace_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Specify a local-as number\n" + "AS number used as local AS\n" + "Do not prepend local-as to updates from ebgp peers\n" + "Do not prepend local-as to updates from ibgp peers\n") { int idx_peer = 1; int idx_number = 3; - struct peer *peer; - int ret; - as_t as; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - as = strtoul(argv[idx_number]->arg, NULL, 10); - ret = peer_local_as_set(peer, as, 1, 1); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./local-as/local-as", NB_OP_MODIFY, + argv[idx_number]->arg); + nb_cli_enqueue_change(vty, "./local-as/no-prepend", NB_OP_MODIFY, + "true"); + nb_cli_enqueue_change(vty, "./local-as/no-replace-as", NB_OP_MODIFY, + "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_local_as, - no_neighbor_local_as_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Specify a local-as number\n" - "AS number used as local AS\n" - "Do not prepend local-as to updates from ebgp peers\n" - "Do not prepend local-as to updates from ibgp peers\n") +DEFUN_YANG(no_neighbor_local_as, + no_neighbor_local_as_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Specify a local-as number\n" + "AS number used as local AS\n" + "Do not prepend local-as to updates from ebgp peers\n" + "Do not prepend local-as to updates from ibgp peers\n") { int idx_peer = 2; - struct peer *peer; - int ret; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_local_as_unset(peer); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./local-as/local-as", NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, "./local-as/no-prepend", NB_OP_MODIFY, + "false"); + nb_cli_enqueue_change(vty, "./local-as/no-replace-as", NB_OP_MODIFY, + "false"); + + return nb_cli_apply_changes(vty, base_xpath); } @@ -4714,65 +4757,70 @@ DEFUN (no_neighbor_solo, return bgp_vty_return(vty, ret); } -DEFUN (neighbor_password, - neighbor_password_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set a password\n" - "The password\n") +DEFUN_YANG(neighbor_password, + neighbor_password_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Set a password\n" + "The password\n") { int idx_peer = 1; int idx_line = 3; - struct peer *peer; - int ret; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_password_set(peer, argv[idx_line]->arg); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./password", NB_OP_MODIFY, + argv[idx_line]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_password, - no_neighbor_password_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set a password\n" - "The password\n") +DEFUN_YANG(no_neighbor_password, + no_neighbor_password_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Set a password\n" + "The password\n") { int idx_peer = 2; - struct peer *peer; - int ret; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_password_unset(peer); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./password", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_activate, - neighbor_activate_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> activate", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enable the Address Family for this Neighbor\n") +DEFUN_YANG(neighbor_activate, + neighbor_activate_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> activate", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Enable the Address Family for this Neighbor\n") { int idx_peer = 1; - int ret; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_activate(peer, bgp_node_afi(vty), bgp_node_safi(vty)); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./enabled", NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_activate, neighbor_activate_hidden_cmd, @@ -4780,25 +4828,30 @@ ALIAS_HIDDEN(neighbor_activate, neighbor_activate_hidden_cmd, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enable the Address Family for this Neighbor\n") -DEFUN (no_neighbor_activate, - no_neighbor_activate_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> activate", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enable the Address Family for this Neighbor\n") +DEFUN_YANG(no_neighbor_activate, + no_neighbor_activate_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> activate", + NO_STR NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Enable the Address Family for this Neighbor\n") { int idx_peer = 2; - int ret; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); - /* Lookup peer. */ - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_deactivate(peer, bgp_node_afi(vty), bgp_node_safi(vty)); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./enabled", NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_activate, no_neighbor_activate_hidden_cmd, @@ -4806,63 +4859,27 @@ ALIAS_HIDDEN(no_neighbor_activate, no_neighbor_activate_hidden_cmd, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enable the Address Family for this Neighbor\n") -DEFUN (neighbor_set_peer_group, - neighbor_set_peer_group_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Member of the peer-group\n" - "Peer-group name\n") +DEFUN_YANG (neighbor_set_peer_group, + neighbor_set_peer_group_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Member of the peer-group\n" + "Peer-group name\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_peer = 1; int idx_word = 3; - int ret; - as_t as; - union sockunion su; - struct peer *peer; - struct peer_group *group; - - ret = str2sockunion(argv[idx_peer]->arg, &su); - if (ret < 0) { - peer = peer_lookup_by_conf_if(bgp, argv[idx_peer]->arg); - if (!peer) { - vty_out(vty, "%% Malformed address or name: %s\n", - argv[idx_peer]->arg); - return CMD_WARNING_CONFIG_FAILED; - } - } else { - if (peer_address_self_check(bgp, &su)) { - vty_out(vty, - "%% Can not configure the local system as neighbor\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - /* Disallow for dynamic neighbor. */ - peer = peer_lookup(bgp, &su); - if (peer && peer_dynamic_neighbor(peer)) { - vty_out(vty, - "%% Operation not allowed on a dynamic neighbor\n"); - return CMD_WARNING_CONFIG_FAILED; - } - } + char base_xpath[XPATH_MAXLEN]; - group = peer_group_lookup(bgp, argv[idx_word]->arg); - if (!group) { - vty_out(vty, "%% Configure the peer-group first\n"); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - } - - ret = peer_group_bind(bgp, &su, peer, group, &as); - if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) { - vty_out(vty, - "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external\n", - as); - return CMD_WARNING_CONFIG_FAILED; - } + nb_cli_enqueue_change(vty, "./peer-group", NB_OP_MODIFY, + argv[idx_word]->arg); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_set_peer_group, neighbor_set_peer_group_hidden_cmd, @@ -4871,39 +4888,26 @@ ALIAS_HIDDEN(neighbor_set_peer_group, neighbor_set_peer_group_hidden_cmd, "Member of the peer-group\n" "Peer-group name\n") -DEFUN (no_neighbor_set_peer_group, - no_neighbor_set_peer_group_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Member of the peer-group\n" - "Peer-group name\n") +DEFUN_YANG (no_neighbor_set_peer_group, + no_neighbor_set_peer_group_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Member of the peer-group\n" + "Peer-group name\n") { - VTY_DECLVAR_CONTEXT(bgp, bgp); int idx_peer = 2; - int idx_word = 4; - int ret; - struct peer *peer; - struct peer_group *group; + char base_xpath[XPATH_MAXLEN]; - peer = peer_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - group = peer_group_lookup(bgp, argv[idx_word]->arg); - if (!group) { - vty_out(vty, "%% Configure the peer-group first\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)) - bgp_zebra_terminate_radv(peer->bgp, peer); - - peer_notify_unconfig(peer); - ret = peer_delete(peer); + nb_cli_enqueue_change(vty, "./peer-group", NB_OP_DESTROY, NULL); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_set_peer_group, no_neighbor_set_peer_group_hidden_cmd, @@ -4955,79 +4959,136 @@ static int peer_flag_unset_vty(struct vty *vty, const char *ip_str, return peer_flag_modify_vty(vty, ip_str, flag, 0); } +int peer_flag_modify_nb(struct bgp *bgp, const char *ip_str, struct peer *peer, + uint32_t flag, bool set, char *errmsg, + size_t errmsg_len) +{ + int ret; + + /* + * If 'neighbor <interface>', then this is for directly connected peers, + * we should not accept disable-connected-check. + */ + if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { + snprintf( + errmsg, errmsg_len, + "%s is directly connected peer, cannot accept disable-connected-check\n", + ip_str); + return -1; + } + + if (!set && flag == PEER_FLAG_SHUTDOWN) + peer_tx_shutdown_message_unset(peer); + + if (set) + ret = peer_flag_set(peer, flag); + else + ret = peer_flag_unset(peer, flag); + + return bgp_nb_errmsg_return(errmsg, errmsg_len, ret); +} + /* neighbor passive. */ -DEFUN (neighbor_passive, - neighbor_passive_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> passive", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Don't send open messages to this neighbor\n") +DEFUN_YANG(neighbor_passive, + neighbor_passive_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> passive", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Don't send open messages to this neighbor\n") { int idx_peer = 1; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, PEER_FLAG_PASSIVE); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./passive-mode", NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_passive, - no_neighbor_passive_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> passive", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Don't send open messages to this neighbor\n") +DEFUN_YANG(no_neighbor_passive, + no_neighbor_passive_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> passive", + NO_STR NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Don't send open messages to this neighbor\n") { int idx_peer = 2; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, PEER_FLAG_PASSIVE); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./passive-mode", NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } /* neighbor shutdown. */ -DEFUN (neighbor_shutdown_msg, - neighbor_shutdown_msg_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Administratively shut down this neighbor\n" - "Add a shutdown message (RFC 8203)\n" - "Shutdown message\n") +DEFUN_YANG(neighbor_shutdown_msg, + neighbor_shutdown_msg_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Administratively shut down this neighbor\n" + "Add a shutdown message (RFC 8203)\n" + "Shutdown message\n") { int idx_peer = 1; + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; if (argc >= 5) { - struct peer *peer = - peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); char *message; - if (!peer) - return CMD_WARNING_CONFIG_FAILED; message = argv_concat(argv, argc, 4); - peer_tx_shutdown_message_set(peer, message); - XFREE(MTYPE_TMP, message); + nb_cli_enqueue_change(vty, "./admin-shutdown/message", + NB_OP_MODIFY, message); } - return peer_flag_set_vty(vty, argv[idx_peer]->arg, PEER_FLAG_SHUTDOWN); + nb_cli_enqueue_change(vty, "./admin-shutdown/enable", NB_OP_MODIFY, + "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -ALIAS(neighbor_shutdown_msg, neighbor_shutdown_cmd, +ALIAS_YANG(neighbor_shutdown_msg, neighbor_shutdown_cmd, "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") -DEFUN (no_neighbor_shutdown_msg, - no_neighbor_shutdown_msg_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Administratively shut down this neighbor\n" - "Remove a shutdown message (RFC 8203)\n" - "Shutdown message\n") +DEFUN_YANG(no_neighbor_shutdown_msg, + no_neighbor_shutdown_msg_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...", + NO_STR NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Administratively shut down this neighbor\n" + "Remove a shutdown message (RFC 8203)\n" + "Shutdown message\n") { int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_SHUTDOWN); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./admin-shutdown/enable", NB_OP_MODIFY, + "false"); + + return nb_cli_apply_changes(vty, base_xpath); } -ALIAS(no_neighbor_shutdown_msg, no_neighbor_shutdown_cmd, +ALIAS_YANG(no_neighbor_shutdown_msg, no_neighbor_shutdown_cmd, "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") @@ -5091,31 +5152,49 @@ DEFUN(no_neighbor_shutdown_rtt, } /* neighbor capability dynamic. */ -DEFUN (neighbor_capability_dynamic, - neighbor_capability_dynamic_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise dynamic capability to this neighbor\n") +DEFUN_YANG (neighbor_capability_dynamic, + neighbor_capability_dynamic_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise dynamic capability to this neighbor\n") { int idx_peer = 1; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_DYNAMIC_CAPABILITY); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./capability-options/dynamic-capability", + NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_capability_dynamic, - no_neighbor_capability_dynamic_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise dynamic capability to this neighbor\n") +DEFUN_YANG (no_neighbor_capability_dynamic, + no_neighbor_capability_dynamic_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise dynamic capability to this neighbor\n") { int idx_peer = 2; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_DYNAMIC_CAPABILITY); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./capability-options/dynamic-capability", + NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } /* neighbor dont-capability-negotiate */ @@ -5145,31 +5224,65 @@ DEFUN (no_neighbor_dont_capability_negotiate, } /* neighbor capability extended next hop encoding */ -DEFUN (neighbor_capability_enhe, - neighbor_capability_enhe_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise extended next-hop capability to the peer\n") +DEFUN_YANG (neighbor_capability_enhe, + neighbor_capability_enhe_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise extended next-hop capability to the peer\n") { int idx_peer = 1; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_CAPABILITY_ENHE); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change( + vty, "./capability-options/extended-nexthop-capability", + NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_capability_enhe, - no_neighbor_capability_enhe_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Advertise capability to the peer\n" - "Advertise extended next-hop capability to the peer\n") +DEFUN_YANG (no_neighbor_capability_enhe, + no_neighbor_capability_enhe_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Advertise capability to the peer\n" + "Advertise extended next-hop capability to the peer\n") { int idx_peer = 2; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_CAPABILITY_ENHE); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change( + vty, "./capability-options/extended-nexthop-capability", + NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); +} + +int peer_af_flag_modify_nb(struct peer *peer, afi_t afi, safi_t safi, + uint32_t flag, int set, char *errmsg, + size_t errmsg_len) +{ + int ret; + + if (set) + ret = peer_af_flag_set(peer, afi, safi, flag); + else + ret = peer_af_flag_unset(peer, afi, safi, flag); + + return bgp_nb_errmsg_return(errmsg, errmsg_len, ret); } static int peer_af_flag_modify_vty(struct vty *vty, const char *peer_str, @@ -5308,16 +5421,36 @@ ALIAS_HIDDEN( "Capability to SEND the ORF to this neighbor\n") /* neighbor next-hop-self. */ -DEFUN (neighbor_nexthop_self, - neighbor_nexthop_self_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Disable the next hop calculation for this neighbor\n") +DEFUN_YANG (neighbor_nexthop_self, + neighbor_nexthop_self_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Disable the next hop calculation for this neighbor\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), PEER_FLAG_NEXTHOP_SELF); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/nexthop-self/next-hop-self", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_nexthop_self, neighbor_nexthop_self_hidden_cmd, @@ -5326,18 +5459,37 @@ ALIAS_HIDDEN(neighbor_nexthop_self, neighbor_nexthop_self_hidden_cmd, "Disable the next hop calculation for this neighbor\n") /* neighbor next-hop-self. */ -DEFUN (neighbor_nexthop_self_force, - neighbor_nexthop_self_force_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Disable the next hop calculation for this neighbor\n" - "Set the next hop to self for reflected routes\n") +DEFUN_YANG(neighbor_nexthop_self_force, + neighbor_nexthop_self_force_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Disable the next hop calculation for this neighbor\n" + "Set the next hop to self for reflected routes\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_FORCE_NEXTHOP_SELF); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/nexthop-self/next-hop-self-force", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_nexthop_self_force, @@ -5354,18 +5506,36 @@ ALIAS_HIDDEN(neighbor_nexthop_self_force, "Disable the next hop calculation for this neighbor\n" "Set the next hop to self for reflected routes\n") -DEFUN (no_neighbor_nexthop_self, - no_neighbor_nexthop_self_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Disable the next hop calculation for this neighbor\n") +DEFUN_YANG (no_neighbor_nexthop_self, + no_neighbor_nexthop_self_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Disable the next hop calculation for this neighbor\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_NEXTHOP_SELF); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/nexthop-self/next-hop-self", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_nexthop_self, no_neighbor_nexthop_self_hidden_cmd, @@ -5373,19 +5543,38 @@ ALIAS_HIDDEN(no_neighbor_nexthop_self, no_neighbor_nexthop_self_hidden_cmd, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") -DEFUN (no_neighbor_nexthop_self_force, - no_neighbor_nexthop_self_force_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Disable the next hop calculation for this neighbor\n" - "Set the next hop to self for reflected routes\n") +DEFUN_YANG (no_neighbor_nexthop_self_force, + no_neighbor_nexthop_self_force_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Disable the next hop calculation for this neighbor\n" + "Set the next hop to self for reflected routes\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_FORCE_NEXTHOP_SELF); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/nexthop-self/next-hop-self-force", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_nexthop_self_force, @@ -5403,16 +5592,35 @@ ALIAS_HIDDEN(no_neighbor_nexthop_self_force, "Set the next hop to self for reflected routes\n") /* neighbor as-override */ -DEFUN (neighbor_as_override, - neighbor_as_override_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> as-override", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Override ASNs in outbound updates if aspath equals remote-as\n") +DEFUN_YANG (neighbor_as_override, + neighbor_as_override_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> as-override", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Override ASNs in outbound updates if aspath equals remote-as\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), PEER_FLAG_AS_OVERRIDE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/as-path-options/replace-peer-as", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_as_override, neighbor_as_override_hidden_cmd, @@ -5420,18 +5628,36 @@ ALIAS_HIDDEN(neighbor_as_override, neighbor_as_override_hidden_cmd, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Override ASNs in outbound updates if aspath equals remote-as\n") -DEFUN (no_neighbor_as_override, - no_neighbor_as_override_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Override ASNs in outbound updates if aspath equals remote-as\n") +DEFUN_YANG (no_neighbor_as_override, + no_neighbor_as_override_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Override ASNs in outbound updates if aspath equals remote-as\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_AS_OVERRIDE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/as-path-options/replace-peer-as", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_as_override, no_neighbor_as_override_hidden_cmd, @@ -5440,17 +5666,35 @@ ALIAS_HIDDEN(no_neighbor_as_override, no_neighbor_as_override_hidden_cmd, "Override ASNs in outbound updates if aspath equals remote-as\n") /* neighbor remove-private-AS. */ -DEFUN (neighbor_remove_private_as, - neighbor_remove_private_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n") +DEFUN_YANG (neighbor_remove_private_as, + neighbor_remove_private_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_remove_private_as, neighbor_remove_private_as_hidden_cmd, @@ -5458,18 +5702,37 @@ ALIAS_HIDDEN(neighbor_remove_private_as, neighbor_remove_private_as_hidden_cmd, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") -DEFUN (neighbor_remove_private_as_all, - neighbor_remove_private_as_all_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers\n") +DEFUN_YANG (neighbor_remove_private_as_all, + neighbor_remove_private_as_all_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Apply to all AS numbers\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_ALL); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-all", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_remove_private_as_all, @@ -5479,18 +5742,37 @@ ALIAS_HIDDEN(neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers") -DEFUN (neighbor_remove_private_as_replace_as, - neighbor_remove_private_as_replace_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Replace private ASNs with our ASN in outbound updates\n") +DEFUN_YANG (neighbor_remove_private_as_replace_as, + neighbor_remove_private_as_replace_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-replace", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_remove_private_as_replace_as, @@ -5500,19 +5782,38 @@ ALIAS_HIDDEN(neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") -DEFUN (neighbor_remove_private_as_all_replace_as, - neighbor_remove_private_as_all_replace_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers\n" - "Replace private ASNs with our ASN in outbound updates\n") +DEFUN_YANG (neighbor_remove_private_as_all_replace_as, + neighbor_remove_private_as_all_replace_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Apply to all AS numbers\n" + "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-all-replace", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -5524,18 +5825,36 @@ ALIAS_HIDDEN( "Apply to all AS numbers\n" "Replace private ASNs with our ASN in outbound updates\n") -DEFUN (no_neighbor_remove_private_as, - no_neighbor_remove_private_as_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n") +DEFUN_YANG (no_neighbor_remove_private_as, + no_neighbor_remove_private_as_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_remove_private_as, @@ -5544,19 +5863,38 @@ ALIAS_HIDDEN(no_neighbor_remove_private_as, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private ASNs in outbound updates\n") -DEFUN (no_neighbor_remove_private_as_all, - no_neighbor_remove_private_as_all_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers\n") +DEFUN_YANG (no_neighbor_remove_private_as_all, + no_neighbor_remove_private_as_all_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Apply to all AS numbers\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_ALL); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-all", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_remove_private_as_all, @@ -5566,19 +5904,38 @@ ALIAS_HIDDEN(no_neighbor_remove_private_as_all, "Remove private ASNs in outbound updates\n" "Apply to all AS numbers\n") -DEFUN (no_neighbor_remove_private_as_replace_as, - no_neighbor_remove_private_as_replace_as_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Replace private ASNs with our ASN in outbound updates\n") +DEFUN_YANG (no_neighbor_remove_private_as_replace_as, + no_neighbor_remove_private_as_replace_as_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-replace", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_remove_private_as_replace_as, @@ -5588,20 +5945,39 @@ ALIAS_HIDDEN(no_neighbor_remove_private_as_replace_as, "Remove private ASNs in outbound updates\n" "Replace private ASNs with our ASN in outbound updates\n") -DEFUN (no_neighbor_remove_private_as_all_replace_as, - no_neighbor_remove_private_as_all_replace_as_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Remove private ASNs in outbound updates\n" - "Apply to all AS numbers\n" - "Replace private ASNs with our ASN in outbound updates\n") +DEFUN_YANG (no_neighbor_remove_private_as_all_replace_as, + no_neighbor_remove_private_as_all_replace_as_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Remove private ASNs in outbound updates\n" + "Apply to all AS numbers\n" + "Replace private ASNs with our ASN in outbound updates\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/private-as/remove-private-as-all-replace", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -5615,12 +5991,12 @@ ALIAS_HIDDEN( /* neighbor send-community. */ -DEFUN (neighbor_send_community, - neighbor_send_community_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> send-community", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Send Community attribute to this neighbor\n") +DEFUN_YANG (neighbor_send_community, + neighbor_send_community_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> send-community", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Send Community attribute to this neighbor\n") { int idx_peer = 1; @@ -5634,13 +6010,13 @@ ALIAS_HIDDEN(neighbor_send_community, neighbor_send_community_hidden_cmd, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Send Community attribute to this neighbor\n") -DEFUN (no_neighbor_send_community, - no_neighbor_send_community_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Send Community attribute to this neighbor\n") +DEFUN_YANG (no_neighbor_send_community, + no_neighbor_send_community_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Send Community attribute to this neighbor\n") { int idx_peer = 2; @@ -5655,52 +6031,95 @@ ALIAS_HIDDEN(no_neighbor_send_community, no_neighbor_send_community_hidden_cmd, "Send Community attribute to this neighbor\n") /* neighbor send-community extended. */ -DEFUN (neighbor_send_community_type, - neighbor_send_community_type_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Send Community attribute to this neighbor\n" - "Send Standard and Extended Community attributes\n" - "Send Standard, Large and Extended Community attributes\n" - "Send Extended Community attributes\n" - "Send Standard Community attributes\n" - "Send Large Community attributes\n") +DEFUN_YANG (neighbor_send_community_type, + neighbor_send_community_type_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Send Community attribute to this neighbor\n" + "Send Standard and Extended Community attributes\n" + "Send Standard, Large and Extended Community attributes\n" + "Send Extended Community attributes\n" + "Send Standard Community attributes\n" + "Send Large Community attributes\n") { const char *type = argv[argc - 1]->text; char *peer_str = argv[1]->arg; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char std_xpath[XPATH_MAXLEN]; + char ext_xpath[XPATH_MAXLEN]; + char lrg_xpath[XPATH_MAXLEN]; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, peer_str); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, peer_str, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - if (strmatch(type, "standard")) - return peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY); + if (strmatch(type, "standard")) { + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); - if (strmatch(type, "extended")) - return peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY); + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "true"); + } - if (strmatch(type, "large")) - return peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_LARGE_COMMUNITY); + if (strmatch(type, "extended")) { + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "true"); + } + + if (strmatch(type, "large")) { + snprintf(lrg_xpath, sizeof(lrg_xpath), + "./%s/send-community/send-large-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, lrg_xpath, NB_OP_MODIFY, "true"); + } if (strmatch(type, "both")) { - return peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY) - | peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY); + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "true"); + + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "true"); } - return peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY) - | peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY) - | peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_LARGE_COMMUNITY); + + if (strmatch(type, "all")) { + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "true"); + + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "true"); + + snprintf(lrg_xpath, sizeof(lrg_xpath), + "./%s/send-community/send-large-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, lrg_xpath, NB_OP_MODIFY, "true"); + } + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -5714,55 +6133,96 @@ ALIAS_HIDDEN( "Send Standard Community attributes\n" "Send Large Community attributes\n") -DEFUN (no_neighbor_send_community_type, - no_neighbor_send_community_type_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Send Community attribute to this neighbor\n" - "Send Standard and Extended Community attributes\n" - "Send Standard, Large and Extended Community attributes\n" - "Send Extended Community attributes\n" - "Send Standard Community attributes\n" - "Send Large Community attributes\n") +DEFUN_YANG (no_neighbor_send_community_type, + no_neighbor_send_community_type_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Send Community attribute to this neighbor\n" + "Send Standard and Extended Community attributes\n" + "Send Standard, Large and Extended Community attributes\n" + "Send Extended Community attributes\n" + "Send Standard Community attributes\n" + "Send Large Community attributes\n") { const char *type = argv[argc - 1]->text; char *peer_str = argv[2]->arg; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char std_xpath[XPATH_MAXLEN]; + char ext_xpath[XPATH_MAXLEN]; + char lrg_xpath[XPATH_MAXLEN]; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, peer_str); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, peer_str, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - if (strmatch(type, "standard")) - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY); + if (strmatch(type, "standard")) { + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); - if (strmatch(type, "extended")) - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY); + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "false"); + } - if (strmatch(type, "large")) - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_LARGE_COMMUNITY); + if (strmatch(type, "extended")) { + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "false"); + } + + if (strmatch(type, "large")) { + snprintf(lrg_xpath, sizeof(lrg_xpath), + "./%s/send-community/send-large-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, lrg_xpath, NB_OP_MODIFY, "false"); + } if (strmatch(type, "both")) { + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY) - | peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY); + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "false"); + + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "false"); + } + + if (strmatch(type, "all")) { + snprintf(std_xpath, sizeof(std_xpath), + "./%s/send-community/send-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, std_xpath, NB_OP_MODIFY, "false"); + + snprintf(ext_xpath, sizeof(ext_xpath), + "./%s/send-community/send-ext-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, ext_xpath, NB_OP_MODIFY, "false"); + + snprintf(lrg_xpath, sizeof(lrg_xpath), + "./%s/send-community/send-large-community", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, lrg_xpath, NB_OP_MODIFY, "false"); } - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_COMMUNITY) - | peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_EXT_COMMUNITY) - | peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_SEND_LARGE_COMMUNITY); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -5778,18 +6238,35 @@ ALIAS_HIDDEN( "Send Large Community attributes\n") /* neighbor soft-reconfig. */ -DEFUN (neighbor_soft_reconfiguration, - neighbor_soft_reconfiguration_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Per neighbor soft reconfiguration\n" - "Allow inbound soft reconfiguration for this neighbor\n") +DEFUN_YANG (neighbor_soft_reconfiguration, + neighbor_soft_reconfiguration_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Per neighbor soft reconfiguration\n" + "Allow inbound soft reconfiguration for this neighbor\n") { int idx_peer = 1; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_SOFT_RECONFIG); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char soft_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(soft_xpath, sizeof(soft_xpath), "./%s/soft-reconfiguration", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, soft_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_soft_reconfiguration, @@ -5799,19 +6276,34 @@ ALIAS_HIDDEN(neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") -DEFUN (no_neighbor_soft_reconfiguration, - no_neighbor_soft_reconfiguration_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Per neighbor soft reconfiguration\n" - "Allow inbound soft reconfiguration for this neighbor\n") +DEFUN_YANG (no_neighbor_soft_reconfiguration, + no_neighbor_soft_reconfiguration_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Per neighbor soft reconfiguration\n" + "Allow inbound soft reconfiguration for this neighbor\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_SOFT_RECONFIG); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char soft_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + snprintf(soft_xpath, sizeof(soft_xpath), "./%s/soft-reconfiguration", + bgp_afi_safi_get_container_str(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, soft_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_soft_reconfiguration, @@ -5821,24 +6313,35 @@ ALIAS_HIDDEN(no_neighbor_soft_reconfiguration, "Per neighbor soft reconfiguration\n" "Allow inbound soft reconfiguration for this neighbor\n") -DEFUN (neighbor_route_reflector_client, - neighbor_route_reflector_client_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Configure a neighbor as Route Reflector client\n") +DEFUN_YANG (neighbor_route_reflector_client, + neighbor_route_reflector_client_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Configure a neighbor as Route Reflector client\n") { int idx_peer = 1; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_REFLECTOR_CLIENT); + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/route-reflector/route-reflector-client", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_route_reflector_client, @@ -5847,18 +6350,36 @@ ALIAS_HIDDEN(neighbor_route_reflector_client, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Reflector client\n") -DEFUN (no_neighbor_route_reflector_client, - no_neighbor_route_reflector_client_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Configure a neighbor as Route Reflector client\n") +DEFUN_YANG (no_neighbor_route_reflector_client, + no_neighbor_route_reflector_client_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Configure a neighbor as Route Reflector client\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_REFLECTOR_CLIENT); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/route-reflector/route-reflector-client", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_route_reflector_client, @@ -5868,22 +6389,35 @@ ALIAS_HIDDEN(no_neighbor_route_reflector_client, "Configure a neighbor as Route Reflector client\n") /* neighbor route-server-client. */ -DEFUN (neighbor_route_server_client, - neighbor_route_server_client_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Configure a neighbor as Route Server client\n") +DEFUN_YANG (neighbor_route_server_client, + neighbor_route_server_client_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Configure a neighbor as Route Server client\n") { int idx_peer = 1; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - return peer_af_flag_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), - PEER_FLAG_RSERVER_CLIENT); + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/route-server/route-server-client", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_route_server_client, @@ -5892,18 +6426,36 @@ ALIAS_HIDDEN(neighbor_route_server_client, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") -DEFUN (no_neighbor_route_server_client, - no_neighbor_route_server_client_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Configure a neighbor as Route Server client\n") +DEFUN_YANG (no_neighbor_route_server_client, + no_neighbor_route_server_client_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Configure a neighbor as Route Server client\n") { int idx_peer = 2; - return peer_af_flag_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty), - PEER_FLAG_RSERVER_CLIENT); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "./%s/route-server/route-server-client", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_route_server_client, @@ -5941,28 +6493,35 @@ DEFUN (no_neighbor_nexthop_local_unchanged, PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED); } -DEFUN (neighbor_attr_unchanged, - neighbor_attr_unchanged_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") +DEFUN_YANG (neighbor_attr_unchanged, + neighbor_attr_unchanged_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "BGP attribute is propagated unchanged to this neighbor\n" + "As-path attribute\n" + "Nexthop attribute\n" + "Med attribute\n") { int idx = 0; char *peer_str = argv[1]->arg; - struct peer *peer; bool aspath = false; bool nexthop = false; bool med = false; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - int ret = 0; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char as_xpath[XPATH_MAXLEN]; + char nxthop_xpath[XPATH_MAXLEN]; + char med_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, peer_str); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, peer_str, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; if (argv_find(argv, argc, "as-path", &idx)) @@ -5976,52 +6535,45 @@ DEFUN (neighbor_attr_unchanged, if (argv_find(argv, argc, "med", &idx)) med = true; + snprintf(as_xpath, sizeof(as_xpath), + "./%s/attr-unchanged/as-path-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + snprintf(nxthop_xpath, sizeof(nxthop_xpath), + "./%s/attr-unchanged/next-hop-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + snprintf(med_xpath, sizeof(med_xpath), + "./%s/attr-unchanged/med-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + /* no flags means all of them! */ if (!aspath && !nexthop && !med) { - ret = peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED); - ret |= peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED); - ret |= peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_MED_UNCHANGED); + nb_cli_enqueue_change(vty, as_xpath, NB_OP_MODIFY, "true"); + nb_cli_enqueue_change(vty, nxthop_xpath, NB_OP_MODIFY, "true"); + nb_cli_enqueue_change(vty, med_xpath, NB_OP_MODIFY, "true"); } else { - if (!aspath) { - if (peer_af_flag_check(peer, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED)) { - ret |= peer_af_flag_unset_vty( - vty, peer_str, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED); - } - } else - ret |= peer_af_flag_set_vty( - vty, peer_str, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED); - - if (!nexthop) { - if (peer_af_flag_check(peer, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED)) { - ret |= peer_af_flag_unset_vty( - vty, peer_str, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED); - } - } else - ret |= peer_af_flag_set_vty( - vty, peer_str, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED); + if (!aspath) + nb_cli_enqueue_change(vty, as_xpath, NB_OP_MODIFY, + "false"); + else + nb_cli_enqueue_change(vty, as_xpath, NB_OP_MODIFY, + "true"); - if (!med) { - if (peer_af_flag_check(peer, afi, safi, - PEER_FLAG_MED_UNCHANGED)) { - ret |= peer_af_flag_unset_vty( - vty, peer_str, afi, safi, - PEER_FLAG_MED_UNCHANGED); - } - } else - ret |= peer_af_flag_set_vty(vty, peer_str, afi, safi, - PEER_FLAG_MED_UNCHANGED); + if (!nexthop) + nb_cli_enqueue_change(vty, nxthop_xpath, NB_OP_MODIFY, + "false"); + else + nb_cli_enqueue_change(vty, nxthop_xpath, NB_OP_MODIFY, + "true"); + + if (!med) + nb_cli_enqueue_change(vty, med_xpath, NB_OP_MODIFY, + "false"); + else + nb_cli_enqueue_change(vty, med_xpath, NB_OP_MODIFY, + "true"); } - return ret; + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -6033,29 +6585,36 @@ ALIAS_HIDDEN( "Nexthop attribute\n" "Med attribute\n") -DEFUN (no_neighbor_attr_unchanged, - no_neighbor_attr_unchanged_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP attribute is propagated unchanged to this neighbor\n" - "As-path attribute\n" - "Nexthop attribute\n" - "Med attribute\n") +DEFUN_YANG (no_neighbor_attr_unchanged, + no_neighbor_attr_unchanged_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "BGP attribute is propagated unchanged to this neighbor\n" + "As-path attribute\n" + "Nexthop attribute\n" + "Med attribute\n") { int idx = 0; char *peer_str = argv[2]->arg; - struct peer *peer; bool aspath = false; bool nexthop = false; bool med = false; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - int ret = 0; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char as_xpath[XPATH_MAXLEN]; + char nxthop_xpath[XPATH_MAXLEN]; + char med_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, peer_str); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, peer_str, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; if (argv_find(argv, argc, "as-path", &idx)) @@ -6069,27 +6628,33 @@ DEFUN (no_neighbor_attr_unchanged, if (argv_find(argv, argc, "med", &idx)) med = true; - if (!aspath && !nexthop && !med) // no flags means all of them! - return peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED) - | peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED) - | peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_MED_UNCHANGED); + snprintf(as_xpath, sizeof(as_xpath), + "./%s/attr-unchanged/as-path-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + snprintf(nxthop_xpath, sizeof(nxthop_xpath), + "./%s/attr-unchanged/next-hop-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + snprintf(med_xpath, sizeof(med_xpath), + "./%s/attr-unchanged/med-unchanged", + bgp_afi_safi_get_container_str(afi, safi)); + + /* no flags means all of them! */ + if (!aspath && !nexthop && !med) { + nb_cli_enqueue_change(vty, as_xpath, NB_OP_MODIFY, "false"); + nb_cli_enqueue_change(vty, nxthop_xpath, NB_OP_MODIFY, "false"); + nb_cli_enqueue_change(vty, med_xpath, NB_OP_MODIFY, "false"); + } if (aspath) - ret |= peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_AS_PATH_UNCHANGED); + nb_cli_enqueue_change(vty, as_xpath, NB_OP_MODIFY, "false"); if (nexthop) - ret |= peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_NEXTHOP_UNCHANGED); + nb_cli_enqueue_change(vty, nxthop_xpath, NB_OP_MODIFY, "false"); if (med) - ret |= peer_af_flag_unset_vty(vty, peer_str, afi, safi, - PEER_FLAG_MED_UNCHANGED); + nb_cli_enqueue_change(vty, med_xpath, NB_OP_MODIFY, "false"); - return ret; + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -6101,251 +6666,318 @@ ALIAS_HIDDEN( "Nexthop attribute\n" "Med attribute\n") -/* EBGP multihop configuration. */ -static int peer_ebgp_multihop_set_vty(struct vty *vty, const char *ip_str, - const char *ttl_str) +/* neighbor ebgp-multihop. */ +DEFUN_YANG (neighbor_ebgp_multihop, + neighbor_ebgp_multihop_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Allow EBGP neighbors not on directly connected networks\n") { - struct peer *peer; - unsigned int ttl; + int idx_peer = 1; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - if (peer->conf_if) - return bgp_vty_return(vty, BGP_ERR_INVALID_FOR_DIRECT_PEER); - - if (!ttl_str) - ttl = MAXTTL; - else - ttl = strtoul(ttl_str, NULL, 10); + nb_cli_enqueue_change(vty, "./ebgp-multihop/enabled", NB_OP_MODIFY, + "true"); - return bgp_vty_return(vty, peer_ebgp_multihop_set(peer, ttl)); + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_ebgp_multihop_unset_vty(struct vty *vty, const char *ip_str) +DEFUN_YANG (neighbor_ebgp_multihop_ttl, + neighbor_ebgp_multihop_ttl_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Allow EBGP neighbors not on directly connected networks\n" + "maximum hop count\n") { - struct peer *peer; + int idx_peer = 1; + int idx_number = 3; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - return bgp_vty_return(vty, peer_ebgp_multihop_unset(peer)); -} - -/* neighbor ebgp-multihop. */ -DEFUN (neighbor_ebgp_multihop, - neighbor_ebgp_multihop_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Allow EBGP neighbors not on directly connected networks\n") -{ - int idx_peer = 1; - return peer_ebgp_multihop_set_vty(vty, argv[idx_peer]->arg, NULL); -} + nb_cli_enqueue_change(vty, "./ebgp-multihop/multihop-ttl", NB_OP_MODIFY, + argv[idx_number]->arg); -DEFUN (neighbor_ebgp_multihop_ttl, - neighbor_ebgp_multihop_ttl_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Allow EBGP neighbors not on directly connected networks\n" - "maximum hop count\n") -{ - int idx_peer = 1; - int idx_number = 3; - return peer_ebgp_multihop_set_vty(vty, argv[idx_peer]->arg, - argv[idx_number]->arg); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_ebgp_multihop, - no_neighbor_ebgp_multihop_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Allow EBGP neighbors not on directly connected networks\n" - "maximum hop count\n") +DEFUN_YANG (no_neighbor_ebgp_multihop, + no_neighbor_ebgp_multihop_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Allow EBGP neighbors not on directly connected networks\n" + "maximum hop count\n") { int idx_peer = 2; - return peer_ebgp_multihop_unset_vty(vty, argv[idx_peer]->arg); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + if (argc > 4) + nb_cli_enqueue_change(vty, "./ebgp-multihop/multihop-ttl", + NB_OP_DESTROY, NULL); + else + nb_cli_enqueue_change(vty, "./ebgp-multihop/enabled", + NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } /* disable-connected-check */ -DEFUN (neighbor_disable_connected_check, - neighbor_disable_connected_check_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "one-hop away EBGP peer using loopback address\n" - "Enforce EBGP neighbors perform multihop\n") +DEFUN_YANG (neighbor_disable_connected_check, + neighbor_disable_connected_check_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "one-hop away EBGP peer using loopback address\n" + "Enforce EBGP neighbors perform multihop\n") { int idx_peer = 1; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_DISABLE_CONNECTED_CHECK); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./ebgp-multihop/disable-connected-check", + NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_disable_connected_check, - no_neighbor_disable_connected_check_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "one-hop away EBGP peer using loopback address\n" - "Enforce EBGP neighbors perform multihop\n") +DEFUN_YANG (no_neighbor_disable_connected_check, + no_neighbor_disable_connected_check_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "one-hop away EBGP peer using loopback address\n" + "Enforce EBGP neighbors perform multihop\n") { int idx_peer = 2; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_DISABLE_CONNECTED_CHECK); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./ebgp-multihop/disable-connected-check", + NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } /* enforce-first-as */ -DEFUN (neighbor_enforce_first_as, - neighbor_enforce_first_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enforce the first AS for EBGP routes\n") +DEFUN_YANG (neighbor_enforce_first_as, + neighbor_enforce_first_as_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Enforce the first AS for EBGP routes\n") { int idx_peer = 1; + char base_xpath[XPATH_MAXLEN]; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_ENFORCE_FIRST_AS); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./enforce-first-as", NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_enforce_first_as, - no_neighbor_enforce_first_as_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Enforce the first AS for EBGP routes\n") +DEFUN_YANG (no_neighbor_enforce_first_as, + no_neighbor_enforce_first_as_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-first-as", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Enforce the first AS for EBGP routes\n") { int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_ENFORCE_FIRST_AS); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./enforce-first-as", NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } +static int peer_and_group_lookup_nb(struct vty *vty, const char *peer_str, + char *base_xpath, int xpath_len, + char *xpath) +{ + union sockunion su; + char num_xpath[XPATH_MAXLEN]; + char unnbr_xpath[XPATH_MAXLEN]; + char prgrp_xpath[XPATH_MAXLEN]; + + if (str2sockunion(peer_str, &su) == 0) { + snprintf(num_xpath, sizeof(num_xpath), + "/neighbors/neighbor[remote-address='%s']", peer_str); + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, num_xpath)) { + snprintf(base_xpath, xpath_len, + FRR_BGP_NEIGHBOR_NUM_XPATH, peer_str, + xpath ? xpath : ""); + } else { + vty_out(vty, + "%% Specify remote-as or peer-group commands first\n"); + return -1; + } -DEFUN (neighbor_description, - neighbor_description_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Neighbor specific description\n" - "Up to 80 characters describing this neighbor\n") + } else { + snprintf(unnbr_xpath, sizeof(unnbr_xpath), + "/neighbors/unnumbered-neighbor[interface='%s']", + peer_str); + + snprintf(prgrp_xpath, sizeof(prgrp_xpath), + "/peer-groups/peer-group[peer-group-name='%s']", + peer_str); + + if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, unnbr_xpath)) { + snprintf(base_xpath, xpath_len, + FRR_BGP_NEIGHBOR_UNNUM_XPATH, peer_str, + xpath ? xpath : ""); + } else if (yang_dnode_exists(vty->candidate_config->dnode, + "%s%s", VTY_CURR_XPATH, + prgrp_xpath)) { + snprintf(base_xpath, xpath_len, + FRR_BGP_PEER_GROUP_XPATH, peer_str, + xpath ? xpath : ""); + } else { + vty_out(vty, + "%% Create the peer-group or interface first\n"); + return -1; + } + } + + return 0; +} + +DEFUN_YANG (neighbor_description, + neighbor_description_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Neighbor specific description\n" + "Up to 80 characters describing this neighbor\n") { int idx_peer = 1; int idx_line = 3; - struct peer *peer; + int ret; + char base_xpath[XPATH_MAXLEN]; char *str; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; str = argv_concat(argv, argc, idx_line); - peer_description_set(peer, str); + nb_cli_enqueue_change(vty, "./description", NB_OP_MODIFY, str); + + ret = nb_cli_apply_changes(vty, base_xpath); XFREE(MTYPE_TMP, str); - return CMD_SUCCESS; + return ret; } -DEFUN (no_neighbor_description, - no_neighbor_description_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> description", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Neighbor specific description\n") +DEFUN_YANG (no_neighbor_description, + no_neighbor_description_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> description", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Neighbor specific description\n") { int idx_peer = 2; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - peer_description_unset(peer); + nb_cli_enqueue_change(vty, "./description", NB_OP_DESTROY, NULL); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, base_xpath); } -ALIAS(no_neighbor_description, no_neighbor_description_comment_cmd, +ALIAS_YANG(no_neighbor_description, no_neighbor_description_comment_cmd, "no neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Neighbor specific description\n" "Up to 80 characters describing this neighbor\n") -/* Neighbor update-source. */ -static int peer_update_source_vty(struct vty *vty, const char *peer_str, - const char *source_str) -{ - struct peer *peer; - struct prefix p; - union sockunion su; - - peer = peer_and_group_lookup_vty(vty, peer_str); - if (!peer) - return CMD_WARNING_CONFIG_FAILED; - - if (peer->conf_if) - return CMD_WARNING; - - if (source_str) { - if (str2sockunion(source_str, &su) == 0) - peer_update_source_addr_set(peer, &su); - else { - if (str2prefix(source_str, &p)) { - vty_out(vty, - "%% Invalid update-source, remove prefix length \n"); - return CMD_WARNING_CONFIG_FAILED; - } else - peer_update_source_if_set(peer, source_str); - } - } else - peer_update_source_unset(peer); - - return CMD_SUCCESS; -} - #define BGP_UPDATE_SOURCE_HELP_STR \ "IPv4 address\n" \ "IPv6 address\n" \ "Interface name (requires zebra to be running)\n" -DEFUN (neighbor_update_source, - neighbor_update_source_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Source of routing updates\n" - BGP_UPDATE_SOURCE_HELP_STR) +DEFUN_YANG (neighbor_update_source, + neighbor_update_source_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Source of routing updates\n" + BGP_UPDATE_SOURCE_HELP_STR) { int idx_peer = 1; int idx_peer_2 = 3; - return peer_update_source_vty(vty, argv[idx_peer]->arg, + union sockunion su; + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + if (str2sockunion(argv[idx_peer_2]->arg, &su) == 0) + nb_cli_enqueue_change(vty, "./update-source/ip", NB_OP_MODIFY, argv[idx_peer_2]->arg); + else + nb_cli_enqueue_change(vty, "./update-source/interface", + NB_OP_MODIFY, argv[idx_peer_2]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_update_source, - no_neighbor_update_source_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Source of routing updates\n" - BGP_UPDATE_SOURCE_HELP_STR) +DEFUN_YANG (no_neighbor_update_source, + no_neighbor_update_source_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]", + NO_STR NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Source of routing updates\n" + BGP_UPDATE_SOURCE_HELP_STR) { int idx_peer = 2; - return peer_update_source_vty(vty, argv[idx_peer]->arg, NULL); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./update-source/ip", NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, "./update-source/interface", NB_OP_DESTROY, + NULL); + + return nb_cli_apply_changes(vty, base_xpath); } static int peer_default_originate_set_vty(struct vty *vty, const char *peer_str, @@ -6440,103 +7072,76 @@ ALIAS_HIDDEN( "route-map name\n") -/* Set neighbor's BGP port. */ -static int peer_port_vty(struct vty *vty, const char *ip_str, int afi, - const char *port_str) -{ - struct peer *peer; - uint16_t port; - struct servent *sp; - - peer = peer_lookup_vty(vty, ip_str); - if (!peer) - return CMD_WARNING_CONFIG_FAILED; - - if (!port_str) { - sp = getservbyname("bgp", "tcp"); - port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs(sp->s_port); - } else { - port = strtoul(port_str, NULL, 10); - } - - peer_port_set(peer, port); - - return CMD_SUCCESS; -} - /* Set specified peer's BGP port. */ -DEFUN (neighbor_port, - neighbor_port_cmd, - "neighbor <A.B.C.D|X:X::X:X> port (0-65535)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Neighbor's BGP port\n" - "TCP port number\n") +DEFUN_YANG (neighbor_port, + neighbor_port_cmd, + "neighbor <A.B.C.D|X:X::X:X> port (0-65535)", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR + "Neighbor's BGP port\n" + "TCP port number\n") { int idx_ip = 1; int idx_number = 3; - return peer_port_vty(vty, argv[idx_ip]->arg, AFI_IP, - argv[idx_number]->arg); -} + char base_xpath[XPATH_MAXLEN]; -DEFUN (no_neighbor_port, - no_neighbor_port_cmd, - "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Neighbor's BGP port\n" - "TCP port number\n") -{ - int idx_ip = 2; - return peer_port_vty(vty, argv[idx_ip]->arg, AFI_IP, NULL); -} + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_NUM_XPATH, + argv[idx_ip]->arg, ""); + nb_cli_enqueue_change(vty, "./local-port", NB_OP_MODIFY, + argv[idx_number]->arg); -/* neighbor weight. */ -static int peer_weight_set_vty(struct vty *vty, const char *ip_str, afi_t afi, - safi_t safi, const char *weight_str) + return nb_cli_apply_changes(vty, base_xpath); +} + +DEFUN_YANG (no_neighbor_port, + no_neighbor_port_cmd, + "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR + "Neighbor's BGP port\n" + "TCP port number\n") { - int ret; - struct peer *peer; - unsigned long weight; + int idx_ip = 2; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) - return CMD_WARNING_CONFIG_FAILED; + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_NUM_XPATH, + argv[idx_ip]->arg, ""); - weight = strtoul(weight_str, NULL, 10); + nb_cli_enqueue_change(vty, "./local-port", NB_OP_DESTROY, NULL); - ret = peer_weight_set(peer, afi, safi, weight); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_weight_unset_vty(struct vty *vty, const char *ip_str, afi_t afi, - safi_t safi) +DEFUN_YANG (neighbor_weight, + neighbor_weight_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Set default weight for routes from this neighbor\n" + "default weight\n") { - int ret; - struct peer *peer; + int idx_peer = 1; + int idx_number = 3; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_weight_unset(peer, afi, safi); - return bgp_vty_return(vty, ret); -} + snprintf(attr_xpath, sizeof(attr_xpath), "./%s/weight/weight-attribute", + bgp_afi_safi_get_container_str(afi, safi)); -DEFUN (neighbor_weight, - neighbor_weight_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set default weight for routes from this neighbor\n" - "default weight\n") -{ - int idx_peer = 1; - int idx_number = 3; - return peer_weight_set_vty(vty, argv[idx_peer]->arg, bgp_node_afi(vty), - bgp_node_safi(vty), argv[idx_number]->arg); + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_MODIFY, + argv[idx_number]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_weight, neighbor_weight_hidden_cmd, @@ -6545,18 +7150,34 @@ ALIAS_HIDDEN(neighbor_weight, neighbor_weight_hidden_cmd, "Set default weight for routes from this neighbor\n" "default weight\n") -DEFUN (no_neighbor_weight, - no_neighbor_weight_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Set default weight for routes from this neighbor\n" - "default weight\n") +DEFUN_YANG (no_neighbor_weight, + no_neighbor_weight_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Set default weight for routes from this neighbor\n" + "default weight\n") { int idx_peer = 2; - return peer_weight_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), bgp_node_safi(vty)); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), "./%s/weight/weight-attribute", + bgp_afi_safi_get_container_str(afi, safi)); + + nb_cli_enqueue_change(vty, attr_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(no_neighbor_weight, no_neighbor_weight_hidden_cmd, @@ -6567,233 +7188,232 @@ ALIAS_HIDDEN(no_neighbor_weight, no_neighbor_weight_hidden_cmd, /* Override capability negotiation. */ -DEFUN (neighbor_override_capability, - neighbor_override_capability_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Override capability negotiation result\n") +DEFUN_YANG (neighbor_override_capability, + neighbor_override_capability_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Override capability negotiation result\n") { int idx_peer = 1; - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_OVERRIDE_CAPABILITY); -} + char base_xpath[XPATH_MAXLEN]; -DEFUN (no_neighbor_override_capability, - no_neighbor_override_capability_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Override capability negotiation result\n") -{ - int idx_peer = 2; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_OVERRIDE_CAPABILITY); -} + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; -DEFUN (neighbor_strict_capability, - neighbor_strict_capability_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Strict capability negotiation match\n") -{ - int idx_peer = 1; + nb_cli_enqueue_change( + vty, "./capability-options/override-capability", + NB_OP_MODIFY, "true"); - return peer_flag_set_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_STRICT_CAP_MATCH); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_strict_capability, - no_neighbor_strict_capability_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Strict capability negotiation match\n") +DEFUN_YANG (no_neighbor_override_capability, + no_neighbor_override_capability_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Override capability negotiation result\n") { int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - return peer_flag_unset_vty(vty, argv[idx_peer]->arg, - PEER_FLAG_STRICT_CAP_MATCH); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change( + vty, "./capability-options/override-capability", + NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_timers_set_vty(struct vty *vty, const char *ip_str, - const char *keep_str, const char *hold_str) +DEFUN_YANG (neighbor_strict_capability, + neighbor_strict_capability_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Strict capability negotiation match\n") { - int ret; - struct peer *peer; - uint32_t keepalive; - uint32_t holdtime; + int idx_peer = 1; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - keepalive = strtoul(keep_str, NULL, 10); - holdtime = strtoul(hold_str, NULL, 10); - - ret = peer_timers_set(peer, keepalive, holdtime); + nb_cli_enqueue_change( + vty, "./capability-options/strict-capability", + NB_OP_MODIFY, "true"); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_timers_unset_vty(struct vty *vty, const char *ip_str) +DEFUN_YANG (no_neighbor_strict_capability, + no_neighbor_strict_capability_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match", + NO_STR + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "Strict capability negotiation match\n") { - int ret; - struct peer *peer; + int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_timers_unset(peer); + nb_cli_enqueue_change( + vty, "./capability-options/strict-capability", + NB_OP_MODIFY, "false"); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_timers, - neighbor_timers_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "Keepalive interval\n" - "Holdtime\n") +DEFUN_YANG (neighbor_timers, + neighbor_timers_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP per neighbor timers\n" + "Keepalive interval\n" + "Holdtime\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; - return peer_timers_set_vty(vty, argv[idx_peer]->arg, - argv[idx_number]->arg, - argv[idx_number_2]->arg); -} - -DEFUN (no_neighbor_timers, - no_neighbor_timers_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "Keepalive interval\n" - "Holdtime\n") -{ - int idx_peer = 2; - return peer_timers_unset_vty(vty, argv[idx_peer]->arg); -} - - -static int peer_timers_connect_set_vty(struct vty *vty, const char *ip_str, - const char *time_str) -{ - int ret; - struct peer *peer; - uint32_t connect; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - connect = strtoul(time_str, NULL, 10); + nb_cli_enqueue_change(vty, "./timers/keepalive", NB_OP_MODIFY, + argv[idx_number]->arg); - ret = peer_timers_connect_set(peer, connect); + nb_cli_enqueue_change(vty, "./timers/hold-time", NB_OP_MODIFY, + argv[idx_number_2]->arg); - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } -static int peer_timers_connect_unset_vty(struct vty *vty, const char *ip_str) +DEFUN_YANG (no_neighbor_timers, + no_neighbor_timers_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP per neighbor timers\n" + "Keepalive interval\n" + "Holdtime\n") { - int ret; - struct peer *peer; + int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - ret = peer_timers_connect_unset(peer); + nb_cli_enqueue_change(vty, "./timers/hold-time", NB_OP_DESTROY, NULL); - return bgp_vty_return(vty, ret); + nb_cli_enqueue_change(vty, "./timers/keepalive", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_timers_connect, - neighbor_timers_connect_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "BGP connect timer\n" - "Connect timer\n") +DEFUN_YANG (neighbor_timers_connect, + neighbor_timers_connect_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP per neighbor timers\n" + "BGP connect timer\n" + "Connect timer\n") { int idx_peer = 1; int idx_number = 4; - return peer_timers_connect_set_vty(vty, argv[idx_peer]->arg, - argv[idx_number]->arg); -} + char base_xpath[XPATH_MAXLEN]; -DEFUN (no_neighbor_timers_connect, - no_neighbor_timers_connect_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP per neighbor timers\n" - "BGP connect timer\n" - "Connect timer\n") -{ - int idx_peer = 2; - return peer_timers_connect_unset_vty(vty, argv[idx_peer]->arg); -} + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + nb_cli_enqueue_change(vty, "./timers/connect-time", NB_OP_MODIFY, + argv[idx_number]->arg); -static int peer_advertise_interval_vty(struct vty *vty, const char *ip_str, - const char *time_str, int set) + return nb_cli_apply_changes(vty, base_xpath); +} + +DEFUN_YANG (no_neighbor_timers_connect, + no_neighbor_timers_connect_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP per neighbor timers\n" + "BGP connect timer\n" + "Connect timer\n") { - int ret; - struct peer *peer; - uint32_t routeadv = 0; + int idx_peer = 2; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - if (time_str) - routeadv = strtoul(time_str, NULL, 10); + nb_cli_enqueue_change(vty, "./timers/connect-time", NB_OP_DESTROY, + NULL); - if (set) - ret = peer_advertise_interval_set(peer, routeadv); - else - ret = peer_advertise_interval_unset(peer); - - return bgp_vty_return(vty, ret); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (neighbor_advertise_interval, - neighbor_advertise_interval_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Minimum interval between sending BGP routing updates\n" - "time in seconds\n") +DEFUN_YANG (neighbor_advertise_interval, + neighbor_advertise_interval_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Minimum interval between sending BGP routing updates\n" + "time in seconds\n") { int idx_peer = 1; int idx_number = 3; - return peer_advertise_interval_vty(vty, argv[idx_peer]->arg, - argv[idx_number]->arg, 1); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./timers/advertise-interval", NB_OP_MODIFY, + argv[idx_number]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_advertise_interval, - no_neighbor_advertise_interval_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Minimum interval between sending BGP routing updates\n" - "time in seconds\n") +DEFUN_YANG (no_neighbor_advertise_interval, + no_neighbor_advertise_interval_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Minimum interval between sending BGP routing updates\n" + "time in seconds\n") { int idx_peer = 2; - return peer_advertise_interval_vty(vty, argv[idx_peer]->arg, NULL, 0); + char base_xpath[XPATH_MAXLEN]; + + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + nb_cli_enqueue_change(vty, "./timers/advertise-interval", NB_OP_DESTROY, + NULL); + + return nb_cli_apply_changes(vty, base_xpath); } @@ -6845,50 +7465,42 @@ DEFUN (no_bgp_set_route_map_delay_timer, return CMD_SUCCESS; } -/* neighbor interface */ -static int peer_interface_vty(struct vty *vty, const char *ip_str, - const char *str) +DEFUN_YANG (neighbor_interface, + neighbor_interface_cmd, + "neighbor <A.B.C.D|X:X::X:X> interface WORD", + NEIGHBOR_STR NEIGHBOR_ADDR_STR + "Interface\n" + "Interface name\n") { - struct peer *peer; - - peer = peer_lookup_vty(vty, ip_str); - if (!peer || peer->conf_if) { - vty_out(vty, "%% BGP invalid peer %s\n", ip_str); - return CMD_WARNING_CONFIG_FAILED; - } + int idx_ip = 1; + int idx_word = 3; + char base_xpath[XPATH_MAXLEN]; - if (str) - peer_interface_set(peer, str); - else - peer_interface_unset(peer); + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_NUM_XPATH, + argv[idx_ip]->arg, ""); - return CMD_SUCCESS; -} + nb_cli_enqueue_change(vty, "./local-interface", NB_OP_MODIFY, + argv[idx_word]->arg); -DEFUN (neighbor_interface, - neighbor_interface_cmd, - "neighbor <A.B.C.D|X:X::X:X> interface WORD", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR - "Interface\n" - "Interface name\n") -{ - int idx_ip = 1; - int idx_word = 3; - return peer_interface_vty(vty, argv[idx_ip]->arg, argv[idx_word]->arg); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_interface, - no_neighbor_interface_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Interface\n" - "Interface name\n") +DEFUN_YANG (no_neighbor_interface, + no_neighbor_interface_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Interface\n" + "Interface name\n") { int idx_peer = 2; - return peer_interface_vty(vty, argv[idx_peer]->arg, NULL); + char base_xpath[XPATH_MAXLEN]; + + snprintf(base_xpath, sizeof(base_xpath), FRR_BGP_NEIGHBOR_NUM_XPATH, + argv[idx_peer]->arg, ""); + + nb_cli_enqueue_change(vty, "./local-interface", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } DEFUN (neighbor_distribute_list, @@ -7415,129 +8027,113 @@ ALIAS_HIDDEN(no_neighbor_unsuppress_map, no_neighbor_unsuppress_map_hidden_cmd, "Route-map to selectively unsuppress suppressed routes\n" "Name of route map\n") -static int peer_maximum_prefix_set_vty(struct vty *vty, const char *ip_str, - afi_t afi, safi_t safi, - const char *num_str, - const char *threshold_str, int warning, - const char *restart_str, - const char *force_str) -{ - int ret; - struct peer *peer; - uint32_t max; - uint8_t threshold; - uint16_t restart; - - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) - return CMD_WARNING_CONFIG_FAILED; - - max = strtoul(num_str, NULL, 10); - if (threshold_str) - threshold = atoi(threshold_str); - else - threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; - - if (restart_str) - restart = atoi(restart_str); - else - restart = 0; - - ret = peer_maximum_prefix_set(peer, afi, safi, max, threshold, warning, - restart, force_str ? true : false); - - return bgp_vty_return(vty, ret); -} - -static int peer_maximum_prefix_unset_vty(struct vty *vty, const char *ip_str, - afi_t afi, safi_t safi) -{ - int ret; - struct peer *peer; - - peer = peer_and_group_lookup_vty(vty, ip_str); - if (!peer) - return CMD_WARNING_CONFIG_FAILED; - - ret = peer_maximum_prefix_unset(peer, afi, safi); - - return bgp_vty_return(vty, ret); -} - /* Maximum number of prefix to be sent to the neighbor. */ -DEFUN(neighbor_maximum_prefix_out, - neighbor_maximum_prefix_out_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix-out (1-4294967295)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefixes to be sent to this peer\n" - "Maximum no. of prefix limit\n") +DEFUN_YANG(neighbor_maximum_prefix_out, + neighbor_maximum_prefix_out_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix-out (1-4294967295)", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefixes to be sent to this peer\n" + "Maximum no. of prefix limit\n") { + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; int idx_peer = 1; int idx_number = 3; - struct peer *peer; - uint32_t max; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - max = strtoul(argv[idx_number]->arg, NULL, 10); + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='out']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); - SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); - peer->pmax_out[afi][safi] = max; + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN(no_neighbor_maximum_prefix_out, - no_neighbor_maximum_prefix_out_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix-out", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefixes to be sent to this peer\n") +DEFUN_YANG(no_neighbor_maximum_prefix_out, + no_neighbor_maximum_prefix_out_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix-out", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefixes to be sent to this peer\n") { + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; int idx_peer = 2; - struct peer *peer; afi_t afi = bgp_node_afi(vty); safi_t safi = bgp_node_safi(vty); - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) return CMD_WARNING_CONFIG_FAILED; - UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT); - peer->pmax_out[afi][safi] = 0; + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='out']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } /* Maximum number of prefix configuration. Prefix count is different for each peer configuration. So this configuration can be set for each peer configuration. */ -DEFUN (neighbor_maximum_prefix, - neighbor_maximum_prefix_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix, + neighbor_maximum_prefix_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 0, NULL, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN(neighbor_maximum_prefix, neighbor_maximum_prefix_hidden_cmd, @@ -7547,28 +8143,50 @@ ALIAS_HIDDEN(neighbor_maximum_prefix, neighbor_maximum_prefix_hidden_cmd, "maximum no. of prefix limit\n" "Force checking all received routes not only accepted\n") -DEFUN (neighbor_maximum_prefix_threshold, - neighbor_maximum_prefix_threshold_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix_threshold, + neighbor_maximum_prefix_threshold_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + + nb_cli_enqueue_change(vty, "./options/shutdown-threshold-pct", + NB_OP_MODIFY, argv[idx_number_2]->arg); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, argv[idx_number_2]->arg, 0, NULL, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7581,27 +8199,48 @@ ALIAS_HIDDEN( "Threshold value (%) at which to generate a warning msg\n" "Force checking all received routes not only accepted\n") -DEFUN (neighbor_maximum_prefix_warning, - neighbor_maximum_prefix_warning_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Only give warning message when limit is exceeded\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix_warning, + neighbor_maximum_prefix_warning_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + + nb_cli_enqueue_change(vty, "./options/warning-only", NB_OP_MODIFY, + "true"); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 1, NULL, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7614,29 +8253,51 @@ ALIAS_HIDDEN( "Only give warning message when limit is exceeded\n" "Force checking all received routes not only accepted\n") -DEFUN (neighbor_maximum_prefix_threshold_warning, - neighbor_maximum_prefix_threshold_warning_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Only give warning message when limit is exceeded\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix_threshold_warning, + neighbor_maximum_prefix_threshold_warning_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + nb_cli_enqueue_change(vty, "./options/tw-shutdown-threshold-pct", + NB_OP_MODIFY, argv[idx_number_2]->arg); + nb_cli_enqueue_change(vty, "./options/tw-warning-only", NB_OP_MODIFY, + "true"); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, argv[idx_number_2]->arg, 1, NULL, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7650,29 +8311,49 @@ ALIAS_HIDDEN( "Only give warning message when limit is exceeded\n" "Force checking all received routes not only accepted\n") -DEFUN (neighbor_maximum_prefix_restart, - neighbor_maximum_prefix_restart_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535) [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n" - "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix_restart, + neighbor_maximum_prefix_restart_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535) [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefix accept from this peer\n" + "maximum no. of prefix limit\n" + "Restart bgp connection after limit is exceeded\n" + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 5; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + nb_cli_enqueue_change(vty, "./options/restart-timer", NB_OP_MODIFY, + argv[idx_number_2]->arg); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 0, argv[idx_number_2]->arg, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7686,32 +8367,53 @@ ALIAS_HIDDEN( "Restart interval in minutes\n" "Force checking all received routes not only accepted\n") -DEFUN (neighbor_maximum_prefix_threshold_restart, - neighbor_maximum_prefix_threshold_restart_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535) [force]", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefixes to accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(neighbor_maximum_prefix_threshold_restart, + neighbor_maximum_prefix_threshold_restart_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535) [force]", + NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefixes to accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Restart bgp connection after limit is exceeded\n" + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 6; int idx_force = 0; - char *force = NULL; + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY, + argv[idx_number]->arg); + nb_cli_enqueue_change(vty, "./options/tr-shutdown-threshold-pct", + NB_OP_MODIFY, argv[idx_number_2]->arg); + nb_cli_enqueue_change(vty, "./options/tr-restart-timer", NB_OP_MODIFY, + argv[idx_number_3]->arg); if (argv_find(argv, argc, "force", &idx_force)) - force = argv[idx_force]->arg; + nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY, + "true"); - return peer_maximum_prefix_set_vty( - vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, argv[idx_number_2]->arg, 0, - argv[idx_number_3]->arg, force); + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7726,24 +8428,40 @@ ALIAS_HIDDEN( "Restart interval in minutes\n" "Force checking all received routes not only accepted\n") -DEFUN (no_neighbor_maximum_prefix, - no_neighbor_maximum_prefix_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only] [force]]", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "Maximum number of prefixes to accept from this peer\n" - "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n" - "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n" - "Only give warning message when limit is exceeded\n" - "Force checking all received routes not only accepted\n") +DEFUN_YANG(no_neighbor_maximum_prefix, + no_neighbor_maximum_prefix_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only] [force]]", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "Maximum number of prefixes to accept from this peer\n" + "maximum no. of prefix limit\n" + "Threshold value (%) at which to generate a warning msg\n" + "Restart bgp connection after limit is exceeded\n" + "Restart interval in minutes\n" + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 2; - return peer_maximum_prefix_unset_vty(vty, argv[idx_peer]->arg, - bgp_node_afi(vty), - bgp_node_safi(vty)); + char base_xpath[XPATH_MAXLEN]; + char af_xpath[XPATH_MAXLEN]; + char attr_xpath[XPATH_MAXLEN]; + afi_t afi = bgp_node_afi(vty); + safi_t safi = bgp_node_safi(vty); + + snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH, + yang_afi_safi_value2identity(afi, safi)); + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), af_xpath) + < 0) + return CMD_WARNING_CONFIG_FAILED; + + snprintf(attr_xpath, sizeof(attr_xpath), + "/%s/prefix-limit/direction-list[direction='in']", + bgp_afi_safi_get_container_str(afi, safi)); + strlcat(base_xpath, attr_xpath, sizeof(base_xpath)); + + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } ALIAS_HIDDEN( @@ -7835,58 +8553,49 @@ ALIAS_HIDDEN( "Number of occurrences of AS number\n" "Only accept my AS in the as-path if the route was originated in my AS\n") -DEFUN (neighbor_ttl_security, - neighbor_ttl_security_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)", - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP ttl-security parameters\n" - "Specify the maximum number of hops to the BGP peer\n" - "Number of hops to BGP peer\n") +DEFUN_YANG (neighbor_ttl_security, + neighbor_ttl_security_cmd, + "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)", + NEIGHBOR_STR + NEIGHBOR_ADDR_STR2 + "BGP ttl-security parameters\n" + "Specify the maximum number of hops to the BGP peer\n" + "Number of hops to BGP peer\n") { int idx_peer = 1; int idx_number = 4; - struct peer *peer; - int gtsm_hops; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - gtsm_hops = strtoul(argv[idx_number]->arg, NULL, 10); - - /* - * If 'neighbor swpX', then this is for directly connected peers, - * we should not accept a ttl-security hops value greater than 1. - */ - if (peer->conf_if && (gtsm_hops > BGP_GTSM_HOPS_CONNECTED)) { - vty_out(vty, - "%s is directly connected peer, hops cannot exceed 1\n", - argv[idx_peer]->arg); - return CMD_WARNING_CONFIG_FAILED; - } + nb_cli_enqueue_change(vty, "./ttl-security", NB_OP_MODIFY, + argv[idx_number]->arg); - return bgp_vty_return(vty, peer_ttl_security_hops_set(peer, gtsm_hops)); + return nb_cli_apply_changes(vty, base_xpath); } -DEFUN (no_neighbor_ttl_security, - no_neighbor_ttl_security_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)", - NO_STR - NEIGHBOR_STR - NEIGHBOR_ADDR_STR2 - "BGP ttl-security parameters\n" - "Specify the maximum number of hops to the BGP peer\n" - "Number of hops to BGP peer\n") +DEFUN_YANG(no_neighbor_ttl_security, + no_neighbor_ttl_security_cmd, + "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)", + NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 + "BGP ttl-security parameters\n" + "Specify the maximum number of hops to the BGP peer\n" + "Number of hops to BGP peer\n") { int idx_peer = 2; - struct peer *peer; + char base_xpath[XPATH_MAXLEN]; - peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg); - if (!peer) + if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath, + sizeof(base_xpath), NULL) + < 0) return CMD_WARNING_CONFIG_FAILED; - return bgp_vty_return(vty, peer_ttl_security_hops_unset(peer)); + nb_cli_enqueue_change(vty, "./ttl-security", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, base_xpath); } DEFUN (neighbor_addpath_tx_all_paths, @@ -10100,28 +10809,74 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, peer->pcount[afi][pfx_rcd_safi]); if (paf && PAF_SUBGRP(paf)) - json_object_int_add(json_peer, - "pfxSnt", - (PAF_SUBGRP(paf))->scount); + json_object_int_add( + json_peer, "pfxSnt", + (PAF_SUBGRP(paf))->scount); + else + json_object_int_add(json_peer, "pfxSnt", + 0); + + /* BGP FSM state */ if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN) || CHECK_FLAG(peer->bgp->flags, BGP_FLAG_SHUTDOWN)) - json_object_string_add(json_peer, "state", + json_object_string_add(json_peer, + "state", "Idle (Admin)"); else if (peer->afc_recv[afi][safi]) json_object_string_add( - json_peer, "state", - lookup_msg(bgp_status_msg, peer->status, - NULL)); - else if (CHECK_FLAG(peer->sflags, - PEER_STATUS_PREFIX_OVERFLOW)) - json_object_string_add(json_peer, "state", + json_peer, "state", + lookup_msg(bgp_status_msg, + peer->status, NULL)); + else if (CHECK_FLAG( + peer->sflags, + PEER_STATUS_PREFIX_OVERFLOW)) + json_object_string_add(json_peer, + "state", "Idle (PfxCt)"); else json_object_string_add( - json_peer, "state", - lookup_msg(bgp_status_msg, peer->status, - NULL)); + json_peer, "state", + lookup_msg(bgp_status_msg, + peer->status, NULL)); + + /* BGP peer state */ + if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN) + || CHECK_FLAG(peer->bgp->flags, + BGP_FLAG_SHUTDOWN)) + json_object_string_add(json_peer, + "peerState", + "Admin"); + else if (CHECK_FLAG( + peer->sflags, + PEER_STATUS_PREFIX_OVERFLOW)) + json_object_string_add(json_peer, + "peerState", + "PfxCt"); + else if (CHECK_FLAG(peer->flags, + PEER_FLAG_PASSIVE)) + json_object_string_add(json_peer, + "peerState", + "Passive"); + else if (CHECK_FLAG(peer->sflags, + PEER_STATUS_NSF_WAIT)) + json_object_string_add(json_peer, + "peerState", + "NSF passive"); + else if (CHECK_FLAG( + peer->bgp->flags, + BGP_FLAG_EBGP_REQUIRES_POLICY) + && (!bgp_inbound_policy_exists(peer, + filter) + || !bgp_outbound_policy_exists( + peer, filter))) + json_object_string_add(json_peer, + "peerState", + "Policy"); + else + json_object_string_add( + json_peer, "peerState", "OK"); + json_object_int_add(json_peer, "connectionsEstablished", peer->established); json_object_int_add(json_peer, "connectionsDropped", @@ -11724,9 +12479,9 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, if (dn_flag[0]) { struct prefix prefix, *range = NULL; - sockunion2hostprefix(&(p->su), &prefix); - range = peer_group_lookup_dynamic_neighbor_range( - p->group, &prefix); + if (sockunion2hostprefix(&(p->su), &prefix)) + range = peer_group_lookup_dynamic_neighbor_range( + p->group, &prefix); if (range) { prefix2str(range, buf1, sizeof(buf1)); @@ -11743,9 +12498,9 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, if (dn_flag[0]) { struct prefix prefix, *range = NULL; - sockunion2hostprefix(&(p->su), &prefix); - range = peer_group_lookup_dynamic_neighbor_range( - p->group, &prefix); + if (sockunion2hostprefix(&(p->su), &prefix)) + range = peer_group_lookup_dynamic_neighbor_range( + p->group, &prefix); if (range) { vty_out(vty, @@ -16123,6 +16878,10 @@ int bgp_config_write(struct vty *vty) vty_out(vty, " bgp router-id %pI4\n", &bgp->router_id_static); + /* Suppress fib pending */ + if (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING)) + vty_out(vty, " bgp suppress-fib-pending\n"); + /* BGP log-neighbor-changes. */ if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES) != SAVE_BGP_LOG_NEIGHBOR_CHANGES) @@ -16638,6 +17397,9 @@ void bgp_vty_init(void) install_element(BGP_NODE, &bgp_router_id_cmd); install_element(BGP_NODE, &no_bgp_router_id_cmd); + /* "bgp suppress-fib-pending" command */ + install_element(BGP_NODE, &bgp_suppress_fib_pending_cmd); + /* "bgp cluster-id" commands. */ install_element(BGP_NODE, &bgp_cluster_id_cmd); install_element(BGP_NODE, &no_bgp_cluster_id_cmd); diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 349efbac45..07f61ab0ea 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -194,5 +194,20 @@ extern const char *bgp_afi_safi_get_container_str(afi_t afi, safi_t safi); extern bool vpn_policy_check_import(struct bgp *bgp, afi_t afi, safi_t safi, bool v2vimport, char *errmsg, size_t errmsg_len); +extern int bgp_nb_errmsg_return(char *errmsg, size_t errmsg_len, int ret); +extern bool peer_address_self_check(struct bgp *bgp, union sockunion *su); +extern int peer_local_interface_cfg(struct bgp *bgp, const char *ip_str, + const char *str, char *errmsg, + size_t errmsg_len); +extern int peer_conf_interface_create(struct bgp *bgp, const char *conf_if, + afi_t afi, safi_t safi, bool v6only, + const char *peer_group_name, int as_type, + as_t as, char *errmsg, size_t errmsg_len); +extern int peer_flag_modify_nb(struct bgp *bgp, const char *ip_str, + struct peer *peer, uint32_t flag, bool set, + char *errmsg, size_t errmsg_len); +extern int peer_af_flag_modify_nb(struct peer *peer, afi_t afi, safi_t safi, + uint32_t flag, int set, char *errmsg, + size_t errmsg_len); #endif /* _QUAGGA_BGP_VTY_H */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 00213b4239..12bc2e41bc 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -531,9 +531,9 @@ static int zebra_read_route(ZAPI_CALLBACK_ARGS) api.instance, &api.prefix, buf, nhtype, ifindex, api.metric, api.tag); } else { - zlog_debug("Rx route DEL VRF %u %s[%d] %s", vrf_id, + zlog_debug("Rx route DEL VRF %u %s[%d] %pFX", vrf_id, zebra_route_string(api.type), api.instance, - buf); + &api.prefix); } } @@ -918,7 +918,7 @@ static bool bgp_table_map_apply(struct route_map *map, const struct prefix *p, { route_map_result_t ret; - ret = route_map_apply(map, p, RMAP_BGP, path); + ret = route_map_apply(map, p, path); bgp_attr_flush(path->attr); if (ret != RMAP_DENYMATCH) @@ -1179,6 +1179,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, int nh_updated; bool do_wt_ecmp; uint64_t cum_bw = 0; + uint32_t nhg_id = 0; + bool is_add; /* Don't try to install if we're not connected to Zebra or Zebra doesn't * know of this instance. @@ -1257,7 +1259,17 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, if (do_wt_ecmp) cum_bw = bgp_path_info_mpath_cumbw(info); - for (mpinfo = info; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) { + /* EVPN MAC-IP routes are installed with a L3 NHG id */ + if (bgp_evpn_path_es_use_nhg(bgp, info, &nhg_id)) { + mpinfo = NULL; + api.nhgid = nhg_id; + if (nhg_id) + SET_FLAG(api.message, ZAPI_MESSAGE_NHG); + } else { + mpinfo = info; + } + + for (; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) { uint32_t nh_weight; if (valid_nh_count >= multipath_num) @@ -1395,6 +1407,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, valid_nh_count++; } + is_add = (valid_nh_count || nhg_id) ? true : false; + /* * When we create an aggregate route we must also * install a Null0 route in the RIB, so overwrite @@ -1428,9 +1442,10 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, zlog_debug( "Tx route %s VRF %u %pFX metric %u tag %" ROUTE_TAG_PRI - " count %d", + " count %d nhg %d", valid_nh_count ? "add" : "delete", bgp->vrf_id, - &api.prefix, api.metric, api.tag, api.nexthop_num); + &api.prefix, api.metric, api.tag, api.nexthop_num, + nhg_id); for (i = 0; i < api.nexthop_num; i++) { api_nh = &api.nexthops[i]; @@ -1487,8 +1502,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, __func__, buf_prefix, (recursion_flag ? "" : "NOT ")); } - zclient_route_send(valid_nh_count ? ZEBRA_ROUTE_ADD - : ZEBRA_ROUTE_DELETE, + zclient_route_send(is_add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, zclient, &api); } @@ -1820,7 +1834,6 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, vrf_bitmap_unset(zclient->redist[afi][type], bgp->vrf_id); } - if (bgp_install_info_to_zebra(bgp)) { /* Send distribute delete message to zebra. */ if (BGP_DEBUG(zebra, ZEBRA)) @@ -2380,6 +2393,99 @@ static int iptable_notify_owner(ZAPI_CALLBACK_ARGS) return 0; } +/* Process route notification messages from RIB */ +static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, + zebra_size_t length, vrf_id_t vrf_id) +{ + struct prefix p; + enum zapi_route_notify_owner note; + uint32_t table_id; + char buf[PREFIX_STRLEN]; + afi_t afi; + safi_t safi; + struct bgp_dest *dest; + struct bgp *bgp; + struct bgp_path_info *pi, *new_select; + + if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, + &afi, &safi)) { + zlog_err("%s : error in msg decode", __PRETTY_FUNCTION__); + return -1; + } + + /* Get the bgp instance */ + bgp = bgp_lookup_by_vrf_id(vrf_id); + if (!bgp) { + flog_err(EC_BGP_INVALID_BGP_INSTANCE, + "%s : bgp instance not found vrf %d", + __PRETTY_FUNCTION__, vrf_id); + return -1; + } + + if (BGP_DEBUG(zebra, ZEBRA)) + prefix2str(&p, buf, sizeof(buf)); + + /* Find the bgp route node */ + dest = bgp_afi_node_lookup(bgp->rib[afi][safi], afi, safi, &p, + &bgp->vrf_prd); + if (!dest) + return -1; + + bgp_dest_unlock_node(dest); + + switch (note) { + case ZAPI_ROUTE_INSTALLED: + new_select = NULL; + /* Clear the flags so that route can be processed */ + if (CHECK_FLAG(dest->flags, + BGP_NODE_FIB_INSTALL_PENDING)) { + UNSET_FLAG(dest->flags, + BGP_NODE_FIB_INSTALL_PENDING); + SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route %s : INSTALLED", buf); + /* Find the best route */ + for (pi = dest->info; pi; pi = pi->next) { + /* Process aggregate route */ + bgp_aggregate_increment(bgp, &p, pi, + afi, safi); + if (CHECK_FLAG(pi->flags, + BGP_PATH_SELECTED)) + new_select = pi; + } + /* Advertise the route */ + if (new_select) + group_announce_route(bgp, afi, safi, + dest, new_select); + else { + flog_err(EC_BGP_INVALID_ROUTE, + "selected route %s not found", + buf); + return -1; + } + } + break; + case ZAPI_ROUTE_REMOVED: + /* Route deleted from dataplane, reset the installed flag + * so that route can be reinstalled when client sends + * route add later + */ + UNSET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); + break; + case ZAPI_ROUTE_FAIL_INSTALL: + /* Error will be logged by zebra module */ + break; + case ZAPI_ROUTE_BETTER_ADMIN_WON: + /* No action required */ + break; + case ZAPI_ROUTE_REMOVE_FAIL: + zlog_warn("%s: Route %s failure to remove", + __func__, buf); + break; + } + return 0; +} + /* this function is used to forge ip rule, * - either for iptable/ipset using fwmark id * - or for sample ip rule cmd @@ -2390,6 +2496,7 @@ static void bgp_encode_pbr_rule_action(struct stream *s, { struct prefix pfx; uint8_t fam = AF_INET; + char ifname[INTERFACE_NAMSIZ]; if (pbra->nh.type == NEXTHOP_TYPE_IPV6) fam = AF_INET6; @@ -2431,7 +2538,7 @@ static void bgp_encode_pbr_rule_action(struct stream *s, stream_put(s, &pfx.u.prefix, prefix_blen(&pfx)); stream_putw(s, 0); /* dst port */ - + stream_putc(s, 0); /* dsfield */ /* if pbr present, fwmark is not used */ if (pbr) stream_putl(s, 0); @@ -2440,7 +2547,8 @@ static void bgp_encode_pbr_rule_action(struct stream *s, stream_putl(s, pbra->table_id); - stream_putl(s, 0); /* ifindex unused */ + memset(ifname, 0, sizeof(ifname)); + stream_put(s, ifname, INTERFACE_NAMSIZ); /* ifname unused */ } static void bgp_encode_pbr_ipset_match(struct stream *s, @@ -2745,6 +2853,7 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) stream_get(&esi, s, sizeof(esi_t)); } else { state = stream_getl(s); + memset(&esi, 0, sizeof(esi_t)); } bgp = bgp_lookup_by_vrf_id(vrf_id); @@ -2908,6 +3017,7 @@ void bgp_zebra_init(struct thread_master *master, unsigned short instance) zclient->ipset_notify_owner = ipset_notify_owner; zclient->ipset_entry_notify_owner = ipset_entry_notify_owner; zclient->iptable_notify_owner = iptable_notify_owner; + zclient->route_notify_owner = bgp_zebra_route_notify_owner; zclient->instance = instance; } @@ -2954,7 +3064,8 @@ void bgp_send_pbr_rule_action(struct bgp_pbr_action *pbra, bgp_encode_pbr_rule_action(s, pbra, pbr); stream_putw_at(s, 0, stream_get_endp(s)); - if (!zclient_send_message(zclient) && install) { + if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) + && install) { if (!pbr) pbra->install_in_progress = true; else @@ -2985,7 +3096,7 @@ void bgp_send_pbr_ipset_match(struct bgp_pbr_match *pbrim, bool install) bgp_encode_pbr_ipset_match(s, pbrim); stream_putw_at(s, 0, stream_get_endp(s)); - if (!zclient_send_message(zclient) && install) + if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) && install) pbrim->install_in_progress = true; } @@ -3013,7 +3124,7 @@ void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry *pbrime, bgp_encode_pbr_ipset_entry_match(s, pbrime); stream_putw_at(s, 0, stream_get_endp(s)); - if (!zclient_send_message(zclient) && install) + if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) && install) pbrime->install_in_progress = true; } @@ -3088,7 +3199,7 @@ void bgp_send_pbr_iptable(struct bgp_pbr_action *pba, stream_putw_at(s, 0, stream_get_endp(s)); ret = zclient_send_message(zclient); if (install) { - if (ret) + if (ret != ZCLIENT_SEND_FAILURE) pba->refcnt++; else pbm->install_iptable_in_progress = true; @@ -3222,7 +3333,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable) } if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) - < 0) { + == ZCLIENT_SEND_FAILURE) { zlog_err("error sending capability"); ret = BGP_GR_FAILURE; } else { @@ -3264,7 +3375,7 @@ int bgp_zebra_update(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type) api.cap = type; if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) - < 0) { + == ZCLIENT_SEND_FAILURE) { if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("error sending capability"); return BGP_GR_FAILURE; @@ -3296,7 +3407,7 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp) api.stale_removal_time = bgp->rib_stale_time; api.vrf_id = bgp->vrf_id; if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) - < 0) { + == ZCLIENT_SEND_FAILURE) { if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("error sending capability"); return BGP_GR_FAILURE; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index cf16378de1..82ce0c3882 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -109,6 +109,9 @@ struct community_list_handler *bgp_clist; unsigned int multipath_num = MULTIPATH_NUM; +/* Number of bgp instances configured for suppress fib config */ +unsigned int bgp_suppress_fib_count; + static void bgp_if_finish(struct bgp *bgp); static void peer_drop_dynamic_neighbor(struct peer *peer); @@ -390,6 +393,43 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id) true /* is config */); } +/* Set the suppress fib pending for the bgp configuration */ +void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set) +{ + bool send_msg = false; + + if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) + return; + + if (set) { + SET_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING); + /* Send msg to zebra for the first instance of bgp enabled + * with suppress fib + */ + if (bgp_suppress_fib_count == 0) + send_msg = true; + bgp_suppress_fib_count++; + } else { + UNSET_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING); + bgp_suppress_fib_count--; + + /* Send msg to zebra if there are no instances enabled + * with suppress fib + */ + if (bgp_suppress_fib_count == 0) + send_msg = true; + } + /* Send route notify request to RIB */ + if (send_msg) { + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("Sending ZEBRA_ROUTE_NOTIFY_REQUEST"); + + if (zclient) + zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST, + zclient, set); + } +} + /* BGP's cluster-id control. */ int bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id) { @@ -1054,6 +1094,15 @@ static void peer_free(struct peer *peer) bgp_delete_connected_nexthop(family2afi(peer->su.sa.sa_family), peer); + FOREACH_AFI_SAFI (afi, safi) { + if (peer->filter[afi][safi].advmap.aname) + XFREE(MTYPE_BGP_FILTER_NAME, + peer->filter[afi][safi].advmap.aname); + if (peer->filter[afi][safi].advmap.cname) + XFREE(MTYPE_BGP_FILTER_NAME, + peer->filter[afi][safi].advmap.cname); + } + XFREE(MTYPE_PEER_TX_SHUTDOWN_MSG, peer->tx_shutdown_message); XFREE(MTYPE_PEER_DESC, peer->desc); @@ -1081,12 +1130,8 @@ static void peer_free(struct peer *peer) bfd_info_free(&(peer->bfd_info)); - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - bgp_addpath_set_peer_type(peer, afi, safi, - BGP_ADDPATH_NONE); - } - } + FOREACH_AFI_SAFI (afi, safi) + bgp_addpath_set_peer_type(peer, afi, safi, BGP_ADDPATH_NONE); bgp_unlock(peer->bgp); @@ -2757,8 +2802,8 @@ int peer_group_listen_range_del(struct peer_group *group, struct prefix *range) if (!peer_dynamic_neighbor(peer)) continue; - sockunion2hostprefix(&peer->su, &prefix2); - if (prefix_match(prefix, &prefix2)) { + if (sockunion2hostprefix(&peer->su, &prefix2) + && prefix_match(prefix, &prefix2)) { if (bgp_debug_neighbor_events(peer)) zlog_debug( "Deleting dynamic neighbor %s group %s upon delete of listen range %pFX", @@ -3022,7 +3067,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, bgp->gr_info[afi][safi].eor_received = 0; bgp->gr_info[afi][safi].t_select_deferral = NULL; bgp->gr_info[afi][safi].t_route_select = NULL; - bgp->gr_info[afi][safi].route_list = list_new(); + bgp->gr_info[afi][safi].gr_deferred = 0; } bgp->v_update_delay = bm->v_update_delay; @@ -3111,6 +3156,7 @@ static struct bgp *bgp_create(as_t *as, const char *name, sizeof(struct bgp_evpn_info)); bgp_evpn_init(bgp); + bgp_evpn_vrf_es_init(bgp); bgp_pbr_init(bgp); /*initilize global GR FSM */ @@ -3382,6 +3428,14 @@ int bgp_delete(struct bgp *bgp) assert(bgp); + /* make sure we withdraw any exported routes */ + vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, bgp_get_default(), + bgp); + vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP6, bgp_get_default(), + bgp); + + bgp_vpn_leak_unimport(bgp); + hook_call(bgp_inst_delete, bgp); THREAD_OFF(bgp->t_startup); @@ -3394,14 +3448,21 @@ int bgp_delete(struct bgp *bgp) /* Delete the graceful restart info */ FOREACH_AFI_SAFI (afi, safi) { + struct thread *t; + gr_info = &bgp->gr_info[afi][safi]; if (!gr_info) continue; BGP_TIMER_OFF(gr_info->t_select_deferral); + + t = gr_info->t_route_select; + if (t) { + void *info = THREAD_ARG(t); + + XFREE(MTYPE_TMP, info); + } BGP_TIMER_OFF(gr_info->t_route_select); - if (gr_info->route_list) - list_delete(&gr_info->route_list); } if (BGP_DEBUG(zebra, ZEBRA)) { @@ -3774,7 +3835,8 @@ struct peer *peer_lookup_dynamic_neighbor(struct bgp *bgp, union sockunion *su) int dncount; char buf[PREFIX2STR_BUFFER]; - sockunion2hostprefix(su, &prefix); + if (!sockunion2hostprefix(su, &prefix)) + return NULL; /* See if incoming connection matches a configured listen range. */ group = peer_group_lookup_dynamic_neighbor(bgp, &prefix, &listen_range); @@ -4498,6 +4560,10 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl) if (peer->sort == BGP_PEER_IBGP || peer->conf_if) return 0; + /* is there anything to do? */ + if (peer->ttl == ttl) + return 0; + /* see comment in peer_ttl_security_hops_set() */ if (ttl != MAXTTL) { if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { @@ -5478,8 +5544,8 @@ int peer_allowas_in_unset(struct peer *peer, afi_t afi, safi_t safi) return 0; } -int peer_local_as_set(struct peer *peer, as_t as, int no_prepend, - int replace_as) +int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend, + bool replace_as) { bool old_no_prepend, old_replace_as; struct bgp *bgp = peer->bgp; @@ -6911,8 +6977,8 @@ int peer_ttl_security_hops_set(struct peer *peer, int gtsm_hops) struct listnode *node, *nnode; int ret; - zlog_debug("peer_ttl_security_hops_set: set gtsm_hops to %d for %s", - gtsm_hops, peer->host); + zlog_debug("%s: set gtsm_hops to %d for %s", __func__, gtsm_hops, + peer->host); /* We cannot configure ttl-security hops when ebgp-multihop is already set. For non peer-groups, the check is simple. For peer-groups, @@ -7014,8 +7080,7 @@ int peer_ttl_security_hops_unset(struct peer *peer) struct listnode *node, *nnode; int ret = 0; - zlog_debug("peer_ttl_security_hops_unset: set gtsm_hops to zero for %s", - peer->host); + zlog_debug("%s: set gtsm_hops to zero for %s", __func__, peer->host); /* if a peer-group member, then reset to peer-group default rather than * 0 */ @@ -7263,6 +7328,7 @@ void bgp_master_init(struct thread_master *master, const int buffer_size) /* mpls label dynamic allocation pool */ bgp_lp_init(bm->master, &bm->labelpool); + bgp_l3nhg_init(); bgp_evpn_mh_init(); QOBJ_REG(bm, bgp_master); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 74828e91df..965a35b345 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -104,10 +104,6 @@ enum bgp_af_index { #define AF_FOREACH(af) for ((af) = BGP_AF_START; (af) < BGP_AF_MAX; (af)++) -#define FOREACH_AFI_SAFI(afi, safi) \ - for (afi = AFI_IP; afi < AFI_MAX; afi++) \ - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - #define FOREACH_SAFI(safi) \ for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) @@ -265,8 +261,8 @@ struct graceful_restart_info { uint32_t eor_received; /* Deferral Timer */ struct thread *t_select_deferral; - /* Route list */ - struct list *route_list; + /* Routes Deferred */ + uint32_t gr_deferred; /* Best route select */ struct thread *t_route_select; /* AFI, SAFI enabled */ @@ -306,6 +302,9 @@ enum bgp_link_bw_handling { BGP_LINK_BW_DEFWT_4_MISSING }; +RB_HEAD(bgp_es_vrf_rb_head, bgp_evpn_es_vrf); +RB_PROTOTYPE(bgp_es_vrf_rb_head, bgp_evpn_es_vrf, rb_node, bgp_es_vrf_rb_cmp); + /* BGP instance structure. */ struct bgp { /* AS number of this BGP instance. */ @@ -455,11 +454,12 @@ struct bgp { #define BGP_FLAG_DELETE_IN_PROGRESS (1 << 22) #define BGP_FLAG_SELECT_DEFER_DISABLE (1 << 23) #define BGP_FLAG_GR_DISABLE_EOR (1 << 24) -#define BGP_FLAG_EBGP_REQUIRES_POLICY (1 << 25) -#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26) +#define BGP_FLAG_EBGP_REQUIRES_POLICY (1 << 25) +#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26) /* This flag is set if the instance is in administrative shutdown */ -#define BGP_FLAG_SHUTDOWN (1 << 27) +#define BGP_FLAG_SHUTDOWN (1 << 27) +#define BGP_FLAG_SUPPRESS_FIB_PENDING (1 << 28) enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE] [BGP_GLOBAL_GR_EVENT_CMD]; @@ -640,6 +640,9 @@ struct bgp { /* SVI associated with the L3-VNI corresponding to this vrf */ ifindex_t l3vni_svi_ifindex; + /* RB tree of ES-VRFs */ + struct bgp_es_vrf_rb_head es_vrf_rb_tree; + /* vrf flags */ uint32_t vrf_flags; #define BGP_VRF_AUTO (1 << 0) @@ -712,6 +715,9 @@ struct afi_safi_info { #define BGP_SELECT_DEFER_DISABLE(bgp) \ (CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE)) +#define BGP_SUPPRESS_FIB_ENABLED(bgp) \ + (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING)) + /* BGP peer-group support. */ struct peer_group { /* Name of the peer-group. */ @@ -1283,6 +1289,8 @@ struct peer { #define PEER_THREAD_WRITES_ON (1U << 0) #define PEER_THREAD_READS_ON (1U << 1) #define PEER_THREAD_KEEPALIVES_ON (1U << 2) +#define PEER_THREAD_SUBGRP_ADV_DELAY (1U << 3) + /* workqueues */ struct work_queue *clear_node_queue; @@ -1507,6 +1515,9 @@ DECLARE_QOBJ_TYPE(peer) || CHECK_FLAG((P)->sflags, PEER_STATUS_PREFIX_OVERFLOW) \ || CHECK_FLAG((P)->bgp->flags, BGP_FLAG_SHUTDOWN)) +#define PEER_ROUTE_ADV_DELAY(peer) \ + (CHECK_FLAG(peer->thread_flags, PEER_THREAD_SUBGRP_ADV_DELAY)) + #define PEER_PASSWORD_MINLEN (1) #define PEER_PASSWORD_MAXLEN (80) @@ -1677,6 +1688,7 @@ struct bgp_nlri { #define BGP_DEFAULT_STALEPATH_TIME 360 #define BGP_DEFAULT_SELECT_DEFERRAL_TIME 360 #define BGP_DEFAULT_RIB_STALE_TIME 500 +#define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME 1 /* BGP uptime string length. */ #define BGP_UPTIME_LEN 25 @@ -1853,6 +1865,7 @@ extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *); extern void bgp_router_id_static_set(struct bgp *, struct in_addr); +extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set); extern int bgp_cluster_id_set(struct bgp *, struct in_addr *); extern int bgp_cluster_id_unset(struct bgp *); @@ -1949,7 +1962,8 @@ extern int peer_distribute_unset(struct peer *, afi_t, safi_t, int); extern int peer_allowas_in_set(struct peer *, afi_t, safi_t, int, int); extern int peer_allowas_in_unset(struct peer *, afi_t, safi_t); -extern int peer_local_as_set(struct peer *, as_t, int, int); +extern int peer_local_as_set(struct peer *, as_t, bool no_prepend, + bool replace_as); extern int peer_local_as_unset(struct peer *); extern int peer_prefix_list_set(struct peer *, afi_t, safi_t, int, diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 2d81a6ce65..f7bbd44512 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -744,7 +744,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ encaptlv->length = 4; lt = htonl(*lifetime); memcpy(encaptlv->value, <, 4); - attr.vnc_subtlvs = encaptlv; + bgp_attr_set_vnc_subtlvs(&attr, encaptlv); vnc_zlog_debug_verbose( "%s: set Encap Attr Prefix Lifetime to %d", __func__, *lifetime); @@ -754,7 +754,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ if (rfp_options) { if (flags & RFAPI_AHR_RFPOPT_IS_VNCTLV) { - + struct bgp_attr_encap_subtlv *vnc_subtlvs = + bgp_attr_get_vnc_subtlvs(&attr); /* * this flag means we're passing a pointer to an * existing encap tlv chain which we should copy. @@ -763,16 +764,15 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ */ encaptlv = encap_tlv_dup( (struct bgp_attr_encap_subtlv *)rfp_options); - if (attr.vnc_subtlvs) { - attr.vnc_subtlvs->next = encaptlv; - } else { - attr.vnc_subtlvs = encaptlv; - } - + if (vnc_subtlvs) + vnc_subtlvs->next = encaptlv; + else + bgp_attr_set_vnc_subtlvs(&attr, encaptlv); } else { struct bgp_tea_options *hop; /* XXX max of one tlv present so far from above code */ - struct bgp_attr_encap_subtlv *tail = attr.vnc_subtlvs; + struct bgp_attr_encap_subtlv *tail = + bgp_attr_get_vnc_subtlvs(&attr); for (hop = rfp_options; hop; hop = hop->next) { @@ -798,11 +798,11 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */ /* * add to end of subtlv chain */ - if (tail) { + if (tail) tail->next = encaptlv; - } else { - attr.vnc_subtlvs = encaptlv; - } + else + bgp_attr_set_vnc_subtlvs(&attr, + encaptlv); tail = encaptlv; } } @@ -3688,20 +3688,16 @@ static void rfapi_print_exported(struct bgp *bgp) if (!table) continue; fprintf(stderr, "%s: encap destn=%p\n", __func__, destn); - for (dest = bgp_table_top(table)) - ; - dest; - dest = bgp_route_next(dest)) - { - bpi = bgp_dest_get_bgp_path_info(dest); - if (!bpi) - continue; - fprintf(stderr, "%s: dest=%p\n", __func__, dest); - for (; bpi; bpi = bpi->next) { - rfapiPrintBi((void *)2, - bpi); /* 2 => stderr */ - } - } + for (dest = bgp_table_top(table); dest; + dest = bgp_route_next(dest)) { + bpi = bgp_dest_get_bgp_path_info(dest); + if (!bpi) + continue; + fprintf(stderr, "%s: dest=%p\n", __func__, dest); + for (; bpi; bpi = bpi->next) { + rfapiPrintBi((void *)2, bpi); /* 2 => stderr */ + } + } } } #endif /* defined(DEBUG_RFAPI) */ diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index e3581addee..3d87b63542 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -298,10 +298,9 @@ static wq_item_status rfapi_deferred_close_workfunc(struct work_queue *q, int rfapiGetL2o(struct attr *attr, struct rfapi_l2address_option *l2o) { if (attr) { - struct bgp_attr_encap_subtlv *pEncap; - for (pEncap = attr->vnc_subtlvs; pEncap; + for (pEncap = bgp_attr_get_vnc_subtlvs(attr); pEncap; pEncap = pEncap->next) { if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) { @@ -358,7 +357,7 @@ int rfapiGetVncLifetime(struct attr *attr, uint32_t *lifetime) if (attr) { - for (pEncap = attr->vnc_subtlvs; pEncap; + for (pEncap = bgp_attr_get_vnc_subtlvs(attr); pEncap; pEncap = pEncap->next) { if (pEncap->type @@ -1337,7 +1336,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix, return NULL; } - for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) { + for (pEncap = bgp_attr_get_vnc_subtlvs(bpi->attr); pEncap; + pEncap = pEncap->next) { switch (pEncap->type) { case BGP_VNC_SUBTLV_TYPE_LIFETIME: /* use configured lifetime, not attr lifetime */ diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 630a379ec2..d1f335f549 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -622,7 +622,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri, ri->lifetime = lifetime; /* This loop based on rfapiRouteInfo2NextHopEntry() */ - for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) { + for (pEncap = bgp_attr_get_vnc_subtlvs(bpi->attr); pEncap; + pEncap = pEncap->next) { struct bgp_tea_options *hop; switch (pEncap->type) { diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index b9a6c4ddc4..40d5111e8c 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -456,7 +456,8 @@ void rfapiPrintAttrPtrs(void *stream, struct attr *attr) struct vty *vty; void *out; const char *vty_newline; - + struct transit *transit; + struct cluster_list *cluster; char buf[BUFSIZ]; if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0) @@ -477,10 +478,14 @@ void rfapiPrintAttrPtrs(void *stream, struct attr *attr) fp(out, " ecommunity=%p, refcnt=%d%s", attr->ecommunity, (attr->ecommunity ? attr->ecommunity->refcnt : 0), HVTYNL); - fp(out, " cluster=%p, refcnt=%d%s", attr->cluster, - (attr->cluster ? attr->cluster->refcnt : 0), HVTYNL); - fp(out, " transit=%p, refcnt=%d%s", attr->transit, - (attr->transit ? attr->transit->refcnt : 0), HVTYNL); + + cluster = bgp_attr_get_cluster(attr); + fp(out, " cluster=%p, refcnt=%d%s", cluster, + (cluster ? cluster->refcnt : 0), HVTYNL); + + transit = bgp_attr_get_transit(attr); + fp(out, " transit=%p, refcnt=%d%s", transit, + (transit ? transit->refcnt : 0), HVTYNL); } /* @@ -591,7 +596,8 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi) } /* RFP option lengths */ - for (pEncap = bpi->attr->vnc_subtlvs; pEncap; pEncap = pEncap->next) { + for (pEncap = bgp_attr_get_vnc_subtlvs(bpi->attr); pEncap; + pEncap = pEncap->next) { if (pEncap->type == BGP_VNC_SUBTLV_TYPE_RFPOPTION) { if (printed_1st_gol) { diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 11f39b2b82..762cd2596f 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -290,7 +290,7 @@ void vnc_direct_bgp_add_route_ce(struct bgp *bgp, struct agg_node *rn, info.peer = peer; info.attr = &hattr; ret = route_map_apply(bgp->rfapi_cfg->routemap_export_bgp, - prefix, RMAP_BGP, &info); + prefix, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); return; @@ -1033,7 +1033,7 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd) ret = route_map_apply( rfgn->rfg ->routemap_export_bgp, - p, RMAP_BGP, &info); + p, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); continue; @@ -1242,8 +1242,7 @@ static void vnc_direct_add_rn_group_rd(struct bgp *bgp, info.peer = irfd->peer; info.attr = &hattr; - ret = route_map_apply(rfg->routemap_export_bgp, p, RMAP_BGP, - &info); + ret = route_map_apply(rfg->routemap_export_bgp, p, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); vnc_zlog_debug_verbose( @@ -1691,8 +1690,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, memset(&info, 0, sizeof(info)); info.peer = peer; info.attr = &hattr; - ret = route_map_apply(hc->routemap_export_bgp, prefix, RMAP_BGP, - &info); + ret = route_map_apply(hc->routemap_export_bgp, prefix, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); return; @@ -1917,8 +1915,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi) info.attr = &hattr; ret = route_map_apply( hc->routemap_export_bgp, - dest_p, RMAP_BGP, - &info); + dest_p, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); vnc_zlog_debug_verbose( diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 0b6b39b966..b23c1eda76 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -357,7 +357,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */ memset(&info, 0, sizeof(info)); info.peer = peer; info.attr = &hattr; - ret = route_map_apply(rmap, prefix, RMAP_BGP, &info); + ret = route_map_apply(rmap, prefix, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); vnc_zlog_debug_verbose( @@ -468,7 +468,7 @@ static void vnc_import_bgp_add_route_mode_resolve_nve_one_bi( plifetime = &lifetime; } - encaptlvs = bpi->attr->vnc_subtlvs; + encaptlvs = bgp_attr_get_vnc_subtlvs(bpi->attr); if (bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED && bpi->attr->encap_tunneltype != BGP_ENCAP_TYPE_MPLS) { opt = &optary[cur_opt++]; @@ -784,7 +784,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp, memset(&info, 0, sizeof(info)); info.peer = peer; info.attr = &hattr; - ret = route_map_apply(rmap, prefix, RMAP_BGP, &info); + ret = route_map_apply(rmap, prefix, &info); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); vnc_zlog_debug_verbose( @@ -977,7 +977,7 @@ static void vnc_import_bgp_add_route_mode_nvegroup( memset(&path, 0, sizeof(path)); path.peer = peer; path.attr = &hattr; - ret = route_map_apply(rmap, prefix, RMAP_BGP, &path); + ret = route_map_apply(rmap, prefix, &path); if (ret == RMAP_DENYMATCH) { bgp_attr_flush(&hattr); vnc_zlog_debug_verbose( diff --git a/changelog-auto.in b/changelog-auto.in index 127d7fe147..50bd5f6d4d 100644 --- a/changelog-auto.in +++ b/changelog-auto.in @@ -6,6 +6,73 @@ frr (@VERSION@-0) UNRELEASED; urgency=medium -- FRRouting-Dev <dev@lists.frrouting.org> Thu, 25 Oct 2018 16:36:50 +0200 +frr (7.5-0) RELEASED; urgency=medium + BFD + Profile support + Minimum ttl support + BGP + rpki VRF support + GR fixes + Add wide option to display of routes + Add `maximum-prefix <num> force` + Add `bestpath-routes` to neighbor command + Add `bgp shutdown message MSG...` command + Add v6 Flowspec support + Add `neighbor <neigh> shutdown rtt` command + Allow update-delay to be applied globaly + EVPN + Beginning of MultiHoming Support + ISIS + Segment Routing Support + VRF Support + Guard against adj timer display overflow + Add support for Anycast-SIDs + Add support for Topology Independent LFA (TI-LFA) + Add `lsp-gen-interval 2` to isis configuration + OSPF + Segment Routing support for ECMP + Various LSA fixes + Prevent crash if transferring config amongst instances + PBR + Adding json support to commands + DSCP/ECN based PBR Matching + PIM + Add more json support to commands + Fix missing mesh-group commands + MSDP SA forwarding + Clear (s,g,rpt) ifchannel on (*, G) prune received + Fix igmp querier election and IP address mapping + Crash fix when RP is removed + STATIC + Northbound Support + YANG + Filter and route-map Support + OSPF model definition + BGP model definition + VTYSH + Speed up output across daemons + Fix build-time errors for some --enable flags + Speed up output of configuration across daemons + ZEBRA + nexthop group support for FPM + northbound support for rib model + Backup nexthop support + netlink batching support + Allow upper level protocols to request ARP + Add json output for zebra ES, ES-EVI and access vlan dumps + + Upgrade to using libyang1.0.184 + + RPM + Moved RPKI to subpackage + Added SNMP subpackage + + As always there are too many bugfixes to list individually. This release + compromises just over 1k of commits by the community, with contributors from + 70 people. + + -- FRRouting-Dev <dev@lists.frrouting.org> Tue, 2 Nov 2020 08:04:23 +0400 + frr (6.0-2) testing; urgency=medium * add install-info to build deps diff --git a/configure.ac b/configure.ac index 237552c140..6a7353d51a 100755 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,13 @@ dnl ----------------------------------- AC_CANONICAL_BUILD() AC_CANONICAL_HOST() +AC_ARG_VAR([AR],[archiver command]) +AC_ARG_VAR([LD],[linker command]) +AC_ARG_VAR([OBJCOPY],[objcopy command]) +AC_ARG_VAR([OBJDUMP],[objdump command]) +AC_ARG_VAR([RANLIB],[ranlib command]) +AC_ARG_VAR([STRIP],[strip command]) + hosttools_clippy="false" build_clippy="true" @@ -2500,19 +2507,6 @@ AC_CONFIG_FILES([tools/watchfrr.sh], [chmod +x tools/watchfrr.sh]) AC_CONFIG_FILES([tools/frrinit.sh], [chmod +x tools/frrinit.sh]) AC_CONFIG_FILES([tools/frrcommon.sh]) -AC_CONFIG_COMMANDS([lib/route_types.h], [ - dst="${ac_abs_top_builddir}/lib/route_types.h" - ${PERL} "${ac_abs_top_srcdir}/lib/route_types.pl" \ - < "${ac_abs_top_srcdir}/lib/route_types.txt" \ - > "${dst}.tmp" - test -f "$dst" \ - && diff "${dst}.tmp" "${dst}" >/dev/null 2>/dev/null \ - && rm "${dst}.tmp" \ - || mv "${dst}.tmp" "${dst}" -], [ - PERL="$PERL" -]) - AS_IF([test "$with_pkg_git_version" = "yes"], [ AC_CONFIG_COMMANDS([lib/gitversion.h], [ dst="${ac_abs_top_builddir}/lib/gitversion.h" diff --git a/doc/developer/building-frr-for-openwrt.rst b/doc/developer/building-frr-for-openwrt.rst index 9bd1296dad..47cf2cbd43 100644 --- a/doc/developer/building-frr-for-openwrt.rst +++ b/doc/developer/building-frr-for-openwrt.rst @@ -51,7 +51,7 @@ to work and it may be needed to run a ``make`` for the entire build environment. Add ``V=s`` to get more debugging output. More information about OpenWrt buildsystem can be found `here -<https://openwrt.org/docs/guide-developer/build-system/use-buildsystem>`_. +<https://openwrt.org/docs/guide-developer/build-system/use-buildsystem>`__. Work with sources ----------------- @@ -59,7 +59,7 @@ Work with sources To update to a newer version, or change other options, you need to edit the ``feeds/packages/frr/Makefile``. More information about working with patches in OpenWrt buildsystem can be found `here -<https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem>`_. +<https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem>`__. Usage ----- diff --git a/doc/developer/frr-release-procedure.rst b/doc/developer/frr-release-procedure.rst index ff95aa04a9..5da73f61f6 100644 --- a/doc/developer/frr-release-procedure.rst +++ b/doc/developer/frr-release-procedure.rst @@ -20,7 +20,13 @@ FRR Release Procedure git checkout -b stable/<version> git push origin stable/<version>:refs/heads/stable/<version> -3. Update Changelog for Red Hat Packages: +3. Remove the development branch called ``dev/<version>`` + + .. code-block:: console + + git push origin --delete dev/<version> + +4. Update Changelog for Red Hat Packages: Edit :file:`redhat/frr.spec.in` and look for the ``%changelog`` section: @@ -41,7 +47,7 @@ FRR Release Procedure - Add the changelog text below this entry. -4. Update Changelog for Debian Packages: +5. Update Changelog for Debian Packages: Edit :file:`changelog-auto.in`: @@ -83,41 +89,41 @@ FRR Release Procedure . * Your Changes Here -5. Change main version number: +6. Change main version number: - Edit :file:`configure.ac` and change version in the ``AC_INIT`` command to ``<version>`` -6. Commit the changes, adding the changelog to the commit message. Follow all +7. Commit the changes, adding the changelog to the commit message. Follow all existing commit guidelines. -7. Create and submit a GitHub pull request, with the ``HEAD`` set to +8. Create and submit a GitHub pull request, with the ``HEAD`` set to ``stable/<version>`` and the base set to the upstream ``master`` branch. Allow NetDef CI to complete its run and verify that all package builds were successful. -8. Create a git tag for the version: +9. Create a git tag for the version: .. code-block:: console git tag -a frr-<version> -m "FRRouting Release <version>" -9. Push the commit and new tag. +10. Push the commit and new tag. .. code-block:: console git push origin stable/<version>:refs/head/stable/<version> git push origin frr-<version> -10. Kick off the Release build plan on the CI system for the correct release. +11. Kick off the Release build plan on the CI system for the correct release. Contact Martin Winter for this step. Ensure all release packages build successfully. -11. Kick off the Snapcraft build plan for the release. +12. Kick off the Snapcraft build plan for the release. -12. Acquire the release RPM binary packages from Martin Winter. +13. Acquire the release RPM binary packages from Martin Winter. -13. On GitHub, go to the <https://github.com/FRRouting/frr/releases>_ and click +14. On GitHub, go to the <https://github.com/FRRouting/frr/releases>_ and click "Draft a new release". Write a release announcement. The release announcement should follow the template in ``release-announcement-template.md``, located next to this document. Check @@ -129,27 +135,27 @@ FRR Release Procedure attach source tarballs - these will be generated and attached by GitHub automatically. Do not publish the release yet. -14. Contact the current Debian maintainer for FRR to get new Debian packages +15. Contact the current Debian maintainer for FRR to get new Debian packages built and published on our APT repository at https://deb.frrouting.net/. Ensure the webpage text is updated. Verify that new packages install successfully on a vanilla Debian installation using the instructions on the webpage. -15. Deploy Snapcraft release (after CI system finishes the tests for snapcraft +16. Deploy Snapcraft release (after CI system finishes the tests for snapcraft testplan). -16. Update the Read The Docs instance to being publishing documentation built +17. Update the Read The Docs instance to being publishing documentation built off the ``stable/<version>`` branch. Contact Quentin Young for this step. -17. Publish the GitHub release. +18. Publish the GitHub release. -18. Clone the ``frr-www`` repository: +19. Clone the ``frr-www`` repository: .. code-block:: console git clone https://github.com/FRRouting/frr-www.git -19. Add a new release announcement, using a previous announcement as template: +20. Add a new release announcement, using a previous announcement as template: .. code-block:: console @@ -174,8 +180,13 @@ FRR Release Procedure Once finished, manually add a new entry into ``index.html`` to link to this new announcement. Look at past commits to see how to do this. -20. Deploy the updated ``frr-www`` on the frrouting.org web server and verify +21. Deploy the updated ``frr-www`` on the frrouting.org web server and verify that the announcement text is visible. -21. Send an email to ``announce@lists.frrouting.org``. The text of this email +22. Send an email to ``announce@lists.frrouting.org``. The text of this email should include the text from the GitHub release. + +23. Update masters version of the changelog-auto.in + + Take the change data and cut-n-paste the changes into the master version below + the @VERSION@-0 lines. So we have the history of the previous release. diff --git a/doc/developer/fuzzing.rst b/doc/developer/fuzzing.rst new file mode 100644 index 0000000000..8a3318745e --- /dev/null +++ b/doc/developer/fuzzing.rst @@ -0,0 +1,164 @@ +.. _fuzzing: + +Fuzzing +======= + +This page describes the fuzzing targets and supported fuzzers available in FRR +and how to use them. Familiarity with fuzzing techniques and tools is assumed. + +Overview +-------- + +It is well known that networked applications tend to be difficult to fuzz on +their network-facing attack surfaces. Approaches involving actual network +transmission tend to be slow and are subject to intermediate devices and +networking stacks which tend to drop fuzzed packets, especially if the fuzzing +surface covers IP itself. Some time was spent on fuzzing FRR this way with some +mediocre results but attention quickly turned towards skipping the actual +networking and instead adding fuzzing targets directly in the packet processing +code for use by more traditional in- and out-of-process fuzzers. Results from +this approach have been very fruitful. + +The patches to add fuzzing targets are kept in a separate git branch. Typically +it is better to keep them in the main branch so they are kept up to date and do +not need to be constantly synchronized with the main codebase. Unfortunately, +changes to FRR to support fuzzing necessarily extend far beyond the +entrypoints. Checksums must be disarmed, interactions with the kernel must be +skipped, sockets and files must be avoided, desired under/overflows must be +marked, etc. There are the usual ``LD_PRELOAD`` libraries to emulate these +things (preeny et al) but FRR is a very kernel-reliant program and these +libraries tend to create annoying problems when used with FRR for whatever +reason. Keeping this code in the main codebase is cluttering, difficult to work +with / around, and runs the risk of accidentally introducing bugs even if +``#ifdef``'d out. Consequently it's in a separate branch that is rebased on +``master`` from time to time. + + +Code +---- + +The git branch with fuzzing targets is located here: + +https://github.com/FRRouting/frr/tree/fuzz + +To build libFuzzer targets, pass ``--enable-libfuzzer`` to ``configure``. +To build AFL targets, compile with ``afl-clang`` as usual. + +Fuzzing with sanitizers is strongly recommended, especially ASAN, which you can +enable by passing ``--enable-address-sanitizer`` to ``configure``. + +Suggested UBSAN flags: ``-fsanitize-recover=unsigned-integer-overflow,implicit-conversion -fsanitize=unsigned-integer-overflow,implicit-conversion,nullability-arg,nullability-assign,nullability-return`` +Recommended cflags: ``-Wno-all -g3 -O3 -funroll-loops`` + +Design +------ + +All fuzzing targets have support for libFuzzer and AFL. This is done by writing +the target as a libFuzzer entrypoint (``LLVMFuzzerTestOneInput()``) and calling +it from the AFL entrypoint in ``main()``. New targets should use this rule. + +When adding AFL entrypoints, it's a good idea to use AFL persistent mode for +better performance. Grep ``bgpd/bgp_main.c`` for ``__AFL_INIT()`` for an +example of how to do this in FRR. Typically it involves moving all internal +daemon setup into a setup function. Then this setup function is called exactly +once for the lifetime of the process. In ``LLVMFuzzerTestOneInput()`` this +means you need to call it at the start of the function protected by a static +boolean that is set to true, since that function is your entrypoint. You also +need to call it prior to ``__AFL_INIT()`` in ``main()`` because ``main()`` is +your entrypoint in the AFL case. + +Adding support to daemons +^^^^^^^^^^^^^^^^^^^^^^^^^ + +This section describes how to add entrypoints to daemons that do not have any +yet. + +Because libFuzzer has its own ``main()`` function, when adding fuzzing support +to a daemon that doesn't have any targets already, ``main()`` needs to be +``#ifdef``'d out like so: + +.. code:: c + + #ifndef FUZZING_LIBFUZZER + + int main(int argc, char **argv) + { + ... + } + + #endif /* FUZZING_LIBFUZZER */ + + +The ``FUZZING_LIBFUZZER`` macro is set by ``--enable-libfuzzer``. + +Because libFuzzer can only be linked into daemons that have +``LLVMFuzzerTestOneInput()`` implemented, we can't pass ``-fsanitize=fuzzer`` +to all daemons in ``AM_CFLAGS``. It needs to go into a variable specific to +each daemon. Since it can be thought of as a kind of sanitizer, for daemons +that have libFuzzer support there are now individual flags variables for those +daemons named ``DAEMON_SAN_FLAGS`` (e.g. ``BGPD_SAN_FLAGS``, +``ZEBRA_SAN_FLAGS``). This variable has the contents of the generic +``SAN_FLAGS`` plus any fuzzing-related flags. It is used in daemons' +``subdir.am`` in place of ``SAN_FLAGS``. Daemons that don't support libFuzzer +still use ``SAN_FLAGS``. If you want to add fuzzing support to a daemon you +need to do this flag variable conversion; look at ``configure.ac`` for +examples, it is fairly straightforward. Remember to update ``subdir.am`` to use +the new variable. + +Do note that when fuzzing is enabled, ``SAN_FLAGS`` gains +``-fsanitize=fuzzer-no-link``; the result is that all daemons are instrumented +for fuzzing but only the ones with ``LLVMFuzzerTestOneInput()`` actually get +linked with libFuzzer. + + +Targets +------- + +A given daemon can have lots of different paths that are interesting to fuzz. +There's not really a great way to handle this, most fuzzers assume the program +has one entrypoint. The approach taken in FRR for multiple entrypoints is to +control which path is taken within ``LLVMFuzzerTestOneInput()`` using +``#ifdef`` and passing whatever controlling macro definition you want. Take a +look at that function for the daemon you're interested in fuzzing, pick the +target, add ``#define MY_TARGET 1`` somewhere before the ``#ifdef`` switch, +recompile. + +.. list-table:: Fuzzing Targets + + * - Daemon + - Target + - Fuzzers + * - bgpd + - packet parser + - libfuzzer, afl + * - ospfd + - packet parser + - libfuzzer, afl + * - pimd + - packet parser + - libfuzzer, afl + * - vrrpd + - packet parser + - libfuzzer, afl + * - vrrpd + - zapi parser + - libfuzzer, afl + * - zebra + - netlink + - libfuzzer, afl + * - zebra + - zserv / zapi + - libfuzzer, afl + + +Fuzzer Notes +------------ + +Some interesting seed corpuses for various daemons are available `here +<https://github.com/qlyoung/frr-fuzz/tree/master/samples>`_. + +For libFuzzer, you need to pass ``-rss_limit_mb=0`` if you are fuzzing with +ASAN enabled, as you should. + +For AFL, afl++ is strongly recommended; afl proper isn't really maintained +anymore. diff --git a/doc/developer/index.rst b/doc/developer/index.rst index 1ba0f31c8a..5a7da806ff 100644 --- a/doc/developer/index.rst +++ b/doc/developer/index.rst @@ -9,6 +9,7 @@ FRRouting Developer's Guide packaging process-architecture library + fuzzing tracing testing bgpd diff --git a/doc/developer/topotests-jsontopo.rst b/doc/developer/topotests-jsontopo.rst index 1c77cd7be1..07f1f05114 100644 --- a/doc/developer/topotests-jsontopo.rst +++ b/doc/developer/topotests-jsontopo.rst @@ -95,7 +95,7 @@ The first step to write a new test is to define the topology and initial configuration. User has to define topology and initial configuration in JSON file. Here is an example of JSON file:: - BGP neihghborship with single phy-link, sample JSON file: + BGP neighborship with single phy-link, sample JSON file: { "ipv4base": "192.168.0.0", "ipv4mask": 30, diff --git a/doc/user/babeld.rst b/doc/user/babeld.rst index d46550d974..62d50d5d65 100644 --- a/doc/user/babeld.rst +++ b/doc/user/babeld.rst @@ -34,27 +34,18 @@ Configuration of *babeld* is done in its configuration file Babel configuration =================== -.. index:: - single: router babel - single: no router babel - +.. index:: router babel .. clicmd:: [no] router babel Enable or disable Babel routing. -.. index:: - single: babel resend-delay (20-655340) - single: no babel resend-delay [(20-655340)] - +.. index:: babel resend-delay (20-655340) .. clicmd:: [no] babel resend-delay (20-655340) Specifies the time after which important messages are resent when avoiding a black-hole. The default is 2000 ms. -.. index:: - single: babel diversity - single: no babel diversity - +.. index:: babel diversity .. clicmd:: [no] babel diversity Enable or disable routing using radio frequency diversity. This is @@ -72,11 +63,8 @@ Babel configuration no role in route selection; you will probably want to set that to 128 or less on nodes with multiple independent radios. -.. index:: - single: network IFNAME - single: no network IFNAME - -.. clicmd:: no network IFNAME +.. index:: network IFNAME +.. clicmd:: [no] network IFNAME Enable or disable Babel on the given interface. @@ -89,10 +77,7 @@ Babel configuration Specifying `wireless` (the default) is always correct, but may cause slower convergence and extra routing traffic. -.. index:: - single: babel split-horizon - single: no babel split-horizon - +.. index:: babel split-horizon .. clicmd:: [no] babel split-horizon Specifies whether to perform split-horizon on the interface. Specifying @@ -120,10 +105,7 @@ Babel configuration Babel makes extensive use of triggered updates, this can be set to fairly high values on links with little packet loss. The default is 20000 ms. -.. index:: - single: babel channel (1-254) - single: babel channel interfering - single: babel channel noninterfering +.. index:: babel channel .. clicmd:: babel channel (1-254) .. clicmd:: babel channel interfering @@ -185,9 +167,7 @@ Babel configuration when the RTT is higher or equal than rtt-max. The default is 0, which effectively disables the use of a RTT-based cost. -.. index:: - single: babel enable-timestamps - single: no babel enable-timestamps +.. index:: babel enable-timestamps .. clicmd:: [no] babel enable-timestamps @@ -216,9 +196,7 @@ Babel configuration Babel redistribution ==================== -.. index:: - single: redistribute <ipv4|ipv6> KIND - single: no redistribute <ipv4|ipv6> KIND +.. index:: redistribute <ipv4|ipv6> KIND .. clicmd:: [no] redistribute <ipv4|ipv6> KIND diff --git a/doc/user/basic.rst b/doc/user/basic.rst index e85e1842b3..e941053f8c 100644 --- a/doc/user/basic.rst +++ b/doc/user/basic.rst @@ -25,10 +25,35 @@ forms the initial command set for a routing beast as it is starting. Config files are generally found in |INSTALL_PREFIX_ETC|. -Each of the daemons has its own config file. The daemon name plus ``.conf`` is -the default config file name. For example, zebra's default config file name is -:file:`zebra.conf`. You can specify a config file using the :option:`-f` or -:option:`--config_file` options when starting the daemon. +Config Methods +-------------- + +There are two ways of configuring FRR. + +Traditionally each of the daemons had its own config file. The daemon name plus +``.conf`` was the default config file name. For example, zebra's default config +file was :file:`zebra.conf`. This method is deprecated. + +Because of the amount of config files this creates, and the tendency of one +daemon to rely on others for certain functionality, most deployments now use +"integrated" configuration. In this setup all configuration goes into a single +file, typically :file:`/etc/frr/frr.conf`. When starting up FRR using an init +script or systemd, ``vtysh`` is invoked to read the config file and send the +appropriate portions to only the daemons interested in them. Running +configuration updates are persisted back to this single file using ``vtysh``. +This is the recommended method. To use this method, add the following line to +:file:`/etc/frr/vtysh.conf`: + +.. code-block:: frr + + service integrated-vtysh-config + +If you installed from source or used a package, this is probably already +present. + +If desired, you can specify a config file using the :option:`-f` or +:option:`--config_file` options when starting a daemon. + .. _basic-config-commands: @@ -40,28 +65,19 @@ Basic Config Commands Set hostname of the router. -.. index:: - single: no password PASSWORD - single: password PASSWORD - +.. index:: password PASSWORD .. clicmd:: [no] password PASSWORD Set password for vty interface. The ``no`` form of the command deletes the password. If there is no password, a vty won't accept connections. -.. index:: - single: no enable password PASSWORD - single: enable password PASSWORD - +.. index:: enable password PASSWORD .. clicmd:: [no] enable password PASSWORD Set enable password. The ``no`` form of the command deletes the enable password. -.. index:: - single: no log trap [LEVEL] - single: log trap LEVEL - +.. index:: log trap LEVEL .. clicmd:: [no] log trap LEVEL These commands are deprecated and are present only for historical @@ -72,9 +88,7 @@ Basic Config Commands future logging commands to debugging, but it does not change the logging level of existing logging destinations. -.. index:: - single: no log stdout [LEVEL] - single: log stdout [LEVEL] +.. index:: log stdout [LEVEL] .. clicmd:: [no] log stdout LEVEL @@ -95,10 +109,7 @@ Basic Config Commands terminal output. Use a log file and ``tail -f`` if this rare chance is inacceptable to your setup. -.. index:: - single: no log file [FILENAME [LEVEL]] - single: log file FILENAME [LEVEL] - +.. index:: log file FILENAME [LEVEL] .. clicmd:: [no] log file [FILENAME [LEVEL]] If you want to log into a file, please specify ``filename`` as @@ -113,10 +124,7 @@ Basic Config Commands deprecated ``log trap`` command) will be used. The ``no`` form of the command disables logging to a file. -.. index:: - single: no log syslog [LEVEL] - single: log syslog [LEVEL] - +.. index:: log syslog [LEVEL] .. clicmd:: [no] log syslog [LEVEL] Enable logging output to syslog. If the optional second argument specifying @@ -124,10 +132,7 @@ Basic Config Commands debugging, but can be changed using the deprecated ``log trap`` command) will be used. The ``no`` form of the command disables logging to syslog. -.. index:: - single: no log monitor [LEVEL] - single: log monitor [LEVEL] - +.. index:: log monitor [LEVEL] .. clicmd:: [no] log monitor [LEVEL] Enable logging output to vty terminals that have enabled logging using the @@ -138,20 +143,14 @@ Basic Config Commands level (typically debugging) will be used. The ``no`` form of the command disables logging to terminal monitors. -.. index:: - single: no log facility [FACILITY] - single: log facility [FACILITY] - +.. index:: log facility [FACILITY] .. clicmd:: [no] log facility [FACILITY] This command changes the facility used in syslog messages. The default facility is ``daemon``. The ``no`` form of the command resets the facility to the default ``daemon`` facility. -.. index:: - single: no log record-priority - single: log record-priority - +.. index:: log record-priority .. clicmd:: [no] log record-priority To include the severity in all messages logged to a file, to stdout, or to @@ -162,10 +161,7 @@ Basic Config Commands versions of syslogd can be configured to include the facility and level in the messages emitted. -.. index:: - single: log timestamp precision (0-6) - single: [no] log timestamp precision (0-6) - +.. index:: log timestamp precision (0-6) .. clicmd:: [no] log timestamp precision [(0-6)] This command sets the precision of log message timestamps to the given @@ -181,7 +177,7 @@ Basic Config Commands In this example, the precision is set to provide timestamps with millisecond accuracy. -.. index:: [no] log commands +.. index:: log commands .. clicmd:: [no] log commands This command enables the logging of all commands typed by a user to all @@ -190,10 +186,7 @@ Basic Config Commands is used to start the daemon then this command is turned on by default and cannot be turned off and the [no] form of the command is dissallowed. -.. index:: - single: no log-filter WORD [DAEMON] - single: log-filter WORD [DAEMON] - +.. index:: log-filter WORD [DAEMON] .. clicmd:: [no] log-filter WORD [DAEMON] This command forces logs to be filtered on a specific string. A log message @@ -250,7 +243,7 @@ Basic Config Commands Set motd string from an input. -.. index:: no banner motd +.. index:: banner motd .. clicmd:: no banner motd No motd banner string will be printed. @@ -263,7 +256,7 @@ Basic Config Commands used for timeout value in seconds. Default timeout value is 10 minutes. When timeout value is zero, it means no timeout. -.. index:: no exec-timeout +.. index:: exec-timeout .. clicmd:: no exec-timeout Do not perform timeout at all. This command is as same as @@ -687,6 +680,12 @@ These options apply to all |PACKAGE_NAME| daemons. Enable the transactional CLI mode. +.. option:: --limit-fds <number> + + Limit the number of file descriptors that will be used internally + by the FRR daemons. By default, the daemons use the system ulimit + value. + .. _loadable-module-support: Loadable Module Support diff --git a/doc/user/bfd.rst b/doc/user/bfd.rst index 86b0c28002..72dd73904a 100644 --- a/doc/user/bfd.rst +++ b/doc/user/bfd.rst @@ -79,7 +79,7 @@ BFDd Commands `vrf` selects which domain we want to use. -.. index:: no peer <A.B.C.D|X:X::X:X>$peer [{multihop|local-address <A.B.C.D|X:X::X:X>$local|interface IFNAME$ifname|vrf NAME$vrf_name}] +.. index:: peer <A.B.C.D|X:X::X:X>$peer [{multihop|local-address <A.B.C.D|X:X::X:X>$local|interface IFNAME$ifname|vrf NAME$vrf_name}] .. clicmd:: no peer <A.B.C.D|X:X::X:X>$peer [{multihop|local-address <A.B.C.D|X:X::X:X>$local|interface IFNAME$ifname|vrf NAME$vrf_name}] Stops and removes the selected peer. @@ -91,7 +91,7 @@ BFDd Commands Creates a peer profile that can be configured in multiple peers. -.. index:: no profile WORD +.. index:: profile WORD .. clicmd:: no profile WORD Deletes a peer profile. Any peer using the profile will have their @@ -151,7 +151,7 @@ BFD peers and profiles share the same BFD session configuration commands. Configures the minimal echo receive transmission interval that this system is capable of handling. -.. index:: [no] echo-mode +.. index:: echo-mode .. clicmd:: [no] echo-mode Enables or disables the echo transmission mode. This mode is disabled @@ -164,14 +164,14 @@ BFD peers and profiles share the same BFD session configuration commands. Echo mode is not supported on multi-hop setups (see :rfc:`5883` section 3). -.. index:: [no] shutdown +.. index:: shutdown .. clicmd:: [no] shutdown Enables or disables the peer. When the peer is disabled an 'administrative down' message is sent to the remote peer. -.. index:: [no] passive-mode +.. index:: passive-mode .. clicmd:: [no] passive-mode Mark session as passive: a passive session will not attempt to start @@ -184,7 +184,7 @@ BFD peers and profiles share the same BFD session configuration commands. The default is active-mode (or ``no passive-mode``). -.. index:: [no] minimum-ttl (1-254) +.. index:: minimum-ttl (1-254) .. clicmd:: [no] minimum-ttl (1-254) For multi hop sessions only: configure the minimum expected TTL for @@ -238,7 +238,7 @@ The following commands are available inside the BGP configuration node. the connection with its neighbor and, when it goes back up, notify BGP to try to connect to it. -.. index:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd .. clicmd:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd Removes any notification registration for this neighbor. @@ -253,7 +253,7 @@ The following commands are available inside the BGP configuration node. This is the case when graceful restart is enabled, and it is wished to ignore the BD event while waiting for the remote router to restart. -.. index:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd check-control-plane-failure +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd check-control-plane-failure .. clicmd:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd check-control-plane-failure Disallow to write CBIT independence in BFD outgoing packets. Also disallow @@ -267,7 +267,7 @@ The following commands are available inside the BGP configuration node. BFD profile to the sessions it creates or that already exist. -.. index:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd profile BFDPROF +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> bfd profile BFDPROF .. clicmd:: no neighbor <A.B.C.D|X:X::X:X|WORD> bfd profile BFDPROF Removes the BFD profile configuration from peer session(s). @@ -287,7 +287,7 @@ The following commands are available inside the interface configuration node. a new neighbor is found a BFD peer is created to monitor the link status for fast convergence. -.. index:: no isis bfd +.. index:: isis bfd .. clicmd:: no isis bfd Removes any notification registration for this interface peers. @@ -301,7 +301,7 @@ The following commands are available inside the interface configuration node. Use a BFD profile BFDPROF as provided in the BFD configuration. -.. index:: no isis bfd profile BFDPROF +.. index:: isis bfd profile BFDPROF .. clicmd:: no isis bfd profile BFDPROF Removes any BFD profile if present. @@ -320,7 +320,7 @@ The following commands are available inside the interface configuration node. a new neighbor is found a BFD peer is created to monitor the link status for fast convergence. -.. index:: no ip ospf bfd +.. index:: ip ospf bfd .. clicmd:: no ip ospf bfd Removes any notification registration for this interface peers. @@ -340,7 +340,7 @@ The following commands are available inside the interface configuration node. a new neighbor is found a BFD peer is created to monitor the link status for fast convergence. -.. index:: no ipv6 ospf6 bfd +.. index:: ipv6 ospf6 bfd .. clicmd:: no ipv6 ospf6 bfd Removes any notification registration for this interface peers. @@ -360,7 +360,7 @@ The following commands are available inside the interface configuration node. a new neighbor is found a BFD peer is created to monitor the link status for fast convergence. -.. index:: no ip pim bfd +.. index:: ip pim bfd .. clicmd:: no ip pim bfd Removes any notification registration for this interface peers. @@ -619,19 +619,19 @@ sure you have `debugging` level enabled: You may also fine tune the debug messages by selecting one or more of the debug levels: -.. index:: [no] debug bfd network +.. index:: debug bfd network .. clicmd:: [no] debug bfd network Toggle network events: show messages about socket failures and unexpected BFD messages that may not belong to registered peers. -.. index:: [no] debug bfd peer +.. index:: debug bfd peer .. clicmd:: [no] debug bfd peer Toggle peer event log messages: show messages about peer creation/removal and state changes. -.. index:: [no] debug bfd zebra +.. index:: debug bfd zebra .. clicmd:: [no] debug bfd zebra Toggle zebra message events: show messages about interfaces, local diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst index 339be7f4d6..a00b994988 100644 --- a/doc/user/bgp.rst +++ b/doc/user/bgp.rst @@ -35,6 +35,8 @@ be specified (:ref:`common-invocation-options`). of ``0.0.0.0`` / ``::``. This can be useful to constrain bgpd to an internal address, or to run multiple bgpd processes on one host. + Note that this option implies the --no_kernel option, and no learned routes will be installed into the linux kernel. + .. option:: -n, --no_kernel Do not install learned routes into the linux kernel. This option is useful @@ -245,7 +247,7 @@ internal or external. Enable a BGP protocol process with the specified ASN. After this statement you can input any `BGP Commands`. -.. index:: no router bgp ASN +.. index:: router bgp ASN .. clicmd:: no router bgp ASN Destroy a BGP protocol process with the specified ASN. @@ -418,7 +420,7 @@ Administrative Distance Metrics Require policy on EBGP ------------------------------- -.. index:: [no] bgp ebgp-requires-policy +.. index:: bgp ebgp-requires-policy .. clicmd:: [no] bgp ebgp-requires-policy This command requires incoming and outgoing filters to be applied @@ -447,7 +449,7 @@ Require policy on EBGP Reject routes with AS_SET or AS_CONFED_SET types ------------------------------------------------ -.. index:: [no] bgp reject-as-sets +.. index:: bgp reject-as-sets .. clicmd:: [no] bgp reject-as-sets This command enables rejection of incoming and outgoing routes having AS_SET or AS_CONFED_SET type. @@ -455,7 +457,7 @@ Reject routes with AS_SET or AS_CONFED_SET types Disable checking if nexthop is connected on EBGP sessions --------------------------------------------------------- -.. index:: [no] bgp disable-ebgp-connected-route-check +.. index:: bgp disable-ebgp-connected-route-check .. clicmd:: [no] bgp disable-ebgp-connected-route-check This command is used to disable the connection verification process for EBGP peering sessions @@ -912,7 +914,7 @@ BGP GR Peer Mode Commands Administrative Shutdown ----------------------- -.. index:: [no] bgp shutdown [message MSG...] +.. index:: bgp shutdown [message MSG...] .. clicmd:: [no] bgp shutdown [message MSG...] Administrative shutdown of all peers of a bgp instance. Drop all BGP peers, @@ -948,10 +950,10 @@ Networks routes if they aren't present in their IGP routing tables; `bgpd` doesn't care about IGP routes when announcing its routes. -.. index:: no network A.B.C.D/M +.. index:: network A.B.C.D/M .. clicmd:: no network A.B.C.D/M -.. index:: [no] bgp network import-check +.. index:: bgp network import-check .. clicmd:: [no] bgp network import-check This configuration modifies the behavior of the network statement. @@ -962,6 +964,53 @@ Networks traditional did not check for existence. For versions 7.4 and beyond both traditional and datacenter the network must exist. +.. _bgp-ipv6-support: + +IPv6 Support +------------ + +.. index:: neighbor A.B.C.D activate +.. clicmd:: [no] neighbor A.B.C.D activate + + This configuration modifies whether to enable an address family for a + specific neighbor. By default only the IPv4 unicast address family is + enabled. + + .. code-block:: frr + + router bgp 1 + address-family ipv6 unicast + neighbor 2001:0DB8::1 activate + network 2001:0DB8:5009::/64 + exit-address-family + + This configuration example says that network 2001:0DB8:5009::/64 will be + announced and enables the neighbor 2001:0DB8::1 to receive this announcement. + + By default, only the IPv4 unicast address family is announced to all + neighbors. Using the 'no bgp default ipv4-unicast' configuration overrides + this default so that all address families need to be enabled explicitly. + + .. code-block:: frr + + router bgp 1 + no bgp default ipv4-unicast + neighbor 10.10.10.1 remote-as 2 + neighbor 2001:0DB8::1 remote-as 3 + address-family ipv4 unicast + neighbor 10.10.10.1 activate + network 192.168.1.0/24 + exit-address-family + address-family ipv6 unicast + neighbor 2001:0DB8::1 activate + network 2001:0DB8:5009::/64 + exit-address-family + + This configuration demonstrates how the 'no bgp default ipv4-unicast' might + be used in a setup with two upstreams where each of the upstreams should only + receive either IPv4 or IPv6 annocuments. + + .. _bgp-route-aggregation: Route Aggregation @@ -1011,7 +1060,7 @@ Route Aggregation-IPv4 Address Family Similar to `summary-only`, but will only suppress more specific routes that are matched by the selected route-map. -.. index:: no aggregate-address A.B.C.D/M +.. index:: aggregate-address A.B.C.D/M .. clicmd:: no aggregate-address A.B.C.D/M This command removes an aggregate address. @@ -1075,7 +1124,7 @@ Route Aggregation-IPv6 Address Family Similar to `summary-only`, but will only suppress more specific routes that are matched by the selected route-map. -.. index:: no aggregate-address X:X::X:X/M +.. index:: aggregate-address X:X::X:X/M .. clicmd:: no aggregate-address X:X::X:X/M This command removes an aggregate address. @@ -1257,7 +1306,7 @@ Defining Peers peers ASN is the same as mine as specified under the :clicmd:`router bgp ASN` command the connection will be denied. -.. index:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME +.. index:: bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME .. clicmd:: [no] bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME Accept connections from any peers in the specified prefix. Configuration @@ -1281,7 +1330,7 @@ Defining Peers ``net.core.optmem_max`` to allow the kernel to allocate the necessary option memory. -.. index:: [no] coalesce-time (0-4294967295) +.. index:: coalesce-time (0-4294967295) .. clicmd:: [no] coalesce-time (0-4294967295) The time in milliseconds that BGP will delay before deciding what peers @@ -1293,7 +1342,7 @@ Defining Peers Configuring Peers ^^^^^^^^^^^^^^^^^ -.. index:: [no] neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]] +.. index:: neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]] .. clicmd:: [no] neighbor PEER shutdown [message MSG...] [rtt (1-65535) [count (1-255)]] Shutdown the peer. We can delete the neighbor's configuration by @@ -1303,19 +1352,19 @@ Configuring Peers Optionally you can specify a shutdown message `MSG`. - Also, you can specify optionally _rtt_ in milliseconds to automatically + Also, you can specify optionally ``rtt`` in milliseconds to automatically shutdown the peer if round-trip-time becomes higher than defined. - Additional _count_ parameter is the number of keepalive messages to count + Additional ``count`` parameter is the number of keepalive messages to count before shutdown the peer if round-trip-time becomes higher than defined. -.. index:: [no] neighbor PEER disable-connected-check +.. index:: neighbor PEER disable-connected-check .. clicmd:: [no] neighbor PEER disable-connected-check Allow peerings between directly connected eBGP peers using loopback addresses. -.. index:: [no] neighbor PEER ebgp-multihop +.. index:: neighbor PEER ebgp-multihop .. clicmd:: [no] neighbor PEER ebgp-multihop Specifying ``ebgp-multihop`` allows sessions with eBGP neighbors to @@ -1323,12 +1372,12 @@ Configuring Peers directly connected and this knob is not enabled, the session will not establish. -.. index:: [no] neighbor PEER description ... +.. index:: neighbor PEER description ... .. clicmd:: [no] neighbor PEER description ... Set description of the peer. -.. index:: [no] neighbor PEER version VERSION +.. index:: neighbor PEER version VERSION .. clicmd:: [no] neighbor PEER version VERSION Set up the neighbor's BGP version. `version` can be `4`, `4+` or `4-`. BGP @@ -1338,7 +1387,7 @@ Configuring Peers revision 00's Multiprotocol Extensions for BGP-4. Some routing software is still using this version. -.. index:: [no] neighbor PEER interface IFNAME +.. index:: neighbor PEER interface IFNAME .. clicmd:: [no] neighbor PEER interface IFNAME When you connect to a BGP peer over an IPv6 link-local address, you have to @@ -1349,7 +1398,7 @@ Configuring Peers This command is deprecated and may be removed in a future release. Its use should be avoided. -.. index:: [no] neighbor PEER next-hop-self [all] +.. index:: neighbor PEER next-hop-self [all] .. clicmd:: [no] neighbor PEER next-hop-self [all] This command specifies an announced route's nexthop as being equivalent to @@ -1365,7 +1414,7 @@ Configuring Peers configurations, as the route-map directive to leave the next-hop unchanged is only available for ipv4. -.. index:: [no] neighbor PEER update-source <IFNAME|ADDRESS> +.. index:: neighbor PEER update-source <IFNAME|ADDRESS> .. clicmd:: [no] neighbor PEER update-source <IFNAME|ADDRESS> Specify the IPv4 source address to use for the :abbr:`BGP` session to this @@ -1380,7 +1429,7 @@ Configuring Peers neighbor bar update-source lo0 -.. index:: [no] neighbor PEER default-originate +.. index:: neighbor PEER default-originate .. clicmd:: [no] neighbor PEER default-originate *bgpd*'s default is to not announce the default route (0.0.0.0/0) even if it @@ -1390,7 +1439,7 @@ Configuring Peers .. index:: neighbor PEER port PORT .. clicmd:: neighbor PEER port PORT -.. index:: [no] neighbor PEER password PASSWORD +.. index:: neighbor PEER password PASSWORD .. clicmd:: [no] neighbor PEER password PASSWORD Set a MD5 password to be used with the tcp socket that is being used @@ -1402,12 +1451,12 @@ Configuring Peers .. index:: neighbor PEER send-community .. clicmd:: neighbor PEER send-community -.. index:: [no] neighbor PEER weight WEIGHT +.. index:: neighbor PEER weight WEIGHT .. clicmd:: [no] neighbor PEER weight WEIGHT This command specifies a default `weight` value for the neighbor's routes. -.. index:: [no] neighbor PEER maximum-prefix NUMBER [force] +.. index:: neighbor PEER maximum-prefix NUMBER [force] .. clicmd:: [no] neighbor PEER maximum-prefix NUMBER [force] Sets a maximum number of prefixes we can receive from a given peer. If this @@ -1420,12 +1469,12 @@ Configuring Peers granular and offers much smarter matching criterion than number of received prefixes, making it more suited to implementing policy. - If _force_ is set, then ALL prefixes are counted for maximum instead of + If ``force`` is set, then ALL prefixes are counted for maximum instead of accepted only. This is useful for cases where an inbound filter is applied, but you want maximum-prefix to act on ALL (including filtered) prefixes. This option requires `soft-reconfiguration inbound` to be enabled for the peer. -.. index:: [no] neighbor PEER maximum-prefix-out NUMBER +.. index:: neighbor PEER maximum-prefix-out NUMBER .. clicmd:: [no] neighbor PEER maximum-prefix-out NUMBER Sets a maximum number of prefixes we can send to a given peer. @@ -1433,7 +1482,7 @@ Configuring Peers Since sent prefix count is managed by update-groups, this option creates a separate update-group for outgoing updates. -.. index:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] +.. index:: neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] .. clicmd:: [no] neighbor PEER local-as AS-NUMBER [no-prepend] [replace-as] Specify an alternate AS for this BGP process when interacting with the @@ -1452,7 +1501,7 @@ Configuring Peers This command is only allowed for eBGP peers. -.. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> as-override +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> as-override .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> as-override Override AS number of the originating router with the local AS number. @@ -1465,7 +1514,7 @@ Configuring Peers This command is only allowed for eBGP peers. -.. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>] +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>] .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>] Accept incoming routes with AS path containing AS number with the same value @@ -1483,19 +1532,19 @@ Configuring Peers This command is only allowed for eBGP peers. -.. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths Configure BGP to send all known paths to neighbor in order to preserve multi path capabilities inside a network. -.. index:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS +.. index:: neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS .. clicmd:: [no] neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS Configure BGP to send best known paths to neighbor in order to preserve multi path capabilities inside a network. -.. index:: [no] neighbor PEER ttl-security hops NUMBER +.. index:: neighbor PEER ttl-security hops NUMBER .. clicmd:: [no] neighbor PEER ttl-security hops NUMBER This command enforces Generalized TTL Security Mechanism (GTSM), as @@ -1503,7 +1552,7 @@ Configuring Peers specified number of hops away will be allowed to become neighbors. This command is mutually exclusive with *ebgp-multihop*. -.. index:: [no] neighbor PEER capability extended-nexthop +.. index:: neighbor PEER capability extended-nexthop .. clicmd:: [no] neighbor PEER capability extended-nexthop Allow bgp to negotiate the extended-nexthop capability with it's peer. @@ -1512,7 +1561,7 @@ Configuring Peers turning on this command will allow BGP to install v4 routes with v6 nexthops if you do not have v4 configured on interfaces. -.. index:: [no] bgp fast-external-failover +.. index:: bgp fast-external-failover .. clicmd:: [no] bgp fast-external-failover This command causes bgp to not take down ebgp peers immediately @@ -1520,27 +1569,27 @@ Configuring Peers and will not be displayed as part of a `show run`. The no form of the command turns off this ability. -.. index:: [no] bgp default ipv4-unicast +.. index:: bgp default ipv4-unicast .. clicmd:: [no] bgp default ipv4-unicast This command allows the user to specify that v4 peering is turned on by default or not. This command defaults to on and is not displayed. The `no bgp default ipv4-unicast` form of the command is displayed. -.. index:: [no] bgp default show-hostname +.. index:: bgp default show-hostname .. clicmd:: [no] bgp default show-hostname This command shows the hostname of the peer in certain BGP commands outputs. It's easier to troubleshoot if you have a number of BGP peers. -.. index:: [no] bgp default show-nexthop-hostname +.. index:: bgp default show-nexthop-hostname .. clicmd:: [no] bgp default show-nexthop-hostname This command shows the hostname of the next-hop in certain BGP commands outputs. It's easier to troubleshoot if you have a number of BGP peers and a number of routes to check. -.. index:: [no] neighbor PEER advertisement-interval (0-600) +.. index:: neighbor PEER advertisement-interval (0-600) .. clicmd:: [no] neighbor PEER advertisement-interval (0-600) Setup the minimum route advertisement interval(mrai) for the @@ -1585,7 +1634,7 @@ Peer Filtering on reflected routes. This option allows the modifications to be reflected as well. Once enabled, it affects all reflected routes. -.. index:: [no] neighbor PEER sender-as-path-loop-detection +.. index:: neighbor PEER sender-as-path-loop-detection .. clicmd:: [no] neighbor PEER sender-as-path-loop-detection Enable the detection of sender side AS path loops and filter the @@ -1629,7 +1678,7 @@ Capability Negotiation .. index:: neighbor PEER strict-capability-match .. clicmd:: neighbor PEER strict-capability-match -.. index:: no neighbor PEER strict-capability-match +.. index:: neighbor PEER strict-capability-match .. clicmd:: no neighbor PEER strict-capability-match Strictly compares remote capabilities and local capabilities. If @@ -1641,7 +1690,7 @@ Capability Negotiation Negotiation. Please use *dont-capability-negotiate* command to disable the feature. -.. index:: [no] neighbor PEER dont-capability-negotiate +.. index:: neighbor PEER dont-capability-negotiate .. clicmd:: [no] neighbor PEER dont-capability-negotiate Suppress sending Capability Negotiation as OPEN message optional parameter @@ -1665,7 +1714,7 @@ Capability Negotiation .. index:: neighbor PEER override-capability .. clicmd:: neighbor PEER override-capability -.. index:: no neighbor PEER override-capability +.. index:: neighbor PEER override-capability .. clicmd:: no neighbor PEER override-capability Override the result of Capability Negotiation with local configuration. @@ -1683,10 +1732,10 @@ AS path access list is user defined AS path. This command defines a new AS path access list. -.. index:: no bgp as-path access-list WORD +.. index:: bgp as-path access-list WORD .. clicmd:: no bgp as-path access-list WORD -.. index:: no bgp as-path access-list WORD permit|deny LINE +.. index:: bgp as-path access-list WORD permit|deny LINE .. clicmd:: no bgp as-path access-list WORD permit|deny LINE .. _bgp-bogon-filter-example: @@ -1705,20 +1754,20 @@ Bogon ASN filter policy configuration example Using AS Path in Route Map -------------------------- -.. index:: [no] match as-path WORD +.. index:: match as-path WORD .. clicmd:: [no] match as-path WORD For a given as-path, WORD, match it on the BGP as-path given for the prefix and if it matches do normal route-map actions. The no form of the command removes this match from the route-map. -.. index:: [no] set as-path prepend AS-PATH +.. index:: set as-path prepend AS-PATH .. clicmd:: [no] set as-path prepend AS-PATH Prepend the given string of AS numbers to the AS_PATH of the BGP path's NLRI. The no form of this command removes this set operation from the route-map. -.. index:: [no] set as-path prepend last-as NUM +.. index:: set as-path prepend last-as NUM .. clicmd:: [no] set as-path prepend last-as NUM Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. @@ -1898,7 +1947,7 @@ expanded for backward compatibility. Use of this feature is not recommended. -.. index:: no bgp community-list [standard|expanded] NAME +.. index:: bgp community-list [standard|expanded] NAME .. clicmd:: no bgp community-list [standard|expanded] NAME Deletes the community list specified by ``NAME``. All community lists share @@ -2180,13 +2229,13 @@ Extended Community Lists expression (:ref:`bgp-regular-expressions`) to match an extended communities attribute in BGP updates. -.. index:: no bgp extcommunity-list NAME +.. index:: bgp extcommunity-list NAME .. clicmd:: no bgp extcommunity-list NAME -.. index:: no bgp extcommunity-list standard NAME +.. index:: bgp extcommunity-list standard NAME .. clicmd:: no bgp extcommunity-list standard NAME -.. index:: no bgp extcommunity-list expanded NAME +.. index:: bgp extcommunity-list expanded NAME .. clicmd:: no bgp extcommunity-list expanded NAME These commands delete extended community lists specified by `name`. All of @@ -2295,13 +2344,13 @@ Two types of large community lists are supported, namely `standard` and lowest to highest. `line` can also be a regular expression which matches this Large Community attribute. -.. index:: no bgp large-community-list NAME +.. index:: bgp large-community-list NAME .. clicmd:: no bgp large-community-list NAME -.. index:: no bgp large-community-list standard NAME +.. index:: bgp large-community-list standard NAME .. clicmd:: no bgp large-community-list standard NAME -.. index:: no bgp large-community-list expanded NAME +.. index:: bgp large-community-list expanded NAME .. clicmd:: no bgp large-community-list expanded NAME These commands delete Large Community lists specified by `name`. All Large @@ -2431,7 +2480,7 @@ address-family: Specifies the route distinguisher to be added to a route exported from the current unicast VRF to VPN. -.. index:: no rd vpn export [AS:NN|IP:nn] +.. index:: rd vpn export [AS:NN|IP:nn] .. clicmd:: no rd vpn export [AS:NN|IP:nn] Deletes any previously-configured export route distinguisher. @@ -2447,7 +2496,7 @@ address-family: extended community values as described in :ref:`bgp-extended-communities-attribute`. -.. index:: no rt vpn import|export|both [RTLIST...] +.. index:: rt vpn import|export|both [RTLIST...] .. clicmd:: no rt vpn import|export|both [RTLIST...] Deletes any previously-configured import or export route-target list. @@ -2461,7 +2510,7 @@ address-family: is not running, or if this command is not configured, automatic label assignment will not complete, which will block corresponding route export. -.. index:: no label vpn export [(0..1048575)|auto] +.. index:: label vpn export [(0..1048575)|auto] .. clicmd:: no label vpn export [(0..1048575)|auto] Deletes any previously-configured export label. @@ -2473,7 +2522,7 @@ address-family: the current unicast VRF to VPN. If left unspecified, the nexthop will be set to 0.0.0.0 or 0:0::0:0 (self). -.. index:: no nexthop vpn export [A.B.C.D|X:X::X:X] +.. index:: nexthop vpn export [A.B.C.D|X:X::X:X] .. clicmd:: no nexthop vpn export [A.B.C.D|X:X::X:X] Deletes any previously-configured export nexthop. @@ -2484,7 +2533,7 @@ address-family: Specifies an optional route-map to be applied to routes imported or exported between the current unicast VRF and VPN. -.. index:: no route-map vpn import|export [MAP] +.. index:: route-map vpn import|export [MAP] .. clicmd:: no route-map vpn import|export [MAP] Deletes any previously-configured import or export route-map. @@ -2494,7 +2543,7 @@ address-family: Enables import or export of routes between the current unicast VRF and VPN. -.. index:: no import|export vpn +.. index:: import|export vpn .. clicmd:: no import|export vpn Disables import or export of routes between the current unicast VRF and VPN. @@ -2512,7 +2561,7 @@ address-family: The CLI will disallow attempts to configure incompatible leaking modes. -.. index:: no import vrf VRFNAME +.. index:: import vrf VRFNAME .. clicmd:: no import vrf VRFNAME Disables automatic leaking from vrf VRFNAME to the current VRF using @@ -2568,12 +2617,119 @@ disable the feature via configuration CLI. Once the feature is disable under bgp vrf instance or MAC-VLAN interface is not configured, all the routes follow the same behavior of using same next-hop and RMAC values. -.. index:: [no] advertise-pip [ip <addr> [mac <addr>]] +.. index:: advertise-pip [ip <addr> [mac <addr>]] .. clicmd:: [no] advertise-pip [ip <addr> [mac <addr>]] Enables or disables advertise-pip feature, specifiy system-IP and/or system-MAC parameters. +EVPN Multihoming +^^^^^^^^^^^^^^^^ + +All-Active Multihoming is used for redundancy and load sharing. Servers +are attached to two or more PEs and the links are bonded (link-aggregation). +This group of server links is referred to as an Ethernet Segment. + +Ethernet Segments +""""""""""""""""" +An Ethernet Segment can be configured by specifying a system-MAC and a +local discriminatior against the bond interface on the PE (via zebra) - + +.. index:: evpn mh es-id [(1-16777215)$es_lid] +.. clicmd:: [no] evpn mh es-id [(1-16777215)$es_lid] + +.. index:: evpn mh es-sys-mac [X:X:X:X:X:X$mac] +.. clicmd:: [no$no] evpn mh es-sys-mac [X:X:X:X:X:X$mac] + +The sys-mac and local discriminator are used for generating a 10-byte, +Type-3 Ethernet Segment ID. + +Type-1 (EAS-per-ES and EAD-per-EVI) routes are used to advertise the locally +attached ESs and to learn off remote ESs in the network. Local Type-2/MAC-IP +routes are also advertised with a destination ESI allowing for MAC-IP syncing +between Ethernet Segment peers. +Reference: RFC 7432, RFC 8365 + +EVPN-MH is intended as a replacement for MLAG or Anycast VTEPs. In +multihoming each PE has an unique VTEP address which requires the introduction +of a new dataplane construct, MAC-ECMP. Here a MAC/FDB entry can point to a +list of remote PEs/VTEPs. + +BUM handling +"""""""""""" +Type-4 (ESR) routes are used for Designated Forwarder (DF) election. DFs +forward BUM traffic received via the overlay network. This implementation +uses a preference based DF election specified by draft-ietf-bess-evpn-pref-df. +The DF preference is configurable per-ES (via zebra) - + +.. index:: evpn mh es-df-pref [(1-16777215)$df_pref] +.. clicmd:: [no] evpn mh es-df-pref [(1-16777215)$df_pref] + +BUM traffic is rxed via the overlay by all PEs attached to a server but +only the DF can forward the de-capsulated traffic to the access port. To +accomodate that non-DF filters are installed in the dataplane to drop +the traffic. + +Similarly traffic received from ES peers via the overlay cannot be forwarded +to the server. This is split-horizon-filtering with local bias. + +Fast failover +""""""""""""" +As the primary purpose of EVPN-MH is redundancy keeping the failover efficient +is a recurring theme in the implementation. Following sub-features have +been introduced for the express purpose of efficient ES failovers. + +- Layer-2 Nexthop Groups and MAC-ECMP via L2NHG. + +- Host routes (for symmetric IRB) via L3NHG. + On dataplanes that support layer3 nexthop groups the feature can be turned + on via the following BGP config - + +.. index:: use-es-l3nhg +.. clicmd:: [no$no] use-es-l3nhg + +- Local ES (MAC/Neigh) failover via ES-redirect. + On dataplanes that do not have support for ES-redirect the feature can be + turned off via the following zebra config - + +.. index:: evpn mh redirect-off +.. clicmd:: [no$no] evpn mh redirect-off + +Uplink/Core tracking +"""""""""""""""""""" +When all the underlay links go down the PE no longer has access to the VxLAN ++overlay. To prevent blackholing of traffic the server/ES links are +protodowned on the PE. A link can be setup for uplink tracking via the +following zebra configuration - + +.. index:: evpn mh uplink +.. clicmd:: [no] evpn mh uplink + +Proxy advertisements +"""""""""""""""""""" +To handle hitless upgrades support for proxy advertisement has been added +as specified by draft-rbickhart-evpn-ip-mac-proxy-adv. This allows a PE +(say PE1) to proxy advertise a MAC-IP rxed from an ES peer (say PE2). When +the ES peer (PE2) goes down PE1 continues to advertise hosts learnt from PE2 +for a holdtime during which it attempts to establish local reachability of +the host. This holdtime is configurable via the following zebra commands - + +.. index:: evpn mh neigh-holdtime (0-86400)$duration +.. clicmd:: [no$no] evpn mh neigh-holdtime (0-86400)$duration + +.. index:: evpn mh mac-holdtime (0-86400)$duration +.. clicmd:: [no$no] evpn mh mac-holdtime (0-86400)$duration + +Startup delay +""""""""""""" +When a switch is rebooted we wait for a brief period to allow the underlay +and EVPN network to converge before enabling the ESs. For this duration the +ES bonds are held protodown. The startup delay is configurable via the +following zebra command - + +.. index:: evpn mh startup-delay(0-3600)$duration +.. clicmd:: [no] evpn mh startup-delay(0-3600)$duration + +Support with VRF network namespace backend +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is possible to separate overlay networks contained in VXLAN interfaces from @@ -2630,7 +2786,7 @@ advertisement to take effect is 60 seconds. The conditional advertisement can ta effect depending on when the tracked route is removed from the BGP table and when the next instance of the BGP scanner occurs. -.. index:: [no] neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME +.. index:: neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME .. clicmd:: [no] neighbor A.B.C.D advertise-map NAME [exist-map|non-exist-map] NAME This command enables BGP scanner process to monitor routes specified by @@ -2799,44 +2955,44 @@ Debugging Display Listen sockets and the vrf that created them. Useful for debugging of when listen is not working and this is considered a developer debug statement. -.. index:: [no] debug bgp neighbor-events +.. index:: debug bgp neighbor-events .. clicmd:: [no] debug bgp neighbor-events Enable or disable debugging for neighbor events. This provides general information on BGP events such as peer connection / disconnection, session establishment / teardown, and capability negotiation. -.. index:: [no] debug bgp updates +.. index:: debug bgp updates .. clicmd:: [no] debug bgp updates Enable or disable debugging for BGP updates. This provides information on BGP UPDATE messages transmitted and received between local and remote instances. -.. index:: [no] debug bgp keepalives +.. index:: debug bgp keepalives .. clicmd:: [no] debug bgp keepalives Enable or disable debugging for BGP keepalives. This provides information on BGP KEEPALIVE messages transmitted and received between local and remote instances. -.. index:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M> +.. index:: debug bgp bestpath <A.B.C.D/M|X:X::X:X/M> .. clicmd:: [no] debug bgp bestpath <A.B.C.D/M|X:X::X:X/M> Enable or disable debugging for bestpath selection on the specified prefix. -.. index:: [no] debug bgp nht +.. index:: debug bgp nht .. clicmd:: [no] debug bgp nht Enable or disable debugging of BGP nexthop tracking. -.. index:: [no] debug bgp update-groups +.. index:: debug bgp update-groups .. clicmd:: [no] debug bgp update-groups Enable or disable debugging of dynamic update groups. This provides general information on group creation, deletion, join and prune events. -.. index:: [no] debug bgp zebra +.. index:: debug bgp zebra .. clicmd:: [no] debug bgp zebra Enable or disable debugging of communications between *bgpd* and *zebra*. @@ -2850,7 +3006,7 @@ Dumping Messages and Routing Tables .. index:: dump bgp all-et PATH [INTERVAL] .. clicmd:: dump bgp all-et PATH [INTERVAL] -.. index:: no dump bgp all [PATH] [INTERVAL] +.. index:: dump bgp all [PATH] [INTERVAL] .. clicmd:: no dump bgp all [PATH] [INTERVAL] Dump all BGP packet and events to `path` file. @@ -2865,7 +3021,7 @@ Dumping Messages and Routing Tables .. index:: dump bgp updates-et PATH [INTERVAL] .. clicmd:: dump bgp updates-et PATH [INTERVAL] -.. index:: no dump bgp updates [PATH] [INTERVAL] +.. index:: dump bgp updates [PATH] [INTERVAL] .. clicmd:: no dump bgp updates [PATH] [INTERVAL] Dump only BGP updates messages to `path` file. @@ -2880,7 +3036,7 @@ Dumping Messages and Routing Tables .. index:: dump bgp routes-mrt PATH INTERVAL .. clicmd:: dump bgp routes-mrt PATH INTERVAL -.. index:: no dump bgp route-mrt [PATH] [INTERVAL] +.. index:: dump bgp route-mrt [PATH] [INTERVAL] .. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL] Dump whole BGP routing table to `path`. This is heavy process. The path @@ -3015,16 +3171,16 @@ displays IPv6 routing table. Total number of prefixes 1 - If _wide_ option is specified, then the prefix table's width is increased + If ``wide`` option is specified, then the prefix table's width is increased to fully display the prefix and the nexthop. This is especially handy dealing with IPv6 prefixes and if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. - If _all_ option is specified, _ip_ keyword is ignored, show bgp all and + If ``all`` option is specified, ``ip`` keyword is ignored, show bgp all and show ip bgp all commands display routes for all AFIs and SAFIs. - If _json_ option is specified, output is displayed in JSON format. + If ``json`` option is specified, output is displayed in JSON format. Some other commands provide additional options for filtering the output. @@ -3118,18 +3274,18 @@ structure is extended with :clicmd:`show bgp [afi] [safi]`. from neighbor or filtered routes received from neighbor based on the option specified. - If _wide_ option is specified, then the prefix table's width is increased + If ``wide`` option is specified, then the prefix table's width is increased to fully display the prefix and the nexthop. This is especially handy dealing with IPv6 prefixes and if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. - If _all_ option is specified, _ip_ keyword is ignored and, + If ``all`` option is specified, ``ip`` keyword is ignored and, routes displayed for all AFIs and SAFIs. - if afi is specified, with _all_ option, routes will be displayed for + if afi is specified, with ``all`` option, routes will be displayed for each SAFI in the selcted AFI - If _json_ option is specified, output is displayed in JSON format. + If ``json`` option is specified, output is displayed in JSON format. .. _bgp-display-routes-by-community: @@ -3163,18 +3319,18 @@ attribute. match the specified community list. When `exact-match` is specified, it displays only routes that have an exact match. - If _wide_ option is specified, then the prefix table's width is increased + If ``wide`` option is specified, then the prefix table's width is increased to fully display the prefix and the nexthop. This is especially handy dealing with IPv6 prefixes and if :clicmd:`[no] bgp default show-nexthop-hostname` is enabled. - If _all_ option is specified, _ip_ keyword is ignored and, + If ``all`` option is specified, ``ip`` keyword is ignored and, routes displayed for all AFIs and SAFIs. - if afi is specified, with _all_ option, routes will be displayed for + if afi is specified, with ``all`` option, routes will be displayed for each SAFI in the selcted AFI - If _json_ option is specified, output is displayed in JSON format. + If ``json`` option is specified, output is displayed in JSON format. .. _bgp-display-routes-by-lcommunity: @@ -3280,7 +3436,7 @@ with: .. index:: neighbor PEER route-reflector-client .. clicmd:: neighbor PEER route-reflector-client -.. index:: no neighbor PEER route-reflector-client +.. index:: neighbor PEER route-reflector-client .. clicmd:: no neighbor PEER route-reflector-client To avoid single points of failure, multiple route reflectors can be configured. @@ -3291,7 +3447,7 @@ by route reflectors to avoid looping. .. index:: bgp cluster-id A.B.C.D .. clicmd:: bgp cluster-id A.B.C.D -.. index:: [no] bgp no-rib +.. index:: bgp no-rib .. clicmd:: [no] bgp no-rib To set and unset the BGP daemon ``-n`` / ``--no_kernel`` options during runtime @@ -3305,6 +3461,49 @@ starting the daemon and the configuration gets saved, the option will persist unless removed from the configuration with the negating command prior to the configuration write operation. +.. _bgp-suppress-fib: + +Suppressing routes not installed in FIB +======================================= + +The FRR implementation of BGP advertises prefixes learnt from a peer to other +peers even if the routes do not get installed in the FIB. There can be +scenarios where the hardware tables in some of the routers (along the path from +the source to destination) is full which will result in all routes not getting +installed in the FIB. If these routes are advertised to the downstream routers +then traffic will start flowing and will be dropped at the intermediate router. + +The solution is to provide a configurable option to check for the FIB install +status of the prefixes and advertise to peers if the prefixes are successfully +installed in the FIB. The advertisement of the prefixes are suppressed if it is +not installed in FIB. + +The following conditions apply will apply when checking for route installation +status in FIB: + +1. The advertisement or suppression of routes based on FIB install status + applies only for newly learnt routes from peer (routes which are not in + BGP local RIB). +2. If the route received from peer already exists in BGP local RIB and route + attributes have changed (best path changed), the old path is deleted and + new path is installed in FIB. The FIB install status will not have any + effect. Therefore only when the route is received first time the checks + apply. +3. The feature will not apply for routes learnt through other means like + redistribution to bgp from other protocols. This is applicable only to + peer learnt routes. +4. If a route is installed in FIB and then gets deleted from the dataplane, + then routes will not be withdrawn from peers. This will be considered as + dataplane issue. +5. The feature will slightly increase the time required to advertise the routes + to peers since the route install status needs to be received from the FIB +6. If routes are received by the peer before the configuration is applied, then + the bgp sessions need to be reset for the configuration to take effect. +7. If the route which is already installed in dataplane is removed for some + reason, sending withdraw message to peers is not currently supported. + +.. index:: bgp suppress-fib-pending +.. clicmd:: [no] bgp suppress-fib-pending .. _routing-policy: diff --git a/doc/user/eigrpd.rst b/doc/user/eigrpd.rst index 915270a562..4ce2e280c7 100644 --- a/doc/user/eigrpd.rst +++ b/doc/user/eigrpd.rst @@ -73,7 +73,7 @@ EIGRP Configuration carrying out any of the EIGRP commands. Specify vrf NAME if you want eigrp to work within the specified vrf. -.. index:: no router eigrp (1-65535) [vrf NAME] +.. index:: router eigrp (1-65535) [vrf NAME] .. clicmd:: no router eigrp (1-65535) [vrf NAME] Disable EIGRP. @@ -81,7 +81,7 @@ EIGRP Configuration .. index:: network NETWORK .. clicmd:: network NETWORK -.. index:: no network NETWORK +.. index:: network NETWORK .. clicmd:: no network NETWORK Set the EIGRP enable interface by `network`. The interfaces which @@ -107,7 +107,7 @@ EIGRP Configuration .. index:: passive-interface (IFNAME|default) .. clicmd:: passive-interface (IFNAME|default) -.. index:: no passive-interface IFNAME +.. index:: passive-interface IFNAME .. clicmd:: no passive-interface IFNAME This command sets the specified interface to passive mode. On passive mode @@ -129,7 +129,7 @@ How to Announce EIGRP route .. index:: redistribute kernel metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) .. clicmd:: redistribute kernel metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) -.. index:: no redistribute kernel +.. index:: redistribute kernel .. clicmd:: no redistribute kernel `redistribute kernel` redistributes routing information from kernel route @@ -141,7 +141,7 @@ How to Announce EIGRP route .. index:: redistribute static metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) .. clicmd:: redistribute static metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) -.. index:: no redistribute static +.. index:: redistribute static .. clicmd:: no redistribute static `redistribute static` redistributes routing information from static route @@ -153,7 +153,7 @@ How to Announce EIGRP route .. index:: redistribute connected metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) .. clicmd:: redistribute connected metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) -.. index:: no redistribute connected +.. index:: redistribute connected .. clicmd:: no redistribute connected Redistribute connected routes into the EIGRP tables. `no redistribute @@ -167,7 +167,7 @@ How to Announce EIGRP route .. index:: redistribute ospf metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) .. clicmd:: redistribute ospf metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) -.. index:: no redistribute ospf +.. index:: redistribute ospf .. clicmd:: no redistribute ospf `redistribute ospf` redistributes routing information from ospf route @@ -179,7 +179,7 @@ How to Announce EIGRP route .. index:: redistribute bgp metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) .. clicmd:: redistribute bgp metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) -.. index:: no redistribute bgp +.. index:: redistribute bgp .. clicmd:: no redistribute bgp `redistribute bgp` redistributes routing information from bgp route entries diff --git a/doc/user/fabricd.rst b/doc/user/fabricd.rst index cf0f937c13..a74d3e098b 100644 --- a/doc/user/fabricd.rst +++ b/doc/user/fabricd.rst @@ -35,7 +35,7 @@ in the configuration: .. index:: router openfabric WORD .. clicmd:: router openfabric WORD -.. index:: no router openfabric WORD +.. index:: router openfabric WORD .. clicmd:: no router openfabric WORD Enable or disable the OpenFabric process by specifying the OpenFabric domain with @@ -44,7 +44,7 @@ in the configuration: .. index:: net XX.XXXX. ... .XXX.XX .. clicmd:: net XX.XXXX. ... .XXX.XX -.. index:: no net XX.XXXX. ... .XXX.XX +.. index:: net XX.XXXX. ... .XXX.XX .. clicmd:: no net XX.XXXX. ... .XXX.XX Set/Unset network entity title (NET) provided in ISO format. @@ -52,7 +52,7 @@ in the configuration: .. index:: domain-password [clear | md5] <password> .. clicmd:: domain-password [clear | md5] <password> -.. index:: no domain-password +.. index:: domain-password .. clicmd:: no domain-password Configure the authentication password for a domain, as clear text or md5 one. @@ -60,7 +60,7 @@ in the configuration: .. index:: log-adjacency-changes .. clicmd:: log-adjacency-changes -.. index:: no log-adjacency-changes +.. index:: log-adjacency-changes .. clicmd:: no log-adjacency-changes Log changes in adjacency state. @@ -68,7 +68,7 @@ in the configuration: .. index:: set-overload-bit .. clicmd:: set-overload-bit -.. index:: no set-overload-bit +.. index:: set-overload-bit .. clicmd:: no set-overload-bit Set overload bit to avoid any transit traffic. @@ -76,7 +76,7 @@ in the configuration: .. index:: purge-originator .. clicmd:: purge-originator -.. index:: no purge-originator +.. index:: purge-originator .. clicmd:: no purge-originator Enable or disable :rfc:`6232` purge originator identification. @@ -84,7 +84,7 @@ in the configuration: .. index:: fabric-tier (0-14) .. clicmd:: fabric-tier (0-14) -.. index:: no fabric-tier +.. index:: fabric-tier .. clicmd:: no fabric-tier Configure a static tier number to advertise as location in the fabric @@ -97,7 +97,7 @@ OpenFabric Timer .. index:: lsp-gen-interval (1-120) .. clicmd:: lsp-gen-interval (1-120) -.. index:: no lsp-gen-interval +.. index:: lsp-gen-interval .. clicmd:: no lsp-gen-interval Set minimum interval in seconds between regenerating same LSP. @@ -105,7 +105,7 @@ OpenFabric Timer .. index:: lsp-refresh-interval (1-65235) .. clicmd:: lsp-refresh-interval (1-65235) -.. index:: no lsp-refresh-interval +.. index:: lsp-refresh-interval .. clicmd:: no lsp-refresh-interval Set LSP refresh interval in seconds. @@ -113,7 +113,7 @@ OpenFabric Timer .. index:: max-lsp-lifetime (360-65535) .. clicmd:: max-lsp-lifetime (360-65535) -.. index:: no max-lsp-lifetime +.. index:: max-lsp-lifetime .. clicmd:: no max-lsp-lifetime Set LSP maximum LSP lifetime in seconds. @@ -121,7 +121,7 @@ OpenFabric Timer .. index:: spf-interval (1-120) .. clicmd:: spf-interval (1-120) -.. index:: no spf-interval +.. index:: spf-interval .. clicmd:: no spf-interval Set minimum interval between consecutive SPF calculations in seconds. @@ -134,7 +134,7 @@ OpenFabric interface .. index:: ip router openfabric WORD .. clicmd:: ip router openfabric WORD -.. index:: no ip router openfabric WORD +.. index:: ip router openfabric WORD .. clicmd:: no ip router openfabric WORD .. _ip-router-openfabric-word: @@ -146,7 +146,7 @@ OpenFabric interface .. index:: openfabric csnp-interval (1-600) .. clicmd:: openfabric csnp-interval (1-600) -.. index:: no openfabric csnp-interval +.. index:: openfabric csnp-interval .. clicmd:: no openfabric csnp-interval Set CSNP interval in seconds. @@ -154,7 +154,7 @@ OpenFabric interface .. index:: openfabric hello-interval (1-600) .. clicmd:: openfabric hello-interval (1-600) -.. index:: no openfabric hello-interval +.. index:: openfabric hello-interval .. clicmd:: no openfabric hello-interval Set Hello interval in seconds. @@ -162,7 +162,7 @@ OpenFabric interface .. index:: openfabric hello-multiplier (2-100) .. clicmd:: openfabric hello-multiplier (2-100) -.. index:: no openfabric hello-multiplier +.. index:: openfabric hello-multiplier .. clicmd:: no openfabric hello-multiplier Set multiplier for Hello holding time. @@ -170,7 +170,7 @@ OpenFabric interface .. index:: openfabric metric (0-16777215) .. clicmd:: openfabric metric (0-16777215) -.. index:: no openfabric metric +.. index:: openfabric metric .. clicmd:: no openfabric metric Set interface metric value. @@ -178,7 +178,7 @@ OpenFabric interface .. index:: openfabric passive .. clicmd:: openfabric passive -.. index:: no openfabric passive +.. index:: openfabric passive .. clicmd:: no openfabric passive Configure the passive mode for this interface. @@ -186,7 +186,7 @@ OpenFabric interface .. index:: openfabric password [clear | md5] <password> .. clicmd:: openfabric password [clear | md5] <password> -.. index:: no openfabric password +.. index:: openfabric password .. clicmd:: no openfabric password Configure the authentication password (clear or encoded text) for the @@ -195,7 +195,7 @@ OpenFabric interface .. index:: openfabric psnp-interval (1-120) .. clicmd:: openfabric psnp-interval (1-120) -.. index:: no openfabric psnp-interval +.. index:: openfabric psnp-interval .. clicmd:: no openfabric psnp-interval Set PSNP interval in seconds. @@ -267,7 +267,7 @@ Debugging OpenFabric .. index:: debug openfabric adj-packets .. clicmd:: debug openfabric adj-packets -.. index:: no debug openfabric adj-packets +.. index:: debug openfabric adj-packets .. clicmd:: no debug openfabric adj-packets OpenFabric Adjacency related packets. @@ -275,7 +275,7 @@ OpenFabric Adjacency related packets. .. index:: debug openfabric checksum-errors .. clicmd:: debug openfabric checksum-errors -.. index:: no debug openfabric checksum-errors +.. index:: debug openfabric checksum-errors .. clicmd:: no debug openfabric checksum-errors OpenFabric LSP checksum errors. @@ -283,7 +283,7 @@ OpenFabric LSP checksum errors. .. index:: debug openfabric events .. clicmd:: debug openfabric events -.. index:: no debug openfabric events +.. index:: debug openfabric events .. clicmd:: no debug openfabric events OpenFabric Events. @@ -291,7 +291,7 @@ OpenFabric Events. .. index:: debug openfabric local-updates .. clicmd:: debug openfabric local-updates -.. index:: no debug openfabric local-updates +.. index:: debug openfabric local-updates .. clicmd:: no debug openfabric local-updates OpenFabric local update packets. @@ -299,7 +299,7 @@ OpenFabric local update packets. .. index:: debug openfabric lsp-gen .. clicmd:: debug openfabric lsp-gen -.. index:: no debug openfabric lsp-gen +.. index:: debug openfabric lsp-gen .. clicmd:: no debug openfabric lsp-gen Generation of own LSPs. @@ -307,7 +307,7 @@ Generation of own LSPs. .. index:: debug openfabric lsp-sched .. clicmd:: debug openfabric lsp-sched -.. index:: no debug openfabric lsp-sched +.. index:: debug openfabric lsp-sched .. clicmd:: no debug openfabric lsp-sched Debug scheduling of generation of own LSPs. @@ -315,7 +315,7 @@ Debug scheduling of generation of own LSPs. .. index:: debug openfabric packet-dump .. clicmd:: debug openfabric packet-dump -.. index:: no debug openfabric packet-dump +.. index:: debug openfabric packet-dump .. clicmd:: no debug openfabric packet-dump OpenFabric packet dump. @@ -323,7 +323,7 @@ OpenFabric packet dump. .. index:: debug openfabric protocol-errors .. clicmd:: debug openfabric protocol-errors -.. index:: no debug openfabric protocol-errors +.. index:: debug openfabric protocol-errors .. clicmd:: no debug openfabric protocol-errors OpenFabric LSP protocol errors. @@ -331,7 +331,7 @@ OpenFabric LSP protocol errors. .. index:: debug openfabric route-events .. clicmd:: debug openfabric route-events -.. index:: no debug openfabric route-events +.. index:: debug openfabric route-events .. clicmd:: no debug openfabric route-events OpenFabric Route related events. @@ -339,7 +339,7 @@ OpenFabric Route related events. .. index:: debug openfabric snp-packets .. clicmd:: debug openfabric snp-packets -.. index:: no debug openfabric snp-packets +.. index:: debug openfabric snp-packets .. clicmd:: no debug openfabric snp-packets OpenFabric CSNP/PSNP packets. @@ -353,13 +353,13 @@ OpenFabric CSNP/PSNP packets. .. index:: debug openfabric spf-triggers .. clicmd:: debug openfabric spf-triggers -.. index:: no debug openfabric spf-events +.. index:: debug openfabric spf-events .. clicmd:: no debug openfabric spf-events -.. index:: no debug openfabric spf-statistics +.. index:: debug openfabric spf-statistics .. clicmd:: no debug openfabric spf-statistics -.. index:: no debug openfabric spf-triggers +.. index:: debug openfabric spf-triggers .. clicmd:: no debug openfabric spf-triggers OpenFabric Shortest Path First Events, Timing and Statistic Data and triggering @@ -368,7 +368,7 @@ events. .. index:: debug openfabric update-packets .. clicmd:: debug openfabric update-packets -.. index:: no debug openfabric update-packets +.. index:: debug openfabric update-packets .. clicmd:: no debug openfabric update-packets Update related packets. diff --git a/doc/user/filter.rst b/doc/user/filter.rst index 98b768412d..910da7246d 100644 --- a/doc/user/filter.rst +++ b/doc/user/filter.rst @@ -98,7 +98,7 @@ is defined, and no match is found, default deny is applied. In the case of no le or ge command, the prefix length must match exactly the length specified in the prefix list. -.. index:: no ip prefix-list NAME +.. index:: ip prefix-list NAME .. clicmd:: no ip prefix-list NAME .. _ip-prefix-list-description: @@ -112,7 +112,7 @@ ip prefix-list description Descriptions may be added to prefix lists. This command adds a description to the prefix list. -.. index:: no ip prefix-list NAME description [DESC] +.. index:: ip prefix-list NAME description [DESC] .. clicmd:: no ip prefix-list NAME description [DESC] Deletes the description from a prefix list. It is possible to use the @@ -129,7 +129,7 @@ ip prefix-list sequential number control With this command, the IP prefix list sequential number is displayed. This is the default behavior. -.. index:: no ip prefix-list sequence-number +.. index:: ip prefix-list sequence-number .. clicmd:: no ip prefix-list sequence-number With this command, the IP prefix list sequential number is not diff --git a/doc/user/flowspec.rst b/doc/user/flowspec.rst index d3eb25a7c7..c303ebdba4 100644 --- a/doc/user/flowspec.rst +++ b/doc/user/flowspec.rst @@ -141,7 +141,7 @@ twice the traffic, or slow down the traffic (filtering costs). To limit Flowspec to one specific interface, use the following command, under `flowspec address-family` node. -.. index:: [no] local-install <IFNAME | any> +.. index:: local-install <IFNAME | any> .. clicmd:: [no] local-install <IFNAME | any> By default, Flowspec is activated on all interfaces. Installing it to a named @@ -168,7 +168,7 @@ following: - The first VRF with the matching Route Target will be selected to route traffic to. Use the following command under ipv4 unicast address-family node -.. index:: [no] rt redirect import RTLIST... +.. index:: rt redirect import RTLIST... .. clicmd:: [no] rt redirect import RTLIST... In order to illustrate, if the Route Target configured in the Flowspec entry is @@ -241,14 +241,14 @@ match. ``TABLEID`` is the table number identifier referencing the non standard routing table used in this example. -.. index:: [no] debug bgp flowspec +.. index:: debug bgp flowspec .. clicmd:: [no] debug bgp flowspec You can troubleshoot Flowspec, or BGP policy based routing. For instance, if you encounter some issues when decoding a Flowspec entry, you should enable :clicmd:`debug bgp flowspec`. -.. index:: [no] debug bgp pbr [error] +.. index:: debug bgp pbr [error] .. clicmd:: [no] debug bgp pbr [error] If you fail to apply the flowspec entry into *zebra*, there should be some diff --git a/doc/user/installation.rst b/doc/user/installation.rst index 5d5dfa5cc5..382d71b71f 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -31,8 +31,11 @@ From Source Building FRR from source is the best way to ensure you have the latest features and bug fixes. Details for each supported platform, including dependency -package listings, permissions, and other gotchas, are in the developer's -documentation. This section provides a brief overview on the process. +package listings, permissions, and other gotchas, are in the `developer's +documentation +<http://docs.frrouting.org/projects/dev-guide/en/latest/building.html>`_. This +section provides a brief overview on the process. + Getting the Source ^^^^^^^^^^^^^^^^^^ diff --git a/doc/user/ipv6.rst b/doc/user/ipv6.rst index d1477ddcdb..26341f04f1 100644 --- a/doc/user/ipv6.rst +++ b/doc/user/ipv6.rst @@ -17,7 +17,7 @@ no longer possible. Router Advertisement ==================== -.. index:: no ipv6 nd suppress-ra +.. index:: ipv6 nd suppress-ra .. clicmd:: no ipv6 nd suppress-ra Send router advertisement messages. @@ -57,9 +57,7 @@ Router Advertisement Default: not set, i.e. hosts do not assume a complete IP address is placed. -.. index:: - single: no ipv6 nd ra-interval [(1-1800)] - single: no ipv6 nd ra-interval [(1-1800)] +.. index:: ipv6 nd ra-interval [(1-1800)] .. clicmd:: [no] ipv6 nd ra-interval [(1-1800)] The maximum time allowed between sending unsolicited multicast router @@ -67,18 +65,13 @@ Router Advertisement Default: ``600`` .. index:: ipv6 nd ra-interval msec (70-1800000) -.. index:: - single: no ipv6 nd ra-interval [msec (70-1800000)] - single: ipv6 nd ra-interval msec (70-1800000) .. clicmd:: [no] ipv6 nd ra-interval [msec (70-1800000)] The maximum time allowed between sending unsolicited multicast router advertisements from the interface, in milliseconds. Default: ``600000`` -.. index:: - single: ipv6 nd ra-fast-retrans - single: no ipv6 nd ra-fast-retrans +.. index:: ipv6 nd ra-fast-retrans .. clicmd:: [no] ipv6 nd ra-fast-retrans RFC4861 states that consecutive RA packets should be sent no more @@ -90,9 +83,7 @@ Router Advertisement and neighbor establishment. Default: enabled -.. index:: - single: ipv6 nd ra-retrans-interval (0-4294967295) - single: no ipv6 nd retrans-interval [(0-4294967295)] +.. index:: ipv6 nd ra-retrans-interval (0-4294967295) .. clicmd:: [no] ipv6 nd ra-retrans-interval [(0-4294967295)] The value to be placed in the retrans timer field of router advertisements @@ -102,9 +93,7 @@ Router Advertisement msec. Default: ``0`` -.. index:: - single: ipv6 nd ra-hop-limit (0-255) - single: no ipv6 nd ra-hop-limit [(0-255)] +.. index:: ipv6 nd ra-hop-limit (0-255) .. clicmd:: [no] ipv6 nd ra-hop-limit [(0-255)] The value to be placed in the hop count field of router advertisements sent @@ -113,9 +102,7 @@ Router Advertisement router. Must be between zero or 255 hops. Default: ``64`` -.. index:: - single: ipv6 nd ra-lifetime (0-9000) - single: no ipv6 nd ra-lifetime [(0-9000)] +.. index:: ipv6 nd ra-lifetime (0-9000) .. clicmd:: [no] ipv6 nd ra-lifetime [(0-9000)] The value to be placed in the Router Lifetime field of router advertisements @@ -126,9 +113,7 @@ Router Advertisement (or default) and 9000 seconds. Default: ``1800`` -.. index:: - single: no ipv6 nd reachable-time [(1-3600000)] - single: ipv6 nd reachable-time (1-3600000) +.. index:: ipv6 nd reachable-time (1-3600000) .. clicmd:: [no] ipv6 nd reachable-time [(1-3600000)] The value to be placed in the Reachable Time field in the Router @@ -137,9 +122,7 @@ Router Advertisement means unspecified (by this router). Default: ``0`` -.. index:: - single: ipv6 nd managed-config-flag - single: no ipv6 nd managed-config-flag +.. index:: ipv6 nd managed-config-flag .. clicmd:: [no] ipv6 nd managed-config-flag Set/unset flag in IPv6 router advertisements which indicates to hosts that @@ -148,9 +131,7 @@ Router Advertisement autoconfiguration. Default: not set -.. index:: - single: ipv6 nd other-config-flag - single: no ipv6 nd other-config-flag +.. index:: ipv6 nd other-config-flag .. clicmd:: [no] ipv6 nd other-config-flag Set/unset flag in IPv6 router advertisements which indicates to hosts that @@ -158,9 +139,7 @@ Router Advertisement information other than addresses. Default: not set -.. index:: - single: ipv6 nd home-agent-config-flag - single: no ipv6 nd home-agent-config-flag +.. index:: ipv6 nd home-agent-config-flag .. clicmd:: [no] ipv6 nd home-agent-config-flag Set/unset flag in IPv6 router advertisements which indicates to hosts that @@ -169,9 +148,7 @@ Router Advertisement .. index:: ipv6 nd home-agent-preference (0-65535) -.. index:: - single: no ipv6 nd home-agent-preference [(0-65535)] - single: ipv6 nd home-agent-preference (0-65535) +.. index:: ipv6 nd home-agent-preference (0-65535) .. clicmd:: [no] ipv6 nd home-agent-preference [(0-65535)] The value to be placed in Home Agent Option, when Home Agent config flag is @@ -179,9 +156,7 @@ Router Advertisement stands for the lowest preference possible. Default: ``0`` -.. index:: - single: ipv6 nd home-agent-lifetime (0-65520) - single: no ipv6 nd home-agent-lifetime (0-65520) +.. index:: ipv6 nd home-agent-lifetime (0-65520) .. clicmd:: [no] ipv6 nd home-agent-lifetime [(0-65520)] The value to be placed in Home Agent Option, when Home Agent config flag is set, @@ -190,26 +165,20 @@ Router Advertisement Default: ``0`` -.. index:: - single: ipv6 nd adv-interval-option - single: no ipv6 nd adv-interval-option +.. index:: ipv6 nd adv-interval-option .. clicmd:: [no] ipv6 nd adv-interval-option Include an Advertisement Interval option which indicates to hosts the maximum time, in milliseconds, between successive unsolicited Router Advertisements. Default: not set -.. index:: - single: ipv6 nd router-preference (high|medium|low) - single: no ipv6 nd router-preference (high|medium|low) +.. index:: ipv6 nd router-preference (high|medium|low) .. clicmd:: [no] ipv6 nd router-preference [(high|medium|low)] Set default router preference in IPv6 router advertisements per RFC4191. Default: medium -.. index:: - single: ipv6 nd mtu (1-65535) - single: no ipv6 nd mtu [(1-65535)] +.. index:: ipv6 nd mtu (1-65535) .. clicmd:: [no] ipv6 nd mtu [(1-65535)] Include an MTU (type 5) option in each RA packet to assist the attached @@ -218,9 +187,7 @@ Router Advertisement Default: don't advertise any MTU option. -.. index:: - single: ipv6 nd rdnss ipv6address [lifetime] - single: no ipv6 nd rdnss ipv6address [lifetime] +.. index:: ipv6 nd rdnss ipv6address [lifetime] .. clicmd:: [no] ipv6 nd rdnss ipv6address [lifetime] Recursive DNS server address to advertise using the RDNSS (type 25) option @@ -238,9 +205,7 @@ Router Advertisement Default: do not emit RDNSS option -.. index:: - single: ipv6 nd dnssl domain-name-suffix [lifetime] - single: no ipv6 nd dnssl domain-name-suffix [lifetime] +.. index:: ipv6 nd dnssl domain-name-suffix [lifetime] .. clicmd:: [no] ipv6 nd dnssl domain-name-suffix [lifetime] Advertise DNS search list using the DNSSL (type 31) option described in diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst index 98f5aff7db..81333a2167 100644 --- a/doc/user/isisd.rst +++ b/doc/user/isisd.rst @@ -33,7 +33,7 @@ ISIS router To start the ISIS process you have to specify the ISIS router. As of this writing, *isisd* does not support multiple ISIS processes. -.. index:: [no] router isis WORD [vrf NAME] +.. index:: router isis WORD [vrf NAME] .. clicmd:: [no] router isis WORD [vrf NAME] Enable or disable the ISIS process by specifying the ISIS domain with @@ -44,7 +44,7 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: net XX.XXXX. ... .XXX.XX .. clicmd:: net XX.XXXX. ... .XXX.XX -.. index:: no net XX.XXXX. ... .XXX.XX +.. index:: net XX.XXXX. ... .XXX.XX .. clicmd:: no net XX.XXXX. ... .XXX.XX Set/Unset network entity title (NET) provided in ISO format. @@ -52,7 +52,7 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: hostname dynamic .. clicmd:: hostname dynamic -.. index:: no hostname dynamic +.. index:: hostname dynamic .. clicmd:: no hostname dynamic Enable support for dynamic hostname. @@ -63,10 +63,10 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: domain-password [clear | md5] <password> .. clicmd:: domain-password [clear | md5] <password> -.. index:: no area-password +.. index:: area-password .. clicmd:: no area-password -.. index:: no domain-password +.. index:: domain-password .. clicmd:: no domain-password Configure the authentication password for an area, respectively a domain, as @@ -75,7 +75,7 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: log-adjacency-changes .. clicmd:: log-adjacency-changes -.. index:: no log-adjacency-changes +.. index:: log-adjacency-changes .. clicmd:: no log-adjacency-changes Log changes in adjacency state. @@ -83,7 +83,7 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: metric-style [narrow | transition | wide] .. clicmd:: metric-style [narrow | transition | wide] -.. index:: no metric-style +.. index:: metric-style .. clicmd:: no metric-style Set old-style (ISO 10589) or new-style packet formats: @@ -98,7 +98,7 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: set-overload-bit .. clicmd:: set-overload-bit -.. index:: no set-overload-bit +.. index:: set-overload-bit .. clicmd:: no set-overload-bit Set overload bit to avoid any transit traffic. @@ -106,12 +106,12 @@ writing, *isisd* does not support multiple ISIS processes. .. index:: purge-originator .. clicmd:: purge-originator -.. index:: no purge-originator +.. index:: purge-originator .. clicmd:: no purge-originator Enable or disable :rfc:`6232` purge originator identification. -.. index:: [no] lsp-mtu (128-4352) +.. index:: lsp-mtu (128-4352) .. clicmd:: [no] lsp-mtu (128-4352) Configure the maximum size of generated LSPs, in bytes. @@ -128,10 +128,10 @@ ISIS Timer .. index:: lsp-gen-interval [level-1 | level-2] (1-120) .. clicmd:: lsp-gen-interval [level-1 | level-2] (1-120) -.. index:: no lsp-gen-interval +.. index:: lsp-gen-interval .. clicmd:: no lsp-gen-interval -.. index:: no lsp-gen-interval [level-1 | level-2] +.. index:: lsp-gen-interval [level-1 | level-2] .. clicmd:: no lsp-gen-interval [level-1 | level-2] Set minimum interval in seconds between regenerating same LSP, @@ -140,7 +140,7 @@ ISIS Timer .. index:: lsp-refresh-interval [level-1 | level-2] (1-65235) .. clicmd:: lsp-refresh-interval [level-1 | level-2] (1-65235) -.. index:: no lsp-refresh-interval [level-1 | level-2] +.. index:: lsp-refresh-interval [level-1 | level-2] .. clicmd:: no lsp-refresh-interval [level-1 | level-2] Set LSP refresh interval in seconds, globally, for an area (level-1) or a @@ -152,10 +152,10 @@ ISIS Timer .. index:: max-lsp-lifetime [level-1 | level-2] (360-65535) .. clicmd:: max-lsp-lifetime [level-1 | level-2] (360-65535) -.. index:: no max-lsp-lifetime +.. index:: max-lsp-lifetime .. clicmd:: no max-lsp-lifetime -.. index:: no max-lsp-lifetime [level-1 | level-2] +.. index:: max-lsp-lifetime [level-1 | level-2] .. clicmd:: no max-lsp-lifetime [level-1 | level-2] Set LSP maximum LSP lifetime in seconds, globally, for an area (level-1) or @@ -167,10 +167,10 @@ ISIS Timer .. index:: spf-interval [level-1 | level-2] (1-120) .. clicmd:: spf-interval [level-1 | level-2] (1-120) -.. index:: no spf-interval +.. index:: spf-interval .. clicmd:: no spf-interval -.. index:: no spf-interval [level-1 | level-2] +.. index:: spf-interval [level-1 | level-2] .. clicmd:: no spf-interval [level-1 | level-2] Set minimum interval between consecutive SPF calculations in seconds. @@ -183,7 +183,7 @@ ISIS region .. index:: is-type [level-1 | level-1-2 | level-2-only] .. clicmd:: is-type [level-1 | level-1-2 | level-2-only] -.. index:: no is-type +.. index:: is-type .. clicmd:: no is-type Define the ISIS router behavior: @@ -202,7 +202,8 @@ ISIS interface .. _ip-router-isis-word: -.. index:: [no] <ip|ipv6> router isis WORD [vrf NAME] +.. index:: ip router isis WORD [vrf NAME] +.. index:: ipv6 router isis WORD [vrf NAME] .. clicmd:: [no] <ip|ipv6> router isis WORD [vrf NAME] Activate ISIS adjacency on this interface. Note that the name of ISIS @@ -213,7 +214,7 @@ ISIS interface .. index:: isis circuit-type [level-1 | level-1-2 | level-2] .. clicmd:: isis circuit-type [level-1 | level-1-2 | level-2] -.. index:: no isis circuit-type +.. index:: isis circuit-type .. clicmd:: no isis circuit-type Configure circuit type for interface: @@ -231,10 +232,10 @@ ISIS interface .. index:: isis csnp-interval (1-600) [level-1 | level-2] .. clicmd:: isis csnp-interval (1-600) [level-1 | level-2] -.. index:: no isis csnp-interval +.. index:: isis csnp-interval .. clicmd:: no isis csnp-interval -.. index:: no isis csnp-interval [level-1 | level-2] +.. index:: isis csnp-interval [level-1 | level-2] .. clicmd:: no isis csnp-interval [level-1 | level-2] Set CSNP interval in seconds globally, for an area (level-1) or a domain @@ -251,10 +252,10 @@ ISIS interface .. index:: isis hello-interval (1-600) [level-1 | level-2] .. clicmd:: isis hello-interval (1-600) [level-1 | level-2] -.. index:: no isis hello-interval +.. index:: isis hello-interval .. clicmd:: no isis hello-interval -.. index:: no isis hello-interval [level-1 | level-2] +.. index:: isis hello-interval [level-1 | level-2] .. clicmd:: no isis hello-interval [level-1 | level-2] Set Hello interval in seconds globally, for an area (level-1) or a domain @@ -266,10 +267,10 @@ ISIS interface .. index:: isis hello-multiplier (2-100) [level-1 | level-2] .. clicmd:: isis hello-multiplier (2-100) [level-1 | level-2] -.. index:: no isis hello-multiplier +.. index:: isis hello-multiplier .. clicmd:: no isis hello-multiplier -.. index:: no isis hello-multiplier [level-1 | level-2] +.. index:: isis hello-multiplier [level-1 | level-2] .. clicmd:: no isis hello-multiplier [level-1 | level-2] Set multiplier for Hello holding time globally, for an area (level-1) or a @@ -281,10 +282,10 @@ ISIS interface .. index:: isis metric [(0-255) | (0-16777215)] [level-1 | level-2] .. clicmd:: isis metric [(0-255) | (0-16777215)] [level-1 | level-2] -.. index:: no isis metric +.. index:: isis metric .. clicmd:: no isis metric -.. index:: no isis metric [level-1 | level-2] +.. index:: isis metric [level-1 | level-2] .. clicmd:: no isis metric [level-1 | level-2] Set default metric value globally, for an area (level-1) or a domain @@ -294,7 +295,7 @@ ISIS interface .. index:: isis network point-to-point .. clicmd:: isis network point-to-point -.. index:: no isis network point-to-point +.. index:: isis network point-to-point .. clicmd:: no isis network point-to-point Set network type to 'Point-to-Point' (broadcast by default). @@ -302,7 +303,7 @@ ISIS interface .. index:: isis passive .. clicmd:: isis passive -.. index:: no isis passive +.. index:: isis passive .. clicmd:: no isis passive Configure the passive mode for this interface. @@ -310,7 +311,7 @@ ISIS interface .. index:: isis password [clear | md5] <password> .. clicmd:: isis password [clear | md5] <password> -.. index:: no isis password +.. index:: isis password .. clicmd:: no isis password Configure the authentication password (clear or encoded text) for the @@ -322,10 +323,10 @@ ISIS interface .. index:: isis priority (0-127) [level-1 | level-2] .. clicmd:: isis priority (0-127) [level-1 | level-2] -.. index:: no isis priority +.. index:: isis priority .. clicmd:: no isis priority -.. index:: no isis priority [level-1 | level-2] +.. index:: isis priority [level-1 | level-2] .. clicmd:: no isis priority [level-1 | level-2] Set priority for Designated Router election, globally, for the area @@ -337,10 +338,10 @@ ISIS interface .. index:: isis psnp-interval (1-120) [level-1 | level-2] .. clicmd:: isis psnp-interval (1-120) [level-1 | level-2] -.. index:: no isis psnp-interval +.. index:: isis psnp-interval .. clicmd:: no isis psnp-interval -.. index:: no isis psnp-interval [level-1 | level-2] +.. index:: isis psnp-interval [level-1 | level-2] .. clicmd:: no isis psnp-interval [level-1 | level-2] Set PSNP interval in seconds globally, for an area (level-1) or a domain @@ -349,13 +350,13 @@ ISIS interface .. index:: isis three-way-handshake .. clicmd:: isis three-way-handshake -.. index:: no isis three-way-handshake +.. index:: isis three-way-handshake .. clicmd:: no isis three-way-handshake Enable or disable :rfc:`5303` Three-Way Handshake for P2P adjacencies. Three-Way Handshake is enabled by default. -.. index:: [no] isis fast-reroute ti-lfa [level-1|level-2] [node-protection] +.. index:: isis fast-reroute ti-lfa [level-1|level-2] [node-protection] .. clicmd:: [no] isis fast-reroute ti-lfa [level-1|level-2] [node-protection] Enable per-prefix TI-LFA fast reroute link or node protection. @@ -443,7 +444,7 @@ Traffic Engineering .. index:: mpls-te on .. clicmd:: mpls-te on -.. index:: no mpls-te +.. index:: mpls-te .. clicmd:: no mpls-te Enable Traffic Engineering LSP flooding. @@ -451,7 +452,7 @@ Traffic Engineering .. index:: mpls-te router-address <A.B.C.D> .. clicmd:: mpls-te router-address <A.B.C.D> -.. index:: no mpls-te router-address +.. index:: mpls-te router-address .. clicmd:: no mpls-te router-address Configure stable IP address for MPLS-TE. @@ -489,33 +490,33 @@ Known limitations: - No support for SRLB - Only one SRGB and default SPF Algorithm is supported -.. index:: [no] segment-routing on +.. index:: segment-routing on .. clicmd:: [no] segment-routing on Enable Segment Routing. -.. index:: [no] segment-routing global-block (0-1048575) (0-1048575) +.. index:: segment-routing global-block (0-1048575) (0-1048575) .. clicmd:: [no] segment-routing global-block (0-1048575) (0-1048575) Set the Segment Routing Global Block i.e. the label range used by MPLS to store label in the MPLS FIB for Prefix SID. Note that the block size may not exceed 65535. -.. index:: [no] segment-routing local-block (0-1048575) (0-1048575) +.. index:: segment-routing local-block (0-1048575) (0-1048575) .. clicmd:: [no] segment-routing local-block (0-1048575) (0-1048575) Set the Segment Routing Local Block i.e. the label range used by MPLS to store label in the MPLS FIB for Adjacency SID. Note that the block size may not exceed 65535. -.. index:: [no] segment-routing node-msd (1-16) +.. index:: segment-routing node-msd (1-16) .. clicmd:: [no] segment-routing node-msd (1-16) Set the Maximum Stack Depth supported by the router. The value depend of the MPLS dataplane. E.g. for Linux kernel, since version 4.13 the maximum value is 32. -.. index:: [no] segment-routing prefix <A.B.C.D/M|X:X::X:X/M> <absolute (16-1048575)|index (0-65535)> [no-php-flag|explicit-null] [n-flag-clear] +.. index:: segment-routing prefix <A.B.C.D/M|X:X::X:X/M> <absolute (16-1048575)|index (0-65535)> [no-php-flag|explicit-null] [n-flag-clear] .. clicmd:: [no] segment-routing prefix <A.B.C.D/M|X:X::X:X/M> <absolute (16-1048575)|index (0-65535) [no-php-flag|explicit-null] [n-flag-clear] Set the Segment Routing index or absolute label value for the specified @@ -542,7 +543,7 @@ Debugging ISIS .. index:: debug isis adj-packets .. clicmd:: debug isis adj-packets -.. index:: no debug isis adj-packets +.. index:: debug isis adj-packets .. clicmd:: no debug isis adj-packets IS-IS Adjacency related packets. @@ -550,7 +551,7 @@ Debugging ISIS .. index:: debug isis checksum-errors .. clicmd:: debug isis checksum-errors -.. index:: no debug isis checksum-errors +.. index:: debug isis checksum-errors .. clicmd:: no debug isis checksum-errors IS-IS LSP checksum errors. @@ -558,7 +559,7 @@ Debugging ISIS .. index:: debug isis events .. clicmd:: debug isis events -.. index:: no debug isis events +.. index:: debug isis events .. clicmd:: no debug isis events IS-IS Events. @@ -566,7 +567,7 @@ Debugging ISIS .. index:: debug isis local-updates .. clicmd:: debug isis local-updates -.. index:: no debug isis local-updates +.. index:: debug isis local-updates .. clicmd:: no debug isis local-updates IS-IS local update packets. @@ -574,7 +575,7 @@ Debugging ISIS .. index:: debug isis packet-dump .. clicmd:: debug isis packet-dump -.. index:: no debug isis packet-dump +.. index:: debug isis packet-dump .. clicmd:: no debug isis packet-dump IS-IS packet dump. @@ -582,7 +583,7 @@ Debugging ISIS .. index:: debug isis protocol-errors .. clicmd:: debug isis protocol-errors -.. index:: no debug isis protocol-errors +.. index:: debug isis protocol-errors .. clicmd:: no debug isis protocol-errors IS-IS LSP protocol errors. @@ -590,7 +591,7 @@ Debugging ISIS .. index:: debug isis route-events .. clicmd:: debug isis route-events -.. index:: no debug isis route-events +.. index:: debug isis route-events .. clicmd:: no debug isis route-events IS-IS Route related events. @@ -598,7 +599,7 @@ Debugging ISIS .. index:: debug isis snp-packets .. clicmd:: debug isis snp-packets -.. index:: no debug isis snp-packets +.. index:: debug isis snp-packets .. clicmd:: no debug isis snp-packets IS-IS CSNP/PSNP packets. @@ -612,13 +613,13 @@ Debugging ISIS .. index:: debug isis spf-triggers .. clicmd:: debug isis spf-triggers -.. index:: no debug isis spf-events +.. index:: debug isis spf-events .. clicmd:: no debug isis spf-events -.. index:: no debug isis spf-statistics +.. index:: debug isis spf-statistics .. clicmd:: no debug isis spf-statistics -.. index:: no debug isis spf-triggers +.. index:: debug isis spf-triggers .. clicmd:: no debug isis spf-triggers IS-IS Shortest Path First Events, Timing and Statistic Data and triggering @@ -627,7 +628,7 @@ Debugging ISIS .. index:: debug isis update-packets .. clicmd:: debug isis update-packets -.. index:: no debug isis update-packets +.. index:: debug isis update-packets .. clicmd:: no debug isis update-packets Update related packets. @@ -635,7 +636,7 @@ Debugging ISIS .. index:: debug isis sr-events .. clicmd:: debug isis sr-events -.. index:: no debug isis sr-events +.. index:: debug isis sr-events .. clicmd:: no debug isis sr-events IS-IS Segment Routing events. @@ -643,7 +644,7 @@ Debugging ISIS .. index:: debug isis ti-lfa .. clicmd:: debug isis ti-lfa -.. index:: no debug isis ti-lfa +.. index:: debug isis ti-lfa .. clicmd:: no debug isis ti-lfa IS-IS TI-LFA events. diff --git a/doc/user/ldpd.rst b/doc/user/ldpd.rst index 2df4ba3005..375842f2ba 100644 --- a/doc/user/ldpd.rst +++ b/doc/user/ldpd.rst @@ -97,29 +97,29 @@ implementation. LDP Configuration =================== -.. index:: [no] mpls ldp +.. index:: mpls ldp .. clicmd:: [no] mpls ldp Enable or disable LDP daemon -.. index:: [no] router-id A.B.C.D +.. index:: router-id A.B.C.D .. clicmd:: [no] router-id A.B.C.D The following command located under MPLS router node configures the MPLS router-id of the local device. -.. index:: [no] ordered-control +.. index:: ordered-control .. clicmd:: [no] ordered-control Configure LDP Ordered Label Distribution Control. -.. index:: [no] address-family [ipv4 | ipv6] +.. index:: address-family [ipv4 | ipv6] .. clicmd:: [no] address-family [ipv4 | ipv6] Configure LDP for IPv4 or IPv6 address-family. Located under MPLS route node, this subnode permits configuring the LDP neighbors. -.. index:: [no] interface IFACE +.. index:: interface IFACE .. clicmd:: [no] interface IFACE Located under MPLS address-family node, use this command to enable or disable @@ -127,14 +127,14 @@ LDP Configuration enabled. By default it is disabled. Once this command executed, the address-family interface node is configured. -.. index:: [no] discovery transport-address A.B.C.D | A:B::C:D +.. index:: discovery transport-address A.B.C.D | A:B::C:D .. clicmd:: [no] discovery transport-address A.B.C.D | A:B::C:D Located under mpls address-family interface node, use this command to set the IPv4 or IPv6 transport-address used by the LDP protocol to talk on this interface. -.. index:: [no] neighbor A.B.C.D password PASSWORD +.. index:: neighbor A.B.C.D password PASSWORD .. clicmd:: [no] neighbor A.B.C.D password PASSWORD The following command located under MPLS router node configures the router @@ -142,7 +142,7 @@ LDP Configuration configured password. PASSWORD is a clear text password wit its digest sent through the network. -.. index:: [no] neighbor A.B.C.D holdtime HOLDTIME +.. index:: neighbor A.B.C.D holdtime HOLDTIME .. clicmd:: [no] neighbor A.B.C.D holdtime HOLDTIME The following command located under MPLS router node configures the holdtime @@ -151,10 +151,10 @@ LDP Configuration this time of non response, the LDP established session will be considered as set to down. By default, no holdtime is configured for the LDP devices. -.. index:: [no] discovery hello holdtime HOLDTIME +.. index:: discovery hello holdtime HOLDTIME .. clicmd:: [no] discovery hello holdtime HOLDTIME -.. index:: [no] discovery hello interval INTERVAL +.. index:: discovery hello interval INTERVAL .. clicmd:: [no] discovery hello interval INTERVAL INTERVAL value ranges from 1 to 65535 seconds. Default value is 5 seconds. @@ -162,7 +162,7 @@ LDP Configuration HOLDTIME value ranges from 1 to 65535 seconds. Default value is 15 seconds. That value is added as a TLV in the LDP messages. -.. index:: [no] dual-stack transport-connection prefer ipv4 +.. index:: dual-stack transport-connection prefer ipv4 .. clicmd:: [no] dual-stack transport-connection prefer ipv4 When *ldpd* is configured for dual-stack operation, the transport connection diff --git a/doc/user/ospf6d.rst b/doc/user/ospf6d.rst index 6295ba9293..4f0ff90943 100644 --- a/doc/user/ospf6d.rst +++ b/doc/user/ospf6d.rst @@ -32,7 +32,7 @@ OSPF6 router .. index:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME .. clicmd:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME -.. index:: no timers throttle spf +.. index:: timers throttle spf .. clicmd:: no timers throttle spf This command sets the initial `delay`, the `initial-holdtime` @@ -71,7 +71,7 @@ OSPF6 router .. index:: auto-cost reference-bandwidth COST .. clicmd:: auto-cost reference-bandwidth COST -.. index:: no auto-cost reference-bandwidth +.. index:: auto-cost reference-bandwidth .. clicmd:: no auto-cost reference-bandwidth This sets the reference bandwidth for cost calculations, where this @@ -163,26 +163,36 @@ Redistribute routes to OSPF6 Showing OSPF6 information ========================= -.. index:: show ipv6 ospf6 [INSTANCE_ID] -.. clicmd:: show ipv6 ospf6 [INSTANCE_ID] +.. index:: show ipv6 ospf6 [INSTANCE_ID] [json] +.. clicmd:: show ipv6 ospf6 [INSTANCE_ID] [json] INSTANCE_ID is an optional OSPF instance ID. To see router ID and OSPF - instance ID, simply type "show ipv6 ospf6 <cr>". + instance ID, simply type "show ipv6 ospf6 <cr>". JSON output can be + obtained by appending 'json' to the end of command. .. index:: show ipv6 ospf6 database .. clicmd:: show ipv6 ospf6 database This command shows LSA database summary. You can specify the type of LSA. -.. index:: show ipv6 ospf6 interface -.. clicmd:: show ipv6 ospf6 interface +.. index:: show ipv6 ospf6 interface [json] +.. clicmd:: show ipv6 ospf6 interface [json] - To see OSPF interface configuration like costs. + To see OSPF interface configuration like costs. JSON output can be + obtained by appending "json" in the end. -.. index:: show ipv6 ospf6 neighbor -.. clicmd:: show ipv6 ospf6 neighbor +.. index:: show ipv6 ospf6 neighbor [json] +.. clicmd:: show ipv6 ospf6 neighbor [json] - Shows state and chosen (Backup) DR of neighbor. + Shows state and chosen (Backup) DR of neighbor. JSON output can be + obtained by appending 'json' at the end. + +.. index:: show ipv6 ospf6 interface traffic [json] +.. clicmd:: show ipv6 ospf6 interface traffic [json] + + Shows counts of different packets that have been recieved and transmitted + by the interfaces. JSON output can be obtained by appending "json" at the + end. .. index:: show ipv6 ospf6 request-list A.B.C.D .. clicmd:: show ipv6 ospf6 request-list A.B.C.D @@ -194,10 +204,17 @@ Showing OSPF6 information This command shows internal routing table. -.. index:: show ipv6 ospf6 zebra -.. clicmd:: show ipv6 ospf6 zebra +.. index:: show ipv6 ospf6 zebra [json] +.. clicmd:: show ipv6 ospf6 zebra [json] + + Shows state about what is being redistributed between zebra and OSPF6. + JSON output can be obtained by appending "json" at the end. + +.. index:: show ipv6 ospf6 redistribute [json] +.. clicmd:: show ipv6 ospf6 redistribute [json] - Shows state about what is being redistributed between zebra and OSPF6 + Shows the routes which are redistributed by the router. JSON output can + be obtained by appending 'json' at the end. OSPF6 Configuration Examples ============================ diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst index b66774ca0e..cbde0fd46f 100644 --- a/doc/user/ospfd.rst +++ b/doc/user/ospfd.rst @@ -83,7 +83,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: router ospf [(1-65535)] vrf NAME .. clicmd:: router ospf [(1-65535)] vrf NAME -.. index:: no router ospf [(1-65535)] vrf NAME +.. index:: router ospf [(1-65535)] vrf NAME .. clicmd:: no router ospf [(1-65535)] vrf NAME Enable or disable the OSPF process. @@ -91,7 +91,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: ospf router-id A.B.C.D .. clicmd:: ospf router-id A.B.C.D -.. index:: no ospf router-id [A.B.C.D] +.. index:: ospf router-id [A.B.C.D] .. clicmd:: no ospf router-id [A.B.C.D] This sets the router-ID of the OSPF process. The router-ID may be an IP @@ -104,7 +104,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: ospf abr-type TYPE .. clicmd:: ospf abr-type TYPE -.. index:: no ospf abr-type TYPE +.. index:: ospf abr-type TYPE .. clicmd:: no ospf abr-type TYPE `type` can be cisco|ibm|shortcut|standard. The "Cisco" and "IBM" types @@ -140,7 +140,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: ospf rfc1583compatibility .. clicmd:: ospf rfc1583compatibility -.. index:: no ospf rfc1583compatibility +.. index:: ospf rfc1583compatibility .. clicmd:: no ospf rfc1583compatibility :rfc:`2328`, the successor to :rfc:`1583`, suggests according @@ -155,7 +155,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: log-adjacency-changes [detail] .. clicmd:: log-adjacency-changes [detail] -.. index:: no log-adjacency-changes [detail] +.. index:: log-adjacency-changes [detail] .. clicmd:: no log-adjacency-changes [detail] Configures ospfd to log changes in adjacency. With the optional @@ -165,7 +165,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: passive-interface INTERFACE .. clicmd:: passive-interface INTERFACE -.. index:: no passive-interface INTERFACE +.. index:: passive-interface INTERFACE .. clicmd:: no passive-interface INTERFACE Do not speak OSPF interface on the @@ -180,7 +180,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: timers throttle spf (0-600000) (0-600000) (0-600000) .. clicmd:: timers throttle spf (0-600000) (0-600000) (0-600000) -.. index:: no timers throttle spf +.. index:: timers throttle spf .. clicmd:: no timers throttle spf This command sets the initial `delay`, the `initial-holdtime` @@ -227,7 +227,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: max-metric router-lsa administrative .. clicmd:: max-metric router-lsa administrative -.. index:: no max-metric router-lsa [on-startup|on-shutdown|administrative] +.. index:: max-metric router-lsa [on-startup|on-shutdown|administrative] .. clicmd:: no max-metric router-lsa [on-startup|on-shutdown|administrative] This enables :rfc:`3137` support, where the OSPF process describes its @@ -260,7 +260,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: auto-cost reference-bandwidth (1-4294967) .. clicmd:: auto-cost reference-bandwidth (1-4294967) -.. index:: no auto-cost reference-bandwidth +.. index:: auto-cost reference-bandwidth .. clicmd:: no auto-cost reference-bandwidth This sets the reference @@ -279,10 +279,10 @@ To start OSPF process you have to specify the OSPF router. .. index:: network A.B.C.D/M area (0-4294967295) .. clicmd:: network A.B.C.D/M area (0-4294967295) -.. index:: no network A.B.C.D/M area A.B.C.D +.. index:: network A.B.C.D/M area A.B.C.D .. clicmd:: no network A.B.C.D/M area A.B.C.D -.. index:: no network A.B.C.D/M area (0-4294967295) +.. index:: network A.B.C.D/M area (0-4294967295) .. clicmd:: no network A.B.C.D/M area (0-4294967295) This command specifies the OSPF enabled interface(s). If the interface has @@ -313,7 +313,7 @@ To start OSPF process you have to specify the OSPF router. .. index:: proactive-arp .. clicmd:: proactive-arp -.. index:: no proactive-arp +.. index:: proactive-arp .. clicmd:: no proactive-arp This command enables or disables sending ARP requests to update neighbor @@ -333,10 +333,10 @@ Areas .. index:: area (0-4294967295) range A.B.C.D/M .. clicmd:: area (0-4294967295) range A.B.C.D/M -.. index:: no area A.B.C.D range A.B.C.D/M +.. index:: area A.B.C.D range A.B.C.D/M .. clicmd:: no area A.B.C.D range A.B.C.D/M -.. index:: no area (0-4294967295) range A.B.C.D/M +.. index:: area (0-4294967295) range A.B.C.D/M .. clicmd:: no area (0-4294967295) range A.B.C.D/M Summarize intra area paths from specified area into one Type-3 summary-LSA @@ -360,7 +360,7 @@ Areas .. index:: area A.B.C.D range IPV4_PREFIX not-advertise .. clicmd:: area A.B.C.D range IPV4_PREFIX not-advertise -.. index:: no area A.B.C.D range IPV4_PREFIX not-advertise +.. index:: area A.B.C.D range IPV4_PREFIX not-advertise .. clicmd:: no area A.B.C.D range IPV4_PREFIX not-advertise Instead of summarizing intra area paths filter them - i.e. intra area paths from this @@ -370,7 +370,7 @@ Areas .. index:: area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX .. clicmd:: area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX -.. index:: no area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX +.. index:: area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX .. clicmd:: no area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX Substitute summarized prefix with another prefix. @@ -394,10 +394,10 @@ Areas .. index:: area (0-4294967295) virtual-link A.B.C.D .. clicmd:: area (0-4294967295) virtual-link A.B.C.D -.. index:: no area A.B.C.D virtual-link A.B.C.D +.. index:: area A.B.C.D virtual-link A.B.C.D .. clicmd:: no area A.B.C.D virtual-link A.B.C.D -.. index:: no area (0-4294967295) virtual-link A.B.C.D +.. index:: area (0-4294967295) virtual-link A.B.C.D .. clicmd:: no area (0-4294967295) virtual-link A.B.C.D .. index:: area A.B.C.D shortcut @@ -406,10 +406,10 @@ Areas .. index:: area (0-4294967295) shortcut .. clicmd:: area (0-4294967295) shortcut -.. index:: no area A.B.C.D shortcut +.. index:: area A.B.C.D shortcut .. clicmd:: no area A.B.C.D shortcut -.. index:: no area (0-4294967295) shortcut +.. index:: area (0-4294967295) shortcut .. clicmd:: no area (0-4294967295) shortcut Configure the area as Shortcut capable. See :rfc:`3509`. This requires @@ -421,10 +421,10 @@ Areas .. index:: area (0-4294967295) stub .. clicmd:: area (0-4294967295) stub -.. index:: no area A.B.C.D stub +.. index:: area A.B.C.D stub .. clicmd:: no area A.B.C.D stub -.. index:: no area (0-4294967295) stub +.. index:: area (0-4294967295) stub .. clicmd:: no area (0-4294967295) stub Configure the area to be a stub area. That is, an area where no router @@ -440,10 +440,10 @@ Areas .. index:: area (0-4294967295) stub no-summary .. clicmd:: area (0-4294967295) stub no-summary -.. index:: no area A.B.C.D stub no-summary +.. index:: area A.B.C.D stub no-summary .. clicmd:: no area A.B.C.D stub no-summary -.. index:: no area (0-4294967295) stub no-summary +.. index:: area (0-4294967295) stub no-summary .. clicmd:: no area (0-4294967295) stub no-summary Prevents an *ospfd* ABR from injecting inter-area @@ -452,7 +452,7 @@ Areas .. index:: area A.B.C.D default-cost (0-16777215) .. clicmd:: area A.B.C.D default-cost (0-16777215) -.. index:: no area A.B.C.D default-cost (0-16777215) +.. index:: area A.B.C.D default-cost (0-16777215) .. clicmd:: no area A.B.C.D default-cost (0-16777215) Set the cost of default-summary LSAs announced to stubby areas. @@ -463,10 +463,10 @@ Areas .. index:: area (0-4294967295) export-list NAME .. clicmd:: area (0-4294967295) export-list NAME -.. index:: no area A.B.C.D export-list NAME +.. index:: area A.B.C.D export-list NAME .. clicmd:: no area A.B.C.D export-list NAME -.. index:: no area (0-4294967295) export-list NAME +.. index:: area (0-4294967295) export-list NAME .. clicmd:: no area (0-4294967295) export-list NAME Filter Type-3 summary-LSAs announced to other areas originated from intra- @@ -496,10 +496,10 @@ Areas .. index:: area (0-4294967295) import-list NAME .. clicmd:: area (0-4294967295) import-list NAME -.. index:: no area A.B.C.D import-list NAME +.. index:: area A.B.C.D import-list NAME .. clicmd:: no area A.B.C.D import-list NAME -.. index:: no area (0-4294967295) import-list NAME +.. index:: area (0-4294967295) import-list NAME .. clicmd:: no area (0-4294967295) import-list NAME Same as export-list, but it applies to paths announced into specified area @@ -517,16 +517,16 @@ Areas .. index:: area (0-4294967295) filter-list prefix NAME out .. clicmd:: area (0-4294967295) filter-list prefix NAME out -.. index:: no area A.B.C.D filter-list prefix NAME in +.. index:: area A.B.C.D filter-list prefix NAME in .. clicmd:: no area A.B.C.D filter-list prefix NAME in -.. index:: no area A.B.C.D filter-list prefix NAME out +.. index:: area A.B.C.D filter-list prefix NAME out .. clicmd:: no area A.B.C.D filter-list prefix NAME out -.. index:: no area (0-4294967295) filter-list prefix NAME in +.. index:: area (0-4294967295) filter-list prefix NAME in .. clicmd:: no area (0-4294967295) filter-list prefix NAME in -.. index:: no area (0-4294967295) filter-list prefix NAME out +.. index:: area (0-4294967295) filter-list prefix NAME out .. clicmd:: no area (0-4294967295) filter-list prefix NAME out Filtering Type-3 summary-LSAs to/from area using prefix lists. This command @@ -538,10 +538,10 @@ Areas .. index:: area (0-4294967295) authentication .. clicmd:: area (0-4294967295) authentication -.. index:: no area A.B.C.D authentication +.. index:: area A.B.C.D authentication .. clicmd:: no area A.B.C.D authentication -.. index:: no area (0-4294967295) authentication +.. index:: area (0-4294967295) authentication .. clicmd:: no area (0-4294967295) authentication Specify that simple password authentication should be used for the given @@ -569,7 +569,7 @@ Interfaces .. index:: ip ospf area AREA [ADDR] .. clicmd:: ip ospf area AREA [ADDR] -.. index:: no ip ospf area [ADDR] +.. index:: ip ospf area [ADDR] .. clicmd:: no ip ospf area [ADDR] Enable OSPF on the interface, optionally restricted to just the IP address @@ -583,7 +583,7 @@ Interfaces .. index:: ip ospf authentication-key AUTH_KEY .. clicmd:: ip ospf authentication-key AUTH_KEY -.. index:: no ip ospf authentication-key +.. index:: ip ospf authentication-key .. clicmd:: no ip ospf authentication-key Set OSPF authentication key to a simple password. After setting `AUTH_KEY`, @@ -612,7 +612,7 @@ Interfaces .. index:: ip ospf message-digest-key KEYID md5 KEY .. clicmd:: ip ospf message-digest-key KEYID md5 KEY -.. index:: no ip ospf message-digest-key +.. index:: ip ospf message-digest-key .. clicmd:: no ip ospf message-digest-key Set OSPF authentication key to a cryptographic password. The cryptographic @@ -627,7 +627,7 @@ Interfaces .. index:: ip ospf cost (1-65535) .. clicmd:: ip ospf cost (1-65535) -.. index:: no ip ospf cost +.. index:: ip ospf cost .. clicmd:: no ip ospf cost Set link cost for the specified interface. The cost value is set to @@ -639,7 +639,7 @@ Interfaces .. index:: ip ospf dead-interval minimal hello-multiplier (2-20) .. clicmd:: ip ospf dead-interval minimal hello-multiplier (2-20) -.. index:: no ip ospf dead-interval +.. index:: ip ospf dead-interval .. clicmd:: no ip ospf dead-interval Set number of seconds for RouterDeadInterval timer value used for Wait Timer @@ -658,7 +658,7 @@ Interfaces .. index:: ip ospf hello-interval (1-65535) .. clicmd:: ip ospf hello-interval (1-65535) -.. index:: no ip ospf hello-interval +.. index:: ip ospf hello-interval .. clicmd:: no ip ospf hello-interval Set number of seconds for HelloInterval timer value. Setting this value, @@ -679,7 +679,7 @@ Interfaces net.ipv4.conf.<interface name>.rp_filter value to 0. In order for the ospf multicast packets to be delivered by the kernel. -.. index:: no ip ospf network +.. index:: ip ospf network .. clicmd:: no ip ospf network Set explicitly network type for specified interface. @@ -687,7 +687,7 @@ Interfaces .. index:: ip ospf priority (0-255) .. clicmd:: ip ospf priority (0-255) -.. index:: no ip ospf priority +.. index:: ip ospf priority .. clicmd:: no ip ospf priority Set RouterPriority integer value. The router with the highest priority will @@ -697,7 +697,7 @@ Interfaces .. index:: ip ospf retransmit-interval (1-65535) .. clicmd:: ip ospf retransmit-interval (1-65535) -.. index:: no ip ospf retransmit interval +.. index:: ip ospf retransmit interval .. clicmd:: no ip ospf retransmit interval Set number of seconds for RxmtInterval timer value. This value is used when @@ -707,7 +707,7 @@ Interfaces .. index:: ip ospf transmit-delay (1-65535) [A.B.C.D] .. clicmd:: ip ospf transmit-delay (1-65535) [A.B.C.D] -.. index:: no ip ospf transmit-delay [(1-65535)] [A.B.C.D] +.. index:: ip ospf transmit-delay [(1-65535)] [A.B.C.D] .. clicmd:: no ip ospf transmit-delay [(1-65535)] [A.B.C.D] Set number of seconds for InfTransDelay value. LSAs' age should be @@ -716,7 +716,7 @@ Interfaces .. index:: ip ospf area (A.B.C.D|(0-4294967295)) .. clicmd:: ip ospf area (A.B.C.D|(0-4294967295)) -.. index:: no ip ospf area +.. index:: ip ospf area .. clicmd:: no ip ospf area Enable ospf on an interface and set associated area. @@ -762,7 +762,7 @@ Redistribution .. index:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) route-map WORD .. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) route-map WORD -.. index:: no redistribute (kernel|connected|static|rip|bgp) +.. index:: redistribute (kernel|connected|static|rip|bgp) .. clicmd:: no redistribute (kernel|connected|static|rip|bgp) .. _ospf-redistribute: @@ -809,7 +809,7 @@ Redistribution .. index:: default-information originate always metric (0-16777214) metric-type (1|2) route-map WORD .. clicmd:: default-information originate always metric (0-16777214) metric-type (1|2) route-map WORD -.. index:: no default-information originate +.. index:: default-information originate .. clicmd:: no default-information originate Originate an AS-External (type-5) LSA describing a default route into all @@ -820,7 +820,7 @@ Redistribution .. index:: distribute-list NAME out (kernel|connected|static|rip|ospf .. clicmd:: distribute-list NAME out (kernel|connected|static|rip|ospf -.. index:: no distribute-list NAME out (kernel|connected|static|rip|ospf +.. index:: distribute-list NAME out (kernel|connected|static|rip|ospf .. clicmd:: no distribute-list NAME out (kernel|connected|static|rip|ospf .. _ospf-distribute-list: @@ -832,25 +832,25 @@ Redistribution .. index:: default-metric (0-16777214) .. clicmd:: default-metric (0-16777214) -.. index:: no default-metric +.. index:: default-metric .. clicmd:: no default-metric .. index:: distance (1-255) .. clicmd:: distance (1-255) -.. index:: no distance (1-255) +.. index:: distance (1-255) .. clicmd:: no distance (1-255) .. index:: distance ospf (intra-area|inter-area|external) (1-255) .. clicmd:: distance ospf (intra-area|inter-area|external) (1-255) -.. index:: no distance ospf +.. index:: distance ospf .. clicmd:: no distance ospf .. index:: router zebra .. clicmd:: router zebra -.. index:: no router zebra +.. index:: router zebra .. clicmd:: no router zebra Graceful Restart Helper @@ -859,7 +859,7 @@ Graceful Restart Helper .. index:: graceful-restart helper-only [A.B.C.D] .. clicmd:: graceful-restart helper-only [A.B.C.D] -.. index:: no graceful-restart helper-only [A.B.C.D] +.. index:: graceful-restart helper-only [A.B.C.D] .. clicmd:: no graceful-restart helper-only [A.B.C.D] Configure Graceful Restart (RFC 3623) helper support. @@ -872,7 +872,7 @@ Graceful Restart Helper .. index:: graceful-restart helper strict-lsa-checking .. clicmd:: graceful-restart helper strict-lsa-checking -.. index:: no graceful-restart helper strict-lsa-checking +.. index:: graceful-restart helper strict-lsa-checking .. clicmd:: no graceful-restart helper strict-lsa-checking If 'strict-lsa-checking' is configured then the helper will @@ -883,7 +883,7 @@ Graceful Restart Helper .. index:: graceful-restart helper supported-grace-time .. clicmd:: graceful-restart helper supported-grace-time -.. index:: no graceful-restart helper supported-grace-time +.. index:: graceful-restart helper supported-grace-time .. clicmd:: no graceful-restart helper supported-grace-time Supports as HELPER for configured grace period. @@ -891,7 +891,7 @@ Graceful Restart Helper .. index:: graceful-restart helper planned-only .. clicmd:: graceful-restart helper planned-only -.. index:: no graceful-restart helper planned-only +.. index:: graceful-restart helper planned-only .. clicmd:: no graceful-restart helper planned-only It helps to support as HELPER only for planned @@ -905,59 +905,63 @@ Showing Information .. _show-ip-ospf: -.. index:: show ip ospf -.. clicmd:: show ip ospf +.. index:: show ip ospf [json] +.. clicmd:: show ip ospf [json] Show information on a variety of general OSPF and area state and configuration information. -.. index:: show ip ospf interface [INTERFACE] -.. clicmd:: show ip ospf interface [INTERFACE] +.. index:: show ip ospf interface [INTERFACE] [json] +.. clicmd:: show ip ospf interface [INTERFACE] [json] Show state and configuration of OSPF the specified interface, or all interfaces if no interface is given. -.. index:: show ip ospf neighbor -.. clicmd:: show ip ospf neighbor +.. index:: show ip ospf neighbor [json] +.. clicmd:: show ip ospf neighbor [json] + +.. index:: show ip ospf neighbor INTERFACE [json] +.. clicmd:: show ip ospf neighbor INTERFACE [json] -.. index:: show ip ospf neighbor INTERFACE -.. clicmd:: show ip ospf neighbor INTERFACE +.. index:: show ip ospf neighbor detail [json] +.. clicmd:: show ip ospf neighbor detail [json] -.. index:: show ip ospf neighbor detail -.. clicmd:: show ip ospf neighbor detail +.. index:: show ip ospf neighbor INTERFACE detail [json] +.. clicmd:: show ip ospf neighbor INTERFACE detail [json] -.. index:: show ip ospf neighbor INTERFACE detail -.. clicmd:: show ip ospf neighbor INTERFACE detail + Display lsa information of LSDB. + Json o/p of this command covers base route information + i.e all LSAs except opaque lsa info. -.. index:: show ip ospf database -.. clicmd:: show ip ospf database +.. index:: show ip ospf database [json] +.. clicmd:: show ip ospf database [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate [json] -.. index:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate -.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate [json] +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate [json] -.. index:: show ip ospf database max-age -.. clicmd:: show ip ospf database max-age +.. index:: show ip ospf database max-age [json] +.. clicmd:: show ip ospf database max-age [json] -.. index:: show ip ospf database self-originate -.. clicmd:: show ip ospf database self-originate +.. index:: show ip ospf database self-originate [json] +.. clicmd:: show ip ospf database self-originate [json] -.. index:: show ip ospf route -.. clicmd:: show ip ospf route +.. index:: show ip ospf route [json] +.. clicmd:: show ip ospf route [json] Show the OSPF routing table, as determined by the most recent SPF calculation. @@ -979,10 +983,10 @@ Opaque LSA .. index:: capability opaque .. clicmd:: capability opaque -.. index:: no ospf opaque-lsa +.. index:: ospf opaque-lsa .. clicmd:: no ospf opaque-lsa -.. index:: no capability opaque +.. index:: capability opaque .. clicmd:: no capability opaque *ospfd* supports Opaque LSA (:rfc:`2370`) as partial support for @@ -1027,7 +1031,7 @@ Traffic Engineering .. index:: mpls-te on .. clicmd:: mpls-te on -.. index:: no mpls-te +.. index:: mpls-te .. clicmd:: no mpls-te Enable Traffic Engineering LSA flooding. @@ -1041,7 +1045,7 @@ Traffic Engineering .. index:: mpls-te inter-as area <area-id>|as .. clicmd:: mpls-te inter-as area <area-id>|as -.. index:: no mpls-te inter-as +.. index:: mpls-te inter-as .. clicmd:: no mpls-te inter-as Enable :rfc:`5392` support - Inter-AS TE v2 - to flood Traffic Engineering @@ -1070,7 +1074,7 @@ Router Information .. index:: router-info [as | area] .. clicmd:: router-info [as | area] -.. index:: no router-info +.. index:: router-info .. clicmd:: no router-info Enable Router Information (:rfc:`4970`) LSA advertisement with AS scope @@ -1082,31 +1086,31 @@ Router Information .. index:: pce address <A.B.C.D> .. clicmd:: pce address <A.B.C.D> -.. index:: no pce address +.. index:: pce address .. clicmd:: no pce address .. index:: pce domain as (0-65535) .. clicmd:: pce domain as (0-65535) -.. index:: no pce domain as (0-65535) +.. index:: pce domain as (0-65535) .. clicmd:: no pce domain as (0-65535) .. index:: pce neighbor as (0-65535) .. clicmd:: pce neighbor as (0-65535) -.. index:: no pce neighbor as (0-65535) +.. index:: pce neighbor as (0-65535) .. clicmd:: no pce neighbor as (0-65535) .. index:: pce flag BITPATTERN .. clicmd:: pce flag BITPATTERN -.. index:: no pce flag +.. index:: pce flag .. clicmd:: no pce flag .. index:: pce scope BITPATTERN .. clicmd:: pce scope BITPATTERN -.. index:: no pce scope +.. index:: pce scope .. clicmd:: no pce scope The commands are conform to :rfc:`5088` and allow OSPF router announce Path @@ -1135,32 +1139,32 @@ Segment Routing This is an EXPERIMENTAL support of Segment Routing as per `RFC 8665` for MPLS dataplane. -.. index:: [no] segment-routing on +.. index:: segment-routing on .. clicmd:: [no] segment-routing on Enable Segment Routing. Even if this also activate routing information support, it is preferable to also activate routing information, and set accordingly the Area or AS flooding. -.. index:: [no] segment-routing global-block (0-1048575) (0-1048575) +.. index:: segment-routing global-block (0-1048575) (0-1048575) .. clicmd:: [no] segment-routing global-block (0-1048575) (0-1048575) Fix the Segment Routing Global Block i.e. the label range used by MPLS to store label in the MPLS FIB for Prefix SID. -.. index:: [no] segment-routing local-block (0-1048575) (0-1048575) +.. index:: segment-routing local-block (0-1048575) (0-1048575) .. clicmd:: [no] segment-routing local-block (0-1048575) (0-1048575) Fix the Segment Routing Local Block i.e. the label range used by MPLS to store label in the MPLS FIB for Adjacency SID. -.. index:: [no] segment-routing node-msd (1-16) +.. index:: segment-routing node-msd (1-16) .. clicmd:: [no] segment-routing node-msd (1-16) Fix the Maximum Stack Depth supported by the router. The value depend of the MPLS dataplane. E.g. for Linux kernel, since version 4.13 it is 32. -.. index:: [no] segment-routing prefix A.B.C.D/M index (0-65535) [no-php-flag|explicit-null] +.. index:: segment-routing prefix A.B.C.D/M index (0-65535) [no-php-flag|explicit-null] .. clicmd:: [no] segment-routing prefix A.B.C.D/M [index (0-65535)|no-php-flag|explicit-null] Set the Segment Routing index for the specified prefix. Note that, only @@ -1177,13 +1181,48 @@ dataplane. self router. Optional JSON output can be obtained by appending 'json' to the end of the command. +External Route Summarisation +============================ +This feature summarises originated external LSAs(Type-5 and Type-7). +Summary Route will be originated on-behalf of all matched external LSAs. + +.. index:: summary-address A.B.C.D/M [tag (1-4294967295)] +.. clicmd:: [no] summary-address A.B.C.D/M [tag (1-4294967295)] + + This command enable/disables summarisation for the configured address + range. Tag is the optional parameter. If tag configured Summary route + will be originated with the configured tag. + +.. index:: summary-address A.B.C.D/M no-advertise +.. clicmd:: [no] summary-address A.B.C.D/M no-advertise + + This command to ensure not advertise the summary lsa for the matched + external LSAs. + +.. index:: aggregation timer (5-1800) +.. clicmd:: aggregation timer (5-1800) + + Configure aggregation delay timer interval. Summarisation starts only after + this delay timer expiry. By default, delay interval is 5 secs. + +.. index:: aggregation timer +.. clicmd:: no aggregation timer + + Resetting the aggregation delay interval to default value. + +.. index:: show ip ospf [vrf <NAME|all>] summary-address [detail] [json] +.. clicmd:: show ip ospf [vrf <NAME|all>] summary-address [detail] [json] + + Show configuration for display all configured summary routes with + matching external LSA information. + Debugging OSPF ============== .. index:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] .. clicmd:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] -.. index:: no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] +.. index:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] .. clicmd:: no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] Dump Packet for debugging @@ -1194,10 +1233,10 @@ Debugging OSPF .. index:: debug ospf ism (status|events|timers) .. clicmd:: debug ospf ism (status|events|timers) -.. index:: no debug ospf ism +.. index:: debug ospf ism .. clicmd:: no debug ospf ism -.. index:: no debug ospf ism (status|events|timers) +.. index:: debug ospf ism (status|events|timers) .. clicmd:: no debug ospf ism (status|events|timers) Show debug information of Interface State Machine @@ -1208,10 +1247,10 @@ Debugging OSPF .. index:: debug ospf nsm (status|events|timers) .. clicmd:: debug ospf nsm (status|events|timers) -.. index:: no debug ospf nsm +.. index:: debug ospf nsm .. clicmd:: no debug ospf nsm -.. index:: no debug ospf nsm (status|events|timers) +.. index:: debug ospf nsm (status|events|timers) .. clicmd:: no debug ospf nsm (status|events|timers) Show debug information of Network State Machine @@ -1219,7 +1258,7 @@ Debugging OSPF .. index:: debug ospf event .. clicmd:: debug ospf event -.. index:: no debug ospf event +.. index:: debug ospf event .. clicmd:: no debug ospf event Show debug information of OSPF event @@ -1227,7 +1266,7 @@ Debugging OSPF .. index:: debug ospf nssa .. clicmd:: debug ospf nssa -.. index:: no debug ospf nssa +.. index:: debug ospf nssa .. clicmd:: no debug ospf nssa Show debug information about Not So Stub Area @@ -1238,10 +1277,10 @@ Debugging OSPF .. index:: debug ospf lsa (generate|flooding|refresh) .. clicmd:: debug ospf lsa (generate|flooding|refresh) -.. index:: no debug ospf lsa +.. index:: debug ospf lsa .. clicmd:: no debug ospf lsa -.. index:: no debug ospf lsa (generate|flooding|refresh) +.. index:: debug ospf lsa (generate|flooding|refresh) .. clicmd:: no debug ospf lsa (generate|flooding|refresh) Show debug detail of Link State messages @@ -1249,7 +1288,7 @@ Debugging OSPF .. index:: debug ospf te .. clicmd:: debug ospf te -.. index:: no debug ospf te +.. index:: debug ospf te .. clicmd:: no debug ospf te Show debug information about Traffic Engineering LSA @@ -1260,10 +1299,10 @@ Debugging OSPF .. index:: debug ospf zebra (interface|redistribute) .. clicmd:: debug ospf zebra (interface|redistribute) -.. index:: no debug ospf zebra +.. index:: debug ospf zebra .. clicmd:: no debug ospf zebra -.. index:: no debug ospf zebra (interface|redistribute) +.. index:: debug ospf zebra (interface|redistribute) .. clicmd:: no debug ospf zebra (interface|redistribute) Show debug information of ZEBRA API @@ -1271,7 +1310,7 @@ Debugging OSPF .. index:: debug ospf graceful-restart helper .. clicmd:: debug ospf graceful-restart helper -.. index:: no debug ospf graceful-restart helper +.. index:: debug ospf graceful-restart helper .. clicmd:: no debug ospf graceful-restart helper Enable/disable debug information for OSPF Graceful Restart Helper @@ -1279,6 +1318,11 @@ Debugging OSPF .. index:: show debugging ospf .. clicmd:: show debugging ospf +.. index:: debug ospf lsa aggregate +.. clicmd:: [no] debug ospf lsa aggregate + + Debug commnd to enable/disable external route summarisation specific debugs. + OSPF Configuration Examples =========================== diff --git a/doc/user/pim.rst b/doc/user/pim.rst index b0a90bfc48..bacf8637ae 100644 --- a/doc/user/pim.rst +++ b/doc/user/pim.rst @@ -166,18 +166,18 @@ Certain signals have special meanings to *pimd*. urib-only Lookup in the Unicast Rib only. -.. index:: [no] ip msdp mesh-group [WORD] +.. index:: ip msdp mesh-group [WORD] .. clicmd:: [no] ip msdp mesh-group [WORD] Create or Delete a multicast source discovery protocol mesh-group using [WORD] as the group name. -.. index:: [no] ip msdp mesh-group WORD member A.B.C.D +.. index:: ip msdp mesh-group WORD member A.B.C.D .. clicmd:: [no] ip msdp mesh-group WORD member A.B.C.D Attach or Delete A.B.C.D to the MSDP mesh group WORD specified. -.. index:: [no] ip msdp mesh-group WORD source A.B.C.D +.. index:: ip msdp mesh-group WORD source A.B.C.D .. clicmd:: [no] ip msdp mesh-group WORD source A.B.C.D For the address specified A.B.C.D use that as the source address for @@ -190,7 +190,7 @@ Certain signals have special meanings to *pimd*. the existing IGMP general query timer.If no version is provided in the cli, it will be considered as default v2 query.This is a hidden command. -.. index:: [no] ip igmp watermark-warn (10-60000) +.. index:: ip igmp watermark-warn (10-60000) .. clicmd:: [no] ip igmp watermark-warn (10-60000) Configure watermark warning generation for an igmp group limit. Generates @@ -252,7 +252,7 @@ is in a vrf, enter the interface command with the vrf keyword at the end. reports on the interface. Refer to the next `ip igmp` command for IGMP management. -.. index:: [no] ip pim use-source A.B.C.D +.. index:: ip pim use-source A.B.C.D .. clicmd:: [no] ip pim use-source A.B.C.D If you have multiple addresses configured on a particular interface @@ -358,17 +358,17 @@ Multicast Source Discovery Protocol (MSDP) Configuration Establish a MSDP connection with a peer. -.. index:: no ip msdp mesh-group [WORD] member A.B.C.D +.. index:: ip msdp mesh-group [WORD] member A.B.C.D .. clicmd:: no ip msdp mesh-group [WORD] member A.B.C.D Remove a MSDP peer member from a MSDP mesh-group. -.. index:: no ip msdp mesh-group [WORD] source A.B.C.D +.. index:: ip msdp mesh-group [WORD] source A.B.C.D .. clicmd:: no ip msdp mesh-group [WORD] source A.B.C.D Delete a MSDP mesh-group. -.. index:: no ip msdp peer A.B.C.D +.. index:: ip msdp peer A.B.C.D .. clicmd:: no ip msdp peer A.B.C.D Delete a MSDP peer connection. diff --git a/doc/user/ripd.rst b/doc/user/ripd.rst index 372c30f587..e83b505a19 100644 --- a/doc/user/ripd.rst +++ b/doc/user/ripd.rst @@ -94,7 +94,7 @@ RIP Configuration `no router rip` command. RIP must be enabled before carrying out any of the RIP commands. -.. index:: no router rip +.. index:: router rip .. clicmd:: no router rip Disable RIP. @@ -102,7 +102,7 @@ RIP Configuration .. index:: network NETWORK .. clicmd:: network NETWORK -.. index:: no network NETWORK +.. index:: network NETWORK .. clicmd:: no network NETWORK Set the RIP enable interface by NETWORK. The interfaces which have addresses @@ -117,7 +117,7 @@ RIP Configuration .. index:: network IFNAME .. clicmd:: network IFNAME -.. index:: no network IFNAME +.. index:: network IFNAME .. clicmd:: no network IFNAME Set a RIP enabled interface by IFNAME. Both the sending and @@ -128,7 +128,7 @@ RIP Configuration .. index:: neighbor A.B.C.D .. clicmd:: neighbor A.B.C.D -.. index:: no neighbor A.B.C.D +.. index:: neighbor A.B.C.D .. clicmd:: no neighbor A.B.C.D Specify RIP neighbor. When a neighbor doesn't understand multicast, this @@ -155,7 +155,7 @@ RIP Configuration .. index:: passive-interface (IFNAME|default) .. clicmd:: passive-interface (IFNAME|default) -.. index:: no passive-interface IFNAME +.. index:: passive-interface IFNAME .. clicmd:: no passive-interface IFNAME This command sets the specified interface to passive mode. On passive mode @@ -169,7 +169,7 @@ RIP Configuration .. index:: ip split-horizon .. clicmd:: ip split-horizon -.. index:: no ip split-horizon +.. index:: ip split-horizon .. clicmd:: no ip split-horizon Control split-horizon on the interface. Default is `ip split-horizon`. If @@ -203,7 +203,7 @@ discussion on the security implications of RIPv1 see :ref:`rip-authentication`. Default: Send Version 2, and accept either version. -.. index:: no version +.. index:: version .. clicmd:: no version Reset the global version setting back to the default. @@ -246,7 +246,7 @@ How to Announce RIP route .. index:: redistribute kernel route-map ROUTE-MAP .. clicmd:: redistribute kernel route-map ROUTE-MAP -.. index:: no redistribute kernel +.. index:: redistribute kernel .. clicmd:: no redistribute kernel `redistribute kernel` redistributes routing information from kernel route @@ -261,7 +261,7 @@ How to Announce RIP route .. index:: redistribute static route-map ROUTE-MAP .. clicmd:: redistribute static route-map ROUTE-MAP -.. index:: no redistribute static +.. index:: redistribute static .. clicmd:: no redistribute static `redistribute static` redistributes routing information from static route @@ -276,7 +276,7 @@ How to Announce RIP route .. index:: redistribute connected route-map ROUTE-MAP .. clicmd:: redistribute connected route-map ROUTE-MAP -.. index:: no redistribute connected +.. index:: redistribute connected .. clicmd:: no redistribute connected Redistribute connected routes into the RIP tables. `no redistribute @@ -293,7 +293,7 @@ How to Announce RIP route .. index:: redistribute ospf route-map ROUTE-MAP .. clicmd:: redistribute ospf route-map ROUTE-MAP -.. index:: no redistribute ospf +.. index:: redistribute ospf .. clicmd:: no redistribute ospf `redistribute ospf` redistributes routing information from ospf route @@ -308,7 +308,7 @@ How to Announce RIP route .. index:: redistribute bgp route-map ROUTE-MAP .. clicmd:: redistribute bgp route-map ROUTE-MAP -.. index:: no redistribute bgp +.. index:: redistribute bgp .. clicmd:: no redistribute bgp `redistribute bgp` redistributes routing information from bgp route entries @@ -322,7 +322,7 @@ How to Announce RIP route .. index:: route A.B.C.D/M .. clicmd:: route A.B.C.D/M -.. index:: no route A.B.C.D/M +.. index:: route A.B.C.D/M .. clicmd:: no route A.B.C.D/M This command is specific to FRR. The `route` command makes a static route @@ -384,7 +384,7 @@ received. Redistributed routes' metric is set to 1. .. index:: default-metric (1-16) .. clicmd:: default-metric (1-16) -.. index:: no default-metric (1-16) +.. index:: default-metric (1-16) .. clicmd:: no default-metric (1-16) This command modifies the default metric value for redistributed routes. @@ -410,7 +410,7 @@ Distance value is used in zebra daemon. Default RIP distance is 120. .. index:: distance (1-255) .. clicmd:: distance (1-255) -.. index:: no distance (1-255) +.. index:: distance (1-255) .. clicmd:: no distance (1-255) Set default RIP distance to specified value. @@ -418,7 +418,7 @@ Distance value is used in zebra daemon. Default RIP distance is 120. .. index:: distance (1-255) A.B.C.D/M .. clicmd:: distance (1-255) A.B.C.D/M -.. index:: no distance (1-255) A.B.C.D/M +.. index:: distance (1-255) A.B.C.D/M .. clicmd:: no distance (1-255) A.B.C.D/M Set default RIP distance to specified value when the route's source IP @@ -427,7 +427,7 @@ Distance value is used in zebra daemon. Default RIP distance is 120. .. index:: distance (1-255) A.B.C.D/M ACCESS-LIST .. clicmd:: distance (1-255) A.B.C.D/M ACCESS-LIST -.. index:: no distance (1-255) A.B.C.D/M ACCESS-LIST +.. index:: distance (1-255) A.B.C.D/M ACCESS-LIST .. clicmd:: no distance (1-255) A.B.C.D/M ACCESS-LIST Set default RIP distance to specified value when the route's source IP @@ -539,7 +539,7 @@ To prevent such unauthenticated querying of routes disable RIPv1, .. index:: ip rip authentication mode md5 .. clicmd:: ip rip authentication mode md5 -.. index:: no ip rip authentication mode md5 +.. index:: ip rip authentication mode md5 .. clicmd:: no ip rip authentication mode md5 Set the interface with RIPv2 MD5 authentication. @@ -547,7 +547,7 @@ To prevent such unauthenticated querying of routes disable RIPv1, .. index:: ip rip authentication mode text .. clicmd:: ip rip authentication mode text -.. index:: no ip rip authentication mode text +.. index:: ip rip authentication mode text .. clicmd:: no ip rip authentication mode text Set the interface with RIPv2 simple password authentication. @@ -555,7 +555,7 @@ To prevent such unauthenticated querying of routes disable RIPv1, .. index:: ip rip authentication string STRING .. clicmd:: ip rip authentication string STRING -.. index:: no ip rip authentication string STRING +.. index:: ip rip authentication string STRING .. clicmd:: no ip rip authentication string STRING RIP version 2 has simple text authentication. This command sets @@ -564,7 +564,7 @@ To prevent such unauthenticated querying of routes disable RIPv1, .. index:: ip rip authentication key-chain KEY-CHAIN .. clicmd:: ip rip authentication key-chain KEY-CHAIN -.. index:: no ip rip authentication key-chain KEY-CHAIN +.. index:: ip rip authentication key-chain KEY-CHAIN .. clicmd:: no ip rip authentication key-chain KEY-CHAIN Specify Keyed MD5 chain. @@ -610,7 +610,7 @@ RIP Timers The ``timers basic`` command allows the the default values of the timers listed above to be changed. -.. index:: no timers basic +.. index:: timers basic .. clicmd:: no timers basic The `no timers basic` command will reset the timers to the default settings diff --git a/doc/user/routemap.rst b/doc/user/routemap.rst index 3d19306a75..fa8eee815d 100644 --- a/doc/user/routemap.rst +++ b/doc/user/routemap.rst @@ -288,7 +288,7 @@ Route Map Set Command Subtract the BGP local preference from an existing `local_pref`. -.. index:: [no] set distance DISTANCE +.. index:: set distance DISTANCE .. clicmd:: [no] set distance DISTANCE Set the Administrative distance to DISTANCE to use for the route. @@ -299,7 +299,7 @@ Route Map Set Command Set the route's weight. -.. index:: [no] set metric <[+|-](1-4294967295)|rtt|+rtt|-rtt> +.. index:: set metric <[+|-](1-4294967295)|rtt|+rtt|-rtt> .. clicmd:: [no] set metric <[+|-](1-4294967295)|rtt|+rtt|-rtt> Set the BGP attribute MED to a specific value. Use `+`/`-` to add or subtract @@ -387,7 +387,7 @@ Route Map Optimization Command of all the prefixes in all the prefix-lists that are included in the match rule of all the sequences of a route-map. -.. index:: no route-map optimization +.. index:: route-map optimization .. clicmd:: no route-map optimization Disable the route-map processing optimization. diff --git a/doc/user/rpki.rst b/doc/user/rpki.rst index f8ec98c964..2c0e5876fa 100644 --- a/doc/user/rpki.rst +++ b/doc/user/rpki.rst @@ -104,7 +104,7 @@ The following commands are independent of a specific cache server. .. index:: rpki polling_period (1-3600) .. clicmd:: rpki polling_period (1-3600) -.. index:: no rpki polling_period +.. index:: rpki polling_period .. clicmd:: no rpki polling_period Set the number of seconds the router waits until the router asks the cache @@ -117,7 +117,7 @@ The following commands are independent of a specific cache server. .. index:: rpki cache (A.B.C.D|WORD) PORT [SSH_USERNAME] [SSH_PRIVKEY_PATH] [SSH_PUBKEY_PATH] [KNOWN_HOSTS_PATH] PREFERENCE .. clicmd:: rpki cache (A.B.C.D|WORD) PORT [SSH_USERNAME] [SSH_PRIVKEY_PATH] [SSH_PUBKEY_PATH] [KNOWN_HOSTS_PATH] PREFERENCE -.. index:: no rpki cache (A.B.C.D|WORD) [PORT] PREFERENCE +.. index:: rpki cache (A.B.C.D|WORD) [PORT] PREFERENCE .. clicmd:: no rpki cache (A.B.C.D|WORD) [PORT] PREFERENCE Add a cache server to the socket. By default, the connection between router @@ -157,7 +157,7 @@ Validating BGP Updates .. index:: match rpki notfound|invalid|valid .. clicmd:: match rpki notfound|invalid|valid -.. index:: no match rpki notfound|invalid|valid +.. index:: match rpki notfound|invalid|valid .. clicmd:: no match rpki notfound|invalid|valid Create a clause for a route map to match prefixes with the specified RPKI @@ -190,7 +190,7 @@ Debugging .. index:: debug rpki .. clicmd:: debug rpki -.. index:: no debug rpki +.. index:: debug rpki .. clicmd:: no debug rpki Enable or disable debugging output for RPKI. diff --git a/doc/user/snmp.rst b/doc/user/snmp.rst index d214926245..ebbe178e0b 100644 --- a/doc/user/snmp.rst +++ b/doc/user/snmp.rst @@ -11,7 +11,9 @@ a SNMP agent using the the AgentX protocol (:rfc:`2741`) and make the routing protocol MIBs available through it. Note that SNMP Support needs to be enabled at compile-time and loaded as module -on daemon startup. Refer to :ref:`loadable-module-support` on the latter. +on daemon startup. Refer to :ref:`loadable-module-support` on the latter. If +you do not start the daemons with snmp module support snmp will not work +properly. .. _getting-and-installing-an-snmp-agent: @@ -39,6 +41,7 @@ can be achieved by amending the default view from SNMP :file:`/etc/snmp/snmpd.conf`: :: + # This is the default view view all included .1 80 # Remove ipRouteTable from view @@ -129,7 +132,7 @@ Here is the syntax for using AgentX: .. index:: agentx .. clicmd:: agentx -.. index:: no agentx +.. index:: agentx .. clicmd:: no agentx diff --git a/doc/user/vnc.rst b/doc/user/vnc.rst index cb9c74ceea..4f03e543ac 100644 --- a/doc/user/vnc.rst +++ b/doc/user/vnc.rst @@ -149,7 +149,7 @@ Defaults section. exit-vnc -.. index:: no vnc nve-group NAME +.. index:: vnc nve-group NAME .. clicmd:: no vnc nve-group NAME Delete the NVE group named `name`. @@ -322,7 +322,7 @@ L2 Group Configuration. exit-vnc -.. index:: no vnc l2-group NAME +.. index:: vnc l2-group NAME .. clicmd:: no vnc l2-group NAME Delete the L2 group named `name`. @@ -338,7 +338,7 @@ The following statements are valid in a L2 group definition: .. index:: labels LABEL-LIST .. clicmd:: labels LABEL-LIST -.. index:: no labels LABEL-LIST +.. index:: labels LABEL-LIST .. clicmd:: no labels LABEL-LIST Add or remove labels associated with the group. `label-list` is a @@ -490,7 +490,7 @@ Redistribution Command Syntax .. index:: vnc redistribute ipv4|ipv6 bgp-direct-to-nve-groups view VIEWNAME .. clicmd:: vnc redistribute ipv4|ipv6 bgp-direct-to-nve-groups view VIEWNAME -.. index:: no vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static +.. index:: vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static .. clicmd:: no vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static Import (or do not import) prefixes from another routing protocols. Specify @@ -511,7 +511,7 @@ Redistribution Command Syntax .. index:: vnc redistribute nve-group GROUP-NAME .. clicmd:: vnc redistribute nve-group GROUP-NAME -.. index:: no vnc redistribute nve-group GROUP-NAME +.. index:: vnc redistribute nve-group GROUP-NAME .. clicmd:: no vnc redistribute nve-group GROUP-NAME When using `nve-group` mode, assign (or do not assign) the NVE group diff --git a/doc/user/vrrp.rst b/doc/user/vrrp.rst index 33582ee446..a39bd53844 100644 --- a/doc/user/vrrp.rst +++ b/doc/user/vrrp.rst @@ -358,21 +358,21 @@ using VRRPv2. All interface configuration commands are documented below. -.. index:: [no] vrrp (1-255) [version (2-3)] +.. index:: vrrp (1-255) [version (2-3)] .. clicmd:: [no] vrrp (1-255) [version (2-3)] Create a VRRP router with the specified VRID on the interface. Optionally specify the protocol version. If the protocol version is not specified, the default is VRRPv3. -.. index:: [no] vrrp (1-255) advertisement-interval (10-40950) +.. index:: vrrp (1-255) advertisement-interval (10-40950) .. clicmd:: [no] vrrp (1-255) advertisement-interval (10-40950) Set the advertisement interval. This is the interval at which VRRP advertisements will be sent. Values are given in milliseconds, but must be multiples of 10, as VRRP itself uses centiseconds. -.. index:: [no] vrrp (1-255) ip A.B.C.D +.. index:: vrrp (1-255) ip A.B.C.D .. clicmd:: [no] vrrp (1-255) ip A.B.C.D Add an IPv4 address to the router. This address must already be configured @@ -380,7 +380,7 @@ All interface configuration commands are documented below. implicitly activate the router; see :clicmd:`[no] vrrp (1-255) shutdown` to override this behavior. -.. index:: [no] vrrp (1-255) ipv6 X:X::X:X +.. index:: vrrp (1-255) ipv6 X:X::X:X .. clicmd:: [no] vrrp (1-255) ipv6 X:X::X:X Add an IPv6 address to the router. This address must already be configured @@ -391,14 +391,14 @@ All interface configuration commands are documented below. This command will fail if the protocol version is set to VRRPv2, as VRRPv2 does not support IPv6. -.. index:: [no] vrrp (1-255) preempt +.. index:: vrrp (1-255) preempt .. clicmd:: [no] vrrp (1-255) preempt Toggle preempt mode. When enabled, preemption allows Backup routers with higher priority to take over Master status from the existing Master. Enabled by default. -.. index:: [no] vrrp (1-255) priority (1-254) +.. index:: vrrp (1-255) priority (1-254) .. clicmd:: [no] vrrp (1-255) priority (1-254) Set the router priority. The router with the highest priority is elected as @@ -406,7 +406,7 @@ All interface configuration commands are documented below. the same priority, the router with the highest primary IP address is elected as the Master. Priority value 255 is reserved for the acting Master router. -.. index:: [no] vrrp (1-255) shutdown +.. index:: vrrp (1-255) shutdown .. clicmd:: [no] vrrp (1-255) shutdown Place the router into administrative shutdown. VRRP will not activate for @@ -427,7 +427,7 @@ Show commands, global defaults and debugging configuration commands. VRID will only show routers with that VRID. Specifying ``json`` will dump each router state in a JSON array. -.. index:: [no] debug vrrp [{protocol|autoconfigure|packets|sockets|ndisc|arp|zebra}] +.. index:: debug vrrp [{protocol|autoconfigure|packets|sockets|ndisc|arp|zebra}] .. clicmd:: [no] debug vrrp [{protocol|autoconfigure|packets|sockets|ndisc|arp|zebra}] Toggle debugging logs for VRRP components. @@ -457,7 +457,7 @@ Show commands, global defaults and debugging configuration commands. zebra Logs communications with Zebra. -.. index:: [no] vrrp default <advertisement-interval (1-4096)|preempt|priority (1-254)|shutdown> +.. index:: vrrp default <advertisement-interval (1-4096)|preempt|priority (1-254)|shutdown> .. clicmd:: [no] vrrp default <advertisement-interval (1-4096)|preempt|priority (1-254)|shutdown> Configure defaults for new VRRP routers. These values will not affect @@ -480,7 +480,7 @@ After configuring the interfaces as described in :ref:`vrrp-system-configuration`, and configuring any defaults you may want, execute the following command: -.. index:: [no] vrrp autoconfigure [version (2-3)] +.. index:: vrrp autoconfigure [version (2-3)] .. clicmd:: [no] vrrp autoconfigure [version (2-3)] Generates VRRP configuration based on the interface configuration on the @@ -503,7 +503,61 @@ The following configuration is then generated for you: vrrp 5 ip 10.0.2.16 vrrp 5 ipv6 2001:db8::370:7334 + VRRP is automatically activated. Global defaults, if set, are applied. You can then edit this configuration with **vtysh** as needed, and commit it by writing to the configuration file. + + +Troubleshooting +--------------- + +My virtual routers are not seeing each others' advertisements +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Check: + +- Is your kernel at least 5.1? +- Did you set the macvlan devices to ``bridge`` mode? +- If using IPv4 virtual addresses, does the parent of the macvlan devices have + an IPv4 address? +- If using IPv6 virtual addresses, is ``addrgenmode`` correctly set to + ``random`` and not the default ``eui64``? +- Is a firewall (``iptables``) or policy (``ip rule``) dropping multicast + traffic? +- Do you have unusual ``sysctls`` enabled that could affect the operation of + multicast traffic? +- Are you running in ESXi? See below. + + +My master router is not forwarding traffic +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +There's several possible causes here. If you're sure your configuration is +otherwise correct, the following sysctl likely needs to be turned on: + +.. code-block:: console + + sysctl -w net.ipv4.conf.eth0.ignore_routes_with_linkdown=1 + +Without this setting, it's possible to create topologies in which virtual +routers holding mastership status will not forward traffic. + +Issue reference: https://github.com/FRRouting/frr/issues/7391 + + +My router is running in ESXi and VRRP isn't working +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +By default, ESXi traffic security settings don't allow traffic to egress a VNIC +that does not have the MAC address assigned to the VNIC. This breaks VRRP, +since virtual MACs are the basis of the protocol. + +On ESXi before 6.7, you need to enable Promiscuous Mode in the ESXi settings. +This is a significant security issue in some deployments so make sure you +understand what you're doing. On 6.7 and later, you can use the MAC Learning +feature instead, explained `here +<https://www.virtuallyghetto.com/2018/04/native-mac-learning-in-vsphere-6-7-removes-the-need-for-promiscuous-mode-for-nested-esxi.html>`_. + +Issue reference: https://github.com/FRRouting/frr/issues/5386 diff --git a/doc/user/vtysh.rst b/doc/user/vtysh.rst index dd754a92ee..b1339f26e5 100644 --- a/doc/user/vtysh.rst +++ b/doc/user/vtysh.rst @@ -52,7 +52,7 @@ and the :clicmd:`terminal paginate` command: This variable should be set by the user according to their preferences, in their :file:`~/.profile` file. -.. index:: [no] terminal paginate +.. index:: terminal paginate .. clicmd:: [no] terminal paginate Enables/disables vtysh output pagination. This command is intended to @@ -165,7 +165,7 @@ in whose file the error is made. .. index:: service integrated-vtysh-config .. clicmd:: service integrated-vtysh-config -.. index:: no service integrated-vtysh-config +.. index:: service integrated-vtysh-config .. clicmd:: no service integrated-vtysh-config Control whether integrated :file:`frr.conf` file is written when diff --git a/doc/user/watchfrr.rst b/doc/user/watchfrr.rst index df04a1e375..b29e602fe5 100644 --- a/doc/user/watchfrr.rst +++ b/doc/user/watchfrr.rst @@ -22,7 +22,7 @@ WATCHFRR commands Give status information about the state of the different daemons being watched by WATCHFRR -.. index:: [no] watchfrr ignore DAEMON +.. index:: watchfrr ignore DAEMON .. clicmd:: [no] watchfrr ignore DAEMON Tell WATCHFRR to ignore a particular DAEMON if it goes unresponsive. diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst index 624e3cfe1a..bb456d89ca 100644 --- a/doc/user/zebra.rst +++ b/doc/user/zebra.rst @@ -72,6 +72,19 @@ Besides the common invocation options (:ref:`common-invocation-options`), the option and we will use Route Replace Semantics instead of delete than add. +.. option:: --asic-offload [notify_on_offload|notify_on_ack] + + The linux kernel has the ability to use asic-offload ( see switchdev + development ). When the operator knows that FRR will be working in + this way, allow them to specify this with FRR. At this point this + code only supports asynchronous notification of the offload state. + In other words the initial ACK received for linux kernel installation + does not give zebra any data about what the state of the offload + is. This option takes the optional paramegers notify_on_offload + or notify_on_ack. This signals to zebra to notify upper level + protocols about route installation/update on ack received from + the linux kernel or from offload notification. + .. _interface-commands: Configuration Addresses behaviour @@ -113,7 +126,7 @@ Standard Commands .. index:: shutdown .. clicmd:: shutdown -.. index:: no shutdown +.. index:: shutdown .. clicmd:: no shutdown @@ -125,10 +138,10 @@ Standard Commands .. index:: ipv6 address ADDRESS/PREFIX .. clicmd:: ipv6 address ADDRESS/PREFIX -.. index:: no ip address ADDRESS/PREFIX +.. index:: ip address ADDRESS/PREFIX .. clicmd:: no ip address ADDRESS/PREFIX -.. index:: no ipv6 address ADDRESS/PREFIX +.. index:: ipv6 address ADDRESS/PREFIX .. clicmd:: no ipv6 address ADDRESS/PREFIX @@ -137,7 +150,7 @@ Standard Commands .. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX .. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX -.. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX +.. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX .. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX @@ -158,7 +171,7 @@ Standard Commands .. index:: multicast .. clicmd:: multicast -.. index:: no multicast +.. index:: multicast .. clicmd:: no multicast @@ -167,7 +180,7 @@ Standard Commands .. index:: bandwidth (1-10000000) .. clicmd:: bandwidth (1-10000000) -.. index:: no bandwidth (1-10000000) +.. index:: bandwidth (1-10000000) .. clicmd:: no bandwidth (1-10000000) @@ -178,7 +191,7 @@ Standard Commands .. index:: link-detect .. clicmd:: link-detect -.. index:: no link-detect +.. index:: link-detect .. clicmd:: no link-detect @@ -202,7 +215,7 @@ Link Parameters Commands .. index:: link-params .. clicmd:: link-params -.. index:: no link-param +.. index:: link-param .. clicmd:: no link-param Enter into the link parameters sub node. At least 'enable' must be @@ -497,7 +510,7 @@ The push action is generally used for LER devices, which want to encapsulate all traffic for a wished destination into an MPLS label. This action is stored in routing entry, and can be configured like a route: -.. index:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL +.. index:: ip route NETWORK MASK GATEWAY|INTERFACE label LABEL .. clicmd:: [no] ip route NETWORK MASK GATEWAY|INTERFACE label LABEL NETWORK and MASK stand for the IP prefix entry to be added as static @@ -528,7 +541,7 @@ The swap action is generally used for LSR devices, which swap a packet with a label, with an other label. The Pop action is used on LER devices, at the termination of the MPLS traffic; this is used to remove MPLS header. -.. index:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null +.. index:: mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null .. clicmd:: [no] mpls lsp INCOMING_LABEL GATEWAY OUTGOING_LABEL|explicit-null|implicit-null INCOMING_LABEL and OUTGOING_LABEL are MPLS labels with values ranging from 16 @@ -579,7 +592,7 @@ unicast topology! .. index:: ip multicast rpf-lookup-mode MODE .. clicmd:: ip multicast rpf-lookup-mode MODE -.. index:: no ip multicast rpf-lookup-mode [MODE] +.. index:: ip multicast rpf-lookup-mode [MODE] .. clicmd:: no ip multicast rpf-lookup-mode [MODE] MODE sets the method used to perform RPF lookups. Supported modes: @@ -642,7 +655,7 @@ unicast topology! .. index:: ip mroute PREFIX NEXTHOP [DISTANCE] .. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE] -.. index:: no ip mroute PREFIX NEXTHOP [DISTANCE] +.. index:: ip mroute PREFIX NEXTHOP [DISTANCE] .. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE] Adds a static route entry to the Multicast RIB. This performs exactly as the @@ -803,7 +816,7 @@ FPM Commands ``127.0.0.1`` port ``2620``. -.. index:: no fpm connection ip A.B.C.D port (1-65535) +.. index:: fpm connection ip A.B.C.D port (1-65535) .. clicmd:: no fpm connection ip A.B.C.D port (1-65535) Configure ``zebra`` to connect to the default FPM server at ``127.0.0.1`` @@ -863,7 +876,7 @@ FPM Commands to connect to it immediately. -.. index:: no fpm address [<A.B.C.D|X:X::X:X> [port (1-65535)]] +.. index:: fpm address [<A.B.C.D|X:X::X:X> [port (1-65535)]] .. clicmd:: no fpm address [<A.B.C.D|X:X::X:X> [port (1-65535)]] Disables FPM entirely. ``zebra`` will close any current connections and @@ -877,7 +890,7 @@ FPM Commands group repeated route next hop information. -.. index:: no fpm use-next-hop-groups +.. index:: fpm use-next-hop-groups .. clicmd:: no fpm use-next-hop-groups Use the old known FPM behavior of including next hop information in the @@ -1051,13 +1064,13 @@ Many routing protocols require a router-id to be configured. To have a consistent router-id across all daemons, the following commands are available to configure and display the router-id: -.. index:: [no] [ip] router-id A.B.C.D +.. index:: router-id A.B.C.D .. clicmd:: [no] [ip] router-id A.B.C.D Allow entering of the router-id. This command also works under the vrf subnode, to allow router-id's per vrf. -.. index:: [no] [ip] router-id A.B.C.D vrf NAME +.. index:: router-id A.B.C.D vrf NAME .. clicmd:: [no] [ip] router-id A.B.C.D vrf NAME Configure the router-id of this router from the configure NODE. @@ -1072,7 +1085,7 @@ to configure and display the router-id: For protocols requiring an IPv6 router-id, the following commands are available: -.. index:: [no] ipv6 router-id X:X::X:X +.. index:: ipv6 router-id X:X::X:X .. clicmd:: [no] ipv6 router-id X:X::X:X Configure the IPv6 router-id of this router. Like its IPv4 counterpart, diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 473cc75a2a..0795fbd6df 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -88,7 +88,8 @@ static int eigrp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS) enum zapi_route_notify_owner note; uint32_t table; - if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e)) + if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e, NULL, + NULL)) return -1; return 0; diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 9b814c92de..74a0d795ab 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -319,6 +319,7 @@ enum rt_scope_t { #define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ #define RTM_F_OFFLOAD 0x4000 /* route is offloaded */ #define RTM_F_TRAP 0x8000 /* route is trapping packets */ +#define RTM_F_OFFLOAD_FAILED 0x10000 /* route offload failed */ /* Reserved table identifiers */ diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 9599077771..454da99e09 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -215,7 +215,7 @@ int isis_sock_init(struct isis_circuit *circuit) int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa) { - int bytesread = 0, bytestoread, offset, one = 1; + int bytesread = 0, bytestoread = 0, offset, one = 1; uint8_t *buff_ptr; struct bpf_hdr *bpf_hdr; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 730d224cb8..e3c70264f8 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -598,8 +598,20 @@ int isis_circuit_up(struct isis_circuit *circuit) if (circuit->state == C_STATE_UP) return ISIS_OK; - if (circuit->is_passive) + if (circuit->is_passive) { + /* make sure the union fields are initialized, else we + * could end with garbage values from a previous circuit + * type, which would then cause a segfault when building + * LSPs or computing the SPF tree + */ + if (circuit->circ_type == CIRCUIT_T_BROADCAST) { + circuit->u.bc.adjdb[0] = list_new(); + circuit->u.bc.adjdb[1] = list_new(); + } else if (circuit->circ_type == CIRCUIT_T_P2P) { + circuit->u.p2p.neighbor = NULL; + } return ISIS_OK; + } if (circuit->area->lsp_mtu > isis_circuit_pdu_size(circuit)) { flog_err( diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 383f23758a..6c6d88ad53 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -170,15 +170,19 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, return CMD_SUCCESS; } ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); - - if (!vrf_name && ifp->vrf_id == VRF_DEFAULT) - vrf_name = VRF_DEFAULT_NAME; - - if (ifp->vrf_id != VRF_DEFAULT) { - vrf = vrf_lookup_by_id(ifp->vrf_id); - if (vrf && !vrf_name) - vrf_name = vrf->name; + if (!vrf_name) { + if (ifp) { + if (ifp->vrf_id == VRF_DEFAULT) + vrf_name = VRF_DEFAULT_NAME; + else { + vrf = vrf_lookup_by_id(ifp->vrf_id); + if (vrf && !vrf_name) + vrf_name = vrf->name; + } + } else + vrf_name = VRF_DEFAULT_NAME; } + area = isis_area_lookup_by_vrf(tag, vrf_name); if (!area) { isis_global_instance_create(vrf_name); @@ -235,7 +239,7 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, } /* check if the interface is a loopback and if so set it as passive */ - if (if_is_loopback(ifp)) + if (ifp && if_is_loopback(ifp)) nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY, "true"); @@ -263,14 +267,19 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, return CMD_SUCCESS; ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); - if (!vrf_name && ifp->vrf_id == VRF_DEFAULT) - vrf_name = VRF_DEFAULT_NAME; - - if (ifp->vrf_id != VRF_DEFAULT) { - vrf = vrf_lookup_by_id(ifp->vrf_id); - if (vrf && !vrf_name) - vrf_name = vrf->name; + if (!vrf_name) { + if (ifp) { + if (ifp->vrf_id == VRF_DEFAULT) + vrf_name = VRF_DEFAULT_NAME; + else { + vrf = vrf_lookup_by_id(ifp->vrf_id); + if (vrf && !vrf_name) + vrf_name = vrf->name; + } + } else + vrf_name = VRF_DEFAULT_NAME; } + area = isis_area_lookup_by_vrf(tag, vrf_name); if (!area) { isis_global_instance_create(vrf_name); @@ -326,7 +335,7 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, } /* check if the interface is a loopback and if so set it as passive */ - if (if_is_loopback(ifp)) + if (ifp && if_is_loopback(ifp)) nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY, "true"); @@ -1633,9 +1642,9 @@ DEFPY_YANG (isis_sr_prefix_sid, "Prefix SID\n" "IPv4 Prefix\n" "IPv6 Prefix\n" - "Specify the absolute value of Prefix Segement ID\n" + "Specify the absolute value of Prefix Segment ID\n" "The Prefix Segment ID value\n" - "Specify the index of Prefix Segement ID\n" + "Specify the index of Prefix Segment ID\n" "The Prefix Segment ID index\n" "Don't request Penultimate Hop Popping (PHP)\n" "Upstream neighbor must replace prefix-sid with explicit null label\n" @@ -1675,9 +1684,9 @@ DEFPY_YANG (no_isis_sr_prefix_sid, "Prefix SID\n" "IPv4 Prefix\n" "IPv6 Prefix\n" - "Specify the absolute value of Prefix Segement ID\n" + "Specify the absolute value of Prefix Segment ID\n" "The Prefix Segment ID value\n" - "Specify the index of Prefix Segement ID\n" + "Specify the index of Prefix Segment ID\n" "The Prefix Segment ID index\n" "Don't request Penultimate Hop Popping (PHP)\n" "Upstream neighbor must replace prefix-sid with explicit null label\n" diff --git a/isisd/isis_errors.c b/isisd/isis_errors.c index 7530d0b966..1d277ac5f1 100644 --- a/isisd/isis_errors.c +++ b/isisd/isis_errors.c @@ -44,6 +44,12 @@ static struct log_ref ferr_isis_err[] = { .suggestion = "Configure a larger SRGB" }, { + .code = EC_ISIS_SID_COLLISION, + .title = "SID collision", + .description = "Isis has detected that two different prefixes share the same SID index", + .suggestion = "Identify the routers that are advertising the same SID index and fix the collision accordingly" + }, + { .code = END_FERR, } }; diff --git a/isisd/isis_errors.h b/isisd/isis_errors.h index d5674dbf30..6f3e5f85cf 100644 --- a/isisd/isis_errors.h +++ b/isisd/isis_errors.h @@ -27,6 +27,7 @@ enum isis_log_refs { EC_ISIS_PACKET = ISIS_FERR_START, EC_ISIS_CONFIG, EC_ISIS_SID_OVERFLOW, + EC_ISIS_SID_COLLISION, }; extern void isis_error_init(void); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 6cb7d32c25..45089410e9 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -22,6 +22,7 @@ #include <zebra.h> +#include "printfrr.h" #include "northbound.h" #include "linklist.h" #include "log.h" @@ -1482,7 +1483,8 @@ int isis_instance_segment_routing_srgb_pre_validate( /* Check that the block size does not exceed 65535 */ if ((srgb_ubound - srgb_lbound + 1) > 65535) { - zlog_warn( + snprintf( + args->errmsg, args->errmsg_len, "New SR Global Block (%u/%u) exceed the limit of 65535", srgb_lbound, srgb_ubound); return NB_ERR_VALIDATION; @@ -1490,7 +1492,8 @@ int isis_instance_segment_routing_srgb_pre_validate( /* Validate SRGB against SRLB */ if (!((srgb_ubound < srlb_lbound) || (srgb_lbound > srlb_ubound))) { - zlog_warn( + snprintf( + args->errmsg, args->errmsg_len, "New SR Global Block (%u/%u) conflict with Local Block (%u/%u)", srgb_lbound, srgb_ubound, srlb_lbound, srlb_ubound); return NB_ERR_VALIDATION; @@ -1523,8 +1526,8 @@ int isis_instance_segment_routing_srgb_lower_bound_modify( switch (args->event) { case NB_EV_VALIDATE: if (!IS_MPLS_UNRESERVED_LABEL(lower_bound)) { - zlog_warn("Invalid SRGB lower bound: %u", - lower_bound); + snprintf(args->errmsg, args->errmsg_len, + "Invalid SRGB lower bound: %u", lower_bound); return NB_ERR_VALIDATION; } break; @@ -1548,8 +1551,8 @@ int isis_instance_segment_routing_srgb_upper_bound_modify( switch (args->event) { case NB_EV_VALIDATE: if (!IS_MPLS_UNRESERVED_LABEL(upper_bound)) { - zlog_warn("Invalid SRGB upper bound: %u", - upper_bound); + snprintf(args->errmsg, args->errmsg_len, + "Invalid SRGB upper bound: %u", upper_bound); return NB_ERR_VALIDATION; } break; @@ -1580,15 +1583,16 @@ int isis_instance_segment_routing_srlb_pre_validate( /* Check that the block size does not exceed 65535 */ if ((srlb_ubound - srlb_lbound + 1) > 65535) { - zlog_warn( - "New SR Local Block (%u/%u) exceed the limit of 65535", - srlb_lbound, srlb_ubound); + snprintf(args->errmsg, args->errmsg_len, + "New SR Local Block (%u/%u) exceed the limit of 65535", + srlb_lbound, srlb_ubound); return NB_ERR_VALIDATION; } /* Validate SRLB against SRGB */ if (!((srlb_ubound < srgb_lbound) || (srlb_lbound > srgb_ubound))) { - zlog_warn( + snprintf( + args->errmsg, args->errmsg_len, "New SR Local Block (%u/%u) conflict with Global Block (%u/%u)", srlb_lbound, srlb_ubound, srgb_lbound, srgb_ubound); return NB_ERR_VALIDATION; @@ -1621,8 +1625,8 @@ int isis_instance_segment_routing_srlb_lower_bound_modify( switch (args->event) { case NB_EV_VALIDATE: if (!IS_MPLS_UNRESERVED_LABEL(lower_bound)) { - zlog_warn("Invalid SRLB lower bound: %u", - lower_bound); + snprintf(args->errmsg, args->errmsg_len, + "Invalid SRLB lower bound: %u", lower_bound); return NB_ERR_VALIDATION; } break; @@ -1646,8 +1650,8 @@ int isis_instance_segment_routing_srlb_upper_bound_modify( switch (args->event) { case NB_EV_VALIDATE: if (!IS_MPLS_UNRESERVED_LABEL(upper_bound)) { - zlog_warn("Invalid SRLB upper bound: %u", - upper_bound); + snprintf(args->errmsg, args->errmsg_len, + "Invalid SRLB upper bound: %u", upper_bound); return NB_ERR_VALIDATION; } break; @@ -1739,12 +1743,17 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy( int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate( struct nb_cb_pre_validate_args *args) { + const struct lyd_node *area_dnode; + struct isis_area *area; + struct prefix prefix; uint32_t srgb_lbound; uint32_t srgb_ubound; uint32_t srgb_range; uint32_t sid; enum sr_sid_value_type sid_type; + struct isis_prefix_sid psid = {}; + yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); srgb_lbound = yang_dnode_get_uint32(args->dnode, "../../srgb/lower-bound"); srgb_ubound = yang_dnode_get_uint32(args->dnode, @@ -1752,23 +1761,67 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate( sid = yang_dnode_get_uint32(args->dnode, "./sid-value"); sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type"); + /* Check for invalid indexes/labels. */ srgb_range = srgb_ubound - srgb_lbound + 1; + psid.value = sid; switch (sid_type) { case SR_SID_VALUE_TYPE_INDEX: if (sid >= srgb_range) { - zlog_warn("SID index %u falls outside local SRGB range", - sid); + snprintf(args->errmsg, args->errmsg_len, + "SID index %u falls outside local SRGB range", + sid); return NB_ERR_VALIDATION; } break; case SR_SID_VALUE_TYPE_ABSOLUTE: if (!IS_MPLS_UNRESERVED_LABEL(sid)) { - zlog_warn("Invalid absolute SID %u", sid); + snprintf(args->errmsg, args->errmsg_len, + "Invalid absolute SID %u", sid); return NB_ERR_VALIDATION; } + SET_FLAG(psid.flags, ISIS_PREFIX_SID_VALUE); + SET_FLAG(psid.flags, ISIS_PREFIX_SID_LOCAL); break; } + /* Check for Prefix-SID collisions. */ + area_dnode = yang_dnode_get_parent(args->dnode, "instance"); + area = nb_running_get_entry(area_dnode, NULL, false); + if (area) { + for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; + level++) { + struct isis_spftree *spftree; + struct isis_vertex *vertex_psid; + + if (!(area->is_type & level)) + continue; + spftree = area->spftree[tree][level - 1]; + if (!spftree) + continue; + + vertex_psid = isis_spf_prefix_sid_lookup( + spftree, &psid); + if (vertex_psid + && !prefix_same(&vertex_psid->N.ip.p.dest, + &prefix)) { + snprintfrr( + args->errmsg, args->errmsg_len, + "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)", + CHECK_FLAG( + psid.flags, + ISIS_PREFIX_SID_VALUE) + ? "label" + : "index", + psid.value, + &vertex_psid->N.ip.p.dest, + level); + return NB_ERR_VALIDATION; + } + } + } + } + return NB_OK; } diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index e6c7a734bd..240be27cf3 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -167,8 +167,7 @@ static void isis_redist_update_ext_reach(struct isis_area *area, int level, area_info.metric = redist->metric; if (redist->map_name) { - map_ret = - route_map_apply(redist->map, p, RMAP_ISIS, &area_info); + map_ret = route_map_apply(redist->map, p, &area_info); if (map_ret == RMAP_DENYMATCH) area_info.distance = 255; } @@ -380,6 +379,19 @@ static void isis_redist_update_zebra_subscriptions(struct isis *isis) } } +void isis_redist_free(struct isis *isis) +{ + int i; + + for (i = 0; i < REDIST_PROTOCOL_COUNT; i++) { + if (!isis->ext_info[i]) + continue; + + route_table_finish(isis->ext_info[i]); + isis->ext_info[i] = NULL; + } +} + void isis_redist_set(struct isis_area *area, int level, int family, int type, uint32_t metric, const char *routemap, int originate_type) { diff --git a/isisd/isis_redist.h b/isisd/isis_redist.h index 0d2dc6a803..afce922240 100644 --- a/isisd/isis_redist.h +++ b/isisd/isis_redist.h @@ -62,4 +62,5 @@ void isis_redist_set(struct isis_area *area, int level, int family, int type, uint32_t metric, const char *routemap, int originate_type); void isis_redist_unset(struct isis_area *area, int level, int family, int type); +void isis_redist_free(struct isis *isis); #endif diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 902528e1bb..db0f2fd8be 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -49,14 +49,10 @@ #include "isis_routemap.h" static enum route_map_cmd_result_t -route_match_ip_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; - if (type != RMAP_ISIS) - return RMAP_NOMATCH; - alist = access_list_lookup(AFI_IP, (char *)rule); if (access_list_apply(alist, prefix) != FILTER_DENY) return RMAP_MATCH; @@ -85,13 +81,10 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = { static enum route_map_cmd_result_t route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; - if (type != RMAP_ISIS) - return RMAP_NOMATCH; - plist = prefix_list_lookup(AFI_IP, (char *)rule); if (prefix_list_apply(plist, prefix) != PREFIX_DENY) return RMAP_MATCH; @@ -120,14 +113,10 @@ static const struct route_map_rule_cmd /* ------------------------------------------------------------*/ static enum route_map_cmd_result_t -route_match_ipv6_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; - if (type != RMAP_ISIS) - return RMAP_NOMATCH; - alist = access_list_lookup(AFI_IP6, (char *)rule); if (access_list_apply(alist, prefix) != FILTER_DENY) return RMAP_MATCH; @@ -156,13 +145,10 @@ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { static enum route_map_cmd_result_t route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; - if (type != RMAP_ISIS) - return RMAP_NOMATCH; - plist = prefix_list_lookup(AFI_IP6, (char *)rule); if (prefix_list_apply(plist, prefix) != PREFIX_DENY) return RMAP_MATCH; @@ -191,18 +177,16 @@ static const struct route_map_rule_cmd /* ------------------------------------------------------------*/ static enum route_map_cmd_result_t -route_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric(void *rule, const struct prefix *prefix, void *object) { uint32_t *metric; struct isis_ext_info *info; - if (type == RMAP_ISIS) { - metric = rule; - info = object; + metric = rule; + info = object; + + info->metric = *metric; - info->metric = *metric; - } return RMAP_OKAY; } diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 690ea9f1a5..58b0cf2684 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -33,11 +33,13 @@ #include "memory.h" #include "prefix.h" #include "if.h" +#include "hash.h" #include "table.h" #include "spf_backoff.h" #include "srcdest_table.h" #include "vrf.h" +#include "isis_errors.h" #include "isis_constants.h" #include "isis_common.h" #include "isis_flags.h" @@ -184,6 +186,36 @@ const char *vid2string(const struct isis_vertex *vertex, char *buff, int size) return "UNKNOWN"; } +static bool prefix_sid_cmp(const void *value1, const void *value2) +{ + const struct isis_vertex *c1 = value1; + const struct isis_vertex *c2 = value2; + + if (CHECK_FLAG(c1->N.ip.sr.sid.flags, + ISIS_PREFIX_SID_VALUE | ISIS_PREFIX_SID_LOCAL) + != CHECK_FLAG(c2->N.ip.sr.sid.flags, + ISIS_PREFIX_SID_VALUE | ISIS_PREFIX_SID_LOCAL)) + return false; + + return c1->N.ip.sr.sid.value == c2->N.ip.sr.sid.value; +} + +static unsigned int prefix_sid_key_make(const void *value) +{ + const struct isis_vertex *vertex = value; + + return jhash_1word(vertex->N.ip.sr.sid.value, 0); +} + +struct isis_vertex *isis_spf_prefix_sid_lookup(struct isis_spftree *spftree, + struct isis_prefix_sid *psid) +{ + struct isis_vertex lookup = {}; + + lookup.N.ip.sr.sid = *psid; + return hash_lookup(spftree->prefix_sids, &lookup); +} + static void isis_vertex_adj_free(void *arg) { struct isis_vertex_adj *vadj = arg; @@ -310,6 +342,8 @@ struct isis_spftree *isis_spftree_new(struct isis_area *area, tree->route_table_backup->cleanup = isis_route_node_cleanup; tree->area = area; tree->lspdb = lspdb; + tree->prefix_sids = hash_create(prefix_sid_key_make, prefix_sid_cmp, + "SR Prefix-SID Entries"); tree->sadj_list = list_new(); tree->sadj_list->del = isis_spf_adj_free; tree->last_run_timestamp = 0; @@ -332,6 +366,8 @@ struct isis_spftree *isis_spftree_new(struct isis_area *area, void isis_spftree_del(struct isis_spftree *spftree) { + hash_clean(spftree->prefix_sids, NULL); + hash_free(spftree->prefix_sids); if (spftree->type == SPF_TYPE_TI_LFA) { isis_spf_node_list_clear(&spftree->lfa.q_space); isis_spf_node_list_clear(&spftree->lfa.p_space); @@ -515,14 +551,39 @@ isis_spf_add2tent(struct isis_spftree *spftree, enum vertextype vtype, void *id, vertex->d_N = cost; vertex->depth = depth; if (VTYPE_IP(vtype) && psid) { - bool local; + struct isis_area *area = spftree->area; + struct isis_vertex *vertex_psid; + + /* + * Check if the Prefix-SID is already in use by another prefix. + */ + vertex_psid = isis_spf_prefix_sid_lookup(spftree, psid); + if (vertex_psid + && !prefix_same(&vertex_psid->N.ip.p.dest, + &vertex->N.ip.p.dest)) { + flog_warn( + EC_ISIS_SID_COLLISION, + "ISIS-Sr (%s): collision detected, prefixes %pFX and %pFX share the same SID %s (%u)", + area->area_tag, &vertex->N.ip.p.dest, + &vertex_psid->N.ip.p.dest, + CHECK_FLAG(psid->flags, ISIS_PREFIX_SID_VALUE) + ? "label" + : "index", + psid->value); + psid = NULL; + } else { + bool local; + + local = (vertex->depth == 1); + vertex->N.ip.sr.sid = *psid; + vertex->N.ip.sr.label = + sr_prefix_in_label(area, psid, local); + if (vertex->N.ip.sr.label != MPLS_INVALID_LABEL) + vertex->N.ip.sr.present = true; - local = (vertex->depth == 1); - vertex->N.ip.sr.sid = *psid; - vertex->N.ip.sr.label = - sr_prefix_in_label(spftree->area, psid, local); - if (vertex->N.ip.sr.label != MPLS_INVALID_LABEL) - vertex->N.ip.sr.present = true; + hash_get(spftree->prefix_sids, vertex, + hash_alloc_intern); + } } if (parent) { @@ -1352,6 +1413,7 @@ static void add_to_paths(struct isis_spftree *spftree, static void init_spt(struct isis_spftree *spftree, int mtid) { /* Clear data from previous run. */ + hash_clean(spftree->prefix_sids, NULL); isis_spf_node_list_clear(&spftree->adj_nodes); list_delete_all_node(spftree->sadj_list); isis_vertex_queue_clear(&spftree->tents); @@ -1665,6 +1727,11 @@ static struct isis_spf_run *isis_run_spf_arg(struct isis_area *area, int level) return run; } +void isis_spf_timer_free(void *run) +{ + XFREE(MTYPE_ISIS_SPF_RUN, run); +} + int _isis_spf_schedule(struct isis_area *area, int level, const char *func, const char *file, int line) { @@ -1744,7 +1811,8 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue, "Vertex Type Metric Next-Hop Interface Parent\n"); for (ALL_QUEUE_ELEMENTS_RO(queue, node, vertex)) { - if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) { + if (VTYPE_IS(vertex->type) + && memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) { vty_out(vty, "%-20s %-12s %-6s", print_sys_hostname(root_sysid), "", ""); vty_out(vty, "%-30s\n", ""); diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index 15d3ff9272..ad15d3e3c7 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -53,6 +53,8 @@ struct isis_spftree *isis_spftree_new(struct isis_area *area, const uint8_t *sysid, int level, enum spf_tree_id tree_id, enum spf_type type, uint8_t flags); +struct isis_vertex *isis_spf_prefix_sid_lookup(struct isis_spftree *spftree, + struct isis_prefix_sid *psid); void isis_spf_invalidate_routes(struct isis_spftree *tree); void isis_spf_verify_routes(struct isis_area *area, struct isis_spftree **trees); @@ -76,4 +78,5 @@ struct isis_spftree *isis_run_hopcount_spf(struct isis_area *area, uint8_t *sysid, struct isis_spftree *spftree); +void isis_spf_timer_free(void *run); #endif /* _ZEBRA_ISIS_SPF_H */ diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h index e999f96539..9cb1a39b82 100644 --- a/isisd/isis_spf_private.h +++ b/isisd/isis_spf_private.h @@ -313,6 +313,7 @@ struct isis_spftree { struct route_table *route_table; struct route_table *route_table_backup; struct lspdb_head *lspdb; /* link-state db */ + struct hash *prefix_sids; /* SR Prefix-SIDs. */ struct list *sadj_list; struct isis_spf_nodes adj_nodes; struct isis_area *area; /* back pointer to area */ diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 805ede1e44..1b4b0c8f2f 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -95,9 +95,9 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) return 0; #ifdef EXTREME_DEBUG - if (p->family == AF_INET) + if (c->address->family == AF_INET) zlog_debug("connected IP address %pFX", c->address); - if (p->family == AF_INET6) + if (c->address->family == AF_INET6) zlog_debug("connected IPv6 address %pFX", c->address); #endif /* EXTREME_DEBUG */ @@ -122,9 +122,9 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) return 0; #ifdef EXTREME_DEBUG - if (p->family == AF_INET) + if (c->address->family == AF_INET) zlog_debug("disconnected IP address %pFX", c->address); - if (p->family == AF_INET6) + if (c->address->family == AF_INET6) zlog_debug("disconnected IPv6 address %pFX", c->address); #endif /* EXTREME_DEBUG */ @@ -207,35 +207,30 @@ static int isis_zebra_add_nexthops(struct isis *isis, struct list *nexthops, api_nh->ifindex = nexthop->ifindex; /* Add MPLS label(s). */ - switch (type) { - case ISIS_NEXTHOP_MAIN: - if (nexthop->sr.present) { - api_nh->label_num = 1; - api_nh->labels[0] = nexthop->sr.label; - } else if (mpls_lsp) + if (nexthop->label_stack) { + api_nh->label_num = nexthop->label_stack->num_labels; + memcpy(api_nh->labels, nexthop->label_stack->label, + sizeof(mpls_label_t) * api_nh->label_num); + } else if (nexthop->sr.present) { + api_nh->label_num = 1; + api_nh->labels[0] = nexthop->sr.label; + } else if (mpls_lsp) { + switch (type) { + case ISIS_NEXTHOP_MAIN: /* * Do not use non-SR enabled nexthops to prevent * broken LSPs from being formed. */ continue; - break; - case ISIS_NEXTHOP_BACKUP: - if (nexthop->label_stack) { - api_nh->label_num = - nexthop->label_stack->num_labels; - memcpy(api_nh->labels, - nexthop->label_stack->label, - sizeof(mpls_label_t) - * api_nh->label_num); - } else if (mpls_lsp) { + case ISIS_NEXTHOP_BACKUP: /* * This is necessary because zebra requires * the nexthops of MPLS LSPs to be labeled. */ api_nh->label_num = 1; api_nh->labels[0] = MPLS_LABEL_IMPLICIT_NULL; + break; } - break; } /* Backup nexthop handling. */ @@ -263,9 +258,15 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix, struct zapi_route api; int count = 0; - if (zclient->sock < 0 || list_isempty(route_info->nexthops)) + if (zclient->sock < 0) return; + /* Uninstall the route if it doesn't have any valid nexthop. */ + if (list_isempty(route_info->nexthops)) { + isis_zebra_route_del_route(isis, prefix, src_p, route_info); + return; + } + memset(&api, 0, sizeof(api)); api.vrf_id = isis->vrf_id; api.type = PROTO_TYPE; @@ -618,7 +619,7 @@ int isis_zebra_label_manager_connect(void) set_nonblocking(zclient_sync->sock); /* Send hello to notify zebra this is a synchronous client */ - if (zclient_send_hello(zclient_sync) < 0) { + if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) { zlog_warn("%s: failed sending hello for synchronous zclient!", __func__); close(zclient_sync->sock); diff --git a/isisd/isisd.c b/isisd/isisd.c index 057ede0e38..950cdc281f 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -442,7 +442,11 @@ void isis_area_destroy(struct isis_area *area) spftree_area_del(area); + if (area->spf_timer[0]) + isis_spf_timer_free(THREAD_ARG(area->spf_timer[0])); thread_cancel(&area->spf_timer[0]); + if (area->spf_timer[1]) + isis_spf_timer_free(THREAD_ARG(area->spf_timer[1])); thread_cancel(&area->spf_timer[1]); spf_backoff_free(area->spf_delay_ietf[0]); @@ -583,6 +587,7 @@ void isis_finish(struct isis *isis) isis_vrf_unlink(isis, vrf); } + isis_redist_free(isis); list_delete(&isis->area_list); list_delete(&isis->init_circ_list); XFREE(MTYPE_ISIS, isis); @@ -2375,6 +2380,9 @@ static void area_resign_level(struct isis_area *area, int level) } } + if (area->spf_timer[level - 1]) + isis_spf_timer_free(THREAD_ARG(area->spf_timer[level - 1])); + thread_cancel(&area->spf_timer[level - 1]); sched_debug( diff --git a/ldpd/lde.c b/ldpd/lde.c index 67b695150e..5ed0ed4520 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -73,6 +73,7 @@ struct ldpd_conf *ldeconf; struct nbr_tree lde_nbrs = RB_INITIALIZER(&lde_nbrs); static struct imsgev *iev_ldpe; +static struct imsgev iev_main_sync_data; static struct imsgev *iev_main, *iev_main_sync; /* lde privileges */ @@ -148,8 +149,8 @@ lde(void) &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; - if ((iev_main_sync = calloc(1, sizeof(struct imsgev))) == NULL) - fatal(NULL); + memset(&iev_main_sync_data, 0, sizeof(iev_main_sync_data)); + iev_main_sync = &iev_main_sync_data; imsg_init(&iev_main_sync->ibuf, LDPD_FD_SYNC); /* create base configuration */ @@ -203,7 +204,6 @@ lde_shutdown(void) if (iev_ldpe) free(iev_ldpe); free(iev_main); - free(iev_main_sync); log_info("label decision engine exiting"); @@ -2092,7 +2092,7 @@ static void zclient_sync_init(void) sock_set_nonblock(zclient_sync->sock); /* Send hello to notify zebra this is a synchronous client */ - if (zclient_send_hello(zclient_sync) < 0) { + if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) { log_warnx("Error sending hello for synchronous zclient!"); goto retry; } diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index 3852d8d23b..df9832a281 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -127,8 +127,12 @@ ldp_zebra_opaque_unregister(void) int ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *state) { - return zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE, - (const uint8_t *) state, sizeof(*state)); + if (zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE, + (const uint8_t *)state, sizeof(*state)) + == ZCLIENT_SEND_FAILURE) + return -1; + else + return 0; } static int @@ -137,8 +141,12 @@ ldp_sync_zebra_send_announce(void) struct ldp_igp_sync_announce announce; announce.proto = ZEBRA_ROUTE_LDP; - return zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE, - (const uint8_t *) &announce, sizeof(announce)); + if (zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE, + (const uint8_t *)&announce, sizeof(announce)) + == ZCLIENT_SEND_FAILURE) + return -1; + else + return 0; } static int @@ -272,7 +280,10 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr) znh->label_num = 1; znh->labels[0] = kr->remote_label; - return zebra_send_mpls_labels(zclient, cmd, &zl); + if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE) + return -1; + + return 0; } int @@ -293,7 +304,8 @@ kmpw_add(struct zapi_pw *zpw) debug_zebra_out("pseudowire %s nexthop %s (add)", zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); - return (zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw)); + return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw) + == ZCLIENT_SEND_FAILURE; } int @@ -302,7 +314,8 @@ kmpw_del(struct zapi_pw *zpw) debug_zebra_out("pseudowire %s nexthop %s (del)", zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); - return (zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw)); + return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw) + == ZCLIENT_SEND_FAILURE; } int @@ -312,7 +325,8 @@ kmpw_set(struct zapi_pw *zpw) zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop), zpw->local_label, zpw->remote_label); - return (zebra_send_pw(zclient, ZEBRA_PW_SET, zpw)); + return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw) + == ZCLIENT_SEND_FAILURE; } int @@ -321,7 +335,8 @@ kmpw_unset(struct zapi_pw *zpw) debug_zebra_out("pseudowire %s nexthop %s (unset)", zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); - return (zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw)); + return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw) + == ZCLIENT_SEND_FAILURE; } void diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index ffc1d17f51..f3f8b85102 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -49,6 +49,7 @@ struct ldpd_conf *leconf; struct ldpd_sysdep sysdep; #endif +static struct imsgev iev_main_data; static struct imsgev *iev_main, *iev_main_sync; static struct imsgev *iev_lde; #ifdef __OpenBSD__ @@ -124,8 +125,8 @@ ldpe(void) &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; - if ((iev_main_sync = calloc(1, sizeof(struct imsgev))) == NULL) - fatal(NULL); + memset(&iev_main_data, 0, sizeof(iev_main_data)); + iev_main_sync = &iev_main_data; imsg_init(&iev_main_sync->ibuf, LDPD_FD_SYNC); /* create base configuration */ @@ -231,7 +232,6 @@ ldpe_shutdown(void) if (iev_lde) free(iev_lde); free(iev_main); - free(iev_main_sync); free(pkt_ptr); log_info("ldp engine exiting"); @@ -104,7 +104,10 @@ void bfd_set_param(struct bfd_info **bfd_info, uint32_t min_rx, uint32_t min_tx, if (((*bfd_info)->required_min_rx != min_rx) || ((*bfd_info)->desired_min_tx != min_tx) || ((*bfd_info)->detect_mult != detect_mult) - || (profile && strcmp((*bfd_info)->profile, profile))) + || ((*bfd_info)->profile[0] == 0 && profile) + || ((*bfd_info)->profile[0] && profile == NULL) + || (profile && (*bfd_info)->profile[0] + && strcmp((*bfd_info)->profile, profile))) *command = ZEBRA_BFD_DEST_UPDATE; } @@ -402,7 +405,7 @@ void bfd_client_sendmsg(struct zclient *zclient, int command, vrf_id_t vrf_id) { struct stream *s; - int ret; + enum zclient_send_status ret; /* Check socket. */ if (!zclient || zclient->sock < 0) { @@ -423,7 +426,7 @@ void bfd_client_sendmsg(struct zclient *zclient, int command, ret = zclient_send_message(zclient); - if (ret < 0) { + if (ret == ZCLIENT_SEND_FAILURE) { if (bfd_debug) zlog_debug( "bfd_client_sendmsg %ld: zclient_send_message() failed", @@ -468,6 +471,39 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args) : sizeof(struct in6_addr); stream_put(s, &args->dst, addrlen); + /* + * For more BFD integration protocol details, see function + * `_ptm_msg_read` in `bfdd/ptm_adapter.c`. + */ +#if HAVE_BFDD > 0 + /* Session timers. */ + stream_putl(s, args->min_rx); + stream_putl(s, args->min_tx); + stream_putc(s, args->detection_multiplier); + + /* Is multi hop? */ + stream_putc(s, args->mhop != 0); + + /* Source address. */ + stream_putw(s, args->family); + stream_put(s, &args->src, addrlen); + + /* Send the expected TTL. */ + stream_putc(s, args->ttl); + + /* Send interface name if any. */ + stream_putc(s, args->ifnamelen); + if (args->ifnamelen) + stream_put(s, args->ifname, args->ifnamelen); + + /* Send the C bit indicator. */ + stream_putc(s, args->cbit); + + /* Send profile name if any. */ + stream_putc(s, args->profilelen); + if (args->profilelen) + stream_put(s, args->profile, args->profilelen); +#else /* PTM BFD */ /* Encode timers if this is a registration message. */ if (args->command != ZEBRA_BFD_DEST_DEREGISTER) { stream_putl(s, args->min_rx); @@ -500,23 +536,13 @@ int zclient_bfd_command(struct zclient *zc, struct bfd_session_arg *args) if (args->ifnamelen) stream_put(s, args->ifname, args->ifnamelen); } - - /* Send the C bit indicator. */ - stream_putc(s, args->cbit); - - /* `ptm-bfd` doesn't support profiles yet. */ -#if HAVE_BFDD > 0 - /* Send profile name if any. */ - stream_putc(s, args->profilelen); - if (args->profilelen) - stream_put(s, args->profile, args->profilelen); #endif /* HAVE_BFDD */ /* Finish the message by writing the size. */ stream_putw_at(s, 0, stream_get_endp(s)); /* Send message to zebra. */ - if (zclient_send_message(zc) == -1) { + if (zclient_send_message(zc) == ZCLIENT_SEND_FAILURE) { if (bfd_debug) zlog_debug("%s: zclient_send_message failed", __func__); return -1; diff --git a/lib/command.c b/lib/command.c index 7d335e1c36..87110157f6 100644 --- a/lib/command.c +++ b/lib/command.c @@ -154,7 +154,8 @@ static bool vty_check_node_for_xpath_decrement(enum node_type target_node, || node == BGP_IPV4M_NODE || node == BGP_IPV6M_NODE || node == BGP_VPNV4_NODE || node == BGP_VPNV6_NODE || node == BGP_EVPN_NODE || node == BGP_IPV4L_NODE - || node == BGP_IPV6L_NODE )) + || node == BGP_IPV6L_NODE || node == BGP_FLOWSPECV4_NODE + || node == BGP_FLOWSPECV6_NODE)) return false; return true; diff --git a/lib/command.h b/lib/command.h index bb007b0868..1b0504101c 100644 --- a/lib/command.h +++ b/lib/command.h @@ -530,7 +530,9 @@ extern int cmd_execute_command(vector, struct vty *, const struct cmd_element **, int); extern int cmd_execute_command_strict(vector, struct vty *, const struct cmd_element **); -extern void cmd_init(int); +extern void cmd_init(int terminal); +extern void cmd_init_config_callbacks(void (*start_config_cb)(void), + void (*end_config_cb)(void)); extern void cmd_terminate(void); extern void cmd_exit(struct vty *vty); extern int cmd_list_cmds(struct vty *vty, int do_permute); diff --git a/lib/command_parse.y b/lib/command_parse.y index 5dc19d2c9b..ba5225b702 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -492,11 +492,11 @@ terminate_graph (CMD_YYLTYPE *locp, struct parser_ctx *ctx, graph_new_node (ctx->graph, (void *)element, NULL); if (ctx->docstr && strlen (ctx->docstr) > 1) { - zlog_debug ("Excessive docstring while parsing '%s'", ctx->el->string); - zlog_debug ("----------"); + zlog_err ("Excessive docstring while parsing '%s'", ctx->el->string); + zlog_err ("----------"); while (ctx->docstr && ctx->docstr[1] != '\0') - zlog_debug ("%s", strsep(&ctx->docstr, "\n")); - zlog_debug ("----------\n"); + zlog_err ("%s", strsep(&ctx->docstr, "\n")); + zlog_err ("----------\n"); } graph_add_edge (finalnode, end_token_node); @@ -509,7 +509,7 @@ doc_next (struct parser_ctx *ctx) const char *piece = ctx->docstr ? strsep (&ctx->docstr, "\n") : ""; if (*piece == 0x03) { - zlog_debug ("Ran out of docstring while parsing '%s'", ctx->el->string); + zlog_err ("Ran out of docstring while parsing '%s'", ctx->el->string); piece = ""; } diff --git a/lib/ferr.c b/lib/ferr.c index 7b923da177..691da495cf 100644 --- a/lib/ferr.c +++ b/lib/ferr.c @@ -121,8 +121,12 @@ void log_ref_display(struct vty *vty, uint32_t code, bool json) if (code) { ref = log_ref_get(code); - if (!ref) + if (!ref) { + if (top) + json_object_free(top); + list_delete(&errlist); return; + } listnode_add(errlist, ref); } diff --git a/lib/lib_vty.c b/lib/lib_vty.c index 9c927ca4af..0cc25f24ed 100644 --- a/lib/lib_vty.c +++ b/lib/lib_vty.c @@ -212,6 +212,57 @@ DEFUN (frr_version, return CMD_SUCCESS; } +static struct call_back { + time_t readin_time; + + void (*start_config)(void); + void (*end_config)(void); +} callback; + + +DEFUN_HIDDEN (start_config, + start_config_cmd, + "start_configuration", + "The Beginning of Configuration\n") +{ + callback.readin_time = monotime(NULL); + + if (callback.start_config) + (*callback.start_config)(); + + return CMD_SUCCESS; +} + +DEFUN_HIDDEN (end_config, + end_config_cmd, + "end_configuration", + "The End of Configuration\n") +{ + time_t readin_time; + char readin_time_str[MONOTIME_STRLEN]; + + readin_time = monotime(NULL); + readin_time -= callback.readin_time; + + frrtime_to_interval(readin_time, readin_time_str, + sizeof(readin_time_str)); + + zlog_info("Configuration Read in Took: %s", readin_time_str); + + if (callback.end_config) + (*callback.end_config)(); + + return CMD_SUCCESS; +} + +void cmd_init_config_callbacks(void (*start_config_cb)(void), + void (*end_config_cb)(void)) +{ + callback.start_config = start_config_cb; + callback.end_config = end_config_cb; +} + + static void defaults_autocomplete(vector comps, struct cmd_token *token) { const char **p; @@ -234,6 +285,9 @@ void lib_cmd_init(void) install_element(VIEW_NODE, &show_memory_cmd); install_element(VIEW_NODE, &show_modules_cmd); + + install_element(CONFIG_NODE, &start_config_cmd); + install_element(CONFIG_NODE, &end_config_cmd); } /* Stats querying from users */ diff --git a/lib/libfrr.c b/lib/libfrr.c index 800596c563..8e7777a1a9 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -99,6 +99,7 @@ static void opt_extend(const struct optspec *os) #define OPTION_TCLI 1005 #define OPTION_DB_FILE 1006 #define OPTION_LOGGING 1007 +#define OPTION_LIMIT_FDS 1008 static const struct option lo_always[] = { {"help", no_argument, NULL, 'h'}, @@ -113,6 +114,7 @@ static const struct option lo_always[] = { {"log-level", required_argument, NULL, OPTION_LOGLEVEL}, {"tcli", no_argument, NULL, OPTION_TCLI}, {"command-log-always", no_argument, NULL, OPTION_LOGGING}, + {"limit-fds", required_argument, NULL, OPTION_LIMIT_FDS}, {NULL}}; static const struct optspec os_always = { "hvdM:F:N:", @@ -126,7 +128,8 @@ static const struct optspec os_always = { " --moduledir Override modules directory\n" " --log Set Logging to stdout, syslog, or file:<name>\n" " --log-level Set Logging Level to use, debug, info, warn, etc\n" - " --tcli Use transaction-based CLI\n", + " --tcli Use transaction-based CLI\n" + " --limit-fds Limit number of fds supported\n", lo_always}; @@ -552,6 +555,9 @@ static int frr_opt(int opt) case OPTION_LOGGING: di->log_always = true; break; + case OPTION_LIMIT_FDS: + di->limit_fds = strtoul(optarg, &err, 0); + break; default: return 1; } @@ -739,6 +745,11 @@ enum frr_cli_mode frr_get_cli_mode(void) return di ? di->cli_mode : FRR_CLI_CLASSIC; } +uint32_t frr_get_fd_limit(void) +{ + return di ? di->limit_fds : 0; +} + static int rcvd_signal = 0; static void rcv_signal(int signum) diff --git a/lib/libfrr.h b/lib/libfrr.h index ab72299206..2e4dcbe093 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -102,6 +102,9 @@ struct frr_daemon_info { size_t n_yang_modules; bool log_always; + + /* Optional upper limit on the number of fds used in select/poll */ + uint32_t limit_fds; }; /* execname is the daemon's executable (and pidfile and configfile) name, @@ -134,6 +137,7 @@ extern __attribute__((__noreturn__)) void frr_help_exit(int status); extern struct thread_master *frr_init(void); extern const char *frr_get_progname(void); extern enum frr_cli_mode frr_get_cli_mode(void); +uint32_t frr_get_fd_limit(void); DECLARE_HOOK(frr_late_init, (struct thread_master * tm), (tm)) DECLARE_HOOK(frr_very_late_init, (struct thread_master * tm), (tm)) @@ -455,7 +455,8 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_NEIGH_DISCOVER), DESC_ENTRY(ZEBRA_NHG_ADD), DESC_ENTRY(ZEBRA_NHG_DEL), - DESC_ENTRY(ZEBRA_NHG_NOTIFY_OWNER)}; + DESC_ENTRY(ZEBRA_NHG_NOTIFY_OWNER), + DESC_ENTRY(ZEBRA_ROUTE_NOTIFY_REQUEST)}; #undef DESC_ENTRY static const struct zebra_desc_table unknown = {0, "unknown", '?'}; diff --git a/lib/prefix.h b/lib/prefix.h index d2cabf3104..b7fdc26369 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -479,7 +479,7 @@ extern void apply_mask_ipv4(struct prefix_ipv4 *); #define PREFIX_COPY(DST, SRC) \ *((struct prefix *)(DST)) = *((const struct prefix *)(SRC)) #define PREFIX_COPY_IPV4(DST, SRC) \ - *((struct prefix_ipv4 *)(DST)) = *((const struct prefix_ipv4 *)(SRC)); + *((struct prefix_ipv4 *)(DST)) = *((const struct prefix_ipv4 *)(SRC)) extern int prefix_ipv4_any(const struct prefix_ipv4 *); extern void apply_classful_mask_ipv4(struct prefix_ipv4 *); @@ -499,7 +499,7 @@ extern int str2prefix_ipv6(const char *, struct prefix_ipv6 *); extern void apply_mask_ipv6(struct prefix_ipv6 *); #define PREFIX_COPY_IPV6(DST, SRC) \ - *((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC)); + *((struct prefix_ipv6 *)(DST)) = *((const struct prefix_ipv6 *)(SRC)) extern int ip6_masklen(struct in6_addr); extern void masklen2ip6(const int, struct in6_addr *); diff --git a/lib/route_types.pl b/lib/route_types.pl index 39af8d0d56..759e9b4729 100755 --- a/lib/route_types.pl +++ b/lib/route_types.pl @@ -29,6 +29,7 @@ ## use strict; +use Getopt::Long; # input processing # @@ -37,6 +38,11 @@ my %protodetail; my %daemons; +my @enabled; + +GetOptions ("enabled=s" => \@enabled); +@enabled = split(/,/,join(',',@enabled)); + while (<STDIN>) { # skip comments and empty lines next if (/^\s*(#|$)/); @@ -56,7 +62,7 @@ while (<STDIN>) { # else: 8-field line my @f = split(/,/, $_); - unless (@f == 8 || @f == 9) { + unless (@f == 9 || @f == 10) { die "invalid input on route_types line $.\n"; } @@ -74,7 +80,8 @@ while (<STDIN>) { "ipv6" => int($f[5]), "redist" => int($f[6]), "shorthelp" => $f[7], - "restrict2" => $f[8], + "enabled" => $f[8], + "restrict2" => $f[9], }; push @protos, $proto; $daemons{$f[2]} = { @@ -109,6 +116,7 @@ sub codelist { my (@lines) = (); my $str = " \"Codes: "; for my $p (@protos) { + next unless (grep $_ eq $protodetail{$p}->{"enabled"}, @enabled); my $s = sprintf("%s - %s, ", $protodetail{$p}->{"char"}, $protodetail{$p}->{"shorthelp"}); @@ -141,6 +149,7 @@ sub collect { next if ($protodetail{$p}->{"restrict2"} ne "" && $protodetail{$p}->{"restrict2"} ne $daemon); next if ($protodetail{$p}->{"redist"} eq 0); + next unless (grep $_ eq $protodetail{$p}->{"enabled"}, @enabled); next unless (($ipv4 && $protodetail{$p}->{"ipv4"}) || ($ipv6 && $protodetail{$p}->{"ipv6"})); push @names, $protodetail{$p}->{"cname"}; diff --git a/lib/route_types.txt b/lib/route_types.txt index 37cc2fb590..c48391545d 100644 --- a/lib/route_types.txt +++ b/lib/route_types.txt @@ -45,48 +45,48 @@ # If you add a new routing protocol here, make sure you also update # meta_queue_map in zebra_rib.c # -## type cname daemon C 4 6 Redist short help Restrictions -ZEBRA_ROUTE_SYSTEM, system, NULL, 'X', 0, 0, 0, "Reserved" -ZEBRA_ROUTE_KERNEL, kernel, zebra, 'K', 1, 1, 1, "kernel route" -ZEBRA_ROUTE_CONNECT, connected, zebra, 'C', 1, 1, 1, "connected" -ZEBRA_ROUTE_STATIC, static, zebra, 'S', 1, 1, 1, "static" -ZEBRA_ROUTE_RIP, rip, ripd, 'R', 1, 0, 1, "RIP" -ZEBRA_ROUTE_RIPNG, ripng, ripngd, 'R', 0, 1, 1, "RIPng" -ZEBRA_ROUTE_OSPF, ospf, ospfd, 'O', 1, 0, 1, "OSPF" -ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, 1, "OSPFv3" -ZEBRA_ROUTE_ISIS, isis, isisd, 'I', 1, 1, 1, "IS-IS" -ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, 1, "BGP" -ZEBRA_ROUTE_PIM, pim, pimd, 'P', 0, 0, 0, "PIM" -ZEBRA_ROUTE_EIGRP, eigrp, eigrpd, 'E', 1, 0, 1, "EIGRP" -ZEBRA_ROUTE_NHRP, nhrp, nhrpd, 'N', 1, 1, 1, "NHRP" +## type cname daemon C 4 6 Redist short help Enabled Restrictions +ZEBRA_ROUTE_SYSTEM, system, NULL, 'X', 0, 0, 0, "Reserved", none +ZEBRA_ROUTE_KERNEL, kernel, zebra, 'K', 1, 1, 1, "kernel route", zebra +ZEBRA_ROUTE_CONNECT, connected, zebra, 'C', 1, 1, 1, "connected", zebra +ZEBRA_ROUTE_STATIC, static, zebra, 'S', 1, 1, 1, "static", zebra +ZEBRA_ROUTE_RIP, rip, ripd, 'R', 1, 0, 1, "RIP", ripd +ZEBRA_ROUTE_RIPNG, ripng, ripngd, 'R', 0, 1, 1, "RIPng", ripngd +ZEBRA_ROUTE_OSPF, ospf, ospfd, 'O', 1, 0, 1, "OSPF", ospfd +ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, 1, "OSPFv3", ospf6d +ZEBRA_ROUTE_ISIS, isis, isisd, 'I', 1, 1, 1, "IS-IS", isisd +ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, 1, "BGP", bgpd +ZEBRA_ROUTE_PIM, pim, pimd, 'P', 0, 0, 0, "PIM", pimd +ZEBRA_ROUTE_EIGRP, eigrp, eigrpd, 'E', 1, 0, 1, "EIGRP", eigrpd +ZEBRA_ROUTE_NHRP, nhrp, nhrpd, 'N', 1, 1, 1, "NHRP", nhrpd # HSLS and OLSR both are AFI independent (so: 1, 1), however # we want to disable for them for general Quagga distribution. # This at least makes it trivial for users of these protocols # to 'switch on' redist support (direct numeric entry remaining # possible). -ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, 0, "HSLS" -ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 0, 0, 0, "OLSR" -ZEBRA_ROUTE_TABLE, table, zebra, 'T', 1, 1, 1, "Table" -ZEBRA_ROUTE_LDP, ldp, ldpd, 'L', 0, 0, 0, "LDP" +ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, 0, "HSLS", hslsd +ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 0, 0, 0, "OLSR", olsrd +ZEBRA_ROUTE_TABLE, table, zebra, 'T', 1, 1, 1, "Table", zebra +ZEBRA_ROUTE_LDP, ldp, ldpd, 'L', 0, 0, 0, "LDP", ldpd #vnc when sent to zebra -ZEBRA_ROUTE_VNC, vnc, NULL, 'v', 1, 1, 1, "VNC" +ZEBRA_ROUTE_VNC, vnc, NULL, 'v', 1, 1, 1, "VNC", bgpd-vnc # vnc when sent to bgp -ZEBRA_ROUTE_VNC_DIRECT, vnc-direct,NULL, 'V', 1, 1, 1, "VNC-Direct", bgpd +ZEBRA_ROUTE_VNC_DIRECT, vnc-direct,NULL, 'V', 1, 1, 1, "VNC-Direct", bgpd-vnc, bgpd # vnc when sent to bgp (resolve NVE mode) -ZEBRA_ROUTE_VNC_DIRECT_RH, vnc-rn, NULL, 'V', 0, 0, 0, "VNC-RN" +ZEBRA_ROUTE_VNC_DIRECT_RH, vnc-rn, NULL, 'V', 0, 0, 0, "VNC-RN", bgpd-vnc # bgp unicast -> vnc -ZEBRA_ROUTE_BGP_DIRECT, bgp-direct, NULL, 'b', 0, 0, 0, "BGP-Direct" +ZEBRA_ROUTE_BGP_DIRECT, bgp-direct, NULL, 'b', 0, 0, 0, "BGP-Direct", bgpd-vnc # bgp unicast -> vnc -ZEBRA_ROUTE_BGP_DIRECT_EXT, bgp-direct-to-nve-groups, NULL, 'e', 0, 0, 0, "BGP2VNC" -ZEBRA_ROUTE_BABEL, babel, babeld, 'A', 1, 1, 1, "Babel" -ZEBRA_ROUTE_SHARP, sharp, sharpd, 'D', 1, 1, 1, "SHARP" -ZEBRA_ROUTE_PBR, pbr, pbrd, 'F', 1, 1, 0, "PBR" -ZEBRA_ROUTE_BFD, bfd, bfdd, '-', 0, 0, 0, "BFD" -ZEBRA_ROUTE_OPENFABRIC, openfabric, fabricd, 'f', 1, 1, 1, "OpenFabric" -ZEBRA_ROUTE_VRRP, vrrp, vrrpd, '-', 0, 0, 0, "VRRP" -ZEBRA_ROUTE_NHG, zebra, none, '-', 0, 0, 0, "Nexthop Group" -ZEBRA_ROUTE_SRTE, srte, none, '-', 0, 0, 0, "SR-TE" -ZEBRA_ROUTE_ALL, wildcard, none, '-', 0, 0, 0, "-" +ZEBRA_ROUTE_BGP_DIRECT_EXT, bgp-direct-to-nve-groups, NULL, 'e', 0, 0, 0, "BGP2VNC", bgpd-vnc +ZEBRA_ROUTE_BABEL, babel, babeld, 'A', 1, 1, 1, "Babel", babeld +ZEBRA_ROUTE_SHARP, sharp, sharpd, 'D', 1, 1, 1, "SHARP", sharpd +ZEBRA_ROUTE_PBR, pbr, pbrd, 'F', 1, 1, 0, "PBR", pbrd +ZEBRA_ROUTE_BFD, bfd, bfdd, '-', 0, 0, 0, "BFD", bfdd +ZEBRA_ROUTE_OPENFABRIC, openfabric, fabricd, 'f', 1, 1, 1, "OpenFabric", fabricd +ZEBRA_ROUTE_VRRP, vrrp, vrrpd, '-', 0, 0, 0, "VRRP", vrrpd +ZEBRA_ROUTE_NHG, zebra, none, '-', 0, 0, 0, "Nexthop Group", none +ZEBRA_ROUTE_SRTE, srte, none, '-', 0, 0, 0, "SR-TE", none +ZEBRA_ROUTE_ALL, wildcard, none, '-', 0, 0, 0, "-", none ## help strings diff --git a/lib/routemap.c b/lib/routemap.c index 0eb54a4794..004beb3628 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1530,8 +1530,7 @@ enum rmap_compile_rets route_map_delete_set(struct route_map_index *index, static enum route_map_cmd_result_t route_map_apply_match(struct route_map_rule_list *match_list, - const struct prefix *prefix, route_map_object_t type, - void *object) + const struct prefix *prefix, void *object) { enum route_map_cmd_result_t ret = RMAP_NOMATCH; struct route_map_rule *match; @@ -1555,7 +1554,7 @@ route_map_apply_match(struct route_map_rule_list *match_list, * If all result in NOOP, end-result is NOOP. */ ret = (*match->cmd->func_apply)(match->value, prefix, - type, object); + object); /* * If the consolidated result of func_apply is: @@ -1647,9 +1646,10 @@ static struct list *route_map_get_index_list(struct route_node **rn, /* * This function returns the route-map index that best matches the prefix. */ -static struct route_map_index * -route_map_get_index(struct route_map *map, const struct prefix *prefix, - route_map_object_t type, void *object, uint8_t *match_ret) +static struct route_map_index *route_map_get_index(struct route_map *map, + const struct prefix *prefix, + void *object, + uint8_t *match_ret) { int ret = 0; struct list *candidate_rmap_list = NULL; @@ -1695,7 +1695,7 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix, break; ret = route_map_apply_match(&index->match_list, prefix, - type, object); + object); if (ret == RMAP_MATCH) { *match_ret = ret; @@ -2369,8 +2369,7 @@ void route_map_notify_pentry_dependencies(const char *affected_name, We need to make sure our route-map processing matches the above */ route_map_result_t route_map_apply(struct route_map *map, - const struct prefix *prefix, - route_map_object_t type, void *object) + const struct prefix *prefix, void *object) { static int recursion = 0; enum route_map_cmd_result_t match_ret = RMAP_NOMATCH; @@ -2397,7 +2396,7 @@ route_map_result_t route_map_apply(struct route_map *map, if ((!map->optimization_disabled) && (map->ipv4_prefix_table || map->ipv6_prefix_table)) { - index = route_map_get_index(map, prefix, type, object, + index = route_map_get_index(map, prefix, object, (uint8_t *)&match_ret); if (index) { if (rmap_debug) @@ -2431,7 +2430,7 @@ route_map_result_t route_map_apply(struct route_map *map, index->applied++; /* Apply this index. */ match_ret = route_map_apply_match(&index->match_list, - prefix, type, object); + prefix, object); if (rmap_debug) { zlog_debug( "Route-map: %s, sequence: %d, prefix: %pFX, result: %s", @@ -2489,9 +2488,8 @@ route_map_result_t route_map_apply(struct route_map *map, * set succeeded or not. So, ignore * return code. */ - (void) (*set->cmd->func_apply)( - set->value, prefix, type, - object); + (void)(*set->cmd->func_apply)( + set->value, prefix, object); /* Call another route-map if available */ if (index->nextrm) { @@ -2504,8 +2502,7 @@ route_map_result_t route_map_apply(struct route_map *map, { recursion++; ret = route_map_apply( - nextrm, prefix, type, - object); + nextrm, prefix, object); recursion--; } diff --git a/lib/routemap.h b/lib/routemap.h index 64da4b87ef..3e208c8cb5 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -68,17 +68,6 @@ enum route_map_cmd_result_t { RMAP_ERROR }; - -typedef enum { - RMAP_RIP, - RMAP_RIPNG, - RMAP_OSPF, - RMAP_OSPF6, - RMAP_BGP, - RMAP_ZEBRA, - RMAP_ISIS, -} route_map_object_t; - typedef enum { RMAP_EXIT, RMAP_GOTO, RMAP_NEXT } route_map_end_t; typedef enum { @@ -117,7 +106,6 @@ struct route_map_rule_cmd { /* Function for value set or match. */ enum route_map_cmd_result_t (*func_apply)(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object); /* Compile argument and return result as void *. */ @@ -299,7 +287,6 @@ struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *nam /* Apply route map to the object. */ extern route_map_result_t route_map_apply(struct route_map *map, const struct prefix *prefix, - route_map_object_t object_type, void *object); extern void route_map_add_hook(void (*func)(const char *)); diff --git a/lib/sigevent.c b/lib/sigevent.c index 04fcc814ef..8d583096f6 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -63,6 +63,33 @@ static void quagga_signal_handler(int signo) sigmaster.caught = 1; } +/* + * Check whether any signals have been received and are pending. This is done + * with the application's key signals blocked. The complete set of signals + * is returned in 'setp', so the caller can restore them when appropriate. + * If there are pending signals, returns 'true', 'false' otherwise. + */ +bool frr_sigevent_check(sigset_t *setp) +{ + sigset_t blocked; + int i; + bool ret; + + sigemptyset(setp); + sigemptyset(&blocked); + + /* Set up mask of application's signals */ + for (i = 0; i < sigmaster.sigc; i++) + sigaddset(&blocked, sigmaster.signals[i].signal); + + pthread_sigmask(SIG_BLOCK, &blocked, setp); + + /* Now that the application's signals are blocked, test. */ + ret = (sigmaster.caught != 0); + + return ret; +} + /* check if signals have been caught and run appropriate handlers */ int quagga_sigevent_process(void) { @@ -223,6 +250,8 @@ core_handler(int signo, siginfo_t *siginfo, void *context) /* dump memory stats on core */ log_memstats(stderr, "core_handler"); + + zlog_tls_buffer_fini(); abort(); } diff --git a/lib/sigevent.h b/lib/sigevent.h index a0ad88fcaa..4a39b22889 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -48,6 +48,15 @@ struct quagga_signal_t { extern void signal_init(struct thread_master *m, int sigc, struct quagga_signal_t *signals); + +/* + * Check whether any signals have been received and are pending. This is done + * with the application's key signals blocked. The complete set of signals + * is returned in 'setp', so the caller can restore them when appropriate. + * If there are pending signals, returns 'true', 'false' otherwise. + */ +bool frr_sigevent_check(sigset_t *setp); + /* check whether there are signals to handle, process any found */ extern int quagga_sigevent_process(void); diff --git a/lib/skiplist.c b/lib/skiplist.c index 2bef18f525..b79dfa6772 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -74,7 +74,6 @@ DEFINE_MTYPE_STATIC(LIB, SKIP_LIST_NODE, "Skip Node") static int randomsLeft; static int randomBits; -static struct skiplist *skiplist_last_created; /* debugging hack */ #if 1 #define CHECKLAST(sl) \ @@ -150,8 +149,6 @@ struct skiplist *skiplist_new(int flags, if (del) new->del = del; - skiplist_last_created = new; /* debug */ - return new; } @@ -586,7 +583,8 @@ void skiplist_debug(struct vty *vty, struct skiplist *l) int i; if (!l) - l = skiplist_last_created; + return; + vty_out(vty, "Skiplist %p has max level %d\n", l, l->level); for (i = l->level; i >= 0; --i) vty_out(vty, " @%d: %ld\n", i, diff --git a/lib/subdir.am b/lib/subdir.am index ed3c30799d..038282a99b 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -470,8 +470,62 @@ lib/clippy-command_parse.$(OBJEXT): lib/command_lex.h lib/lib_clippy-command_lex.$(OBJEXT): lib/command_parse.h lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h +rt_enabled = + +if BABELD +rt_enabled += --enabled babeld +endif +if BFDD +rt_enabled += --enabled bfdd +endif +if BGPD +rt_enabled += --enabled bgpd +if ENABLE_BGP_VNC +rt_enabled += --enabled bgpd-vnc +endif +endif +if EIGRPD +rt_enabled += --enabled eigrpd +endif +if ISISD +rt_enabled += --enabled isisd +endif +if FABRICD +rt_enabled += --enabled fabricd +endif +if LDPD +rt_enabled += --enabled ldpd +endif +if NHRPD +rt_enabled += --enabled nhrpd +endif +if OSPFD +rt_enabled += --enabled ospfd +endif +if OSPF6D +rt_enabled += --enabled ospf6d +endif +if PBRD +rt_enabled += --enabled pbrd +endif +if PIMD +rt_enabled += --enabled pimd +endif +if RIPD +rt_enabled += --enabled ripd +endif +if RIPNGD +rt_enabled += --enabled ripngd +endif +if SHARPD +rt_enabled += --enabled sharpd +endif +if ZEBRA +rt_enabled += --enabled zebra +endif + lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl - $(PERL) $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@ + $(PERL) $(top_srcdir)/lib/route_types.pl $(rt_enabled) < $(top_srcdir)/lib/route_types.txt > $@ DISTCLEANFILES += lib/route_types.h if GIT_VERSION diff --git a/lib/thread.c b/lib/thread.c index 1765de9573..c886058355 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -36,6 +36,7 @@ #include "frr_pthread.h" #include "lib_errors.h" #include "libfrr_trace.h" +#include "libfrr.h" DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread") DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master") @@ -115,10 +116,9 @@ static void vty_out_cpu_thread_history(struct vty *vty, struct cpu_thread_history *a) { vty_out(vty, "%5zu %10zu.%03zu %9zu %8zu %9zu %8zu %9zu", - (size_t)a->total_active, a->cpu.total / 1000, - a->cpu.total % 1000, (size_t)a->total_calls, - (size_t)(a->cpu.total / a->total_calls), a->cpu.max, - (size_t)(a->real.total / a->total_calls), a->real.max); + a->total_active, a->cpu.total / 1000, a->cpu.total % 1000, + a->total_calls, (a->cpu.total / a->total_calls), a->cpu.max, + (a->real.total / a->total_calls), a->real.max); vty_out(vty, " %c%c%c%c%c %s\n", a->types & (1 << THREAD_READ) ? 'R' : ' ', a->types & (1 << THREAD_WRITE) ? 'W' : ' ', @@ -443,8 +443,14 @@ struct thread_master *thread_master_create(const char *name) rv->name = XSTRDUP(MTYPE_THREAD_MASTER, name); /* Initialize I/O task data structures */ - getrlimit(RLIMIT_NOFILE, &limit); - rv->fd_limit = (int)limit.rlim_cur; + + /* Use configured limit if present, ulimit otherwise. */ + rv->fd_limit = frr_get_fd_limit(); + if (rv->fd_limit == 0) { + getrlimit(RLIMIT_NOFILE, &limit); + rv->fd_limit = (int)limit.rlim_cur; + } + rv->read = XCALLOC(MTYPE_THREAD_POLL, sizeof(struct thread *) * rv->fd_limit); @@ -728,9 +734,13 @@ static void thread_free(struct thread_master *master, struct thread *thread) XFREE(MTYPE_THREAD, thread); } -static int fd_poll(struct thread_master *m, struct pollfd *pfds, nfds_t pfdsize, - nfds_t count, const struct timeval *timer_wait) +static int fd_poll(struct thread_master *m, const struct timeval *timer_wait, + bool *eintr_p) { + sigset_t origsigs; + unsigned char trash[64]; + nfds_t count = m->handler.copycount; + /* * If timer_wait is null here, that means poll() should block * indefinitely, unless the thread_master has overridden it by setting @@ -761,15 +771,58 @@ static int fd_poll(struct thread_master *m, struct pollfd *pfds, nfds_t pfdsize, rcu_assert_read_unlocked(); /* add poll pipe poker */ - assert(count + 1 < pfdsize); - pfds[count].fd = m->io_pipe[0]; - pfds[count].events = POLLIN; - pfds[count].revents = 0x00; + assert(count + 1 < m->handler.pfdsize); + m->handler.copy[count].fd = m->io_pipe[0]; + m->handler.copy[count].events = POLLIN; + m->handler.copy[count].revents = 0x00; + + /* We need to deal with a signal-handling race here: we + * don't want to miss a crucial signal, such as SIGTERM or SIGINT, + * that may arrive just before we enter poll(). We will block the + * key signals, then check whether any have arrived - if so, we return + * before calling poll(). If not, we'll re-enable the signals + * in the ppoll() call. + */ - num = poll(pfds, count + 1, timeout); + sigemptyset(&origsigs); + if (m->handle_signals) { + /* Main pthread that handles the app signals */ + if (frr_sigevent_check(&origsigs)) { + /* Signal to process - restore signal mask and return */ + pthread_sigmask(SIG_SETMASK, &origsigs, NULL); + num = -1; + *eintr_p = true; + goto done; + } + } else { + /* Don't make any changes for the non-main pthreads */ + pthread_sigmask(SIG_SETMASK, NULL, &origsigs); + } - unsigned char trash[64]; - if (num > 0 && pfds[count].revents != 0 && num--) +#if defined(HAVE_PPOLL) + struct timespec ts, *tsp; + + if (timeout >= 0) { + ts.tv_sec = timeout / 1000; + ts.tv_nsec = (timeout % 1000) * 1000000; + tsp = &ts; + } else + tsp = NULL; + + num = ppoll(m->handler.copy, count + 1, tsp, &origsigs); + pthread_sigmask(SIG_SETMASK, &origsigs, NULL); +#else + /* Not ideal - there is a race after we restore the signal mask */ + pthread_sigmask(SIG_SETMASK, &origsigs, NULL); + num = poll(m->handler.copy, count + 1, timeout); +#endif + +done: + + if (num < 0 && errno == EINTR) + *eintr_p = true; + + if (num > 0 && m->handler.copy[count].revents != 0 && num--) while (read(m->io_pipe[0], &trash, sizeof(trash)) > 0) ; @@ -1186,9 +1239,9 @@ void thread_cancel(struct thread **thread) master = (*thread)->master; - frrtrace(9, frr_libfrr, thread_cancel, master, thread->funcname, - thread->schedfrom, thread->schedfrom_line, NULL, thread->u.fd, - thread->u.val, thread->arg, thread->u.sands.tv_sec); + frrtrace(9, frr_libfrr, thread_cancel, master, (*thread)->funcname, + (*thread)->schedfrom, (*thread)->schedfrom_line, NULL, (*thread)->u.fd, + (*thread)->u.val, (*thread)->arg, (*thread)->u.sands.tv_sec); assert(master->owner == pthread_self()); @@ -1434,7 +1487,7 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) struct timeval zerotime = {0, 0}; struct timeval tv; struct timeval *tw = NULL; - + bool eintr_p = false; int num = 0; do { @@ -1506,14 +1559,14 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) pthread_mutex_unlock(&m->mtx); { - num = fd_poll(m, m->handler.copy, m->handler.pfdsize, - m->handler.copycount, tw); + eintr_p = false; + num = fd_poll(m, tw, &eintr_p); } pthread_mutex_lock(&m->mtx); /* Handle any errors received in poll() */ if (num < 0) { - if (errno == EINTR) { + if (eintr_p) { pthread_mutex_unlock(&m->mtx); /* loop around to signal handler */ continue; @@ -1703,3 +1756,49 @@ void funcname_thread_execute(struct thread_master *m, /* Give back or free thread. */ thread_add_unuse(m, thread); } + +/* Debug signal mask - if 'sigs' is NULL, use current effective mask. */ +void debug_signals(const sigset_t *sigs) +{ + int i, found; + sigset_t tmpsigs; + char buf[300]; + + /* + * We're only looking at the non-realtime signals here, so we need + * some limit value. Platform differences mean at some point we just + * need to pick a reasonable value. + */ +#if defined SIGRTMIN +# define LAST_SIGNAL SIGRTMIN +#else +# define LAST_SIGNAL 32 +#endif + + + if (sigs == NULL) { + sigemptyset(&tmpsigs); + pthread_sigmask(SIG_BLOCK, NULL, &tmpsigs); + sigs = &tmpsigs; + } + + found = 0; + buf[0] = '\0'; + + for (i = 0; i < LAST_SIGNAL; i++) { + char tmp[20]; + + if (sigismember(sigs, i) > 0) { + if (found > 0) + strlcat(buf, ",", sizeof(buf)); + snprintf(tmp, sizeof(tmp), "%d", i); + strlcat(buf, tmp, sizeof(buf)); + found++; + } + } + + if (found == 0) + snprintf(buf, sizeof(buf), "<none>"); + + zlog_debug("%s: %s", __func__, buf); +} diff --git a/lib/thread.h b/lib/thread.h index e2b7763c51..eb1b107e7b 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -115,8 +115,8 @@ struct thread { struct cpu_thread_history { int (*func)(struct thread *); - atomic_uint_fast32_t total_calls; - atomic_uint_fast32_t total_active; + atomic_size_t total_calls; + atomic_size_t total_active; struct time_stats { atomic_size_t total, max; } real; @@ -230,6 +230,9 @@ extern pthread_key_t thread_current; extern char *thread_timer_to_hhmmss(char *buf, int buf_size, struct thread *t_timer); +/* Debug signal mask */ +void debug_signals(const sigset_t *sigs); + #ifdef __cplusplus } #endif @@ -43,7 +43,7 @@ enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX }; #endif #define VRF_NAMSIZ 36 -#define NS_NAMSIZ 16 +#define NS_NAMSIZ 36 /* * The command strings @@ -1810,7 +1810,12 @@ static int vty_accept(struct thread *thread) set_nonblocking(vty_sock); set_cloexec(vty_sock); - sockunion2hostprefix(&su, &p); + if (!sockunion2hostprefix(&su, &p)) { + close(vty_sock); + zlog_info("Vty unable to convert prefix from sockunion %s", + sockunion2str(&su, buf, SU_ADDRSTRLEN)); + return -1; + } /* VTY's accesslist apply. */ if (p.family == AF_INET && vty_accesslist_name) { diff --git a/lib/yang.c b/lib/yang.c index c59cb642f0..22fe938e4c 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -772,8 +772,7 @@ const struct lyd_node *yang_dnode_get_parent(const struct lyd_node *dnode, return NULL; } -/* API to check if the given node is last node in the list */ -static bool yang_is_last_list_dnode(const struct lyd_node *dnode) +bool yang_is_last_list_dnode(const struct lyd_node *dnode) { return (((dnode->next == NULL) || (dnode->next @@ -785,8 +784,7 @@ static bool yang_is_last_list_dnode(const struct lyd_node *dnode) != 0))); } -/* API to check if the given node is last node in the data tree level */ -static bool yang_is_last_level_dnode(const struct lyd_node *dnode) +bool yang_is_last_level_dnode(const struct lyd_node *dnode) { const struct lyd_node *parent; const struct lys_node_list *snode; diff --git a/lib/yang.h b/lib/yang.h index 0cd6a4a6f2..b8bf07ee7e 100644 --- a/lib/yang.h +++ b/lib/yang.h @@ -587,6 +587,11 @@ extern uint32_t yang_get_list_elements_count(const struct lyd_node *node); /* To get the immediate child of a dnode */ const struct lyd_node *yang_dnode_get_child(const struct lyd_node *dnode); +/* API to check if the given node is last node in the list */ +bool yang_is_last_list_dnode(const struct lyd_node *dnode); + +/* API to check if the given node is last node in the data tree level */ +bool yang_is_last_level_dnode(const struct lyd_node *dnode); #ifdef __cplusplus } diff --git a/lib/yang_wrappers.c b/lib/yang_wrappers.c index 4c658c1bfb..98f8fea0fe 100644 --- a/lib/yang_wrappers.c +++ b/lib/yang_wrappers.c @@ -1236,6 +1236,10 @@ const char *yang_afi_safi_value2identity(afi_t afi, safi_t safi) return "frr-routing:ipv4-labeled-unicast"; if (afi == AFI_IP6 && safi == SAFI_LABELED_UNICAST) return "frr-routing:ipv6-labeled-unicast"; + if (afi == AFI_IP && safi == SAFI_FLOWSPEC) + return "frr-routing:ipv4-flowspec"; + if (afi == AFI_IP6 && safi == SAFI_FLOWSPEC) + return "frr-routing:ipv6-flowspec"; return NULL; } @@ -1269,6 +1273,12 @@ void yang_afi_safi_identity2value(const char *key, afi_t *afi, safi_t *safi) } else if (strmatch(key, "frr-routing:l2vpn-evpn")) { *afi = AFI_L2VPN; *safi = SAFI_EVPN; + } else if (strmatch(key, "frr-routing:ipv4-flowspec")) { + *afi = AFI_IP; + *safi = SAFI_FLOWSPEC; + } else if (strmatch(key, "frr-routing:ipv6-flowspec")) { + *afi = AFI_IP6; + *safi = SAFI_FLOWSPEC; } else { *afi = AFI_UNSPEC; *safi = SAFI_UNSPEC; diff --git a/lib/zclient.c b/lib/zclient.c index d0144279e5..053014f86d 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -249,12 +249,12 @@ int zclient_socket_connect(struct zclient *zclient) return sock; } -static int zclient_failed(struct zclient *zclient) +static enum zclient_send_status zclient_failed(struct zclient *zclient) { zclient->fail++; zclient_stop(zclient); zclient_event(ZCLIENT_CONNECT, zclient); - return -1; + return ZCLIENT_SEND_FAILURE; } static int zclient_flush_data(struct thread *thread) @@ -277,15 +277,23 @@ static int zclient_flush_data(struct thread *thread) zclient->sock, &zclient->t_write); break; case BUFFER_EMPTY: + if (zclient->zebra_buffer_write_ready) + (*zclient->zebra_buffer_write_ready)(); break; } return 0; } -int zclient_send_message(struct zclient *zclient) +/* + * Returns: + * ZCLIENT_SEND_FAILED - is a failure + * ZCLIENT_SEND_SUCCESS - means we sent data to zebra + * ZCLIENT_SEND_BUFFERED - means we are buffering + */ +enum zclient_send_status zclient_send_message(struct zclient *zclient) { if (zclient->sock < 0) - return -1; + return ZCLIENT_SEND_FAILURE; switch (buffer_write(zclient->wb, zclient->sock, STREAM_DATA(zclient->obuf), stream_get_endp(zclient->obuf))) { @@ -296,13 +304,15 @@ int zclient_send_message(struct zclient *zclient) return zclient_failed(zclient); case BUFFER_EMPTY: THREAD_OFF(zclient->t_write); - break; + return ZCLIENT_SEND_SUCCESS; case BUFFER_PENDING: thread_add_write(zclient->master, zclient_flush_data, zclient, zclient->sock, &zclient->t_write); - break; + return ZCLIENT_SEND_BUFFERED; } - return 0; + + /* should not get here */ + return ZCLIENT_SEND_SUCCESS; } /* @@ -362,8 +372,8 @@ stream_failure: } /* Send simple Zebra message. */ -static int zebra_message_send(struct zclient *zclient, int command, - vrf_id_t vrf_id) +static enum zclient_send_status zebra_message_send(struct zclient *zclient, + int command, vrf_id_t vrf_id) { struct stream *s; @@ -377,7 +387,7 @@ static int zebra_message_send(struct zclient *zclient, int command, return zclient_send_message(zclient); } -int zclient_send_hello(struct zclient *zclient) +enum zclient_send_status zclient_send_hello(struct zclient *zclient) { struct stream *s; @@ -403,11 +413,13 @@ int zclient_send_hello(struct zclient *zclient) return zclient_send_message(zclient); } - return 0; + return ZCLIENT_SEND_SUCCESS; } -void zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi, - mpls_label_t label, enum lsp_types_t ltype) +enum zclient_send_status zclient_send_vrf_label(struct zclient *zclient, + vrf_id_t vrf_id, afi_t afi, + mpls_label_t label, + enum lsp_types_t ltype) { struct stream *s; @@ -419,7 +431,7 @@ void zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi, stream_putc(s, afi); stream_putc(s, ltype); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(zclient); + return zclient_send_message(zclient); } /* Send register requests to zebra daemon for the information in a VRF. */ @@ -557,9 +569,10 @@ void zclient_send_dereg_requests(struct zclient *zclient, vrf_id_t vrf_id) } } -int zclient_send_router_id_update(struct zclient *zclient, - zebra_message_types_t type, afi_t afi, - vrf_id_t vrf_id) +enum zclient_send_status +zclient_send_router_id_update(struct zclient *zclient, + zebra_message_types_t type, afi_t afi, + vrf_id_t vrf_id) { struct stream *s = zclient->obuf; stream_reset(s); @@ -570,15 +583,16 @@ int zclient_send_router_id_update(struct zclient *zclient, } /* Send request to zebra daemon to start or stop RA. */ -void zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id, - struct interface *ifp, int enable, - int ra_interval) +enum zclient_send_status +zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id, + struct interface *ifp, int enable, + int ra_interval) { struct stream *s; /* If not connected to the zebra yet. */ if (zclient->sock < 0) - return; + return ZCLIENT_SEND_FAILURE; /* Form and send message. */ s = zclient->obuf; @@ -594,16 +608,17 @@ void zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id, stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(zclient); + return zclient_send_message(zclient); } -int zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id, - struct interface *ifp, bool down) +enum zclient_send_status +zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id, + struct interface *ifp, bool down) { struct stream *s; if (zclient->sock < 0) - return -1; + return ZCLIENT_SEND_FAILURE; s = zclient->obuf; stream_reset(s); @@ -611,9 +626,7 @@ int zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id, stream_putl(s, ifp->ifindex); stream_putc(s, !!down); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(zclient); - - return 0; + return zclient_send_message(zclient); } /* Make connection to zebra daemon. */ @@ -712,9 +725,9 @@ static int zclient_connect(struct thread *t) return zclient_start(zclient); } -int zclient_send_rnh(struct zclient *zclient, int command, - const struct prefix *p, bool exact_match, - vrf_id_t vrf_id) +enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command, + const struct prefix *p, + bool exact_match, vrf_id_t vrf_id) { struct stream *s; @@ -750,45 +763,10 @@ int zclient_send_rnh(struct zclient *zclient, int command, * The corresponding read ("xdr_decode") function on the server * side is zapi_route_decode(). * - * 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Length (2) | Command | Route Type | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | ZEBRA Flags | Message Flags | Prefix length | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Destination IPv4 Prefix for route | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Nexthop count | - * +-+-+-+-+-+-+-+-+ - * - * - * A number of IPv4 nexthop(s) or nexthop interface index(es) are then - * described, as per the Nexthop count. Each nexthop described as: - * - * +-+-+-+-+-+-+-+-+ - * | Nexthop Type | Set to one of ZEBRA_NEXTHOP_* - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | IPv4 Nexthop address or Interface Index number | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * Alternatively, if the route is a blackhole route, then Nexthop count - * is set to 1 and a nexthop of type NEXTHOP_TYPE_BLACKHOLE is the sole - * nexthop. - * - * The original struct zapi_route_*() infrastructure was built around - * the traditional (32-bit "gate OR ifindex") nexthop data unit. - * A special encoding can be used to feed onlink (64-bit "gate AND ifindex") - * nexthops into zapi_route_encode() using the same zapi_route structure. - * This is done by setting zapi_route fields as follows: - * - .message |= ZAPI_MESSAGE_NEXTHOP | ZAPI_MESSAGE_ONLINK - * - .nexthop_num == .ifindex_num - * - .nexthop and .ifindex are filled with gate and ifindex parts of - * each compound nexthop, both in the same order - * * If ZAPI_MESSAGE_DISTANCE is set, the distance value is written as a 1 * byte value. * - * If ZAPI_MESSAGE_METRIC is set, the metric value is written as an 8 + * If ZAPI_MESSAGE_METRIC is set, the metric value is written as a 4 * byte value. * * If ZAPI_MESSAGE_TAG is set, the tag value is written as a 4 byte value @@ -797,11 +775,11 @@ int zclient_send_rnh(struct zclient *zclient, int command, * * XXX: No attention paid to alignment. */ -int zclient_route_send(uint8_t cmd, struct zclient *zclient, - struct zapi_route *api) +enum zclient_send_status +zclient_route_send(uint8_t cmd, struct zclient *zclient, struct zapi_route *api) { if (zapi_route_encode(cmd, zclient->obuf, api) < 0) - return -1; + return ZCLIENT_SEND_FAILURE; return zclient_send_message(zclient); } @@ -1058,7 +1036,8 @@ int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg) return 0; } -int zclient_nhg_send(struct zclient *zclient, int cmd, struct zapi_nhg *api_nhg) +enum zclient_send_status zclient_nhg_send(struct zclient *zclient, int cmd, + struct zapi_nhg *api_nhg) { api_nhg->proto = zclient->redist_default; @@ -1494,9 +1473,12 @@ stream_failure: bool zapi_route_notify_decode(struct stream *s, struct prefix *p, uint32_t *tableid, - enum zapi_route_notify_owner *note) + enum zapi_route_notify_owner *note, + afi_t *afi, safi_t *safi) { uint32_t t; + afi_t afi_val; + safi_t safi_val; STREAM_GET(note, s, sizeof(*note)); @@ -1504,9 +1486,16 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p, STREAM_GETC(s, p->prefixlen); STREAM_GET(&p->u.prefix, s, prefix_blen(p)); STREAM_GETL(s, t); + STREAM_GETC(s, afi_val); + STREAM_GETC(s, safi_val); *tableid = t; + if (afi) + *afi = afi_val; + if (safi) + *safi = safi_val; + return true; stream_failure: @@ -1781,8 +1770,9 @@ stream_failure: * then set/unset redist[type] in the client handle (a struct zserv) for the * sending client */ -int zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi, - int type, unsigned short instance, vrf_id_t vrf_id) +enum zclient_send_status +zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi, + int type, unsigned short instance, vrf_id_t vrf_id) { struct stream *s; @@ -1799,8 +1789,9 @@ int zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi, return zclient_send_message(zclient); } -int zebra_redistribute_default_send(int command, struct zclient *zclient, - afi_t afi, vrf_id_t vrf_id) +enum zclient_send_status +zebra_redistribute_default_send(int command, struct zclient *zclient, afi_t afi, + vrf_id_t vrf_id) { struct stream *s; @@ -1815,6 +1806,22 @@ int zebra_redistribute_default_send(int command, struct zclient *zclient, return zclient_send_message(zclient); } +/* Send route notify request to zebra */ +int zebra_route_notify_send(int command, struct zclient *zclient, bool set) +{ + struct stream *s; + + s = zclient->obuf; + stream_reset(s); + + zclient_create_header(s, command, 0); + stream_putc(s, !!set); + + stream_putw_at(s, 0, stream_get_endp(s)); + + return zclient_send_message(zclient); +} + /* Get prefix in ZServ format; family should be filled in on prefix */ static int zclient_stream_get_prefix(struct stream *s, struct prefix *p) { @@ -2575,8 +2582,10 @@ stream_failure: * @param base Base for the label chunk. if MPLS_LABEL_BASE_ANY we do not care * @result 0 on success, -1 otherwise */ -int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, - uint32_t chunk_size, uint32_t base) +enum zclient_send_status zclient_send_get_label_chunk(struct zclient *zclient, + uint8_t keep, + uint32_t chunk_size, + uint32_t base) { struct stream *s; @@ -2584,7 +2593,7 @@ int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, zlog_debug("Getting Label Chunk"); if (zclient->sock < 0) - return -1; + return ZCLIENT_SEND_FAILURE; s = zclient->obuf; stream_reset(s); @@ -2800,7 +2809,7 @@ int tm_table_manager_connect(struct zclient *zclient) zlog_debug("Connecting to Table Manager"); if (zclient->sock < 0) - return -1; + return ZCLIENT_SEND_FAILURE; /* send request */ s = zclient->obuf; @@ -2816,7 +2825,7 @@ int tm_table_manager_connect(struct zclient *zclient) stream_putw_at(s, 0, stream_get_endp(s)); ret = zclient_send_message(zclient); - if (ret < 0) + if (ret == ZCLIENT_SEND_FAILURE) return -1; if (zclient_debug) @@ -2941,14 +2950,17 @@ int tm_release_table_chunk(struct zclient *zclient, uint32_t start, /* Put length at the first point of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); - return zclient_send_message(zclient); + if (zclient_send_message(zclient) == ZCLIENT_SEND_FAILURE) + return -1; + + return 0; } -int zebra_send_sr_policy(struct zclient *zclient, int cmd, - struct zapi_sr_policy *zp) +enum zclient_send_status zebra_send_sr_policy(struct zclient *zclient, int cmd, + struct zapi_sr_policy *zp) { if (zapi_sr_policy_encode(zclient->obuf, cmd, zp) < 0) - return -1; + return ZCLIENT_SEND_FAILURE; return zclient_send_message(zclient); } @@ -3030,11 +3042,11 @@ stream_failure: return -1; } -int zebra_send_mpls_labels(struct zclient *zclient, int cmd, - struct zapi_labels *zl) +enum zclient_send_status zebra_send_mpls_labels(struct zclient *zclient, + int cmd, struct zapi_labels *zl) { if (zapi_labels_encode(zclient->obuf, cmd, zl) < 0) - return -1; + return ZCLIENT_SEND_FAILURE; return zclient_send_message(zclient); } @@ -3195,7 +3207,8 @@ stream_failure: return -1; } -int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw) +enum zclient_send_status zebra_send_pw(struct zclient *zclient, int command, + struct zapi_pw *pw) { struct stream *s; @@ -3221,7 +3234,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw) break; default: flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown af", __func__); - return -1; + return ZCLIENT_SEND_FAILURE; } /* Put labels */ @@ -3290,7 +3303,8 @@ stream_failure: return; } -void zclient_send_mlag_register(struct zclient *client, uint32_t bit_map) +enum zclient_send_status zclient_send_mlag_register(struct zclient *client, + uint32_t bit_map) { struct stream *s; @@ -3301,15 +3315,16 @@ void zclient_send_mlag_register(struct zclient *client, uint32_t bit_map) stream_putl(s, bit_map); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(client); + return zclient_send_message(client); } -void zclient_send_mlag_deregister(struct zclient *client) +enum zclient_send_status zclient_send_mlag_deregister(struct zclient *client) { - zebra_message_send(client, ZEBRA_MLAG_CLIENT_UNREGISTER, VRF_DEFAULT); + return zebra_message_send(client, ZEBRA_MLAG_CLIENT_UNREGISTER, VRF_DEFAULT); } -void zclient_send_mlag_data(struct zclient *client, struct stream *client_s) +enum zclient_send_status zclient_send_mlag_data(struct zclient *client, + struct stream *client_s) { struct stream *s; @@ -3320,7 +3335,7 @@ void zclient_send_mlag_data(struct zclient *client, struct stream *client_s) stream_put(s, client_s->data, client_s->endp); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(client); + return zclient_send_message(client); } static void zclient_mlag_process_up(ZAPI_CALLBACK_ARGS) @@ -3345,17 +3360,17 @@ static void zclient_mlag_handle_msg(ZAPI_CALLBACK_ARGS) * Send an OPAQUE message, contents opaque to zebra. The message header * is a message subtype. */ -int zclient_send_opaque(struct zclient *zclient, uint32_t type, - const uint8_t *data, size_t datasize) +enum zclient_send_status zclient_send_opaque(struct zclient *zclient, + uint32_t type, const uint8_t *data, + size_t datasize) { - int ret; struct stream *s; uint16_t flags = 0; /* Check buffer size */ if (STREAM_SIZE(zclient->obuf) < (ZEBRA_HEADER_SIZE + sizeof(type) + datasize)) - return -1; + return ZCLIENT_SEND_FAILURE; s = zclient->obuf; stream_reset(s); @@ -3372,28 +3387,26 @@ int zclient_send_opaque(struct zclient *zclient, uint32_t type, /* Put length into the header at the start of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); - ret = zclient_send_message(zclient); - - return ret; + return zclient_send_message(zclient); } /* * Send an OPAQUE message to a specific zclient. The contents are opaque * to zebra. */ -int zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type, - uint8_t proto, uint16_t instance, - uint32_t session_id, const uint8_t *data, - size_t datasize) +enum zclient_send_status +zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type, + uint8_t proto, uint16_t instance, + uint32_t session_id, const uint8_t *data, + size_t datasize) { - int ret; struct stream *s; uint16_t flags = 0; /* Check buffer size */ if (STREAM_SIZE(zclient->obuf) < (ZEBRA_HEADER_SIZE + sizeof(struct zapi_opaque_msg) + datasize)) - return -1; + return ZCLIENT_SEND_FAILURE; s = zclient->obuf; stream_reset(s); @@ -3416,9 +3429,7 @@ int zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type, /* Put length into the header at the start of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); - ret = zclient_send_message(zclient); - - return ret; + return zclient_send_message(zclient); } /* @@ -3451,9 +3462,9 @@ stream_failure: /* * Send a registration request for opaque messages with a specified subtype. */ -int zclient_register_opaque(struct zclient *zclient, uint32_t type) +enum zclient_send_status zclient_register_opaque(struct zclient *zclient, + uint32_t type) { - int ret; struct stream *s; s = zclient->obuf; @@ -3472,17 +3483,15 @@ int zclient_register_opaque(struct zclient *zclient, uint32_t type) /* Put length at the first point of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); - ret = zclient_send_message(zclient); - - return ret; + return zclient_send_message(zclient); } /* * Send an un-registration request for a specified opaque subtype. */ -int zclient_unregister_opaque(struct zclient *zclient, uint32_t type) +enum zclient_send_status zclient_unregister_opaque(struct zclient *zclient, + uint32_t type) { - int ret; struct stream *s; s = zclient->obuf; @@ -3501,9 +3510,7 @@ int zclient_unregister_opaque(struct zclient *zclient, uint32_t type) /* Put length at the first point of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); - ret = zclient_send_message(zclient); - - return ret; + return zclient_send_message(zclient); } /* Utility to decode opaque registration info */ @@ -3958,9 +3965,9 @@ static void zclient_event(enum event event, struct zclient *zclient) } } -void zclient_interface_set_master(struct zclient *client, - struct interface *master, - struct interface *slave) +enum zclient_send_status zclient_interface_set_master(struct zclient *client, + struct interface *master, + struct interface *slave) { struct stream *s; @@ -3975,20 +3982,21 @@ void zclient_interface_set_master(struct zclient *client, stream_putl(s, slave->ifindex); stream_putw_at(s, 0, stream_get_endp(s)); - zclient_send_message(client); + return zclient_send_message(client); } /* * Send capabilities message to zebra */ -int32_t zclient_capabilities_send(uint32_t cmd, struct zclient *zclient, - struct zapi_cap *api) +enum zclient_send_status zclient_capabilities_send(uint32_t cmd, + struct zclient *zclient, + struct zapi_cap *api) { struct stream *s; if (zclient == NULL) - return -1; + return ZCLIENT_SEND_FAILURE; s = zclient->obuf; stream_reset(s); @@ -4047,9 +4055,10 @@ stream_failure: return 0; } -int zclient_send_neigh_discovery_req(struct zclient *zclient, - const struct interface *ifp, - const struct prefix *p) +enum zclient_send_status +zclient_send_neigh_discovery_req(struct zclient *zclient, + const struct interface *ifp, + const struct prefix *p) { struct stream *s; diff --git a/lib/zclient.h b/lib/zclient.h index 80dca3fc56..ae94237b76 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -54,6 +54,7 @@ typedef uint16_t zebra_size_t; /* For input/output buffer to zebra. */ #define ZEBRA_MAX_PACKET_SIZ 16384U +#define ZEBRA_SMALL_PACKET_SIZE 200U /* Zebra header size. */ #define ZEBRA_HEADER_SIZE 10 @@ -218,6 +219,7 @@ typedef enum { ZEBRA_OPAQUE_REGISTER, ZEBRA_OPAQUE_UNREGISTER, ZEBRA_NEIGH_DISCOVER, + ZEBRA_ROUTE_NOTIFY_REQUEST, } zebra_message_types_t; enum zebra_error_types { @@ -319,6 +321,18 @@ struct zclient { /* Pointer to the callback functions. */ void (*zebra_connected)(struct zclient *); void (*zebra_capabilities)(struct zclient_capabilities *cap); + + /* + * When the zclient attempts to write the stream data to + * it's named pipe to/from zebra, we may have a situation + * where the other daemon has not fully drained the data + * from the socket. In this case provide a mechanism + * where we will *still* buffer the data to be sent + * and also provide a callback mechanism to the appropriate + * place where we can signal that we're ready to receive + * more data. + */ + void (*zebra_buffer_write_ready)(void); int (*router_id_update)(ZAPI_CALLBACK_ARGS); int (*interface_address_add)(ZAPI_CALLBACK_ARGS); int (*interface_address_delete)(ZAPI_CALLBACK_ARGS); @@ -513,6 +527,13 @@ struct zapi_route { * offload situation. */ #define ZEBRA_FLAG_OFFLOADED 0x100 +/* + * This flag tells everyone that the route has + * failed offloading. + * This flag makes no sense unless you are in an asic + * offload situation. + */ +#define ZEBRA_FLAG_OFFLOAD_FAILED 0x200 /* The older XXX_MESSAGE flags live here */ uint32_t message; @@ -655,6 +676,12 @@ enum zapi_iptable_notify_owner { ZAPI_IPTABLE_FAIL_REMOVE, }; +enum zclient_send_status { + ZCLIENT_SEND_FAILURE = -1, + ZCLIENT_SEND_SUCCESS = 0, + ZCLIENT_SEND_BUFFERED = 1 +}; + static inline const char * zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note) { @@ -752,31 +779,37 @@ extern void redist_del_all_instances(struct redist_proto *red); * we have installed and play some special games * to get them both installed. */ -extern void zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, - afi_t afi, mpls_label_t label, - enum lsp_types_t ltype); +extern enum zclient_send_status +zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi, + mpls_label_t label, enum lsp_types_t ltype); extern void zclient_send_reg_requests(struct zclient *, vrf_id_t); extern void zclient_send_dereg_requests(struct zclient *, vrf_id_t); -extern int zclient_send_router_id_update(struct zclient *zclient, - zebra_message_types_t type, afi_t afi, - vrf_id_t vrf_id); - -extern void zclient_send_interface_radv_req(struct zclient *zclient, - vrf_id_t vrf_id, - struct interface *ifp, int enable, - int ra_interval); -extern int zclient_send_interface_protodown(struct zclient *zclient, - vrf_id_t vrf_id, - struct interface *ifp, bool down); +extern enum zclient_send_status +zclient_send_router_id_update(struct zclient *zclient, + zebra_message_types_t type, afi_t afi, + vrf_id_t vrf_id); + +extern enum zclient_send_status +zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id, + struct interface *ifp, int enable, + int ra_interval); +extern enum zclient_send_status +zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id, + struct interface *ifp, bool down); /* Send redistribute command to zebra daemon. Do not update zclient state. */ -extern int zebra_redistribute_send(int command, struct zclient *, afi_t, - int type, unsigned short instance, - vrf_id_t vrf_id); +extern enum zclient_send_status +zebra_redistribute_send(int command, struct zclient *, afi_t, int type, + unsigned short instance, vrf_id_t vrf_id); + +extern enum zclient_send_status +zebra_redistribute_default_send(int command, struct zclient *zclient, afi_t afi, + vrf_id_t vrf_id); -extern int zebra_redistribute_default_send(int command, struct zclient *zclient, - afi_t afi, vrf_id_t vrf_id); +/* Send route notify request to zebra */ +extern int zebra_route_notify_send(int command, struct zclient *zclient, + bool set); /* If state has changed, update state and call zebra_redistribute_send. */ extern void zclient_redistribute(int command, struct zclient *, afi_t, int type, @@ -786,9 +819,14 @@ extern void zclient_redistribute(int command, struct zclient *, afi_t, int type, extern void zclient_redistribute_default(int command, struct zclient *, afi_t, vrf_id_t vrf_id); -/* Send the message in zclient->obuf to the zebra daemon (or enqueue it). - Returns 0 for success or -1 on an I/O error. */ -extern int zclient_send_message(struct zclient *); +/* + * Send the message in zclient->obuf to the zebra daemon (or enqueue it). + * Returns: + * -1 on a I/O error + * 0 data was successfully sent + * 1 data was buffered for future usage + */ +extern enum zclient_send_status zclient_send_message(struct zclient *); /* create header for command, length to be filled in by user later */ extern void zclient_create_header(struct stream *, uint16_t, vrf_id_t); @@ -845,9 +883,9 @@ extern int zclient_read_header(struct stream *s, int sock, uint16_t *size, */ extern bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr); -extern void zclient_interface_set_master(struct zclient *client, - struct interface *master, - struct interface *slave); +extern enum zclient_send_status +zclient_interface_set_master(struct zclient *client, struct interface *master, + struct interface *slave); extern struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t); extern struct connected *zebra_interface_address_read(int, struct stream *, vrf_id_t); @@ -862,8 +900,9 @@ extern struct interface *zebra_interface_link_params_read(struct stream *s, vrf_id_t vrf_id); extern size_t zebra_interface_link_params_write(struct stream *, struct interface *); -extern int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, - uint32_t chunk_size, uint32_t base); +extern enum zclient_send_status +zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, + uint32_t chunk_size, uint32_t base); extern int lm_label_manager_connect(struct zclient *zclient, int async); extern int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, @@ -877,29 +916,32 @@ extern int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size, extern int tm_release_table_chunk(struct zclient *zclient, uint32_t start, uint32_t end); -extern int zebra_send_sr_policy(struct zclient *zclient, int cmd, - struct zapi_sr_policy *zp); +extern enum zclient_send_status zebra_send_sr_policy(struct zclient *zclient, + int cmd, + struct zapi_sr_policy *zp); extern int zapi_sr_policy_encode(struct stream *s, int cmd, struct zapi_sr_policy *zp); extern int zapi_sr_policy_decode(struct stream *s, struct zapi_sr_policy *zp); extern int zapi_sr_policy_notify_status_decode(struct stream *s, struct zapi_sr_policy *zp); -extern int zebra_send_mpls_labels(struct zclient *zclient, int cmd, - struct zapi_labels *zl); +extern enum zclient_send_status zebra_send_mpls_labels(struct zclient *zclient, + int cmd, + struct zapi_labels *zl); extern int zapi_labels_encode(struct stream *s, int cmd, struct zapi_labels *zl); extern int zapi_labels_decode(struct stream *s, struct zapi_labels *zl); -extern int zebra_send_pw(struct zclient *zclient, int command, - struct zapi_pw *pw); +extern enum zclient_send_status zebra_send_pw(struct zclient *zclient, + int command, struct zapi_pw *pw); extern int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw); -extern int zclient_route_send(uint8_t, struct zclient *, struct zapi_route *); -extern int zclient_send_rnh(struct zclient *zclient, int command, - const struct prefix *p, bool exact_match, - vrf_id_t vrf_id); +extern enum zclient_send_status zclient_route_send(uint8_t, struct zclient *, + struct zapi_route *); +extern enum zclient_send_status +zclient_send_rnh(struct zclient *zclient, int command, const struct prefix *p, + bool exact_match, vrf_id_t vrf_id); int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh, uint32_t api_flags, uint32_t api_message); extern int zapi_route_encode(uint8_t, struct stream *, struct zapi_route *); @@ -910,7 +952,8 @@ bool zapi_nhg_notify_decode(struct stream *s, uint32_t *id, enum zapi_nhg_notify_owner *note); bool zapi_route_notify_decode(struct stream *s, struct prefix *p, uint32_t *tableid, - enum zapi_route_notify_owner *note); + enum zapi_route_notify_owner *note, + afi_t *afi, safi_t *safi); bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno, uint32_t *priority, uint32_t *unique, char *ifname, enum zapi_rule_notify_owner *note); @@ -921,8 +964,8 @@ bool zapi_ipset_notify_decode(struct stream *s, extern int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg); extern int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg); -extern int zclient_nhg_send(struct zclient *zclient, int cmd, - struct zapi_nhg *api_nhg); +extern enum zclient_send_status +zclient_nhg_send(struct zclient *zclient, int cmd, struct zapi_nhg *api_nhg); #define ZEBRA_IPSET_NAME_SIZE 32 @@ -949,8 +992,9 @@ const char *zapi_nexthop2str(const struct zapi_nexthop *znh, char *buf, extern bool zapi_error_decode(struct stream *s, enum zebra_error_types *error); /* Encode and decode restart capabilities */ -extern int32_t zclient_capabilities_send(uint32_t cmd, struct zclient *zclient, - struct zapi_cap *api); +extern enum zclient_send_status +zclient_capabilities_send(uint32_t cmd, struct zclient *zclient, + struct zapi_cap *api); extern int32_t zapi_capabilities_decode(struct stream *s, struct zapi_cap *api); static inline void zapi_route_set_blackhole(struct zapi_route *api, @@ -963,12 +1007,13 @@ static inline void zapi_route_set_blackhole(struct zapi_route *api, SET_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP); }; -extern void zclient_send_mlag_register(struct zclient *client, - uint32_t bit_map); -extern void zclient_send_mlag_deregister(struct zclient *client); +extern enum zclient_send_status +zclient_send_mlag_register(struct zclient *client, uint32_t bit_map); +extern enum zclient_send_status +zclient_send_mlag_deregister(struct zclient *client); -extern void zclient_send_mlag_data(struct zclient *client, - struct stream *client_s); +extern enum zclient_send_status zclient_send_mlag_data(struct zclient *client, + struct stream *client_s); /* * Send an OPAQUE message, contents opaque to zebra - but note that @@ -978,13 +1023,15 @@ extern void zclient_send_mlag_data(struct zclient *client, * below to avoid sub-type collisions. Clients use the registration * apis to manage the specific opaque subtypes they want to receive. */ -int zclient_send_opaque(struct zclient *zclient, uint32_t type, - const uint8_t *data, size_t datasize); +enum zclient_send_status zclient_send_opaque(struct zclient *zclient, + uint32_t type, const uint8_t *data, + size_t datasize); -int zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type, - uint8_t proto, uint16_t instance, - uint32_t session_id, const uint8_t *data, - size_t datasize); +enum zclient_send_status +zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type, + uint8_t proto, uint16_t instance, + uint32_t session_id, const uint8_t *data, + size_t datasize); /* Struct representing the decoded opaque header info */ struct zapi_opaque_msg { @@ -1014,8 +1061,10 @@ struct zapi_opaque_reg_info { /* Decode incoming opaque */ int zclient_opaque_decode(struct stream *msg, struct zapi_opaque_msg *info); -int zclient_register_opaque(struct zclient *zclient, uint32_t type); -int zclient_unregister_opaque(struct zclient *zclient, uint32_t type); +enum zclient_send_status zclient_register_opaque(struct zclient *zclient, + uint32_t type); +enum zclient_send_status zclient_unregister_opaque(struct zclient *zclient, + uint32_t type); int zapi_opaque_reg_decode(struct stream *msg, struct zapi_opaque_reg_info *info); @@ -1041,11 +1090,12 @@ enum zapi_opaque_registry { /* Send the hello message. * Returns 0 for success or -1 on an I/O error. */ -extern int zclient_send_hello(struct zclient *client); +extern enum zclient_send_status zclient_send_hello(struct zclient *client); -extern int zclient_send_neigh_discovery_req(struct zclient *zclient, - const struct interface *ifp, - const struct prefix *p); +extern enum zclient_send_status +zclient_send_neigh_discovery_req(struct zclient *zclient, + const struct interface *ifp, + const struct prefix *p); #ifdef __cplusplus } diff --git a/lib/zebra.h b/lib/zebra.h index 14d66d6627..ded44ac636 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -359,6 +359,10 @@ typedef enum { SAFI_MAX = 8 } safi_t; +#define FOREACH_AFI_SAFI(afi, safi) \ + for (afi = AFI_IP; afi < AFI_MAX; afi++) \ + for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) + /* Default Administrative Distance of each protocol. */ #define ZEBRA_KERNEL_DISTANCE_DEFAULT 0 #define ZEBRA_CONNECT_DISTANCE_DEFAULT 0 diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index 42f6a88f95..f7c71c2218 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -122,7 +122,8 @@ static void nhrp_cache_update_route(struct nhrp_cache *c) char buf[3][SU_ADDRSTRLEN]; struct nhrp_interface *nifp; - sockunion2hostprefix(&c->remote_addr, &pfx); + if (!sockunion2hostprefix(&c->remote_addr, &pfx)) + return; if (p && nhrp_peer_check(p, 1)) { if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) { @@ -186,7 +187,7 @@ static void nhrp_cache_update_route(struct nhrp_cache *c) c->nhrp_route_installed = 0; } if (c->route_installed) { - sockunion2hostprefix(&c->remote_addr, &pfx); + assert(sockunion2hostprefix(&c->remote_addr, &pfx)); notifier_call(&c->notifier_list, NOTIFY_CACHE_DOWN); nhrp_route_announce(0, c->cur.type, &pfx, NULL, NULL, 0); diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 2bc2d91597..e7d35b90ff 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -350,10 +350,22 @@ void nhrp_zebra_init(void) zclient_init(zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs); } +static void nhrp_table_node_cleanup(struct route_table *table, + struct route_node *node) +{ + if (!node->info) + return; + + XFREE(MTYPE_NHRP_ROUTE, node->info); +} + void nhrp_zebra_terminate(void) { zclient_stop(zclient); zclient_free(zclient); + + zebra_rib[AFI_IP]->cleanup = nhrp_table_node_cleanup; + zebra_rib[AFI_IP6]->cleanup = nhrp_table_node_cleanup; route_table_finish(zebra_rib[AFI_IP]); route_table_finish(zebra_rib[AFI_IP6]); } diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 9a6f77334f..2359cfa4ac 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -397,7 +397,9 @@ void nhrp_shortcut_initiate(union sockunion *addr) struct prefix p; struct nhrp_shortcut *s; - sockunion2hostprefix(addr, &p); + if (!sockunion2hostprefix(addr, &p)) + return; + s = nhrp_shortcut_get(&p); if (s && s->type != NHRP_CACHE_INCOMPLETE) { s->addr = *addr; diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index cbb80b668d..c71b30a2d4 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -82,10 +82,10 @@ static int ospf6_abr_nexthops_belong_to_area(struct ospf6_route *route, static void ospf6_abr_delete_route(struct ospf6_route *range, struct ospf6_route *summary, struct ospf6_route_table *summary_table, - struct ospf6_lsa *old) + struct ospf6_lsa *old, struct ospf6 *ospf6) { if (summary) { - ospf6_route_remove(summary, summary_table); + ospf6_route_remove(summary, summary_table, ospf6); } if (old && !OSPF6_LSA_IS_MAXAGE(old)) @@ -117,7 +117,7 @@ void ospf6_abr_disable_area(struct ospf6_area *area) area->ospf6->router_id, area->lsdb); if (old) ospf6_lsa_purge(old); - ospf6_route_remove(ro, area->summary_prefix); + ospf6_route_remove(ro, area->summary_prefix, area->ospf6); } /* Withdraw all summary router-routes previously originated */ @@ -128,7 +128,7 @@ void ospf6_abr_disable_area(struct ospf6_area *area) area->ospf6->router_id, area->lsdb); if (old) ospf6_lsa_purge(old); - ospf6_route_remove(ro, area->summary_router); + ospf6_route_remove(ro, area->summary_router, area->ospf6); } /* Schedule Router-LSA for each area (ABR status may change) */ @@ -196,7 +196,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (ADV_ROUTER_IN_PREFIX(&route->prefix) == area->ospf6->router_id) { zlog_debug( - "%s: Skipping ASBR announcement for ABR (%pFX)", + "%s: Skipping ASBR announcement for ABR (%pI4)", __func__, &ADV_ROUTER_IN_PREFIX(&route->prefix)); return 0; @@ -208,7 +208,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, || IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) { is_debug++; zlog_debug( - "Originating summary in area %s for ASBR %pFX", + "Originating summary in area %s for ASBR %pI4", area->name, &ADV_ROUTER_IN_PREFIX(&route->prefix)); } @@ -225,9 +225,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug( "%s: route %pFX with cost %u is not best, ignore.", - __func__, - &ADV_ROUTER_IN_PREFIX( - &route->prefix), + __func__, &route->prefix, route->path.cost); return 0; } @@ -273,10 +271,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, "The range is not active. withdraw"); ospf6_abr_delete_route(route, summary, - summary_table, old); + summary_table, old, + area->ospf6); } } else if (old) { - ospf6_route_remove(summary, summary_table); + ospf6_route_remove(summary, summary_table, area->ospf6); ospf6_lsa_purge(old); } return 0; @@ -287,7 +286,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "Area has been stubbed, purge Inter-Router LSA"); - ospf6_abr_delete_route(route, summary, summary_table, old); + ospf6_abr_delete_route(route, summary, summary_table, old, + area->ospf6); return 0; } @@ -296,7 +296,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug("Area has been stubbed, purge prefix LSA"); - ospf6_abr_delete_route(route, summary, summary_table, old); + ospf6_abr_delete_route(route, summary, summary_table, old, + area->ospf6); return 0; } @@ -332,7 +333,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "This is the secondary path to the ASBR, ignore"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } @@ -363,7 +364,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, "Suppressed by range %pFX of area %s", &range->prefix, route_area->name); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } } @@ -376,7 +377,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "This is the range with DoNotAdvertise set. ignore"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } @@ -385,7 +386,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug("The range is not active. withdraw"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } } @@ -402,8 +403,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug( "prefix %pFX was denied by export list", - &ADV_ROUTER_IN_PREFIX( - &route->prefix)); + &route->prefix); return 0; } } @@ -415,7 +415,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug( "prefix %pFX was denied by filter-list out", - &ADV_ROUTER_IN_PREFIX(&route->prefix)); + &route->prefix); return 0; } @@ -437,7 +437,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, summary->path.origin.type, summary->path.origin.adv_router, area->lsdb); } - summary = ospf6_route_add(summary, summary_table); + summary = ospf6_route_add(summary, summary_table, area->ospf6); } else { summary->type = route->type; monotime(&summary->changed); @@ -576,7 +576,8 @@ ospf6_abr_range_summary_needs_update(struct ospf6_route *range, uint32_t cost) return (redo_summary); } -static void ospf6_abr_range_update(struct ospf6_route *range) +static void ospf6_abr_range_update(struct ospf6_route *range, + struct ospf6 *ospf6) { uint32_t cost = 0; struct listnode *node, *nnode; @@ -615,7 +616,7 @@ static void ospf6_abr_range_update(struct ospf6_route *range) if (IS_OSPF6_DEBUG_ABR) zlog_debug("Add discard route"); - ospf6_zebra_add_discard(range); + ospf6_zebra_add_discard(range, ospf6); } } else { /* Summary removed or no summary generated as no @@ -625,18 +626,19 @@ static void ospf6_abr_range_update(struct ospf6_route *range) if (IS_OSPF6_DEBUG_ABR) zlog_debug("Delete discard route"); - ospf6_zebra_delete_discard(range); + ospf6_zebra_delete_discard(range, ospf6); } } } } -void ospf6_abr_originate_summary(struct ospf6_route *route) +void ospf6_abr_originate_summary(struct ospf6_route *route, struct ospf6 *ospf6) { struct listnode *node, *nnode; struct ospf6_area *oa; struct ospf6_route *range = NULL; + if (route->type == OSPF6_DEST_TYPE_NETWORK) { oa = ospf6_area_lookup(route->path.area_id, ospf6); if (!oa) { @@ -647,7 +649,7 @@ void ospf6_abr_originate_summary(struct ospf6_route *route) range = ospf6_route_lookup_bestmatch(&route->prefix, oa->range_table); if (range) { - ospf6_abr_range_update(range); + ospf6_abr_range_update(range, ospf6); } } @@ -674,7 +676,7 @@ void ospf6_abr_defaults_to_stub(struct ospf6 *o) def->path.subtype = OSPF6_PATH_SUBTYPE_DEFAULT_RT; def->path.area_id = o->backbone->area_id; - for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa)) { + for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa)) { if (!IS_AREA_STUB(oa)) { /* withdraw defaults when an area switches from stub to * non-stub */ @@ -704,7 +706,8 @@ void ospf6_abr_defaults_to_stub(struct ospf6 *o) void ospf6_abr_old_path_update(struct ospf6_route *old_route, struct ospf6_route *route, - struct ospf6_route_table *table) + struct ospf6_route_table *table, + struct ospf6 *ospf6) { struct ospf6_path *o_path = NULL; struct listnode *anode, *anext; @@ -751,7 +754,7 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route, : 0); if (table->hook_add) - (*table->hook_add)(old_route); + (*table->hook_add)(old_route, ospf6); if (old_route->path.origin.id == route->path.origin.id && old_route->path.origin.adv_router == @@ -768,9 +771,9 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route, } } -void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, - struct ospf6_route *old, - struct ospf6_route_table *table) +void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_route *old, + struct ospf6_route_table *table, + struct ospf6 *ospf6) { if (listcount(old->paths) > 1) { struct listnode *anode, *anext, *nnode, *rnode, *rnext; @@ -807,7 +810,7 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, : 0); if (table->hook_add) - (*table->hook_add)(old); + (*table->hook_add)(old, ospf6); if ((old->path.origin.id == lsa->header->id) && (old->path.origin.adv_router @@ -824,11 +827,10 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, h_path->origin.adv_router; } } else - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, ospf6); } } else - ospf6_route_remove(old, table); - + ospf6_route_remove(old, table, ospf6); } /* RFC 2328 16.2. Calculating the inter-area routes */ @@ -943,7 +945,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("cost is LS_INFINITY, ignore"); if (old) - ospf6_abr_old_route_remove(lsa, old, table); + ospf6_abr_old_route_remove(lsa, old, table, oa->ospf6); return; } if (OSPF6_LSA_IS_MAXAGE(lsa)) { @@ -951,7 +953,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug("%s: LSA %s is MaxAge, ignore", __func__, lsa->name); if (old) - ospf6_abr_old_route_remove(lsa, old, table); + ospf6_abr_old_route_remove(lsa, old, table, oa->ospf6); return; } @@ -961,7 +963,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug("LSA %s is self-originated, ignore", lsa->name); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -977,7 +979,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "Prefix is equal to address range, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -988,7 +990,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix has NU/LA bit set, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } } @@ -1001,7 +1003,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix has NU/LA bit set, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -1015,7 +1017,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) "Ignorning Inter-Router LSA for an ABR (%s)", buf); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -1043,7 +1045,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "%s: remove old entry: %s %p ", __func__, buf, (void *)old); - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); } } return; @@ -1062,7 +1064,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "Prefix was denied by import-list"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, + oa->ospf6); return; } } @@ -1074,7 +1077,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix was denied by prefix-list"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } } @@ -1127,7 +1130,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) */ if (listcount(old_route->paths) > 1) ospf6_abr_old_path_update(old_route, route, - table); + table, oa->ospf6); continue; } @@ -1195,7 +1198,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) * For Inter-Router trigger summary update */ if (table->hook_add) - (*table->hook_add)(old_route); + (*table->hook_add)(old_route, oa->ospf6); /* Delete new route */ ospf6_route_delete(route); @@ -1214,23 +1217,19 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) path = ospf6_path_dup(&route->path); ospf6_copy_nexthops(path->nh_list, abr_entry->nh_list); listnode_add_sort(route->paths, path); - /* ospf6_ia_add_nw_route (table, &prefix, route); */ - ospf6_route_add(route, table); + ospf6_route_add(route, table, oa->ospf6); } } -void ospf6_abr_examin_brouter(uint32_t router_id) +void ospf6_abr_examin_brouter(uint32_t router_id, struct ospf6_route *route, + struct ospf6 *ospf6) { struct ospf6_lsa *lsa; struct ospf6_area *oa; uint16_t type; - if (ospf6_is_router_abr(ospf6)) - oa = ospf6->backbone; - else - oa = listgetdata(listhead(ospf6->area_list)); - + oa = ospf6_area_lookup(route->path.area_id, ospf6); /* * It is possible to designate a non backbone * area first. If that is the case safely @@ -1271,7 +1270,7 @@ void ospf6_abr_prefix_resummarize(struct ospf6 *o) for (route = ospf6_route_head(o->route_table); route; route = ospf6_route_next(route)) - ospf6_abr_originate_summary(route); + ospf6_abr_originate_summary(route, o); if (IS_OSPF6_DEBUG_ABR) zlog_debug("Finished re-examining Inter-Prefix Summaries"); diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index e40d155037..8ad51a4f82 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -64,11 +64,14 @@ extern void ospf6_abr_disable_area(struct ospf6_area *oa); extern int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, struct ospf6_area *area); -extern void ospf6_abr_originate_summary(struct ospf6_route *route); +extern void ospf6_abr_originate_summary(struct ospf6_route *route, + struct ospf6 *ospf6); extern void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa); extern void ospf6_abr_defaults_to_stub(struct ospf6 *); -extern void ospf6_abr_examin_brouter(uint32_t router_id); +extern void ospf6_abr_examin_brouter(uint32_t router_id, + struct ospf6_route *route, + struct ospf6 *ospf6); extern void ospf6_abr_reimport(struct ospf6_area *oa); extern void ospf6_abr_range_reset_cost(struct ospf6 *ospf6); extern void ospf6_abr_prefix_resummarize(struct ospf6 *ospf6); @@ -78,10 +81,12 @@ extern void install_element_ospf6_debug_abr(void); extern int ospf6_abr_config_write(struct vty *vty); extern void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_route *old, - struct ospf6_route_table *table); + struct ospf6_route_table *table, + struct ospf6 *ospf6); extern void ospf6_abr_old_path_update(struct ospf6_route *old_route, struct ospf6_route *route, - struct ospf6_route_table *table); + struct ospf6_route_table *table, + struct ospf6 *ospf6); extern void ospf6_abr_init(void); #endif /*OSPF6_ABR_H*/ diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 866bc7e189..2ef61ae0cd 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -115,21 +115,23 @@ static void ospf6_area_lsdb_hook_remove(struct ospf6_lsa *lsa) } } -static void ospf6_area_route_hook_add(struct ospf6_route *route) +static void ospf6_area_route_hook_add(struct ospf6_route *route, + struct ospf6 *ospf6) { struct ospf6_route *copy; copy = ospf6_route_copy(route); - ospf6_route_add(copy, ospf6->route_table); + ospf6_route_add(copy, ospf6->route_table, ospf6); } -static void ospf6_area_route_hook_remove(struct ospf6_route *route) +static void ospf6_area_route_hook_remove(struct ospf6_route *route, + struct ospf6 *ospf6) { struct ospf6_route *copy; copy = ospf6_route_lookup_identical(route, ospf6->route_table); if (copy) - ospf6_route_remove(copy, ospf6->route_table); + ospf6_route_remove(copy, ospf6->route_table, ospf6); } static void ospf6_area_stub_update(struct ospf6_area *area) @@ -282,13 +284,13 @@ void ospf6_area_delete(struct ospf6_area *oa) ospf6_lsdb_delete(oa->lsdb_self); ospf6_lsdb_delete(oa->temp_router_lsa_lsdb); - ospf6_spf_table_finish(oa->spf_table); - ospf6_route_table_delete(oa->spf_table); - ospf6_route_table_delete(oa->route_table); + ospf6_spf_table_finish(oa->spf_table, oa->ospf6); + ospf6_route_table_delete(oa->spf_table, oa->ospf6); + ospf6_route_table_delete(oa->route_table, oa->ospf6); - ospf6_route_table_delete(oa->range_table); - ospf6_route_table_delete(oa->summary_prefix); - ospf6_route_table_delete(oa->summary_router); + ospf6_route_table_delete(oa->range_table, oa->ospf6); + ospf6_route_table_delete(oa->summary_prefix, oa->ospf6); + ospf6_route_table_delete(oa->summary_router, oa->ospf6); listnode_delete(oa->ospf6->area_list, oa); oa->ospf6 = NULL; @@ -297,6 +299,20 @@ void ospf6_area_delete(struct ospf6_area *oa) XFREE(MTYPE_OSPF6_AREA, oa); } +struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id) +{ + struct ospf6_area *oa; + struct listnode *n, *node, *nnode; + struct ospf6 *ospf6; + + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) + if (oa->area_id == area_id) + return oa; + } + return (struct ospf6_area *)NULL; +} + struct ospf6_area *ospf6_area_lookup(uint32_t area_id, struct ospf6 *ospf6) { struct ospf6_area *oa; @@ -335,48 +351,102 @@ void ospf6_area_disable(struct ospf6_area *oa) ospf6_lsdb_remove_all(oa->lsdb); ospf6_lsdb_remove_all(oa->lsdb_self); - ospf6_spf_table_finish(oa->spf_table); - ospf6_route_remove_all(oa->route_table); + ospf6_spf_table_finish(oa->spf_table, oa->ospf6); + ospf6_route_remove_all(oa->route_table, oa->ospf6); THREAD_OFF(oa->thread_router_lsa); THREAD_OFF(oa->thread_intra_prefix_lsa); } -void ospf6_area_show(struct vty *vty, struct ospf6_area *oa) +void ospf6_area_show(struct vty *vty, struct ospf6_area *oa, + json_object *json_areas, bool use_json) { struct listnode *i; struct ospf6_interface *oi; unsigned long result; + json_object *json_area; + json_object *array_interfaces; - if (!IS_AREA_STUB(oa)) - vty_out(vty, " Area %s\n", oa->name); - else { - if (oa->no_summary) { - vty_out(vty, " Area %s[Stub, No Summary]\n", oa->name); - } else { - vty_out(vty, " Area %s[Stub]\n", oa->name); + if (use_json) { + json_area = json_object_new_object(); + json_object_boolean_add(json_area, "areaIsStub", + IS_AREA_STUB(oa)); + if (IS_AREA_STUB(oa)) { + json_object_boolean_add(json_area, "areaNoSummary", + oa->no_summary); } - } - vty_out(vty, " Number of Area scoped LSAs is %u\n", - oa->lsdb->count); - vty_out(vty, " Interface attached to this area:"); - for (ALL_LIST_ELEMENTS_RO(oa->if_list, i, oi)) - vty_out(vty, " %s", oi->interface->name); - vty_out(vty, "\n"); + json_object_int_add(json_area, "numberOfAreaScopedLsa", + oa->lsdb->count); + + /* Interfaces Attached */ + array_interfaces = json_object_new_array(); + for (ALL_LIST_ELEMENTS_RO(oa->if_list, i, oi)) + json_object_array_add( + array_interfaces, + json_object_new_string(oi->interface->name)); + + json_object_object_add(json_area, "interfacesAttachedToArea", + array_interfaces); + + if (oa->ts_spf.tv_sec || oa->ts_spf.tv_usec) { + json_object_boolean_true_add(json_area, "spfHasRun"); + result = monotime_since(&oa->ts_spf, NULL); + if (result / TIMER_SECOND_MICRO > 0) { + json_object_int_add( + json_area, "spfLastExecutedSecs", + result / TIMER_SECOND_MICRO); + + json_object_int_add( + json_area, "spfLastExecutedMicroSecs", + result % TIMER_SECOND_MICRO); + } else { + json_object_int_add(json_area, + "spfLastExecutedSecs", 0); + json_object_int_add(json_area, + "spfLastExecutedMicroSecs", + result); + } + } else + json_object_boolean_false_add(json_area, "spfHasRun"); - if (oa->ts_spf.tv_sec || oa->ts_spf.tv_usec) { - result = monotime_since(&oa->ts_spf, NULL); - if (result / TIMER_SECOND_MICRO > 0) { - vty_out(vty, "SPF last executed %ld.%lds ago\n", - result / TIMER_SECOND_MICRO, - result % TIMER_SECOND_MICRO); - } else { - vty_out(vty, "SPF last executed %ldus ago\n", result); + + json_object_object_add(json_areas, oa->name, json_area); + + } else { + + if (!IS_AREA_STUB(oa)) + vty_out(vty, " Area %s\n", oa->name); + else { + if (oa->no_summary) { + vty_out(vty, " Area %s[Stub, No Summary]\n", + oa->name); + } else { + vty_out(vty, " Area %s[Stub]\n", oa->name); + } } - } else - vty_out(vty, "SPF has not been run\n"); + vty_out(vty, " Number of Area scoped LSAs is %u\n", + oa->lsdb->count); + + vty_out(vty, " Interface attached to this area:"); + for (ALL_LIST_ELEMENTS_RO(oa->if_list, i, oi)) + vty_out(vty, " %s", oi->interface->name); + vty_out(vty, "\n"); + + if (oa->ts_spf.tv_sec || oa->ts_spf.tv_usec) { + result = monotime_since(&oa->ts_spf, NULL); + if (result / TIMER_SECOND_MICRO > 0) { + vty_out(vty, "SPF last executed %ld.%lds ago\n", + result / TIMER_SECOND_MICRO, + result % TIMER_SECOND_MICRO); + } else { + vty_out(vty, "SPF last executed %ldus ago\n", + result); + } + } else + vty_out(vty, "SPF has not been run\n"); + } } DEFUN (area_range, @@ -401,7 +471,9 @@ DEFUN (area_range, struct ospf6_route *range; uint32_t cost = OSPF_AREA_RANGE_COST_UNSPEC; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa, ospf6); ret = str2prefix(argv[idx_ipv6_prefixlen]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { @@ -436,7 +508,7 @@ DEFUN (area_range, zlog_debug("%s: for prefix %s, flag = %x", __func__, argv[idx_ipv6_prefixlen]->arg, range->flag); if (range->rnode == NULL) { - ospf6_route_add(range, oa->range_table); + ospf6_route_add(range, oa->range_table, oa->ospf6); } if (ospf6_is_router_abr(ospf6)) { @@ -468,7 +540,9 @@ DEFUN (no_area_range, struct prefix prefix; struct ospf6_route *range, *route; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa, ospf6); ret = str2prefix(argv[idx_ipv6]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { @@ -488,19 +562,19 @@ DEFUN (no_area_range, SET_FLAG(range->flag, OSPF6_ROUTE_REMOVE); /* Redo summaries if required */ - for (route = ospf6_route_head(ospf6->route_table); route; + for (route = ospf6_route_head(oa->ospf6->route_table); route; route = ospf6_route_next(route)) - ospf6_abr_originate_summary(route); + ospf6_abr_originate_summary(route, oa->ospf6); /* purge the old aggregated summary LSA */ - ospf6_abr_originate_summary(range); + ospf6_abr_originate_summary(range, oa->ospf6); } - ospf6_route_remove(range, oa->range_table); + ospf6_route_remove(range, oa->range_table, oa->ospf6); return CMD_SUCCESS; } -void ospf6_area_config_write(struct vty *vty) +void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6) { struct listnode *node; struct ospf6_area *oa; @@ -566,7 +640,9 @@ DEFUN (area_filter_list, struct ospf6_area *area; struct prefix_list *plist; - OSPF6_CMD_AREA_GET(areaid, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(areaid, area, ospf6); plist = prefix_list_lookup(AFI_IP6, plistname); if (strmatch(inout, "in")) { @@ -605,7 +681,8 @@ DEFUN (no_area_filter_list, struct ospf6_area *area; - OSPF6_CMD_AREA_GET(areaid, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + OSPF6_CMD_AREA_GET(areaid, area, ospf6); if (strmatch(inout, "in")) { if (PREFIX_NAME_IN(area)) @@ -629,18 +706,25 @@ DEFUN (no_area_filter_list, void ospf6_area_plist_update(struct prefix_list *plist, int add) { + struct listnode *node, *nnode; struct ospf6_area *oa; struct listnode *n; const char *name = prefix_list_name(plist); + struct ospf6 *ospf6 = NULL; + - if (!ospf6) + if (!om6->ospf6) return; - for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) { - if (PREFIX_NAME_IN(oa) && !strcmp(PREFIX_NAME_IN(oa), name)) - PREFIX_LIST_IN(oa) = add ? plist : NULL; - if (PREFIX_NAME_OUT(oa) && !strcmp(PREFIX_NAME_OUT(oa), name)) - PREFIX_LIST_OUT(oa) = add ? plist : NULL; + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) { + if (PREFIX_NAME_IN(oa) + && !strcmp(PREFIX_NAME_IN(oa), name)) + PREFIX_LIST_IN(oa) = add ? plist : NULL; + if (PREFIX_NAME_OUT(oa) + && !strcmp(PREFIX_NAME_OUT(oa), name)) + PREFIX_LIST_OUT(oa) = add ? plist : NULL; + } } } @@ -658,7 +742,9 @@ DEFUN (area_import_list, struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area, ospf6); list = access_list_lookup(AFI_IP6, argv[idx_name]->arg); @@ -686,7 +772,9 @@ DEFUN (no_area_import_list, int idx_ipv4 = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area, ospf6); IMPORT_LIST(area) = 0; @@ -713,7 +801,9 @@ DEFUN (area_export_list, struct ospf6_area *area; struct access_list *list; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area, ospf6); list = access_list_lookup(AFI_IP6, argv[idx_name]->arg); @@ -741,7 +831,9 @@ DEFUN (no_area_export_list, int idx_ipv4 = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area, ospf6); EXPORT_LIST(area) = 0; @@ -768,9 +860,10 @@ DEFUN (show_ipv6_ospf6_spf_tree, struct ospf6_vertex *root; struct ospf6_route *route; struct prefix prefix; + struct ospf6 *ospf6; - OSPF6_CMD_CHECK_RUNNING(); - + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_linkstate_prefix(ospf6->router_id, htonl(0), &prefix); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { @@ -804,8 +897,11 @@ DEFUN (show_ipv6_ospf6_area_spf_tree, struct ospf6_vertex *root; struct ospf6_route *route; struct prefix prefix; + struct ospf6 *ospf6; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_linkstate_prefix(ospf6->router_id, htonl(0), &prefix); @@ -853,8 +949,11 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, uint32_t router_id; struct ospf6_route_table *spf_table; unsigned char tmp_debug_ospf6_spf = 0; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); - OSPF6_CMD_CHECK_RUNNING(); + OSPF6_CMD_CHECK_RUNNING(ospf6); inet_pton(AF_INET, argv[idx_ipv4]->arg, &router_id); ospf6_linkstate_prefix(router_id, htonl(0), &prefix); @@ -879,15 +978,15 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, route = ospf6_route_lookup(&prefix, spf_table); if (route == NULL) { - ospf6_spf_table_finish(spf_table); - ospf6_route_table_delete(spf_table); + ospf6_spf_table_finish(spf_table, ospf6); + ospf6_route_table_delete(spf_table, ospf6); return CMD_SUCCESS; } root = (struct ospf6_vertex *)route->route_option; ospf6_spf_display_subtree(vty, "", 0, root); - ospf6_spf_table_finish(spf_table); - ospf6_route_table_delete(spf_table); + ospf6_spf_table_finish(spf_table, ospf6); + ospf6_route_table_delete(spf_table, ospf6); return CMD_SUCCESS; } @@ -903,7 +1002,9 @@ DEFUN (ospf6_area_stub, int idx_ipv4_number = 1; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); if (!ospf6_area_stub_set(ospf6, area)) { vty_out(vty, @@ -928,7 +1029,9 @@ DEFUN (ospf6_area_stub_no_summary, int idx_ipv4_number = 1; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); if (!ospf6_area_stub_set(ospf6, area)) { vty_out(vty, @@ -953,7 +1056,9 @@ DEFUN (no_ospf6_area_stub, int idx_ipv4_number = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); ospf6_area_stub_unset(ospf6, area); ospf6_area_no_summary_unset(ospf6, area); @@ -974,7 +1079,9 @@ DEFUN (no_ospf6_area_stub_no_summary, int idx_ipv4_number = 2; struct ospf6_area *area; - OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area, ospf6); ospf6_area_stub_unset(ospf6, area); ospf6_area_no_summary_unset(ospf6, area); @@ -1009,11 +1116,12 @@ void ospf6_area_interface_delete(struct ospf6_interface *oi) { struct ospf6_area *oa; struct listnode *node, *nnode; + struct ospf6 *ospf6; - if (!ospf6) + if (!om6->ospf6) return; - for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa)) - if(listnode_lookup(oa->if_list, oi)) - listnode_delete(oa->if_list, oi); - + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) + for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa)) + if (listnode_lookup(oa->if_list, oi)) + listnode_delete(oa->if_list, oi); } diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index f6287660d6..8a58b2a50e 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -22,6 +22,7 @@ #define OSPF_AREA_H #include "ospf6_top.h" +#include "lib/json.h" struct ospf6_area { /* Reference to Top data structure */ @@ -117,7 +118,7 @@ struct ospf6_area { #define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT)) #define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB)) -#define OSPF6_CMD_AREA_GET(str, oa) \ +#define OSPF6_CMD_AREA_GET(str, oa, ospf6) \ { \ char *ep; \ uint32_t area_id = htonl(strtoul(str, &ep, 10)); \ @@ -138,14 +139,16 @@ extern int ospf6_area_cmp(void *va, void *vb); extern struct ospf6_area *ospf6_area_create(uint32_t, struct ospf6 *, int); extern void ospf6_area_delete(struct ospf6_area *); extern struct ospf6_area *ospf6_area_lookup(uint32_t, struct ospf6 *); +extern struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id); extern void ospf6_area_enable(struct ospf6_area *); extern void ospf6_area_disable(struct ospf6_area *); -extern void ospf6_area_show(struct vty *, struct ospf6_area *); +extern void ospf6_area_show(struct vty *, struct ospf6_area *, + json_object *json_areas, bool use_json); extern void ospf6_area_plist_update(struct prefix_list *plist, int add); -extern void ospf6_area_config_write(struct vty *vty); +extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6); extern void ospf6_area_init(void); struct ospf6_interface; extern void ospf6_area_interface_delete(struct ospf6_interface *oi); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 80a3c1005d..308732c4ee 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -43,9 +43,11 @@ #include "ospf6_interface.h" #include "ospf6_neighbor.h" #include "ospf6_asbr.h" +#include "ospf6_abr.h" #include "ospf6_intra.h" #include "ospf6_flood.h" #include "ospf6d.h" +#include "lib/json.h" static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id); static void ospf6_asbr_redistribute_unset(int type, vrf_id_t vrf_id); @@ -55,7 +57,8 @@ unsigned char conf_debug_ospf6_asbr = 0; #define ZROUTE_NAME(x) zebra_route_string(x) /* AS External LSA origination */ -static void ospf6_as_external_lsa_originate(struct ospf6_route *route) +static void ospf6_as_external_lsa_originate(struct ospf6_route *route, + struct ospf6 *ospf6) { char buffer[OSPF6_MAX_LSASIZE]; struct ospf6_lsa_header *lsa_header; @@ -163,7 +166,8 @@ int ospf6_orig_as_external_lsa(struct thread *thread) type = htons(OSPF6_LSTYPE_AS_EXTERNAL); adv_router = oi->area->ospf6->router_id; - for (ALL_LSDB_TYPED_ADVRTR(ospf6->lsdb, type, adv_router, lsa)) { + for (ALL_LSDB_TYPED_ADVRTR(oi->area->ospf6->lsdb, type, adv_router, + lsa)) { if (IS_OSPF6_DEBUG_ASBR) zlog_debug( "%s: Send update of AS-External LSA %s seq 0x%x", @@ -202,7 +206,8 @@ static route_tag_t ospf6_as_external_lsa_get_tag(struct ospf6_lsa *lsa) } void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, - struct ospf6_route *route) + struct ospf6_route *route, + struct ospf6 *ospf6) { struct ospf6_route *old_route; struct ospf6_path *ecmp_path, *o_path = NULL; @@ -281,8 +286,8 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, * nh_list */ if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add) - (old_route); + (*ospf6->route_table->hook_add)( + old_route, ospf6); if (old_route->path.origin.id == route->path.origin.id @@ -310,7 +315,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, route->path.cost); } ospf6_route_remove(old_route, - ospf6->route_table); + ospf6->route_table, ospf6); } } if (route_updated) @@ -420,7 +425,8 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, /* Update RIB/FIB */ if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add)(old_route); + (*ospf6->route_table->hook_add)(old_route, + ospf6); /* Delete the new route its info added to existing * route. @@ -433,11 +439,11 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, if (!route_found) { /* Add new route to existing node in ospf6 route table. */ - ospf6_route_add(route, ospf6->route_table); + ospf6_route_add(route, ospf6->route_table, ospf6); } } -void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) +void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6) { struct ospf6_as_external_lsa *external; struct prefix asbr_id; @@ -525,14 +531,14 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) old = ospf6_route_lookup(&route->prefix, ospf6->route_table); if (!old) { /* Add the new route to ospf6 instance route table. */ - ospf6_route_add(route, ospf6->route_table); + ospf6_route_add(route, ospf6->route_table, ospf6); } else { /* RFC 2328 16.4 (6) * ECMP: Keep new equal preference path in current * route's path list, update zebra with new effective * list along with addition of ECMP path. */ - ospf6_asbr_update_route_ecmp_path(old, route); + ospf6_asbr_update_route_ecmp_path(old, route, ospf6); } } @@ -542,6 +548,8 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, struct ospf6_as_external_lsa *external; struct prefix prefix; struct ospf6_route *route, *nroute, *route_to_del; + struct ospf6_area *oa = NULL; + struct ospf6 *ospf6; external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END( lsa->header); @@ -549,7 +557,16 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) zlog_debug("Withdraw AS-External route for %s", lsa->name); - if (lsa->header->adv_router == ospf6->router_id) { + ospf6 = ospf6_get_by_lsdb(lsa); + if (ospf6_is_router_abr(ospf6)) + oa = ospf6->backbone; + else + oa = listgetdata(listhead(ospf6->area_list)); + + if (oa == NULL) + return; + + if (lsa->header->adv_router == oa->ospf6->router_id) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) zlog_debug("Ignore self-originated AS-External-LSA"); return; @@ -588,7 +605,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, prefix.prefixlen = external->prefix.prefix_length; ospf6_prefix_in6_addr(&prefix.u.prefix6, external, &external->prefix); - route = ospf6_route_lookup(&prefix, ospf6->route_table); + route = ospf6_route_lookup(&prefix, oa->ospf6->route_table); if (route == NULL) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { zlog_debug("AS-External route %pFX not found", &prefix); @@ -714,9 +731,10 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, /* Update RIB/FIB with effective * nh_list */ - if (ospf6->route_table->hook_add) - (*ospf6->route_table->hook_add) - (route); + if (oa->ospf6->route_table->hook_add) + (*oa->ospf6->route_table + ->hook_add)( + route, oa->ospf6); /* route's primary path is similar * to LSA, replace route's primary @@ -739,8 +757,9 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, h_path->origin.adv_router; } } else { - ospf6_route_remove(route, - ospf6->route_table); + ospf6_route_remove( + route, oa->ospf6->route_table, + oa->ospf6); } } continue; @@ -780,7 +799,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, &route->prefix, route->path.cost, route->path.u.cost_e2, listcount(route->nh_list)); } - ospf6_route_remove(route, ospf6->route_table); + ospf6_route_remove(route, oa->ospf6->route_table, oa->ospf6); } if (route != NULL) ospf6_route_unlock(route); @@ -788,7 +807,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, ospf6_route_delete(route_to_del); } -void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) +void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry, struct ospf6 *ospf6) { struct ospf6_lsa *lsa; uint16_t type; @@ -806,11 +825,12 @@ void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry) router = ospf6_linkstate_prefix_adv_router(&asbr_entry->prefix); for (ALL_LSDB_TYPED_ADVRTR(ospf6->lsdb, type, router, lsa)) { if (!OSPF6_LSA_IS_MAXAGE(lsa)) - ospf6_asbr_lsa_add(lsa); + ospf6_asbr_lsa_add(lsa, ospf6); } } -void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry) +void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry, + struct ospf6 *ospf6) { struct ospf6_lsa *lsa; uint16_t type; @@ -825,8 +845,16 @@ void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry) /* redistribute function */ -static void ospf6_asbr_routemap_set(int type, const char *mapname) +static void ospf6_asbr_routemap_set(int type, const char *mapname, + uint32_t vrf_id) { + struct ospf6 *ospf6 = NULL; + + ospf6 = ospf6_lookup_by_vrf_id(vrf_id); + + if (ospf6 == NULL) + return; + if (ospf6->rmap[type].name) { route_map_counter_decrement(ospf6->rmap[type].map); free(ospf6->rmap[type].name); @@ -836,7 +864,7 @@ static void ospf6_asbr_routemap_set(int type, const char *mapname) route_map_counter_increment(ospf6->rmap[type].map); } -static void ospf6_asbr_routemap_unset(int type) +static void ospf6_asbr_routemap_unset(int type, struct ospf6 *ospf6) { if (ospf6->rmap[type].name) free(ospf6->rmap[type].name); @@ -851,8 +879,10 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread) { void **arg; int arg_type; + struct ospf6 *ospf6; arg = THREAD_ARG(thread); + ospf6 = (struct ospf6 *)arg[0]; arg_type = (int)(intptr_t)arg[1]; ospf6->t_distribute_update = NULL; @@ -874,7 +904,7 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread) return 0; } -void ospf6_asbr_distribute_list_update(int type) +void ospf6_asbr_distribute_list_update(int type, struct ospf6 *ospf6) { void **args = NULL; @@ -899,62 +929,75 @@ void ospf6_asbr_distribute_list_update(int type) static void ospf6_asbr_routemap_update(const char *mapname) { int type; + struct listnode *node, *nnode; + struct ospf6 *ospf6 = NULL; - if (ospf6 == NULL) + if (om6 == NULL) return; - for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { - if (ospf6->rmap[type].name) { + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { + if (ospf6->rmap[type].name == NULL) + continue; ospf6->rmap[type].map = route_map_lookup_by_name( - ospf6->rmap[type].name); + ospf6->rmap[type].name); - if (mapname - && (strcmp(ospf6->rmap[type].name, mapname) == 0)) { - if (ospf6->rmap[type].map) { - if (IS_OSPF6_DEBUG_ASBR) - zlog_debug( + if (mapname == NULL || strcmp(ospf6->rmap[type].name, mapname)) + continue; + if (ospf6->rmap[type].map) { + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug( "%s: route-map %s update, reset redist %s", - __func__, mapname, - ZROUTE_NAME(type)); + __func__, + mapname, + ZROUTE_NAME( + type)); route_map_counter_increment( - ospf6->rmap[type].map); + ospf6->rmap[type].map); - ospf6_asbr_distribute_list_update(type); - } else { - /* - * if the mapname matches a route-map on - * ospf6 but the map doesn't exist, it - * is being deleted. flush and then - * readvertise - */ - if (IS_OSPF6_DEBUG_ASBR) - zlog_debug( + ospf6_asbr_distribute_list_update( + type, ospf6); + } else { + /* + * if the mapname matches a + * route-map on ospf6 but the + * map doesn't exist, it is + * being deleted. flush and then + * readvertise + */ + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug( "%s: route-map %s deleted, reset redist %s", - __func__, mapname, - ZROUTE_NAME(type)); - ospf6_asbr_redistribute_unset( + __func__, + mapname, + ZROUTE_NAME( + type)); + ospf6_asbr_redistribute_unset( type, ospf6->vrf_id); - ospf6_asbr_routemap_set(type, mapname); - ospf6_asbr_redistribute_set( + ospf6_asbr_routemap_set( + type, mapname, + ospf6->vrf_id); + ospf6_asbr_redistribute_set( type, ospf6->vrf_id); - } } - } else - ospf6->rmap[type].map = NULL; + } } } static void ospf6_asbr_routemap_event(const char *name) { int type; + struct listnode *node, *nnode; + struct ospf6 *ospf6; - if (ospf6 == NULL) + if (om6 == NULL) return; - for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { - if ((ospf6->rmap[type].name) - && (strcmp(ospf6->rmap[type].name, name) == 0)) { - ospf6_asbr_distribute_list_update(type); + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { + if ((ospf6->rmap[type].name) + && (strcmp(ospf6->rmap[type].name, name) == 0)) + ospf6_asbr_distribute_list_update(type, ospf6); } } } @@ -973,6 +1016,12 @@ static void ospf6_asbr_redistribute_unset(int type, vrf_id_t vrf_id) { struct ospf6_route *route; struct ospf6_external_info *info; + struct ospf6 *ospf6 = NULL; + + ospf6 = ospf6_lookup_by_vrf_id(vrf_id); + + if (ospf6 == NULL) + return; ospf6_zebra_no_redistribute(type, vrf_id); @@ -982,10 +1031,11 @@ static void ospf6_asbr_redistribute_unset(int type, vrf_id_t vrf_id) if (info->type != type) continue; - ospf6_asbr_redistribute_remove(info->type, 0, &route->prefix); + ospf6_asbr_redistribute_remove(info->type, 0, &route->prefix, + ospf6); } - ospf6_asbr_routemap_unset(type); + ospf6_asbr_routemap_unset(type, ospf6); } /* When an area is unstubified, flood all the external LSAs in the area */ @@ -1005,7 +1055,8 @@ void ospf6_asbr_send_externals_to_area(struct ospf6_area *oa) void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct prefix *prefix, unsigned int nexthop_num, - struct in6_addr *nexthop, route_tag_t tag) + struct in6_addr *nexthop, route_tag_t tag, + struct ospf6 *ospf6) { route_map_result_t ret; struct ospf6_route troute; @@ -1045,13 +1096,13 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, tinfo.ifindex = ifindex; tinfo.tag = tag; - ret = route_map_apply(ospf6->rmap[type].map, prefix, RMAP_OSPF6, - &troute); + ret = route_map_apply(ospf6->rmap[type].map, prefix, &troute); if (ret == RMAP_DENYMATCH) { if (IS_OSPF6_DEBUG_ASBR) zlog_debug("Denied by route-map \"%s\"", ospf6->rmap[type].name); - ospf6_asbr_redistribute_remove(type, ifindex, prefix); + ospf6_asbr_redistribute_remove(type, ifindex, prefix, + ospf6); return; } } @@ -1098,7 +1149,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, } match->path.origin.id = htonl(info->id); - ospf6_as_external_lsa_originate(match); + ospf6_as_external_lsa_originate(match, ospf6); return; } @@ -1140,7 +1191,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, node = route_node_get(ospf6->external_id_table, &prefix_id); node->info = route; - route = ospf6_route_add(route, ospf6->external_table); + route = ospf6_route_add(route, ospf6->external_table, ospf6); route->route_option = info; if (IS_OSPF6_DEBUG_ASBR) { @@ -1151,7 +1202,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, } route->path.origin.id = htonl(info->id); - ospf6_as_external_lsa_originate(route); + ospf6_as_external_lsa_originate(route, ospf6); /* Router-Bit (ASBR Flag) may have to be updated */ for (ALL_LIST_ELEMENTS(ospf6->area_list, lnode, lnnode, oa)) @@ -1159,7 +1210,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, } void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, - struct prefix *prefix) + struct prefix *prefix, struct ospf6 *ospf6) { struct ospf6_route *match; struct ospf6_external_info *info = NULL; @@ -1206,7 +1257,7 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, route_unlock_node(node); /* to free the lookup lock */ route_unlock_node(node); /* to free the original lock */ - ospf6_route_remove(match, ospf6->external_table); + ospf6_route_remove(match, ospf6->external_table, ospf6); XFREE(MTYPE_OSPF6_EXTERNAL_INFO, info); /* Router-Bit (ASBR Flag) may have to be updated */ @@ -1222,8 +1273,8 @@ DEFUN (ospf6_redistribute, { int type; - OSPF6_CMD_CHECK_RUNNING(); - + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + OSPF6_CMD_CHECK_RUNNING(ospf6); char *proto = argv[argc - 1]->text; type = proto_redistnum(AFI_IP6, proto); if (type < 0) @@ -1246,7 +1297,8 @@ DEFUN (ospf6_redistribute_routemap, int idx_word = 3; int type; - OSPF6_CMD_CHECK_RUNNING(); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + OSPF6_CMD_CHECK_RUNNING(ospf6); char *proto = argv[idx_protocol]->text; type = proto_redistnum(AFI_IP6, proto); @@ -1254,7 +1306,7 @@ DEFUN (ospf6_redistribute_routemap, return CMD_WARNING_CONFIG_FAILED; ospf6_asbr_redistribute_unset(type, ospf6->vrf_id); - ospf6_asbr_routemap_set(type, argv[idx_word]->arg); + ospf6_asbr_routemap_set(type, argv[idx_word]->arg, ospf6->vrf_id); ospf6_asbr_redistribute_set(type, ospf6->vrf_id); return CMD_SUCCESS; } @@ -1271,7 +1323,9 @@ DEFUN (no_ospf6_redistribute, int idx_protocol = 2; int type; - OSPF6_CMD_CHECK_RUNNING(); + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + + OSPF6_CMD_CHECK_RUNNING(ospf6); char *proto = argv[idx_protocol]->text; type = proto_redistnum(AFI_IP6, proto); @@ -1283,7 +1337,7 @@ DEFUN (no_ospf6_redistribute, return CMD_SUCCESS; } -int ospf6_redistribute_config_write(struct vty *vty) +int ospf6_redistribute_config_write(struct vty *vty, struct ospf6 *ospf6) { int type; @@ -1303,13 +1357,16 @@ int ospf6_redistribute_config_write(struct vty *vty) return 0; } -static void ospf6_redistribute_show_config(struct vty *vty) +static void ospf6_redistribute_show_config(struct vty *vty, struct ospf6 *ospf6, + json_object *json_array, + json_object *json, bool use_json) { int type; int nroute[ZEBRA_ROUTE_MAX]; int total; struct ospf6_route *route; struct ospf6_external_info *info; + json_object *json_route; total = 0; for (type = 0; type < ZEBRA_ROUTE_MAX; type++) @@ -1321,24 +1378,57 @@ static void ospf6_redistribute_show_config(struct vty *vty) total++; } - vty_out(vty, "Redistributing External Routes from:\n"); + if (use_json) + json_route = json_object_new_object(); + else + vty_out(vty, "Redistributing External Routes from:\n"); + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { if (type == ZEBRA_ROUTE_OSPF6) continue; if (!ospf6_zebra_is_redistribute(type, ospf6->vrf_id)) continue; - if (ospf6->rmap[type].name) - vty_out(vty, " %d: %s with route-map \"%s\"%s\n", - nroute[type], ZROUTE_NAME(type), - ospf6->rmap[type].name, - (ospf6->rmap[type].map ? "" - : " (not found !)")); - else - vty_out(vty, " %d: %s\n", nroute[type], - ZROUTE_NAME(type)); + if (use_json) { + json_object_string_add(json_route, "routeType", + ZROUTE_NAME(type)); + json_object_int_add(json_route, "numberOfRoutes", + nroute[type]); + json_object_boolean_add(json_route, + "routeMapNamePresent", + ospf6->rmap[type].name); + } + + if (ospf6->rmap[type].name) { + if (use_json) { + json_object_string_add(json_route, + "routeMapName", + ospf6->rmap[type].name); + json_object_boolean_add(json_route, + "routeMapFound", + ospf6->rmap[type].map); + } else + vty_out(vty, + " %d: %s with route-map \"%s\"%s\n", + nroute[type], ZROUTE_NAME(type), + ospf6->rmap[type].name, + (ospf6->rmap[type].map + ? "" + : " (not found !)")); + } else { + if (!use_json) + vty_out(vty, " %d: %s\n", nroute[type], + ZROUTE_NAME(type)); + } + + if (use_json) + json_object_array_add(json_array, json_route); } - vty_out(vty, "Total %d routes\n", total); + if (use_json) { + json_object_object_add(json, "redistributedRoutes", json_array); + json_object_int_add(json, "totalRoutes", total); + } else + vty_out(vty, "Total %d routes\n", total); } @@ -1346,14 +1436,11 @@ static void ospf6_redistribute_show_config(struct vty *vty) static enum route_map_cmd_result_t ospf6_routemap_rule_match_address_prefixlist(void *rule, const struct prefix *prefix, - route_map_object_t type, + void *object) { struct prefix_list *plist; - if (type != RMAP_OSPF6) - return RMAP_NOMATCH; - plist = prefix_list_lookup(AFI_IP6, (char *)rule); if (plist == NULL) return RMAP_NOMATCH; @@ -1386,18 +1473,16 @@ static const struct route_map_rule_cmd zero. */ static enum route_map_cmd_result_t ospf6_routemap_rule_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct interface *ifp; struct ospf6_external_info *ei; - if (type == RMAP_OSPF6) { - ei = ((struct ospf6_route *)object)->route_option; - ifp = if_lookup_by_name_all_vrf((char *)rule); + ei = ((struct ospf6_route *)object)->route_option; + ifp = if_lookup_by_name_all_vrf((char *)rule); - if (ifp != NULL && ei->ifindex == ifp->ifindex) - return RMAP_MATCH; - } + if (ifp != NULL && ei->ifindex == ifp->ifindex) + return RMAP_MATCH; return RMAP_NOMATCH; } @@ -1426,14 +1511,13 @@ static const struct route_map_rule_cmd /* Match function for matching route tags */ static enum route_map_cmd_result_t -ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p, void *object) { route_tag_t *tag = rule; struct ospf6_route *route = object; struct ospf6_external_info *info = route->route_option; - if (type == RMAP_OSPF6 && info->tag == *tag) + if (info->tag == *tag) return RMAP_MATCH; return RMAP_NOMATCH; @@ -1449,14 +1533,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t ospf6_routemap_rule_set_metric_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { char *metric_type = rule; struct ospf6_route *route = object; - if (type != RMAP_OSPF6) - return RMAP_OKAY; - if (strcmp(metric_type, "type-2") == 0) route->path.metric_type = 2; else @@ -1487,14 +1568,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t ospf6_routemap_rule_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { char *metric = rule; struct ospf6_route *route = object; - if (type != RMAP_OSPF6) - return RMAP_OKAY; - route->path.cost = atoi(metric); return RMAP_OKAY; } @@ -1524,15 +1602,12 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t ospf6_routemap_rule_set_forwarding(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { char *forwarding = rule; struct ospf6_route *route = object; struct ospf6_external_info *info = route->route_option; - if (type != RMAP_OSPF6) - return RMAP_OKAY; - if (inet_pton(AF_INET6, forwarding, &info->forwarding) != 1) { memset(&info->forwarding, 0, sizeof(struct in6_addr)); return RMAP_ERROR; @@ -1563,16 +1638,12 @@ static const struct route_map_rule_cmd }; static enum route_map_cmd_result_t -ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p, void *object) { route_tag_t *tag = rule; struct ospf6_route *route = object; struct ospf6_external_info *info = route->route_option; - if (type != RMAP_OSPF6) - return RMAP_OKAY; - info->tag = *tag; return RMAP_OKAY; } @@ -1797,12 +1868,17 @@ static int ospf6_as_external_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) } static void ospf6_asbr_external_route_show(struct vty *vty, - struct ospf6_route *route) + struct ospf6_route *route, + json_object *json_array, + bool use_json) { struct ospf6_external_info *info = route->route_option; - char id[16], forwarding[64]; + char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64]; uint32_t tmp_id; + json_object *json_route; + char route_type[2]; + prefix2str(&route->prefix, prefix, sizeof(prefix)); tmp_id = ntohl(info->id); inet_ntop(AF_INET, &tmp_id, id, sizeof(id)); if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding)) @@ -1812,34 +1888,74 @@ static void ospf6_asbr_external_route_show(struct vty *vty, snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)", ospf6_route_get_first_nh_index(route)); - vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n", - zebra_route_char(info->type), &route->prefix, id, - route->path.metric_type, - (unsigned long)(route->path.metric_type == 2 - ? route->path.u.cost_e2 - : route->path.cost), - forwarding); + if (use_json) { + json_route = json_object_new_object(); + snprintf(route_type, sizeof(route_type), "%c", + zebra_route_char(info->type)); + json_object_string_add(json_route, "routeType", route_type); + json_object_string_add(json_route, "destination", prefix); + json_object_string_add(json_route, "id", id); + json_object_int_add(json_route, "metricType", + route->path.metric_type); + json_object_int_add( + json_route, "routeCost", + (unsigned long)(route->path.metric_type == 2 + ? route->path.u.cost_e2 + : route->path.cost)); + json_object_string_add(json_route, "forwarding", forwarding); + + json_object_array_add(json_array, json_route); + } else + + vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n", + zebra_route_char(info->type), &route->prefix, id, + route->path.metric_type, + (unsigned long)(route->path.metric_type == 2 + ? route->path.u.cost_e2 + : route->path.cost), + forwarding); } DEFUN (show_ipv6_ospf6_redistribute, show_ipv6_ospf6_redistribute_cmd, - "show ipv6 ospf6 redistribute", + "show ipv6 ospf6 redistribute [json]", SHOW_STR IP6_STR OSPF6_STR "redistributing External information\n" - ) + JSON_STR) { struct ospf6_route *route; - - OSPF6_CMD_CHECK_RUNNING(); - - ospf6_redistribute_show_config(vty); + struct ospf6 *ospf6 = NULL; + json_object *json = NULL; + bool uj = use_json(argc, argv); + json_object *json_array_routes = NULL; + json_object *json_array_redistribute = NULL; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); + + if (uj) { + json = json_object_new_object(); + json_array_routes = json_object_new_array(); + json_array_redistribute = json_object_new_array(); + } + ospf6_redistribute_show_config(vty, ospf6, json_array_redistribute, + json, uj); for (route = ospf6_route_head(ospf6->external_table); route; - route = ospf6_route_next(route)) - ospf6_asbr_external_route_show(vty, route); + route = ospf6_route_next(route)) { + ospf6_asbr_external_route_show(vty, route, json_array_routes, + uj); + } + if (uj) { + json_object_object_add(json, "routes", json_array_routes); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index 41b1ac70e9..46c99706ac 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -70,22 +70,26 @@ struct ospf6_as_external_lsa { (E)->bits_metric |= htonl(0x00ffffff) & htonl(C); \ } -extern void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa); +extern void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6); extern void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, struct ospf6_route *asbr_entry); -extern void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry); -extern void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry); +extern void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry, + struct ospf6 *ospf6); +extern void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry, + struct ospf6 *ospf6); extern int ospf6_asbr_is_asbr(struct ospf6 *o); extern void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct prefix *prefix, unsigned int nexthop_num, struct in6_addr *nexthop, - route_tag_t tag); + route_tag_t tag, struct ospf6 *ospf6); extern void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, - struct prefix *prefix); + struct prefix *prefix, + struct ospf6 *ospf6); -extern int ospf6_redistribute_config_write(struct vty *vty); +extern int ospf6_redistribute_config_write(struct vty *vty, + struct ospf6 *ospf6); extern void ospf6_asbr_init(void); extern void ospf6_asbr_redistribute_reset(vrf_id_t vrf_id); @@ -95,7 +99,8 @@ extern void ospf6_asbr_send_externals_to_area(struct ospf6_area *); extern int config_write_ospf6_debug_asbr(struct vty *vty); extern void install_element_ospf6_debug_asbr(void); extern void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, - struct ospf6_route *route); -extern void ospf6_asbr_distribute_list_update(int type); + struct ospf6_route *route, + struct ospf6 *ospf6); +extern void ospf6_asbr_distribute_list_update(int type, struct ospf6 *ospf6); #endif /* OSPF6_ASBR_H */ diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 4e50ab5244..a701583621 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -55,12 +55,13 @@ void ospf6_bfd_info_free(void **bfd_info) /* * ospf6_bfd_show_info - Show BFD info structure */ -void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only) +void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only, + json_object *json_obj, bool use_json) { if (param_only) - bfd_show_param(vty, bfd_info, 1, 0, 0, NULL); + bfd_show_param(vty, bfd_info, 1, 0, use_json, json_obj); else - bfd_show_info(vty, bfd_info, 0, 1, 0, NULL); + bfd_show_info(vty, bfd_info, 0, 1, use_json, json_obj); } /* diff --git a/ospf6d/ospf6_bfd.h b/ospf6d/ospf6_bfd.h index 19dff1ff7c..ddf624efce 100644 --- a/ospf6d/ospf6_bfd.h +++ b/ospf6d/ospf6_bfd.h @@ -19,9 +19,10 @@ * with this program; see the file COPYING; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - +#include "lib/json.h" #ifndef OSPF6_BFD_H #define OSPF6_BFD_H +#include "lib/json.h" extern void ospf6_bfd_init(void); @@ -35,8 +36,8 @@ extern void ospf6_bfd_info_nbr_create(struct ospf6_interface *oi, extern void ospf6_bfd_info_free(void **bfd_info); -extern void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, - int param_only); +extern void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only, + json_object *json_obj, bool use_json); extern void ospf6_bfd_reg_dereg_nbr(struct ospf6_neighbor *on, int command); #endif /* OSPF6_BFD_H */ diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 56aac0f21f..0662cfd683 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -370,7 +370,7 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, continue; } - if (ospf6->inst_shutdown) { + if (oi->area->ospf6->inst_shutdown) { if (is_debug) zlog_debug( "%s: Send LSA %s (age %d) update now", @@ -486,6 +486,12 @@ static void ospf6_flood_process(struct ospf6_neighbor *from, void ospf6_flood(struct ospf6_neighbor *from, struct ospf6_lsa *lsa) { + struct ospf6 *ospf6; + + ospf6 = ospf6_get_by_lsdb(lsa); + if (ospf6 == NULL) + return; + ospf6_flood_process(from, lsa, ospf6); } @@ -555,6 +561,9 @@ static void ospf6_flood_clear_process(struct ospf6_lsa *lsa, void ospf6_flood_clear(struct ospf6_lsa *lsa) { + struct ospf6 *ospf6; + + ospf6 = ospf6_get_by_lsdb(lsa); ospf6_flood_clear_process(lsa, ospf6); } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a724157737..89b36d48a8 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -43,6 +43,7 @@ #include "ospf6d.h" #include "ospf6_bfd.h" #include "ospf6_zebra.h" +#include "lib/json.h" DEFINE_MTYPE_STATIC(OSPF6D, CFG_PLIST_NAME, "configured prefix list names") DEFINE_QOBJ_TYPE(ospf6_interface) @@ -118,7 +119,7 @@ static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi) /* If all else fails, use default OSPF cost */ uint32_t cost; uint32_t bw, refbw; - + struct ospf6 *ospf6; /* interface speed and bw can be 0 in some platforms, * use ospf default bw. If bw is configured then it would * be used. @@ -130,6 +131,7 @@ static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi) : OSPF6_INTERFACE_BANDWIDTH; } + ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id); refbw = ospf6 ? ospf6->ref_bandwidth : OSPF6_REFERENCE_BANDWIDTH; /* A specifed ip ospf cost overrides a calculated one. */ @@ -259,7 +261,7 @@ void ospf6_interface_delete(struct ospf6_interface *oi) ospf6_lsdb_delete(oi->lsupdate_list); ospf6_lsdb_delete(oi->lsack_list); - ospf6_route_table_delete(oi->route_connected); + ospf6_route_table_delete(oi->route_connected, oi->area->ospf6); /* cut link */ oi->interface->info = NULL; @@ -415,7 +417,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp) return; /* update "route to advertise" interface route table */ - ospf6_route_remove_all(oi->route_connected); + ospf6_route_remove_all(oi->route_connected, oi->area->ospf6); for (ALL_LIST_ELEMENTS(oi->interface->connected, node, nnode, c)) { if (c->address->family != AF_INET6) @@ -459,7 +461,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp) inet_pton(AF_INET6, "::1", &nh_addr); ospf6_route_add_nexthop(route, oi->interface->ifindex, &nh_addr); - ospf6_route_add(route, oi->route_connected); + ospf6_route_add(route, oi->route_connected, oi->area->ospf6); } /* create new Link-LSA */ @@ -472,6 +474,7 @@ static void ospf6_interface_state_change(uint8_t next_state, struct ospf6_interface *oi) { uint8_t prev_state; + struct ospf6 *ospf6; prev_state = oi->state; oi->state = next_state; @@ -487,20 +490,21 @@ static void ospf6_interface_state_change(uint8_t next_state, ospf6_interface_state_str[next_state]); } oi->state_change++; + ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id); if ((prev_state == OSPF6_INTERFACE_DR || prev_state == OSPF6_INTERFACE_BDR) && (next_state != OSPF6_INTERFACE_DR && next_state != OSPF6_INTERFACE_BDR)) ospf6_sso(oi->interface->ifindex, &alldrouters6, - IPV6_LEAVE_GROUP); + IPV6_LEAVE_GROUP, ospf6->fd); if ((prev_state != OSPF6_INTERFACE_DR && prev_state != OSPF6_INTERFACE_BDR) && (next_state == OSPF6_INTERFACE_DR || next_state == OSPF6_INTERFACE_BDR)) ospf6_sso(oi->interface->ifindex, &alldrouters6, - IPV6_JOIN_GROUP); + IPV6_JOIN_GROUP, ospf6->fd); OSPF6_ROUTER_LSA_SCHEDULE(oi->area); if (next_state == OSPF6_INTERFACE_DOWN) { @@ -677,6 +681,7 @@ static uint8_t dr_election(struct ospf6_interface *oi) int interface_up(struct thread *thread) { struct ospf6_interface *oi; + struct ospf6 *ospf6; oi = (struct ospf6_interface *)THREAD_ARG(thread); assert(oi && oi->interface); @@ -747,9 +752,14 @@ int interface_up(struct thread *thread) return 0; } #endif /* __FreeBSD__ */ + if (oi->area->ospf6) + ospf6 = oi->area->ospf6; + else + ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id); /* Join AllSPFRouters */ - if (ospf6_sso(oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP) + if (ospf6_sso(oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP, + ospf6->fd) < 0) { if (oi->sso_try_cnt++ < OSPF6_INTERFACE_SSO_RETRY_MAX) { zlog_info( @@ -846,6 +856,7 @@ int interface_down(struct thread *thread) struct ospf6_interface *oi; struct listnode *node, *nnode; struct ospf6_neighbor *on; + struct ospf6 *ospf6; oi = (struct ospf6_interface *)THREAD_ARG(thread); assert(oi && oi->interface); @@ -859,11 +870,11 @@ int interface_down(struct thread *thread) /* Stop trying to set socket options. */ THREAD_OFF(oi->thread_sso); - + ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id); /* Leave AllSPFRouters */ if (oi->state > OSPF6_INTERFACE_DOWN) ospf6_sso(oi->interface->ifindex, &allspfrouters6, - IPV6_LEAVE_GROUP); + IPV6_LEAVE_GROUP, ospf6->fd); ospf6_interface_state_change(OSPF6_INTERFACE_DOWN, oi); @@ -894,7 +905,8 @@ static const char *ospf6_iftype_str(uint8_t iftype) } /* show specified interface structure */ -static int ospf6_interface_show(struct vty *vty, struct interface *ifp) +static int ospf6_interface_show(struct vty *vty, struct interface *ifp, + json_object *json_obj, bool use_json) { struct ospf6_interface *oi; struct connected *c; @@ -905,116 +917,299 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp) struct timeval res, now; char duration[32]; struct ospf6_lsa *lsa, *lsanext; + json_object *json_arr; + json_object *json_addr; default_iftype = ospf6_default_iftype(ifp); - vty_out(vty, "%s is %s, type %s\n", ifp->name, - (if_is_operative(ifp) ? "up" : "down"), - ospf6_iftype_str(default_iftype)); - vty_out(vty, " Interface ID: %d\n", ifp->ifindex); + if (use_json) { + json_object_string_add(json_obj, "status", + (if_is_operative(ifp) ? "up" : "down")); + json_object_string_add(json_obj, "type", + ospf6_iftype_str(default_iftype)); + json_object_int_add(json_obj, "interfaceId", ifp->ifindex); + + if (ifp->info == NULL) { + json_object_boolean_false_add(json_obj, "ospf6Enabled"); + return 0; + } + json_object_boolean_true_add(json_obj, "ospf6Enabled"); - if (ifp->info == NULL) { - vty_out(vty, " OSPF not enabled on this interface\n"); - return 0; - } else oi = (struct ospf6_interface *)ifp->info; - if (if_is_operative(ifp) && oi->type != default_iftype) - vty_out(vty, " Operating as type %s\n", - ospf6_iftype_str(oi->type)); - - vty_out(vty, " Internet Address:\n"); - - for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) { - p = c->address; - switch (p->family) { - case AF_INET: - vty_out(vty, " inet : %pFX\n", p); - break; - case AF_INET6: - vty_out(vty, " inet6: %pFX\n", p); - break; - default: - vty_out(vty, " ??? : %pFX\n", p); - break; + if (if_is_operative(ifp) && oi->type != default_iftype) + json_object_string_add(json_obj, "operatingAsType", + ospf6_iftype_str(oi->type)); + + } else { + vty_out(vty, "%s is %s, type %s\n", ifp->name, + (if_is_operative(ifp) ? "up" : "down"), + ospf6_iftype_str(default_iftype)); + vty_out(vty, " Interface ID: %d\n", ifp->ifindex); + + if (ifp->info == NULL) { + vty_out(vty, " OSPF not enabled on this interface\n"); + return 0; } + oi = (struct ospf6_interface *)ifp->info; + + if (if_is_operative(ifp) && oi->type != default_iftype) + vty_out(vty, " Operating as type %s\n", + ospf6_iftype_str(oi->type)); } - if (oi->area) { - vty_out(vty, - " Instance ID %d, Interface MTU %d (autodetect: %d)\n", - oi->instance_id, oi->ifmtu, ifp->mtu6); - vty_out(vty, " MTU mismatch detection: %s\n", - oi->mtu_ignore ? "disabled" : "enabled"); - inet_ntop(AF_INET, &oi->area->area_id, strbuf, sizeof(strbuf)); - vty_out(vty, " Area ID %s, Cost %u\n", strbuf, oi->cost); - } else - vty_out(vty, " Not Attached to Area\n"); + if (use_json) { + json_arr = json_object_new_array(); + for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) { + json_addr = json_object_new_object(); + p = c->address; + prefix2str(p, strbuf, sizeof(strbuf)); + switch (p->family) { + case AF_INET: + json_object_string_add(json_addr, "type", + "inet"); + json_object_string_add(json_addr, "address", + strbuf); + json_object_array_add(json_arr, json_addr); + break; + case AF_INET6: + json_object_string_add(json_addr, "type", + "inet6"); + json_object_string_add(json_addr, "address", + strbuf); + json_object_array_add(json_arr, json_addr); + break; + default: + json_object_string_add(json_addr, "type", + "unknown"); + json_object_string_add(json_addr, "address", + strbuf); + json_object_array_add(json_arr, json_addr); + break; + } + } + json_object_object_add(json_obj, "internetAddress", json_arr); + } else { + vty_out(vty, " Internet Address:\n"); + + for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) { + p = c->address; + prefix2str(p, strbuf, sizeof(strbuf)); + switch (p->family) { + case AF_INET: + vty_out(vty, " inet : %pFX\n", p); + break; + case AF_INET6: + vty_out(vty, " inet6: %pFX\n", p); + break; + default: + vty_out(vty, " ??? : %pFX\n", p); + break; + } + } + } - vty_out(vty, " State %s, Transmit Delay %d sec, Priority %d\n", - ospf6_interface_state_str[oi->state], oi->transdelay, - oi->priority); - vty_out(vty, " Timer intervals configured:\n"); - vty_out(vty, " Hello %d, Dead %d, Retransmit %d\n", - oi->hello_interval, oi->dead_interval, oi->rxmt_interval); + if (use_json) { + if (oi->area) { + json_object_boolean_true_add(json_obj, + "attachedToArea"); + json_object_int_add(json_obj, "instanceId", + oi->instance_id); + json_object_int_add(json_obj, "interfaceMtu", + oi->ifmtu); + json_object_int_add(json_obj, "autoDetect", ifp->mtu6); + json_object_string_add(json_obj, "mtuMismatchDetection", + oi->mtu_ignore ? "disabled" + : "enabled"); + inet_ntop(AF_INET, &oi->area->area_id, strbuf, + sizeof(strbuf)); + json_object_string_add(json_obj, "areaId", strbuf); + json_object_int_add(json_obj, "cost", oi->cost); + } else + json_object_boolean_false_add(json_obj, + "attachedToArea"); + + } else { + if (oi->area) { + vty_out(vty, + " Instance ID %d, Interface MTU %d (autodetect: %d)\n", + oi->instance_id, oi->ifmtu, ifp->mtu6); + vty_out(vty, " MTU mismatch detection: %s\n", + oi->mtu_ignore ? "disabled" : "enabled"); + inet_ntop(AF_INET, &oi->area->area_id, strbuf, + sizeof(strbuf)); + vty_out(vty, " Area ID %s, Cost %u\n", strbuf, + oi->cost); + } else + vty_out(vty, " Not Attached to Area\n"); + } + + if (use_json) { + json_object_string_add(json_obj, "ospf6InterfaceState", + ospf6_interface_state_str[oi->state]); + json_object_int_add(json_obj, "transmitDelaySec", + oi->transdelay); + json_object_int_add(json_obj, "priority", oi->priority); + json_object_int_add(json_obj, "timerIntervalsConfigHello", + oi->hello_interval); + json_object_int_add(json_obj, "timerIntervalsConfigDead", + oi->dead_interval); + json_object_int_add(json_obj, "timerIntervalsConfigRetransmit", + oi->rxmt_interval); + } else { + vty_out(vty, " State %s, Transmit Delay %d sec, Priority %d\n", + ospf6_interface_state_str[oi->state], oi->transdelay, + oi->priority); + vty_out(vty, " Timer intervals configured:\n"); + vty_out(vty, " Hello %d, Dead %d, Retransmit %d\n", + oi->hello_interval, oi->dead_interval, + oi->rxmt_interval); + } inet_ntop(AF_INET, &oi->drouter, drouter, sizeof(drouter)); inet_ntop(AF_INET, &oi->bdrouter, bdrouter, sizeof(bdrouter)); - vty_out(vty, " DR: %s BDR: %s\n", drouter, bdrouter); - - vty_out(vty, " Number of I/F scoped LSAs is %u\n", oi->lsdb->count); + if (use_json) { + json_object_string_add(json_obj, "dr", drouter); + json_object_string_add(json_obj, "bdr", bdrouter); + json_object_int_add(json_obj, "numberOfInterfaceScopedLsa", + oi->lsdb->count); + } else { + vty_out(vty, " DR: %s BDR: %s\n", drouter, bdrouter); + vty_out(vty, " Number of I/F scoped LSAs is %u\n", + oi->lsdb->count); + } monotime(&now); - timerclear(&res); - if (oi->thread_send_lsupdate) - timersub(&oi->thread_send_lsupdate->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, - " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", - oi->lsupdate_list->count, duration, - (oi->thread_send_lsupdate ? "on" : "off")); - for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - timerclear(&res); - if (oi->thread_send_lsack) - timersub(&oi->thread_send_lsack->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n", - oi->lsack_list->count, duration, - (oi->thread_send_lsack ? "on" : "off")); - for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - ospf6_bfd_show_info(vty, oi->bfd_info, 1); + if (use_json) { + timerclear(&res); + if (oi->thread_send_lsupdate) + timersub(&oi->thread_send_lsupdate->u.sands, &now, + &res); + timerstring(&res, duration, sizeof(duration)); + json_object_int_add(json_obj, "pendingLsaLsUpdateCount", + oi->lsupdate_list->count); + json_object_string_add(json_obj, "pendingLsaLsUpdateTime", + duration); + json_object_string_add( + json_obj, "lsUpdateSendThread", + (oi->thread_send_lsupdate ? "on" : "off")); + + json_arr = json_object_new_array(); + for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) + json_object_array_add( + json_arr, json_object_new_string(lsa->name)); + json_object_object_add(json_obj, "pendingLsaLsUpdate", + json_arr); + + timerclear(&res); + if (oi->thread_send_lsack) + timersub(&oi->thread_send_lsack->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + + json_object_int_add(json_obj, "pendingLsaLsAckCount", + oi->lsack_list->count); + json_object_string_add(json_obj, "pendingLsaLsAckTime", + duration); + json_object_string_add(json_obj, "lsAckSendThread", + (oi->thread_send_lsack ? "on" : "off")); + + json_arr = json_object_new_array(); + for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) + json_object_array_add( + json_arr, json_object_new_string(lsa->name)); + json_object_object_add(json_obj, "pendingLsaLsAck", json_arr); + + } else { + timerclear(&res); + if (oi->thread_send_lsupdate) + timersub(&oi->thread_send_lsupdate->u.sands, &now, + &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", + oi->lsupdate_list->count, duration, + (oi->thread_send_lsupdate ? "on" : "off")); + for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + timerclear(&res); + if (oi->thread_send_lsack) + timersub(&oi->thread_send_lsack->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for LSAck in Time %s [thread %s]\n", + oi->lsack_list->count, duration, + (oi->thread_send_lsack ? "on" : "off")); + for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + } + ospf6_bfd_show_info(vty, oi->bfd_info, 1, json_obj, use_json); return 0; } /* show interface */ -DEFUN (show_ipv6_ospf6_interface, - show_ipv6_ospf6_interface_ifname_cmd, - "show ipv6 ospf6 interface [IFNAME]", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - IFNAME_STR) +DEFUN(show_ipv6_ospf6_interface, + show_ipv6_ospf6_interface_ifname_cmd, + "show ipv6 ospf6 interface [IFNAME] [json]", + SHOW_STR + IP6_STR + OSPF6_STR + INTERFACE_STR + IFNAME_STR + JSON_STR) { struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); int idx_ifname = 4; struct interface *ifp; - - if (argc == 5) { - ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); - if (ifp == NULL) { - vty_out(vty, "No such Interface: %s\n", - argv[idx_ifname]->arg); - return CMD_WARNING; + json_object *json; + json_object *json_int; + bool uj = use_json(argc, argv); + + if (uj) { + json = json_object_new_object(); + if (argc == 6) { + ifp = if_lookup_by_name(argv[idx_ifname]->arg, + VRF_DEFAULT); + json_int = json_object_new_object(); + if (ifp == NULL) { + json_object_string_add(json, "noSuchInterface", + argv[idx_ifname]->arg); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + json_object_free(json_int); + return CMD_WARNING; + } + ospf6_interface_show(vty, ifp, json_int, uj); + json_object_object_add(json, ifp->name, json_int); + } else { + FOR_ALL_INTERFACES (vrf, ifp) { + json_int = json_object_new_object(); + ospf6_interface_show(vty, ifp, json_int, uj); + json_object_object_add(json, ifp->name, + json_int); + } } - ospf6_interface_show(vty, ifp); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); } else { - FOR_ALL_INTERFACES (vrf, ifp) - ospf6_interface_show(vty, ifp); + if (argc == 5) { + ifp = if_lookup_by_name(argv[idx_ifname]->arg, + VRF_DEFAULT); + if (ifp == NULL) { + vty_out(vty, "No such Interface: %s\n", + argv[idx_ifname]->arg); + return CMD_WARNING; + } + ospf6_interface_show(vty, ifp, NULL, uj); + } else { + FOR_ALL_INTERFACES (vrf, ifp) + ospf6_interface_show(vty, ifp, NULL, uj); + } } return CMD_SUCCESS; @@ -1022,18 +1217,20 @@ DEFUN (show_ipv6_ospf6_interface, static int ospf6_interface_show_traffic(struct vty *vty, struct interface *intf_ifp, - int display_once) + int display_once, json_object *json, + bool use_json) { struct interface *ifp; struct vrf *vrf = NULL; struct ospf6_interface *oi = NULL; + json_object *json_interface; if (intf_ifp) vrf = vrf_lookup_by_id(intf_ifp->vrf_id); else vrf = vrf_lookup_by_id(VRF_DEFAULT); - if (!display_once) { + if (!display_once && !use_json) { vty_out(vty, "\n"); vty_out(vty, "%-12s%-17s%-17s%-17s%-17s%-17s\n", "Interface", " HELLO", " DB-Desc", " LS-Req", " LS-Update", @@ -1052,61 +1249,158 @@ static int ospf6_interface_show_traffic(struct vty *vty, else continue; - vty_out(vty, - "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", - oi->interface->name, oi->hello_in, - oi->hello_out, oi->db_desc_in, oi->db_desc_out, - oi->ls_req_in, oi->ls_req_out, oi->ls_upd_in, - oi->ls_upd_out, oi->ls_ack_in, oi->ls_ack_out); + if (use_json) { + json_interface = json_object_new_object(); + json_object_int_add(json_interface, "helloRx", + oi->hello_in); + json_object_int_add(json_interface, "helloTx", + oi->hello_out); + json_object_int_add(json_interface, "dbDescRx", + oi->db_desc_in); + json_object_int_add(json_interface, "dbDescTx", + oi->db_desc_out); + json_object_int_add(json_interface, "lsReqRx", + oi->ls_req_in); + json_object_int_add(json_interface, "lsReqTx", + oi->ls_req_out); + json_object_int_add(json_interface, + "lsUpdateRx", + oi->ls_upd_in); + json_object_int_add(json_interface, + "lsUpdateTx", + oi->ls_upd_out); + json_object_int_add(json_interface, "lsAckRx", + oi->ls_ack_in); + json_object_int_add(json_interface, "lsAckTx", + oi->ls_ack_out); + + json_object_object_add(json, + oi->interface->name, + json_interface); + } else + vty_out(vty, + "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", + oi->interface->name, oi->hello_in, + oi->hello_out, oi->db_desc_in, + oi->db_desc_out, oi->ls_req_in, + oi->ls_req_out, oi->ls_upd_in, + oi->ls_upd_out, oi->ls_ack_in, + oi->ls_ack_out); } } else { oi = intf_ifp->info; if (oi == NULL) return CMD_WARNING; - vty_out(vty, - "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", - oi->interface->name, oi->hello_in, oi->hello_out, - oi->db_desc_in, oi->db_desc_out, oi->ls_req_in, - oi->ls_req_out, oi->ls_upd_in, oi->ls_upd_out, - oi->ls_ack_in, oi->ls_ack_out); + if (use_json) { + json_interface = json_object_new_object(); + json_object_int_add(json_interface, "helloRx", + oi->hello_in); + json_object_int_add(json_interface, "helloTx", + oi->hello_out); + json_object_int_add(json_interface, "dbDescRx", + oi->db_desc_in); + json_object_int_add(json_interface, "dbDescTx", + oi->db_desc_out); + json_object_int_add(json_interface, "lsReqRx", + oi->ls_req_in); + json_object_int_add(json_interface, "lsReqTx", + oi->ls_req_out); + json_object_int_add(json_interface, "lsUpdateRx", + oi->ls_upd_in); + json_object_int_add(json_interface, "lsUpdateTx", + oi->ls_upd_out); + json_object_int_add(json_interface, "lsAckRx", + oi->ls_ack_in); + json_object_int_add(json_interface, "lsAckTx", + oi->ls_ack_out); + + json_object_object_add(json, oi->interface->name, + json_interface); + } else + vty_out(vty, + "%-10s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u\n", + oi->interface->name, oi->hello_in, + oi->hello_out, oi->db_desc_in, oi->db_desc_out, + oi->ls_req_in, oi->ls_req_out, oi->ls_upd_in, + oi->ls_upd_out, oi->ls_ack_in, oi->ls_ack_out); } return CMD_SUCCESS; } /* show interface */ -DEFUN (show_ipv6_ospf6_interface_traffic, - show_ipv6_ospf6_interface_traffic_cmd, - "show ipv6 ospf6 interface traffic [IFNAME]", - SHOW_STR - IP6_STR - OSPF6_STR - INTERFACE_STR - "Protocol Packet counters\n" - IFNAME_STR) +DEFUN(show_ipv6_ospf6_interface_traffic, + show_ipv6_ospf6_interface_traffic_cmd, + "show ipv6 ospf6 interface traffic [IFNAME] [json]", + SHOW_STR + IP6_STR + OSPF6_STR + INTERFACE_STR + "Protocol Packet counters\n" + IFNAME_STR + JSON_STR) { int idx_ifname = 0; int display_once = 0; char *intf_name = NULL; struct interface *ifp = NULL; + json_object *json = NULL; + bool uj = use_json(argc, argv); + + if (uj) + json = json_object_new_object(); if (argv_find(argv, argc, "IFNAME", &idx_ifname)) { intf_name = argv[idx_ifname]->arg; ifp = if_lookup_by_name(intf_name, VRF_DEFAULT); - if (ifp == NULL) { - vty_out(vty, "No such Interface: %s\n", intf_name); - return CMD_WARNING; - } - if (ifp->info == NULL) { - vty_out(vty, - " OSPF not enabled on this interface %s\n", - intf_name); - return 0; + if (uj) { + if (ifp == NULL) { + json_object_string_add(json, "status", + "No Such Interface"); + json_object_string_add(json, "interface", + intf_name); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + return CMD_WARNING; + } + if (ifp->info == NULL) { + json_object_string_add( + json, "status", + "OSPF not enabled on this interface"); + json_object_string_add(json, "interface", + intf_name); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + return 0; + } + } else { + if (ifp == NULL) { + vty_out(vty, "No such Interface: %s\n", + intf_name); + return CMD_WARNING; + } + if (ifp->info == NULL) { + vty_out(vty, + " OSPF not enabled on this interface %s\n", + intf_name); + return 0; + } } } - ospf6_interface_show_traffic(vty, ifp, display_once); + ospf6_interface_show_traffic(vty, ifp, display_once, json, uj); + + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } return CMD_SUCCESS; diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 733b9cffb1..f84a7cfe9a 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -147,7 +147,7 @@ static void ospf6_router_lsa_options_set(struct ospf6_area *oa, OSPF6_OPT_CLEAR_ALL(router_lsa->options); memcpy(router_lsa->options, oa->options, 3); - if (ospf6_is_router_abr(ospf6)) + if (ospf6_is_router_abr(oa->ospf6)) SET_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B); else UNSET_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B); @@ -987,7 +987,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) zlog_debug(" include %pFX", &route->prefix); ospf6_route_add(ospf6_route_copy(route), - route_advertise); + route_advertise, oa->ospf6); } } @@ -1008,7 +1008,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) oa->lsdb); } } - ospf6_route_table_delete(route_advertise); + ospf6_route_table_delete(route_advertise, oa->ospf6); return 0; } @@ -1088,7 +1088,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) op = OSPF6_PREFIX_NEXT(op); } - ospf6_route_table_delete(route_advertise); + ospf6_route_table_delete(route_advertise, oa->ospf6); if (prefix_num == 0) { if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) @@ -1254,7 +1254,8 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) zlog_debug(" include %pFX", &route->prefix); - ospf6_route_add(route, route_advertise); + ospf6_route_add(route, route_advertise, + oi->area->ospf6); prefix_num--; } if (current != end && IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) @@ -1276,7 +1277,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) prefix_num++; } - ospf6_route_table_delete(route_advertise); + ospf6_route_table_delete(route_advertise, oi->area->ospf6); if (prefix_num == 0) { if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) @@ -1309,14 +1310,14 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) return 0; } -static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route) +static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route, + struct ospf6 *ospf6) { struct ospf6_path *h_path; struct ospf6_route *g_route, *nroute; /* Update Global ospf6 route path */ - g_route = ospf6_route_lookup(&oa_route->prefix, - ospf6->route_table); + g_route = ospf6_route_lookup(&oa_route->prefix, ospf6->route_table); assert(g_route); @@ -1362,7 +1363,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, struct ospf6_nexthop *nh, *rnh; char buf[PREFIX2STR_BUFFER]; bool route_found = false; - struct interface *ifp; + struct interface *ifp = NULL; struct ospf6_lsa *lsa; struct ospf6_intra_prefix_lsa *intra_prefix_lsa; @@ -1436,15 +1437,15 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, * nh_list */ if (oa->route_table->hook_add) - (*oa->route_table->hook_add) - (old_route); + (*oa->route_table->hook_add)( + old_route, oa->ospf6); if (old_route->path.origin.id == route->path.origin.id && old_route->path.origin.adv_router == route->path.origin.adv_router) { ospf6_intra_prefix_update_route_origin( - old_route); + old_route, oa->ospf6); } break; } @@ -1458,7 +1459,8 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, } if (oa->route_table->hook_remove) ospf6_route_remove(old_route, - oa->route_table); + oa->route_table, + oa->ospf6); else SET_FLAG(old_route->flag, OSPF6_ROUTE_REMOVE); @@ -1563,12 +1565,20 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, ifp = if_lookup_prefix( &old_route->prefix, oa->ospf6->vrf_id); - if (ifp) - ospf6_route_add_nexthop( - old_route, + } + + if (ifp) { + /* Nexthop interface found */ + ospf6_route_add_nexthop(old_route, ifp->ifindex, NULL); } else { + /* The connected interfaces between + * routers can be in different networks. + * In this case the matching interface + * is not found. Copy nexthops from the + * link state entry + */ ospf6_route_merge_nexthops(old_route, ls_entry); } @@ -1591,7 +1601,8 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, SET_FLAG(old_route->flag, OSPF6_ROUTE_ADD); /* Update ospf6 route table and RIB/FIB */ if (oa->route_table->hook_add) - (*oa->route_table->hook_add)(old_route); + (*oa->route_table->hook_add)(old_route, + oa->ospf6); /* Delete the new route its info added to existing * route. */ @@ -1603,7 +1614,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, if (!route_found) { /* Add new route to existing node in ospf6 route table. */ - ospf6_route_add(route, oa->route_table); + ospf6_route_add(route, oa->route_table, oa->ospf6); } } @@ -1617,7 +1628,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa) struct ospf6_prefix *op; char *start, *current, *end; char buf[PREFIX2STR_BUFFER]; - struct interface *ifp; + struct interface *ifp = NULL; int direct_connect = 0; struct ospf6_path *path; @@ -1707,10 +1718,17 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa) if (direct_connect) { ifp = if_lookup_prefix(&route->prefix, oa->ospf6->vrf_id); - if (ifp) - ospf6_route_add_nexthop(route, ifp->ifindex, - NULL); + } + + if (ifp) { + /* Nexthop interface found */ + ospf6_route_add_nexthop(route, ifp->ifindex, NULL); } else { + /* The connected interfaces between routers can be in + * different networks. In this case the matching + * interface is not found. Copy nexthops from the + * link state entry + */ ospf6_route_copy_nexthops(route, ls_entry); } @@ -1739,7 +1757,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa) listcount(route->paths), listcount(route->nh_list)); } - ospf6_route_add(route, oa->route_table); + ospf6_route_add(route, oa->route_table, oa->ospf6); } prefix_num--; } @@ -1821,7 +1839,7 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa, * nh_list */ if (oa->route_table->hook_add) - (*oa->route_table->hook_add)(route); + (*oa->route_table->hook_add)(route, oa->ospf6); /* route's primary path is similar * to LSA, replace route's primary @@ -1831,7 +1849,8 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa, if ((route->path.origin.id == lsa->header->id) && (route->path.origin.adv_router == lsa->header->adv_router)) { - ospf6_intra_prefix_update_route_origin(route); + ospf6_intra_prefix_update_route_origin(route, + oa->ospf6); } } @@ -1913,7 +1932,8 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa) listcount(route->paths), listcount(route->nh_list)); } - ospf6_route_remove(route, oa->route_table); + ospf6_route_remove(route, oa->route_table, + oa->ospf6); } } if (route) @@ -1929,8 +1949,8 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa) struct ospf6_route *route, *nroute; uint16_t type; struct ospf6_lsa *lsa; - void (*hook_add)(struct ospf6_route *) = NULL; - void (*hook_remove)(struct ospf6_route *) = NULL; + void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL; + void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL; if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) zlog_debug("Re-examin intra-routes for area %s", oa->name); @@ -1960,15 +1980,15 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa) } if (CHECK_FLAG(route->flag, OSPF6_ROUTE_REMOVE)) - ospf6_route_remove(route, oa->route_table); + ospf6_route_remove(route, oa->route_table, oa->ospf6); else if (CHECK_FLAG(route->flag, OSPF6_ROUTE_ADD) || CHECK_FLAG(route->flag, OSPF6_ROUTE_CHANGE)) { if (hook_add) - (*hook_add)(route); + (*hook_add)(route, oa->ospf6); route->flag = 0; } else { /* Redo the summaries as things might have changed */ - ospf6_abr_originate_summary(route); + ospf6_abr_originate_summary(route, oa->ospf6); route->flag = 0; } } @@ -2036,8 +2056,8 @@ static void ospf6_brouter_debug_print(struct ospf6_route *brouter) void ospf6_intra_brouter_calculation(struct ospf6_area *oa) { struct ospf6_route *brouter, *nbrouter, *copy; - void (*hook_add)(struct ospf6_route *) = NULL; - void (*hook_remove)(struct ospf6_route *) = NULL; + void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL; + void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL; uint32_t brouter_id; char brouter_name[16]; @@ -2095,7 +2115,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) copy = ospf6_route_copy(brouter); copy->type = OSPF6_DEST_TYPE_ROUTER; copy->path.area_id = oa->area_id; - ospf6_route_add(copy, oa->ospf6->brouter_table); + ospf6_route_add(copy, oa->ospf6->brouter_table, oa->ospf6); if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(brouter_id) || IS_OSPF6_DEBUG_ROUTE(MEMORY)) { @@ -2181,7 +2201,8 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) * removes brouters which are marked for remove. */ oa->intra_brouter_calc = 1; - ospf6_route_remove(brouter, oa->ospf6->brouter_table); + ospf6_route_remove(brouter, oa->ospf6->brouter_table, + oa->ospf6); brouter = NULL; } else if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_ADD) || CHECK_FLAG(brouter->flag, OSPF6_ROUTE_CHANGE)) { @@ -2195,7 +2216,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) /* newly added */ if (hook_add) - (*hook_add)(brouter); + (*hook_add)(brouter, oa->ospf6); } else { if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID( brouter_id) @@ -2204,7 +2225,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa) zlog_info("brouter %s still exists via area %s", brouter_name, oa->name); /* But re-originate summaries */ - ospf6_abr_originate_summary(brouter); + ospf6_abr_originate_summary(brouter, oa->ospf6); } if (brouter) { diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 058284f5e9..29141ee7f8 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -45,6 +45,27 @@ vector ospf6_lsa_handler_vector; +struct ospf6 *ospf6_get_by_lsdb(struct ospf6_lsa *lsa) +{ + struct ospf6 *ospf6 = NULL; + + switch (OSPF6_LSA_SCOPE(lsa->header->type)) { + case OSPF6_SCOPE_LINKLOCAL: + ospf6 = OSPF6_INTERFACE(lsa->lsdb->data)->area->ospf6; + break; + case OSPF6_SCOPE_AREA: + ospf6 = OSPF6_AREA(lsa->lsdb->data)->ospf6; + break; + case OSPF6_SCOPE_AS: + ospf6 = OSPF6_PROCESS(lsa->lsdb->data); + break; + default: + assert(0); + break; + } + return ospf6; +} + static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa) { uint8_t *start, *end, *current; @@ -626,6 +647,7 @@ struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa) int ospf6_lsa_expire(struct thread *thread) { struct ospf6_lsa *lsa; + struct ospf6 *ospf6; lsa = (struct ospf6_lsa *)THREAD_ARG(thread); @@ -642,7 +664,7 @@ int ospf6_lsa_expire(struct thread *thread) if (CHECK_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY)) return 0; /* dbexchange will do something ... */ - + ospf6 = ospf6_get_by_lsdb(lsa); /* reinstall lsa */ ospf6_install_lsa(lsa); @@ -703,7 +725,7 @@ int ospf6_lsa_refresh(struct thread *thread) return 0; } -void ospf6_flush_self_originated_lsas_now(void) +void ospf6_flush_self_originated_lsas_now(struct ospf6 *ospf6) { struct listnode *node; struct ospf6_area *oa; diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index f8f0780baa..814e276796 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -20,6 +20,7 @@ #ifndef OSPF6_LSA_H #define OSPF6_LSA_H +#include "ospf6_top.h" /* Debug option */ #define OSPF6_LSA_DEBUG 0x01 @@ -236,6 +237,6 @@ extern void ospf6_lsa_terminate(void); extern int config_write_ospf6_debug_lsa(struct vty *vty); extern void install_element_ospf6_debug_lsa(void); extern void ospf6_lsa_age_set(struct ospf6_lsa *lsa); -extern void ospf6_flush_self_originated_lsas_now(void); - +extern void ospf6_flush_self_originated_lsas_now(struct ospf6 *ospf6); +extern struct ospf6 *ospf6_get_by_lsdb(struct ospf6_lsa *lsa); #endif /* OSPF6_LSA_H */ diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 0892863cf1..c136c558cb 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -68,9 +68,9 @@ static void ospf6_lsdb_set_key(struct prefix_ipv6 *key, const void *value, #ifdef DEBUG static void _lsdb_count_assert(struct ospf6_lsdb *lsdb) { - struct ospf6_lsa *debug; + struct ospf6_lsa *debug, *debugnext; unsigned int num = 0; - for (ALL_LSDB(lsdb, debug)) + for (ALL_LSDB(lsdb, debug, debugnext)) num++; if (num == lsdb->count) @@ -78,7 +78,7 @@ static void _lsdb_count_assert(struct ospf6_lsdb *lsdb) zlog_debug("PANIC !! lsdb[%p]->count = %d, real = %d", lsdb, lsdb->count, num); - for (ALL_LSDB(lsdb, debug)) + for (ALL_LSDB(lsdb, debug, debugnext)) zlog_debug("%s lsdb[%p]", debug->name, debug->lsdb); zlog_debug("DUMP END"); diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 8533c1b12c..4ed6e2a604 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -81,22 +81,23 @@ static void __attribute__((noreturn)) ospf6_exit(int status) { struct vrf *vrf; struct interface *ifp; + struct ospf6 *ospf6; + struct listnode *node, *nnode; frr_early_fini(); - if (ospf6) { + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { vrf = vrf_lookup_by_id(ospf6->vrf_id); ospf6_serv_close(&ospf6->fd); + FOR_ALL_INTERFACES (vrf, ifp) + if (ifp->info != NULL) + ospf6_interface_delete(ifp->info); ospf6_delete(ospf6); ospf6 = NULL; - } else - vrf = vrf_lookup_by_id(VRF_DEFAULT); + } bfd_gbl_exit(); - FOR_ALL_INTERFACES (vrf, ifp) - if (ifp->info != NULL) - ospf6_interface_delete(ifp->info); ospf6_message_terminate(); ospf6_asbr_terminate(); @@ -216,17 +217,17 @@ int main(int argc, char *argv[], char *envp[]) } /* OSPF6 master init. */ - ospf6_master_init(); + ospf6_master_init(frr_init()); /* thread master */ - master = frr_init(); + master = om6->master; vrf_init(NULL, NULL, NULL, NULL, NULL); access_list_init(); prefix_list_init(); /* initialize ospf6 */ - ospf6_init(); + ospf6_init(master); frr_config_fork(); frr_run(master); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 07089d8774..5f9953782c 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -781,9 +781,9 @@ static void ospf6_dbdesc_recv(struct in6_addr *src, struct in6_addr *dst, oi->db_desc_in++; - if (ntohl(oh->router_id) < ntohl(ospf6->router_id)) + if (ntohl(oh->router_id) < ntohl(oi->area->ospf6->router_id)) ospf6_dbdesc_recv_master(oh, on); - else if (ntohl(ospf6->router_id) < ntohl(oh->router_id)) + else if (ntohl(oi->area->ospf6->router_id) < ntohl(oh->router_id)) ospf6_dbdesc_recv_slave(oh, on); else { if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) @@ -1701,7 +1701,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, /* send message */ if (oi->area->ospf6->fd != -1) { - len = ospf6_sendmsg(src, dst, &oi->interface->ifindex, iovector, + len = ospf6_sendmsg(src, dst, oi->interface->ifindex, iovector, oi->area->ospf6->fd); if (len != ntohs(oh->length)) flog_err(EC_LIB_DEVELOPMENT, diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index f8676e0c13..c1905e8c1e 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -44,6 +44,7 @@ #include "ospf6_lsa.h" #include "ospf6_spf.h" #include "ospf6_zebra.h" +#include "lib/json.h" DEFINE_HOOK(ospf6_neighbor_change, (struct ospf6_neighbor * on, int state, int next_state), @@ -595,7 +596,8 @@ int inactivity_timer(struct thread *thread) /* vty functions */ /* show neighbor structure */ -static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on) +static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on, + json_object *json_array, bool use_json) { char router_id[16]; char duration[64]; @@ -603,6 +605,7 @@ static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on) char nstate[16]; char deadtime[64]; long h, m, s; + json_object *json_route; /* Router-ID (Name) */ inet_ntop(AF_INET, &on->router_id, router_id, sizeof(router_id)); @@ -641,23 +644,43 @@ static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on) /* vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]\n", - "Neighbor ID", "Pri", "DeadTime", "State", "", "Duration", - "I/F", "State"); + "Neighbor ID", "Pri", "DeadTime", "State", "IfState", + "Duration", "I/F", "State"); */ - - vty_out(vty, "%-15s %3d %11s %8s/%-12s %11s %s[%s]\n", router_id, - on->priority, deadtime, ospf6_neighbor_state_str[on->state], - nstate, duration, on->ospf6_if->interface->name, - ospf6_interface_state_str[on->ospf6_if->state]); + if (use_json) { + json_route = json_object_new_object(); + + json_object_string_add(json_route, "neighborId", router_id); + json_object_int_add(json_route, "priority", on->priority); + json_object_string_add(json_route, "deadTime", deadtime); + json_object_string_add(json_route, "state", + ospf6_neighbor_state_str[on->state]); + json_object_string_add(json_route, "ifState", nstate); + json_object_string_add(json_route, "duration", duration); + json_object_string_add(json_route, "interfaceName", + on->ospf6_if->interface->name); + json_object_string_add( + json_route, "interfaceState", + ospf6_interface_state_str[on->ospf6_if->state]); + + json_object_array_add(json_array, json_route); + } else + vty_out(vty, "%-15s %3d %11s %8s/%-12s %11s %s[%s]\n", + router_id, on->priority, deadtime, + ospf6_neighbor_state_str[on->state], nstate, duration, + on->ospf6_if->interface->name, + ospf6_interface_state_str[on->ospf6_if->state]); } static void ospf6_neighbor_show_drchoice(struct vty *vty, - struct ospf6_neighbor *on) + struct ospf6_neighbor *on, + json_object *json_array, bool use_json) { char router_id[16]; char drouter[16], bdrouter[16]; char duration[64]; struct timeval now, res; + json_object *json_route; /* vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]\n", @@ -673,19 +696,39 @@ static void ospf6_neighbor_show_drchoice(struct vty *vty, timersub(&now, &on->last_changed, &res); timerstring(&res, duration, sizeof(duration)); - vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", router_id, - ospf6_neighbor_state_str[on->state], duration, drouter, - bdrouter, on->ospf6_if->interface->name, - ospf6_interface_state_str[on->ospf6_if->state]); + if (use_json) { + json_route = json_object_new_object(); + json_object_string_add(json_route, "routerId", router_id); + json_object_string_add(json_route, "state", + ospf6_neighbor_state_str[on->state]); + json_object_string_add(json_route, "duration", duration); + json_object_string_add(json_route, "dRouter", drouter); + json_object_string_add(json_route, "bdRouter", bdrouter); + json_object_string_add(json_route, "interfaceName", + on->ospf6_if->interface->name); + json_object_string_add( + json_route, "interfaceState", + ospf6_interface_state_str[on->ospf6_if->state]); + + json_object_array_add(json_array, json_route); + } else + vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", router_id, + ospf6_neighbor_state_str[on->state], duration, drouter, + bdrouter, on->ospf6_if->interface->name, + ospf6_interface_state_str[on->ospf6_if->state]); } static void ospf6_neighbor_show_detail(struct vty *vty, - struct ospf6_neighbor *on) + struct ospf6_neighbor *on, + json_object *json, bool use_json) { char drouter[16], bdrouter[16]; char linklocal_addr[64], duration[32]; struct timeval now, res; struct ospf6_lsa *lsa, *lsanext; + json_object *json_neighbor; + json_object *json_array; + char db_desc_str[20]; inet_ntop(AF_INET6, &on->linklocal_addr, linklocal_addr, sizeof(linklocal_addr)); @@ -696,144 +739,333 @@ static void ospf6_neighbor_show_detail(struct vty *vty, timersub(&now, &on->last_changed, &res); timerstring(&res, duration, sizeof(duration)); - vty_out(vty, " Neighbor %s\n", on->name); - vty_out(vty, " Area %s via interface %s (ifindex %d)\n", - on->ospf6_if->area->name, on->ospf6_if->interface->name, - on->ospf6_if->interface->ifindex); - vty_out(vty, " His IfIndex: %d Link-local address: %s\n", - on->ifindex, linklocal_addr); - vty_out(vty, " State %s for a duration of %s\n", - ospf6_neighbor_state_str[on->state], duration); - vty_out(vty, " His choice of DR/BDR %s/%s, Priority %d\n", drouter, - bdrouter, on->priority); - vty_out(vty, " DbDesc status: %s%s%s SeqNum: %#lx\n", - (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT) ? "Initial " - : ""), - (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) ? "More " : ""), - (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) ? "Master" - : "Slave"), - (unsigned long)ntohl(on->dbdesc_seqnum)); - - vty_out(vty, " Summary-List: %d LSAs\n", on->summary_list->count); - for (ALL_LSDB(on->summary_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - vty_out(vty, " Request-List: %d LSAs\n", on->request_list->count); - for (ALL_LSDB(on->request_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - vty_out(vty, " Retrans-List: %d LSAs\n", on->retrans_list->count); - for (ALL_LSDB(on->retrans_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - timerclear(&res); - if (on->thread_send_dbdesc) - timersub(&on->thread_send_dbdesc->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, " %d Pending LSAs for DbDesc in Time %s [thread %s]\n", - on->dbdesc_list->count, duration, - (on->thread_send_dbdesc ? "on" : "off")); - for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - timerclear(&res); - if (on->thread_send_lsreq) - timersub(&on->thread_send_lsreq->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, " %d Pending LSAs for LSReq in Time %s [thread %s]\n", - on->request_list->count, duration, - (on->thread_send_lsreq ? "on" : "off")); - for (ALL_LSDB(on->request_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - timerclear(&res); - if (on->thread_send_lsupdate) - timersub(&on->thread_send_lsupdate->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, - " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", - on->lsupdate_list->count, duration, - (on->thread_send_lsupdate ? "on" : "off")); - for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - timerclear(&res); - if (on->thread_send_lsack) - timersub(&on->thread_send_lsack->u.sands, &now, &res); - timerstring(&res, duration, sizeof(duration)); - vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n", - on->lsack_list->count, duration, - (on->thread_send_lsack ? "on" : "off")); - for (ALL_LSDB(on->lsack_list, lsa, lsanext)) - vty_out(vty, " %s\n", lsa->name); - - ospf6_bfd_show_info(vty, on->bfd_info, 0); + if (use_json) { + json_neighbor = json_object_new_object(); + json_object_string_add(json_neighbor, "area", + on->ospf6_if->area->name); + json_object_string_add(json_neighbor, "interface", + on->ospf6_if->interface->name); + json_object_int_add(json_neighbor, "interfaceIndex", + on->ospf6_if->interface->ifindex); + json_object_int_add(json_neighbor, "neighborInterfaceIndex", + on->ifindex); + json_object_string_add(json_neighbor, "linkLocalAddress", + linklocal_addr); + json_object_string_add(json_neighbor, "neighborState", + ospf6_neighbor_state_str[on->state]); + json_object_string_add(json_neighbor, "neighborStateDuration", + duration); + json_object_string_add(json_neighbor, "neighborDRouter", + drouter); + json_object_string_add(json_neighbor, "neighborBdRouter", + bdrouter); + snprintf(db_desc_str, sizeof(db_desc_str), "%s%s%s", + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT) + ? "Initial " + : ""), + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) + ? "More" + : ""), + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) + ? "Master" + : "Slave")); + json_object_string_add(json_neighbor, "dbDescStatus", + db_desc_str); + + json_object_int_add(json_neighbor, "dbDescSeqNumber", + (unsigned long)ntohl(on->dbdesc_seqnum)); + + json_array = json_object_new_array(); + json_object_int_add(json_neighbor, "summaryListCount", + on->summary_list->count); + for (ALL_LSDB(on->summary_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "summaryListLsa", + json_array); + + json_array = json_object_new_array(); + json_object_int_add(json_neighbor, "requestListCount", + on->request_list->count); + for (ALL_LSDB(on->request_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "requestListLsa", + json_array); + + json_array = json_object_new_array(); + json_object_int_add(json_neighbor, "reTransListCount", + on->retrans_list->count); + for (ALL_LSDB(on->retrans_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "reTransListLsa", + json_array); + + + timerclear(&res); + if (on->thread_send_dbdesc) + timersub(&on->thread_send_dbdesc->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + json_object_int_add(json_neighbor, "pendingLsaDbDescCount", + on->dbdesc_list->count); + json_object_string_add(json_neighbor, "pendingLsaDbDescTime", + duration); + json_object_string_add(json_neighbor, "dbDescSendThread", + (on->thread_send_dbdesc ? "on" : "off")); + json_array = json_object_new_array(); + for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "pendingLsaDbDesc", + json_array); + + timerclear(&res); + if (on->thread_send_lsreq) + timersub(&on->thread_send_lsreq->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + json_object_int_add(json_neighbor, "pendingLsaLsReqCount", + on->request_list->count); + json_object_string_add(json_neighbor, "pendingLsaLsReqTime", + duration); + json_object_string_add(json_neighbor, "lsReqSendThread", + (on->thread_send_lsreq ? "on" : "off")); + json_array = json_object_new_array(); + for (ALL_LSDB(on->request_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "pendingLsaLsReq", + json_array); + + + timerclear(&res); + if (on->thread_send_lsupdate) + timersub(&on->thread_send_lsupdate->u.sands, &now, + &res); + timerstring(&res, duration, sizeof(duration)); + json_object_int_add(json_neighbor, "pendingLsaLsUpdateCount", + on->lsupdate_list->count); + json_object_string_add(json_neighbor, "pendingLsaLsUpdateTime", + duration); + json_object_string_add( + json_neighbor, "lsUpdateSendThread", + (on->thread_send_lsupdate ? "on" : "off")); + json_array = json_object_new_array(); + for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "pendingLsaLsUpdate", + json_array); + + timerclear(&res); + if (on->thread_send_lsack) + timersub(&on->thread_send_lsack->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + json_object_int_add(json_neighbor, "pendingLsaLsAckCount", + on->lsack_list->count); + json_object_string_add(json_neighbor, "pendingLsaLsAckTime", + duration); + json_object_string_add(json_neighbor, "lsAckSendThread", + (on->thread_send_lsack ? "on" : "off")); + json_array = json_object_new_array(); + for (ALL_LSDB(on->lsack_list, lsa, lsanext)) + json_object_array_add( + json_array, json_object_new_string(lsa->name)); + json_object_object_add(json_neighbor, "pendingLsaLsAck", + json_array); + + ospf6_bfd_show_info(vty, on->bfd_info, 0, json_neighbor, + use_json); + + json_object_object_add(json, on->name, json_neighbor); + + + } else { + vty_out(vty, " Neighbor %s\n", on->name); + vty_out(vty, " Area %s via interface %s (ifindex %d)\n", + on->ospf6_if->area->name, on->ospf6_if->interface->name, + on->ospf6_if->interface->ifindex); + vty_out(vty, " His IfIndex: %d Link-local address: %s\n", + on->ifindex, linklocal_addr); + vty_out(vty, " State %s for a duration of %s\n", + ospf6_neighbor_state_str[on->state], duration); + vty_out(vty, " His choice of DR/BDR %s/%s, Priority %d\n", + drouter, bdrouter, on->priority); + vty_out(vty, " DbDesc status: %s%s%s SeqNum: %#lx\n", + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT) + ? "Initial " + : ""), + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) + ? "More " + : ""), + (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) + ? "Master" + : "Slave"), + (unsigned long)ntohl(on->dbdesc_seqnum)); + + vty_out(vty, " Summary-List: %d LSAs\n", + on->summary_list->count); + for (ALL_LSDB(on->summary_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + vty_out(vty, " Request-List: %d LSAs\n", + on->request_list->count); + for (ALL_LSDB(on->request_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + vty_out(vty, " Retrans-List: %d LSAs\n", + on->retrans_list->count); + for (ALL_LSDB(on->retrans_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + timerclear(&res); + if (on->thread_send_dbdesc) + timersub(&on->thread_send_dbdesc->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for DbDesc in Time %s [thread %s]\n", + on->dbdesc_list->count, duration, + (on->thread_send_dbdesc ? "on" : "off")); + for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + timerclear(&res); + if (on->thread_send_lsreq) + timersub(&on->thread_send_lsreq->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for LSReq in Time %s [thread %s]\n", + on->request_list->count, duration, + (on->thread_send_lsreq ? "on" : "off")); + for (ALL_LSDB(on->request_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + timerclear(&res); + if (on->thread_send_lsupdate) + timersub(&on->thread_send_lsupdate->u.sands, &now, + &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", + on->lsupdate_list->count, duration, + (on->thread_send_lsupdate ? "on" : "off")); + for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + timerclear(&res); + if (on->thread_send_lsack) + timersub(&on->thread_send_lsack->u.sands, &now, &res); + timerstring(&res, duration, sizeof(duration)); + vty_out(vty, + " %d Pending LSAs for LSAck in Time %s [thread %s]\n", + on->lsack_list->count, duration, + (on->thread_send_lsack ? "on" : "off")); + for (ALL_LSDB(on->lsack_list, lsa, lsanext)) + vty_out(vty, " %s\n", lsa->name); + + ospf6_bfd_show_info(vty, on->bfd_info, 0, NULL, use_json); + } } DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, - "show ipv6 ospf6 neighbor [<detail|drchoice>]", + "show ipv6 ospf6 neighbor [<detail|drchoice>] [json]", SHOW_STR IP6_STR OSPF6_STR "Neighbor list\n" "Display details\n" - "Display DR choices\n") + "Display DR choices\n" + JSON_STR) { int idx_type = 4; struct ospf6_neighbor *on; struct ospf6_interface *oi; struct ospf6_area *oa; struct listnode *i, *j, *k; - void (*showfunc)(struct vty *, struct ospf6_neighbor *); + struct ospf6 *ospf6; + json_object *json = NULL; + json_object *json_array = NULL; + bool uj = use_json(argc, argv); + void (*showfunc)(struct vty *, struct ospf6_neighbor *, + json_object *json, bool use_json); - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + + OSPF6_CMD_CHECK_RUNNING(ospf6); showfunc = ospf6_neighbor_show; - if (argc == 5) { + if ((uj && argc == 6) || (!uj && argc == 5)) { if (!strncmp(argv[idx_type]->arg, "de", 2)) showfunc = ospf6_neighbor_show_detail; else if (!strncmp(argv[idx_type]->arg, "dr", 2)) showfunc = ospf6_neighbor_show_drchoice; } - if (showfunc == ospf6_neighbor_show) - vty_out(vty, "%-15s %3s %11s %8s/%-12s %11s %s[%s]\n", - "Neighbor ID", "Pri", "DeadTime", "State", "IfState", - "Duration", "I/F", "State"); - else if (showfunc == ospf6_neighbor_show_drchoice) - vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", "RouterID", - "State", "Duration", "DR", "BDR", "I/F", "State"); + if (uj) { + json = json_object_new_object(); + json_array = json_object_new_array(); + } else { + if (showfunc == ospf6_neighbor_show) + vty_out(vty, "%-15s %3s %11s %8s/%-12s %11s %s[%s]\n", + "Neighbor ID", "Pri", "DeadTime", "State", + "IfState", "Duration", "I/F", "State"); + else if (showfunc == ospf6_neighbor_show_drchoice) + vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", + "RouterID", "State", "Duration", "DR", "BDR", + "I/F", "State"); + } for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) - for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) - (*showfunc)(vty, on); - + for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) { + if (showfunc == ospf6_neighbor_show_detail) + (*showfunc)(vty, on, json, uj); + else + (*showfunc)(vty, on, json_array, uj); + } + + if (uj) { + if (showfunc != ospf6_neighbor_show_detail) + json_object_object_add(json, "neighbors", json_array); + else + json_object_free(json_array); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } return CMD_SUCCESS; } DEFUN (show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, - "show ipv6 ospf6 neighbor A.B.C.D", + "show ipv6 ospf6 neighbor A.B.C.D [json]", SHOW_STR IP6_STR OSPF6_STR "Neighbor list\n" "Specify Router-ID as IPv4 address notation\n" - ) + JSON_STR) { int idx_ipv4 = 4; struct ospf6_neighbor *on; struct ospf6_interface *oi; struct ospf6_area *oa; struct listnode *i, *j, *k; - void (*showfunc)(struct vty *, struct ospf6_neighbor *); + void (*showfunc)(struct vty *, struct ospf6_neighbor *, + json_object *json, bool use_json); uint32_t router_id; + struct ospf6 *ospf6; + json_object *json = NULL; + bool uj = use_json(argc, argv); - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); showfunc = ospf6_neighbor_show_detail; + if (uj) + json = json_object_new_object(); if ((inet_pton(AF_INET, argv[idx_ipv4]->arg, &router_id)) != 1) { vty_out(vty, "Router-ID is not parsable: %s\n", @@ -844,8 +1076,15 @@ DEFUN (show_ipv6_ospf6_neighbor_one, for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) - (*showfunc)(vty, on); + (*showfunc)(vty, on, json, uj); + + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 1a45a1966a..94300ff2ba 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -64,7 +64,7 @@ struct ospf6_neighbor { /* Options field (Capability) */ char options[3]; - /* IPaddr of I/F on our side link */ + /* IPaddr of I/F on neighbour's link */ struct in6_addr linklocal_addr; /* For Database Exchange */ diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 6c83881bf4..76f98fecdd 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -124,21 +124,20 @@ int ospf6_serv_sock(struct ospf6 *ospf6) } /* ospf6 set socket option */ -int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option) +int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option, int sockfd) { struct ipv6_mreq mreq6; int ret; int bufsize = (8 * 1024 * 1024); - if (ospf6->fd == -1) + if (sockfd == -1) return -1; assert(ifindex); mreq6.ipv6mr_interface = ifindex; memcpy(&mreq6.ipv6mr_multiaddr, group, sizeof(struct in6_addr)); - ret = setsockopt(ospf6->fd, IPPROTO_IPV6, option, &mreq6, - sizeof(mreq6)); + ret = setsockopt(sockfd, IPPROTO_IPV6, option, &mreq6, sizeof(mreq6)); if (ret < 0) { flog_err_sys( EC_LIB_SOCKET, @@ -147,8 +146,8 @@ int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option) return ret; } - setsockopt_so_sendbuf(ospf6->fd, bufsize); - setsockopt_so_recvbuf(ospf6->fd, bufsize); + setsockopt_so_sendbuf(sockfd, bufsize); + setsockopt_so_recvbuf(sockfd, bufsize); return 0; } @@ -171,7 +170,7 @@ static int iov_totallen(struct iovec *iov) } int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, - ifindex_t *ifindex, struct iovec *message, int ospf6_sock) + ifindex_t ifindex, struct iovec *message, int ospf6_sock) { int retval; struct msghdr smsghdr; @@ -184,7 +183,6 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, struct sockaddr_in6 dst_sin6; assert(dst); - assert(*ifindex); memset(&cmsgbuf, 0, sizeof(cmsgbuf)); scmsgp = (struct cmsghdr *)&cmsgbuf; @@ -192,7 +190,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, memset(&dst_sin6, 0, sizeof(struct sockaddr_in6)); /* source address */ - pktinfo->ipi6_ifindex = *ifindex; + pktinfo->ipi6_ifindex = ifindex; if (src) memcpy(&pktinfo->ipi6_addr, src, sizeof(struct in6_addr)); else @@ -204,7 +202,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, dst_sin6.sin6_len = sizeof(struct sockaddr_in6); #endif /*SIN6_LEN*/ memcpy(&dst_sin6.sin6_addr, dst, sizeof(struct in6_addr)); - dst_sin6.sin6_scope_id = *ifindex; + dst_sin6.sin6_scope_id = ifindex; /* send control msg */ scmsgp->cmsg_level = IPPROTO_IPV6; @@ -223,7 +221,8 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, retval = sendmsg(ospf6_sock, &smsghdr, 0); if (retval != iov_totallen(message)) - zlog_warn("sendmsg failed: ifindex: %d: %s (%d)", *ifindex, + zlog_warn("sendmsg failed: source: %pI6 Dest: %pI6 ifindex: %d: %s (%d)", + src, dst, ifindex, safe_strerror(errno), errno); return retval; diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index d11a611c49..08d8be4445 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -26,11 +26,14 @@ extern struct in6_addr alldrouters6; extern int ospf6_serv_sock(struct ospf6 *ospf6); extern void ospf6_serv_close(int *ospf6_sock); -extern int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option); +extern int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option, + int sockfd); -extern int ospf6_sendmsg(struct in6_addr *, struct in6_addr *, ifindex_t *, - struct iovec *, int ospf6_sock); -extern int ospf6_recvmsg(struct in6_addr *, struct in6_addr *, ifindex_t *, - struct iovec *, int ospf6_sock); +extern int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, + ifindex_t ifindex, struct iovec *message, + int ospf6_sock); +extern int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst, + ifindex_t *ifindex, struct iovec *message, + int ospf6_sock); #endif /* OSPF6_NETWORK_H */ diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 1cd6b8cff4..2602854f33 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -296,25 +296,24 @@ void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route, { struct ospf6_nexthop *nh; struct listnode *node; + struct interface *ifp; char buf[64]; int i; if (route) { i = 0; for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) { + ifp = if_lookup_by_index_all_vrf(nh->ifindex); if (IS_OSPF6_DEBUG_ZEBRA(SEND)) { - const char *ifname; inet_ntop(AF_INET6, &nh->address, buf, sizeof(buf)); - ifname = ifindex2ifname(nh->ifindex, - ospf6->vrf_id); zlog_debug(" nexthop: %s%%%.*s(%d)", buf, - IFNAMSIZ, ifname, nh->ifindex); + IFNAMSIZ, ifp->name, nh->ifindex); } if (i >= entries) return; - nexthops[i].vrf_id = ospf6->vrf_id; + nexthops[i].vrf_id = ifp->vrf_id; nexthops[i].ifindex = nh->ifindex; if (!IN6_IS_ADDR_UNSPECIFIED(&nh->address)) { nexthops[i].gate.ipv6 = nh->address; @@ -591,7 +590,8 @@ static void route_table_assert(struct ospf6_route_table *table) #endif /*DEBUG*/ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, - struct ospf6_route_table *table) + struct ospf6_route_table *table, + struct ospf6 *ospf6) { struct route_node *node, *nextnode, *prevnode; struct ospf6_route *current = NULL; @@ -700,7 +700,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, ospf6_route_table_assert(table); if (table->hook_add) - (*table->hook_add)(route); + (*table->hook_add)(route, ospf6); return route; } @@ -755,7 +755,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, SET_FLAG(route->flag, OSPF6_ROUTE_ADD); if (table->hook_add) - (*table->hook_add)(route); + (*table->hook_add)(route, ospf6); return route; } @@ -821,13 +821,13 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, SET_FLAG(route->flag, OSPF6_ROUTE_ADD); if (table->hook_add) - (*table->hook_add)(route); + (*table->hook_add)(route, ospf6); return route; } void ospf6_route_remove(struct ospf6_route *route, - struct ospf6_route_table *table) + struct ospf6_route_table *table, struct ospf6 *ospf6) { struct route_node *node; struct ospf6_route *current; @@ -882,7 +882,7 @@ void ospf6_route_remove(struct ospf6_route *route, /* Note hook_remove may call ospf6_route_remove */ if (table->hook_remove) - (*table->hook_remove)(route); + (*table->hook_remove)(route, ospf6); ospf6_route_unlock(route); } @@ -1002,12 +1002,13 @@ struct ospf6_route *ospf6_route_match_next(struct prefix *prefix, return next; } -void ospf6_route_remove_all(struct ospf6_route_table *table) +void ospf6_route_remove_all(struct ospf6_route_table *table, + struct ospf6 *ospf6) { struct ospf6_route *route; for (route = ospf6_route_head(table); route; route = ospf6_route_next(route)) - ospf6_route_remove(route, table); + ospf6_route_remove(route, table, ospf6); } struct ospf6_route_table *ospf6_route_table_create(int s, int t) @@ -1020,9 +1021,10 @@ struct ospf6_route_table *ospf6_route_table_create(int s, int t) return new; } -void ospf6_route_table_delete(struct ospf6_route_table *table) +void ospf6_route_table_delete(struct ospf6_route_table *table, + struct ospf6 *ospf6) { - ospf6_route_remove_all(table); + ospf6_route_remove_all(table, ospf6); bf_free(table->idspace); route_table_finish(table->table); XFREE(MTYPE_OSPF6_ROUTE, table); @@ -1035,12 +1037,11 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route) int i; char destination[PREFIX2STR_BUFFER], nexthop[64]; char duration[64]; - const char *ifname; struct timeval now, res; struct listnode *node; struct ospf6_nexthop *nh; - if (ospf6 == NULL) { + if (om6->ospf6 == NULL) { vty_out(vty, "OSPFv3 is not running\n"); return; } @@ -1061,35 +1062,34 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route) i = 0; for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) { + struct interface *ifp; /* nexthop */ inet_ntop(AF_INET6, &nh->address, nexthop, sizeof(nexthop)); - ifname = ifindex2ifname(nh->ifindex, ospf6->vrf_id); - + ifp = if_lookup_by_index_all_vrf(nh->ifindex); if (!i) { vty_out(vty, "%c%1s %2s %-30s %-25s %6.*s %s\n", (ospf6_route_is_best(route) ? '*' : ' '), OSPF6_DEST_TYPE_SUBSTR(route->type), OSPF6_PATH_TYPE_SUBSTR(route->path.type), - destination, nexthop, IFNAMSIZ, ifname, + destination, nexthop, IFNAMSIZ, ifp->name, duration); i++; } else vty_out(vty, "%c%1s %2s %-30s %-25s %6.*s %s\n", ' ', - "", "", "", nexthop, IFNAMSIZ, ifname, ""); + "", "", "", nexthop, IFNAMSIZ, ifp->name, ""); } } void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route) { - const char *ifname; - char destination[PREFIX2STR_BUFFER], nexthop[64]; + char destination[PREFIX2STR_BUFFER]; char area_id[16], id[16], adv_router[16], capa[16], options[16]; struct timeval now, res; char duration[64]; struct listnode *node; struct ospf6_nexthop *nh; - if (ospf6 == NULL) { + if (om6->ospf6 == NULL) { vty_out(vty, "OSPFv3 is not running\n"); return; } @@ -1166,10 +1166,11 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route) /* Nexthops */ vty_out(vty, "Nexthop:\n"); for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) { + struct interface *ifp; /* nexthop */ - inet_ntop(AF_INET6, &nh->address, nexthop, sizeof(nexthop)); - ifname = ifindex2ifname(nh->ifindex, ospf6->vrf_id); - vty_out(vty, " %s %.*s\n", nexthop, IFNAMSIZ, ifname); + + ifp = if_lookup_by_index_all_vrf(nh->ifindex); + vty_out(vty, " %pI6 %.*s\n", &nh->address, IFNAMSIZ, ifp->name); } vty_out(vty, "\n"); } diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 95ba983e6b..0b984400b5 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -178,6 +178,7 @@ struct ospf6_route { #define OSPF6_ROUTE_DO_NOT_ADVERTISE 0x20 #define OSPF6_ROUTE_WAS_REMOVED 0x40 #define OSPF6_ROUTE_BLACKHOLE_ADDED 0x80 +struct ospf6; struct ospf6_route_table { int scope_type; @@ -192,9 +193,9 @@ struct ospf6_route_table { bitfield_t idspace; /* hooks */ - void (*hook_add)(struct ospf6_route *); + void (*hook_add)(struct ospf6_route *, struct ospf6 *); void (*hook_change)(struct ospf6_route *); - void (*hook_remove)(struct ospf6_route *); + void (*hook_remove)(struct ospf6_route *, struct ospf6 *); }; #define OSPF6_SCOPE_TYPE_NONE 0 @@ -296,7 +297,6 @@ extern int ospf6_route_cmp(struct ospf6_route *ra, struct ospf6_route *rb); extern void ospf6_route_lock(struct ospf6_route *route); extern void ospf6_route_unlock(struct ospf6_route *route); - extern struct ospf6_route *ospf6_route_lookup(struct prefix *prefix, struct ospf6_route_table *table); extern struct ospf6_route * @@ -307,9 +307,11 @@ ospf6_route_lookup_bestmatch(struct prefix *prefix, struct ospf6_route_table *table); extern struct ospf6_route *ospf6_route_add(struct ospf6_route *route, - struct ospf6_route_table *table); + struct ospf6_route_table *table, + struct ospf6 *ospf6); extern void ospf6_route_remove(struct ospf6_route *route, - struct ospf6_route_table *table); + struct ospf6_route_table *table, + struct ospf6 *ospf6); extern struct ospf6_route *ospf6_route_head(struct ospf6_route_table *table); extern struct ospf6_route *ospf6_route_next(struct ospf6_route *route); @@ -320,9 +322,10 @@ ospf6_route_match_head(struct prefix *prefix, struct ospf6_route_table *table); extern struct ospf6_route *ospf6_route_match_next(struct prefix *prefix, struct ospf6_route *route); -extern void ospf6_route_remove_all(struct ospf6_route_table *); +extern void ospf6_route_remove_all(struct ospf6_route_table *, struct ospf6 *); extern struct ospf6_route_table *ospf6_route_table_create(int s, int t); -extern void ospf6_route_table_delete(struct ospf6_route_table *); +extern void ospf6_route_table_delete(struct ospf6_route_table *, + struct ospf6 *); extern void ospf6_route_dump(struct ospf6_route_table *table); @@ -341,7 +344,6 @@ extern void ospf6_brouter_show(struct vty *vty, struct ospf6_route *route); extern int config_write_ospf6_debug_route(struct vty *vty); extern void install_element_ospf6_debug_route(void); extern void ospf6_route_init(void); -extern void ospf6_clean(void); extern void ospf6_path_free(struct ospf6_path *op); extern struct ospf6_path *ospf6_path_dup(struct ospf6_path *path); extern void ospf6_copy_paths(struct list *dst, struct list *src); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 6e24be6a1e..51a3bff2a3 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -638,7 +638,9 @@ static uint8_t *ospfv3GeneralGroup(struct variable *v, oid *name, uint16_t sum; uint32_t count; struct ospf6_lsa *lsa = NULL, *lsanext; + struct ospf6 *ospf6; + ospf6 = ospf6_lookup_by_vrf_id(VRF_DEFAULT); /* Check whether the instance identifier is valid */ if (smux_header_generic(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -741,6 +743,9 @@ static uint8_t *ospfv3AreaEntry(struct variable *v, oid *name, size_t *length, unsigned int len; char a[16]; struct ospf6_route *ro; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_id(VRF_DEFAULT); if (ospf6 == NULL) return NULL; @@ -850,6 +855,9 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, struct interface *iif; struct ospf6_interface *oi = NULL; struct list *ifslist; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_id(VRF_DEFAULT); if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -955,8 +963,6 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, else if (v->magic & OSPFv3WWLINKTABLE) { /* We build a sorted list of interfaces */ ifslist = list_new(); - if (!ifslist) - return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); @@ -985,6 +991,7 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length, } list_delete_all_node(ifslist); + list_delete(&ifslist); } } @@ -1051,6 +1058,9 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, oid *offset; int offsetlen, len; uint32_t sum; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_id(VRF_DEFAULT); if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -1089,8 +1099,6 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, } else { /* We build a sorted list of interfaces */ ifslist = list_new(); - if (!ifslist) - return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); @@ -1110,6 +1118,7 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length, } list_delete_all_node(ifslist); + list_delete(&ifslist); } if (!oi) @@ -1205,6 +1214,9 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, struct list *ifslist; oid *offset; int offsetlen, len; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_id(VRF_DEFAULT); if (smux_header_table(v, name, length, exact, var_len, write_method) == MATCH_FAILED) @@ -1253,8 +1265,6 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, } else { /* We build a sorted list of interfaces */ ifslist = list_new(); - if (!ifslist) - return NULL; ifslist->cmp = (int (*)(void *, void *))if_icmp_func; FOR_ALL_INTERFACES (vrf, iif) listnode_add_sort(ifslist, iif); @@ -1282,6 +1292,7 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length, } list_delete_all_node(ifslist); + list_delete(&ifslist); } if (!oi || !on) diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index d3a330c3c7..4dd1d5a462 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -258,7 +258,7 @@ static char *ospf6_lsdesc_backlink(struct ospf6_lsa *lsa, caddr_t lsdesc, } static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, - caddr_t lsdesc) + caddr_t lsdesc, struct ospf6 *ospf6) { int i; ifindex_t ifindex; @@ -316,7 +316,8 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v, } static int ospf6_spf_install(struct ospf6_vertex *v, - struct ospf6_route_table *result_table) + struct ospf6_route_table *result_table, + struct ospf6 *ospf6) { struct ospf6_route *route, *parent_route; struct ospf6_vertex *prev; @@ -416,11 +417,12 @@ static int ospf6_spf_install(struct ospf6_vertex *v, listnode_add_sort(v->parent->child_list, v); route->route_option = v; - ospf6_route_add(route, result_table); + ospf6_route_add(route, result_table, ospf6); return 0; } -void ospf6_spf_table_finish(struct ospf6_route_table *result_table) +void ospf6_spf_table_finish(struct ospf6_route_table *result_table, + struct ospf6 *ospf6) { struct ospf6_route *route, *nroute; struct ospf6_vertex *v; @@ -428,7 +430,7 @@ void ospf6_spf_table_finish(struct ospf6_route_table *result_table) nroute = ospf6_route_next(route); v = (struct ospf6_vertex *)route->route_option; ospf6_vertex_delete(v); - ospf6_route_remove(route, result_table); + ospf6_route_remove(route, result_table, ospf6); } } @@ -466,7 +468,7 @@ void ospf6_spf_calculation(uint32_t router_id, struct ospf6_lsa *lsa; struct in6_addr address; - ospf6_spf_table_finish(result_table); + ospf6_spf_table_finish(result_table, oa->ospf6); /* Install the calculating router itself as the root of the SPF tree */ /* construct root vertex */ @@ -495,7 +497,7 @@ void ospf6_spf_calculation(uint32_t router_id, while ((v = vertex_pqueue_pop(&candidate_list))) { /* installing may result in merging or rejecting of the vertex */ - if (ospf6_spf_install(v, result_table) < 0) + if (ospf6_spf_install(v, result_table, oa->ospf6) < 0) continue; /* Skip overloaded routers */ @@ -541,7 +543,7 @@ void ospf6_spf_calculation(uint32_t router_id, w->nh_list, ROUTER_LSDESC_GET_IFID(lsdesc), NULL); else if (w->hops == 1 && v->hops == 0) - ospf6_nexthop_calc(w, v, lsdesc); + ospf6_nexthop_calc(w, v, lsdesc, oa->ospf6); else ospf6_copy_nexthops(w->nh_list, v->nh_list); @@ -912,7 +914,7 @@ int config_write_ospf6_debug_spf(struct vty *vty) return 0; } -void ospf6_spf_config_write(struct vty *vty) +void ospf6_spf_config_write(struct vty *vty, struct ospf6 *ospf6) { if (ospf6->spf_delay != OSPF_SPF_DELAY_DEFAULT diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index a387d40a57..f288f91f57 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -139,7 +139,8 @@ static inline unsigned int ospf6_lsremove_to_spf_reason(struct ospf6_lsa *lsa) return (reason); } -extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table); +extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table, + struct ospf6 *ospf6); extern void ospf6_spf_calculation(uint32_t router_id, struct ospf6_route_table *result_table, struct ospf6_area *oa); @@ -148,7 +149,7 @@ extern void ospf6_spf_schedule(struct ospf6 *ospf, unsigned int reason); extern void ospf6_spf_display_subtree(struct vty *vty, const char *prefix, int rest, struct ospf6_vertex *v); -extern void ospf6_spf_config_write(struct vty *vty); +extern void ospf6_spf_config_write(struct vty *vty, struct ospf6 *ospf6); extern int config_write_ospf6_debug_spf(struct vty *vty); extern void install_element_ospf6_debug_spf(void); extern void ospf6_spf_init(void); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 1f906cadd1..cbfa8ba3d5 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -29,6 +29,7 @@ #include "thread.h" #include "command.h" #include "defaults.h" +#include "lib/json.h" #include "lib_errors.h" #include "ospf6_proto.h" @@ -59,17 +60,76 @@ FRR_CFG_DEFAULT_BOOL(OSPF6_LOG_ADJACENCY_CHANGES, ) /* global ospf6d variable */ -struct ospf6 *ospf6; static struct ospf6_master ospf6_master; struct ospf6_master *om6; static void ospf6_disable(struct ospf6 *o); +static void ospf6_add(struct ospf6 *ospf6) +{ + listnode_add(om6->ospf6, ospf6); +} + +static void ospf6_del(struct ospf6 *ospf6) +{ + listnode_delete(om6->ospf6, ospf6); +} + +const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id) +{ + struct vrf *vrf = vrf_lookup_by_id(vrf_id); + + return vrf ? vrf->name : "NIL"; +} + +/* Link OSPF instance to VRF. */ +void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf) +{ + ospf6->vrf_id = vrf->vrf_id; + if (vrf->info != (void *)ospf6) + vrf->info = (void *)ospf6; +} + +/* Unlink OSPF instance from VRF. */ +void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf) +{ + if (vrf->info == (void *)ospf6) + vrf->info = NULL; + ospf6->vrf_id = VRF_UNKNOWN; +} + +struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id) +{ + struct vrf *vrf = NULL; + + vrf = vrf_lookup_by_id(vrf_id); + if (!vrf) + return NULL; + return (vrf->info) ? (struct ospf6 *)vrf->info : NULL; +} + +struct ospf6 *ospf6_lookup_by_vrf_name(const char *name) +{ + struct ospf6 *o = NULL; + struct listnode *node, *nnode; + + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, o)) { + if (((o->name == NULL && name == NULL) + || (o->name && name && strcmp(o->name, name) == 0))) + return o; + } + return NULL; +} + + static void ospf6_top_lsdb_hook_add(struct ospf6_lsa *lsa) { + struct ospf6 *ospf6 = NULL; + switch (ntohs(lsa->header->type)) { case OSPF6_LSTYPE_AS_EXTERNAL: - ospf6_asbr_lsa_add(lsa); + ospf6 = ospf6_get_by_lsdb(lsa); + ospf6_asbr_lsa_add(lsa, ospf6); break; default: @@ -89,20 +149,23 @@ static void ospf6_top_lsdb_hook_remove(struct ospf6_lsa *lsa) } } -static void ospf6_top_route_hook_add(struct ospf6_route *route) +static void ospf6_top_route_hook_add(struct ospf6_route *route, + struct ospf6 *ospf6) { - ospf6_abr_originate_summary(route); - ospf6_zebra_route_update_add(route); + ospf6_abr_originate_summary(route, ospf6); + ospf6_zebra_route_update_add(route, ospf6); } -static void ospf6_top_route_hook_remove(struct ospf6_route *route) +static void ospf6_top_route_hook_remove(struct ospf6_route *route, + struct ospf6 *ospf6) { route->flag |= OSPF6_ROUTE_REMOVE; - ospf6_abr_originate_summary(route); - ospf6_zebra_route_update_remove(route); + ospf6_abr_originate_summary(route, ospf6); + ospf6_zebra_route_update_remove(route, ospf6); } -static void ospf6_top_brouter_hook_add(struct ospf6_route *route) +static void ospf6_top_brouter_hook_add(struct ospf6_route *route, + struct ospf6 *ospf6) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) || IS_OSPF6_DEBUG_BROUTER) { @@ -117,12 +180,14 @@ static void ospf6_top_brouter_hook_add(struct ospf6_route *route) route->path.origin.adv_router, listcount(route->nh_list)); } - ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix)); - ospf6_asbr_lsentry_add(route); - ospf6_abr_originate_summary(route); + ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix), route, + ospf6); + ospf6_asbr_lsentry_add(route, ospf6); + ospf6_abr_originate_summary(route, ospf6); } -static void ospf6_top_brouter_hook_remove(struct ospf6_route *route) +static void ospf6_top_brouter_hook_remove(struct ospf6_route *route, + struct ospf6 *ospf6) { if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) || IS_OSPF6_DEBUG_BROUTER) { @@ -138,9 +203,10 @@ static void ospf6_top_brouter_hook_remove(struct ospf6_route *route) listcount(route->nh_list)); } route->flag |= OSPF6_ROUTE_REMOVE; - ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix)); - ospf6_asbr_lsentry_remove(route); - ospf6_abr_originate_summary(route); + ospf6_abr_examin_brouter(ADV_ROUTER_IN_PREFIX(&route->prefix), route, + ospf6); + ospf6_asbr_lsentry_remove(route, ospf6); + ospf6_abr_originate_summary(route, ospf6); } static struct ospf6 *ospf6_create(const char *name) @@ -153,9 +219,16 @@ static struct ospf6 *ospf6_create(const char *name) vrf = vrf_lookup_by_name(name); if (vrf) { o->vrf_id = vrf->vrf_id; - /* Freed in ospf6_delete */ - o->name = XSTRDUP(MTYPE_OSPF6_TOP, name); - } + } else + o->vrf_id = VRF_UNKNOWN; + + /* Freed in ospf6_delete */ + o->name = XSTRDUP(MTYPE_OSPF6_TOP, name); + if (vrf) + ospf6_vrf_link(o, vrf); + + ospf6_zebra_vrf_register(o); + /* initialize */ monotime(&o->starttime); o->area_list = list_new(); @@ -201,16 +274,20 @@ static struct ospf6 *ospf6_create(const char *name) return o; } -void ospf6_instance_create(const char *name) +struct ospf6 *ospf6_instance_create(const char *name) { + struct ospf6 *ospf6; + ospf6 = ospf6_create(name); if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES) SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES); if (ospf6->router_id == 0) - ospf6_router_id_update(); - + ospf6_router_id_update(ospf6); + ospf6_add(ospf6); thread_add_read(master, ospf6_receive, ospf6, ospf6->fd, &ospf6->t_ospf6_receive); + + return ospf6; } void ospf6_delete(struct ospf6 *o) @@ -220,8 +297,9 @@ void ospf6_delete(struct ospf6 *o) QOBJ_UNREG(o); - ospf6_flush_self_originated_lsas_now(); - ospf6_disable(ospf6); + ospf6_flush_self_originated_lsas_now(o); + ospf6_disable(o); + ospf6_del(o); for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa)) ospf6_area_delete(oa); @@ -232,10 +310,10 @@ void ospf6_delete(struct ospf6 *o) ospf6_lsdb_delete(o->lsdb); ospf6_lsdb_delete(o->lsdb_self); - ospf6_route_table_delete(o->route_table); - ospf6_route_table_delete(o->brouter_table); + ospf6_route_table_delete(o->route_table, o); + ospf6_route_table_delete(o->brouter_table, o); - ospf6_route_table_delete(o->external_table); + ospf6_route_table_delete(o->external_table, o); route_table_finish(o->external_id_table); ospf6_distance_reset(o); @@ -260,8 +338,8 @@ static void ospf6_disable(struct ospf6 *o) ospf6_asbr_redistribute_reset(o->vrf_id); ospf6_lsdb_remove_all(o->lsdb); - ospf6_route_remove_all(o->route_table); - ospf6_route_remove_all(o->brouter_table); + ospf6_route_remove_all(o->route_table, o); + ospf6_route_remove_all(o->brouter_table, o); THREAD_OFF(o->maxage_remover); THREAD_OFF(o->t_spf_calc); @@ -271,11 +349,13 @@ static void ospf6_disable(struct ospf6 *o) } } -void ospf6_master_init(void) +void ospf6_master_init(struct thread_master *master) { memset(&ospf6_master, 0, sizeof(struct ospf6_master)); om6 = &ospf6_master; + om6->ospf6 = list_new(); + om6->master = master; } static int ospf6_maxage_remover(struct thread *thread) @@ -333,7 +413,7 @@ void ospf6_maxage_remove(struct ospf6 *o) &o->maxage_remover); } -void ospf6_router_id_update(void) +void ospf6_router_id_update(struct ospf6 *ospf6) { if (!ospf6) return; @@ -351,8 +431,11 @@ DEFUN_NOSH (router_ospf6, ROUTER_STR OSPF6_STR) { + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); if (ospf6 == NULL) - ospf6_instance_create(VRF_DEFAULT_NAME); + ospf6 = ospf6_instance_create(VRF_DEFAULT_NAME); /* set current ospf point. */ VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6); @@ -368,6 +451,9 @@ DEFUN (no_router_ospf6, ROUTER_STR OSPF6_STR) { + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); if (ospf6 == NULL) vty_out(vty, "OSPFv3 is not configured\n"); else { @@ -672,13 +758,14 @@ DEFUN (ospf6_interface_area, "OSPF6 area ID in decimal notation\n" ) { - VTY_DECLVAR_CONTEXT(ospf6, o); int idx_ifname = 1; int idx_ipv4 = 3; struct ospf6_area *oa; struct ospf6_interface *oi; struct interface *ifp; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + /* find/create ospf6 interface */ ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT); oi = (struct ospf6_interface *)ifp->info; @@ -691,7 +778,7 @@ DEFUN (ospf6_interface_area, } /* parse Area-ID */ - OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa); + OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, oa, ospf6); /* attach interface to area */ listnode_add(oa->if_list, oi); /* sort ?? */ @@ -700,14 +787,14 @@ DEFUN (ospf6_interface_area, SET_FLAG(oa->flag, OSPF6_AREA_ENABLE); /* ospf6 process is currently disabled, not much more to do */ - if (CHECK_FLAG(o->flag, OSPF6_DISABLED)) + if (CHECK_FLAG(ospf6->flag, OSPF6_DISABLED)) return CMD_SUCCESS; /* start up */ ospf6_interface_enable(oi); /* If the router is ABR, originate summary routes */ - if (ospf6_is_router_abr(o)) + if (ospf6_is_router_abr(ospf6)) ospf6_abr_enable_area(oa); return CMD_SUCCESS; @@ -783,6 +870,8 @@ DEFUN (ospf6_stub_router_admin, struct listnode *node; struct ospf6_area *oa; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); + if (!CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) { for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { OSPF6_OPT_CLEAR(oa->options, OSPF6_OPT_V6); @@ -805,6 +894,7 @@ DEFUN (no_ospf6_stub_router_admin, struct listnode *node; struct ospf6_area *oa; + VTY_DECLVAR_CONTEXT(ospf6, ospf6); if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) { for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { OSPF6_OPT_SET(oa->options, OSPF6_OPT_V6); @@ -865,88 +955,207 @@ DEFUN (no_ospf6_stub_router_shutdown, } #endif -static void ospf6_show(struct vty *vty, struct ospf6 *o) + +static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json, + bool use_json) { struct listnode *n; struct ospf6_area *oa; char router_id[16], duration[32]; struct timeval now, running, result; char buf[32], rbuf[32]; + json_object *json_areas = NULL; + const char *adjacency; + + if (use_json) { + json_areas = json_object_new_object(); + + /* process id, router id */ + inet_ntop(AF_INET, &o->router_id, router_id, sizeof(router_id)); + json_object_string_add(json, "routerId", router_id); + + /* running time */ + monotime(&now); + timersub(&now, &o->starttime, &running); + timerstring(&running, duration, sizeof(duration)); + json_object_string_add(json, "running", duration); + + /* Redistribute configuration */ + /* XXX */ + json_object_int_add(json, "lsaMinimumArrivalMsecs", + o->lsa_minarrival); + + /* Show SPF parameters */ + json_object_int_add(json, "spfScheduleDelayMsecs", + o->spf_delay); + json_object_int_add(json, "holdTimeMinMsecs", o->spf_holdtime); + json_object_int_add(json, "holdTimeMaxMsecs", + o->spf_max_holdtime); + json_object_int_add(json, "holdTimeMultiplier", + o->spf_hold_multiplier); + + + if (o->ts_spf.tv_sec || o->ts_spf.tv_usec) { + timersub(&now, &o->ts_spf, &result); + timerstring(&result, buf, sizeof(buf)); + ospf6_spf_reason_string(o->last_spf_reason, rbuf, + sizeof(rbuf)); + json_object_boolean_true_add(json, "spfHasRun"); + json_object_string_add(json, "spfLastExecutedMsecs", + buf); + json_object_string_add(json, "spfLastExecutedReason", + rbuf); + + json_object_int_add( + json, "spfLastDurationSecs", + (long long)o->ts_spf_duration.tv_sec); + + json_object_int_add( + json, "spfLastDurationMsecs", + (long long)o->ts_spf_duration.tv_usec); + } else + json_object_boolean_false_add(json, "spfHasRun"); + + + threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf)); + if (o->t_spf_calc) { + long time_store; + + json_object_boolean_true_add(json, "spfTimerActive"); + time_store = + monotime_until(&o->t_spf_calc->u.sands, NULL) + / 1000LL; + json_object_int_add(json, "spfTimerDueInMsecs", + time_store); + } else + json_object_boolean_false_add(json, "spfTimerActive"); + + json_object_boolean_add(json, "routerIsStubRouter", + CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER)); + + /* LSAs */ + json_object_int_add(json, "numberOfAsScopedLsa", + o->lsdb->count); + /* Areas */ + json_object_int_add(json, "numberOfAreaInRouter", + listcount(o->area_list)); + + if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) { + if (CHECK_FLAG(o->config_flags, + OSPF6_LOG_ADJACENCY_DETAIL)) + adjacency = "LoggedAll"; + else + adjacency = "Logged"; + } else + adjacency = "NotLogged"; + json_object_string_add(json, "adjacencyChanges", adjacency); + + for (ALL_LIST_ELEMENTS_RO(o->area_list, n, oa)) + ospf6_area_show(vty, oa, json_areas, use_json); + + json_object_object_add(json, "areas", json_areas); + + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + + } else { + /* process id, router id */ + inet_ntop(AF_INET, &o->router_id, router_id, sizeof(router_id)); + vty_out(vty, " OSPFv3 Routing Process (0) with Router-ID %s\n", + router_id); + + /* running time */ + monotime(&now); + timersub(&now, &o->starttime, &running); + timerstring(&running, duration, sizeof(duration)); + vty_out(vty, " Running %s\n", duration); + + /* Redistribute configuration */ + /* XXX */ + vty_out(vty, " LSA minimum arrival %d msecs\n", + o->lsa_minarrival); + + + /* Show SPF parameters */ + vty_out(vty, + " Initial SPF scheduling delay %d millisec(s)\n" + " Minimum hold time between consecutive SPFs %d millsecond(s)\n" + " Maximum hold time between consecutive SPFs %d millsecond(s)\n" + " Hold time multiplier is currently %d\n", + o->spf_delay, o->spf_holdtime, o->spf_max_holdtime, + o->spf_hold_multiplier); + + + vty_out(vty, " SPF algorithm "); + if (o->ts_spf.tv_sec || o->ts_spf.tv_usec) { + timersub(&now, &o->ts_spf, &result); + timerstring(&result, buf, sizeof(buf)); + ospf6_spf_reason_string(o->last_spf_reason, rbuf, + sizeof(rbuf)); + vty_out(vty, "last executed %s ago, reason %s\n", buf, + rbuf); + vty_out(vty, " Last SPF duration %lld sec %lld usec\n", + (long long)o->ts_spf_duration.tv_sec, + (long long)o->ts_spf_duration.tv_usec); + } else + vty_out(vty, "has not been run\n"); + + threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf)); + vty_out(vty, " SPF timer %s%s\n", + (o->t_spf_calc ? "due in " : "is "), buf); + + if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER)) + vty_out(vty, " Router Is Stub Router\n"); + + /* LSAs */ + vty_out(vty, " Number of AS scoped LSAs is %u\n", + o->lsdb->count); + + /* Areas */ + vty_out(vty, " Number of areas in this router is %u\n", + listcount(o->area_list)); + + if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) { + if (CHECK_FLAG(o->config_flags, + OSPF6_LOG_ADJACENCY_DETAIL)) + vty_out(vty, + " All adjacency changes are logged\n"); + else + vty_out(vty, " Adjacency changes are logged\n"); + } - /* process id, router id */ - inet_ntop(AF_INET, &o->router_id, router_id, sizeof(router_id)); - vty_out(vty, " OSPFv3 Routing Process (0) with Router-ID %s\n", - router_id); - - /* running time */ - monotime(&now); - timersub(&now, &o->starttime, &running); - timerstring(&running, duration, sizeof(duration)); - vty_out(vty, " Running %s\n", duration); - - /* Redistribute configuration */ - /* XXX */ - - vty_out(vty, " LSA minimum arrival %d msecs\n", o->lsa_minarrival); - - /* Show SPF parameters */ - vty_out(vty, - " Initial SPF scheduling delay %d millisec(s)\n" - " Minimum hold time between consecutive SPFs %d millsecond(s)\n" - " Maximum hold time between consecutive SPFs %d millsecond(s)\n" - " Hold time multiplier is currently %d\n", - o->spf_delay, o->spf_holdtime, o->spf_max_holdtime, - o->spf_hold_multiplier); - - vty_out(vty, " SPF algorithm "); - if (o->ts_spf.tv_sec || o->ts_spf.tv_usec) { - timersub(&now, &o->ts_spf, &result); - timerstring(&result, buf, sizeof(buf)); - ospf6_spf_reason_string(o->last_spf_reason, rbuf, sizeof(rbuf)); - vty_out(vty, "last executed %s ago, reason %s\n", buf, rbuf); - vty_out(vty, " Last SPF duration %lld sec %lld usec\n", - (long long)o->ts_spf_duration.tv_sec, - (long long)o->ts_spf_duration.tv_usec); - } else - vty_out(vty, "has not been run\n"); - threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf)); - vty_out(vty, " SPF timer %s%s\n", (o->t_spf_calc ? "due in " : "is "), - buf); - - if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER)) - vty_out(vty, " Router Is Stub Router\n"); - - /* LSAs */ - vty_out(vty, " Number of AS scoped LSAs is %u\n", o->lsdb->count); - - /* Areas */ - vty_out(vty, " Number of areas in this router is %u\n", - listcount(o->area_list)); - - if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) { - if (CHECK_FLAG(o->config_flags, OSPF6_LOG_ADJACENCY_DETAIL)) - vty_out(vty, " All adjacency changes are logged\n"); - else - vty_out(vty, " Adjacency changes are logged\n"); - } - vty_out(vty, "\n"); + vty_out(vty, "\n"); - for (ALL_LIST_ELEMENTS_RO(o->area_list, n, oa)) - ospf6_area_show(vty, oa); + for (ALL_LIST_ELEMENTS_RO(o->area_list, n, oa)) + ospf6_area_show(vty, oa, json_areas, use_json); + } } /* show top level structures */ -DEFUN (show_ipv6_ospf6, - show_ipv6_ospf6_cmd, - "show ipv6 ospf6", - SHOW_STR - IP6_STR - OSPF6_STR) +DEFUN(show_ipv6_ospf6, + show_ipv6_ospf6_cmd, + "show ipv6 ospf6 [json]", + SHOW_STR + IP6_STR + OSPF6_STR + JSON_STR) { - OSPF6_CMD_CHECK_RUNNING(); + struct ospf6 *ospf6; + bool uj = use_json(argc, argv); + json_object *json = NULL; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); + + if (uj) + json = json_object_new_object(); - ospf6_show(vty, ospf6); + ospf6_show(vty, ospf6, json, uj); + + if (uj) + json_object_free(json); return CMD_SUCCESS; } @@ -966,7 +1175,10 @@ DEFUN (show_ipv6_ospf6_route, "Detailed information\n" "Summary of route table\n") { - OSPF6_CMD_CHECK_RUNNING(); + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; @@ -983,9 +1195,13 @@ DEFUN (show_ipv6_ospf6_route_match, "Display routes which match the specified route\n" "Display routes longer than the specified route\n") { - OSPF6_CMD_CHECK_RUNNING(); + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table); + return CMD_SUCCESS; } @@ -1001,7 +1217,10 @@ DEFUN (show_ipv6_ospf6_route_match_detail, "Detailed information\n" ) { - OSPF6_CMD_CHECK_RUNNING(); + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; @@ -1022,13 +1241,16 @@ DEFUN (show_ipv6_ospf6_route_type_detail, "Detailed information\n" ) { - OSPF6_CMD_CHECK_RUNNING(); + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table); return CMD_SUCCESS; } -static void ospf6_stub_router_config_write(struct vty *vty) +static void ospf6_stub_router_config_write(struct vty *vty, struct ospf6 *ospf6) { if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) { vty_out(vty, " stub-router administrative\n"); @@ -1036,7 +1258,7 @@ static void ospf6_stub_router_config_write(struct vty *vty) return; } -static int ospf6_distance_config_write(struct vty *vty) +static int ospf6_distance_config_write(struct vty *vty, struct ospf6 *ospf6) { struct route_node *rn; struct ospf6_distance *odistance; @@ -1070,52 +1292,56 @@ static int ospf6_distance_config_write(struct vty *vty) /* OSPF configuration write function. */ static int config_write_ospf6(struct vty *vty) { - char router_id[16]; struct listnode *j, *k; struct ospf6_area *oa; struct ospf6_interface *oi; + struct ospf6 *ospf6; + struct listnode *node, *nnode; /* OSPFv3 configuration. */ - if (ospf6 == NULL) + if (om6 == NULL) return CMD_SUCCESS; - inet_ntop(AF_INET, &ospf6->router_id_static, router_id, - sizeof(router_id)); - vty_out(vty, "router ospf6\n"); - if (ospf6->router_id_static != 0) - vty_out(vty, " ospf6 router-id %s\n", router_id); - - /* log-adjacency-changes flag print. */ - if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES)) { - if (CHECK_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL)) - vty_out(vty, " log-adjacency-changes detail\n"); - else if (!SAVE_OSPF6_LOG_ADJACENCY_CHANGES) - vty_out(vty, " log-adjacency-changes\n"); - } else if (SAVE_OSPF6_LOG_ADJACENCY_CHANGES) { - vty_out(vty, " no log-adjacency-changes\n"); - } + for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) { + vty_out(vty, "router ospf6\n"); + if (ospf6->router_id_static != 0) + vty_out(vty, " ospf6 router-id %pI4\n", + &ospf6->router_id_static); + + /* log-adjacency-changes flag print. */ + if (CHECK_FLAG(ospf6->config_flags, + OSPF6_LOG_ADJACENCY_CHANGES)) { + if (CHECK_FLAG(ospf6->config_flags, + OSPF6_LOG_ADJACENCY_DETAIL)) + vty_out(vty, " log-adjacency-changes detail\n"); + else if (!SAVE_OSPF6_LOG_ADJACENCY_CHANGES) + vty_out(vty, " log-adjacency-changes\n"); + } else if (SAVE_OSPF6_LOG_ADJACENCY_CHANGES) { + vty_out(vty, " no log-adjacency-changes\n"); + } - if (ospf6->ref_bandwidth != OSPF6_REFERENCE_BANDWIDTH) - vty_out(vty, " auto-cost reference-bandwidth %d\n", - ospf6->ref_bandwidth); - - /* LSA timers print. */ - if (ospf6->lsa_minarrival != OSPF_MIN_LS_ARRIVAL) - vty_out(vty, " timers lsa min-arrival %d\n", - ospf6->lsa_minarrival); - - ospf6_stub_router_config_write(vty); - ospf6_redistribute_config_write(vty); - ospf6_area_config_write(vty); - ospf6_spf_config_write(vty); - ospf6_distance_config_write(vty); - - for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, j, oa)) { - for (ALL_LIST_ELEMENTS_RO(oa->if_list, k, oi)) - vty_out(vty, " interface %s area %s\n", - oi->interface->name, oa->name); + if (ospf6->ref_bandwidth != OSPF6_REFERENCE_BANDWIDTH) + vty_out(vty, " auto-cost reference-bandwidth %d\n", + ospf6->ref_bandwidth); + + /* LSA timers print. */ + if (ospf6->lsa_minarrival != OSPF_MIN_LS_ARRIVAL) + vty_out(vty, " timers lsa min-arrival %d\n", + ospf6->lsa_minarrival); + + ospf6_stub_router_config_write(vty, ospf6); + ospf6_redistribute_config_write(vty, ospf6); + ospf6_area_config_write(vty, ospf6); + ospf6_spf_config_write(vty, ospf6); + ospf6_distance_config_write(vty, ospf6); + + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, j, oa)) { + for (ALL_LIST_ELEMENTS_RO(oa->if_list, k, oi)) + vty_out(vty, " interface %s area %s\n", + oi->interface->name, oa->name); + } + vty_out(vty, "!\n"); } - vty_out(vty, "!\n"); return 0; } diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index a78b05d565..52e1d7ee2b 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -23,9 +23,12 @@ #include "qobj.h" #include "routemap.h" - struct ospf6_master { + /* OSPFv3 instance. */ + struct list *ospf6; + /* OSPFv3 thread master. */ + struct thread_master *master; in_addr_t zebra_router_id; }; @@ -128,12 +131,17 @@ extern struct ospf6 *ospf6; extern struct ospf6_master *om6; /* prototypes */ -extern void ospf6_master_init(void); +extern void ospf6_master_init(struct thread_master *master); extern void ospf6_top_init(void); extern void ospf6_delete(struct ospf6 *o); -extern void ospf6_router_id_update(void); +extern void ospf6_router_id_update(struct ospf6 *ospf6); extern void ospf6_maxage_remove(struct ospf6 *o); -extern void ospf6_instance_create(const char *name); +extern struct ospf6 *ospf6_instance_create(const char *name); +void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf); +void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf); +struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id); +struct ospf6 *ospf6_lookup_by_vrf_name(const char *name); +const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id); #endif /* OSPF6_TOP_H */ diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index c5c8ca27b9..f21e940a77 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -39,6 +39,8 @@ #include "ospf6_asbr.h" #include "ospf6_zebra.h" #include "ospf6d.h" +#include "ospf6_area.h" +#include "lib/json.h" DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DISTANCE, "OSPF6 distance") @@ -47,16 +49,49 @@ unsigned char conf_debug_ospf6_zebra = 0; /* information about zebra. */ struct zclient *zclient = NULL; +void ospf6_zebra_vrf_register(struct ospf6 *ospf6) +{ + if (!zclient || zclient->sock < 0 || !ospf6) + return; + + if (ospf6->vrf_id != VRF_UNKNOWN) { + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { + zlog_debug("%s: Register VRF %s id %u", __func__, + ospf6_vrf_id_to_name(ospf6->vrf_id), + ospf6->vrf_id); + } + zclient_send_reg_requests(zclient, ospf6->vrf_id); + } +} + +void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6) +{ + if (!zclient || zclient->sock < 0 || !ospf6) + return; + + if (ospf6->vrf_id != VRF_DEFAULT && ospf6->vrf_id != VRF_UNKNOWN) { + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { + zlog_debug("%s: De-Register VRF %s id %u to Zebra.", + __func__, + ospf6_vrf_id_to_name(ospf6->vrf_id), + ospf6->vrf_id); + } + /* Deregister for router-id, interfaces, + * redistributed routes. */ + zclient_send_dereg_requests(zclient, ospf6->vrf_id); + } +} + /* Router-id update message from zebra. */ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct prefix router_id; - struct ospf6 *o = ospf6; + struct ospf6 *o; zebra_router_id_update_read(zclient->ibuf, &router_id); om6->zebra_router_id = router_id.u.prefix4.s_addr; - + o = ospf6_lookup_by_vrf_id(vrf_id); if (o == NULL) return 0; @@ -69,7 +104,7 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) INET_ADDRSTRLEN)); } - ospf6_router_id_update(); + ospf6_router_id_update(o); return 0; } @@ -146,6 +181,9 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) struct zapi_route api; unsigned long ifindex; struct in6_addr *nexthop; + struct ospf6 *ospf6; + + ospf6 = ospf6_lookup_by_vrf_id(vrf_id); if (ospf6 == NULL) return 0; @@ -173,44 +211,80 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix, - api.nexthop_num, nexthop, api.tag); + api.nexthop_num, nexthop, api.tag, + ospf6); else - ospf6_asbr_redistribute_remove(api.type, ifindex, &api.prefix); + ospf6_asbr_redistribute_remove(api.type, ifindex, &api.prefix, + ospf6); return 0; } -DEFUN (show_zebra, - show_ospf6_zebra_cmd, - "show ipv6 ospf6 zebra", - SHOW_STR - IPV6_STR - OSPF6_STR - ZEBRA_STR) +DEFUN(show_zebra, + show_ospf6_zebra_cmd, + "show ipv6 ospf6 zebra [json]", + SHOW_STR + IPV6_STR + OSPF6_STR + ZEBRA_STR + JSON_STR) { int i; + bool uj = use_json(argc, argv); + json_object *json; + json_object *json_zebra; + json_object *json_array; + if (zclient == NULL) { vty_out(vty, "Not connected to zebra\n"); return CMD_SUCCESS; } - vty_out(vty, "Zebra Information\n"); - vty_out(vty, " fail: %d\n", zclient->fail); - vty_out(vty, " redistribute default: %d\n", - vrf_bitmap_check(zclient->default_information[AFI_IP6], - VRF_DEFAULT)); - vty_out(vty, " redistribute:"); - for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { - if (vrf_bitmap_check(zclient->redist[AFI_IP6][i], VRF_DEFAULT)) - vty_out(vty, " %s", zebra_route_string(i)); + if (uj) { + json = json_object_new_object(); + json_zebra = json_object_new_object(); + json_array = json_object_new_array(); + + json_object_int_add(json_zebra, "fail", zclient->fail); + json_object_int_add( + json_zebra, "redistributeDefault", + vrf_bitmap_check(zclient->default_information[AFI_IP6], + VRF_DEFAULT)); + for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { + if (vrf_bitmap_check(zclient->redist[AFI_IP6][i], + VRF_DEFAULT)) + json_object_array_add( + json_array, + json_object_new_string( + zebra_route_string(i))); + } + json_object_object_add(json_zebra, "redistribute", json_array); + json_object_object_add(json, "zebraInformation", json_zebra); + + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + } else { + vty_out(vty, "Zebra Infomation\n"); + vty_out(vty, " fail: %d\n", zclient->fail); + vty_out(vty, " redistribute default: %d\n", + vrf_bitmap_check(zclient->default_information[AFI_IP6], + VRF_DEFAULT)); + vty_out(vty, " redistribute:"); + for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { + if (vrf_bitmap_check(zclient->redist[AFI_IP6][i], + VRF_DEFAULT)) + vty_out(vty, " %s", zebra_route_string(i)); + } + vty_out(vty, "\n"); } - vty_out(vty, "\n"); return CMD_SUCCESS; } #define ADD 0 #define REM 1 -static void ospf6_zebra_route_update(int type, struct ospf6_route *request) +static void ospf6_zebra_route_update(int type, struct ospf6_route *request, + struct ospf6 *ospf6) { struct zapi_route api; int nhcount; @@ -280,15 +354,15 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request) } SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE); - api.distance = - ospf6_distance_apply((struct prefix_ipv6 *)dest, request); + api.distance = ospf6_distance_apply((struct prefix_ipv6 *)dest, request, + ospf6); if (type == REM) ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); else ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); - if (ret < 0) + if (ret == ZCLIENT_SEND_FAILURE) flog_err(EC_LIB_ZAPI_SOCKET, "zclient_route_send() %s failed: %s", (type == REM ? "delete" : "add"), @@ -297,17 +371,19 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request) return; } -void ospf6_zebra_route_update_add(struct ospf6_route *request) +void ospf6_zebra_route_update_add(struct ospf6_route *request, + struct ospf6 *ospf6) { - ospf6_zebra_route_update(ADD, request); + ospf6_zebra_route_update(ADD, request, ospf6); } -void ospf6_zebra_route_update_remove(struct ospf6_route *request) +void ospf6_zebra_route_update_remove(struct ospf6_route *request, + struct ospf6 *ospf6) { - ospf6_zebra_route_update(REM, request); + ospf6_zebra_route_update(REM, request, ospf6); } -void ospf6_zebra_add_discard(struct ospf6_route *request) +void ospf6_zebra_add_discard(struct ospf6_route *request, struct ospf6 *ospf6) { struct zapi_route api; struct prefix *dest = &request->prefix; @@ -334,7 +410,8 @@ void ospf6_zebra_add_discard(struct ospf6_route *request) } } -void ospf6_zebra_delete_discard(struct ospf6_route *request) +void ospf6_zebra_delete_discard(struct ospf6_route *request, + struct ospf6 *ospf6) { struct zapi_route api; struct prefix *dest = &request->prefix; @@ -462,7 +539,8 @@ void ospf6_distance_reset(struct ospf6 *o) } } -uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) +uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or, + struct ospf6 *ospf6) { struct ospf6 *o; diff --git a/ospf6d/ospf6_zebra.h b/ospf6d/ospf6_zebra.h index d23268303a..5f340924b9 100644 --- a/ospf6d/ospf6_zebra.h +++ b/ospf6d/ospf6_zebra.h @@ -41,21 +41,26 @@ struct ospf6_distance { }; extern struct zclient *zclient; +struct ospf6; -extern void ospf6_zebra_route_update_add(struct ospf6_route *request); -extern void ospf6_zebra_route_update_remove(struct ospf6_route *request); +extern void ospf6_zebra_route_update_add(struct ospf6_route *request, + struct ospf6 *ospf6); +extern void ospf6_zebra_route_update_remove(struct ospf6_route *request, + struct ospf6 *ospf6); extern void ospf6_zebra_redistribute(int, vrf_id_t vrf_id); extern void ospf6_zebra_no_redistribute(int, vrf_id_t vrf_id); #define ospf6_zebra_is_redistribute(type, vrf_id) \ vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id) extern void ospf6_zebra_init(struct thread_master *); -extern void ospf6_zebra_add_discard(struct ospf6_route *request); -extern void ospf6_zebra_delete_discard(struct ospf6_route *request); +extern void ospf6_zebra_add_discard(struct ospf6_route *request, + struct ospf6 *ospf6); +extern void ospf6_zebra_delete_discard(struct ospf6_route *request, + struct ospf6 *ospf6); -struct ospf6; extern void ospf6_distance_reset(struct ospf6 *); -extern uint8_t ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *); +extern uint8_t ospf6_distance_apply(struct prefix_ipv6 *, struct ospf6_route *, + struct ospf6 *); extern int ospf6_distance_set(struct vty *, struct ospf6 *, const char *, const char *, const char *); @@ -64,5 +69,6 @@ extern int ospf6_distance_unset(struct vty *, struct ospf6 *, const char *, extern int config_write_ospf6_debug_zebra(struct vty *vty); extern void install_element_ospf6_debug_zebra(void); - +extern void ospf6_zebra_vrf_register(struct ospf6 *ospf6); +extern void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6); #endif /*OSPF6_ZEBRA_H*/ diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 151ed2bf29..fe519d0a26 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -168,20 +168,22 @@ DEFUN (show_ipv6_ospf6_database, int idx_level = 4; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); level = parse_show_level(idx_level, argc, argv); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, NULL, NULL, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -190,7 +192,7 @@ DEFUN (show_ipv6_ospf6_database, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, NULL, NULL, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, NULL, NULL, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -221,19 +223,21 @@ DEFUN (show_ipv6_ospf6_database_type, int idx_level = 5; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); level = parse_show_level(idx_level, argc, argv); switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, NULL, NULL, oa->lsdb); @@ -241,7 +245,7 @@ DEFUN (show_ipv6_ospf6_database_type, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -253,7 +257,7 @@ DEFUN (show_ipv6_ospf6_database_type, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, NULL, NULL, o->lsdb); + ospf6_lsdb_show(vty, level, &type, NULL, NULL, ospf6->lsdb); break; default: @@ -283,24 +287,26 @@ DEFUN (show_ipv6_ospf6_database_id, int idx_level = 6; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint32_t id = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); if (argv[idx_ipv4]->type == IPV4_TKN) inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); level = parse_show_level(idx_level, argc, argv); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, &id, NULL, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -309,7 +315,7 @@ DEFUN (show_ipv6_ospf6_database_id, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, &id, NULL, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, &id, NULL, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -334,21 +340,23 @@ DEFUN (show_ipv6_ospf6_database_router, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); level = parse_show_level(idx_level, argc, argv); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -358,7 +366,7 @@ DEFUN (show_ipv6_ospf6_database_router, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -379,15 +387,18 @@ DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, uint16_t type = htons(OSPF6_LSTYPE_ROUTER); int idx_ipv4 = 6; struct listnode *i; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_lsdb *lsdb; uint32_t adv_router = 0; + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); + inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { - if (adv_router == o->router_id) + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { + if (adv_router == ospf6->router_id) lsdb = oa->lsdb_self; else lsdb = oa->lsdb; @@ -435,13 +446,15 @@ DEFUN (show_ipv6_ospf6_database_type_id, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t id = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_ipv4]->arg, &id); @@ -449,14 +462,14 @@ DEFUN (show_ipv6_ospf6_database_type_id, switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, &id, NULL, oa->lsdb); } break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -468,7 +481,7 @@ DEFUN (show_ipv6_ospf6_database_type_id, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, &id, NULL, o->lsdb); + ospf6_lsdb_show(vty, level, &type, &id, NULL, ospf6->lsdb); break; default: @@ -509,21 +522,22 @@ DEFUN (show_ipv6_ospf6_database_type_router, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); level = parse_show_level(idx_level, argc, argv); switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, oa->lsdb); @@ -531,7 +545,7 @@ DEFUN (show_ipv6_ospf6_database_type_router, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -543,7 +557,8 @@ DEFUN (show_ipv6_ospf6_database_type_router, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, + ospf6->lsdb); break; default: @@ -576,23 +591,24 @@ DEFUN (show_ipv6_ospf6_database_id_router, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint32_t id = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); level = parse_show_level(idx_level, argc, argv); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -602,7 +618,7 @@ DEFUN (show_ipv6_ospf6_database_id_router, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -629,23 +645,25 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, int idx_level = 8; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint32_t id = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); level = parse_show_level(idx_level, argc, argv); - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -655,7 +673,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, &id, &adv_router, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -688,14 +706,16 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t id = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); @@ -704,7 +724,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, &id, &adv_router, oa->lsdb); @@ -712,7 +732,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -724,7 +744,8 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, &id, &adv_router, + ospf6->lsdb); break; default: @@ -766,14 +787,16 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, int idx_level = 9; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t id = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); @@ -782,7 +805,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, &id, &adv_router, oa->lsdb); @@ -790,7 +813,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -802,7 +825,8 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, &id, &adv_router, + ospf6->lsdb); break; default: @@ -829,21 +853,22 @@ DEFUN (show_ipv6_ospf6_database_self_originated, int idx_level = 5; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); level = parse_show_level(idx_level, argc, argv); - adv_router = o->router_id; + adv_router = ospf6->router_id; - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, oa->lsdb); } - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -853,7 +878,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, } vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, NULL, NULL, &adv_router, ospf6->lsdb); vty_out(vty, "\n"); return CMD_SUCCESS; @@ -885,22 +910,22 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, int idx_level = 6; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t adv_router = 0; - OSPF6_CMD_CHECK_RUNNING(); - + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); level = parse_show_level(idx_level, argc, argv); - adv_router = o->router_id; + adv_router = ospf6->router_id; switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, oa->lsdb); @@ -908,7 +933,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -920,7 +945,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, NULL, &adv_router, + ospf6->lsdb); break; default: @@ -960,23 +986,23 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, int idx_level = 8; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t adv_router = 0; uint32_t id = 0; - OSPF6_CMD_CHECK_RUNNING(); - + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); level = parse_show_level(idx_level, argc, argv); - adv_router = o->router_id; + adv_router = ospf6->router_id; switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, &id, &adv_router, oa->lsdb); @@ -984,7 +1010,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -996,7 +1022,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, &id, &adv_router, + ospf6->lsdb); break; default: @@ -1035,23 +1062,23 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, int idx_level = 7; int level; struct listnode *i, *j; - struct ospf6 *o = ospf6; + struct ospf6 *ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; uint16_t type = 0; uint32_t adv_router = 0; uint32_t id = 0; - OSPF6_CMD_CHECK_RUNNING(); - + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); type = parse_type_spec(idx_lsa, argc, argv); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); level = parse_show_level(idx_level, argc, argv); - adv_router = o->router_id; + adv_router = ospf6->router_id; switch (OSPF6_LSA_SCOPE(type)) { case OSPF6_SCOPE_AREA: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { vty_out(vty, AREA_LSDB_TITLE_FORMAT, oa->name); ospf6_lsdb_show(vty, level, &type, &id, &adv_router, oa->lsdb); @@ -1059,7 +1086,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, break; case OSPF6_SCOPE_LINKLOCAL: - for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) { for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) { vty_out(vty, IF_LSDB_TITLE_FORMAT, oi->interface->name, oa->name); @@ -1071,7 +1098,8 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, case OSPF6_SCOPE_AS: vty_out(vty, AS_LSDB_TITLE_FORMAT); - ospf6_lsdb_show(vty, level, &type, &id, &adv_router, o->lsdb); + ospf6_lsdb_show(vty, level, &type, &id, &adv_router, + ospf6->lsdb); break; default: @@ -1097,9 +1125,11 @@ DEFUN (show_ipv6_ospf6_border_routers, uint32_t adv_router; struct ospf6_route *ro; struct prefix prefix; + struct ospf6 *ospf6 = NULL; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); if (argc == 5) { if (strmatch(argv[idx_ipv4]->text, "detail")) { for (ro = ospf6_route_head(ospf6->brouter_table); ro; @@ -1148,9 +1178,10 @@ DEFUN (show_ipv6_ospf6_linkstate, int idx_ipv4 = 5; struct listnode *node; struct ospf6_area *oa; + struct ospf6 *ospf6 = NULL; - OSPF6_CMD_CHECK_RUNNING(); - + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); ospf6_linkstate_table_show(vty, idx_ipv4, argc, argv, @@ -1174,8 +1205,10 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, int idx_detail = 4; struct listnode *node; struct ospf6_area *oa; + struct ospf6 *ospf6 = NULL; - OSPF6_CMD_CHECK_RUNNING(); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); + OSPF6_CMD_CHECK_RUNNING(ospf6); for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { vty_out(vty, "\n SPF Result in Area %s\n\n", oa->name); @@ -1202,8 +1235,10 @@ static void ospf6_plist_del(struct prefix_list *plist) } /* Install ospf related commands. */ -void ospf6_init(void) +void ospf6_init(struct thread_master *master) { + struct ospf6 *ospf6; + ospf6_top_init(); ospf6_area_init(); ospf6_interface_init(); @@ -1268,16 +1303,7 @@ void ospf6_init(void) &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd); install_element(VIEW_NODE, &show_ipv6_ospf6_database_aggr_router_cmd); + ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME); if (ospf6 == NULL) ospf6_instance_create(VRF_DEFAULT_NAME); } - -void ospf6_clean(void) -{ - if (!ospf6) - return; - if (ospf6->route_table) - ospf6_route_remove_all(ospf6->route_table); - if (ospf6->brouter_table) - ospf6_route_remove_all(ospf6->brouter_table); -} diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index 36f3c2233f..d85ff40f32 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -88,7 +88,7 @@ extern struct thread_master *master; #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n" #define OSPF6_LS_ID_STR "Specify Link State ID\n" -#define OSPF6_CMD_CHECK_RUNNING() \ +#define OSPF6_CMD_CHECK_RUNNING(ospf6) \ if (ospf6 == NULL) { \ vty_out(vty, "OSPFv3 is not running\n"); \ return CMD_SUCCESS; \ @@ -100,6 +100,6 @@ extern struct zebra_privs_t ospf6d_privs; extern struct route_node *route_prev(struct route_node *node); extern void ospf6_debug(void); -extern void ospf6_init(void); +extern void ospf6_init(struct thread_master *master); #endif /* OSPF6D_H */ diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 634418ec5a..f3c4798906 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -379,7 +379,7 @@ static int ospf_abr_nssa_am_elected(struct ospf_area *area) /* Check NSSA ABR status * assumes there are nssa areas */ -static void ospf_abr_nssa_check_status(struct ospf *ospf) +void ospf_abr_nssa_check_status(struct ospf *ospf) { struct ospf_area *area; struct listnode *lnode, *nnode; diff --git a/ospfd/ospf_abr.h b/ospfd/ospf_abr.h index b3007622c4..e15f4a6bf7 100644 --- a/ospfd/ospf_abr.h +++ b/ospfd/ospf_abr.h @@ -83,4 +83,5 @@ extern void ospf_schedule_abr_task(struct ospf *); extern void ospf_abr_announce_network_to_area(struct prefix_ipv4 *, uint32_t, struct ospf_area *); +extern void ospf_abr_nssa_check_status(struct ospf *ospf); #endif /* _ZEBRA_OSPF_ABR_H */ diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index fd9b166433..94fa1b5b44 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -42,7 +42,7 @@ #include "ospfd/ospf_route.h" #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_dump.h" - +#include "ospfd/ospf_errors.h" /* Remove external route. */ void ospf_external_route_remove(struct ospf *ospf, struct prefix_ipv4 *p) @@ -80,6 +80,7 @@ struct external_info *ospf_external_info_new(uint8_t type, new = XCALLOC(MTYPE_OSPF_EXTERNAL_INFO, sizeof(struct external_info)); new->type = type; new->instance = instance; + new->to_be_processed = 0; ospf_reset_route_map_set_values(&new->route_map_set); return new; @@ -147,6 +148,7 @@ ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance, new->nexthop = nexthop; new->tag = tag; new->orig_tag = tag; + new->aggr_route = NULL; /* we don't unlock rn from the get() because we're attaching the info */ if (rn) @@ -327,3 +329,890 @@ void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type, rn->info = NULL; } } + +/* External Route Aggregator Handlers */ +bool is_valid_summary_addr(struct prefix_ipv4 *p) +{ + /* Default prefix validation*/ + if (p->prefix.s_addr == INADDR_ANY) + return false; + + /*Host route shouldn't be configured as summary addres*/ + if (p->prefixlen == IPV4_MAX_PREFIXLEN) + return false; + + return true; +} +void ospf_asbr_external_aggregator_init(struct ospf *instance) +{ + instance->rt_aggr_tbl = route_table_init(); + + instance->t_external_aggr = NULL; + + instance->aggr_action = 0; + + instance->aggr_delay_interval = OSPF_EXTL_AGGR_DEFAULT_DELAY; +} + +static unsigned int ospf_external_rt_hash_key(const void *data) +{ + const struct external_info *ei = data; + unsigned int key = 0; + + key = prefix_hash_key(&ei->p); + return key; +} + +static bool ospf_external_rt_hash_cmp(const void *d1, const void *d2) +{ + const struct external_info *ei1 = d1; + const struct external_info *ei2 = d2; + + return prefix_same((struct prefix *)&ei1->p, (struct prefix *)&ei2->p); +} + +static struct ospf_external_aggr_rt * +ospf_external_aggregator_new(struct prefix_ipv4 *p) +{ + struct ospf_external_aggr_rt *aggr; + + aggr = (struct ospf_external_aggr_rt *)XCALLOC( + MTYPE_OSPF_EXTERNAL_RT_AGGR, + sizeof(struct ospf_external_aggr_rt)); + + if (!aggr) + return NULL; + + aggr->p.family = p->family; + aggr->p.prefix = p->prefix; + aggr->p.prefixlen = p->prefixlen; + aggr->match_extnl_hash = hash_create(ospf_external_rt_hash_key, + ospf_external_rt_hash_cmp, + "Ospf external route hash"); + return aggr; +} + +static void ospf_aggr_handle_external_info(void *data) +{ + struct external_info *ei = (struct external_info *)data; + struct ospf_external_aggr_rt *aggr = NULL; + struct ospf *ospf = NULL; + struct ospf_lsa *lsa = NULL; + + ei->aggr_route = NULL; + + ei->to_be_processed = true; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Handle extrenal route(%pI4/%d)", __func__, + &ei->p.prefix, ei->p.prefixlen); + + ospf = ospf_lookup_instance(ei->instance); + + assert(ospf); + + if (!ospf_redistribute_check(ospf, ei, NULL)) + return; + + aggr = ospf_external_aggr_match(ospf, &ei->p); + if (aggr) { + (void)ospf_originate_summary_lsa(ospf, aggr, ei); + return; + } + + lsa = ospf_external_info_find_lsa(ospf, &ei->p); + if (lsa) + ospf_external_lsa_refresh(ospf, lsa, ei, LSA_REFRESH_FORCE, 1); + else + (void)ospf_external_lsa_originate(ospf, ei); +} + +static void ospf_aggr_unlink_external_info(void *data) +{ + struct external_info *ei = (struct external_info *)data; + + ei->aggr_route = NULL; + + ei->to_be_processed = true; +} + +void ospf_external_aggregator_free(struct ospf_external_aggr_rt *aggr) +{ + if (OSPF_EXTERNAL_RT_COUNT(aggr)) + hash_clean(aggr->match_extnl_hash, + (void *)ospf_aggr_unlink_external_info); + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Release the aggregator Address(%pI4/%d)", + __func__, &aggr->p.prefix, aggr->p.prefixlen); + hash_free(aggr->match_extnl_hash); + aggr->match_extnl_hash = NULL; + + XFREE(MTYPE_OSPF_EXTERNAL_RT_AGGR, aggr); +} + +static void ospf_external_aggr_add(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr) +{ + struct route_node *rn; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Adding Aggregate route to Aggr table (%pI4/%d)", + __func__, &aggr->p.prefix, aggr->p.prefixlen); + rn = route_node_get(ospf->rt_aggr_tbl, (struct prefix *)&aggr->p); + if (rn->info) + route_unlock_node(rn); + else + rn->info = aggr; +} + +static void ospf_external_aggr_delete(struct ospf *ospf, struct route_node *rn) +{ + struct ospf_external_aggr_rt *aggr = rn->info; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Deleting Aggregate route (%pI4/%d)", __func__, + &aggr->p.prefix, aggr->p.prefixlen); + + /* Sent a Max age LSA if it is already originated. */ + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Flushing Aggregate route (%pI4/%d)", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + ospf_external_lsa_flush(ospf, 0, &aggr->p, 0); + } + + rn->info = NULL; + route_unlock_node(rn); + route_unlock_node(rn); +} + +struct ospf_external_aggr_rt * +ospf_extrenal_aggregator_lookup(struct ospf *ospf, struct prefix_ipv4 *p) +{ + struct route_node *rn; + struct ospf_external_aggr_rt *summary_rt = NULL; + + rn = route_node_lookup(ospf->rt_aggr_tbl, (struct prefix *)p); + if (rn) { + summary_rt = rn->info; + route_unlock_node(rn); + return summary_rt; + } + return NULL; +} + +struct ospf_external_aggr_rt *ospf_external_aggr_match(struct ospf *ospf, + struct prefix_ipv4 *p) +{ + struct route_node *node; + struct ospf_external_aggr_rt *summary_rt = NULL; + + node = route_node_match(ospf->rt_aggr_tbl, (struct prefix *)p); + if (node) { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + if (node->info) { + struct ospf_external_aggr_rt *ag = node->info; + + zlog_debug( + "%s: Matching aggregator found.prefix:%pI4/%d Aggregator %pI4/%d\n", + __func__, &p->prefix, p->prefixlen, + &ag->p.prefix, ag->p.prefixlen); + } + + summary_rt = node->info; + route_unlock_node(node); + return summary_rt; + } + return NULL; +} + +void ospf_unlink_ei_from_aggr(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei) +{ + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Unlinking extrenal route(%pI4/%d) from aggregator(%pI4/%d), external route count:%ld", + __func__, &ei->p.prefix, ei->p.prefixlen, + &aggr->p.prefix, aggr->p.prefixlen, + OSPF_EXTERNAL_RT_COUNT(aggr)); + hash_release(aggr->match_extnl_hash, ei); + ei->aggr_route = NULL; + + /* Flush the aggreagte route if matching + * external route count becomes zero. + */ + if (!OSPF_EXTERNAL_RT_COUNT(aggr) + && CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Flushing the aggreagte route (%pI4/%d)", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + + /* Flush the aggregate LSA */ + ospf_external_lsa_flush(ospf, 0, &aggr->p, 0); + + /* Unset the Origination flag */ + UNSET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + } +} + +static void ospf_link_ei_to_aggr(struct ospf_external_aggr_rt *aggr, + struct external_info *ei) +{ + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Linking extrenal route(%pI4/%d) to aggregator(%pI4/%d)", + __func__, &ei->p.prefix, ei->p.prefixlen, + &aggr->p.prefix, aggr->p.prefixlen); + hash_get(aggr->match_extnl_hash, ei, hash_alloc_intern); + ei->aggr_route = aggr; +} + +struct ospf_lsa *ospf_originate_summary_lsa(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei) +{ + struct ospf_lsa *lsa; + struct external_info ei_aggr; + struct as_external_lsa *asel; + struct ospf_external_aggr_rt *old_aggr; + route_tag_t tag = 0; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Prepare to originate Summary route(%pI4/%d)", + __func__, &aggr->p.prefix, aggr->p.prefixlen); + + /* This case to handle when the overlapping aggregator address + * is availbe.Best match will be considered.So need to delink + * from old aggregator and link to the new aggr. + */ + if (ei->aggr_route) { + if (ei->aggr_route != aggr) { + old_aggr = ei->aggr_route; + ospf_unlink_ei_from_aggr(ospf, old_aggr, ei); + } + } + + /* Add the external route to hash table */ + ospf_link_ei_to_aggr(aggr, ei); + + lsa = ospf_external_info_find_lsa(ospf, &aggr->p); + /* Dont originate external LSA, + * If it is configured not to advertise. + */ + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) { + /* If it is already originated as external LSA, + * But, it is configured not to advertise then + * flush the originated external lsa. + */ + if (lsa) + ospf_external_lsa_flush(ospf, 0, &aggr->p, 0); + UNSET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Don't originate the summary address,It is configured to not-advertise.", + __func__); + return NULL; + } + + /* Prepare the extrenal_info for aggregator */ + memset(&ei_aggr, 0, sizeof(struct external_info)); + ei_aggr.p = aggr->p; + ei_aggr.tag = aggr->tag; + ei_aggr.type = 0; + ei_aggr.instance = ospf->instance; + ei_aggr.route_map_set.metric = -1; + ei_aggr.route_map_set.metric_type = -1; + + /* Summary route already originated, + * So, Do nothing. + */ + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + if (!lsa) { + flog_warn(EC_OSPF_LSA_MISSING, + "%s: Could not refresh/originate %pI4/%d", + __func__, &aggr->p.prefix, aggr->p.prefixlen); + return NULL; + } + + asel = (struct as_external_lsa *)lsa->data; + tag = (unsigned long)ntohl(asel->e[0].route_tag); + + /* If tag modified , then re-originate the route + * with modified tag details. + */ + if (tag != ei_aggr.tag) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Route tag changed(old:%d new:%d,So refresh the summary route.(%pI4/%d)", + __func__, tag, ei_aggr.tag, + &aggr->p.prefix, aggr->p.prefixlen); + + ospf_external_lsa_refresh(ospf, lsa, &ei_aggr, + LSA_REFRESH_FORCE, 1); + } + return lsa; + } + + if (lsa && IS_LSA_MAXAGE(lsa)) { + /* This is special case. + * If a summary route need to be originated but where + * summary route already exist in lsdb with maxage, then + * it need to be refreshed. + */ + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: LSA is in MAX-AGE so refreshing LSA(%pI4/%d)", + __PRETTY_FUNCTION__, &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_external_lsa_refresh(ospf, lsa, &ei_aggr, + LSA_REFRESH_FORCE, 1); + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + return lsa; + } + + /* If the external route prefix same as aggregate route + * and if external route is already originated as TYPE-5 + * then it need to be refreshed and originate bit should + * be set. + */ + if (lsa && prefix_same((struct prefix *)&ei_aggr.p, + (struct prefix *)&ei->p)) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: External route prefix is same as aggr so refreshing LSA(%pI4/%d)", + __PRETTY_FUNCTION__, &aggr->p.prefix, + aggr->p.prefixlen); + ospf_external_lsa_refresh(ospf, lsa, &ei_aggr, + LSA_REFRESH_FORCE, 1); + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + return lsa; + } + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Originate Summary route(%pI4/%d)", __func__, + &aggr->p.prefix, aggr->p.prefixlen); + + /* Originate summary LSA */ + lsa = ospf_external_lsa_originate(ospf, &ei_aggr); + if (lsa) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Set the origination bit for aggregator", + __func__); + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + } + + return lsa; +} +void ospf_unset_all_aggr_flag(struct ospf *ospf) +{ + struct route_node *rn = NULL; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("Unset the origination bit for all aggregator"); + + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) { + if (!rn->info) + continue; + + struct ospf_external_aggr_rt *aggr = rn->info; + + UNSET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + } +} + +static void ospf_delete_all_marked_aggregators(struct ospf *ospf) +{ + struct route_node *rn = NULL; + + /* Loop through all the aggregators, Delete all aggregators + * which are marked as DELETE. Set action to NONE for remaining + * aggregators + */ + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) { + if (!rn->info) + continue; + + struct ospf_external_aggr_rt *aggr = rn->info; + + if (aggr->action != OSPF_ROUTE_AGGR_DEL) { + aggr->action = OSPF_ROUTE_AGGR_NONE; + continue; + } + ospf_external_aggr_delete(ospf, rn); + ospf_external_aggregator_free(aggr); + } +} + +static void ospf_handle_aggregated_exnl_rt(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei) +{ + struct ospf_lsa *lsa; + struct as_external_lsa *al; + struct in_addr mask; + + /* Handling the case where the external route prefix + * and aggregate prefix is same + * If same dont flush the originated external LSA. + */ + if (prefix_same((struct prefix *)&aggr->p, (struct prefix *)&ei->p)) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: External Route prefix same as Aggregator(%pI4/%d), so dont flush.", + __func__, &ei->p.prefix, ei->p.prefixlen); + return; + } + + lsa = ospf_external_info_find_lsa(ospf, &ei->p); + if (lsa) { + al = (struct as_external_lsa *)lsa->data; + masklen2ip(ei->p.prefixlen, &mask); + + if (mask.s_addr != al->mask.s_addr) + return; + + ospf_external_lsa_flush(ospf, ei->type, &ei->p, 0); + } +} + +static void ospf_handle_exnl_rt_after_aggr_del(struct ospf *ospf, + struct external_info *ei) +{ + struct ospf_lsa *lsa; + + /* Process only marked external routes. + * These routes were part of a deleted + * aggregator.So, originate now. + */ + if (!ei->to_be_processed) + return; + + ei->to_be_processed = false; + + lsa = ospf_external_info_find_lsa(ospf, &ei->p); + + if (lsa) + ospf_external_lsa_refresh(ospf, lsa, ei, LSA_REFRESH_FORCE, 0); + else { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Originate external route(%pI4/%d)", + __func__, &ei->p.prefix, ei->p.prefixlen); + + ospf_external_lsa_originate(ospf, ei); + } +} + +static void ospf_handle_external_aggr_add(struct ospf *ospf) +{ + struct external_info *ei; + struct route_node *rn = NULL; + struct route_table *rt = NULL; + int type = 0; + + /* Delete all the aggregators which are marked as + * OSPF_ROUTE_AGGR_DEL. + */ + ospf_delete_all_marked_aggregators(ospf); + + for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) { + struct list *ext_list; + struct listnode *node; + struct ospf_external *ext; + struct ospf_external_aggr_rt *aggr; + + ext_list = ospf->external[type]; + if (!ext_list) + continue; + + for (ALL_LIST_ELEMENTS_RO(ext_list, node, ext)) { + rt = ext->external_info; + if (!rt) + continue; + + for (rn = route_top(rt); rn; rn = route_next(rn)) { + if (!rn->info) + continue; + + ei = rn->info; + if (is_prefix_default(&ei->p)) + continue; + + /* Check the AS-external-LSA + * should be originated. + */ + if (!ospf_redistribute_check(ospf, ei, NULL)) + continue; + + aggr = ospf_external_aggr_match(ospf, &ei->p); + + /* If matching aggregator found, Add + * the external route reference to the + * aggregator and originate the aggr + * route if it is advertisable. + * flush the external LSA if it is + * already originated for this external + * prefix. + */ + if (aggr) { + ospf_originate_summary_lsa(ospf, aggr, + ei); + + /* All aggregated external rts + * are handled here. + */ + ospf_handle_aggregated_exnl_rt( + ospf, aggr, ei); + continue; + } + + /* External routes which are only out + * of aggregation will be handled here. + */ + ospf_handle_exnl_rt_after_aggr_del(ospf, ei); + } + } + } +} + +static void +ospf_aggr_handle_advertise_change(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei_aggr) +{ + struct ospf_lsa *lsa; + + /* Check if advertise option modified. */ + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Don't originate the summary address,It is configured to not-advertise.", + __func__); + + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: No-advertise,So Flush the Aggregate route(%pI4/%d)", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_external_lsa_flush(ospf, 0, &aggr->p, 0); + + UNSET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + } + return; + } + + if (!CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Now it is advatisable", __func__); + + lsa = ospf_external_info_find_lsa(ospf, &ei_aggr->p); + if (lsa && IS_LSA_MAXAGE(lsa)) { + /* This is special case. + * If a summary route need to be originated but where + * summary route already exist in lsdb with maxage, then + * it need to be refreshed. + */ + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: It is already with Maxage, So refresh it (%pI4/%d)", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_external_lsa_refresh(ospf, lsa, ei_aggr, + LSA_REFRESH_FORCE, 1); + + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_ORIGINATED); + + } else { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Originate Aggregate LSA (%pI4/%d)", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + + /* Originate summary LSA */ + lsa = ospf_external_lsa_originate(ospf, ei_aggr); + if (lsa) + SET_FLAG(aggr->flags, + OSPF_EXTERNAL_AGGRT_ORIGINATED); + } + } +} + +static void ospf_handle_external_aggr_update(struct ospf *ospf) +{ + struct route_node *rn = NULL; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Process modified aggregators.\n", __func__); + + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) { + struct ospf_external_aggr_rt *aggr; + struct ospf_lsa *lsa = NULL; + struct as_external_lsa *asel = NULL; + struct external_info ei_aggr; + route_tag_t tag = 0; + + if (!rn->info) + continue; + + aggr = rn->info; + + if (aggr->action == OSPF_ROUTE_AGGR_DEL) { + aggr->action = OSPF_ROUTE_AGGR_NONE; + ospf_external_aggr_delete(ospf, rn); + + if (OSPF_EXTERNAL_RT_COUNT(aggr)) + hash_clean( + aggr->match_extnl_hash, + (void *)ospf_aggr_handle_external_info); + + hash_free(aggr->match_extnl_hash); + XFREE(MTYPE_OSPF_EXTERNAL_RT_AGGR, aggr); + + } else if (aggr->action == OSPF_ROUTE_AGGR_MODIFY) { + + aggr->action = OSPF_ROUTE_AGGR_NONE; + + /* Prepare the extrenal_info for aggregator */ + memset(&ei_aggr, 0, sizeof(struct external_info)); + ei_aggr.p = aggr->p; + ei_aggr.tag = aggr->tag; + ei_aggr.type = 0; + ei_aggr.instance = ospf->instance; + ei_aggr.route_map_set.metric = -1; + ei_aggr.route_map_set.metric_type = -1; + + /* Check if tag modified */ + if (CHECK_FLAG(aggr->flags, + OSPF_EXTERNAL_AGGRT_ORIGINATED)) { + lsa = ospf_external_info_find_lsa(ospf, + &ei_aggr.p); + if (!lsa) { + flog_warn(EC_OSPF_LSA_MISSING, + "%s: Could not refresh/originate %pI4/%d", + __func__, &aggr->p.prefix, + aggr->p.prefixlen); + continue; + } + + asel = (struct as_external_lsa *)lsa->data; + tag = (unsigned long)ntohl( + asel->e[0].route_tag); + + /* If tag modified , then re-originate the + * route with modified tag details. + */ + if (tag != ei_aggr.tag) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Route tag changed(old:%d new:%d,So refresh the summary route.(%pI4/%d)", + __func__, tag, + ei_aggr.tag, + &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_external_lsa_refresh( + ospf, lsa, &ei_aggr, + LSA_REFRESH_FORCE, 1); + } + } + + /* Advertise option modified ? + * If so, handled it here. + */ + ospf_aggr_handle_advertise_change(ospf, aggr, &ei_aggr); + } + } +} + +static int ospf_asbr_external_aggr_process(struct thread *thread) +{ + struct ospf *ospf = THREAD_ARG(thread); + int operation = 0; + + ospf->t_external_aggr = NULL; + operation = ospf->aggr_action; + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: operation:%d\n", __func__, operation); + + switch (operation) { + case OSPF_ROUTE_AGGR_ADD: + ospf_handle_external_aggr_add(ospf); + break; + case OSPF_ROUTE_AGGR_DEL: + case OSPF_ROUTE_AGGR_MODIFY: + ospf_handle_external_aggr_update(ospf); + break; + default: + break; + } + + return OSPF_SUCCESS; +} +static void ospf_external_aggr_timer(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + enum ospf_aggr_action_t operation) +{ + aggr->action = operation; + + if (ospf->t_external_aggr) { + if (ospf->aggr_action == OSPF_ROUTE_AGGR_ADD) { + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Not required to retsart timer,set is already added.", + __func__); + return; + } + + if (operation == OSPF_ROUTE_AGGR_ADD) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s, Restarting Aggregator delay timer.", + __func__); + THREAD_OFF(ospf->t_external_aggr); + } + } + + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug("%s: Start Aggregator delay timer %d(in seconds).", + __func__, ospf->aggr_delay_interval); + + ospf->aggr_action = operation; + thread_add_timer(master, ospf_asbr_external_aggr_process, ospf, + ospf->aggr_delay_interval, &ospf->t_external_aggr); +} + +int ospf_asbr_external_aggregator_set(struct ospf *ospf, struct prefix_ipv4 *p, + route_tag_t tag) +{ + struct ospf_external_aggr_rt *aggregator; + + aggregator = ospf_extrenal_aggregator_lookup(ospf, p); + + if (aggregator) { + if (CHECK_FLAG(aggregator->flags, + OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) + UNSET_FLAG(aggregator->flags, + OSPF_EXTERNAL_AGGRT_NO_ADVERTISE); + else if (aggregator->tag == tag) + return OSPF_SUCCESS; + + aggregator->tag = tag; + + ospf_external_aggr_timer(ospf, aggregator, + OSPF_ROUTE_AGGR_MODIFY); + } else { + aggregator = ospf_external_aggregator_new(p); + if (!aggregator) + return OSPF_FAILURE; + + aggregator->tag = tag; + + ospf_external_aggr_add(ospf, aggregator); + ospf_external_aggr_timer(ospf, aggregator, OSPF_ROUTE_AGGR_ADD); + } + + return OSPF_SUCCESS; +} + +int ospf_asbr_external_aggregator_unset(struct ospf *ospf, + struct prefix_ipv4 *p, route_tag_t tag) +{ + struct route_node *rn; + struct ospf_external_aggr_rt *aggr; + + rn = route_node_lookup(ospf->rt_aggr_tbl, (struct prefix *)p); + if (!rn) + return OSPF_INVALID; + + aggr = rn->info; + + if (tag && (tag != aggr->tag)) + return OSPF_INVALID; + + if (!OSPF_EXTERNAL_RT_COUNT(aggr)) { + ospf_external_aggr_delete(ospf, rn); + ospf_external_aggregator_free(aggr); + return OSPF_SUCCESS; + } + + ospf_external_aggr_timer(ospf, aggr, OSPF_ROUTE_AGGR_DEL); + + return OSPF_SUCCESS; +} + +int ospf_asbr_external_rt_no_advertise(struct ospf *ospf, struct prefix_ipv4 *p) +{ + struct ospf_external_aggr_rt *aggr; + route_tag_t tag = 0; + + aggr = ospf_extrenal_aggregator_lookup(ospf, p); + if (aggr) { + if (CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) + return OSPF_SUCCESS; + + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE); + + aggr->tag = tag; + + if (!OSPF_EXTERNAL_RT_COUNT(aggr)) + return OSPF_SUCCESS; + + ospf_external_aggr_timer(ospf, aggr, OSPF_ROUTE_AGGR_MODIFY); + } else { + aggr = ospf_external_aggregator_new(p); + + if (!aggr) + return OSPF_FAILURE; + + SET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE); + ospf_external_aggr_add(ospf, aggr); + ospf_external_aggr_timer(ospf, aggr, OSPF_ROUTE_AGGR_ADD); + } + + return OSPF_SUCCESS; +} + +int ospf_asbr_external_rt_advertise(struct ospf *ospf, struct prefix_ipv4 *p) +{ + struct route_node *rn; + struct ospf_external_aggr_rt *aggr; + + rn = route_node_lookup(ospf->rt_aggr_tbl, (struct prefix *)p); + if (!rn) + return OSPF_INVALID; + + aggr = rn->info; + + if (!CHECK_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) + return OSPF_INVALID; + + UNSET_FLAG(aggr->flags, OSPF_EXTERNAL_AGGRT_NO_ADVERTISE); + + if (!OSPF_EXTERNAL_RT_COUNT(aggr)) + return OSPF_SUCCESS; + + ospf_external_aggr_timer(ospf, aggr, OSPF_ROUTE_AGGR_MODIFY); + return OSPF_SUCCESS; +} + +int ospf_external_aggregator_timer_set(struct ospf *ospf, unsigned int interval) +{ + ospf->aggr_delay_interval = interval; + return OSPF_SUCCESS; +} diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index ede6c47906..7759d45455 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -50,8 +50,57 @@ struct external_info { route_tag_t orig_tag; struct route_map_set_values route_map_set; -#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric +#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric #define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type + + /* Back pointer to summary address */ + struct ospf_external_aggr_rt *aggr_route; + + /* To identify the routes to be originated + * after a summary address deletion. + */ + bool to_be_processed; +}; + +#define OSPF_EXTL_AGGR_DEFAULT_DELAY 5 + +#define OSPF_EXTERNAL_RT_COUNT(aggr) \ + (((struct ospf_external_aggr_rt *)aggr)->match_extnl_hash->count) + +enum ospf_aggr_action_t { + OSPF_ROUTE_AGGR_NONE = 0, + OSPF_ROUTE_AGGR_ADD, + OSPF_ROUTE_AGGR_DEL, + OSPF_ROUTE_AGGR_MODIFY +}; + +#define OSPF_SUCCESS 1 +#define OSPF_FAILURE 0 +#define OSPF_INVALID -1 + +#define OSPF_EXTERNAL_AGGRT_NO_ADVERTISE 0x1 +#define OSPF_EXTERNAL_AGGRT_ORIGINATED 0x2 + +/* Data structures for external route aggregator */ +struct ospf_external_aggr_rt { + /* Prefix. */ + struct prefix_ipv4 p; + + /* Bit 1 : Dont advertise. + * Bit 2 : Originated as Type-5 + */ + uint8_t flags; + + /* Tag for summary route */ + route_tag_t tag; + + /* Action to be done at the delay + * timer expairy. + */ + enum ospf_aggr_action_t action; + + /* Hash Table of external routes */ + struct hash *match_extnl_hash; }; #define OSPF_ASBR_CHECK_DELAY 30 @@ -81,4 +130,36 @@ extern void ospf_asbr_route_install_lsa(struct ospf_lsa *); extern struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *, struct prefix_ipv4 *p); +/* External Route Aggregator */ +extern void ospf_asbr_external_aggregator_init(struct ospf *instance); +extern void ospf_external_aggregator_free(struct ospf_external_aggr_rt *aggr); +extern bool is_valid_summary_addr(struct prefix_ipv4 *p); +extern struct ospf_external_aggr_rt * +ospf_external_aggr_match(struct ospf *ospf, struct prefix_ipv4 *p); +extern void ospf_unlink_ei_from_aggr(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei); +extern struct ospf_lsa * +ospf_originate_summary_lsa(struct ospf *ospf, + struct ospf_external_aggr_rt *aggr, + struct external_info *ei); +extern int ospf_external_aggregator_timer_set(struct ospf *ospf, + unsigned int interval); +extern void ospf_external_aggrigator_free(struct ospf_external_aggr_rt *aggr); + +extern struct ospf_external_aggr_rt * +ospf_extrenal_aggregator_lookup(struct ospf *ospf, struct prefix_ipv4 *p); + +void ospf_unset_all_aggr_flag(struct ospf *ospf); + +extern int ospf_asbr_external_aggregator_set(struct ospf *ospf, + struct prefix_ipv4 *p, + route_tag_t tag); +extern int ospf_asbr_external_aggregator_unset(struct ospf *ospf, + struct prefix_ipv4 *p, + route_tag_t tag); +extern int ospf_asbr_external_rt_no_advertise(struct ospf *ospf, + struct prefix_ipv4 *p); +extern int ospf_asbr_external_rt_advertise(struct ospf *ospf, + struct prefix_ipv4 *p); #endif /* _ZEBRA_OSPF_ASBR_H */ diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index ba045e0418..e15c9c42c7 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -1001,6 +1001,8 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, DEBUG_ON(lsa, LSA_INSTALL); else if (strmatch(argv[arg_base]->text, "refresh")) DEBUG_ON(lsa, LSA_REFRESH); + else if (strmatch(argv[arg_base]->text, "aggregate")) + DEBUG_ON(lsa, EXTNL_LSA_AGGR); } return CMD_SUCCESS; @@ -1018,6 +1020,8 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_ON(lsa, LSA_INSTALL); else if (strmatch(argv[arg_base]->text, "refresh")) TERM_DEBUG_ON(lsa, LSA_REFRESH); + else if (strmatch(argv[arg_base]->text, "aggregate")) + TERM_DEBUG_ON(lsa, EXTNL_LSA_AGGR); } return CMD_SUCCESS; @@ -1025,21 +1029,23 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, DEFUN (debug_ospf_lsa, debug_ospf_lsa_cmd, - "debug ospf lsa [<generate|flooding|install|refresh>]", + "debug ospf lsa [<generate|flooding|install|refresh|aggregate>]", DEBUG_STR OSPF_STR "OSPF Link State Advertisement\n" "LSA Generation\n" "LSA Flooding\n" "LSA Install/Delete\n" - "LSA Refresh\n") + "LSA Refresh\n" + "External LSA Aggregation\n") { return debug_ospf_lsa_common(vty, 3, argc, argv); } DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, - "debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]", + "debug ospf (1-65535) lsa " + "[<generate|flooding|install|refresh|aggregate>]", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1047,7 +1053,8 @@ DEFUN (debug_ospf_instance_lsa, "LSA Generation\n" "LSA Flooding\n" "LSA Install/Delete\n" - "LSA Refresh\n") + "LSA Refresh\n" + "External LSA Aggregation\n") { int idx_number = 2; unsigned short instance = 0; @@ -1075,6 +1082,8 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, DEBUG_OFF(lsa, LSA_INSTALL); else if (strmatch(argv[arg_base]->text, "refresh")) DEBUG_OFF(lsa, LSA_REFRESH); + else if (strmatch(argv[arg_base]->text, "aggregate")) + DEBUG_OFF(lsa, EXTNL_LSA_AGGR); } return CMD_SUCCESS; @@ -1092,6 +1101,8 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, TERM_DEBUG_OFF(lsa, LSA_INSTALL); else if (strmatch(argv[arg_base]->text, "refresh")) TERM_DEBUG_OFF(lsa, LSA_REFRESH); + else if (strmatch(argv[arg_base]->text, "aggregate")) + TERM_DEBUG_OFF(lsa, EXTNL_LSA_AGGR); } return CMD_SUCCESS; @@ -1099,7 +1110,7 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc, DEFUN (no_debug_ospf_lsa, no_debug_ospf_lsa_cmd, - "no debug ospf lsa [<generate|flooding|install|refresh>]", + "no debug ospf lsa [<generate|flooding|install|refresh|aggregate>]", NO_STR DEBUG_STR OSPF_STR @@ -1107,14 +1118,16 @@ DEFUN (no_debug_ospf_lsa, "LSA Generation\n" "LSA Flooding\n" "LSA Install/Delete\n" - "LSA Refres\n") + "LSA Refres\n" + "External LSA Aggregation\n") { return no_debug_ospf_lsa_common(vty, 4, argc, argv); } DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, - "no debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]", + "no debug ospf (1-65535) lsa " + "[<generate|flooding|install|refresh|aggregate>]", NO_STR DEBUG_STR OSPF_STR @@ -1123,7 +1136,8 @@ DEFUN (no_debug_ospf_instance_lsa, "LSA Generation\n" "LSA Flooding\n" "LSA Install/Delete\n" - "LSA Refres\n") + "LSA Refres\n" + "External LSA Aggregation\n") { int idx_number = 3; unsigned short instance = 0; diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h index a2df4ff22c..ea607fef7c 100644 --- a/ospfd/ospf_dump.h +++ b/ospfd/ospf_dump.h @@ -49,6 +49,7 @@ #define OSPF_DEBUG_LSA_INSTALL 0x04 #define OSPF_DEBUG_LSA_REFRESH 0x08 #define OSPF_DEBUG_LSA 0x0F +#define OSPF_DEBUG_EXTNL_LSA_AGGR 0x10 #define OSPF_DEBUG_ZEBRA_INTERFACE 0x01 #define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02 diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 0f43553c01..cb2b7c2365 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -154,6 +154,9 @@ static void ospf_process_self_originated_lsa(struct ospf *ospf, struct ospf_interface *oi; struct external_info *ei; struct listnode *node; + struct as_external_lsa *al; + struct prefix_ipv4 p; + struct ospf_external_aggr_rt *aggr; if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -222,12 +225,51 @@ static void ospf_process_self_originated_lsa(struct ospf *ospf, ospf_translated_nssa_refresh(ospf, NULL, new); return; } + + al = (struct as_external_lsa *)new->data; + p.family = AF_INET; + p.prefixlen = ip_masklen(al->mask); + p.prefix = new->data->id; + ei = ospf_external_info_check(ospf, new); - if (ei) + if (ei) { + if (ospf_external_aggr_match(ospf, &ei->p)) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "%s, Matching external aggregate route found for %pI4, so don't refresh it.", + __func__, + &ei->p.prefix); + + /* Aggregated external route shouldn't + * be in LSDB. + */ + if (!IS_LSA_MAXAGE(new)) + ospf_lsa_flush_as(ospf, new); + + return; + } + ospf_external_lsa_refresh(ospf, new, ei, - LSA_REFRESH_FORCE); - else - ospf_lsa_flush_as(ospf, new); + LSA_REFRESH_FORCE, false); + } else { + aggr = (struct ospf_external_aggr_rt *) + ospf_extrenal_aggregator_lookup(ospf, &p); + if (aggr) { + struct external_info ei_aggr; + + memset(&ei_aggr, 0, + sizeof(struct external_info)); + ei_aggr.p = aggr->p; + ei_aggr.tag = aggr->tag; + ei_aggr.instance = ospf->instance; + ei_aggr.route_map_set.metric = -1; + ei_aggr.route_map_set.metric_type = -1; + + ospf_external_lsa_refresh(ospf, new, &ei_aggr, + LSA_REFRESH_FORCE, true); + } else + ospf_lsa_flush_as(ospf, new); + } break; case OSPF_OPAQUE_AREA_LSA: ospf_opaque_lsa_refresh(new); diff --git a/ospfd/ospf_gr_helper.c b/ospfd/ospf_gr_helper.c index 9c029a49ba..a86e1b8401 100644 --- a/ospfd/ospf_gr_helper.c +++ b/ospfd/ospf_gr_helper.c @@ -251,7 +251,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, /* Check TLV len against overall LSA */ if (sum + TLV_SIZE(tlvh) > length) { if (IS_DEBUG_OSPF_GR_HELPER) - zlog_debug("%s: Malformed packet: Invalid TLV len:%zu", + zlog_debug("%s: Malformed packet: Invalid TLV len:%u", __func__, TLV_SIZE(tlvh)); return OSPF_GR_FAILURE; } @@ -260,7 +260,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, case GRACE_PERIOD_TYPE: if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_graceperiod)) { - zlog_debug("%s: Malformed packet: Invalid grace TLV len:%zu", + zlog_debug("%s: Malformed packet: Invalid grace TLV len:%u", __func__, TLV_SIZE(tlvh)); return OSPF_GR_FAILURE; } @@ -277,7 +277,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, case RESTART_REASON_TYPE: if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_restart_reason)) { - zlog_debug("%s: Malformed packet: Invalid reason TLV len:%zu", + zlog_debug("%s: Malformed packet: Invalid reason TLV len:%u", __func__, TLV_SIZE(tlvh)); return OSPF_GR_FAILURE; } @@ -292,7 +292,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, case RESTARTER_IP_ADDR_TYPE: if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_restart_addr)) { - zlog_debug("%s: Malformed packet: Invalid addr TLV len:%zu", + zlog_debug("%s: Malformed packet: Invalid addr TLV len:%u", __func__, TLV_SIZE(tlvh)); return OSPF_GR_FAILURE; } @@ -1018,7 +1018,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa) tlvh = TLV_HDR_NEXT(tlvh)) { /* Check TLV len */ if (sum + TLV_SIZE(tlvh) > length) { - vty_out(vty, "%% Invalid TLV length: %zu\n", + vty_out(vty, "%% Invalid TLV length: %u\n", TLV_SIZE(tlvh)); return; } @@ -1028,7 +1028,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa) if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_graceperiod)) { vty_out(vty, - "%% Invalid grace TLV length %zu\n", + "%% Invalid grace TLV length %u\n", TLV_SIZE(tlvh)); return; } @@ -1043,7 +1043,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa) if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_restart_reason)) { vty_out(vty, - "%% Invalid reason TLV length %zu\n", + "%% Invalid reason TLV length %u\n", TLV_SIZE(tlvh)); return; } @@ -1058,7 +1058,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa) if (TLV_SIZE(tlvh) < sizeof(struct grace_tlv_restart_addr)) { vty_out(vty, - "%% Invalid addr TLV length %zu\n", + "%% Invalid addr TLV length %u\n", TLV_SIZE(tlvh)); return; } diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 6e34740166..e461345fe5 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -535,6 +535,7 @@ static struct ospf_if_params *ospf_new_if_params(void) UNSET_IF_PARAM(oip, auth_simple); UNSET_IF_PARAM(oip, auth_crypt); UNSET_IF_PARAM(oip, auth_type); + UNSET_IF_PARAM(oip, if_area); oip->auth_crypt = list_new(); @@ -579,8 +580,8 @@ void ospf_free_if_params(struct interface *ifp, struct in_addr addr) && !OSPF_IF_PARAM_CONFIGURED(oip, type) && !OSPF_IF_PARAM_CONFIGURED(oip, auth_simple) && !OSPF_IF_PARAM_CONFIGURED(oip, auth_type) - && listcount(oip->auth_crypt) == 0 - && ntohl(oip->network_lsa_seqnum) != OSPF_INITIAL_SEQUENCE_NUMBER) { + && !OSPF_IF_PARAM_CONFIGURED(oip, if_area) + && listcount(oip->auth_crypt) == 0) { ospf_del_if_params(oip); rn->info = NULL; route_unlock_node(rn); @@ -1276,6 +1277,9 @@ void ospf_if_interface(struct interface *ifp) static int ospf_ifp_create(struct interface *ifp) { struct ospf *ospf = NULL; + struct ospf_if_params *params; + struct route_node *rn; + uint32_t count = 0; if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug( @@ -1297,6 +1301,19 @@ static int ospf_ifp_create(struct interface *ifp) if (!ospf) return 0; + params = IF_DEF_PARAMS(ifp); + if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) + if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + if (count > 0) { + ospf->if_ospf_cli_count += count; + ospf_interface_area_set(ospf, ifp); + } + ospf_if_recalculate_output_cost(ifp); ospf_if_update(ospf, ifp); @@ -1362,7 +1379,10 @@ static int ospf_ifp_down(struct interface *ifp) static int ospf_ifp_destroy(struct interface *ifp) { + struct ospf *ospf; + struct ospf_if_params *params; struct route_node *rn; + uint32_t count = 0; if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug( @@ -1373,6 +1393,22 @@ static int ospf_ifp_destroy(struct interface *ifp) hook_call(ospf_if_delete, ifp); + ospf = ospf_lookup_by_vrf_id(ifp->vrf_id); + if (ospf) { + params = IF_DEF_PARAMS(ifp); + if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) + if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + if (count > 0) { + ospf->if_ospf_cli_count -= count; + ospf_interface_area_unset(ospf, ifp); + } + } + for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) if (rn->info) ospf_if_free((struct ospf_interface *)rn->info); diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 9ad7f2c4d7..42fc3288cd 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -1977,10 +1977,6 @@ struct ospf_lsa *ospf_external_lsa_originate(struct ospf *ospf, return NULL; } - /* Check the AS-external-LSA should be originated. */ - if (!ospf_redistribute_check(ospf, ei, NULL)) - return NULL; - /* Create new AS-external-LSA instance. */ if ((new = ospf_external_lsa_new(ospf, ei, NULL)) == NULL) { if (IS_DEBUG_OSPF_EVENT) @@ -2056,6 +2052,7 @@ static struct external_info *ospf_default_external_info(struct ospf *ospf) void ospf_external_lsa_rid_change(struct ospf *ospf) { struct external_info *ei; + struct ospf_external_aggr_rt *aggr; int type; for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { @@ -2087,9 +2084,21 @@ void ospf_external_lsa_rid_change(struct ospf *ospf) (struct prefix_ipv4 *)&ei->p)) continue; - if (!ospf_external_lsa_originate(ospf, ei)) + if (!ospf_redistribute_check(ospf, ei, NULL)) + continue; + + aggr = ospf_external_aggr_match(ospf, &ei->p); + if (aggr) { + if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) + zlog_debug( + "Originate Summary LSA after reset/router-ID change"); + /* Here the LSA is originated as new */ + ospf_originate_summary_lsa(ospf, aggr, + ei); + } else if (!ospf_external_lsa_originate(ospf, + ei)) flog_warn(EC_OSPF_LSA_INSTALL_FAILURE, - "LSA: AS-external-LSA was not originated."); + "LSA: AS-external-LSA was not originated."); } } } @@ -2191,8 +2200,9 @@ void ospf_external_lsa_refresh_default(struct ospf *ospf) if (ei && lsa) { if (IS_DEBUG_OSPF_EVENT) zlog_debug("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p", - (void *)lsa); - ospf_external_lsa_refresh(ospf, lsa, ei, LSA_REFRESH_FORCE); + (void *)lsa); + ospf_external_lsa_refresh(ospf, lsa, ei, LSA_REFRESH_FORCE, + false); } else if (ei && !lsa) { if (IS_DEBUG_OSPF_EVENT) zlog_debug( @@ -2225,15 +2235,51 @@ void ospf_external_lsa_refresh_type(struct ospf *ospf, uint8_t type, if (ei) { if (!is_prefix_default(&ei->p)) { struct ospf_lsa *lsa; + struct ospf_external_aggr_rt *aggr; + aggr = ospf_external_aggr_match(ospf, + &ei->p); lsa = ospf_external_info_find_lsa( - ospf, &ei->p); - if (lsa) + ospf, &ei->p); + if (aggr) { + /* Check the AS-external-LSA + * should be originated. + */ + if (!ospf_redistribute_check( + ospf, ei, NULL)) { + + ospf_unlink_ei_from_aggr( + ospf, aggr, ei); + continue; + } + + if (IS_DEBUG_OSPF( + lsa, + EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Send Aggreate LSA (%pFX/%d)", + __func__, + &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_originate_summary_lsa( + ospf, aggr, ei); + + } else if (lsa) { + + if (IS_LSA_MAXAGE(lsa)) + force = LSA_REFRESH_FORCE; + ospf_external_lsa_refresh( - ospf, lsa, ei, force); - else + ospf, lsa, ei, force, + false); + } else { + if (!ospf_redistribute_check( + ospf, ei, NULL)) + continue; ospf_external_lsa_originate( ospf, ei); + } } } } @@ -2243,21 +2289,25 @@ void ospf_external_lsa_refresh_type(struct ospf *ospf, uint8_t type, /* Refresh AS-external-LSA. */ struct ospf_lsa *ospf_external_lsa_refresh(struct ospf *ospf, struct ospf_lsa *lsa, - struct external_info *ei, int force) + struct external_info *ei, int force, + bool is_aggr) { struct ospf_lsa *new; - int changed; + int changed = 0; /* Check the AS-external-LSA should be originated. */ - if (!ospf_redistribute_check(ospf, ei, &changed)) { - if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) - zlog_debug( - "LSA[Type%d:%pI4]: Could not be refreshed, redist check fail", - lsa->data->type, &lsa->data->id); - ospf_external_lsa_flush(ospf, ei->type, &ei->p, - ei->ifindex /*, ei->nexthop */); - return NULL; - } + if (!is_aggr) + if (!ospf_redistribute_check(ospf, ei, &changed)) { + if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) + zlog_debug( + "LSA[Type%d:%s] Could not be refreshed, redist check fail", + lsa->data->type, + inet_ntoa(lsa->data->id)); + + ospf_external_lsa_flush(ospf, ei->type, &ei->p, + ei->ifindex /*, ei->nexthop */); + return NULL; + } if (!changed && !force) { if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) @@ -3447,7 +3497,11 @@ void ospf_schedule_lsa_flush_area(struct ospf_area *area, struct ospf_lsa *lsa) struct ospf_lsa *ospf_lsa_refresh(struct ospf *ospf, struct ospf_lsa *lsa) { struct external_info *ei; + struct ospf_external_aggr_rt *aggr; struct ospf_lsa *new = NULL; + struct as_external_lsa *al; + struct prefix_ipv4 p; + assert(CHECK_FLAG(lsa->flags, OSPF_LSA_SELF)); assert(IS_LSA_SELF(lsa)); assert(lsa->lock > 0); @@ -3470,14 +3524,37 @@ struct ospf_lsa *ospf_lsa_refresh(struct ospf *ospf, struct ospf_lsa *lsa) /* Translated from NSSA Type-5s are refreshed when * from refresh of Type-7 - do not refresh these directly. */ + + al = (struct as_external_lsa *)lsa->data; + p.family = AF_INET; + p.prefixlen = ip_masklen(al->mask); + p.prefix = lsa->data->id; + if (CHECK_FLAG(lsa->flags, OSPF_LSA_LOCAL_XLT)) break; ei = ospf_external_info_check(ospf, lsa); if (ei) - new = ospf_external_lsa_refresh(ospf, lsa, ei, - LSA_REFRESH_FORCE); - else - ospf_lsa_flush_as(ospf, lsa); + new = ospf_external_lsa_refresh( + ospf, lsa, ei, LSA_REFRESH_FORCE, false); + else { + aggr = (struct ospf_external_aggr_rt *) + ospf_extrenal_aggregator_lookup(ospf, &p); + if (aggr) { + struct external_info ei_aggr; + + memset(&ei_aggr, 0, + sizeof(struct external_info)); + ei_aggr.p = aggr->p; + ei_aggr.tag = aggr->tag; + ei_aggr.instance = ospf->instance; + ei_aggr.route_map_set.metric = -1; + ei_aggr.route_map_set.metric_type = -1; + + ospf_external_lsa_refresh(ospf, lsa, &ei_aggr, + LSA_REFRESH_FORCE, true); + } else + ospf_lsa_flush_as(ospf, lsa); + } break; case OSPF_OPAQUE_LINK_LSA: case OSPF_OPAQUE_AREA_LSA: diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index e63af4b347..c5de287948 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -313,7 +313,8 @@ extern void ospf_external_lsa_refresh_type(struct ospf *, uint8_t, unsigned short, int); extern struct ospf_lsa *ospf_external_lsa_refresh(struct ospf *, struct ospf_lsa *, - struct external_info *, int); + struct external_info *, int, + bool aggr); extern struct in_addr ospf_lsa_unique_id(struct ospf *, struct ospf_lsdb *, uint8_t, struct prefix_ipv4 *); extern void ospf_schedule_lsa_flood_area(struct ospf_area *, struct ospf_lsa *); diff --git a/ospfd/ospf_memory.c b/ospfd/ospf_memory.c index d102fddf86..ae22cec414 100644 --- a/ospfd/ospf_memory.c +++ b/ospfd/ospf_memory.c @@ -57,3 +57,4 @@ DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters") DEFINE_MTYPE(OSPFD, OSPF_EXT_PARAMS, "OSPF Extended parameters") DEFINE_MTYPE(OSPFD, OSPF_SR_PARAMS, "OSPF Segment Routing parameters") DEFINE_MTYPE(OSPFD, OSPF_GR_HELPER, "OSPF Graceful Restart Helper") +DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_RT_AGGR, "OSPF External Route Summarisation") diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h index 58f23aa9c7..624b1d3306 100644 --- a/ospfd/ospf_memory.h +++ b/ospfd/ospf_memory.h @@ -56,5 +56,6 @@ DECLARE_MTYPE(OSPF_PCE_PARAMS) DECLARE_MTYPE(OSPF_SR_PARAMS) DECLARE_MTYPE(OSPF_EXT_PARAMS) DECLARE_MTYPE(OSPF_GR_HELPER) +DECLARE_MTYPE(OSPF_EXTERNAL_RT_AGGR) #endif /* _QUAGGA_OSPF_MEMORY_H */ diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 5ba61b3184..3939b5479f 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -126,6 +126,8 @@ void ospf_opaque_term(void) void ospf_opaque_finish(void) { + ospf_mpls_te_finish(); + ospf_router_info_finish(); ospf_ext_finish(); @@ -1159,7 +1161,8 @@ void ospf_opaque_config_write_debug(struct vty *vty) return; } -void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) +void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { struct lsa_header *lsah = lsa->data; uint32_t lsid = ntohl(lsah->id.s_addr); @@ -1169,13 +1172,17 @@ void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) /* Switch output functionality by vty address. */ if (vty != NULL) { - vty_out(vty, " Opaque-Type %u (%s)\n", opaque_type, - ospf_opaque_type_name(opaque_type)); - vty_out(vty, " Opaque-ID 0x%x\n", opaque_id); - - vty_out(vty, " Opaque-Info: %u octets of data%s\n", - ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE, - VALID_OPAQUE_INFO_LEN(lsah) ? "" : "(Invalid length?)"); + if (!json) { + vty_out(vty, " Opaque-Type %u (%s)\n", opaque_type, + ospf_opaque_type_name(opaque_type)); + vty_out(vty, " Opaque-ID 0x%x\n", opaque_id); + + vty_out(vty, " Opaque-Info: %u octets of data%s\n", + ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE, + VALID_OPAQUE_INFO_LEN(lsah) + ? "" + : "(Invalid length?)"); + } } else { zlog_debug(" Opaque-Type %u (%s)", opaque_type, ospf_opaque_type_name(opaque_type)); @@ -1200,7 +1207,7 @@ void ospf_opaque_lsa_dump(struct stream *s, uint16_t length) struct ospf_lsa lsa; lsa.data = (struct lsa_header *)stream_pnt(s); - show_opaque_info_detail(NULL, &lsa); + show_opaque_info_detail(NULL, &lsa, NULL); return; } diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h index 96155608b2..c63b8ebdaf 100644 --- a/ospfd/ospf_opaque.h +++ b/ospfd/ospf_opaque.h @@ -24,6 +24,7 @@ #define _ZEBRA_OSPF_OPAQUE_H #include "vty.h" +#include <lib/json.h> #define IS_OPAQUE_LSA(type) \ ((type) == OSPF_OPAQUE_LINK_LSA || (type) == OSPF_OPAQUE_AREA_LSA \ @@ -93,7 +94,7 @@ struct tlv_header { #define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(uint32_t))) -#define TLV_SIZE(tlvh) (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) +#define TLV_SIZE(tlvh) (uint32_t)(TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh)) #define TLV_HDR_TOP(lsah) \ (struct tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE) @@ -148,7 +149,8 @@ extern void ospf_opaque_nsm_change(struct ospf_neighbor *nbr, int old_status); extern void ospf_opaque_config_write_router(struct vty *vty, struct ospf *ospf); extern void ospf_opaque_config_write_if(struct vty *vty, struct interface *ifp); extern void ospf_opaque_config_write_debug(struct vty *vty); -extern void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa); +extern void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json); extern void ospf_opaque_lsa_dump(struct stream *s, uint16_t length); extern void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index c89fd3597f..bdc65d23bf 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -127,27 +127,22 @@ static void ospf_route_map_event(const char *name) /* `match ip netxthop ' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_nexthop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_nexthop(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; struct external_info *ei = object; struct prefix_ipv4 p; - if (type == RMAP_OSPF) { - p.family = AF_INET; - p.prefix = ei->nexthop; - p.prefixlen = IPV4_MAX_BITLEN; + p.family = AF_INET; + p.prefix = ei->nexthop; + p.prefixlen = IPV4_MAX_BITLEN; - alist = access_list_lookup(AFI_IP, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_IP, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - return (access_list_apply(alist, &p) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `ip next-hop' match statement. `arg' should be @@ -175,26 +170,22 @@ static const struct route_map_rule_cmd route_match_ip_nexthop_cmd = { static enum route_map_cmd_result_t route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; struct external_info *ei = object; struct prefix_ipv4 p; - if (type == RMAP_OSPF) { - p.family = AF_INET; - p.prefix = ei->nexthop; - p.prefixlen = IPV4_MAX_BITLEN; + p.family = AF_INET; + p.prefix = ei->nexthop; + p.prefixlen = IPV4_MAX_BITLEN; - plist = prefix_list_lookup(AFI_IP, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + plist = prefix_list_lookup(AFI_IP, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, &p) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static void *route_match_ip_next_hop_prefix_list_compile(const char *arg) @@ -219,11 +210,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct external_info *ei = object; - if (type == RMAP_OSPF && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { ei = (struct external_info *)object; if (!ei) return RMAP_NOMATCH; @@ -256,22 +247,17 @@ static const struct route_map_rule_cmd /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; /* struct prefix_ipv4 match; */ - if (type == RMAP_OSPF) { - alist = access_list_lookup(AFI_IP, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_IP, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - return (access_list_apply(alist, prefix) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `ip address' match statement. `arg' should be @@ -298,20 +284,16 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = { /* `match ip address prefix-list PREFIX_LIST' */ static enum route_map_cmd_result_t route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; - if (type == RMAP_OSPF) { - plist = prefix_list_lookup(AFI_IP, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + plist = prefix_list_lookup(AFI_IP, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, prefix) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static void *route_match_ip_address_prefix_list_compile(const char *arg) @@ -336,22 +318,18 @@ static const struct route_map_rule_cmd /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_interface(void *rule, const struct prefix *prefix, void *object) { struct interface *ifp; struct external_info *ei; - if (type == RMAP_OSPF) { - ei = object; - ifp = if_lookup_by_name_all_vrf((char *)rule); + ei = object; + ifp = if_lookup_by_name_all_vrf((char *)rule); - if (ifp == NULL || ifp->ifindex != ei->ifindex) - return RMAP_NOMATCH; + if (ifp == NULL || ifp->ifindex != ei->ifindex) + return RMAP_NOMATCH; - return RMAP_MATCH; - } - return RMAP_NOMATCH; + return RMAP_MATCH; } /* Route map `interface' match statement. `arg' should be @@ -377,20 +355,15 @@ static const struct route_map_rule_cmd route_match_interface_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_tag(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct external_info *ei; - if (type == RMAP_OSPF) { - tag = rule; - ei = object; + tag = rule; + ei = object; - return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH); - } - - return RMAP_NOMATCH; + return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH); } /* Route map commands for tag matching. */ @@ -410,33 +383,31 @@ struct ospf_metric { /* `set metric METRIC' */ /* Set metric to attribute. */ static enum route_map_cmd_result_t -route_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric(void *rule, const struct prefix *prefix, void *object) { struct ospf_metric *metric; struct external_info *ei; - if (type == RMAP_OSPF) { - /* Fetch routemap's rule information. */ - metric = rule; - ei = object; + /* Fetch routemap's rule information. */ + metric = rule; + ei = object; - /* Set metric out value. */ - if (!metric->used) - return RMAP_OKAY; + /* Set metric out value. */ + if (!metric->used) + return RMAP_OKAY; - ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC; + ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC; - if (metric->type == metric_increment) - ei->route_map_set.metric += metric->metric; - else if (metric->type == metric_decrement) - ei->route_map_set.metric -= metric->metric; - else if (metric->type == metric_absolute) - ei->route_map_set.metric = metric->metric; + if (metric->type == metric_increment) + ei->route_map_set.metric += metric->metric; + else if (metric->type == metric_decrement) + ei->route_map_set.metric -= metric->metric; + else if (metric->type == metric_absolute) + ei->route_map_set.metric = metric->metric; + + if (ei->route_map_set.metric > OSPF_LS_INFINITY) + ei->route_map_set.metric = OSPF_LS_INFINITY; - if (ei->route_map_set.metric > OSPF_LS_INFINITY) - ei->route_map_set.metric = OSPF_LS_INFINITY; - } return RMAP_OKAY; } @@ -445,7 +416,7 @@ static void *route_set_metric_compile(const char *arg) { struct ospf_metric *metric; - metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(uint32_t)); + metric = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(*metric)); metric->used = false; if (all_digit(arg)) @@ -492,20 +463,18 @@ static const struct route_map_rule_cmd route_set_metric_cmd = { /* `set metric-type TYPE' */ /* Set metric-type to attribute. */ static enum route_map_cmd_result_t -route_set_metric_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric_type(void *rule, const struct prefix *prefix, void *object) { uint32_t *metric_type; struct external_info *ei; - if (type == RMAP_OSPF) { - /* Fetch routemap's rule information. */ - metric_type = rule; - ei = object; + /* Fetch routemap's rule information. */ + metric_type = rule; + ei = object; + + /* Set metric out value. */ + ei->route_map_set.metric_type = *metric_type; - /* Set metric out value. */ - ei->route_map_set.metric_type = *metric_type; - } return RMAP_OKAY; } @@ -543,19 +512,16 @@ static const struct route_map_rule_cmd route_set_metric_type_cmd = { }; static enum route_map_cmd_result_t -route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type, - void *object) +route_set_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct external_info *ei; - if (type == RMAP_OSPF) { - tag = rule; - ei = object; + tag = rule; + ei = object; - /* Set tag value */ - ei->tag = *tag; - } + /* Set tag value */ + ei->tag = *tag; return RMAP_OKAY; } diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index b53719a402..78814cb288 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1432,8 +1432,11 @@ static int ospf_spf_calculate_schedule_worker(struct thread *thread) /* ABRs may require additional changes, see RFC 2328 16.7. */ monotime(&start_time); - if (IS_OSPF_ABR(ospf)) + if (IS_OSPF_ABR(ospf)) { + if (ospf->anyNSSA) + ospf_abr_nssa_check_status(ospf); ospf_abr_task(ospf); + } abr_time = monotime_since(&start_time, NULL); /* Schedule Segment Routing update */ diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index e3c554c530..17ff9a1a46 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -187,6 +187,7 @@ void ospf_mpls_te_finish(void) // list_delete_all_node(OspfMplsTE.iflist); OspfMplsTE.enabled = false; + ospf_mpls_te_unregister(); OspfMplsTE.inter_as = Off; } @@ -2229,6 +2230,17 @@ DEFUN (no_ospf_mpls_te, if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA); + /* + * This resets the OspfMplsTE.inter_as to its initial state. + * This is to avoid having an inter-as value different from + * Off when mpls-te gets restarted (after being removed) + */ + if (OspfMplsTE.inter_as != Off) { + /* Deregister the Callbacks for Inter-AS support */ + ospf_mpls_te_unregister(); + OspfMplsTE.inter_as = Off; + } + return CMD_SUCCESS; } diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1060f20bdf..30aa0b80e1 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -22,6 +22,7 @@ #include <zebra.h> #include <string.h> +#include "printfrr.h" #include "monotime.h" #include "memory.h" #include "thread.h" @@ -55,6 +56,7 @@ #include "ospfd/ospf_bfd.h" #include "ospfd/ospf_ldp_sync.h" + FRR_CFG_DEFAULT_BOOL(OSPF_LOG_ADJACENCY_CHANGES, { .val_bool = true, .match_profile = "datacenter", }, { .val_bool = false }, @@ -214,9 +216,6 @@ DEFUN_NOSH (router_ospf, struct ospf *ospf = NULL; int ret = CMD_SUCCESS; unsigned short instance = 0; - struct vrf *vrf = NULL; - struct route_node *rn; - struct interface *ifp; ospf = ospf_cmd_lookup_ospf(vty, argv, argc, 1, &instance); if (!ospf) @@ -228,46 +227,12 @@ DEFUN_NOSH (router_ospf, VTY_PUSH_CONTEXT_NULL(OSPF_NODE); ret = CMD_NOT_MY_INSTANCE; } else { - if (ospf->vrf_id != VRF_UNKNOWN) - ospf->oi_running = 1; if (IS_DEBUG_OSPF_EVENT) zlog_debug( "Config command 'router ospf %d' received, vrf %s id %u oi_running %u", instance, ospf->name ? ospf->name : "NIL", ospf->vrf_id, ospf->oi_running); VTY_PUSH_CONTEXT(OSPF_NODE, ospf); - - /* Activate 'ip ospf area x' configured interfaces for given - * vrf. Activate area on vrf x aware interfaces. - * vrf_enable callback calls router_id_update which - * internally will call ospf_if_update to trigger - * network_run_state - */ - vrf = vrf_lookup_by_id(ospf->vrf_id); - - FOR_ALL_INTERFACES (vrf, ifp) { - struct ospf_if_params *params; - - params = IF_DEF_PARAMS(ifp); - if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) { - for (rn = route_top(ospf->networks); rn; - rn = route_next(rn)) { - if (rn->info != NULL) { - vty_out(vty, - "Interface %s has area config but please remove all network commands first.\n", - ifp->name); - return ret; - } - } - if (!ospf_interface_area_is_already_set(ospf, - ifp)) { - ospf_interface_area_set(ospf, ifp); - ospf->if_ospf_cli_count++; - } - } - } - - ospf_router_id_update(ospf); } return ret; @@ -618,7 +583,7 @@ DEFUN (ospf_network_area, "Please remove all ip ospf area x.x.x.x commands first.\n"); if (IS_DEBUG_OSPF_EVENT) zlog_debug( - "%s ospf vrf %s num of %u ip osp area x config", + "%s ospf vrf %s num of %u ip ospf area x config", __func__, ospf->name ? ospf->name : "NIL", ospf->if_ospf_cli_count); return CMD_WARNING_CONFIG_FAILED; @@ -5811,27 +5776,62 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, } /* Show functions */ -static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) +static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self, + json_object *json_lsa) { struct router_lsa *rl; struct summary_lsa *sl; struct as_external_lsa *asel; struct prefix_ipv4 p; + char buf[PREFIX2STR_BUFFER]; if (lsa != NULL) /* If self option is set, check LSA self flag. */ if (self == 0 || IS_LSA_SELF(lsa)) { - /* LSA common part show. */ - vty_out(vty, "%-15pI4 ", &lsa->data->id); - vty_out(vty, "%-15pI4 %4d 0x%08lx 0x%04x", - &lsa->data->adv_router, LS_AGE(lsa), - (unsigned long)ntohl(lsa->data->ls_seqnum), - ntohs(lsa->data->checksum)); + + if (!json_lsa) { + /* LSA common part show. */ + vty_out(vty, "%-15pI4", + &lsa->data->id); + vty_out(vty, "%-15s %4d 0x%08lx 0x%04x", + inet_ntoa(lsa->data->adv_router), + LS_AGE(lsa), + (unsigned long)ntohl( + lsa->data->ls_seqnum), + ntohs(lsa->data->checksum)); + } else { + char seqnum[10]; + char checksum[10]; + + snprintf(seqnum, sizeof(seqnum), "%x", + ntohl(lsa->data->ls_seqnum)); + snprintf(checksum, sizeof(checksum), "%x", + ntohs(lsa->data->checksum)); + json_object_string_add( + json_lsa, "lsId", + inet_ntoa(lsa->data->id)); + json_object_string_add( + json_lsa, "advertisedRouter", + inet_ntoa(lsa->data->adv_router)); + json_object_int_add(json_lsa, "lsaAge", + LS_AGE(lsa)); + json_object_string_add( + json_lsa, "sequenceNumber", seqnum); + json_object_string_add(json_lsa, "checksum", + checksum); + } + /* LSA specific part show. */ switch (lsa->data->type) { case OSPF_ROUTER_LSA: rl = (struct router_lsa *)lsa->data; - vty_out(vty, " %-d", ntohs(rl->links)); + + if (!json_lsa) + vty_out(vty, " %-d", ntohs(rl->links)); + else + json_object_int_add(json_lsa, + "numOfRouterLinks", + ntohs(rl->links)); break; case OSPF_SUMMARY_LSA: sl = (struct summary_lsa *)lsa->data; @@ -5841,7 +5841,14 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) p.prefixlen = ip_masklen(sl->mask); apply_mask_ipv4(&p); - vty_out(vty, " %pFX", &p); + if (!json_lsa) + vty_out(vty, " %pFX", &p); + else { + prefix2str(&p, buf, sizeof(buf)); + json_object_string_add(json_lsa, + "summaryAddress", + buf); + } break; case OSPF_AS_EXTERNAL_LSA: case OSPF_AS_NSSA_LSA: @@ -5852,13 +5859,30 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) p.prefixlen = ip_masklen(asel->mask); apply_mask_ipv4(&p); - vty_out(vty, " %s %pFX [0x%lx]", - IS_EXTERNAL_METRIC(asel->e[0].tos) - ? "E2" - : "E1", - &p, - (unsigned long)ntohl( - asel->e[0].route_tag)); + if (!json_lsa) + vty_out(vty, " %s %pFX [0x%lx]", + IS_EXTERNAL_METRIC( + asel->e[0].tos) + ? "E2" + : "E1", + &p, + (unsigned long)ntohl( + asel->e[0].route_tag)); + else { + prefix2str(&p, buf, sizeof(buf)); + json_object_string_add( + json_lsa, "metricType", + IS_EXTERNAL_METRIC( + asel->e[0].tos) + ? "E2" + : "E1"); + json_object_string_add(json_lsa, + "route", buf); + json_object_int_add( + json_lsa, "tag", + (unsigned long)ntohl( + asel->e[0].route_tag)); + } break; case OSPF_NETWORK_LSA: case OSPF_ASBR_SUMMARY_LSA: @@ -5868,7 +5892,9 @@ static int show_lsa_summary(struct vty *vty, struct ospf_lsa *lsa, int self) default: break; } - vty_out(vty, "\n"); + + if (!json_lsa) + vty_out(vty, "\n"); } return 0; @@ -5889,6 +5915,21 @@ static const char *const show_database_desc[] = { "AS-external Opaque-LSA", }; +static const char * const show_database_desc_json[] = { + "unknown", + "routerLinkStates", + "networkLinkStates", + "summaryLinkStates", + "asbrSummaryLinkStates", + "asExternalLinkStates", + "groupMembershipLsa", + "nssaExternalLinkStates", + "type8Lsa", + "linkLocalOpaqueLsa", + "areaLocalOpaqueLsa", + "asExternalOpaqueLsa", +}; + static const char *const show_database_header[] = { "", "Link ID ADV Router Age Seq# CkSum Link count", @@ -5904,41 +5945,97 @@ static const char *const show_database_header[] = { "Opaque-Type/Id ADV Router Age Seq# CkSum", }; -static void show_ip_ospf_database_header(struct vty *vty, struct ospf_lsa *lsa) +static void show_ip_ospf_database_header(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { struct router_lsa *rlsa = (struct router_lsa *)lsa->data; - vty_out(vty, " LS age: %d\n", LS_AGE(lsa)); - vty_out(vty, " Options: 0x%-2x : %s\n", lsa->data->options, - ospf_options_dump(lsa->data->options)); - vty_out(vty, " LS Flags: 0x%-2x %s\n", lsa->flags, - ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" - : "")); - - if (lsa->data->type == OSPF_ROUTER_LSA) { - vty_out(vty, " Flags: 0x%x", rlsa->flags); - - if (rlsa->flags) - vty_out(vty, " :%s%s%s%s", - IS_ROUTER_LSA_BORDER(rlsa) ? " ABR" : "", - IS_ROUTER_LSA_EXTERNAL(rlsa) ? " ASBR" : "", - IS_ROUTER_LSA_VIRTUAL(rlsa) ? " VL-endpoint" - : "", - IS_ROUTER_LSA_SHORTCUT(rlsa) ? " Shortcut" - : ""); + if (!json) { + vty_out(vty, " LS age: %d\n", LS_AGE(lsa)); + vty_out(vty, " Options: 0x%-2x : %s\n", lsa->data->options, + ospf_options_dump(lsa->data->options)); + vty_out(vty, " LS Flags: 0x%-2x %s\n", lsa->flags, + ((lsa->flags & OSPF_LSA_LOCAL_XLT) + ? "(Translated from Type-7)" + : "")); + + if (lsa->data->type == OSPF_ROUTER_LSA) { + vty_out(vty, " Flags: 0x%x", rlsa->flags); + + if (rlsa->flags) + vty_out(vty, " :%s%s%s%s", + IS_ROUTER_LSA_BORDER(rlsa) ? " ABR" + : "", + IS_ROUTER_LSA_EXTERNAL(rlsa) ? " ASBR" + : "", + IS_ROUTER_LSA_VIRTUAL(rlsa) + ? " VL-endpoint" + : "", + IS_ROUTER_LSA_SHORTCUT(rlsa) + ? " Shortcut" + : ""); - vty_out(vty, "\n"); + vty_out(vty, "\n"); + } + vty_out(vty, " LS Type: %s\n", + lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL)); + vty_out(vty, " Link State ID: %pI4 %s\n", + &lsa->data->id, + lookup_msg(ospf_link_state_id_type_msg, lsa->data->type, + NULL)); + vty_out(vty, " Advertising Router: %pI4\n", + &lsa->data->adv_router); + vty_out(vty, " LS Seq Number: %08lx\n", + (unsigned long)ntohl(lsa->data->ls_seqnum)); + vty_out(vty, " Checksum: 0x%04x\n", + ntohs(lsa->data->checksum)); + vty_out(vty, " Length: %d\n\n", ntohs(lsa->data->length)); + } else { + char seqnum[10]; + char checksum[10]; + + snprintf(seqnum, 10, "%x", ntohl(lsa->data->ls_seqnum)); + snprintf(checksum, 10, "%x", ntohs(lsa->data->checksum)); + + json_object_int_add(json, "lsaAge", LS_AGE(lsa)); + json_object_string_add(json, "options", + ospf_options_dump(lsa->data->options)); + json_object_int_add(json, "lsaFlags", lsa->flags); + + if (lsa->flags & OSPF_LSA_LOCAL_XLT) + json_object_boolean_true_add(json, + "translatedFromType7"); + + if (lsa->data->type == OSPF_ROUTER_LSA) { + json_object_int_add(json, "flags", rlsa->flags); + + if (rlsa->flags) { + if (IS_ROUTER_LSA_BORDER(rlsa)) + json_object_boolean_true_add(json, + "abr"); + if (IS_ROUTER_LSA_EXTERNAL(rlsa)) + json_object_boolean_true_add(json, + "asbr"); + if (IS_ROUTER_LSA_VIRTUAL(rlsa)) + json_object_boolean_true_add( + json, "vlEndpoint"); + if (IS_ROUTER_LSA_SHORTCUT(rlsa)) + json_object_boolean_true_add( + json, "shortcut"); + } + } + + json_object_string_add( + json, "lsaType", + lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL)); + json_object_string_add(json, "linkStateId", + inet_ntoa(lsa->data->id)); + json_object_string_add(json, "advertisingRouter", + inet_ntoa(lsa->data->adv_router)); + json_object_string_add(json, "lsaSeqNumber", seqnum); + json_object_string_add(json, "checksum", checksum); + json_object_int_add(json, "length", ntohs(lsa->data->length)); } - vty_out(vty, " LS Type: %s\n", - lookup_msg(ospf_lsa_type_msg, lsa->data->type, NULL)); - vty_out(vty, " Link State ID: %pI4 %s\n", &lsa->data->id, - lookup_msg(ospf_link_state_id_type_msg, lsa->data->type, NULL)); - vty_out(vty, " Advertising Router: %pI4\n", - &lsa->data->adv_router); - vty_out(vty, " LS Seq Number: %08lx\n", - (unsigned long)ntohl(lsa->data->ls_seqnum)); - vty_out(vty, " Checksum: 0x%04x\n", ntohs(lsa->data->checksum)); - vty_out(vty, " Length: %d\n\n", ntohs(lsa->data->length)); } static const char *const link_type_desc[] = { @@ -5959,128 +6056,240 @@ static const char *const link_data_desc[] = { "Network Mask", "Router Interface address", }; +static const char *const link_id_desc_json[] = { + "null", "neighborRouterId", "designatedRouterAddress", + "networkAddress", "neighborRouterId", +}; + +static const char *const link_data_desc_json[] = { + "null", "routerInterfaceAddress", "routerInterfaceAddress", + "networkMask", "routerInterfaceAddress", +}; + /* Show router-LSA each Link information. */ static void show_ip_ospf_database_router_links(struct vty *vty, - struct router_lsa *rl) + struct router_lsa *rl, + json_object *json) { int len, type; - unsigned int i; + unsigned short i; + json_object *json_links = NULL; + json_object *json_link = NULL; + int metric = 0; + + if (json) + json_links = json_object_new_object(); len = ntohs(rl->header.length) - 4; for (i = 0; i < ntohs(rl->links) && len > 0; len -= 12, i++) { type = rl->link[i].type; - vty_out(vty, " Link connected to: %s\n", - link_type_desc[type]); - vty_out(vty, " (Link ID) %s: %pI4\n", link_id_desc[type], - &rl->link[i].link_id); - vty_out(vty, " (Link Data) %s: %pI4\n", - link_data_desc[type], &rl->link[i].link_data); - vty_out(vty, " Number of TOS metrics: 0\n"); - vty_out(vty, " TOS 0 Metric: %d\n", - ntohs(rl->link[i].metric)); - vty_out(vty, "\n"); + if (json) { + char link[16]; + + snprintf(link, sizeof(link), "link%u", i); + json_link = json_object_new_object(); + json_object_string_add(json_link, "linkType", + link_type_desc[type]); + json_object_string_add(json_link, + link_id_desc_json[type], + inet_ntoa(rl->link[i].link_id)); + json_object_string_add( + json_link, link_data_desc_json[type], + inet_ntoa(rl->link[i].link_data)); + json_object_int_add(json_link, "numOfTosMetrics", + metric); + json_object_int_add(json_link, "tos0Metric", + ntohs(rl->link[i].metric)); + json_object_object_add(json_links, link, json_link); + } else { + vty_out(vty, " Link connected to: %s\n", + link_type_desc[type]); + vty_out(vty, " (Link ID) %s: %pI4\n", + link_id_desc[type], + &rl->link[i].link_id); + vty_out(vty, " (Link Data) %s: %pI4\n", + link_data_desc[type], + &rl->link[i].link_data); + vty_out(vty, " Number of TOS metrics: 0\n"); + vty_out(vty, " TOS 0 Metric: %d\n", + ntohs(rl->link[i].metric)); + vty_out(vty, "\n"); + } } + if (json) + json_object_object_add(json, "routerLinks", json_links); } /* Show router-LSA detail information. */ -static int show_router_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_router_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { if (lsa != NULL) { struct router_lsa *rl = (struct router_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); + show_ip_ospf_database_header(vty, lsa, json); - vty_out(vty, " Number of Links: %d\n\n", ntohs(rl->links)); + if (!json) + vty_out(vty, " Number of Links: %d\n\n", + ntohs(rl->links)); + else + json_object_int_add(json, "numOfLinks", + ntohs(rl->links)); - show_ip_ospf_database_router_links(vty, rl); - vty_out(vty, "\n"); + show_ip_ospf_database_router_links(vty, rl, json); + + if (!json) + vty_out(vty, "\n"); } return 0; } /* Show network-LSA detail information. */ -static int show_network_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_network_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { int length, i; + json_object *json_attached_rt = NULL; + json_object *json_router = NULL; + + if (json) + json_attached_rt = json_object_new_object(); if (lsa != NULL) { struct network_lsa *nl = (struct network_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); + show_ip_ospf_database_header(vty, lsa, json); - vty_out(vty, " Network Mask: /%d\n", ip_masklen(nl->mask)); + if (!json) + vty_out(vty, " Network Mask: /%d\n", + ip_masklen(nl->mask)); + else + json_object_int_add(json, "networkMask", + ip_masklen(nl->mask)); length = ntohs(lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; for (i = 0; length > 0; i++, length -= 4) - vty_out(vty, " Attached Router: %pI4\n", - &nl->routers[i]); - - vty_out(vty, "\n"); + if (!json) { + vty_out(vty, " Attached Router: %pI4\n", + &nl->routers[i]); + vty_out(vty, "\n"); + } else { + json_router = json_object_new_object(); + json_object_string_add( + json_router, "attachedRouterId", + inet_ntoa(nl->routers[i])); + json_object_object_add( + json_attached_rt, + inet_ntoa(nl->routers[i]), json_router); + } } + if (json) + json_object_object_add(json, "attchedRouters", + json_attached_rt); + return 0; } /* Show summary-LSA detail information. */ -static int show_summary_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_summary_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { if (lsa != NULL) { struct summary_lsa *sl = (struct summary_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); + show_ip_ospf_database_header(vty, lsa, json); - vty_out(vty, " Network Mask: /%d\n", ip_masklen(sl->mask)); - vty_out(vty, " TOS: 0 Metric: %d\n", - GET_METRIC(sl->metric)); - vty_out(vty, "\n"); + if (!json) { + vty_out(vty, " Network Mask: /%d\n", + ip_masklen(sl->mask)); + vty_out(vty, " TOS: 0 Metric: %d\n", + GET_METRIC(sl->metric)); + vty_out(vty, "\n"); + } else { + json_object_int_add(json, "networkMask", + ip_masklen(sl->mask)); + json_object_int_add(json, "tos0Metric", + GET_METRIC(sl->metric)); + } } return 0; } /* Show summary-ASBR-LSA detail information. */ -static int show_summary_asbr_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_summary_asbr_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { if (lsa != NULL) { struct summary_lsa *sl = (struct summary_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); + show_ip_ospf_database_header(vty, lsa, json); - vty_out(vty, " Network Mask: /%d\n", ip_masklen(sl->mask)); - vty_out(vty, " TOS: 0 Metric: %d\n", - GET_METRIC(sl->metric)); - vty_out(vty, "\n"); + if (!json) { + vty_out(vty, " Network Mask: /%d\n", + ip_masklen(sl->mask)); + vty_out(vty, " TOS: 0 Metric: %d\n", + GET_METRIC(sl->metric)); + vty_out(vty, "\n"); + } else { + json_object_int_add(json, "networkMask", + ip_masklen(sl->mask)); + json_object_int_add(json, "tos0Metric", + GET_METRIC(sl->metric)); + } } return 0; } /* Show AS-external-LSA detail information. */ -static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { + int tos = 0; + if (lsa != NULL) { struct as_external_lsa *al = (struct as_external_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); - - vty_out(vty, " Network Mask: /%d\n", ip_masklen(al->mask)); - vty_out(vty, " Metric Type: %s\n", - IS_EXTERNAL_METRIC(al->e[0].tos) - ? "2 (Larger than any link state path)" - : "1"); - vty_out(vty, " TOS: 0\n"); - vty_out(vty, " Metric: %d\n", - GET_METRIC(al->e[0].metric)); - vty_out(vty, " Forward Address: %pI4\n", - &al->e[0].fwd_addr); - - vty_out(vty, - " External Route Tag: %" ROUTE_TAG_PRI "\n\n", - (route_tag_t)ntohl(al->e[0].route_tag)); + show_ip_ospf_database_header(vty, lsa, json); + + if (!json) { + vty_out(vty, " Network Mask: /%d\n", + ip_masklen(al->mask)); + vty_out(vty, " Metric Type: %s\n", + IS_EXTERNAL_METRIC(al->e[0].tos) + ? "2 (Larger than any link state path)" + : "1"); + vty_out(vty, " TOS: 0\n"); + vty_out(vty, " Metric: %d\n", + GET_METRIC(al->e[0].metric)); + vty_out(vty, " Forward Address: %pI4\n", + &al->e[0].fwd_addr); + vty_out(vty, + " External Route Tag: %" ROUTE_TAG_PRI "\n\n", + (route_tag_t)ntohl(al->e[0].route_tag)); + } else { + json_object_int_add(json, "networkMask", + ip_masklen(al->mask)); + json_object_string_add( + json, "metricType", + IS_EXTERNAL_METRIC(al->e[0].tos) + ? "E2 (Larger than any link state path)" + : "E1"); + json_object_int_add(json, "tos", tos); + json_object_int_add(json, "metric", + GET_METRIC(al->e[0].metric)); + json_object_string_add(json, "forwardAddress", + inet_ntoa(al->e[0].fwd_addr)); + json_object_int_add( + json, "externalRouteTag", + (route_tag_t)ntohl(al->e[0].route_tag)); + } } return 0; @@ -6111,50 +6320,74 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa) } #endif /* Show AS-NSSA-LSA detail information. */ -static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { + int tos = 0; + if (lsa != NULL) { struct as_external_lsa *al = (struct as_external_lsa *)lsa->data; - show_ip_ospf_database_header(vty, lsa); - - vty_out(vty, " Network Mask: /%d\n", ip_masklen(al->mask)); - vty_out(vty, " Metric Type: %s\n", - IS_EXTERNAL_METRIC(al->e[0].tos) - ? "2 (Larger than any link state path)" - : "1"); - vty_out(vty, " TOS: 0\n"); - vty_out(vty, " Metric: %d\n", - GET_METRIC(al->e[0].metric)); - vty_out(vty, " NSSA: Forward Address: %pI4\n", - &al->e[0].fwd_addr); - - vty_out(vty, - " External Route Tag: %" ROUTE_TAG_PRI "\n\n", - (route_tag_t)ntohl(al->e[0].route_tag)); + show_ip_ospf_database_header(vty, lsa, json); + + if (!json) { + vty_out(vty, " Network Mask: /%d\n", + ip_masklen(al->mask)); + vty_out(vty, " Metric Type: %s\n", + IS_EXTERNAL_METRIC(al->e[0].tos) + ? "2 (Larger than any link state path)" + : "1"); + vty_out(vty, " TOS: 0\n"); + vty_out(vty, " Metric: %d\n", + GET_METRIC(al->e[0].metric)); + vty_out(vty, " NSSA: Forward Address: %pI4\n", + &al->e[0].fwd_addr); + vty_out(vty, + " External Route Tag: %" ROUTE_TAG_PRI + "\n\n", + (route_tag_t)ntohl(al->e[0].route_tag)); + } else { + json_object_int_add(json, "networkMask", + ip_masklen(al->mask)); + json_object_string_add( + json, "metricType", + IS_EXTERNAL_METRIC(al->e[0].tos) + ? "E2 (Larger than any link state path)" + : "E1"); + json_object_int_add(json, "tos", tos); + json_object_int_add(json, "metric", + GET_METRIC(al->e[0].metric)); + json_object_string_add(json, "nssaForwardAddress", + inet_ntoa(al->e[0].fwd_addr)); + json_object_int_add( + json, "externalRouteTag", + (route_tag_t)ntohl(al->e[0].route_tag)); + } } return 0; } -static int show_func_dummy(struct vty *vty, struct ospf_lsa *lsa) +static int show_func_dummy(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { return 0; } -static int show_opaque_lsa_detail(struct vty *vty, struct ospf_lsa *lsa) +static int show_opaque_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { if (lsa != NULL) { - show_ip_ospf_database_header(vty, lsa); - show_opaque_info_detail(vty, lsa); - - vty_out(vty, "\n"); + show_ip_ospf_database_header(vty, lsa, json); + show_opaque_info_detail(vty, lsa, json); + if (!json) + vty_out(vty, "\n"); } return 0; } -int (*const show_function[])(struct vty *, struct ospf_lsa *) = { +int (*show_function[])(struct vty *, struct ospf_lsa *, json_object *) = { NULL, show_router_lsa_detail, show_network_lsa_detail, @@ -6187,11 +6420,13 @@ static void show_lsa_prefix_set(struct vty *vty, struct prefix_ls *lp, } static void show_lsa_detail_proc(struct vty *vty, struct route_table *rt, - struct in_addr *id, struct in_addr *adv_router) + struct in_addr *id, struct in_addr *adv_router, + json_object *json) { struct prefix_ls lp; struct route_node *rn, *start; struct ospf_lsa *lsa; + json_object *json_lsa = NULL; show_lsa_prefix_set(vty, &lp, id, adv_router); start = route_node_get(rt, (struct prefix *)&lp); @@ -6199,9 +6434,14 @@ static void show_lsa_detail_proc(struct vty *vty, struct route_table *rt, route_lock_node(start); for (rn = start; rn; rn = route_next_until(rn, start)) if ((lsa = rn->info)) { + if (json) { + json_lsa = json_object_new_object(); + json_object_array_add(json, json_lsa); + } + if (show_function[lsa->data->type] != NULL) - show_function[lsa->data->type](vty, - lsa); + show_function[lsa->data->type]( + vty, lsa, json_lsa); } route_unlock_node(start); } @@ -6210,25 +6450,62 @@ static void show_lsa_detail_proc(struct vty *vty, struct route_table *rt, /* Show detail LSA information -- if id is NULL then show all LSAs. */ static void show_lsa_detail(struct vty *vty, struct ospf *ospf, int type, - struct in_addr *id, struct in_addr *adv_router) + struct in_addr *id, struct in_addr *adv_router, + json_object *json) { struct listnode *node; struct ospf_area *area; + json_object *json_lsa_type = NULL; + json_object *json_areas = NULL; + json_object *json_lsa_array = NULL; + + if (json) + json_lsa_type = json_object_new_object(); switch (type) { case OSPF_AS_EXTERNAL_LSA: case OSPF_OPAQUE_AS_LSA: - vty_out(vty, " %s \n\n", - show_database_desc[type]); - show_lsa_detail_proc(vty, AS_LSDB(ospf, type), id, adv_router); + if (!json) + vty_out(vty, " %s \n\n", + show_database_desc[type]); + else + json_lsa_array = json_object_new_array(); + + show_lsa_detail_proc(vty, AS_LSDB(ospf, type), id, adv_router, + json_lsa_array); + if (json) + json_object_object_add(json, + show_database_desc_json[type], + json_lsa_array); + break; default: + if (json) + json_areas = json_object_new_object(); + for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) { - vty_out(vty, "\n %s (Area %s)\n\n", - show_database_desc[type], - ospf_area_desc_string(area)); + if (!json) { + vty_out(vty, + "\n %s (Area %s)\n\n", + show_database_desc[type], + ospf_area_desc_string(area)); + } else { + json_lsa_array = json_object_new_array(); + json_object_object_add(json_areas, + inet_ntoa(area->area_id), + json_lsa_array); + } + show_lsa_detail_proc(vty, AREA_LSDB(area, type), id, - adv_router); + adv_router, json_lsa_array); + } + + if (json) { + json_object_object_add(json_lsa_type, "areas", + json_areas); + json_object_object_add(json, + show_database_desc_json[type], + json_lsa_type); } break; } @@ -6236,60 +6513,104 @@ static void show_lsa_detail(struct vty *vty, struct ospf *ospf, int type, static void show_lsa_detail_adv_router_proc(struct vty *vty, struct route_table *rt, - struct in_addr *adv_router) + struct in_addr *adv_router, + json_object *json) { struct route_node *rn; struct ospf_lsa *lsa; for (rn = route_top(rt); rn; rn = route_next(rn)) - if ((lsa = rn->info)) + if ((lsa = rn->info)) { + json_object *json_lsa = NULL; + if (IPV4_ADDR_SAME(adv_router, &lsa->data->adv_router)) { if (CHECK_FLAG(lsa->flags, OSPF_LSA_LOCAL_XLT)) continue; + if (json) + json_lsa = json_object_new_object(); + if (show_function[lsa->data->type] != NULL) - show_function[lsa->data->type](vty, - lsa); + show_function[lsa->data->type]( + vty, lsa, json_lsa); + if (json) + json_object_object_add( + json, inet_ntoa(lsa->data->id), + json_lsa); } + } } /* Show detail LSA information. */ static void show_lsa_detail_adv_router(struct vty *vty, struct ospf *ospf, - int type, struct in_addr *adv_router) + int type, struct in_addr *adv_router, + json_object *json) { struct listnode *node; struct ospf_area *area; + json_object *json_lstype = NULL; + json_object *json_area = NULL; + + if (json) + json_lstype = json_object_new_object(); switch (type) { case OSPF_AS_EXTERNAL_LSA: case OSPF_OPAQUE_AS_LSA: - vty_out(vty, " %s \n\n", - show_database_desc[type]); + if (!json) + vty_out(vty, " %s \n\n", + show_database_desc[type]); + show_lsa_detail_adv_router_proc(vty, AS_LSDB(ospf, type), - adv_router); + adv_router, json_lstype); break; default: + for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) { - vty_out(vty, "\n %s (Area %s)\n\n", - show_database_desc[type], - ospf_area_desc_string(area)); - show_lsa_detail_adv_router_proc( - vty, AREA_LSDB(area, type), adv_router); + if (json) + json_area = json_object_new_object(); + else + vty_out(vty, + "\n %s (Area %s)\n\n", + show_database_desc[type], + ospf_area_desc_string(area)); + show_lsa_detail_adv_router_proc(vty, + AREA_LSDB(area, type), + adv_router, json_area); + + if (json) + json_object_object_add(json_lstype, + inet_ntoa(area->area_id), + json_area); } break; } + + if (json) + json_object_object_add(json, show_database_desc[type], + json_lstype); } static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf, - int self) + int self, json_object *json) { struct ospf_lsa *lsa; struct route_node *rn; struct ospf_area *area; struct listnode *node; + json_object *json_areas = NULL; + json_object *json_area = NULL; + json_object *json_lsa = NULL; int type; + json_object *json_lsa_array = NULL; + + if (json) + json_areas = json_object_new_object(); for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) { + if (json) + json_area = json_object_new_object(); + for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) { switch (type) { case OSPF_AS_EXTERNAL_LSA: @@ -6301,20 +6622,49 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf, if (ospf_lsdb_count_self(area->lsdb, type) > 0 || (!self && ospf_lsdb_count(area->lsdb, type) > 0)) { - vty_out(vty, " %s (Area %s)\n\n", - show_database_desc[type], - ospf_area_desc_string(area)); - vty_out(vty, "%s\n", - show_database_header[type]); - LSDB_LOOP (AREA_LSDB(area, type), rn, lsa) - show_lsa_summary(vty, lsa, self); + if (!json) { + vty_out(vty, + " %s (Area %s)\n\n", + show_database_desc[type], + ospf_area_desc_string(area)); + vty_out(vty, "%s\n", + show_database_header[type]); + } else { + json_lsa_array = + json_object_new_array(); + json_object_object_add( + json_area, + show_database_desc_json[type], + json_lsa_array); + } - vty_out(vty, "\n"); + LSDB_LOOP (AREA_LSDB(area, type), rn, lsa) { + if (json) { + json_lsa = + json_object_new_object(); + json_object_array_add( + json_lsa_array, + json_lsa); + } + + show_lsa_summary(vty, lsa, self, + json_lsa); + } + + if (!json) + vty_out(vty, "\n"); } } + if (json) + json_object_object_add(json_areas, + inet_ntoa(area->area_id), + json_area); } + if (json) + json_object_object_add(json, "areas", json_areas); + for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) { switch (type) { case OSPF_AS_EXTERNAL_LSA: @@ -6325,39 +6675,82 @@ static void show_ip_ospf_database_summary(struct vty *vty, struct ospf *ospf, } if (ospf_lsdb_count_self(ospf->lsdb, type) || (!self && ospf_lsdb_count(ospf->lsdb, type))) { - vty_out(vty, " %s\n\n", - show_database_desc[type]); - vty_out(vty, "%s\n", show_database_header[type]); + if (!json) { + vty_out(vty, " %s\n\n", + show_database_desc[type]); + vty_out(vty, "%s\n", + show_database_header[type]); + } else { + json_lsa_array = json_object_new_array(); + json_object_object_add( + json, show_database_desc_json[type], + json_lsa_array); + } - LSDB_LOOP (AS_LSDB(ospf, type), rn, lsa) - show_lsa_summary(vty, lsa, self); + LSDB_LOOP (AS_LSDB(ospf, type), rn, lsa) { + if (json) { + json_lsa = json_object_new_object(); + json_object_array_add(json_lsa_array, + json_lsa); + } - vty_out(vty, "\n"); + show_lsa_summary(vty, lsa, self, json_lsa); + } + + if (!json) + vty_out(vty, "\n"); } } - vty_out(vty, "\n"); + if (!json) + vty_out(vty, "\n"); } -static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf) +static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf, + json_object *json) { struct route_node *rn; + json_object *json_maxage = NULL; - vty_out(vty, "\n MaxAge Link States:\n\n"); + if (!json) + vty_out(vty, "\n MaxAge Link States:\n\n"); + else + json_maxage = json_object_new_object(); for (rn = route_top(ospf->maxage_lsa); rn; rn = route_next(rn)) { struct ospf_lsa *lsa; + json_object *json_lsa = NULL; if ((lsa = rn->info) != NULL) { - vty_out(vty, "Link type: %d\n", lsa->data->type); - vty_out(vty, "Link State ID: %pI4\n", - &lsa->data->id); - vty_out(vty, "Advertising Router: %pI4\n", - &lsa->data->adv_router); - vty_out(vty, "LSA lock count: %d\n", lsa->lock); - vty_out(vty, "\n"); + if (!json) { + vty_out(vty, "Link type: %d\n", + lsa->data->type); + vty_out(vty, "Link State ID: %s\n", + inet_ntoa(lsa->data->id)); + vty_out(vty, "Advertising Router: %pI4\n", + &lsa->data->adv_router); + vty_out(vty, "LSA lock count: %d\n", lsa->lock); + vty_out(vty, "\n"); + } else { + json_lsa = json_object_new_object(); + json_object_int_add(json_lsa, "linkType", + lsa->data->type); + json_object_string_add( + json_lsa, "linkStateId", + inet_ntoa(lsa->data->id)); + json_object_string_add( + json_lsa, "advertisingRouter", + inet_ntoa(lsa->data->adv_router)); + json_object_int_add(json_lsa, "lsaLockCount", + lsa->lock); + json_object_object_add(json_maxage, + inet_ntoa(lsa->data->id), + json_lsa); + } } } + if (json) + json_object_object_add(json, "maxAgeLinkStates", json_maxage); } #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" @@ -6380,23 +6773,53 @@ static void show_ip_ospf_database_maxage(struct vty *vty, struct ospf *ospf) static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, int arg_base, int argc, struct cmd_token **argv, - uint8_t use_vrf) + uint8_t use_vrf, json_object *json, + bool uj) { int idx_type = 4; int type, ret; struct in_addr id, adv_router; + json_object *json_vrf = NULL; - if (ospf->instance) - vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance); + if (uj) { + if (use_vrf) + json_vrf = json_object_new_object(); + else + json_vrf = json; + } - ospf_show_vrf_name(ospf, vty, NULL, use_vrf); + if (ospf->instance) { + if (uj) + json_object_int_add(json_vrf, "ospfInstance", + ospf->instance); + else + vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); + } - vty_out(vty, "\n OSPF Router with ID (%pI4)\n\n", - &ospf->router_id); + ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf); + + /* Show Router ID. */ + if (uj) { + json_object_string_add(json_vrf, "routerId", + inet_ntoa(ospf->router_id)); + } else { + vty_out(vty, "\n OSPF Router with ID (%pI4)\n\n", + &ospf->router_id); + } /* Show all LSA. */ - if (argc == arg_base + 4) { - show_ip_ospf_database_summary(vty, ospf, 0); + if ((argc == arg_base + 4) || (uj && (argc == arg_base + 5))) { + show_ip_ospf_database_summary(vty, ospf, 0, json_vrf); + if (json) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); + } + } return CMD_SUCCESS; } @@ -6414,10 +6837,30 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, else if (strncmp(argv[arg_base + idx_type]->text, "e", 1) == 0) type = OSPF_AS_EXTERNAL_LSA; else if (strncmp(argv[arg_base + idx_type]->text, "se", 2) == 0) { - show_ip_ospf_database_summary(vty, ospf, 1); + show_ip_ospf_database_summary(vty, ospf, 1, json_vrf); + if (json) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); + } + } return CMD_SUCCESS; } else if (strncmp(argv[arg_base + idx_type]->text, "m", 1) == 0) { - show_ip_ospf_database_maxage(vty, ospf); + show_ip_ospf_database_maxage(vty, ospf, json_vrf); + if (json) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); + } + } return CMD_SUCCESS; } else if (strncmp(argv[arg_base + idx_type]->text, "opaque-l", 8) == 0) type = OSPF_OPAQUE_LINK_LSA; @@ -6429,18 +6872,19 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, return CMD_WARNING; /* `show ip ospf database LSA'. */ - if (argc == arg_base + 5) - show_lsa_detail(vty, ospf, type, NULL, NULL); + if ((argc == arg_base + 5) || (uj && (argc == arg_base + 6))) + show_lsa_detail(vty, ospf, type, NULL, NULL, json_vrf); else if (argc >= arg_base + 6) { ret = inet_aton(argv[arg_base + 5]->arg, &id); if (!ret) return CMD_WARNING; /* `show ip ospf database LSA ID'. */ - if (argc == arg_base + 6) - show_lsa_detail(vty, ospf, type, &id, NULL); + if ((argc == arg_base + 6) || (uj && (argc == arg_base + 7))) + show_lsa_detail(vty, ospf, type, &id, NULL, json_vrf); /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ - else if (argc == arg_base + 7) { + else if ((argc == arg_base + 7) + || (uj && (argc == arg_base + 8))) { if (strncmp(argv[arg_base + 6]->text, "s", 1) == 0) adv_router = ospf->router_id; else { @@ -6449,7 +6893,19 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, if (!ret) return CMD_WARNING; } - show_lsa_detail(vty, ospf, type, &id, &adv_router); + show_lsa_detail(vty, ospf, type, &id, &adv_router, + json_vrf); + } + } + + if (json) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); } } @@ -6458,7 +6914,7 @@ static int show_ip_ospf_database_common(struct vty *vty, struct ospf *ospf, DEFUN (show_ip_ospf_database_max, show_ip_ospf_database_max_cmd, - "show ip ospf [vrf <NAME|all>] database <max-age|self-originate>", + "show ip ospf [vrf <NAME|all>] database <max-age|self-originate> [json]", SHOW_STR IP_STR "OSPF information\n" @@ -6466,7 +6922,8 @@ DEFUN (show_ip_ospf_database_max, "All VRFs\n" "Database summary\n" "LSAs in MaxAge list\n" - "Self-originated link states\n") + "Self-originated link states\n" + JSON_STR) { struct ospf *ospf = NULL; struct listnode *node = NULL; @@ -6476,6 +6933,11 @@ DEFUN (show_ip_ospf_database_max, int inst = 0; int idx_vrf = 0; uint8_t use_vrf = 0; + bool uj = use_json(argc, argv); + json_object *json = NULL; + + if (uj) + json = json_object_new_object(); OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -6491,7 +6953,7 @@ DEFUN (show_ip_ospf_database_max, ospf_output = true; ret = show_ip_ospf_database_common( vty, ospf, idx_vrf ? 2 : 0, argc, argv, - use_vrf); + use_vrf, json, uj); } if (!ospf_output) @@ -6503,8 +6965,8 @@ DEFUN (show_ip_ospf_database_max, return CMD_SUCCESS; } ret = (show_ip_ospf_database_common( - vty, ospf, idx_vrf ? 2 : 0, argc, argv, - use_vrf)); + vty, ospf, idx_vrf ? 2 : 0, argc, argv, use_vrf, + json, uj)); } } else { /* Display default ospf (instance 0) info */ @@ -6515,7 +6977,12 @@ DEFUN (show_ip_ospf_database_max, } ret = show_ip_ospf_database_common(vty, ospf, 0, argc, argv, - use_vrf); + use_vrf, json, uj); + } + + if (uj) { + vty_out(vty, "%s\n", json_object_to_json_string(json)); + json_object_free(json); } return ret; @@ -6523,7 +6990,7 @@ DEFUN (show_ip_ospf_database_max, DEFUN (show_ip_ospf_instance_database, show_ip_ospf_instance_database_cmd, - "show ip ospf [{(1-65535)|vrf NAME}] database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]", + "show ip ospf [{(1-65535)|vrf NAME}] database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]] [json]", SHOW_STR IP_STR "OSPF information\n" @@ -6534,7 +7001,8 @@ DEFUN (show_ip_ospf_instance_database, "Link State ID (as an IP address)\n" "Self-originated link states\n" "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") + "Advertising Router (as an IP address)\n" + JSON_STR) { struct ospf *ospf; unsigned short instance = 0; @@ -6545,6 +7013,11 @@ DEFUN (show_ip_ospf_instance_database, int inst = 0; int idx = 0; uint8_t use_vrf = 0; + bool uj = use_json(argc, argv); + json_object *json = NULL; + + if (uj) + json = json_object_new_object(); if (argv_find(argv, argc, "(1-65535)", &idx)) { instance = strtoul(argv[idx]->arg, NULL, 10); @@ -6554,8 +7027,8 @@ DEFUN (show_ip_ospf_instance_database, if (!ospf->oi_running) return CMD_SUCCESS; - return (show_ip_ospf_database_common(vty, ospf, idx ? 1 : 0, - argc, argv, use_vrf)); + return (show_ip_ospf_database_common( + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, json, uj)); } else if (argv_find(argv, argc, "vrf", &idx)) { vrf_name = argv[++idx]->arg; all_vrf = strmatch(vrf_name, "all"); @@ -6569,7 +7042,7 @@ DEFUN (show_ip_ospf_instance_database, continue; ret = (show_ip_ospf_database_common( vty, ospf, idx ? 2 : 0, argc, argv, - use_vrf)); + use_vrf, json, uj)); } } else { ospf = ospf_lookup_by_inst_name(inst, vrf_name); @@ -6579,7 +7052,8 @@ DEFUN (show_ip_ospf_instance_database, } ret = (show_ip_ospf_database_common( - vty, ospf, idx ? 2 : 0, argc, argv, use_vrf)); + vty, ospf, idx ? 2 : 0, argc, argv, use_vrf, + json, uj)); } } else { /* Display default ospf (instance 0) info */ @@ -6590,7 +7064,12 @@ DEFUN (show_ip_ospf_instance_database, } ret = (show_ip_ospf_database_common(vty, ospf, 0, argc, argv, - use_vrf)); + use_vrf, json, uj)); + } + + if (uj) { + vty_out(vty, "%s\n", json_object_to_json_string(json)); + json_object_free(json); } return ret; @@ -6598,18 +7077,24 @@ DEFUN (show_ip_ospf_instance_database, DEFUN (show_ip_ospf_instance_database_max, show_ip_ospf_instance_database_max_cmd, - "show ip ospf (1-65535) database <max-age|self-originate>", + "show ip ospf (1-65535) database <max-age|self-originate> [json]", SHOW_STR IP_STR "OSPF information\n" "Instance ID\n" "Database summary\n" "LSAs in MaxAge list\n" - "Self-originated link states\n") + "Self-originated link states\n" + JSON_STR) { int idx_number = 3; struct ospf *ospf; unsigned short instance = 0; + bool uj = use_json(argc, argv); + json_object *json = NULL; + + if (uj) + json = json_object_new_object(); instance = strtoul(argv[idx_number]->arg, NULL, 10); @@ -6622,7 +7107,16 @@ DEFUN (show_ip_ospf_instance_database_max, return CMD_SUCCESS; } - return show_ip_ospf_database_common(vty, ospf, 1, argc, argv, 0); + show_ip_ospf_database_common(vty, ospf, 1, argc, argv, 0, json, uj); + + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } + + return CMD_SUCCESS; } @@ -6630,19 +7124,40 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty, struct ospf *ospf, int arg_base, int argc, struct cmd_token **argv, - uint8_t use_vrf) + uint8_t use_vrf, + json_object *json, + bool uj) { int idx_type = 4; int type, ret; struct in_addr adv_router; + json_object *json_vrf = NULL; - if (ospf->instance) - vty_out(vty, "\nOSPF Instance: %d\n", ospf->instance); + if (uj) { + if (use_vrf) + json_vrf = json_object_new_object(); + else + json_vrf = json; + } - ospf_show_vrf_name(ospf, vty, NULL, use_vrf); + if (ospf->instance) { + if (uj) + json_object_int_add(json, "ospfInstance", + ospf->instance); + else + vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); + } + + ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf); - vty_out(vty, "\n OSPF Router with ID (%pI4)\n\n", - &ospf->router_id); + /* Show Router ID. */ + if (uj) { + json_object_string_add(json_vrf, "routerId", + inet_ntoa(ospf->router_id)); + } else { + vty_out(vty, "\n OSPF Router with ID (%pI4)\n\n", + &ospf->router_id); + } /* Set database type to show. */ if (strncmp(argv[arg_base + idx_type]->text, "r", 1) == 0) @@ -6675,14 +7190,25 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty, return CMD_WARNING; } - show_lsa_detail_adv_router(vty, ospf, type, &adv_router); + show_lsa_detail_adv_router(vty, ospf, type, &adv_router, json_vrf); + + if (json) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); + } + } return CMD_SUCCESS; } DEFUN (show_ip_ospf_instance_database_type_adv_router, show_ip_ospf_instance_database_type_adv_router_cmd, - "show ip ospf [{(1-65535)|vrf NAME}] database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>", + "show ip ospf [{(1-65535)|vrf NAME}] database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate> [json]", SHOW_STR IP_STR "OSPF information\n" @@ -6692,7 +7218,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, OSPF_LSA_TYPES_DESC "Advertising Router link states\n" "Advertising Router (as an IP address)\n" - "Self-originated link states\n") + "Self-originated link states\n" + JSON_STR) { struct ospf *ospf = NULL; unsigned short instance = 0; @@ -6703,6 +7230,11 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, int inst = 0; int idx = 0, idx_vrf = 0; uint8_t use_vrf = 0; + bool uj = use_json(argc, argv); + json_object *json = NULL; + + if (uj) + json = json_object_new_object(); if (argv_find(argv, argc, "(1-65535)", &idx)) { instance = strtoul(argv[idx]->arg, NULL, 10); @@ -6715,7 +7247,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, } return (show_ip_ospf_database_type_adv_router_common( - vty, ospf, idx ? 1 : 0, argc, argv, use_vrf)); + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, json, uj)); } OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); @@ -6732,7 +7264,7 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, ospf_output = true; ret = show_ip_ospf_database_type_adv_router_common( vty, ospf, idx ? 1 : 0, argc, argv, - use_vrf); + use_vrf, json, uj); } if (!ospf_output) vty_out(vty, "%% OSPF instance not found\n"); @@ -6744,7 +7276,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, } ret = show_ip_ospf_database_type_adv_router_common( - vty, ospf, idx ? 1 : 0, argc, argv, use_vrf); + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, + json, uj); } } else { /* Display default ospf (instance 0) info */ @@ -6755,8 +7288,14 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, } ret = show_ip_ospf_database_type_adv_router_common( - vty, ospf, idx ? 1 : 0, argc, argv, use_vrf); + vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, json, uj); } + + if (uj) { + vty_out(vty, "%s\n", json_object_to_json_string(json)); + json_object_free(json); + } + return ret; /*return (show_ip_ospf_database_type_adv_router_common( vty, ospf, idx ? 1 : 0, argc, argv));*/ @@ -8151,6 +8690,7 @@ DEFUN (ip_ospf_area, struct ospf *ospf = NULL; unsigned short instance = 0; char *areaid; + uint32_t count = 0; if (argv_find(argv, argc, "(1-65535)", &idx)) instance = strtol(argv[idx]->arg, NULL, 10); @@ -8175,15 +8715,28 @@ DEFUN (ip_ospf_area, * allow the other instance(process) handle * the configuration command. */ + count = 0; + params = IF_DEF_PARAMS(ifp); if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) { UNSET_IF_PARAM(params, if_area); - ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); + count++; + } + + for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) + if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) { + UNSET_IF_PARAM(params, if_area); + count++; + } + + if (count > 0) { + ospf = ospf_lookup_by_vrf_id(ifp->vrf_id); if (ospf) { ospf_interface_area_unset(ospf, ifp); - ospf->if_ospf_cli_count--; + ospf->if_ospf_cli_count -= count; } } + return CMD_NOT_MY_INSTANCE; } @@ -8197,6 +8750,16 @@ DEFUN (ip_ospf_area, return CMD_WARNING_CONFIG_FAILED; } + if (ospf) { + for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) { + if (rn->info != NULL) { + vty_out(vty, + "Please remove all network commands first.\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } + } + params = IF_DEF_PARAMS(ifp); if (OSPF_IF_PARAM_CONFIGURED(params, if_area) && !IPV4_ADDR_SAME(¶ms->if_area, &area_id)) { @@ -8216,22 +8779,12 @@ DEFUN (ip_ospf_area, params = ospf_get_if_params((ifp), (addr)); if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) { vty_out(vty, - "Must remove previous area/address config before changing ospf area"); + "Must remove previous area/address config before changing ospf area\n"); return CMD_WARNING_CONFIG_FAILED; } ospf_if_update_params((ifp), (addr)); } - if (ospf) { - for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) { - if (rn->info != NULL) { - vty_out(vty, - "Please remove all network commands first.\n"); - return CMD_WARNING_CONFIG_FAILED; - } - } - } - /* enable ospf on this interface with area_id */ if (params) { SET_IF_PARAM(params, if_area); @@ -9225,6 +9778,88 @@ DEFPY(ospf_gr_helper_planned_only, return CMD_SUCCESS; } +/* External Route Aggregation */ +DEFUN (ospf_external_route_aggregation, + ospf_external_route_aggregation_cmd, + "summary-address A.B.C.D/M [tag (1-4294967295)]", + "External summary address\n" + "Summary address prefix (a.b.c.d/m) \n" + "Router tag \n" + "Router tag value\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + struct prefix_ipv4 p; + int idx = 1; + route_tag_t tag = 0; + int ret = OSPF_SUCCESS; + + str2prefix_ipv4(argv[idx]->arg, &p); + + if (is_prefix_default(&p)) { + vty_out(vty, + "Default address shouldn't be configured as summary address.\n"); + return CMD_SUCCESS; + } + + /* Apply mask for given prefix. */ + apply_mask((struct prefix *)&p); + + if (!is_valid_summary_addr(&p)) { + vty_out(vty, "Not a valid summary address.\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + if (argc > 2) + tag = strtoul(argv[idx + 2]->arg, NULL, 10); + + ret = ospf_asbr_external_aggregator_set(ospf, &p, tag); + if (ret == OSPF_INVALID) + vty_out(vty, "Inavlid configuration!!\n"); + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_external_route_aggregation, + no_ospf_external_route_aggregation_cmd, + "no summary-address A.B.C.D/M [tag (1-4294967295)]", + NO_STR + "External summary address\n" + "Summary address prefix (a.b.c.d/m)\n" + "Router tag\n" + "Router tag value\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + struct prefix_ipv4 p; + int idx = 2; + route_tag_t tag = 0; + int ret = OSPF_SUCCESS; + + str2prefix_ipv4(argv[idx]->arg, &p); + + if (is_prefix_default(&p)) { + vty_out(vty, + "Default address shouldn't be configured as summary address.\n"); + return CMD_SUCCESS; + } + + /* Apply mask for given prefix. */ + apply_mask((struct prefix *)&p); + + if (!is_valid_summary_addr(&p)) { + vty_out(vty, "Not a valid summary address.\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + if (argc > 3) + tag = strtoul(argv[idx + 2]->arg, NULL, 10); + + ret = ospf_asbr_external_aggregator_unset(ospf, &p, tag); + if (ret == OSPF_INVALID) + vty_out(vty, "Inavlid configuration!!\n"); + + return CMD_SUCCESS; +} + DEFPY(no_ospf_gr_helper_planned_only, no_ospf_gr_helper_planned_only_cmd, "no graceful-restart helper planned-only", @@ -9477,6 +10112,93 @@ static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf, } } } + return CMD_SUCCESS; +} + +DEFUN (ospf_external_route_aggregation_no_adrvertise, + ospf_external_route_aggregation_no_adrvertise_cmd, + "summary-address A.B.C.D/M no-advertise", + "External summary address\n" + "Summary address prefix (a.b.c.d/m) \n" + "Don't advertise summary route \n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + struct prefix_ipv4 p; + int idx = 1; + int ret = OSPF_SUCCESS; + + str2prefix_ipv4(argv[idx]->arg, &p); + + if (is_prefix_default(&p)) { + vty_out(vty, + "Default address shouldn't be configured as summary address.\n"); + return CMD_SUCCESS; + } + + /* Apply mask for given prefix. */ + apply_mask((struct prefix *)&p); + + if (!is_valid_summary_addr(&p)) { + vty_out(vty, "Not a valid summary address.\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + ret = ospf_asbr_external_rt_no_advertise(ospf, &p); + if (ret == OSPF_INVALID) + vty_out(vty, "Inavlid configuration!!\n"); + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_external_route_aggregation_no_adrvertise, + no_ospf_external_route_aggregation_no_adrvertise_cmd, + "no summary-address A.B.C.D/M no-advertise", + NO_STR + "External summary address\n" + "Summary address prefix (a.b.c.d/m)\n" + "Advertise summary route to the AS \n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + struct prefix_ipv4 p; + int idx = 2; + int ret = OSPF_SUCCESS; + + str2prefix_ipv4(argv[idx]->arg, &p); + + if (is_prefix_default(&p)) { + vty_out(vty, + "Default address shouldn't be configured as summary address.\n"); + return CMD_SUCCESS; + } + + /* Apply mask for given prefix. */ + apply_mask((struct prefix *)&p); + + if (!is_valid_summary_addr(&p)) { + vty_out(vty, "Not a valid summary address.\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + ret = ospf_asbr_external_rt_advertise(ospf, &p); + if (ret == OSPF_INVALID) + vty_out(vty, "Inavlid configuration!!\n"); + + return CMD_SUCCESS; +} + +DEFUN (ospf_route_aggregation_timer, + ospf_route_aggregation_timer_cmd, + "aggregation timer (5-1800)", + "External route aggregation\n" + "Delay timer (in seconds)\n" + "Timer interval(in seconds)\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + unsigned int interval = 0; + + interval = strtoul(argv[2]->arg, NULL, 10); + + ospf_external_aggregator_timer_set(ospf, interval); return CMD_SUCCESS; } @@ -9583,6 +10305,21 @@ DEFPY (show_ip_ospf_gr_helper, return CMD_SUCCESS; } /* Graceful Restart HELPER commands end */ +DEFUN (no_ospf_route_aggregation_timer, + no_ospf_route_aggregation_timer_cmd, + "no aggregation timer", + NO_STR + "External route aggregation\n" + "Delay timer\n") +{ + VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); + + ospf_external_aggregator_timer_set(ospf, OSPF_EXTL_AGGR_DEFAULT_DELAY); + + return CMD_SUCCESS; +} + +/* External Route Aggregation End */ static void config_write_stub_router(struct vty *vty, struct ospf *ospf) { @@ -10393,6 +11130,264 @@ static const char *const ospf_abr_type_str[] = { static const char *const ospf_shortcut_mode_str[] = { "default", "enable", "disable" }; +static int ospf_vty_external_rt_walkcb(struct hash_bucket *backet, + void *arg) +{ + struct external_info *ei = backet->data; + struct vty *vty = (struct vty *)arg; + static unsigned int count; + + vty_out(vty, "%-4pI4/%d, ", &ei->p.prefix, ei->p.prefixlen); + count++; + + if (count % 5 == 0) + vty_out(vty, "\n"); + + if (OSPF_EXTERNAL_RT_COUNT(ei->aggr_route) == count) + count = 0; + + return HASHWALK_CONTINUE; +} + +static int ospf_json_external_rt_walkcb(struct hash_bucket *backet, + void *arg) +{ + struct external_info *ei = backet->data; + struct json_object *json = (struct json_object *)arg; + char buf[PREFIX2STR_BUFFER]; + char exnalbuf[20]; + static unsigned int count; + + prefix2str(&ei->p, buf, sizeof(buf)); + + snprintf(exnalbuf, 20, "Exnl Addr-%d", count); + + json_object_string_add(json, exnalbuf, buf); + + count++; + + if (OSPF_EXTERNAL_RT_COUNT(ei->aggr_route) == count) + count = 0; + + return HASHWALK_CONTINUE; +} + +static int ospf_show_summary_address(struct vty *vty, struct ospf *ospf, + uint8_t use_vrf, json_object *json, + bool uj, bool detail) +{ + struct route_node *rn; + json_object *json_vrf = NULL; + int mtype = 0; + int mval = 0; + static char header[] = + "Summary-address Metric-type Metric Tag External_Rt_count\n"; + + mtype = metric_type(ospf, 0, ospf->instance); + mval = metric_value(ospf, 0, ospf->instance); + + if (!uj) + vty_out(vty, "%s\n", header); + + if (uj) { + if (use_vrf) + json_vrf = json_object_new_object(); + else + json_vrf = json; + } + + if (ospf->instance) { + if (uj) + json_object_int_add(json, "ospfInstance", + ospf->instance); + else + vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance); + } + + ospf_show_vrf_name(ospf, vty, json_vrf, use_vrf); + + if (!uj) + vty_out(vty, "aggregation delay interval :%d(in seconds)\n\n", + ospf->aggr_delay_interval); + else + json_object_int_add(json_vrf, "aggregation delay interval", + ospf->aggr_delay_interval); + + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) + if (rn->info) { + struct ospf_external_aggr_rt *aggr = rn->info; + json_object *json_aggr = NULL; + char buf[PREFIX2STR_BUFFER]; + + prefix2str(&aggr->p, buf, sizeof(buf)); + + if (uj) { + + json_aggr = json_object_new_object(); + + json_object_object_add(json_vrf, buf, + json_aggr); + + json_object_string_add(json_aggr, + "Summary address", buf); + + json_object_string_add( + json_aggr, "Metric-type", + (mtype == EXTERNAL_METRIC_TYPE_1) + ? "E1" + : "E2"); + + json_object_int_add(json_aggr, "Metric", mval); + + json_object_int_add(json_aggr, "Tag", + aggr->tag); + + json_object_int_add( + json_aggr, "External route count", + OSPF_EXTERNAL_RT_COUNT(aggr)); + + if (OSPF_EXTERNAL_RT_COUNT(aggr) && detail) { + hash_walk( + aggr->match_extnl_hash, + ospf_json_external_rt_walkcb, + json_aggr); + } + + } else { + vty_out(vty, "%-20s", buf); + + (mtype == EXTERNAL_METRIC_TYPE_1) + ? vty_out(vty, "%-16s", "E1") + : vty_out(vty, "%-16s", "E2"); + vty_out(vty, "%-11d", mval); + + vty_out(vty, "%-12u", aggr->tag); + + vty_out(vty, "%-5ld\n", + OSPF_EXTERNAL_RT_COUNT(aggr)); + + if (OSPF_EXTERNAL_RT_COUNT(aggr) && detail) { + vty_out(vty, + "Matched External routes:\n"); + hash_walk( + aggr->match_extnl_hash, + ospf_vty_external_rt_walkcb, + vty); + vty_out(vty, "\n"); + } + + vty_out(vty, "\n"); + } + } + + if (uj) { + if (use_vrf) { + if (ospf->vrf_id == VRF_DEFAULT) + json_object_object_add(json, "default", + json_vrf); + else + json_object_object_add(json, ospf->name, + json_vrf); + } + } else + vty_out(vty, "\n"); + + return CMD_SUCCESS; +} + +DEFUN (show_ip_ospf_external_aggregator, + show_ip_ospf_external_aggregator_cmd, + "show ip ospf [vrf <NAME|all>] summary-address [detail] [json]", + SHOW_STR IP_STR + "OSPF information\n" + VRF_CMD_HELP_STR + "All VRFs\n" + "Show external summary addresses\n" + "Detailed informtion\n" + JSON_STR) +{ + char *vrf_name = NULL; + bool all_vrf = false; + int ret = CMD_SUCCESS; + int idx_vrf = 0; + int idx = 0; + uint8_t use_vrf = 0; + bool uj = use_json(argc, argv); + struct ospf *ospf = NULL; + json_object *json = NULL; + struct listnode *node = NULL; + int inst = 0; + bool detail = false; + + OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); + + if (argv_find(argv, argc, "detail", &idx)) + detail = true; + + if (uj) + json = json_object_new_object(); + + /* vrf input is provided */ + if (vrf_name) { + use_vrf = 1; + if (all_vrf) { + for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) { + if (!ospf->oi_running) + continue; + ret = ospf_show_summary_address( + vty, ospf, use_vrf, json, uj, detail); + } + + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } + + return ret; + } + + ospf = ospf_lookup_by_inst_name(inst, vrf_name); + + if (ospf == NULL || !ospf->oi_running) { + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } else + vty_out(vty, "%% OSPF instance not found\n"); + + return CMD_SUCCESS; + } + ospf_show_summary_address(vty, ospf, use_vrf, json, uj, detail); + + } else { + /* Default Vrf */ + ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); + if (ospf == NULL || !ospf->oi_running) { + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } else + vty_out(vty, "%% OSPF instance not found\n"); + + return CMD_SUCCESS; + } + + ospf_show_summary_address(vty, ospf, use_vrf, json, uj, detail); + } + + if (uj) { + vty_out(vty, "%s\n", json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); + } + return CMD_SUCCESS; +} static const char *const ospf_int_type_str[] = { "unknown", /* should never be used. */ @@ -10949,6 +11944,30 @@ static int config_write_ospf_gr_helper(struct vty *vty, struct ospf *ospf) hash_walk(ospf->enable_rtr_list, ospf_cfg_write_helper_dis_rtr_walkcb, vty); } + return 0; +} + +static int config_write_ospf_external_aggregator(struct vty *vty, + struct ospf *ospf) +{ + struct route_node *rn; + + /* print 'summary-address A.B.C.D/M' */ + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) + if (rn->info) { + struct ospf_external_aggr_rt *aggr = rn->info; + + vty_out(vty, " summary-address %pI4/%d ", + &aggr->p.prefix, aggr->p.prefixlen); + if (aggr->tag) + vty_out(vty, " tag %u ", aggr->tag); + + if (CHECK_FLAG(aggr->flags, + OSPF_EXTERNAL_AGGRT_NO_ADVERTISE)) + vty_out(vty, " no-advertise"); + + vty_out(vty, "\n"); + } return 0; } @@ -11122,6 +12141,9 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf) /* Print gr helper configs */ config_write_ospf_gr_helper(vty, ospf); + /* Print external route aggregation. */ + config_write_ospf_external_aggregator(vty, ospf); + /* passive-interface print. */ if (ospf->passive_interface_default == OSPF_IF_PASSIVE) vty_out(vty, " passive-interface default\n"); @@ -11268,8 +12290,10 @@ void ospf_vty_show_init(void) /* "show ip ospf gr-helper details" command */ install_element(VIEW_NODE, &show_ip_ospf_gr_helper_cmd); -} + /* "show ip ospf summary-address" command */ + install_element(VIEW_NODE, &show_ip_ospf_external_aggregator_cmd); +} static int config_write_interface(struct vty *vty); /* ospfd's interface node. */ @@ -11393,6 +12417,17 @@ static void ospf_vty_zebra_init(void) install_element(OSPF_NODE, &no_ospf_gr_helper_supported_grace_time_cmd); install_element(OSPF_NODE, &ospf_gr_helper_planned_only_cmd); install_element(OSPF_NODE, &no_ospf_gr_helper_planned_only_cmd); + + /* External LSA summarisation config commands.*/ + install_element(OSPF_NODE, &ospf_external_route_aggregation_cmd); + install_element(OSPF_NODE, &no_ospf_external_route_aggregation_cmd); + install_element(OSPF_NODE, + &ospf_external_route_aggregation_no_adrvertise_cmd); + install_element(OSPF_NODE, + &no_ospf_external_route_aggregation_no_adrvertise_cmd); + install_element(OSPF_NODE, &ospf_route_aggregation_timer_cmd); + install_element(OSPF_NODE, &no_ospf_route_aggregation_timer_cmd); + #if 0 install_element (OSPF_NODE, &ospf_distance_source_cmd); install_element (OSPF_NODE, &no_ospf_distance_source_cmd); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 9fa6a59a72..e7dbdbd9af 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -463,7 +463,7 @@ static int ospf_external_lsa_default_routemap_timer(struct thread *thread) if (ret && !lsa) ospf_external_lsa_originate(ospf, default_ei); else if (ret && lsa && IS_LSA_MAXAGE(lsa)) - ospf_external_lsa_refresh(ospf, lsa, default_ei, true); + ospf_external_lsa_refresh(ospf, lsa, default_ei, true, false); else if (!ret && lsa) ospf_external_lsa_flush(ospf, DEFAULT_ROUTE, &default_ei->p, 0); @@ -902,8 +902,7 @@ int ospf_external_info_apply_default_routemap(struct ospf *ospf, if (red && ROUTEMAP_NAME(red)) { route_map_result_t ret; - ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, - RMAP_OSPF, ei); + ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei); if (ret == RMAP_DENYMATCH) { ei->route_map_set = save_values; @@ -964,7 +963,7 @@ static bool ospf_external_lsa_default_routemap_apply(struct ospf *ospf, /* If permit and default already advertise then return. */ if (lsa && !IS_LSA_MAXAGE(lsa)) { if (IS_DEBUG_OSPF_DEFAULT_INFO) - zlog_debug("Defult lsa already originated"); + zlog_debug("Default lsa already originated"); return true; } @@ -973,7 +972,8 @@ static bool ospf_external_lsa_default_routemap_apply(struct ospf *ospf, if (lsa && IS_LSA_MAXAGE(lsa)) /* Refresh lsa.*/ - ospf_external_lsa_refresh(ospf, lsa, default_ei, true); + ospf_external_lsa_refresh(ospf, lsa, default_ei, true, + false); else /* If permit and default not advertised then advertise. */ @@ -1055,8 +1055,7 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei, if (red && ROUTEMAP_NAME(red)) { route_map_result_t ret; - ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, - RMAP_OSPF, ei); + ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei); if (ret == RMAP_DENYMATCH) { ei->route_map_set = save_values; @@ -1180,23 +1179,100 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) if (is_prefix_default(&p)) ospf_external_lsa_refresh_default(ospf); else { - struct ospf_lsa *current; + struct ospf_external_aggr_rt *aggr; + struct as_external_lsa *al; + struct ospf_lsa *lsa = NULL; + struct in_addr mask; + + aggr = ospf_external_aggr_match(ospf, + &ei->p); + + if (aggr) { + /* Check the AS-external-LSA + * should be originated. + */ + if (!ospf_redistribute_check( + ospf, ei, NULL)) + return 0; - current = ospf_external_info_find_lsa( - ospf, &ei->p); - if (!current) - ospf_external_lsa_originate( - ospf, ei); - else { if (IS_DEBUG_OSPF( - zebra, - ZEBRA_REDISTRIBUTE)) + lsa, + EXTNL_LSA_AGGR)) zlog_debug( - "ospf_zebra_read_route() : %pI4 refreshing LSA", - &p.prefix); - ospf_external_lsa_refresh( - ospf, current, ei, - LSA_REFRESH_FORCE); + "%s: Send Aggreate LSA (%pI4/%d)", + __func__, + &aggr->p.prefix, + aggr->p.prefixlen); + + ospf_originate_summary_lsa( + ospf, aggr, ei); + + /* Handling the case where the + * external route prefix + * and aggegate prefix is same + * If same dont flush the + * originated + * external LSA. + */ + if (prefix_same( + (struct prefix + *)&aggr->p, + (struct prefix *)&ei + ->p)) + return 0; + + lsa = ospf_external_info_find_lsa( + ospf, &ei->p); + + if (lsa) { + al = (struct + as_external_lsa *) + lsa->data; + masklen2ip( + ei->p.prefixlen, + &mask); + + if (mask.s_addr + != al->mask.s_addr) + return 0; + + ospf_external_lsa_flush( + ospf, ei->type, + &ei->p, 0); + } + } else { + struct ospf_lsa *current; + + current = + ospf_external_info_find_lsa( + ospf, &ei->p); + if (!current) { + /* Check the + * AS-external-LSA + * should be + * originated. + */ + if (!ospf_redistribute_check( + ospf, ei, + NULL)) + return 0; + + ospf_external_lsa_originate( + ospf, ei); + } else { + if (IS_DEBUG_OSPF( + zebra, + ZEBRA_REDISTRIBUTE)) + zlog_debug( + "%s: %pI4 refreshing LSA", + __func__, + &p.prefix); + ospf_external_lsa_refresh( + ospf, current, + ei, + LSA_REFRESH_FORCE, + false); + } } } } @@ -1210,21 +1286,36 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) } else /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */ { - /* - * Check if default-information originate is - * with some routemap prefix/access list match. - * Apply before ei is deleted. - */ + struct ospf_external_aggr_rt *aggr; + ei = ospf_external_info_lookup(ospf, rt_type, api.instance, &p); - if (ei) + if (ei == NULL) + return 0; + else + /* + * Check if default-information originate i + * with some routemap prefix/access list match. + * Apply before ei is deleted. + */ ospf_external_lsa_default_routemap_apply(ospf, ei, cmd); - ospf_external_info_delete(ospf, rt_type, api.instance, p); - if (is_prefix_default(&p)) - ospf_external_lsa_refresh_default(ospf); - else - ospf_external_lsa_flush(ospf, rt_type, &p, - ifindex /*, nexthop */); + aggr = ospf_external_aggr_match(ospf, &ei->p); + + if (aggr && (ei->aggr_route == aggr)) { + ospf_unlink_ei_from_aggr(ospf, aggr, ei); + + ospf_external_info_delete(ospf, rt_type, api.instance, + p); + } else { + ospf_external_info_delete(ospf, rt_type, api.instance, + p); + + if (is_prefix_default(&p)) + ospf_external_lsa_refresh_default(ospf); + else + ospf_external_lsa_flush(ospf, rt_type, &p, + ifindex /*, nexthop */); + } } @@ -1316,32 +1407,80 @@ static int ospf_distribute_list_update_timer(struct thread *thread) if ((ei = rn->info) != NULL) { if (is_prefix_default(&ei->p)) default_refresh = 1; - else if ( - (lsa = ospf_external_info_find_lsa( - ospf, &ei->p))) { - int force = - LSA_REFRESH_IF_CHANGED; - /* If this is a MaxAge LSA, we - * need to force refresh it - * because distribute settings - * might have changed and now, - * this LSA needs to be - * originated, not be removed. - * If we don't force refresh it, - * it will remain a MaxAge LSA - * because it will look like it - * hasn't changed. Neighbors - * will not receive updates for - * this LSA. - */ - if (IS_LSA_MAXAGE(lsa)) - force = LSA_REFRESH_FORCE; - - ospf_external_lsa_refresh( - ospf, lsa, ei, force); - } else - ospf_external_lsa_originate( - ospf, ei); + else { + struct ospf_external_aggr_rt + *aggr; + aggr = ospf_external_aggr_match( + ospf, &ei->p); + if (aggr) { + /* Check the + * AS-external-LSA + * should be originated. + */ + if (!ospf_redistribute_check( + ospf, ei, + NULL)) { + + ospf_unlink_ei_from_aggr( + ospf, + aggr, + ei); + continue; + } + + if (IS_DEBUG_OSPF( + lsa, + EXTNL_LSA_AGGR)) + zlog_debug( + "%s: Send Aggregate LSA (%pI4/%d)", + __func__, + &aggr->p.prefix, + aggr->p.prefixlen); + + /* Originate Aggregate + * LSA + */ + ospf_originate_summary_lsa( + ospf, aggr, ei); + } else if ( + (lsa = ospf_external_info_find_lsa( + ospf, + &ei->p))) { + int force = + LSA_REFRESH_IF_CHANGED; + /* If this is a MaxAge + * LSA, we need to + * force refresh it + * because distribute + * settings might have + * changed and now, + * this LSA needs to be + * originated, not be + * removed. + * If we don't force + * refresh it, it will + * remain a MaxAge LSA + * because it will look + * like it hasn't + * changed. Neighbors + * will not receive + * updates for this LSA. + */ + if (IS_LSA_MAXAGE(lsa)) + force = LSA_REFRESH_FORCE; + + ospf_external_lsa_refresh( + ospf, lsa, ei, + force, false); + } else { + if (!ospf_redistribute_check( + ospf, ei, + NULL)) + continue; + ospf_external_lsa_originate( + ospf, ei); + } + } } } } @@ -1776,7 +1915,7 @@ int ospf_zebra_label_manager_connect(void) set_nonblocking(zclient_sync->sock); /* Send hello to notify zebra this is a synchronous client */ - if (zclient_send_hello(zclient_sync) < 0) { + if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) { zlog_warn("%s: failed sending hello for synchronous zclient!", __func__); close(zclient_sync->sock); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 3718f82c05..d8be19db9a 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -312,6 +312,8 @@ static struct ospf *ospf_new(unsigned short instance, const char *name) ospf_gr_helper_init(new); + ospf_asbr_external_aggregator_init(new); + QOBJ_REG(new, ospf); new->fd = -1; @@ -385,6 +387,8 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name) struct ospf *ospf_get(unsigned short instance, const char *name, bool *created) { struct ospf *ospf; + struct vrf *vrf; + struct interface *ifp; /* vrf name provided call inst and name based api * in case of no name pass default ospf instance */ @@ -398,10 +402,39 @@ struct ospf *ospf_get(unsigned short instance, const char *name, bool *created) ospf = ospf_new(instance, name); ospf_add(ospf); - if (ospf->router_id_static.s_addr == INADDR_ANY) - ospf_router_id_update(ospf); - ospf_opaque_type11_lsa_init(ospf); + + if (ospf->vrf_id != VRF_UNKNOWN) + ospf->oi_running = 1; + + /* Activate 'ip ospf area x' configured interfaces for given + * vrf. Activate area on vrf x aware interfaces. + * vrf_enable callback calls router_id_update which + * internally will call ospf_if_update to trigger + * network_run_state + */ + vrf = vrf_lookup_by_id(ospf->vrf_id); + + FOR_ALL_INTERFACES (vrf, ifp) { + struct ospf_if_params *params; + struct route_node *rn; + uint32_t count = 0; + + params = IF_DEF_PARAMS(ifp); + if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn)) + if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area)) + count++; + + if (count > 0) { + ospf_interface_area_set(ospf, ifp); + ospf->if_ospf_cli_count += count; + } + } + + ospf_router_id_update(ospf); } return ospf; @@ -417,9 +450,6 @@ struct ospf *ospf_get_instance(unsigned short instance, bool *created) ospf = ospf_new(instance, NULL /* VRF_DEFAULT*/); ospf_add(ospf); - if (ospf->router_id_static.s_addr == INADDR_ANY) - ospf_router_id_update(ospf); - ospf_opaque_type11_lsa_init(ospf); } @@ -581,11 +611,10 @@ void ospf_finish(struct ospf *ospf) /* Final cleanup of ospf instance */ static void ospf_finish_final(struct ospf *ospf) { - struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id); + struct vrf *vrf; struct route_node *rn; struct ospf_nbr_nbma *nbr_nbma; struct ospf_lsa *lsa; - struct interface *ifp; struct ospf_interface *oi; struct ospf_area *area; struct ospf_vl_data *vl_data; @@ -628,15 +657,6 @@ static void ospf_finish_final(struct ospf *ospf) if (ospf->vrf_id == VRF_DEFAULT) ospf_ldp_sync_gbl_exit(ospf, true); - /* Remove any ospf interface config params */ - FOR_ALL_INTERFACES (vrf, ifp) { - struct ospf_if_params *params; - - params = IF_DEF_PARAMS(ifp); - if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) - UNSET_IF_PARAM(params, if_area); - } - /* Reset interface. */ for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) ospf_if_free(oi); @@ -698,6 +718,7 @@ static void ospf_finish_final(struct ospf *ospf) OSPF_TIMER_OFF(ospf->t_opaque_lsa_self); OSPF_TIMER_OFF(ospf->t_sr_update); OSPF_TIMER_OFF(ospf->t_default_routemap_timer); + OSPF_TIMER_OFF(ospf->t_external_aggr); LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) ospf_discard_from_db(ospf, ospf->lsdb, lsa); @@ -766,6 +787,22 @@ static void ospf_finish_final(struct ospf *ospf) ospf_distance_reset(ospf); route_table_finish(ospf->distance_table); + /* Release extrenal Aggregator table */ + for (rn = route_top(ospf->rt_aggr_tbl); rn; rn = route_next(rn)) { + struct ospf_external_aggr_rt *aggr; + + aggr = rn->info; + + if (aggr) { + ospf_external_aggregator_free(aggr); + rn->info = NULL; + route_unlock_node(rn); + } + } + + route_table_finish(ospf->rt_aggr_tbl); + + list_delete(&ospf->areas); list_delete(&ospf->oi_write_q); @@ -1144,32 +1181,6 @@ void ospf_interface_area_unset(struct ospf *ospf, struct interface *ifp) update_redistributed(ospf, 0); /* interfaces possibly removed */ } -bool ospf_interface_area_is_already_set(struct ospf *ospf, - struct interface *ifp) -{ - struct route_node *rn_oi; - - if (!ospf) - return false; /* Ospf not ready yet */ - - /* Find interfaces that may need to be removed. */ - for (rn_oi = route_top(IF_OIFS(ifp)); rn_oi; - rn_oi = route_next(rn_oi)) { - struct ospf_interface *oi = rn_oi->info; - - if (oi == NULL) - continue; - - if (oi->type == OSPF_IFTYPE_VIRTUALLINK) - continue; - /* at least one route covered by interface - * that implies already done - */ - return true; - } - return false; -} - /* Check whether interface matches given network * returns: 1, true. 0, false */ @@ -1592,7 +1603,8 @@ int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id, int argc) OSPF_NSSA_TRANS_STABLE_DEFAULT; ospf_area_type_set(area, OSPF_AREA_DEFAULT); } else { - area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE; + ospf_area_nssa_translator_role_set(ospf, area_id, + OSPF_NSSA_ROLE_CANDIDATE); } ospf_area_check_free(ospf, area_id); @@ -1609,7 +1621,19 @@ int ospf_area_nssa_translator_role_set(struct ospf *ospf, if (area == NULL) return 0; - area->NSSATranslatorRole = role; + if (role != area->NSSATranslatorRole) { + if ((area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) + || (role == OSPF_NSSA_ROLE_ALWAYS)) { + /* RFC 3101 3.1 + * if new role is OSPF_NSSA_ROLE_ALWAYS we need to set + * Nt bit, if the role was OSPF_NSSA_ROLE_ALWAYS we need + * to clear Nt bit + */ + area->NSSATranslatorRole = role; + ospf_router_lsa_update_area(area); + } else + area->NSSATranslatorRole = role; + } return 1; } diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 5535cb40ab..192e542815 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -303,7 +303,7 @@ struct ospf { uint32_t rx_lsa_count; /* Counter of "ip ospf area x.x.x.x" used - * for multual exclusion of network command under + * for mutual exclusion of network command under * router ospf or ip ospf area x under interface. */ uint32_t if_ospf_cli_count; @@ -355,6 +355,22 @@ struct ospf { /* last HELPER exit reason */ uint32_t last_exit_reason; + /* delay timer to process external routes + * with summary address. + */ + struct thread *t_external_aggr; + + /* delay interval in seconds */ + unsigned int aggr_delay_interval; + + /* Table of configured Aggregate addresses */ + struct route_table *rt_aggr_tbl; + + /* used as argument for aggr delay + * timer thread. + */ + int aggr_action; + /* MPLS LDP-IGP Sync */ struct ldp_sync_info_cmd ldp_sync_cmd; @@ -608,8 +624,6 @@ extern void ospf_area_del_if(struct ospf_area *, struct ospf_interface *); extern void ospf_interface_area_set(struct ospf *, struct interface *); extern void ospf_interface_area_unset(struct ospf *, struct interface *); -extern bool ospf_interface_area_is_already_set(struct ospf *ospf, - struct interface *ifp); extern void ospf_route_map_init(void); diff --git a/pbrd/pbr_main.c b/pbrd/pbr_main.c index 9a9edd79c6..01c52f24e5 100644 --- a/pbrd/pbr_main.c +++ b/pbrd/pbr_main.c @@ -82,6 +82,8 @@ static void sigint(void) { zlog_notice("Terminating on signal"); + pbr_vrf_terminate(); + frr_fini(); exit(0); diff --git a/pbrd/pbr_vrf.c b/pbrd/pbr_vrf.c index 389e5e8be0..3284607406 100644 --- a/pbrd/pbr_vrf.c +++ b/pbrd/pbr_vrf.c @@ -26,6 +26,7 @@ #include "pbr_map.h" #include "pbr_debug.h" #include "pbr_nht.h" +#include "pbr_zebra.h" DEFINE_MTYPE_STATIC(PBRD, PBR_MAP_VRF, "PBR Map VRF") @@ -137,3 +138,14 @@ void pbr_vrf_init(void) vrf_init(pbr_vrf_new, pbr_vrf_enable, pbr_vrf_disable, pbr_vrf_delete, NULL); } + +void pbr_vrf_terminate(void) +{ + struct vrf *vrf; + struct interface *ifp; + + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { + FOR_ALL_INTERFACES (vrf, ifp) + pbr_if_del(ifp); + } +} diff --git a/pbrd/pbr_vrf.h b/pbrd/pbr_vrf.h index c9448762eb..5953387de2 100644 --- a/pbrd/pbr_vrf.h +++ b/pbrd/pbr_vrf.h @@ -40,4 +40,5 @@ extern bool pbr_vrf_is_valid(const struct pbr_vrf *pbr_vrf); extern bool pbr_vrf_is_enabled(const struct pbr_vrf *pbr_vrf); extern void pbr_vrf_init(void); +extern void pbr_vrf_terminate(void); #endif diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index eb51516c24..26163dcc56 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -907,16 +907,22 @@ DEFPY (show_pbr_interface, if (j) this_iface = json_object_new_object(); - if (!ifp->info) + if (!ifp->info) { + json_object_free(this_iface); continue; + } - if (name && strcmp(ifp->name, name) != 0) + if (name && strcmp(ifp->name, name) != 0) { + json_object_free(this_iface); continue; + } pbr_ifp = ifp->info; - if (strcmp(pbr_ifp->mapname, "") == 0) + if (strcmp(pbr_ifp->mapname, "") == 0) { + json_object_free(this_iface); continue; + } pbrm = pbrm_find(pbr_ifp->mapname); diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 697c65ca45..222a10e751 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -59,6 +59,11 @@ struct pbr_interface *pbr_if_new(struct interface *ifp) return pbr_ifp; } +void pbr_if_del(struct interface *ifp) +{ + XFREE(MTYPE_PBR_INTERFACE, ifp->info); +} + /* Inteface addition message from zebra. */ int pbr_ifp_create(struct interface *ifp) { @@ -162,7 +167,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) enum zapi_route_notify_owner note; uint32_t table_id; - if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e)) + if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, + NULL, NULL)) return -1; switch (note) { @@ -470,8 +476,8 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg) break; } - if (zclient_send_rnh(zclient, command, &p, - false, nhop->vrf_id) < 0) { + if (zclient_send_rnh(zclient, command, &p, false, nhop->vrf_id) + == ZCLIENT_SEND_FAILURE) { zlog_warn("%s: Failure to send nexthop to zebra", __func__); } } diff --git a/pbrd/pbr_zebra.h b/pbrd/pbr_zebra.h index e8f9bff5d9..d0f9ff910c 100644 --- a/pbrd/pbr_zebra.h +++ b/pbrd/pbr_zebra.h @@ -46,4 +46,7 @@ extern int pbr_ifp_up(struct interface *ifp); extern int pbr_ifp_down(struct interface *ifp); extern int pbr_ifp_destroy(struct interface *ifp); +/* Free the ifp->info pointer */ +extern void pbr_if_del(struct interface *ifp); + #endif diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 2a7ff4e7f8..4d7ecbc6de 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -64,6 +64,9 @@ #include "pim_mlag.h" #include "bfd.h" #include "pim_bsm.h" +#include "lib/northbound_cli.h" +#include "pim_errors.h" +#include "pim_nb.h" #ifndef VTYSH_EXTRACT_PL #include "pimd/pim_cmd_clippy.c" @@ -101,94 +104,6 @@ static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[], return vrf; } -static void pim_if_membership_clear(struct interface *ifp) -{ - struct pim_interface *pim_ifp; - - pim_ifp = ifp->info; - zassert(pim_ifp); - - if (PIM_IF_TEST_PIM(pim_ifp->options) - && PIM_IF_TEST_IGMP(pim_ifp->options)) { - return; - } - - pim_ifchannel_membership_clear(ifp); -} - -/* - When PIM is disabled on interface, IGMPv3 local membership - information is not injected into PIM interface state. - - The function pim_if_membership_refresh() fetches all IGMPv3 local - membership information into PIM. It is intented to be called - whenever PIM is enabled on the interface in order to collect missed - local membership information. - */ -static void pim_if_membership_refresh(struct interface *ifp) -{ - struct pim_interface *pim_ifp; - struct listnode *sock_node; - struct igmp_sock *igmp; - - pim_ifp = ifp->info; - zassert(pim_ifp); - - if (!PIM_IF_TEST_PIM(pim_ifp->options)) - return; - if (!PIM_IF_TEST_IGMP(pim_ifp->options)) - return; - - /* - First clear off membership from all PIM (S,G) entries on the - interface - */ - - pim_ifchannel_membership_clear(ifp); - - /* - Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on - the interface - */ - - /* scan igmp sockets */ - for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { - struct listnode *grpnode; - struct igmp_group *grp; - - /* scan igmp groups */ - for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list, grpnode, - grp)) { - struct listnode *srcnode; - struct igmp_source *src; - - /* scan group sources */ - for (ALL_LIST_ELEMENTS_RO(grp->group_source_list, - srcnode, src)) { - - if (IGMP_SOURCE_TEST_FORWARDING( - src->source_flags)) { - struct prefix_sg sg; - - memset(&sg, 0, - sizeof(struct prefix_sg)); - sg.src = src->source_addr; - sg.grp = grp->group_addr; - pim_ifchannel_local_membership_add(ifp, - &sg, false /*is_vxlan*/); - } - - } /* scan group sources */ - } /* scan igmp groups */ - } /* scan igmp sockets */ - - /* - Finally delete every PIM (S,G) entry lacking all state info - */ - - pim_ifchannel_delete_on_noinfo(ifp); -} - static void pim_show_assert_helper(struct vty *vty, struct pim_interface *pim_ifp, struct pim_ifchannel *ch, time_t now) @@ -261,7 +176,7 @@ static void pim_show_assert_internal_helper(struct vty *vty, PIM_IF_FLAG_TEST_COULD_ASSERT(ch->flags) ? "yes" : "no", pim_macro_ch_could_assert_eval(ch) ? "yes" : "no", PIM_IF_FLAG_TEST_ASSERT_TRACKING_DESIRED(ch->flags) ? "yes" - : "no", + : "no", pim_macro_assert_tracking_desired_eval(ch) ? "yes" : "no"); } @@ -455,8 +370,8 @@ static void pim_show_membership_helper(struct vty *vty, json_object_string_add(json_row, "group", ch_grp_str); json_object_string_add(json_row, "localMembership", ch->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO - ? "NOINFO" - : "INCLUDE"); + ? "NOINFO" + : "INCLUDE"); json_object_object_add(json_iface, ch_grp_str, json_row); } static void pim_show_membership(struct pim_instance *pim, struct vty *vty, @@ -483,7 +398,7 @@ static void pim_show_membership(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); } else { vty_out(vty, "Interface Address Source Group Membership\n"); @@ -642,14 +557,14 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, "%-16s %5s %15s %d %7s %11s %8s\n", ifp->name, if_is_up(ifp) - ? (igmp->mtrace_only ? "mtrc" - : "up") - : "down", + ? (igmp->mtrace_only ? "mtrc" + : "up") + : "down", inet_ntop(AF_INET, &igmp->ifaddr, buf, sizeof(buf)), pim_ifp->igmp_version, igmp->t_igmp_query_timer ? "local" - : "other", + : "other", query_hhmmss, uptime); } } @@ -657,7 +572,7 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -738,7 +653,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, * 100; qri_msec = pim_ifp->igmp_query_max_response_time_dsec - * 100; + * 100; if (pim_ifp->pim_sock_fd >= 0) mloop = pim_socket_mcastloop_get( pim_ifp->pim_sock_fd); @@ -753,8 +668,8 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, uptime); json_object_string_add(json_row, "querier", igmp->t_igmp_query_timer - ? "local" - : "other"); + ? "local" + : "other"); json_object_int_add(json_row, "queryStartCount", igmp->startup_query_count); json_object_string_add(json_row, @@ -807,10 +722,10 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, } else { vty_out(vty, "Interface : %s\n", ifp->name); vty_out(vty, "State : %s\n", - if_is_up(ifp) - ? (igmp->mtrace_only ? "mtrace" - : "up") - : "down"); + if_is_up(ifp) ? (igmp->mtrace_only ? + "mtrace" + : "up") + : "down"); vty_out(vty, "Address : %pI4\n", &pim_ifp->primary_address); vty_out(vty, "Uptime : %s\n", uptime); @@ -823,7 +738,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, vty_out(vty, "-------\n"); vty_out(vty, "Querier : %s\n", igmp->t_igmp_query_timer ? "local" - : "other"); + : "other"); vty_out(vty, "Start Count : %d\n", igmp->startup_query_count); vty_out(vty, "Query Timer : %s\n", @@ -872,7 +787,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { if (!found_ifname) @@ -1245,7 +1160,7 @@ static void pim_show_interfaces_single(struct pim_instance *pim, if (strcmp(ifp->name, up->rpf.source_nexthop - .interface->name) + .interface->name) != 0) continue; @@ -1327,7 +1242,7 @@ static void pim_show_interfaces_single(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { if (!found_ifname) @@ -1386,7 +1301,7 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty, json_object_object_add(json, ifname ? ifname : "global", json_row); vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { vty_out(vty, "IGMP RX statistics\n"); @@ -1459,7 +1374,7 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); } else { vty_out(vty, "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n"); @@ -1561,11 +1476,11 @@ static void pim_show_interface_traffic(struct pim_instance *pim, json_object_int_add(json_row, "assertRx", pim_ifp->pim_ifstat_assert_recv); json_object_int_add(json_row, "assertTx", - pim_ifp->pim_ifstat_assert_send); + pim_ifp->pim_ifstat_assert_send); json_object_int_add(json_row, "bsmRx", - pim_ifp->pim_ifstat_bsm_rx); + pim_ifp->pim_ifstat_bsm_rx); json_object_int_add(json_row, "bsmTx", - pim_ifp->pim_ifstat_bsm_tx); + pim_ifp->pim_ifstat_bsm_tx); json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, @@ -1588,7 +1503,7 @@ static void pim_show_interface_traffic(struct pim_instance *pim, } if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -1681,7 +1596,7 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, } if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { if (!found_ifname) @@ -1794,7 +1709,7 @@ static void pim_show_join(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -1997,7 +1912,7 @@ static void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { { @@ -2041,8 +1956,8 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, first_oif = 1; if ((c_oil->up && - PIM_UPSTREAM_FLAG_TEST_USE_RPT(c_oil->up->flags)) || - c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) + PIM_UPSTREAM_FLAG_TEST_USE_RPT(c_oil->up->flags)) || + c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) isRpt = true; else isRpt = false; @@ -2102,10 +2017,10 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, c_oil->installed); if (isRpt) json_object_boolean_true_add( - json_source, "isRpt"); + json_source, "isRpt"); else json_object_boolean_false_add( - json_source, "isRpt"); + json_source, "isRpt"); json_object_int_add(json_source, "RefCount", c_oil->oil_ref_count); json_object_int_add(json_source, "OilListSize", @@ -2125,8 +2040,8 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, } } else { vty_out(vty, "%-6d %-15s %-15s %-3s %-16s ", - c_oil->installed, src_str, grp_str, - isRpt ? "y" : "n", in_ifname); + c_oil->installed, src_str, grp_str, + isRpt ? "y" : "n", in_ifname); } for (oif_vif_index = 0; oif_vif_index < MAXVIFS; @@ -2173,47 +2088,47 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, out_ifname, (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_IGMP) - ? 'I' - : ' ', + ? 'I' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_PIM) - ? 'J' - : ' ', + ? 'J' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_VXLAN) - ? 'V' - : ' ', + ? 'V' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) - ? '*' - : ' ', + ? '*' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_MUTE) - ? 'M' - : ' '); + ? 'M' + : ' '); } else vty_out(vty, ", %s(%c%c%c%c%c)", out_ifname, (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_IGMP) - ? 'I' - : ' ', + ? 'I' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_PIM) - ? 'J' - : ' ', + ? 'J' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_VXLAN) - ? 'V' - : ' ', + ? 'V' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) - ? '*' - : ' ', + ? '*' + : ' ', (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_MUTE) - ? 'M' - : ' '); + ? 'M' + : ' '); } } @@ -2224,7 +2139,7 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { vty_out(vty, "\n"); @@ -2308,7 +2223,7 @@ static void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -2546,8 +2461,8 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, json_row = json_object_new_object(); json_object_pim_upstream_add(json_row, up); json_object_string_add( - json_row, "inboundInterface", - up->rpf.source_nexthop.interface + json_row, "inboundInterface", + up->rpf.source_nexthop.interface ? up->rpf.source_nexthop.interface->name : "Unknown"); @@ -2600,8 +2515,8 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, vty_out(vty, "%-16s%-15s %-15s %-11s %-8s %-9s %-9s %-9s %6d\n", up->rpf.source_nexthop.interface - ? up->rpf.source_nexthop.interface->name - : "Unknown", + ? up->rpf.source_nexthop.interface->name + : "Unknown", src_str, grp_str, state_str, uptime, join_timer, rs_timer, ka_timer, up->ref_count); } @@ -2609,16 +2524,16 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } static void pim_show_channel_helper(struct pim_instance *pim, - struct vty *vty, - struct pim_interface *pim_ifp, - struct pim_ifchannel *ch, - json_object *json, bool uj) + struct vty *vty, + struct pim_interface *pim_ifp, + struct pim_ifchannel *ch, + json_object *json, bool uj) { struct pim_upstream *up = ch->upstream; json_object *json_group = NULL; @@ -2666,15 +2581,15 @@ static void pim_show_channel_helper(struct pim_instance *pim, pim_macro_chisin_joins(ch) ? "yes" : "no", pim_macro_chisin_pim_include(ch) ? "yes" : "no", PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up->flags) - ? "yes" - : "no", + ? "yes" + : "no", pim_upstream_evaluate_join_desired(pim, up) ? "yes" - : "no"); + : "no"); } } static void pim_show_channel(struct pim_instance *pim, struct vty *vty, - bool uj) + bool uj) { struct pim_interface *pim_ifp; struct pim_ifchannel *ch; @@ -2698,13 +2613,13 @@ static void pim_show_channel(struct pim_instance *pim, struct vty *vty, RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) { /* scan all interfaces */ pim_show_channel_helper(pim, vty, pim_ifp, ch, - json, uj); + json, uj); } } if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -2745,7 +2660,7 @@ static void pim_show_join_desired_helper(struct pim_instance *pim, vty_out(vty, "%-15s %-15s %-6s\n", src_str, grp_str, pim_upstream_evaluate_join_desired(pim, up) ? "yes" - : "no"); + : "no"); } } @@ -2765,12 +2680,12 @@ static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, frr_each (rb_pim_upstream, &pim->upstream_head, up) { /* scan all interfaces */ pim_show_join_desired_helper(pim, vty, up, - json, uj); + json, uj); } if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -2838,7 +2753,7 @@ static void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -2981,7 +2896,7 @@ static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, bool uj) if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3183,7 +3098,7 @@ static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj) if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3333,7 +3248,7 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3408,7 +3323,7 @@ static void pim_show_statistics(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3507,9 +3422,9 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) json_groups = json_object_new_array(); json_object_object_add( - json_iface, - "groups", - json_groups); + json_iface, + "groups", + json_groups); } json_group = json_object_new_object(); @@ -3524,20 +3439,20 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) json_object_string_add( json_group, "mode", grp->group_filtermode_isexcl - ? "EXCLUDE" - : "INCLUDE"); + ? "EXCLUDE" + : "INCLUDE"); json_object_string_add(json_group, "timer", hhmmss); json_object_int_add( json_group, "sourcesCount", grp->group_source_list - ? listcount( - grp->group_source_list) - : 0); + ? listcount( + grp->group_source_list) + : 0); json_object_int_add( - json_group, "version", - grp->igmp_version); + json_group, "version", + grp->igmp_version); json_object_string_add( json_group, "uptime", uptime); json_object_array_add(json_groups, @@ -3548,15 +3463,15 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) ifp->name, ifaddr_str, group_str, grp->igmp_version == 3 - ? (grp->group_filtermode_isexcl - ? "EXCL" - : "INCL") - : "----", + ? (grp->group_filtermode_isexcl + ? "EXCL" + : "INCL") + : "----", hhmmss, grp->group_source_list - ? listcount( - grp->group_source_list) - : 0, + ? listcount( + grp->group_source_list) + : 0, grp->igmp_version, uptime); } } /* scan igmp groups */ @@ -3565,7 +3480,7 @@ static void igmp_show_groups(struct pim_instance *pim, struct vty *vty, bool uj) if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3700,8 +3615,8 @@ static void igmp_show_sources(struct pim_instance *pim, struct vty *vty) group_str, source_str, mmss, IGMP_SOURCE_TEST_FORWARDING( src->source_flags) - ? "Y" - : "N", + ? "Y" + : "N", uptime); } /* scan group sources */ @@ -3839,7 +3754,7 @@ static void pim_show_bsr(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -3872,12 +3787,12 @@ static void clear_interfaces(struct pim_instance *pim) clear_pim_interfaces(pim); } -#define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \ - pim_ifp = ifp->info; \ - if (!pim_ifp) { \ - vty_out(vty, \ +#define PIM_GET_PIM_INTERFACE(pim_ifp, ifp) \ + pim_ifp = ifp->info; \ + if (!pim_ifp) { \ + vty_out(vty, \ "%% Enable PIM and/or IGMP on this interface first\n"); \ - return CMD_WARNING_CONFIG_FAILED; \ + return CMD_WARNING_CONFIG_FAILED; \ } DEFUN (clear_ip_interfaces, @@ -3963,7 +3878,7 @@ static void clear_mroute(struct pim_instance *pim) /* clean up all igmp groups */ /* scan igmp sockets */ for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, - igmp)) { + igmp)) { struct igmp_group *grp; @@ -3979,9 +3894,9 @@ static void clear_mroute(struct pim_instance *pim) } /* clean up all upstreams*/ - while ((up = rb_pim_upstream_first(&pim->upstream_head))) { + while ((up = rb_pim_upstream_first(&pim->upstream_head))) pim_upstream_del(pim, up, __func__); - } + } DEFUN (clear_ip_mroute, @@ -4374,83 +4289,83 @@ DEFUN (show_ip_pim_mlag_summary, if (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP) json_object_boolean_true_add(json, "mlagPeerZebraUp"); json_object_string_add(json, "mlagRole", - mlag_role2str(router->mlag_role, - role_buf, sizeof(role_buf))); + mlag_role2str(router->mlag_role, + role_buf, sizeof(role_buf))); inet_ntop(AF_INET, &router->local_vtep_ip, - addr_buf, INET_ADDRSTRLEN); + addr_buf, INET_ADDRSTRLEN); json_object_string_add(json, "localVtepIp", addr_buf); inet_ntop(AF_INET, &router->anycast_vtep_ip, - addr_buf, INET_ADDRSTRLEN); + addr_buf, INET_ADDRSTRLEN); json_object_string_add(json, "anycastVtepIp", addr_buf); json_object_string_add(json, "peerlinkRif", - router->peerlink_rif); + router->peerlink_rif); json_stat = json_object_new_object(); json_object_int_add(json_stat, "mlagConnFlaps", - router->mlag_stats.mlagd_session_downs); + router->mlag_stats.mlagd_session_downs); json_object_int_add(json_stat, "mlagPeerConnFlaps", - router->mlag_stats.peer_session_downs); + router->mlag_stats.peer_session_downs); json_object_int_add(json_stat, "mlagPeerZebraFlaps", - router->mlag_stats.peer_zebra_downs); + router->mlag_stats.peer_zebra_downs); json_object_int_add(json_stat, "mrouteAddRx", - router->mlag_stats.msg.mroute_add_rx); + router->mlag_stats.msg.mroute_add_rx); json_object_int_add(json_stat, "mrouteAddTx", - router->mlag_stats.msg.mroute_add_tx); + router->mlag_stats.msg.mroute_add_tx); json_object_int_add(json_stat, "mrouteDelRx", - router->mlag_stats.msg.mroute_del_rx); + router->mlag_stats.msg.mroute_del_rx); json_object_int_add(json_stat, "mrouteDelTx", - router->mlag_stats.msg.mroute_del_tx); + router->mlag_stats.msg.mroute_del_tx); json_object_int_add(json_stat, "mlagStatusUpdates", - router->mlag_stats.msg.mlag_status_updates); + router->mlag_stats.msg.mlag_status_updates); json_object_int_add(json_stat, "peerZebraStatusUpdates", - router->mlag_stats.msg.peer_zebra_status_updates); + router->mlag_stats.msg.peer_zebra_status_updates); json_object_int_add(json_stat, "pimStatusUpdates", - router->mlag_stats.msg.pim_status_updates); + router->mlag_stats.msg.pim_status_updates); json_object_int_add(json_stat, "vxlanUpdates", - router->mlag_stats.msg.vxlan_updates); + router->mlag_stats.msg.vxlan_updates); json_object_object_add(json, "connStats", json_stat); vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); return CMD_SUCCESS; } vty_out(vty, "MLAG daemon connection: %s\n", (router->mlag_flags & PIM_MLAGF_LOCAL_CONN_UP) - ? "up" : "down"); + ? "up" : "down"); vty_out(vty, "MLAG peer state: %s\n", (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP) - ? "up" : "down"); + ? "up" : "down"); vty_out(vty, "Zebra peer state: %s\n", (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP) - ? "up" : "down"); + ? "up" : "down"); vty_out(vty, "MLAG role: %s\n", mlag_role2str(router->mlag_role, role_buf, sizeof(role_buf))); inet_ntop(AF_INET, &router->local_vtep_ip, - addr_buf, INET_ADDRSTRLEN); + addr_buf, INET_ADDRSTRLEN); vty_out(vty, "Local VTEP IP: %s\n", addr_buf); inet_ntop(AF_INET, &router->anycast_vtep_ip, - addr_buf, INET_ADDRSTRLEN); + addr_buf, INET_ADDRSTRLEN); vty_out(vty, "Anycast VTEP IP: %s\n", addr_buf); vty_out(vty, "Peerlink: %s\n", router->peerlink_rif); vty_out(vty, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n", - router->mlag_stats.mlagd_session_downs, - router->mlag_stats.peer_session_downs, - router->mlag_stats.peer_zebra_downs); + router->mlag_stats.mlagd_session_downs, + router->mlag_stats.peer_session_downs, + router->mlag_stats.peer_zebra_downs); vty_out(vty, "Message Statistics:\n"); vty_out(vty, " mroute adds: rx: %d, tx: %d\n", - router->mlag_stats.msg.mroute_add_rx, - router->mlag_stats.msg.mroute_add_tx); + router->mlag_stats.msg.mroute_add_rx, + router->mlag_stats.msg.mroute_add_tx); vty_out(vty, " mroute dels: rx: %d, tx: %d\n", - router->mlag_stats.msg.mroute_del_rx, - router->mlag_stats.msg.mroute_del_tx); + router->mlag_stats.msg.mroute_del_rx, + router->mlag_stats.msg.mroute_del_tx); vty_out(vty, " peer zebra status updates: %d\n", - router->mlag_stats.msg.peer_zebra_status_updates); + router->mlag_stats.msg.peer_zebra_status_updates); vty_out(vty, " PIM status updates: %d\n", - router->mlag_stats.msg.pim_status_updates); + router->mlag_stats.msg.pim_status_updates); vty_out(vty, " VxLAN updates: %d\n", - router->mlag_stats.msg.vxlan_updates); + router->mlag_stats.msg.vxlan_updates); return CMD_SUCCESS; } @@ -4692,10 +4607,10 @@ DEFUN (show_ip_pim_join_vrf_all, } static void pim_show_jp_agg_helper(struct vty *vty, - struct interface *ifp, - struct pim_neighbor *neigh, - struct pim_upstream *up, - int is_join) + struct interface *ifp, + struct pim_neighbor *neigh, + struct pim_upstream *up, + int is_join) { char src_str[INET_ADDRSTRLEN]; char grp_str[INET_ADDRSTRLEN]; @@ -4703,12 +4618,12 @@ static void pim_show_jp_agg_helper(struct vty *vty, pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str)); pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str)); - /* pius->address.s_addr */ + /* pius->address.s_addr */ pim_inet4_dump("<rpf?>", neigh->source_addr, rpf_str, sizeof(rpf_str)); vty_out(vty, "%-16s %-15s %-15s %-15s %5s\n", - ifp->name, rpf_str, src_str, - grp_str, is_join?"J":"P"); + ifp->name, rpf_str, src_str, + grp_str, is_join?"J":"P"); } static void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty) @@ -4723,7 +4638,7 @@ static void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty) struct pim_jp_sources *js; vty_out(vty, - "Interface RPF Nbr Source Group State\n"); + "Interface RPF Nbr Source Group State\n"); FOR_ALL_INTERFACES (pim->vrf, ifp) { pim_ifp = ifp->info; @@ -4731,14 +4646,14 @@ static void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty) continue; for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, - n_node, neigh)) { + n_node, neigh)) { for (ALL_LIST_ELEMENTS_RO(neigh->upstream_jp_agg, - jag_node, jag)) { + jag_node, jag)) { for (ALL_LIST_ELEMENTS_RO(jag->sources, - js_node, js)) { + js_node, js)) { pim_show_jp_agg_helper(vty, - ifp, neigh, js->up, - js->is_join); + ifp, neigh, js->up, + js->is_join); } } } @@ -4798,8 +4713,10 @@ DEFUN (show_ip_pim_local_membership, } static void pim_show_mlag_up_entry_detail(struct vrf *vrf, - struct vty *vty, struct pim_upstream *up, - char *src_str, char *grp_str, json_object *json) + struct vty *vty, + struct pim_upstream *up, + char *src_str, char *grp_str, + json_object *json) { if (json) { json_object *json_row = NULL; @@ -4811,7 +4728,7 @@ static void pim_show_mlag_up_entry_detail(struct vrf *vrf, if (!json_group) { json_group = json_object_new_object(); json_object_object_add(json, grp_str, - json_group); + json_group); } json_row = json_object_new_object(); @@ -4821,19 +4738,19 @@ static void pim_show_mlag_up_entry_detail(struct vrf *vrf, own_list = json_object_new_array(); if (pim_up_mlag_is_local(up)) json_object_array_add(own_list, - json_object_new_string("local")); + json_object_new_string("local")); if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)) json_object_array_add(own_list, - json_object_new_string("peer")); + json_object_new_string("peer")); if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)) json_object_array_add( own_list, json_object_new_string("Interface")); json_object_object_add(json_row, "owners", own_list); json_object_int_add(json_row, "localCost", - pim_up_mlag_local_cost(up)); + pim_up_mlag_local_cost(up)); json_object_int_add(json_row, "peerCost", - pim_up_mlag_peer_cost(up)); + pim_up_mlag_peer_cost(up)); if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags)) json_object_boolean_false_add(json_row, "df"); else @@ -4851,18 +4768,18 @@ static void pim_show_mlag_up_entry_detail(struct vrf *vrf, strlcat(own_str, "I", sizeof(own_str)); /* XXX - fixup, print paragraph output */ vty_out(vty, - "%-15s %-15s %-6s %-11u %-10d %2s\n", - src_str, grp_str, own_str, - pim_up_mlag_local_cost(up), - pim_up_mlag_peer_cost(up), - PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags) - ? "n" : "y"); + "%-15s %-15s %-6s %-11u %-10d %2s\n", + src_str, grp_str, own_str, + pim_up_mlag_local_cost(up), + pim_up_mlag_peer_cost(up), + PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags) + ? "n" : "y"); } } static void pim_show_mlag_up_detail(struct vrf *vrf, - struct vty *vty, const char *src_or_group, - const char *group, bool uj) + struct vty *vty, const char *src_or_group, + const char *group, bool uj) { char src_str[INET_ADDRSTRLEN]; char grp_str[INET_ADDRSTRLEN]; @@ -4938,7 +4855,7 @@ static void pim_show_mlag_up_vrf(struct vrf *vrf, struct vty *vty, bool uj) if (!json_group) { json_group = json_object_new_object(); json_object_object_add(json, grp_str, - json_group); + json_group); } json_row = json_object_new_object(); @@ -4950,18 +4867,20 @@ static void pim_show_mlag_up_vrf(struct vrf *vrf, struct vty *vty, bool uj) if (pim_up_mlag_is_local(up)) { json_object_array_add(own_list, - json_object_new_string("local")); + json_object_new_string( + "local")); } if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)) { json_object_array_add(own_list, - json_object_new_string("peer")); + json_object_new_string( + "peer")); } json_object_object_add(json_row, "owners", own_list); json_object_int_add(json_row, "localCost", - pim_up_mlag_local_cost(up)); + pim_up_mlag_local_cost(up)); json_object_int_add(json_row, "peerCost", - pim_up_mlag_peer_cost(up)); + pim_up_mlag_peer_cost(up)); if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags)) json_object_boolean_false_add(json_row, "df"); else @@ -4983,12 +4902,12 @@ static void pim_show_mlag_up_vrf(struct vrf *vrf, struct vty *vty, bool uj) pim_up_mlag_local_cost(up), pim_up_mlag_peer_cost(up), PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags) - ? "n" : "y"); + ? "n" : "y"); } } if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -6042,12 +5961,12 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, /* do not display muted OIFs */ if (c_oil->oif_flags[oif_vif_index] - & PIM_OIF_FLAG_MUTE) + & PIM_OIF_FLAG_MUTE) continue; if (c_oil->oil.mfcc_parent == oif_vif_index && - !pim_mroute_allow_iif_in_oil(c_oil, - oif_vif_index)) + !pim_mroute_allow_iif_in_oil(c_oil, + oif_vif_index)) continue; ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index); @@ -6109,6 +6028,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, json_object_object_add(json_oil, out_ifname, json_ifp_out); } else { + proto[0] = '\0'; if (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_PIM) { strlcpy(proto, "PIM", sizeof(proto)); @@ -6215,8 +6135,8 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, pim_time_uptime( oif_uptime, sizeof(oif_uptime), now - - s_route->c_oil - .oif_creation[oif_vif_index]); + - s_route->c_oil + .oif_creation[oif_vif_index]); found_oif = 1; if (ifp_out) @@ -6278,7 +6198,7 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -6609,8 +6529,8 @@ static void show_mroute_summary(struct pim_instance *pim, struct vty *vty, starg_hw_mroute_cnt + sg_hw_mroute_cnt); json_object_int_add(json, "totalNumOfMroutes", starg_sw_mroute_cnt + starg_hw_mroute_cnt - + sg_sw_mroute_cnt - + sg_hw_mroute_cnt); + + sg_sw_mroute_cnt + + sg_hw_mroute_cnt); } } @@ -6796,83 +6716,6 @@ DEFUN (show_ip_ssmpingd, return CMD_SUCCESS; } -static int pim_rp_cmd_worker(struct pim_instance *pim, struct vty *vty, - const char *rp, const char *group, - const char *plist) -{ - int result; - - result = pim_rp_new_config(pim, rp, group, plist); - - if (result == PIM_GROUP_BAD_ADDR_MASK_COMBO) { - vty_out(vty, "%% Inconsistent address and mask: %s\n", - group ? group : "No Group Address"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (result == PIM_GROUP_BAD_ADDRESS) { - vty_out(vty, "%% Bad group address specified: %s\n", - group ? group : "No Group Address"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (result == PIM_RP_BAD_ADDRESS) { - vty_out(vty, "%% Bad RP address specified: %s\n", rp); - return CMD_WARNING_CONFIG_FAILED; - } - - if (result == PIM_RP_NO_PATH) { - vty_out(vty, "%% No Path to RP address specified: %s\n", rp); - return CMD_WARNING; - } - - if (result == PIM_GROUP_OVERLAP) { - vty_out(vty, - "%% Group range specified cannot exact match another\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (result == PIM_GROUP_PFXLIST_OVERLAP) { - vty_out(vty, - "%% This group is already covered by a RP prefix-list\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - if (result == PIM_RP_PFXLIST_IN_USE) { - vty_out(vty, - "%% The same prefix-list cannot be applied to multiple RPs\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - return CMD_SUCCESS; -} - -static int pim_cmd_spt_switchover(struct pim_instance *pim, - enum pim_spt_switchover spt, - const char *plist) -{ - pim->spt.switchover = spt; - - switch (pim->spt.switchover) { - case PIM_SPT_IMMEDIATE: - XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist); - - pim_upstream_add_lhr_star_pimreg(pim); - break; - case PIM_SPT_INFINITY: - pim_upstream_remove_lhr_star_pimreg(pim, plist); - - XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist); - - if (plist) - pim->spt.plist = - XSTRDUP(MTYPE_PIM_PLIST_NAME, plist); - break; - } - - return CMD_SUCCESS; -} - DEFUN (ip_pim_spt_switchover_infinity, ip_pim_spt_switchover_infinity_cmd, "ip pim spt-switchover infinity-and-beyond", @@ -6881,8 +6724,45 @@ DEFUN (ip_pim_spt_switchover_infinity, "SPT-Switchover\n" "Never switch to SPT Tree\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_cmd_spt_switchover(pim, PIM_SPT_INFINITY, NULL); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char spt_plist_xpath[XPATH_MAXLEN]; + char spt_action_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(spt_plist_xpath, sizeof(spt_plist_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list", + sizeof(spt_plist_xpath)); + + snprintf(spt_action_xpath, sizeof(spt_action_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_action_xpath, "/spt-switchover/spt-action", + sizeof(spt_action_xpath)); + + if (yang_dnode_exists(vty->candidate_config->dnode, spt_plist_xpath)) + nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, + NULL); + nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY, + "PIM_SPT_INFINITY"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_spt_switchover_infinity_plist, @@ -6895,8 +6775,44 @@ DEFUN (ip_pim_spt_switchover_infinity_plist, "Prefix-List to control which groups to switch\n" "Prefix-List name\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_cmd_spt_switchover(pim, PIM_SPT_INFINITY, argv[5]->arg); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char spt_plist_xpath[XPATH_MAXLEN]; + char spt_action_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(spt_plist_xpath, sizeof(spt_plist_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list", + sizeof(spt_plist_xpath)); + + snprintf(spt_action_xpath, sizeof(spt_action_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_action_xpath, "/spt-switchover/spt-action", + sizeof(spt_action_xpath)); + + nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY, + "PIM_SPT_INFINITY"); + nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_MODIFY, + argv[5]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_spt_switchover_infinity, @@ -6908,8 +6824,43 @@ DEFUN (no_ip_pim_spt_switchover_infinity, "SPT_Switchover\n" "Never switch to SPT Tree\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_cmd_spt_switchover(pim, PIM_SPT_IMMEDIATE, NULL); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char spt_plist_xpath[XPATH_MAXLEN]; + char spt_action_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(spt_plist_xpath, sizeof(spt_plist_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list", + sizeof(spt_plist_xpath)); + + snprintf(spt_action_xpath, sizeof(spt_action_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_action_xpath, "/spt-switchover/spt-action", + sizeof(spt_action_xpath)); + + nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY, + "PIM_SPT_IMMEDIATE"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_spt_switchover_infinity_plist, @@ -6923,8 +6874,43 @@ DEFUN (no_ip_pim_spt_switchover_infinity_plist, "Prefix-List to control which groups to switch\n" "Prefix-List name\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_cmd_spt_switchover(pim, PIM_SPT_IMMEDIATE, NULL); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char spt_plist_xpath[XPATH_MAXLEN]; + char spt_action_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(spt_plist_xpath, sizeof(spt_plist_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_plist_xpath, "/spt-switchover/spt-infinity-prefix-list", + sizeof(spt_plist_xpath)); + + snprintf(spt_action_xpath, sizeof(spt_action_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(spt_action_xpath, "/spt-switchover/spt-action", + sizeof(spt_action_xpath)); + + nb_cli_enqueue_change(vty, spt_plist_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, spt_action_xpath, NB_OP_MODIFY, + "PIM_SPT_IMMEDIATE"); + + return nb_cli_apply_changes(vty, NULL); } DEFPY (pim_register_accept_list, @@ -6936,15 +6922,37 @@ DEFPY (pim_register_accept_list, "Only accept registers from a specific source prefix list\n" "Prefix-List name\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char reg_alist_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(reg_alist_xpath, sizeof(reg_alist_xpath), + FRR_PIM_AF_XPATH, "frr-pim:pimd", "pim", vrfname, + "frr-routing:ipv4"); + strlcat(reg_alist_xpath, "/register-accept-list", + sizeof(reg_alist_xpath)); if (no) - XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist); - else { - XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist); - pim->register_plist = XSTRDUP(MTYPE_PIM_PLIST_NAME, word); - } - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, reg_alist_xpath, + NB_OP_DESTROY, NULL); + else + nb_cli_enqueue_change(vty, reg_alist_xpath, + NB_OP_MODIFY, word); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_joinprune_time, @@ -6955,9 +6963,10 @@ DEFUN (ip_pim_joinprune_time, "Join Prune Send Interval\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->t_periodic = atoi(argv[3]->arg); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "/frr-pim:pim/join-prune-interval", + NB_OP_MODIFY, argv[3]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_joinprune_time, @@ -6969,9 +6978,15 @@ DEFUN (no_ip_pim_joinprune_time, "Join Prune Send Interval\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->t_periodic = PIM_DEFAULT_T_PERIODIC; - return CMD_SUCCESS; + char jp_default_timer[5]; + + snprintf(jp_default_timer, sizeof(jp_default_timer), "%d", + PIM_DEFAULT_T_PERIODIC); + + nb_cli_enqueue_change(vty, "/frr-pim:pim/join-prune-interval", + NB_OP_MODIFY, jp_default_timer); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_register_suppress, @@ -6982,9 +6997,10 @@ DEFUN (ip_pim_register_suppress, "Register Suppress Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->register_suppress_time = atoi(argv[3]->arg); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "/frr-pim:pim/register-suppress-time", + NB_OP_MODIFY, argv[3]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_register_suppress, @@ -6996,9 +7012,15 @@ DEFUN (no_ip_pim_register_suppress, "Register Suppress Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->register_suppress_time = PIM_REGISTER_SUPPRESSION_TIME_DEFAULT; - return CMD_SUCCESS; + char rs_default_timer[5]; + + snprintf(rs_default_timer, sizeof(rs_default_timer), "%d", + PIM_REGISTER_SUPPRESSION_TIME_DEFAULT); + + nb_cli_enqueue_change(vty, "/frr-pim:pim/register-suppress-time", + NB_OP_MODIFY, rs_default_timer); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_rp_keep_alive, @@ -7010,9 +7032,32 @@ DEFUN (ip_pim_rp_keep_alive, "Keep alive Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->rp_keep_alive_time = atoi(argv[4]->arg); - return CMD_SUCCESS; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char rp_ka_timer_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath), + FRR_PIM_XPATH, "frr-pim:pimd", "pim", vrfname); + strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer", + sizeof(rp_ka_timer_xpath)); + + nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY, + argv[4]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_rp_keep_alive, @@ -7025,9 +7070,36 @@ DEFUN (no_ip_pim_rp_keep_alive, "Keep alive Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->rp_keep_alive_time = PIM_KEEPALIVE_PERIOD; - return CMD_SUCCESS; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char rp_ka_timer[5]; + char rp_ka_timer_xpath[XPATH_MAXLEN]; + + snprintf(rp_ka_timer, sizeof(rp_ka_timer), "%d", PIM_KEEPALIVE_PERIOD); + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + + snprintf(rp_ka_timer_xpath, sizeof(rp_ka_timer_xpath), + FRR_PIM_XPATH, "frr-pim:pimd", "pim", vrfname); + strlcat(rp_ka_timer_xpath, "/rp-keep-alive-timer", + sizeof(rp_ka_timer_xpath)); + + nb_cli_enqueue_change(vty, rp_ka_timer_xpath, NB_OP_MODIFY, + rp_ka_timer); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_keep_alive, @@ -7038,9 +7110,31 @@ DEFUN (ip_pim_keep_alive, "Keep alive Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->keep_alive_time = atoi(argv[3]->arg); - return CMD_SUCCESS; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ka_timer_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath)); + + nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_MODIFY, + argv[3]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_keep_alive, @@ -7052,9 +7146,34 @@ DEFUN (no_ip_pim_keep_alive, "Keep alive Timer\n" "Seconds\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->keep_alive_time = PIM_KEEPALIVE_PERIOD; - return CMD_SUCCESS; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ka_timer[5]; + char ka_timer_xpath[XPATH_MAXLEN]; + + snprintf(ka_timer, sizeof(ka_timer), "%d", PIM_KEEPALIVE_PERIOD); + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ka_timer_xpath, sizeof(ka_timer_xpath), FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ka_timer_xpath, "/keep-alive-timer", sizeof(ka_timer_xpath)); + + nb_cli_enqueue_change(vty, ka_timer_xpath, NB_OP_MODIFY, + ka_timer); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_packets, @@ -7065,9 +7184,10 @@ DEFUN (ip_pim_packets, "packets to process at one time per fd\n" "Number of packets\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->packet_process = atoi(argv[3]->arg); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "/frr-pim:pim/packets", NB_OP_MODIFY, + argv[3]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_packets, @@ -7079,9 +7199,15 @@ DEFUN (no_ip_pim_packets, "packets to process at one time per fd\n" "Number of packets\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - router->packet_process = PIM_DEFAULT_PACKET_PROCESS; - return CMD_SUCCESS; + char default_packet[3]; + + snprintf(default_packet, sizeof(default_packet), "%d", + PIM_DEFAULT_PACKET_PROCESS); + + nb_cli_enqueue_change(vty, "/frr-pim:pim/packets", NB_OP_MODIFY, + default_packet); + + return nb_cli_apply_changes(vty, NULL); } DEFPY (igmp_group_watermark, @@ -7120,10 +7246,33 @@ DEFUN (ip_pim_v6_secondary, "pim multicast routing\n" "Send v6 secondary addresses\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->send_v6_secondary = 1; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char send_v6_secondary_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(send_v6_secondary_xpath, sizeof(send_v6_secondary_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(send_v6_secondary_xpath, "/send-v6-secondary", + sizeof(send_v6_secondary_xpath)); + + nb_cli_enqueue_change(vty, send_v6_secondary_xpath, NB_OP_MODIFY, + "true"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_v6_secondary, @@ -7134,10 +7283,33 @@ DEFUN (no_ip_pim_v6_secondary, "pim multicast routing\n" "Send v6 secondary addresses\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->send_v6_secondary = 0; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char send_v6_secondary_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(send_v6_secondary_xpath, sizeof(send_v6_secondary_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(send_v6_secondary_xpath, "/send-v6-secondary", + sizeof(send_v6_secondary_xpath)); + + nb_cli_enqueue_change(vty, send_v6_secondary_xpath, NB_OP_MODIFY, + "false"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_rp, @@ -7149,15 +7321,66 @@ DEFUN (ip_pim_rp, "ip address of RP\n" "Group Address range to cover\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - int idx_ipv4 = 3; + const struct lyd_node *vrf_dnode; + const char *vrfname; + int idx_rp = 3, idx_group = 4; + char rp_group_xpath[XPATH_MAXLEN]; + int result = 0; + struct prefix group; + struct in_addr rp_addr; + const char *group_str = + (argc == 5) ? argv[idx_group]->arg : "224.0.0.0/4"; - if (argc == (idx_ipv4 + 1)) - return pim_rp_cmd_worker(pim, vty, argv[idx_ipv4]->arg, NULL, - NULL); - else - return pim_rp_cmd_worker(pim, vty, argv[idx_ipv4]->arg, - argv[idx_ipv4 + 1]->arg, NULL); + result = str2prefix(group_str, &group); + if (result) { + struct prefix temp; + + prefix_copy(&temp, &group); + apply_mask(&temp); + if (!prefix_same(&group, &temp)) { + vty_out(vty, "%% Inconsistent address and mask: %s\n", + group_str); + return CMD_WARNING_CONFIG_FAILED; + } + } + + if (!result) { + vty_out(vty, "%% Bad group address specified: %s\n", + group_str); + return CMD_WARNING_CONFIG_FAILED; + } + + result = inet_pton(AF_INET, argv[idx_rp]->arg, &rp_addr); + if (result <= 0) { + vty_out(vty, "%% Bad RP address specified: %s\n", + argv[idx_rp]->arg); + return CMD_WARNING_CONFIG_FAILED; + } + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(rp_group_xpath, sizeof(rp_group_xpath), + FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); + strlcat(rp_group_xpath, "/group-list", sizeof(rp_group_xpath)); + + nb_cli_enqueue_change(vty, rp_group_xpath, NB_OP_CREATE, group_str); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_rp_prefix_list, @@ -7170,33 +7393,36 @@ DEFUN (ip_pim_rp_prefix_list, "group prefix-list filter\n" "Name of a prefix-list\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_rp_cmd_worker(pim, vty, argv[3]->arg, NULL, argv[5]->arg); -} + int idx_rp = 3, idx_plist = 5; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char rp_plist_xpath[XPATH_MAXLEN]; -static int pim_no_rp_cmd_worker(struct pim_instance *pim, struct vty *vty, - const char *rp, const char *group, - const char *plist) -{ - int result = pim_rp_del_config(pim, rp, group, plist); + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); - if (result == PIM_GROUP_BAD_ADDRESS) { - vty_out(vty, "%% Bad group address specified: %s\n", - group ? group : "No Group Address"); - return CMD_WARNING_CONFIG_FAILED; - } + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } - if (result == PIM_RP_BAD_ADDRESS) { - vty_out(vty, "%% Bad RP address specified: %s\n", rp); - return CMD_WARNING_CONFIG_FAILED; - } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - if (result == PIM_RP_NOT_FOUND) { - vty_out(vty, "%% Unable to find specified RP\n"); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(rp_plist_xpath, sizeof(rp_plist_xpath), + FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); + strlcat(rp_plist_xpath, "/prefix-list", sizeof(rp_plist_xpath)); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, rp_plist_xpath, NB_OP_MODIFY, + argv[idx_plist]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_rp, @@ -7209,15 +7435,55 @@ DEFUN (no_ip_pim_rp, "ip address of RP\n" "Group Address range to cover\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - int idx_ipv4 = 4, idx_group = 0; + int idx_rp = 4, idx_group = 5; + const char *group_str = + (argc == 6) ? argv[idx_group]->arg : "224.0.0.0/4"; + char group_xpath[XPATH_MAXLEN]; + char temp_xpath[XPATH_MAXLEN]; + char rp_xpath[XPATH_MAXLEN]; + const struct lyd_node *vrf_dnode; + const char *vrfname; + const struct lyd_node *group_dnode; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(rp_xpath, sizeof(rp_xpath), FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); - if (argv_find(argv, argc, "A.B.C.D/M", &idx_group)) - return pim_no_rp_cmd_worker(pim, vty, argv[idx_ipv4]->arg, - argv[idx_group]->arg, NULL); + snprintf(group_xpath, sizeof(group_xpath), FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); + snprintf(temp_xpath, sizeof(temp_xpath), "/group-list[.='%s']", + group_str); + strlcat(group_xpath, temp_xpath, sizeof(group_xpath)); + + if (!yang_dnode_exists(vty->candidate_config->dnode, group_xpath)) { + vty_out(vty, "%% Unable to find specified RP\n"); + return NB_OK; + } + + group_dnode = yang_dnode_get(vty->candidate_config->dnode, group_xpath); + + if (yang_is_last_list_dnode(group_dnode)) + nb_cli_enqueue_change(vty, rp_xpath, NB_OP_DESTROY, NULL); else - return pim_no_rp_cmd_worker(pim, vty, argv[idx_ipv4]->arg, NULL, - NULL); + nb_cli_enqueue_change(vty, group_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_rp_prefix_list, @@ -7231,32 +7497,52 @@ DEFUN (no_ip_pim_rp_prefix_list, "group prefix-list filter\n" "Name of a prefix-list\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_no_rp_cmd_worker(pim, vty, argv[4]->arg, NULL, argv[6]->arg); -} + int idx_rp = 4; + int idx_plist = 6; + char rp_xpath[XPATH_MAXLEN]; + char plist_xpath[XPATH_MAXLEN]; + const struct lyd_node *vrf_dnode; + const char *vrfname; + const struct lyd_node *plist_dnode; + const char *plist; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; -static int pim_ssm_cmd_worker(struct pim_instance *pim, struct vty *vty, - const char *plist) -{ - int result = pim_ssm_range_set(pim, pim->vrf_id, plist); - int ret = CMD_WARNING_CONFIG_FAILED; + snprintf(rp_xpath, sizeof(rp_xpath), FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); - if (result == PIM_SSM_ERR_NONE) - return CMD_SUCCESS; + snprintf(plist_xpath, sizeof(plist_xpath), FRR_PIM_STATIC_RP_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4", + argv[idx_rp]->arg); + strlcat(plist_xpath, "/prefix-list", sizeof(plist_xpath)); - switch (result) { - case PIM_SSM_ERR_NO_VRF: - vty_out(vty, "%% VRF doesn't exist\n"); - break; - case PIM_SSM_ERR_DUP: - vty_out(vty, "%% duplicate config\n"); - ret = CMD_WARNING; - break; - default: - vty_out(vty, "%% ssm range config failed\n"); + plist_dnode = yang_dnode_get(vty->candidate_config->dnode, plist_xpath); + if (!plist_dnode) { + vty_out(vty, "%% Unable to find specified RP\n"); + return NB_OK; } - return ret; + plist = yang_dnode_get_string(plist_dnode, plist_xpath); + if (strcmp(argv[idx_plist]->arg, plist)) { + vty_out(vty, "%% Unable to find specified RP\n"); + return NB_OK; + } + + nb_cli_enqueue_change(vty, rp_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_ssm_prefix_list, @@ -7268,8 +7554,31 @@ DEFUN (ip_pim_ssm_prefix_list, "group range prefix-list filter\n" "Name of a prefix-list\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_ssm_cmd_worker(pim, vty, argv[4]->arg); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ssm_plist_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ssm_plist_xpath, sizeof(ssm_plist_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(ssm_plist_xpath, "/ssm-prefix-list", sizeof(ssm_plist_xpath)); + + nb_cli_enqueue_change(vty, ssm_plist_xpath, NB_OP_MODIFY, argv[4]->arg); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_ssm_prefix_list, @@ -7281,8 +7590,31 @@ DEFUN (no_ip_pim_ssm_prefix_list, "Source Specific Multicast\n" "group range prefix-list filter\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return pim_ssm_cmd_worker(pim, vty, NULL); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ssm_plist_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ssm_plist_xpath, sizeof(ssm_plist_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(ssm_plist_xpath, "/ssm-prefix-list", sizeof(ssm_plist_xpath)); + + nb_cli_enqueue_change(vty, ssm_plist_xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_ssm_prefix_list_name, @@ -7295,11 +7627,50 @@ DEFUN (no_ip_pim_ssm_prefix_list_name, "group range prefix-list filter\n" "Name of a prefix-list\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - struct pim_ssm *ssm = pim->ssm_info; + const struct lyd_node *vrf_dnode; + const char *vrfname; + const struct lyd_node *ssm_plist_dnode; + char ssm_plist_xpath[XPATH_MAXLEN]; + const char *ssm_plist_name; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + + snprintf(ssm_plist_xpath, sizeof(ssm_plist_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(ssm_plist_xpath, "/ssm-prefix-list", sizeof(ssm_plist_xpath)); + ssm_plist_dnode = yang_dnode_get(vty->candidate_config->dnode, + ssm_plist_xpath); - if (ssm->plist_name && !strcmp(ssm->plist_name, argv[5]->arg)) - return pim_ssm_cmd_worker(pim, vty, NULL); + if (!ssm_plist_dnode) { + vty_out(vty, + "%% pim ssm prefix-list %s doesn't exist\n", + argv[5]->arg); + return CMD_WARNING_CONFIG_FAILED; + } + + ssm_plist_name = yang_dnode_get_string(ssm_plist_dnode, "."); + + if (ssm_plist_name && !strcmp(ssm_plist_name, argv[5]->arg)) { + nb_cli_enqueue_change(vty, ssm_plist_xpath, NB_OP_DESTROY, + NULL); + + return nb_cli_apply_changes(vty, NULL); + } vty_out(vty, "%% pim ssm prefix-list %s doesn't exist\n", argv[5]->arg); @@ -7318,7 +7689,7 @@ static void ip_pim_ssm_show_group_range(struct pim_instance *pim, json = json_object_new_object(); json_object_string_add(json, "ssmGroups", range_str); vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else vty_out(vty, "SSM group range : %s\n", range_str); @@ -7370,7 +7741,7 @@ static void ip_pim_ssm_show_group_type(struct pim_instance *pim, json = json_object_new_object(); json_object_string_add(json, "groupType", type_str); vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else vty_out(vty, "Group type : %s\n", type_str); @@ -7428,27 +7799,35 @@ DEFUN (ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); int idx_ipv4 = 2; - int result; - struct in_addr source_addr; const char *source_str = (argc == 3) ? argv[idx_ipv4]->arg : "0.0.0.0"; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ssmpingd_ip_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - result = inet_pton(AF_INET, source_str, &source_addr); - if (result <= 0) { - vty_out(vty, "%% Bad source address %s: errno=%d: %s\n", - source_str, errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(ssmpingd_ip_xpath, sizeof(ssmpingd_ip_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(ssmpingd_ip_xpath, "/ssm-pingd-source-ip", + sizeof(ssmpingd_ip_xpath)); - result = pim_ssmpingd_start(pim, source_addr); - if (result) { - vty_out(vty, "%% Failure starting ssmpingd for source %s: %d\n", - source_str, result); - return CMD_WARNING_CONFIG_FAILED; - } + nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, NB_OP_CREATE, + source_str); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_ssmpingd, @@ -7459,27 +7838,35 @@ DEFUN (no_ip_ssmpingd, CONF_SSMPINGD_STR "Source address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); + const struct lyd_node *vrf_dnode; + const char *vrfname; int idx_ipv4 = 3; - int result; - struct in_addr source_addr; const char *source_str = (argc == 4) ? argv[idx_ipv4]->arg : "0.0.0.0"; + char ssmpingd_ip_xpath[XPATH_MAXLEN]; - result = inet_pton(AF_INET, source_str, &source_addr); - if (result <= 0) { - vty_out(vty, "%% Bad source address %s: errno=%d: %s\n", - source_str, errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - result = pim_ssmpingd_stop(pim, source_addr); - if (result) { - vty_out(vty, "%% Failure stopping ssmpingd for source %s: %d\n", - source_str, result); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(ssmpingd_ip_xpath, sizeof(ssmpingd_ip_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(ssmpingd_ip_xpath, "/ssm-pingd-source-ip", + sizeof(ssmpingd_ip_xpath)); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, ssmpingd_ip_xpath, NB_OP_DESTROY, + source_str); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_ecmp, @@ -7489,10 +7876,29 @@ DEFUN (ip_pim_ecmp, "pim multicast routing\n" "Enable PIM ECMP \n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->ecmp_enable = true; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ecmp_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ecmp_xpath, sizeof(ecmp_xpath), FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ecmp_xpath, "/ecmp", sizeof(ecmp_xpath)); + + nb_cli_enqueue_change(vty, ecmp_xpath, NB_OP_MODIFY, "true"); + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_ecmp, @@ -7503,10 +7909,30 @@ DEFUN (no_ip_pim_ecmp, "pim multicast routing\n" "Disable PIM ECMP \n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->ecmp_enable = false; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ecmp_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ecmp_xpath, sizeof(ecmp_xpath), FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ecmp_xpath, "/ecmp", sizeof(ecmp_xpath)); + + nb_cli_enqueue_change(vty, ecmp_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_pim_ecmp_rebalance, @@ -7517,11 +7943,37 @@ DEFUN (ip_pim_ecmp_rebalance, "Enable PIM ECMP \n" "Enable PIM ECMP Rebalance\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->ecmp_enable = true; - pim->ecmp_rebalance_enable = true; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ecmp_xpath[XPATH_MAXLEN]; + char ecmp_rebalance_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(ecmp_xpath, sizeof(ecmp_xpath), FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ecmp_xpath, "/ecmp", sizeof(ecmp_xpath)); + snprintf(ecmp_rebalance_xpath, sizeof(ecmp_rebalance_xpath), + FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ecmp_rebalance_xpath, "/ecmp-rebalance", + sizeof(ecmp_rebalance_xpath)); + + nb_cli_enqueue_change(vty, ecmp_xpath, NB_OP_MODIFY, "true"); + nb_cli_enqueue_change(vty, ecmp_rebalance_xpath, NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_pim_ecmp_rebalance, @@ -7533,46 +7985,32 @@ DEFUN (no_ip_pim_ecmp_rebalance, "Disable PIM ECMP \n" "Disable PIM ECMP Rebalance\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - pim->ecmp_rebalance_enable = false; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char ecmp_rebalance_xpath[XPATH_MAXLEN]; - return CMD_SUCCESS; -} - -static int pim_cmd_igmp_start(struct vty *vty, struct interface *ifp) -{ - struct pim_interface *pim_ifp; - struct pim_instance *pim; - uint8_t need_startup = 0; - - pim_ifp = ifp->info; - - if (!pim_ifp) { - pim = pim_get_pim_instance(ifp->vrf_id); - /* Limit mcast interfaces to number of vifs available */ - if (pim->mcast_if_count == MAXVIFS) { + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { vty_out(vty, - "Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s\n", - MAXVIFS, ifp->name); + "%% Failed to get vrf dnode in candidate db\n"); return CMD_WARNING_CONFIG_FAILED; } - (void)pim_if_new(ifp, true, false, false, false); - need_startup = 1; - } else { - if (!PIM_IF_TEST_IGMP(pim_ifp->options)) { - PIM_IF_DO_IGMP(pim_ifp->options); - need_startup = 1; - } - } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - /* 'ip igmp' executed multiple times, with need_startup - avoid multiple if add all and membership refresh */ - if (need_startup) { - pim_if_addr_add_all(ifp); - pim_if_membership_refresh(ifp); - } + snprintf(ecmp_rebalance_xpath, sizeof(ecmp_rebalance_xpath), + FRR_PIM_XPATH, + "frr-pim:pimd", "pim", vrfname); + strlcat(ecmp_rebalance_xpath, "/ecmp-rebalance", + sizeof(ecmp_rebalance_xpath)); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, ecmp_rebalance_xpath, NB_OP_MODIFY, "false"); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (interface_ip_igmp, @@ -7581,9 +8019,9 @@ DEFUN (interface_ip_igmp, IP_STR IFACE_IGMP_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, "true"); - return pim_cmd_igmp_start(vty, ifp); + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp, @@ -7593,23 +8031,28 @@ DEFUN (interface_no_ip_igmp, IP_STR IFACE_IGMP_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) - return CMD_SUCCESS; + const struct lyd_node *pim_enable_dnode; + char pim_if_xpath[XPATH_MAXLEN + 20]; - PIM_IF_DONT_IGMP(pim_ifp->options); + snprintf(pim_if_xpath, sizeof(pim_if_xpath), + "%s/frr-pim:pim", VTY_CURR_XPATH); - pim_if_membership_clear(ifp); - - pim_if_addr_del_all_igmp(ifp); - - if (!PIM_IF_TEST_PIM(pim_ifp->options)) { - pim_if_delete(ifp); + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/pim-enable", pim_if_xpath); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) { + nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY, + NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "false"); } - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_ip_igmp_join, @@ -7621,46 +8064,28 @@ DEFUN (interface_ip_igmp_join, "Multicast group address\n" "Source address\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - int idx_ipv4 = 3; - int idx_ipv4_2 = 4; - const char *group_str; + int idx_group = 3; + int idx_source = 4; const char *source_str; - struct in_addr group_addr; - struct in_addr source_addr; - int result; + char xpath[XPATH_MAXLEN]; - /* Group address */ - group_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, group_str, &group_addr); - if (result <= 0) { - vty_out(vty, "Bad group address %s: errno=%d: %s\n", group_str, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + if (argc == 5) { + source_str = argv[idx_source]->arg; - /* Source address */ - if (argc == (idx_ipv4_2 + 1)) { - source_str = argv[idx_ipv4_2]->arg; - result = inet_pton(AF_INET, source_str, &source_addr); - if (result <= 0) { - vty_out(vty, "Bad source address %s: errno=%d: %s\n", - source_str, errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - /* Reject 0.0.0.0. Reserved for any source. */ - if (source_addr.s_addr == INADDR_ANY) { - vty_out(vty, "Bad source address %s\n", source_str); + if (strcmp(source_str, "0.0.0.0") == 0) { + vty_out(vty, "Bad source address %s\n", + argv[idx_source]->arg); return CMD_WARNING_CONFIG_FAILED; } - } else { - source_addr.s_addr = INADDR_ANY; - } + } else + source_str = "0.0.0.0"; - CMD_FERR_RETURN(pim_if_igmp_join_add(ifp, group_addr, source_addr), - "Failure joining IGMP group: $ERR"); + snprintf(xpath, sizeof(xpath), FRR_IGMP_JOIN_XPATH, + "frr-routing:ipv4", argv[idx_group]->arg, source_str); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); + + return nb_cli_apply_changes(vty, NULL); } DEFUN (interface_no_ip_igmp_join, @@ -7673,190 +8098,30 @@ DEFUN (interface_no_ip_igmp_join, "Multicast group address\n" "Source address\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - int idx_ipv4 = 4; - int idx_ipv4_2 = 5; - const char *group_str; + int idx_group = 4; + int idx_source = 5; const char *source_str; - struct in_addr group_addr; - struct in_addr source_addr; - int result; + char xpath[XPATH_MAXLEN]; - /* Group address */ - group_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, group_str, &group_addr); - if (result <= 0) { - vty_out(vty, "Bad group address %s: errno=%d: %s\n", group_str, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + if (argc == 6) { + source_str = argv[idx_source]->arg; - /* Source address */ - if (argc == (idx_ipv4_2 + 1)) { - source_str = argv[idx_ipv4_2]->arg; - result = inet_pton(AF_INET, source_str, &source_addr); - if (result <= 0) { - vty_out(vty, "Bad source address %s: errno=%d: %s\n", - source_str, errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - /* Reject 0.0.0.0. Reserved for any source. */ - if (source_addr.s_addr == INADDR_ANY) { - vty_out(vty, "Bad source address %s\n", source_str); + if (strcmp(source_str, "0.0.0.0") == 0) { + vty_out(vty, "Bad source address %s\n", + argv[idx_source]->arg); return CMD_WARNING_CONFIG_FAILED; } - } else { - source_str = "*"; - source_addr.s_addr = INADDR_ANY; - } - - result = pim_if_igmp_join_del(ifp, group_addr, source_addr); - if (result) { - vty_out(vty, - "%% Failure leaving IGMP group %s source %s on interface %s: %d\n", - group_str, source_str, ifp->name, result); - return CMD_WARNING_CONFIG_FAILED; - } - - return CMD_SUCCESS; -} - -/* - CLI reconfiguration affects the interface level (struct pim_interface). - This function propagates the reconfiguration to every active socket - for that interface. - */ -static void igmp_sock_query_interval_reconfig(struct igmp_sock *igmp) -{ - struct interface *ifp; - struct pim_interface *pim_ifp; - - zassert(igmp); - - /* other querier present? */ - - if (igmp->t_other_querier_timer) - return; - - /* this is the querier */ - - zassert(igmp->interface); - zassert(igmp->interface->info); - - ifp = igmp->interface; - pim_ifp = ifp->info; - - if (PIM_DEBUG_IGMP_TRACE) { - char ifaddr_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<ifaddr?>", igmp->ifaddr, ifaddr_str, - sizeof(ifaddr_str)); - zlog_debug("%s: Querier %s on %s reconfig query_interval=%d", - __func__, ifaddr_str, ifp->name, - pim_ifp->igmp_default_query_interval); - } - - /* - igmp_startup_mode_on() will reset QQI: - - igmp->querier_query_interval = pim_ifp->igmp_default_query_interval; - */ - igmp_startup_mode_on(igmp); -} - -static void igmp_sock_query_reschedule(struct igmp_sock *igmp) -{ - if (igmp->mtrace_only) - return; - - if (igmp->t_igmp_query_timer) { - /* other querier present */ - zassert(igmp->t_igmp_query_timer); - zassert(!igmp->t_other_querier_timer); - - pim_igmp_general_query_off(igmp); - pim_igmp_general_query_on(igmp); - - zassert(igmp->t_igmp_query_timer); - zassert(!igmp->t_other_querier_timer); - } else { - /* this is the querier */ - - zassert(!igmp->t_igmp_query_timer); - zassert(igmp->t_other_querier_timer); - - pim_igmp_other_querier_timer_off(igmp); - pim_igmp_other_querier_timer_on(igmp); - - zassert(!igmp->t_igmp_query_timer); - zassert(igmp->t_other_querier_timer); - } -} - -static void change_query_interval(struct pim_interface *pim_ifp, - int query_interval) -{ - struct listnode *sock_node; - struct igmp_sock *igmp; - - pim_ifp->igmp_default_query_interval = query_interval; - - for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { - igmp_sock_query_interval_reconfig(igmp); - igmp_sock_query_reschedule(igmp); - } -} - -static void change_query_max_response_time(struct pim_interface *pim_ifp, - int query_max_response_time_dsec) -{ - struct listnode *sock_node; - struct igmp_sock *igmp; - - pim_ifp->igmp_query_max_response_time_dsec = - query_max_response_time_dsec; - - /* - Below we modify socket/group/source timers in order to quickly - reflect the change. Otherwise, those timers would eventually catch - up. - */ - - /* scan all sockets */ - for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { - struct listnode *grp_node; - struct igmp_group *grp; - - /* reschedule socket general query */ - igmp_sock_query_reschedule(igmp); - - /* scan socket groups */ - for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list, grp_node, - grp)) { - struct listnode *src_node; - struct igmp_source *src; + } else + source_str = "0.0.0.0"; - /* reset group timers for groups in EXCLUDE mode */ - if (grp->group_filtermode_isexcl) { - igmp_group_reset_gmi(grp); - } + snprintf(xpath, sizeof(xpath), FRR_IGMP_JOIN_XPATH, + "frr-routing:ipv4", argv[idx_group]->arg, source_str); - /* scan group sources */ - for (ALL_LIST_ELEMENTS_RO(grp->group_source_list, - src_node, src)) { + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); - /* reset source timers for sources with running - * timers */ - if (src->t_source_timer) { - igmp_source_reset_gmi(igmp, grp, src); - } - } - } - } + return nb_cli_apply_changes(vty, NULL); } -#define IGMP_QUERY_INTERVAL_MIN (1) -#define IGMP_QUERY_INTERVAL_MAX (1800) - DEFUN (interface_ip_igmp_query_interval, interface_ip_igmp_query_interval_cmd, "ip igmp query-interval (1-1800)", @@ -7865,50 +8130,24 @@ DEFUN (interface_ip_igmp_query_interval, IFACE_IGMP_QUERY_INTERVAL_STR "Query interval in seconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int query_interval; - int query_interval_dsec; - int ret; - - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; - } - - query_interval = atoi(argv[3]->arg); - query_interval_dsec = 10 * query_interval; - - /* - It seems we don't need to check bounds since command.c does it - already, but we verify them anyway for extra safety. - */ - if (query_interval < IGMP_QUERY_INTERVAL_MIN) { - vty_out(vty, - "General query interval %d lower than minimum %d\n", - query_interval, IGMP_QUERY_INTERVAL_MIN); - return CMD_WARNING_CONFIG_FAILED; - } - if (query_interval > IGMP_QUERY_INTERVAL_MAX) { - vty_out(vty, - "General query interval %d higher than maximum %d\n", - query_interval, IGMP_QUERY_INTERVAL_MAX); - return CMD_WARNING_CONFIG_FAILED; - } + const struct lyd_node *pim_enable_dnode; - if (query_interval_dsec <= pim_ifp->igmp_query_max_response_time_dsec) { - vty_out(vty, - "Can't set general query interval %d dsec <= query max response time %d dsec.\n", - query_interval_dsec, - pim_ifp->igmp_query_max_response_time_dsec); - return CMD_WARNING_CONFIG_FAILED; + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-pim:pim/pim-enable", + VTY_CURR_XPATH); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "true"); } - change_query_interval(pim_ifp, query_interval); + nb_cli_enqueue_change(vty, "./query-interval", NB_OP_MODIFY, + argv[3]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp_query_interval, @@ -7919,27 +8158,15 @@ DEFUN (interface_no_ip_igmp_query_interval, IFACE_IGMP_STR IFACE_IGMP_QUERY_INTERVAL_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int default_query_interval_dsec; + char default_query_interval[5]; - if (!pim_ifp) - return CMD_SUCCESS; + snprintf(default_query_interval, sizeof(default_query_interval), "%d", + IGMP_GENERAL_QUERY_INTERVAL); - default_query_interval_dsec = IGMP_GENERAL_QUERY_INTERVAL * 10; + nb_cli_enqueue_change(vty, "./query-interval", NB_OP_MODIFY, + default_query_interval); - if (default_query_interval_dsec - <= pim_ifp->igmp_query_max_response_time_dsec) { - vty_out(vty, - "Can't set default general query interval %d dsec <= query max response time %d dsec.\n", - default_query_interval_dsec, - pim_ifp->igmp_query_max_response_time_dsec); - return CMD_WARNING_CONFIG_FAILED; - } - - change_query_interval(pim_ifp, IGMP_GENERAL_QUERY_INTERVAL); - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_ip_igmp_version, @@ -7950,36 +8177,11 @@ DEFUN (interface_ip_igmp_version, "IGMP version\n" "IGMP version number\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int igmp_version, old_version = 0; - int ret; - - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; - } + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + nb_cli_enqueue_change(vty, "./version", NB_OP_MODIFY, argv[3]->arg); - igmp_version = atoi(argv[3]->arg); - old_version = pim_ifp->igmp_version; - pim_ifp->igmp_version = igmp_version; - - // Check if IGMP is Enabled otherwise, enable on interface - if (!PIM_IF_TEST_IGMP(pim_ifp->options)) { - PIM_IF_DO_IGMP(pim_ifp->options); - pim_if_addr_add_all(ifp); - pim_if_membership_refresh(ifp); - old_version = igmp_version; - // avoid refreshing membership again. - } - /* Current and new version is different refresh existing - membership. Going from 3 -> 2 or 2 -> 3. */ - if (old_version != igmp_version) - pim_if_membership_refresh(ifp); - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp_version, @@ -7991,20 +8193,11 @@ DEFUN (interface_no_ip_igmp_version, "IGMP version\n" "IGMP version number\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./version", NB_OP_DESTROY, NULL); - pim_ifp->igmp_version = IGMP_DEFAULT_VERSION; - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } -#define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10) -#define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250) - DEFUN (interface_ip_igmp_query_max_response_time, interface_ip_igmp_query_max_response_time_cmd, "ip igmp query-max-response-time (10-250)", @@ -8013,32 +8206,25 @@ DEFUN (interface_ip_igmp_query_max_response_time, IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR "Query response value in deci-seconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int query_max_response_time; - int ret; - - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; - } + const struct lyd_node *pim_enable_dnode; - query_max_response_time = atoi(argv[3]->arg); + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-pim:pim/pim-enable", + VTY_CURR_XPATH); - if (query_max_response_time - >= pim_ifp->igmp_default_query_interval * 10) { - vty_out(vty, - "Can't set query max response time %d sec >= general query interval %d sec\n", - query_max_response_time, - pim_ifp->igmp_default_query_interval); - return CMD_WARNING_CONFIG_FAILED; + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "true"); } - change_query_max_response_time(pim_ifp, query_max_response_time); + nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY, + argv[3]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp_query_max_response_time, @@ -8050,21 +8236,17 @@ DEFUN (interface_no_ip_igmp_query_max_response_time, IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR "Time for response in deci-seconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) - return CMD_SUCCESS; + char default_query_max_response_time[4]; - change_query_max_response_time(pim_ifp, - IGMP_QUERY_MAX_RESPONSE_TIME_DSEC); + snprintf(default_query_max_response_time, + sizeof(default_query_max_response_time), + "%d", IGMP_QUERY_MAX_RESPONSE_TIME_DSEC); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY, + default_query_max_response_time); + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } -#define IGMP_QUERY_MAX_RESPONSE_TIME_MIN_DSEC (10) -#define IGMP_QUERY_MAX_RESPONSE_TIME_MAX_DSEC (250) - DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec, interface_ip_igmp_query_max_response_time_dsec_cmd, "ip igmp query-max-response-time-dsec (10-250)", @@ -8073,34 +8255,24 @@ DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec, IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR "Query response value in deciseconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int query_max_response_time_dsec; - int default_query_interval_dsec; - int ret; + const struct lyd_node *pim_enable_dnode; - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; - } - - query_max_response_time_dsec = atoi(argv[4]->arg); - - default_query_interval_dsec = 10 * pim_ifp->igmp_default_query_interval; - - if (query_max_response_time_dsec >= default_query_interval_dsec) { - vty_out(vty, - "Can't set query max response time %d dsec >= general query interval %d dsec\n", - query_max_response_time_dsec, - default_query_interval_dsec); - return CMD_WARNING_CONFIG_FAILED; + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-pim:pim/pim-enable", + VTY_CURR_XPATH); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "true"); } - change_query_max_response_time(pim_ifp, query_max_response_time_dsec); + nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY, + argv[3]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec, @@ -8111,21 +8283,18 @@ DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec, IFACE_IGMP_STR IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + char default_query_max_response_time[4]; - if (!pim_ifp) - return CMD_SUCCESS; + snprintf(default_query_max_response_time, + sizeof(default_query_max_response_time), + "%d", IGMP_QUERY_MAX_RESPONSE_TIME_DSEC); - change_query_max_response_time(pim_ifp, - IGMP_QUERY_MAX_RESPONSE_TIME_DSEC); + nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY, + default_query_max_response_time); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } -#define IGMP_LAST_MEMBER_QUERY_COUNT_MIN (1) -#define IGMP_LAST_MEMBER_QUERY_COUNT_MAX (7) - DEFUN (interface_ip_igmp_last_member_query_count, interface_ip_igmp_last_member_query_count_cmd, "ip igmp last-member-query-count (1-7)", @@ -8134,23 +8303,24 @@ DEFUN (interface_ip_igmp_last_member_query_count, IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR "Last member query count\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int last_member_query_count; - int ret; + const struct lyd_node *pim_enable_dnode; - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-pim:pim/pim-enable", + VTY_CURR_XPATH); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "true"); } - last_member_query_count = atoi(argv[3]->arg); - - pim_ifp->igmp_last_member_query_count = last_member_query_count; + nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY, + argv[3]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp_last_member_query_count, @@ -8161,21 +8331,17 @@ DEFUN (interface_no_ip_igmp_last_member_query_count, IFACE_IGMP_STR IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + char default_robustness[2]; - if (!pim_ifp) - return CMD_SUCCESS; + snprintf(default_robustness, sizeof(default_robustness), "%d", + IGMP_DEFAULT_ROBUSTNESS_VARIABLE); - pim_ifp->igmp_last_member_query_count = - IGMP_DEFAULT_ROBUSTNESS_VARIABLE; + nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY, + default_robustness); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } -#define IGMP_LAST_MEMBER_QUERY_INTERVAL_MIN (1) -#define IGMP_LAST_MEMBER_QUERY_INTERVAL_MAX (255) - DEFUN (interface_ip_igmp_last_member_query_interval, interface_ip_igmp_last_member_query_interval_cmd, "ip igmp last-member-query-interval (1-255)", @@ -8184,23 +8350,24 @@ DEFUN (interface_ip_igmp_last_member_query_interval, IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR "Last member query interval in deciseconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - int last_member_query_interval; - int ret; + const struct lyd_node *pim_enable_dnode; - if (!pim_ifp) { - ret = pim_cmd_igmp_start(vty, ifp); - if (ret != CMD_SUCCESS) - return ret; - pim_ifp = ifp->info; + pim_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-pim:pim/pim-enable", + VTY_CURR_XPATH); + if (!pim_enable_dnode) { + nb_cli_enqueue_change(vty, "./igmp-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(pim_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./igmp-enable", + NB_OP_MODIFY, "true"); } - last_member_query_interval = atoi(argv[3]->arg); - pim_ifp->igmp_specific_query_max_response_time_dsec - = last_member_query_interval; + nb_cli_enqueue_change(vty, "./last-member-query-interval", NB_OP_MODIFY, + argv[3]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_no_ip_igmp_last_member_query_interval, @@ -8211,16 +8378,16 @@ DEFUN (interface_no_ip_igmp_last_member_query_interval, IFACE_IGMP_STR IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + char default_last_member_query_count[4]; - if (!pim_ifp) - return CMD_SUCCESS; + snprintf(default_last_member_query_count, + sizeof(default_last_member_query_count), + "%d", IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC); - pim_ifp->igmp_specific_query_max_response_time_dsec = - IGMP_SPECIFIC_QUERY_MAX_RESPONSE_TIME_DSEC; + nb_cli_enqueue_change(vty, "./last-member-query-interval", NB_OP_MODIFY, + default_last_member_query_count); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-igmp:igmp"); } DEFUN (interface_ip_pim_drprio, @@ -8231,26 +8398,12 @@ DEFUN (interface_ip_pim_drprio, "Set the Designated Router Election Priority\n" "Value of the new DR Priority\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; - struct pim_interface *pim_ifp = ifp->info; - uint32_t old_dr_prio; - - if (!pim_ifp) { - vty_out(vty, "Please enable PIM on interface, first\n"); - return CMD_WARNING_CONFIG_FAILED; - } - old_dr_prio = pim_ifp->pim_dr_priority; + nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_MODIFY, + argv[idx_number]->arg); - pim_ifp->pim_dr_priority = strtol(argv[idx_number]->arg, NULL, 10); - - if (old_dr_prio != pim_ifp->pim_dr_priority) { - pim_if_dr_election(ifp); - pim_hello_restart_now(ifp); - } - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (interface_no_ip_pim_drprio, @@ -8262,31 +8415,25 @@ DEFUN (interface_no_ip_pim_drprio, "Revert the Designated Router Priority to default\n" "Old Value of the Priority\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + char default_priority[10]; - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface\n"); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(default_priority, sizeof(default_priority), "%d", + PIM_DEFAULT_DR_PRIORITY); - if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) { - pim_ifp->pim_dr_priority = PIM_DEFAULT_DR_PRIORITY; - pim_if_dr_election(ifp); - pim_hello_restart_now(ifp); - } + nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_MODIFY, + default_priority); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFPY_HIDDEN (interface_ip_igmp_query_generate, - interface_ip_igmp_query_generate_cmd, - "ip igmp generate-query-once [version (2-3)]", - IP_STR - IFACE_IGMP_STR - "Generate igmp general query once\n" - "IGMP version\n" - "IGMP version number\n") + interface_ip_igmp_query_generate_cmd, + "ip igmp generate-query-once [version (2-3)]", + IP_STR + IFACE_IGMP_STR + "Generate igmp general query once\n" + "IGMP version\n" + "IGMP version number\n") { VTY_DECLVAR_CONTEXT(interface, ifp); int igmp_version = 2; @@ -8305,30 +8452,6 @@ DEFPY_HIDDEN (interface_ip_igmp_query_generate, return CMD_SUCCESS; } -static int pim_cmd_interface_add(struct vty *vty, struct interface *ifp) -{ - struct pim_interface *pim_ifp = ifp->info; - struct pim_instance *pim; - - if (!pim_ifp) { - pim = pim_get_pim_instance(ifp->vrf_id); - /* Limiting mcast interfaces to number of VIFs */ - if (pim->mcast_if_count == MAXVIFS) { - vty_out(vty, "Max multicast interfaces(%d) reached.", - MAXVIFS); - return 0; - } - pim_ifp = pim_if_new(ifp, false, true, false, false); - } else - PIM_IF_DO_PIM(pim_ifp->options); - - pim_if_addr_add_all(ifp); - pim_if_membership_refresh(ifp); - - pim_if_create_pimreg(pim_ifp->pim); - return 1; -} - DEFPY_HIDDEN (pim_test_sg_keepalive, pim_test_sg_keepalive_cmd, "test pim [vrf NAME$name] keepalive-reset A.B.C.D$source A.B.C.D$group", @@ -8387,77 +8510,52 @@ DEFPY (interface_ip_pim_activeactive, PIM_STR "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp; - - if (!no && !pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM active-active on interface %s\n", - ifp->name); - return CMD_WARNING_CONFIG_FAILED; - } - - - if (PIM_DEBUG_MLAG) - zlog_debug("%sConfiguring PIM active-active on Interface: %s", - no ? "Un-" : " ", ifp->name); - - pim_ifp = ifp->info; if (no) - pim_if_unconfigure_mlag_dualactive(pim_ifp); - else - pim_if_configure_mlag_dualactive(pim_ifp); - - return CMD_SUCCESS; -} - -DEFUN_HIDDEN (interface_ip_pim_ssm, - interface_ip_pim_ssm_cmd, - "ip pim ssm", - IP_STR - PIM_STR - IFACE_PIM_STR) -{ - VTY_DECLVAR_CONTEXT(interface, ifp); + nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY, + "false"); + else { + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING_CONFIG_FAILED; + nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY, + "true"); } - vty_out(vty, - "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n"); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } -static int interface_ip_pim_helper(struct vty *vty) +DEFUN_HIDDEN (interface_ip_pim_ssm, + interface_ip_pim_ssm_cmd, + "ip pim ssm", + IP_STR + PIM_STR + IFACE_PIM_STR) { - struct pim_interface *pim_ifp; + int ret; - VTY_DECLVAR_CONTEXT(interface, ifp); + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true"); - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING_CONFIG_FAILED; - } + ret = nb_cli_apply_changes(vty, "./frr-pim:pim"); - pim_ifp = ifp->info; + if (ret != NB_OK) + return ret; - pim_if_create_pimreg(pim_ifp->pim); + vty_out(vty, + "WARN: Enabled PIM SM on interface; configure PIM SSM range if needed\n"); - return CMD_SUCCESS; + return NB_OK; } DEFUN_HIDDEN (interface_ip_pim_sm, - interface_ip_pim_sm_cmd, - "ip pim sm", - IP_STR - PIM_STR - IFACE_PIM_SM_STR) + interface_ip_pim_sm_cmd, + "ip pim sm", + IP_STR + PIM_STR + IFACE_PIM_SM_STR) { - return interface_ip_pim_helper(vty); + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (interface_ip_pim, @@ -8466,65 +8564,73 @@ DEFUN (interface_ip_pim, IP_STR PIM_STR) { - return interface_ip_pim_helper(vty); + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true"); + + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } -static int pim_cmd_interface_delete(struct interface *ifp) +DEFUN_HIDDEN (interface_no_ip_pim_ssm, + interface_no_ip_pim_ssm_cmd, + "no ip pim ssm", + NO_STR + IP_STR + PIM_STR + IFACE_PIM_STR) { - struct pim_interface *pim_ifp = ifp->info; + const struct lyd_node *igmp_enable_dnode; + char igmp_if_xpath[XPATH_MAXLEN + 20]; - if (!pim_ifp) - return 1; + snprintf(igmp_if_xpath, sizeof(igmp_if_xpath), + "%s/frr-igmp:igmp", VTY_CURR_XPATH); + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/igmp-enable", igmp_if_xpath); - PIM_IF_DONT_PIM(pim_ifp->options); - - pim_if_membership_clear(ifp); - - /* - pim_sock_delete() removes all neighbors from - pim_ifp->pim_neighbor_list. - */ - pim_sock_delete(ifp, "pim unconfigured on interface"); - - if (!PIM_IF_TEST_IGMP(pim_ifp->options)) { - pim_if_addr_del_all(ifp); - pim_if_delete(ifp); + if (!igmp_enable_dnode) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, + NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "false"); } - return 1; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } -static int interface_no_ip_pim_helper(struct vty *vty) +DEFUN_HIDDEN (interface_no_ip_pim_sm, + interface_no_ip_pim_sm_cmd, + "no ip pim sm", + NO_STR + IP_STR + PIM_STR + IFACE_PIM_SM_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - if (!pim_cmd_interface_delete(ifp)) { - vty_out(vty, "Unable to delete interface information\n"); - return CMD_WARNING_CONFIG_FAILED; - } + const struct lyd_node *igmp_enable_dnode; + char igmp_if_xpath[XPATH_MAXLEN + 20]; - return CMD_SUCCESS; -} + snprintf(igmp_if_xpath, sizeof(igmp_if_xpath), + "%s/frr-igmp:igmp", VTY_CURR_XPATH); + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/igmp-enable", igmp_if_xpath); -DEFUN_HIDDEN (interface_no_ip_pim_ssm, - interface_no_ip_pim_ssm_cmd, - "no ip pim ssm", - NO_STR - IP_STR - PIM_STR - IFACE_PIM_STR) -{ - return interface_no_ip_pim_helper(vty); -} + if (!igmp_enable_dnode) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, + NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "false"); + } -DEFUN_HIDDEN (interface_no_ip_pim_sm, - interface_no_ip_pim_sm_cmd, - "no ip pim sm", - NO_STR - IP_STR - PIM_STR - IFACE_PIM_SM_STR) -{ - return interface_no_ip_pim_helper(vty); + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (interface_no_ip_pim, @@ -8534,7 +8640,28 @@ DEFUN (interface_no_ip_pim, IP_STR PIM_STR) { - return interface_no_ip_pim_helper(vty); + const struct lyd_node *igmp_enable_dnode; + char igmp_if_xpath[XPATH_MAXLEN + 20]; + + snprintf(igmp_if_xpath, sizeof(igmp_if_xpath), + "%s/frr-igmp:igmp", VTY_CURR_XPATH); + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/igmp-enable", igmp_if_xpath); + + if (!igmp_enable_dnode) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) { + nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, + NULL); + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + } else + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "false"); + } + + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } /* boundaries */ @@ -8547,22 +8674,13 @@ DEFUN(interface_ip_pim_boundary_oil, "Filter OIL by group using prefix list\n" "Prefix list to filter OIL with\n") { - VTY_DECLVAR_CONTEXT(interface, iif); - struct pim_interface *pim_ifp; - int idx = 0; - - argv_find(argv, argc, "WORD", &idx); + nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_MODIFY, + argv[4]->arg); - PIM_GET_PIM_INTERFACE(pim_ifp, iif); + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']", + "frr-routing:ipv4"); - if (pim_ifp->boundary_oil_plist) - XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); - - pim_ifp->boundary_oil_plist = - XSTRDUP(MTYPE_PIM_INTERFACE, argv[idx]->arg); - - /* Interface will be pruned from OIL on next Join */ - return CMD_SUCCESS; } DEFUN(interface_no_ip_pim_boundary_oil, @@ -8575,18 +8693,12 @@ DEFUN(interface_no_ip_pim_boundary_oil, "Filter OIL by group using prefix list\n" "Prefix list to filter OIL with\n") { - VTY_DECLVAR_CONTEXT(interface, iif); - struct pim_interface *pim_ifp; - int idx = 0; - - argv_find(argv, argc, "WORD", &idx); - - PIM_GET_PIM_INTERFACE(pim_ifp, iif); - - if (pim_ifp->boundary_oil_plist) - XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); + nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_DESTROY, + NULL); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']", + "frr-routing:ipv4"); } DEFUN (interface_ip_mroute, @@ -8598,56 +8710,22 @@ DEFUN (interface_ip_mroute, "Group address\n" "Source address\n") { - VTY_DECLVAR_CONTEXT(interface, iif); - struct pim_interface *pim_ifp; - struct pim_instance *pim; int idx_interface = 2; int idx_ipv4 = 3; - struct interface *oif; - const char *oifname; - const char *grp_str; - struct in_addr grp_addr; - const char *src_str; - struct in_addr src_addr; - int result; - - PIM_GET_PIM_INTERFACE(pim_ifp, iif); - pim = pim_ifp->pim; - - oifname = argv[idx_interface]->arg; - oif = if_lookup_by_name(oifname, pim->vrf_id); - if (!oif) { - vty_out(vty, "No such interface name %s\n", oifname); - return CMD_WARNING; - } + const char *source_str; - grp_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, grp_str, &grp_addr); - if (result <= 0) { - vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str, - errno, safe_strerror(errno)); - return CMD_WARNING; - } + if (argc == (idx_ipv4 + 1)) + source_str = "0.0.0.0"; + else + source_str = argv[idx_ipv4 + 1]->arg; - if (argc == (idx_ipv4 + 1)) { - src_addr.s_addr = INADDR_ANY; - } - else { - src_str = argv[idx_ipv4 + 1]->arg; - result = inet_pton(AF_INET, src_str, &src_addr); - if (result <= 0) { - vty_out(vty, "Bad source address %s: errno=%d: %s\n", src_str, - errno, safe_strerror(errno)); - return CMD_WARNING; - } - } - - if (pim_static_add(pim, iif, oif, grp_addr, src_addr)) { - vty_out(vty, "Failed to add static mroute\n"); - return CMD_WARNING; - } + nb_cli_enqueue_change(vty, "./oif", NB_OP_MODIFY, + argv[idx_interface]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']/mroute[source-addr='%s'][group-addr='%s']", + "frr-routing:ipv4", source_str, + argv[idx_ipv4]->arg); } DEFUN (interface_no_ip_mroute, @@ -8660,56 +8738,20 @@ DEFUN (interface_no_ip_mroute, "Group Address\n" "Source Address\n") { - VTY_DECLVAR_CONTEXT(interface, iif); - struct pim_interface *pim_ifp; - struct pim_instance *pim; - int idx_interface = 3; int idx_ipv4 = 4; - struct interface *oif; - const char *oifname; - const char *grp_str; - struct in_addr grp_addr; - const char *src_str; - struct in_addr src_addr; - int result; - - PIM_GET_PIM_INTERFACE(pim_ifp, iif); - pim = pim_ifp->pim; - - oifname = argv[idx_interface]->arg; - oif = if_lookup_by_name(oifname, pim->vrf_id); - if (!oif) { - vty_out(vty, "No such interface name %s\n", oifname); - return CMD_WARNING; - } + const char *source_str; - grp_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, grp_str, &grp_addr); - if (result <= 0) { - vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str, - errno, safe_strerror(errno)); - return CMD_WARNING; - } + if (argc == (idx_ipv4 + 1)) + source_str = "0.0.0.0"; + else + source_str = argv[idx_ipv4 + 1]->arg; - if (argc == (idx_ipv4 + 1)) { - src_addr.s_addr = INADDR_ANY; - } - else { - src_str = argv[idx_ipv4 + 1]->arg; - result = inet_pton(AF_INET, src_str, &src_addr); - if (result <= 0) { - vty_out(vty, "Bad source address %s: errno=%d: %s\n", src_str, - errno, safe_strerror(errno)); - return CMD_WARNING; - } - } - - if (pim_static_del(pim, iif, oif, grp_addr, src_addr)) { - vty_out(vty, "Failed to remove static mroute\n"); - return CMD_WARNING; - } + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']/mroute[source-addr='%s'][group-addr='%s']", + "frr-routing:ipv4", source_str, + argv[idx_ipv4]->arg); } DEFUN (interface_ip_pim_hello, @@ -8721,28 +8763,30 @@ DEFUN (interface_ip_pim_hello, IFACE_PIM_HELLO_TIME_STR IFACE_PIM_HELLO_HOLD_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); int idx_time = 3; int idx_hold = 4; - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) { - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING_CONFIG_FAILED; - } + const struct lyd_node *igmp_enable_dnode; + + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-igmp:igmp/igmp-enable", + VTY_CURR_XPATH); + if (!igmp_enable_dnode) { + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + } else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); } - pim_ifp = ifp->info; - pim_ifp->pim_hello_period = strtol(argv[idx_time]->arg, NULL, 10); + nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_MODIFY, + argv[idx_time]->arg); if (argc == idx_hold + 1) - pim_ifp->pim_default_holdtime = - strtol(argv[idx_hold]->arg, NULL, 10); + nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_MODIFY, + argv[idx_hold]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (interface_no_ip_pim_hello, @@ -8755,18 +8799,16 @@ DEFUN (interface_no_ip_pim_hello, IFACE_PIM_HELLO_TIME_STR IFACE_PIM_HELLO_HOLD_STR) { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + char hello_default_timer[3]; - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface\n"); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(hello_default_timer, sizeof(hello_default_timer), "%d", + PIM_DEFAULT_HELLO_PERIOD); - pim_ifp->pim_hello_period = PIM_DEFAULT_HELLO_PERIOD; - pim_ifp->pim_default_holdtime = -1; + nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_MODIFY, + hello_default_timer); + nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_DESTROY, NULL); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (debug_igmp, @@ -9403,40 +9445,6 @@ DEFUN_NOSH (show_debugging_pim, return CMD_SUCCESS; } -static int interface_pim_use_src_cmd_worker(struct vty *vty, const char *source) -{ - int result; - struct in_addr source_addr; - int ret = CMD_SUCCESS; - VTY_DECLVAR_CONTEXT(interface, ifp); - - result = inet_pton(AF_INET, source, &source_addr); - if (result <= 0) { - vty_out(vty, "%% Bad source address %s: errno=%d: %s\n", source, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - - result = pim_update_source_set(ifp, source_addr); - switch (result) { - case PIM_SUCCESS: - break; - case PIM_IFACE_NOT_FOUND: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "Pim not enabled on this interface\n"); - break; - case PIM_UPDATE_SOURCE_DUP: - ret = CMD_WARNING; - vty_out(vty, "%% Source already set to %s\n", source); - break; - default: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% Source set failed\n"); - } - - return ret; -} - DEFUN (interface_pim_use_source, interface_pim_use_source_cmd, "ip pim use-source A.B.C.D", @@ -9445,7 +9453,11 @@ DEFUN (interface_pim_use_source, "Configure primary IP address\n" "source ip address\n") { - return interface_pim_use_src_cmd_worker(vty, argv[3]->arg); + nb_cli_enqueue_change(vty, "./use-source", NB_OP_MODIFY, argv[3]->arg); + + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']", + "frr-routing:ipv4"); } DEFUN (interface_no_pim_use_source, @@ -9457,7 +9469,11 @@ DEFUN (interface_no_pim_use_source, "Delete source IP address\n" "source ip address\n") { - return interface_pim_use_src_cmd_worker(vty, "0.0.0.0"); + nb_cli_enqueue_change(vty, "./use-source", NB_OP_MODIFY, "0.0.0.0"); + + return nb_cli_apply_changes(vty, + "./frr-pim:pim/address-family[address-family='%s']", + "frr-routing:ipv4"); } DEFUN (ip_pim_bfd, @@ -9467,27 +9483,50 @@ DEFUN (ip_pim_bfd, PIM_STR "Enables BFD support\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; struct bfd_info *bfd_info = NULL; - - if (!pim_ifp) { - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING; - } + char default_rx_interval[5]; + char default_tx_interval[5]; + char default_detect_mult[3]; + const struct lyd_node *igmp_enable_dnode; + char bfd_xpath[XPATH_MAXLEN + 20]; + + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-igmp:igmp/igmp-enable", + VTY_CURR_XPATH); + if (!igmp_enable_dnode) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); } - pim_ifp = ifp->info; - bfd_info = pim_ifp->bfd_info; + snprintf(default_rx_interval, sizeof(default_rx_interval), "%d", + BFD_DEF_MIN_RX); + snprintf(default_tx_interval, sizeof(default_tx_interval), "%d", + BFD_DEF_MIN_TX); + snprintf(default_detect_mult, sizeof(default_detect_mult), "%d", + BFD_DEF_DETECT_MULT); - if (!bfd_info || !CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG)) - pim_bfd_if_param_set(ifp, BFD_DEF_MIN_RX, BFD_DEF_MIN_TX, - BFD_DEF_DETECT_MULT, 1); + snprintf(bfd_xpath, sizeof(bfd_xpath), "%s/frr-pim:pim/bfd", + VTY_CURR_XPATH); + bfd_info = nb_running_get_entry(NULL, bfd_xpath, false); - return CMD_SUCCESS; + if (!bfd_info || + !CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG)) { + nb_cli_enqueue_change(vty, "./bfd/min-rx-interval", + NB_OP_MODIFY, default_rx_interval); + nb_cli_enqueue_change(vty, "./bfd/min-tx-interval", + NB_OP_MODIFY, default_tx_interval); + nb_cli_enqueue_change(vty, "./bfd/detect_mult", + NB_OP_MODIFY, + default_detect_mult); + + return nb_cli_apply_changes(vty, "./frr-pim:pim"); + } + + return NB_OK; } DEFUN (no_ip_pim_bfd, @@ -9498,20 +9537,9 @@ DEFUN (no_ip_pim_bfd, PIM_STR "Disables BFD support\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + nb_cli_enqueue_change(vty, "./bfd", NB_OP_DESTROY, NULL); - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface\n"); - return CMD_WARNING; - } - - if (pim_ifp->bfd_info) { - pim_bfd_reg_dereg_all_nbr(ifp, ZEBRA_BFD_DEST_DEREGISTER); - bfd_info_free(&(pim_ifp->bfd_info)); - } - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (ip_pim_bsm, @@ -9521,22 +9549,23 @@ DEFUN (ip_pim_bsm, PIM_STR "Enables BSM support on the interface\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + const struct lyd_node *igmp_enable_dnode; - if (!pim_ifp) { - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING; - } + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-igmp:igmp/igmp-enable", + VTY_CURR_XPATH); + if (!igmp_enable_dnode) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); } - pim_ifp = ifp->info; - pim_ifp->bsm_enable = true; + nb_cli_enqueue_change(vty, "./bsm", NB_OP_MODIFY, "true"); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (no_ip_pim_bsm, @@ -9547,17 +9576,9 @@ DEFUN (no_ip_pim_bsm, PIM_STR "Disables BSM support\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + nb_cli_enqueue_change(vty, "./bsm", NB_OP_MODIFY, "false"); - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface\n"); - return CMD_WARNING; - } - - pim_ifp->bsm_enable = false; - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (ip_pim_ucast_bsm, @@ -9567,22 +9588,23 @@ DEFUN (ip_pim_ucast_bsm, PIM_STR "Accept/Send unicast BSM on the interface\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; + const struct lyd_node *igmp_enable_dnode; - if (!pim_ifp) { - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING; - } + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-igmp:igmp/igmp-enable", + VTY_CURR_XPATH); + if (!igmp_enable_dnode) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); } - pim_ifp = ifp->info; - pim_ifp->ucast_bsm_accept = true; + nb_cli_enqueue_change(vty, "./unicast-bsm", NB_OP_MODIFY, "true"); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } DEFUN (no_ip_pim_ucast_bsm, @@ -9593,44 +9615,35 @@ DEFUN (no_ip_pim_ucast_bsm, PIM_STR "Block send/receive unicast BSM on this interface\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface\n"); - return CMD_WARNING; - } + nb_cli_enqueue_change(vty, "./unicast-bsm", NB_OP_MODIFY, "false"); - pim_ifp->ucast_bsm_accept = false; - - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } #if HAVE_BFDD > 0 DEFUN_HIDDEN( - ip_pim_bfd_param, - ip_pim_bfd_param_cmd, - "ip pim bfd (2-255) (50-60000) (50-60000)", - IP_STR - PIM_STR - "Enables BFD support\n" - "Detect Multiplier\n" - "Required min receive interval\n" - "Desired min transmit interval\n") + ip_pim_bfd_param, + ip_pim_bfd_param_cmd, + "ip pim bfd (2-255) (50-60000) (50-60000)", + IP_STR + PIM_STR + "Enables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") #else -DEFUN( - ip_pim_bfd_param, - ip_pim_bfd_param_cmd, - "ip pim bfd (2-255) (50-60000) (50-60000)", - IP_STR - PIM_STR - "Enables BFD support\n" - "Detect Multiplier\n" - "Required min receive interval\n" - "Desired min transmit interval\n") + DEFUN( + ip_pim_bfd_param, + ip_pim_bfd_param_cmd, + "ip pim bfd (2-255) (50-60000) (50-60000)", + IP_STR + PIM_STR + "Enables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") #endif /* HAVE_BFDD */ { - VTY_DECLVAR_CONTEXT(interface, ifp); int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 5; @@ -9638,26 +9651,35 @@ DEFUN( uint32_t tx_val; uint8_t dm_val; int ret; - struct pim_interface *pim_ifp = ifp->info; + const struct lyd_node *igmp_enable_dnode; - if (!pim_ifp) { - if (!pim_cmd_interface_add(vty, ifp)) { - vty_out(vty, - "Could not enable PIM SM on interface %s\n", - ifp->name); - return CMD_WARNING; - } - } - - if ((ret = bfd_validate_param( - vty, argv[idx_number]->arg, argv[idx_number_2]->arg, - argv[idx_number_3]->arg, &dm_val, &rx_val, &tx_val)) + if ((ret = bfd_validate_param(vty, argv[idx_number]->arg, + argv[idx_number_2]->arg, + argv[idx_number_3]->arg, &dm_val, &rx_val, + &tx_val)) != CMD_SUCCESS) return ret; - pim_bfd_if_param_set(ifp, rx_val, tx_val, dm_val, 0); + igmp_enable_dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-igmp:igmp/igmp-enable", + VTY_CURR_XPATH); + if (!igmp_enable_dnode) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + else { + if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) + nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, + "true"); + } + + nb_cli_enqueue_change(vty, "./bfd/min-rx-interval", NB_OP_MODIFY, + argv[idx_number_2]->arg); + nb_cli_enqueue_change(vty, "./bfd/min-tx-interval", NB_OP_MODIFY, + argv[idx_number_3]->arg); + nb_cli_enqueue_change(vty, "./bfd/detect_mult", NB_OP_MODIFY, + argv[idx_number]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, "./frr-pim:pim"); } #if HAVE_BFDD == 0 @@ -9669,92 +9691,47 @@ ALIAS(no_ip_pim_bfd, no_ip_pim_bfd_param_cmd, "Desired min transmit interval\n") #endif /* !HAVE_BFDD */ -static int ip_msdp_peer_cmd_worker(struct pim_instance *pim, struct vty *vty, - const char *peer, const char *local) -{ - enum pim_msdp_err result; - struct in_addr peer_addr; - struct in_addr local_addr; - int ret = CMD_SUCCESS; - - result = inet_pton(AF_INET, peer, &peer_addr); - if (result <= 0) { - vty_out(vty, "%% Bad peer address %s: errno=%d: %s\n", peer, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - - result = inet_pton(AF_INET, local, &local_addr); - if (result <= 0) { - vty_out(vty, "%% Bad source address %s: errno=%d: %s\n", local, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - - result = pim_msdp_peer_add(pim, peer_addr, local_addr, "default", - NULL /* mp_p */); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_OOM: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% Out of memory\n"); - break; - case PIM_MSDP_ERR_PEER_EXISTS: - ret = CMD_WARNING; - vty_out(vty, "%% Peer exists\n"); - break; - case PIM_MSDP_ERR_MAX_MESH_GROUPS: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% Only one mesh-group allowed currently\n"); - break; - default: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% peer add failed\n"); - } - - return ret; -} + DEFUN (ip_msdp_peer, + ip_msdp_peer_cmd, + "ip msdp peer A.B.C.D source A.B.C.D", + IP_STR + CFG_MSDP_STR + "Configure MSDP peer\n" + "peer ip address\n" + "Source address for TCP connection\n" + "local ip address\n") +{ + const struct lyd_node *vrf_dnode; + const char *vrfname; + char temp_xpath[XPATH_MAXLEN]; + char msdp_peer_source_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; -DEFUN (ip_msdp_peer, - ip_msdp_peer_cmd, - "ip msdp peer A.B.C.D source A.B.C.D", - IP_STR - CFG_MSDP_STR - "Configure MSDP peer\n" - "peer ip address\n" - "Source address for TCP connection\n" - "local ip address\n") -{ - PIM_DECLVAR_CONTEXT(vrf, pim); - return ip_msdp_peer_cmd_worker(pim, vty, argv[3]->arg, argv[5]->arg); -} + snprintf(msdp_peer_source_xpath, sizeof(msdp_peer_source_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + snprintf(temp_xpath, sizeof(temp_xpath), + "/msdp-peer[peer-ip='%s']/source-ip", + argv[3]->arg); + strlcat(msdp_peer_source_xpath, temp_xpath, + sizeof(msdp_peer_source_xpath)); -static int ip_no_msdp_peer_cmd_worker(struct pim_instance *pim, struct vty *vty, - const char *peer) -{ - enum pim_msdp_err result; - struct in_addr peer_addr; + nb_cli_enqueue_change(vty, msdp_peer_source_xpath, NB_OP_MODIFY, + argv[5]->arg); - result = inet_pton(AF_INET, peer, &peer_addr); - if (result <= 0) { - vty_out(vty, "%% Bad peer address %s: errno=%d: %s\n", peer, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - - result = pim_msdp_peer_del(pim, peer_addr); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_NO_PEER: - vty_out(vty, "%% Peer does not exist\n"); - break; - default: - vty_out(vty, "%% peer del failed\n"); - } - - return result ? CMD_WARNING_CONFIG_FAILED : CMD_SUCCESS; + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_msdp_peer, @@ -9766,47 +9743,36 @@ DEFUN (no_ip_msdp_peer, "Delete MSDP peer\n" "peer ip address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return ip_no_msdp_peer_cmd_worker(pim, vty, argv[4]->arg); -} + const struct lyd_node *vrf_dnode; + const char *vrfname; + char msdp_peer_xpath[XPATH_MAXLEN]; + char temp_xpath[XPATH_MAXLEN]; -static int ip_msdp_mesh_group_member_cmd_worker(struct pim_instance *pim, - struct vty *vty, const char *mg, - const char *mbr) -{ - enum pim_msdp_err result; - struct in_addr mbr_ip; - int ret = CMD_SUCCESS; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - result = inet_pton(AF_INET, mbr, &mbr_ip); - if (result <= 0) { - vty_out(vty, "%% Bad member address %s: errno=%d: %s\n", mbr, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(msdp_peer_xpath, sizeof(msdp_peer_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + snprintf(temp_xpath, sizeof(temp_xpath), + "/msdp-peer[peer-ip='%s']", + argv[4]->arg); - result = pim_msdp_mg_mbr_add(pim, mg, mbr_ip); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_OOM: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% Out of memory\n"); - break; - case PIM_MSDP_ERR_MG_MBR_EXISTS: - ret = CMD_WARNING; - vty_out(vty, "%% mesh-group member exists\n"); - break; - case PIM_MSDP_ERR_MAX_MESH_GROUPS: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% Only one mesh-group allowed currently\n"); - break; - default: - ret = CMD_WARNING_CONFIG_FAILED; - vty_out(vty, "%% member add failed\n"); - } + strlcat(msdp_peer_xpath, temp_xpath, sizeof(msdp_peer_xpath)); + + nb_cli_enqueue_change(vty, msdp_peer_xpath, NB_OP_DESTROY, NULL); - return ret; + return nb_cli_apply_changes(vty, NULL); } DEFUN (ip_msdp_mesh_group_member, @@ -9819,42 +9785,44 @@ DEFUN (ip_msdp_mesh_group_member, "mesh group member\n" "peer ip address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return ip_msdp_mesh_group_member_cmd_worker(pim, vty, argv[3]->arg, - argv[5]->arg); -} + const struct lyd_node *vrf_dnode; + const char *vrfname; + char msdp_mesh_group_name_xpath[XPATH_MAXLEN]; + char msdp_mesh_group_member_xpath[XPATH_MAXLEN]; -static int ip_no_msdp_mesh_group_member_cmd_worker(struct pim_instance *pim, - struct vty *vty, - const char *mg, - const char *mbr) -{ - enum pim_msdp_err result; - struct in_addr mbr_ip; + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - result = inet_pton(AF_INET, mbr, &mbr_ip); - if (result <= 0) { - vty_out(vty, "%% Bad member address %s: errno=%d: %s\n", mbr, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } + snprintf(msdp_mesh_group_name_xpath, sizeof(msdp_mesh_group_name_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_group_name_xpath, "/msdp-mesh-group/mesh-group-name", + sizeof(msdp_mesh_group_name_xpath)); + snprintf(msdp_mesh_group_member_xpath, + sizeof(msdp_mesh_group_member_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_group_member_xpath, "/msdp-mesh-group/member-ip", + sizeof(msdp_mesh_group_member_xpath)); - result = pim_msdp_mg_mbr_del(pim, mg, mbr_ip); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_NO_MG: - vty_out(vty, "%% mesh-group does not exist\n"); - break; - case PIM_MSDP_ERR_NO_MG_MBR: - vty_out(vty, "%% mesh-group member does not exist\n"); - break; - default: - vty_out(vty, "%% mesh-group member del failed\n"); - } + nb_cli_enqueue_change(vty, msdp_mesh_group_name_xpath, NB_OP_MODIFY, + argv[3]->arg); + nb_cli_enqueue_change(vty, msdp_mesh_group_member_xpath, NB_OP_CREATE, + argv[5]->arg); - return result ? CMD_WARNING_CONFIG_FAILED : CMD_SUCCESS; + return nb_cli_apply_changes(vty, NULL); } + DEFUN (no_ip_msdp_mesh_group_member, no_ip_msdp_mesh_group_member_cmd, "no ip msdp mesh-group WORD member A.B.C.D", @@ -9866,42 +9834,89 @@ DEFUN (no_ip_msdp_mesh_group_member, "mesh group member\n" "peer ip address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return ip_no_msdp_mesh_group_member_cmd_worker(pim, vty, argv[4]->arg, - argv[6]->arg); -} - -static int ip_msdp_mesh_group_source_cmd_worker(struct pim_instance *pim, - struct vty *vty, const char *mg, - const char *src) -{ - enum pim_msdp_err result; - struct in_addr src_ip; - - result = inet_pton(AF_INET, src, &src_ip); - if (result <= 0) { - vty_out(vty, "%% Bad source address %s: errno=%d: %s\n", src, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; + const struct lyd_node *vrf_dnode; + const char *vrfname; + char temp_xpath[XPATH_MAXLEN]; + char mesh_group_xpath[XPATH_MAXLEN]; + char group_member_xpath[XPATH_MAXLEN]; + char source_xpath[XPATH_MAXLEN]; + char mesh_group_name_xpath[XPATH_MAXLEN]; + const char *mesh_group_name; + const struct lyd_node *member_dnode; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(mesh_group_xpath, sizeof(mesh_group_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(mesh_group_xpath, "/msdp-mesh-group", sizeof(mesh_group_xpath)); + + snprintf(group_member_xpath, sizeof(group_member_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + snprintf(temp_xpath, sizeof(temp_xpath), + "/msdp-mesh-group/member-ip[.='%s']", argv[6]->arg); + strlcat(group_member_xpath, temp_xpath, sizeof(group_member_xpath)); + + snprintf(source_xpath, sizeof(source_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + snprintf(temp_xpath, sizeof(temp_xpath), + "/msdp-mesh-group/source-ip"); + strlcat(source_xpath, temp_xpath, sizeof(source_xpath)); + + snprintf(mesh_group_name_xpath, sizeof(mesh_group_name_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(mesh_group_name_xpath, "/msdp-mesh-group/mesh-group-name", + sizeof(mesh_group_name_xpath)); + + if (yang_dnode_exists(running_config->dnode, mesh_group_name_xpath) + == true) { + mesh_group_name = yang_dnode_get_string(running_config->dnode, + mesh_group_name_xpath); + if (strcmp(mesh_group_name, argv[4]->arg)) { + vty_out(vty, "%% mesh-group does not exist\n"); + return CMD_WARNING_CONFIG_FAILED; + } } - result = pim_msdp_mg_src_add(pim, mg, src_ip); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_OOM: - vty_out(vty, "%% Out of memory\n"); - break; - case PIM_MSDP_ERR_MAX_MESH_GROUPS: - vty_out(vty, "%% Only one mesh-group allowed currently\n"); - break; - default: - vty_out(vty, "%% source add failed\n"); + if (yang_dnode_exists(vty->candidate_config->dnode, + group_member_xpath)) { + if (!yang_dnode_exists(vty->candidate_config->dnode, + source_xpath)) { + member_dnode = yang_dnode_get( + vty->candidate_config->dnode, + group_member_xpath); + if (yang_is_last_list_dnode(member_dnode)) { + nb_cli_enqueue_change(vty, mesh_group_xpath, + NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); + } + nb_cli_enqueue_change(vty, group_member_xpath, + NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); + } + nb_cli_enqueue_change(vty, group_member_xpath, + NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } - return result ? CMD_WARNING_CONFIG_FAILED : CMD_SUCCESS; -} + vty_out(vty, "%% mesh-group member does not exist\n"); + return CMD_SUCCESS; +} DEFUN (ip_msdp_mesh_group_source, ip_msdp_mesh_group_source_cmd, @@ -9913,48 +9928,42 @@ DEFUN (ip_msdp_mesh_group_source, "mesh group local address\n" "source ip address for the TCP connection\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); - return ip_msdp_mesh_group_source_cmd_worker(pim, vty, argv[3]->arg, - argv[5]->arg); -} + const struct lyd_node *vrf_dnode; + const char *vrfname; + char msdp_mesh_source_ip_xpath[XPATH_MAXLEN]; + char msdp_mesh_group_name_xpath[XPATH_MAXLEN]; -static int ip_no_msdp_mesh_group_source_cmd_worker(struct pim_instance *pim, - struct vty *vty, - const char *mg) -{ - enum pim_msdp_err result; - - result = pim_msdp_mg_src_del(pim, mg); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_NO_MG: - vty_out(vty, "%% mesh-group does not exist\n"); - break; - default: - vty_out(vty, "%% mesh-group source del failed\n"); - } + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; - return result ? CMD_WARNING_CONFIG_FAILED : CMD_SUCCESS; -} + snprintf(msdp_mesh_group_name_xpath, sizeof(msdp_mesh_group_name_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_group_name_xpath, "/msdp-mesh-group/mesh-group-name", + sizeof(msdp_mesh_group_name_xpath)); -static int ip_no_msdp_mesh_group_cmd_worker(struct pim_instance *pim, - struct vty *vty, const char *mg) -{ - enum pim_msdp_err result; + snprintf(msdp_mesh_source_ip_xpath, sizeof(msdp_mesh_source_ip_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_source_ip_xpath, "/msdp-mesh-group/source-ip", + sizeof(msdp_mesh_source_ip_xpath)); - result = pim_msdp_mg_del(pim, mg); - switch (result) { - case PIM_MSDP_ERR_NONE: - break; - case PIM_MSDP_ERR_NO_MG: - vty_out(vty, "%% mesh-group does not exist\n"); - break; - default: - vty_out(vty, "%% mesh-group source del failed\n"); - } + nb_cli_enqueue_change(vty, msdp_mesh_group_name_xpath, NB_OP_MODIFY, + argv[3]->arg); + nb_cli_enqueue_change(vty, msdp_mesh_source_ip_xpath, NB_OP_MODIFY, + argv[5]->arg); - return result ? CMD_WARNING_CONFIG_FAILED : CMD_SUCCESS; + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_msdp_mesh_group_source, @@ -9968,9 +9977,69 @@ DEFUN (no_ip_msdp_mesh_group_source, "mesh group source\n" "mesh group local address\n") { - PIM_DECLVAR_CONTEXT(vrf, pim); + const struct lyd_node *vrf_dnode; + const char *vrfname; + char msdp_mesh_xpath[XPATH_MAXLEN]; + char source_xpath[XPATH_MAXLEN]; + char group_member_xpath[XPATH_MAXLEN]; + char mesh_group_name_xpath[XPATH_MAXLEN]; + const char *mesh_group_name; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + snprintf(msdp_mesh_xpath, sizeof(msdp_mesh_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_xpath, "/msdp-mesh-group", sizeof(msdp_mesh_xpath)); + + snprintf(source_xpath, sizeof(source_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(source_xpath, "/msdp-mesh-group/source-ip", + sizeof(source_xpath)); + + snprintf(group_member_xpath, + sizeof(group_member_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(group_member_xpath, "/msdp-mesh-group/member-ip", + sizeof(group_member_xpath)); + + snprintf(mesh_group_name_xpath, sizeof(mesh_group_name_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(mesh_group_name_xpath, "/msdp-mesh-group/mesh-group-name", + sizeof(mesh_group_name_xpath)); + + if (yang_dnode_exists(running_config->dnode, mesh_group_name_xpath) + == true) { + mesh_group_name = yang_dnode_get_string(running_config->dnode, + mesh_group_name_xpath); + if (strcmp(mesh_group_name, argv[4]->arg)) { + vty_out(vty, "%% mesh-group does not exist\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } - return ip_no_msdp_mesh_group_source_cmd_worker(pim, vty, argv[4]->arg); + if (!yang_dnode_exists(vty->candidate_config->dnode, + group_member_xpath)) { + nb_cli_enqueue_change(vty, msdp_mesh_xpath, NB_OP_DESTROY, + NULL); + return nb_cli_apply_changes(vty, NULL); + } + nb_cli_enqueue_change(vty, source_xpath, NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } DEFUN (no_ip_msdp_mesh_group, @@ -9982,12 +10051,50 @@ DEFUN (no_ip_msdp_mesh_group, "Delete MSDP mesh-group\n" "mesh group name") { - PIM_DECLVAR_CONTEXT(vrf, pim); + const struct lyd_node *vrf_dnode; + const char *vrfname; + const char *mesh_group_name; + char xpath[XPATH_MAXLEN]; + char msdp_mesh_xpath[XPATH_MAXLEN]; + + if (vty->xpath_index) { + vrf_dnode = + yang_dnode_get(vty->candidate_config->dnode, + VTY_CURR_XPATH); + if (!vrf_dnode) { + vty_out(vty, + "%% Failed to get vrf dnode in candidate db\n"); + return CMD_WARNING_CONFIG_FAILED; + } + vrfname = yang_dnode_get_string(vrf_dnode, "./name"); + } else + vrfname = VRF_DEFAULT_NAME; + + if (argc == 5) { + snprintf(xpath, sizeof(xpath), FRR_PIM_AF_XPATH, "frr-pim:pimd", + "pim", vrfname, "frr-routing:ipv4"); + strlcat(xpath, "/msdp-mesh-group/mesh-group-name", + sizeof(xpath)); + + if (yang_dnode_exists(running_config->dnode, xpath) == true) { + mesh_group_name = + yang_dnode_get_string(running_config->dnode, + xpath); + + if (strcmp(mesh_group_name, argv[4]->arg)) { + vty_out(vty, "%% mesh-group does not exist\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } + } - if (argc == 5) - return ip_no_msdp_mesh_group_cmd_worker(pim, vty, argv[4]->arg); - else - return ip_no_msdp_mesh_group_cmd_worker(pim, vty, NULL); + snprintf(msdp_mesh_xpath, sizeof(msdp_mesh_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", vrfname, "frr-routing:ipv4"); + strlcat(msdp_mesh_xpath, "/msdp-mesh-group", sizeof(msdp_mesh_xpath)); + + nb_cli_enqueue_change(vty, msdp_mesh_xpath, NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } static void print_empty_json_obj(struct vty *vty) @@ -10062,7 +10169,7 @@ static void ip_msdp_show_mesh_group(struct pim_instance *pim, struct vty *vty, if (uj) { json_object_object_add(json, mg->mesh_group_name, json_mg_row); vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10170,7 +10277,7 @@ static void ip_msdp_show_peers(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10275,7 +10382,7 @@ static void ip_msdp_show_peers_detail(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10423,7 +10530,7 @@ static void ip_msdp_show_sa(struct pim_instance *pim, struct vty *vty, bool uj) if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10516,7 +10623,7 @@ static void ip_msdp_show_sa_detail(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10601,7 +10708,7 @@ static void ip_msdp_show_sa_addr(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10630,7 +10737,7 @@ static void ip_msdp_show_sa_sg(struct pim_instance *pim, struct vty *vty, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10657,10 +10764,10 @@ DEFUN (show_ip_msdp_sa_sg, return CMD_WARNING; char *src_ip = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx++]->arg - : NULL; + : NULL; char *grp_ip = idx < argc && argv_find(argv, argc, "A.B.C.D", &idx) - ? argv[idx]->arg - : NULL; + ? argv[idx]->arg + : NULL; if (src_ip && grp_ip) ip_msdp_show_sa_sg(vrf->info, vty, src_ip, grp_ip, uj); @@ -10690,10 +10797,10 @@ DEFUN (show_ip_msdp_sa_sg_vrf_all, int idx = 2; char *src_ip = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx++]->arg - : NULL; + : NULL; char *grp_ip = idx < argc && argv_find(argv, argc, "A.B.C.D", &idx) - ? argv[idx]->arg - : NULL; + ? argv[idx]->arg + : NULL; if (uj) vty_out(vty, "{ "); @@ -10728,7 +10835,7 @@ struct pim_sg_cache_walk_data { }; static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg *vxlan_sg, - struct pim_sg_cache_walk_data *cwd) + struct pim_sg_cache_walk_data *cwd) { struct vty *vty = cwd->vty; json_object *json = cwd->json; @@ -10745,7 +10852,7 @@ static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg *vxlan_sg, oif_name = vxlan_sg->term_oif?vxlan_sg->term_oif->name:""; if (cwd->addr_match && (vxlan_sg->sg.src.s_addr != cwd->addr.s_addr) && - (vxlan_sg->sg.grp.s_addr != cwd->addr.s_addr)) { + (vxlan_sg->sg.grp.s_addr != cwd->addr.s_addr)) { return; } pim_inet4_dump("<src?>", vxlan_sg->sg.src, src_str, sizeof(src_str)); @@ -10756,7 +10863,7 @@ static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg *vxlan_sg, if (!cwd->json_group) { cwd->json_group = json_object_new_object(); json_object_object_add(json, grp_str, - cwd->json_group); + cwd->json_group); } json_row = json_object_new_object(); @@ -10771,19 +10878,19 @@ static void pim_show_vxlan_sg_entry(struct pim_vxlan_sg *vxlan_sg, json_object_object_add(cwd->json_group, src_str, json_row); } else { vty_out(vty, "%-15s %-15s %-15s %-15s %-5s\n", - src_str, grp_str, iif_name, oif_name, - installed?"I":""); + src_str, grp_str, iif_name, oif_name, + installed?"I":""); } } static void pim_show_vxlan_sg_hash_entry(struct hash_bucket *backet, void *arg) { pim_show_vxlan_sg_entry((struct pim_vxlan_sg *)backet->data, - (struct pim_sg_cache_walk_data *)arg); + (struct pim_sg_cache_walk_data *)arg); } static void pim_show_vxlan_sg(struct pim_instance *pim, - struct vty *vty, bool uj) + struct vty *vty, bool uj) { json_object *json = NULL; struct pim_sg_cache_walk_data cwd; @@ -10803,13 +10910,14 @@ static void pim_show_vxlan_sg(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } static void pim_show_vxlan_sg_match_addr(struct pim_instance *pim, - struct vty *vty, char *addr_str, bool uj) + struct vty *vty, char *addr_str, + bool uj) { json_object *json = NULL; struct pim_sg_cache_walk_data cwd; @@ -10819,7 +10927,7 @@ static void pim_show_vxlan_sg_match_addr(struct pim_instance *pim, result = inet_pton(AF_INET, addr_str, &cwd.addr); if (result <= 0) { vty_out(vty, "Bad address %s: errno=%d: %s\n", addr_str, - errno, safe_strerror(errno)); + errno, safe_strerror(errno)); return; } @@ -10838,13 +10946,14 @@ static void pim_show_vxlan_sg_match_addr(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } static void pim_show_vxlan_sg_one(struct pim_instance *pim, - struct vty *vty, char *src_str, char *grp_str, bool uj) + struct vty *vty, char *src_str, char *grp_str, + bool uj) { json_object *json = NULL; struct prefix_sg sg; @@ -10857,13 +10966,13 @@ static void pim_show_vxlan_sg_one(struct pim_instance *pim, result = inet_pton(AF_INET, src_str, &sg.src); if (result <= 0) { vty_out(vty, "Bad src address %s: errno=%d: %s\n", src_str, - errno, safe_strerror(errno)); + errno, safe_strerror(errno)); return; } result = inet_pton(AF_INET, grp_str, &sg.grp); if (result <= 0) { vty_out(vty, "Bad grp address %s: errno=%d: %s\n", grp_str, - errno, safe_strerror(errno)); + errno, safe_strerror(errno)); return; } @@ -10893,7 +11002,7 @@ static void pim_show_vxlan_sg_one(struct pim_instance *pim, json_object_boolean_true_add(json, "installed"); else json_object_boolean_false_add(json, - "installed"); + "installed"); } else { vty_out(vty, "SG : %s\n", vxlan_sg->sg_str); vty_out(vty, " Input : %s\n", iif_name); @@ -10905,7 +11014,7 @@ static void pim_show_vxlan_sg_one(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -10947,7 +11056,7 @@ DEFUN (show_ip_pim_vxlan_sg, } static void pim_show_vxlan_sg_work(struct pim_instance *pim, - struct vty *vty, bool uj) + struct vty *vty, bool uj) { json_object *json = NULL; struct pim_sg_cache_walk_data cwd; @@ -10970,7 +11079,7 @@ static void pim_show_vxlan_sg_work(struct pim_instance *pim, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } } @@ -11000,86 +11109,108 @@ DEFUN_HIDDEN (show_ip_pim_vxlan_sg_work, } DEFUN_HIDDEN (no_ip_pim_mlag, - no_ip_pim_mlag_cmd, - "no ip pim mlag", - NO_STR - IP_STR - PIM_STR - "MLAG\n") + no_ip_pim_mlag_cmd, + "no ip pim mlag", + NO_STR + IP_STR + PIM_STR + "MLAG\n") { - struct in_addr addr; + char mlag_xpath[XPATH_MAXLEN]; - addr.s_addr = 0; - pim_vxlan_mlag_update(true/*mlag_enable*/, - false/*peer_state*/, MLAG_ROLE_NONE, - NULL/*peerlink*/, &addr); + snprintf(mlag_xpath, sizeof(mlag_xpath), FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", "default", "frr-routing:ipv4"); + strlcat(mlag_xpath, "/mlag", sizeof(mlag_xpath)); - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, mlag_xpath, NB_OP_DESTROY, NULL); + + + return nb_cli_apply_changes(vty, NULL); } DEFUN_HIDDEN (ip_pim_mlag, - ip_pim_mlag_cmd, - "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D", - IP_STR - PIM_STR - "MLAG\n" - "peerlink sub interface\n" - "MLAG role\n" - "MLAG role primary\n" - "MLAG role secondary\n" - "peer session state\n" - "peer session state up\n" - "peer session state down\n" - "configure PIP\n" - "unique ip address\n") + ip_pim_mlag_cmd, + "ip pim mlag INTERFACE role [primary|secondary] state [up|down] addr A.B.C.D", + IP_STR + PIM_STR + "MLAG\n" + "peerlink sub interface\n" + "MLAG role\n" + "MLAG role primary\n" + "MLAG role secondary\n" + "peer session state\n" + "peer session state up\n" + "peer session state down\n" + "configure PIP\n" + "unique ip address\n") { - struct interface *ifp; - const char *peerlink; - uint32_t role; int idx; - bool peer_state; - int result; - struct in_addr reg_addr; + char mlag_peerlink_rif_xpath[XPATH_MAXLEN]; + char mlag_my_role_xpath[XPATH_MAXLEN]; + char mlag_peer_state_xpath[XPATH_MAXLEN]; + char mlag_reg_address_xpath[XPATH_MAXLEN]; + + snprintf(mlag_peerlink_rif_xpath, sizeof(mlag_peerlink_rif_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", "default", "frr-routing:ipv4"); + strlcat(mlag_peerlink_rif_xpath, "/mlag/peerlink-rif", + sizeof(mlag_peerlink_rif_xpath)); idx = 3; - peerlink = argv[idx]->arg; - ifp = if_lookup_by_name(peerlink, VRF_DEFAULT); - if (!ifp) { - vty_out(vty, "No such interface name %s\n", peerlink); - return CMD_WARNING; - } + nb_cli_enqueue_change(vty, mlag_peerlink_rif_xpath, NB_OP_MODIFY, + argv[idx]->arg); + + snprintf(mlag_my_role_xpath, sizeof(mlag_my_role_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", "default", "frr-routing:ipv4"); + strlcat(mlag_my_role_xpath, "/mlag/my-role", + sizeof(mlag_my_role_xpath)); idx += 2; if (!strcmp(argv[idx]->arg, "primary")) { - role = MLAG_ROLE_PRIMARY; + nb_cli_enqueue_change(vty, mlag_my_role_xpath, NB_OP_MODIFY, + "MLAG_ROLE_PRIMARY"); + } else if (!strcmp(argv[idx]->arg, "secondary")) { - role = MLAG_ROLE_SECONDARY; + nb_cli_enqueue_change(vty, mlag_my_role_xpath, NB_OP_MODIFY, + "MLAG_ROLE_SECONDARY"); + } else { vty_out(vty, "unknown MLAG role %s\n", argv[idx]->arg); return CMD_WARNING; } + snprintf(mlag_peer_state_xpath, sizeof(mlag_peer_state_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", "default", "frr-routing:ipv4"); + strlcat(mlag_peer_state_xpath, "/mlag/peer-state", + sizeof(mlag_peer_state_xpath)); + idx += 2; if (!strcmp(argv[idx]->arg, "up")) { - peer_state = true; + nb_cli_enqueue_change(vty, mlag_peer_state_xpath, NB_OP_MODIFY, + "true"); + } else if (strcmp(argv[idx]->arg, "down")) { - peer_state = false; + nb_cli_enqueue_change(vty, mlag_peer_state_xpath, NB_OP_MODIFY, + "false"); + } else { vty_out(vty, "unknown MLAG state %s\n", argv[idx]->arg); return CMD_WARNING; } + snprintf(mlag_reg_address_xpath, sizeof(mlag_reg_address_xpath), + FRR_PIM_AF_XPATH, + "frr-pim:pimd", "pim", "default", "frr-routing:ipv4"); + strlcat(mlag_reg_address_xpath, "/mlag/reg-address", + sizeof(mlag_reg_address_xpath)); + idx += 2; - result = inet_pton(AF_INET, argv[idx]->arg, ®_addr); - if (result <= 0) { - vty_out(vty, "%% Bad reg address %s: errno=%d: %s\n", - argv[idx]->arg, - errno, safe_strerror(errno)); - return CMD_WARNING_CONFIG_FAILED; - } - pim_vxlan_mlag_update(true, peer_state, role, ifp, ®_addr); + nb_cli_enqueue_change(vty, mlag_reg_address_xpath, NB_OP_MODIFY, + argv[idx]->arg); - return CMD_SUCCESS; + return nb_cli_apply_changes(vty, NULL); } void pim_cmd_init(void) diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index cff237f965..62d19f7619 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1174,7 +1174,7 @@ long pim_if_t_suppressed_msec(struct interface *ifp) zassert(pim_ifp); /* join suppression disabled ? */ - if (PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp->options)) + if (PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options)) return 0; /* t_suppressed = t_periodic * rand(1.1, 1.4) */ diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 8decfef74d..664ab31949 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -35,24 +35,27 @@ #define PIM_IF_MASK_PIM (1 << 0) #define PIM_IF_MASK_IGMP (1 << 1) #define PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS (1 << 2) -#define PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPRESSION (1 << 3) +#define PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION (1 << 3) #define PIM_IF_IS_DELETED(ifp) ((ifp)->ifindex == IFINDEX_INTERNAL) #define PIM_IF_TEST_PIM(options) (PIM_IF_MASK_PIM & (options)) #define PIM_IF_TEST_IGMP(options) (PIM_IF_MASK_IGMP & (options)) #define PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(options) (PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS & (options)) -#define PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(options) (PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPRESSION & (options)) +#define PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \ + (PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION & (options)) #define PIM_IF_DO_PIM(options) ((options) |= PIM_IF_MASK_PIM) #define PIM_IF_DO_IGMP(options) ((options) |= PIM_IF_MASK_IGMP) #define PIM_IF_DO_IGMP_LISTEN_ALLROUTERS(options) ((options) |= PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS) -#define PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPRESSION(options) ((options) |= PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPRESSION) +#define PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \ + ((options) |= PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION) #define PIM_IF_DONT_PIM(options) ((options) &= ~PIM_IF_MASK_PIM) #define PIM_IF_DONT_IGMP(options) ((options) &= ~PIM_IF_MASK_IGMP) #define PIM_IF_DONT_IGMP_LISTEN_ALLROUTERS(options) ((options) &= ~PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS) -#define PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPRESSION(options) ((options) &= ~PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPRESSION) +#define PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \ + ((options) &= ~PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION) #define PIM_I_am_DR(pim_ifp) (pim_ifp)->pim_dr_addr.s_addr == (pim_ifp)->primary_address.s_addr #define PIM_I_am_DualActive(pim_ifp) (pim_ifp)->activeactive == true diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 19d7817577..9924e335b0 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -270,6 +270,27 @@ void pim_igmp_other_querier_timer_off(struct igmp_sock *igmp) THREAD_OFF(igmp->t_other_querier_timer); } +int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len) +{ + uint16_t recv_checksum; + uint16_t checksum; + + IGMP_GET_INT16((unsigned char *)(igmp_msg + IGMP_CHECKSUM_OFFSET), + recv_checksum); + + /* Clear the checksum field */ + memset(igmp_msg + IGMP_CHECKSUM_OFFSET, 0, 2); + + checksum = in_cksum(igmp_msg, igmp_msg_len); + if (ntohs(checksum) != recv_checksum) { + zlog_warn("Invalid checksum received %x, calculated %x", + recv_checksum, ntohs(checksum)); + return -1; + } + + return 0; +} + static int igmp_recv_query(struct igmp_sock *igmp, int query_version, int max_resp_code, struct in_addr from, const char *from_str, char *igmp_msg, @@ -278,8 +299,6 @@ static int igmp_recv_query(struct igmp_sock *igmp, int query_version, struct interface *ifp; struct pim_interface *pim_ifp; struct in_addr group_addr; - uint16_t recv_checksum; - uint16_t checksum; if (igmp->mtrace_only) return 0; @@ -289,17 +308,10 @@ static int igmp_recv_query(struct igmp_sock *igmp, int query_version, ifp = igmp->interface; pim_ifp = ifp->info; - recv_checksum = *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET); - - /* for computing checksum */ - *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET) = 0; - - checksum = in_cksum(igmp_msg, igmp_msg_len); - if (checksum != recv_checksum) { + if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) { zlog_warn( - "Recv IGMP query v%d from %s on %s: checksum mismatch: received=%x computed=%x", - query_version, from_str, ifp->name, recv_checksum, - checksum); + "Recv IGMP query v%d from %s on %s with invalid checksum", + query_version, from_str, ifp->name); return -1; } @@ -427,6 +439,13 @@ static int igmp_v1_recv_report(struct igmp_sock *igmp, struct in_addr from, return -1; } + if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) { + zlog_warn( + "Recv IGMP report v1 from %s on %s with invalid checksum", + from_str, ifp->name); + return -1; + } + /* Collecting IGMP Rx stats */ igmp->rx_stats.report_v1++; diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h index 9231b0b41f..a0681128c0 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -69,6 +69,12 @@ #define IGMP_DEFAULT_VERSION (3) +#define IGMP_GET_INT16(ptr, output) \ + do { \ + output = *(ptr) << 8; \ + output |= *((ptr) + 1); \ + } while (0) + struct igmp_join { struct in_addr group_addr; struct in_addr source_addr; @@ -116,6 +122,8 @@ void pim_igmp_general_query_off(struct igmp_sock *igmp); void pim_igmp_other_querier_timer_on(struct igmp_sock *igmp); void pim_igmp_other_querier_timer_off(struct igmp_sock *igmp); +int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len); + #define IGMP_SOURCE_MASK_FORWARDING (1 << 0) #define IGMP_SOURCE_MASK_DELETE (1 << 1) #define IGMP_SOURCE_MASK_SEND (1 << 2) diff --git a/pimd/pim_igmpv2.c b/pimd/pim_igmpv2.c index af598d040d..d836c66cbb 100644 --- a/pimd/pim_igmpv2.c +++ b/pimd/pim_igmpv2.c @@ -121,6 +121,13 @@ int igmp_v2_recv_report(struct igmp_sock *igmp, struct in_addr from, return -1; } + if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) { + zlog_warn( + "Recv IGMPv2 REPORT from %s on %s: size=%d with invalid checksum", + from_str, ifp->name, igmp_msg_len); + return -1; + } + /* Collecting IGMP Rx stats */ igmp->rx_stats.report_v2++; @@ -170,6 +177,13 @@ int igmp_v2_recv_leave(struct igmp_sock *igmp, struct in_addr from, return -1; } + if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) { + zlog_warn( + "Recv IGMPv2 LEAVE from %s on %s with invalid checksum", + from_str, ifp->name); + return -1; + } + /* Collecting IGMP Rx stats */ igmp->rx_stats.leave_v2++; diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 22767a8629..425adfe166 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1830,8 +1830,6 @@ void igmp_v3_recv_query(struct igmp_sock *igmp, const char *from_str, int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from, const char *from_str, char *igmp_msg, int igmp_msg_len) { - uint16_t recv_checksum; - uint16_t checksum; int num_groups; uint8_t *group_record; uint8_t *report_pastend = (uint8_t *)igmp_msg + igmp_msg_len; @@ -1853,16 +1851,10 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from, return -1; } - recv_checksum = *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET); - - /* for computing checksum */ - *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET) = 0; - - checksum = in_cksum(igmp_msg, igmp_msg_len); - if (checksum != recv_checksum) { + if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) { zlog_warn( - "Recv IGMP report v3 from %s on %s: checksum mismatch: received=%x computed=%x", - from_str, ifp->name, recv_checksum, checksum); + "Recv IGMPv3 report from %s on %s with invalid checksum", + from_str, ifp->name); return -1; } @@ -1880,9 +1872,8 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from, if (PIM_DEBUG_IGMP_PACKETS) { zlog_debug( - "Recv IGMP report v3 from %s on %s: size=%d checksum=%x groups=%d", - from_str, ifp->name, igmp_msg_len, checksum, - num_groups); + "Recv IGMP report v3 from %s on %s: size=%d groups=%d", + from_str, ifp->name, igmp_msg_len, num_groups); } group_record = (uint8_t *)igmp_msg + IGMP_V3_REPORT_GROUPPRECORD_OFFSET; diff --git a/pimd/pim_main.c b/pimd/pim_main.c index 132d913f68..b7ca90ad93 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -38,6 +38,7 @@ #include "vrf.h" #include "libfrr.h" #include "routemap.h" +#include "routing_nb.h" #include "pimd.h" #include "pim_instance.h" @@ -49,6 +50,7 @@ #include "pim_bfd.h" #include "pim_mlag.h" #include "pim_errors.h" +#include "pim_nb.h" extern struct host host; @@ -77,6 +79,10 @@ static const struct frr_yang_module_info *const pimd_yang_modules[] = { &frr_interface_info, &frr_route_map_info, &frr_vrf_info, + &frr_routing_info, + &frr_pim_info, + &frr_pim_rp_info, + &frr_igmp_info, }; FRR_DAEMON_INFO(pimd, PIM, .vty_port = PIMD_VTY_PORT, @@ -137,6 +143,9 @@ int main(int argc, char **argv, char **envp) pim_bfd_init(); pim_mlag_init(); + hook_register(routing_conf_event, + routing_control_plane_protocols_name_validate); + frr_config_fork(); #ifdef PIM_DEBUG_BYDEFAULT diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index 2dfc0af1de..a06c0a6f4e 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -96,7 +96,7 @@ static void pim_mlag_inherit_mlag_flags(struct pim_upstream *up, bool is_df) struct channel_oil *ch_oil = NULL; if (PIM_DEBUG_MLAG) - zlog_debug("%s: Updating DF for uptream:%s childs", __func__, + zlog_debug("%s: Updating DF for uptream:%s children", __func__, up->sg_str); diff --git a/pimd/pim_nb.c b/pimd/pim_nb.c new file mode 100644 index 0000000000..8ca0e0780b --- /dev/null +++ b/pimd/pim_nb.c @@ -0,0 +1,417 @@ +/* + * Copyright (C) 2020 VmWare + * Sarita Patra + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <zebra.h> + +#include "northbound.h" +#include "libfrr.h" +#include "vrf.h" +#include "pimd/pim_nb.h" + +/* clang-format off */ +const struct frr_yang_module_info frr_pim_info = { + .name = "frr-pim", + .nodes = { + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/ecmp", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_ecmp_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/ecmp-rebalance", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_ecmp_rebalance_modify, + } + }, + { + .xpath = "/frr-pim:pim/join-prune-interval", + .cbs = { + .modify = pim_join_prune_interval_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/keep-alive-timer", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_keep_alive_timer_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/rp-keep-alive-timer", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_rp_keep_alive_timer_modify, + } + }, + { + .xpath = "/frr-pim:pim/packets", + .cbs = { + .modify = pim_packets_modify, + } + }, + { + .xpath = "/frr-pim:pim/register-suppress-time", + .cbs = { + .modify = pim_register_suppress_time_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/send-v6-secondary", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover", + .cbs = { + .apply_finish = routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover/spt-action", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_action_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover/spt-infinity-prefix-list", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/ssm-prefix-list", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/ssm-pingd-source-ip", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/mesh-group-name", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/member-ip", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/source-ip", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-peer", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-peer/source-ip", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_destroy, + .apply_finish = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_apply_finish, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/peerlink-rif", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/reg-address", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/my-role", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_my_role_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/peer-state", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peer_state_modify, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/register-accept-list", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim", + .cbs = { + .create = lib_interface_pim_create, + .destroy = lib_interface_pim_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/pim-enable", + .cbs = { + .modify = lib_interface_pim_pim_enable_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/dr-priority", + .cbs = { + .modify = lib_interface_pim_dr_priority_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/hello-interval", + .cbs = { + .modify = lib_interface_pim_hello_interval_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/hello-holdtime", + .cbs = { + .modify = lib_interface_pim_hello_holdtime_modify, + .destroy = lib_interface_pim_hello_holdtime_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/bfd", + .cbs = { + .create = lib_interface_pim_bfd_create, + .destroy = lib_interface_pim_bfd_destroy, + .apply_finish = lib_interface_pim_bfd_apply_finish, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/bfd/min-rx-interval", + .cbs = { + .modify = lib_interface_pim_bfd_min_rx_interval_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/bfd/min-tx-interval", + .cbs = { + .modify = lib_interface_pim_bfd_min_tx_interval_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/bfd/detect_mult", + .cbs = { + .modify = lib_interface_pim_bfd_detect_mult_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/bsm", + .cbs = { + .modify = lib_interface_pim_bsm_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/unicast-bsm", + .cbs = { + .modify = lib_interface_pim_unicast_bsm_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/active-active", + .cbs = { + .modify = lib_interface_pim_active_active_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/address-family", + .cbs = { + .create = lib_interface_pim_address_family_create, + .destroy = lib_interface_pim_address_family_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/address-family/use-source", + .cbs = { + .modify = lib_interface_pim_address_family_use_source_modify, + .destroy = lib_interface_pim_address_family_use_source_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/address-family/multicast-boundary-oil", + .cbs = { + .modify = lib_interface_pim_address_family_multicast_boundary_oil_modify, + .destroy = lib_interface_pim_address_family_multicast_boundary_oil_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/address-family/mroute", + .cbs = { + .create = lib_interface_pim_address_family_mroute_create, + .destroy = lib_interface_pim_address_family_mroute_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-pim:pim/address-family/mroute/oif", + .cbs = { + .modify = lib_interface_pim_address_family_mroute_oif_modify, + .destroy = lib_interface_pim_address_family_mroute_oif_destroy, + } + }, + { + .xpath = NULL, + }, + } +}; + +/* clang-format off */ +const struct frr_yang_module_info frr_pim_rp_info = { + .name = "frr-pim-rp", + .nodes = { + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list/group-list", + .cbs = { + .create = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_create, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_destroy, + } + }, + { + .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list/prefix-list", + .cbs = { + .modify = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_modify, + .destroy = routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_destroy, + } + }, + { + .xpath = NULL, + }, + } +}; + +/* clang-format off */ +const struct frr_yang_module_info frr_igmp_info = { + .name = "frr-igmp", + .nodes = { + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp", + .cbs = { + .create = lib_interface_igmp_create, + .destroy = lib_interface_igmp_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/igmp-enable", + .cbs = { + .modify = lib_interface_igmp_igmp_enable_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/version", + .cbs = { + .modify = lib_interface_igmp_version_modify, + .destroy = lib_interface_igmp_version_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/query-interval", + .cbs = { + .modify = lib_interface_igmp_query_interval_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/query-max-response-time", + .cbs = { + .modify = lib_interface_igmp_query_max_response_time_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/last-member-query-interval", + .cbs = { + .modify = lib_interface_igmp_last_member_query_interval_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/robustness-variable", + .cbs = { + .modify = lib_interface_igmp_robustness_variable_modify, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/address-family", + .cbs = { + .create = lib_interface_igmp_address_family_create, + .destroy = lib_interface_igmp_address_family_destroy, + } + }, + { + .xpath = "/frr-interface:lib/interface/frr-igmp:igmp/address-family/static-group", + .cbs = { + .create = lib_interface_igmp_address_family_static_group_create, + .destroy = lib_interface_igmp_address_family_static_group_destroy, + } + }, + { + .xpath = NULL, + }, + } +}; diff --git a/pimd/pim_nb.h b/pimd/pim_nb.h new file mode 100644 index 0000000000..78eb680103 --- /dev/null +++ b/pimd/pim_nb.h @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2020 VmWare + * Sarita Patra + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _FRR_PIM_NB_H_ +#define _FRR_PIM_NB_H_ + +extern const struct frr_yang_module_info frr_pim_info; +extern const struct frr_yang_module_info frr_pim_rp_info; +extern const struct frr_yang_module_info frr_igmp_info; + +/* frr-pim prototypes*/ +int routing_control_plane_protocols_control_plane_protocol_pim_ecmp_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_ecmp_rebalance_modify( + struct nb_cb_modify_args *args); +int pim_join_prune_interval_modify(struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_keep_alive_timer_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_rp_keep_alive_timer_modify( + struct nb_cb_modify_args *args); +int pim_packets_modify(struct nb_cb_modify_args *args); +int pim_register_suppress_time_modify(struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_destroy( + struct nb_cb_destroy_args *args); +void routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_apply_finish( + struct nb_cb_apply_finish_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_action_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_destroy( + struct nb_cb_destroy_args *args); +void routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_apply_finish( + struct nb_cb_apply_finish_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_my_role_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peer_state_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_destroy( + struct nb_cb_destroy_args *args); +int lib_interface_pim_dr_priority_modify( + struct nb_cb_modify_args *args); +int lib_interface_pim_create(struct nb_cb_create_args *args); +int lib_interface_pim_destroy(struct nb_cb_destroy_args *args); +int lib_interface_pim_pim_enable_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_hello_interval_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_hello_holdtime_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_hello_holdtime_destroy(struct nb_cb_destroy_args *args); +int lib_interface_pim_bfd_create(struct nb_cb_create_args *args); +int lib_interface_pim_bfd_destroy(struct nb_cb_destroy_args *args); +void lib_interface_pim_bfd_apply_finish(struct nb_cb_apply_finish_args *args); +int lib_interface_pim_bfd_min_rx_interval_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_bfd_min_tx_interval_modify( + struct nb_cb_modify_args *args); +int lib_interface_pim_bfd_detect_mult_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_bsm_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_unicast_bsm_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_active_active_modify(struct nb_cb_modify_args *args); +int lib_interface_pim_address_family_create(struct nb_cb_create_args *args); +int lib_interface_pim_address_family_destroy(struct nb_cb_destroy_args *args); +int lib_interface_pim_address_family_use_source_modify( + struct nb_cb_modify_args *args); +int lib_interface_pim_address_family_use_source_destroy( + struct nb_cb_destroy_args *args); +int lib_interface_pim_address_family_multicast_boundary_oil_modify( + struct nb_cb_modify_args *args); +int lib_interface_pim_address_family_multicast_boundary_oil_destroy( + struct nb_cb_destroy_args *args); +int lib_interface_pim_address_family_mroute_create( + struct nb_cb_create_args *args); +int lib_interface_pim_address_family_mroute_destroy( + struct nb_cb_destroy_args *args); +int lib_interface_pim_address_family_mroute_oif_modify( + struct nb_cb_modify_args *args); +int lib_interface_pim_address_family_mroute_oif_destroy( + struct nb_cb_destroy_args *args); + +/* frr-pim-rp prototypes*/ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_create( + struct nb_cb_create_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_destroy( + struct nb_cb_destroy_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_modify( + struct nb_cb_modify_args *args); +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_destroy( + struct nb_cb_destroy_args *args); + +/* frr-igmp prototypes*/ +int lib_interface_igmp_create(struct nb_cb_create_args *args); +int lib_interface_igmp_destroy(struct nb_cb_destroy_args *args); +int lib_interface_igmp_igmp_enable_modify(struct nb_cb_modify_args *args); +int lib_interface_igmp_version_modify(struct nb_cb_modify_args *args); +int lib_interface_igmp_version_destroy(struct nb_cb_destroy_args *args); +int lib_interface_igmp_query_interval_modify(struct nb_cb_modify_args *args); +int lib_interface_igmp_query_max_response_time_modify( + struct nb_cb_modify_args *args); +int lib_interface_igmp_last_member_query_interval_modify( + struct nb_cb_modify_args *args); +int lib_interface_igmp_robustness_variable_modify( + struct nb_cb_modify_args *args); +int lib_interface_igmp_address_family_create(struct nb_cb_create_args *args); +int lib_interface_igmp_address_family_destroy(struct nb_cb_destroy_args *args); +int lib_interface_igmp_address_family_static_group_create( + struct nb_cb_create_args *args); +int lib_interface_igmp_address_family_static_group_destroy( + struct nb_cb_destroy_args *args); + +/* + * Callback registered with routing_nb lib to validate only + * one instance of staticd is allowed + */ +int routing_control_plane_protocols_name_validate( + struct nb_cb_create_args *args); + +#define FRR_PIM_XPATH \ + "/frr-routing:routing/control-plane-protocols/" \ + "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \ + "frr-pim:pim" +#define FRR_PIM_AF_XPATH \ + "/frr-routing:routing/control-plane-protocols/" \ + "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \ + "frr-pim:pim/address-family[address-family='%s']" +#define FRR_PIM_STATIC_RP_XPATH \ + "/frr-routing:routing/control-plane-protocols/" \ + "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \ + "frr-pim:pim/address-family[address-family='%s']/" \ + "frr-pim-rp:rp/static-rp/rp-list[rp-address='%s']" +#define FRR_IGMP_JOIN_XPATH \ + "./frr-igmp:igmp/address-family[address-family='%s']/" \ + "static-group[group-addr='%s'][source-addr='%s']" +#endif /* _FRR_PIM_NB_H_ */ diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c new file mode 100644 index 0000000000..ba044de2f8 --- /dev/null +++ b/pimd/pim_nb_config.c @@ -0,0 +1,3050 @@ +/* + * Copyright (C) 2020 VmWare + * Sarita Patra + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "pimd.h" +#include "pim_nb.h" +#include "lib/northbound_cli.h" +#include "pim_igmpv3.h" +#include "pim_pim.h" +#include "pim_mlag.h" +#include "pim_bfd.h" +#include "pim_static.h" +#include "pim_ssm.h" +#include "pim_ssmpingd.h" +#include "pim_vxlan.h" +#include "log.h" +#include "lib_errors.h" + +static void pim_if_membership_clear(struct interface *ifp) +{ + struct pim_interface *pim_ifp; + + pim_ifp = ifp->info; + zassert(pim_ifp); + + if (PIM_IF_TEST_PIM(pim_ifp->options) + && PIM_IF_TEST_IGMP(pim_ifp->options)) { + return; + } + + pim_ifchannel_membership_clear(ifp); +} + +/* + * When PIM is disabled on interface, IGMPv3 local membership + * information is not injected into PIM interface state. + + * The function pim_if_membership_refresh() fetches all IGMPv3 local + * membership information into PIM. It is intented to be called + * whenever PIM is enabled on the interface in order to collect missed + * local membership information. + */ +static void pim_if_membership_refresh(struct interface *ifp) +{ + struct pim_interface *pim_ifp; + struct listnode *sock_node; + struct igmp_sock *igmp; + + pim_ifp = ifp->info; + zassert(pim_ifp); + + if (!PIM_IF_TEST_PIM(pim_ifp->options)) + return; + if (!PIM_IF_TEST_IGMP(pim_ifp->options)) + return; + + /* + * First clear off membership from all PIM (S,G) entries on the + * interface + */ + + pim_ifchannel_membership_clear(ifp); + + /* + * Then restore PIM (S,G) membership from all IGMPv3 (S,G) entries on + * the interface + */ + + /* scan igmp sockets */ + for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { + struct listnode *grpnode; + struct igmp_group *grp; + + /* scan igmp groups */ + for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list, grpnode, + grp)) { + struct listnode *srcnode; + struct igmp_source *src; + + /* scan group sources */ + for (ALL_LIST_ELEMENTS_RO(grp->group_source_list, + srcnode, src)) { + + if (IGMP_SOURCE_TEST_FORWARDING( + src->source_flags)) { + struct prefix_sg sg; + + memset(&sg, 0, + sizeof(struct prefix_sg)); + sg.src = src->source_addr; + sg.grp = grp->group_addr; + pim_ifchannel_local_membership_add( + ifp, &sg, false /*is_vxlan*/); + } + + } /* scan group sources */ + } /* scan igmp groups */ + } /* scan igmp sockets */ + + /* + * Finally delete every PIM (S,G) entry lacking all state info + */ + + pim_ifchannel_delete_on_noinfo(ifp); +} + +static int pim_cmd_interface_add(struct interface *ifp) +{ + struct pim_interface *pim_ifp = ifp->info; + + if (!pim_ifp) + pim_ifp = pim_if_new(ifp, false, true, false, false); + else + PIM_IF_DO_PIM(pim_ifp->options); + + pim_if_addr_add_all(ifp); + pim_if_membership_refresh(ifp); + + pim_if_create_pimreg(pim_ifp->pim); + return 1; +} + +static int pim_cmd_interface_delete(struct interface *ifp) +{ + struct pim_interface *pim_ifp = ifp->info; + + if (!pim_ifp) + return 1; + + PIM_IF_DONT_PIM(pim_ifp->options); + + pim_if_membership_clear(ifp); + + /* + * pim_sock_delete() removes all neighbors from + * pim_ifp->pim_neighbor_list. + */ + pim_sock_delete(ifp, "pim unconfigured on interface"); + + if (!PIM_IF_TEST_IGMP(pim_ifp->options)) { + pim_if_addr_del_all(ifp); + pim_if_delete(ifp); + } + + return 1; +} + +static int interface_pim_use_src_cmd_worker(struct interface *ifp, + struct in_addr source_addr, + char *errmsg, size_t errmsg_len) +{ + int result; + int ret = NB_OK; + + result = pim_update_source_set(ifp, source_addr); + + switch (result) { + case PIM_SUCCESS: + break; + case PIM_IFACE_NOT_FOUND: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "Pim not enabled on this interface %s", + ifp->name); + break; + case PIM_UPDATE_SOURCE_DUP: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, "Source already set"); + break; + default: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, "Source set failed"); + } + + return ret; +} + +static int pim_cmd_spt_switchover(struct pim_instance *pim, + enum pim_spt_switchover spt, + const char *plist) +{ + pim->spt.switchover = spt; + + switch (pim->spt.switchover) { + case PIM_SPT_IMMEDIATE: + XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist); + + pim_upstream_add_lhr_star_pimreg(pim); + break; + case PIM_SPT_INFINITY: + pim_upstream_remove_lhr_star_pimreg(pim, plist); + + XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist); + + if (plist) + pim->spt.plist = XSTRDUP(MTYPE_PIM_PLIST_NAME, plist); + break; + } + + return NB_OK; +} + +static int pim_ssm_cmd_worker(struct pim_instance *pim, const char *plist, + char *errmsg, size_t errmsg_len) +{ + int result = pim_ssm_range_set(pim, pim->vrf_id, plist); + int ret = NB_ERR; + + if (result == PIM_SSM_ERR_NONE) + return NB_OK; + + switch (result) { + case PIM_SSM_ERR_NO_VRF: + snprintf(errmsg, errmsg_len, + "VRF doesn't exist"); + break; + case PIM_SSM_ERR_DUP: + snprintf(errmsg, errmsg_len, + "duplicate config"); + break; + default: + snprintf(errmsg, errmsg_len, + "ssm range config failed"); + } + + return ret; +} + +static int ip_no_msdp_mesh_group_cmd_worker(struct pim_instance *pim, + const char *mg, + char *errmsg, size_t errmsg_len) +{ + enum pim_msdp_err result; + + result = pim_msdp_mg_del(pim, mg); + + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_NO_MG: + snprintf(errmsg, errmsg_len, + "%% mesh-group does not exist"); + break; + default: + snprintf(errmsg, errmsg_len, + "mesh-group source del failed"); + } + + return result ? NB_ERR : NB_OK; +} + +static int ip_msdp_mesh_group_member_cmd_worker(struct pim_instance *pim, + const char *mg, + struct in_addr mbr_ip, + char *errmsg, size_t errmsg_len) +{ + enum pim_msdp_err result; + int ret = NB_OK; + + result = pim_msdp_mg_mbr_add(pim, mg, mbr_ip); + + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_OOM: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% Out of memory"); + break; + case PIM_MSDP_ERR_MG_MBR_EXISTS: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% mesh-group member exists"); + break; + case PIM_MSDP_ERR_MAX_MESH_GROUPS: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% Only one mesh-group allowed currently"); + break; + default: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% member add failed"); + } + + return ret; +} + +static int ip_no_msdp_mesh_group_member_cmd_worker(struct pim_instance *pim, + const char *mg, + struct in_addr mbr_ip, + char *errmsg, + size_t errmsg_len) +{ + enum pim_msdp_err result; + + result = pim_msdp_mg_mbr_del(pim, mg, mbr_ip); + + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_NO_MG: + snprintf(errmsg, errmsg_len, + "%% mesh-group does not exist"); + break; + case PIM_MSDP_ERR_NO_MG_MBR: + snprintf(errmsg, errmsg_len, + "%% mesh-group member does not exist"); + break; + default: + snprintf(errmsg, errmsg_len, + "%% mesh-group member del failed"); + } + + return result ? NB_ERR : NB_OK; +} + +static int ip_msdp_mesh_group_source_cmd_worker(struct pim_instance *pim, + const char *mg, + struct in_addr src_ip, + char *errmsg, size_t errmsg_len) +{ + enum pim_msdp_err result; + + result = pim_msdp_mg_src_add(pim, mg, src_ip); + + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_OOM: + snprintf(errmsg, errmsg_len, + "%% Out of memory"); + break; + case PIM_MSDP_ERR_MAX_MESH_GROUPS: + snprintf(errmsg, errmsg_len, + "%% Only one mesh-group allowed currently"); + break; + default: + snprintf(errmsg, errmsg_len, + "%% source add failed"); + } + + return result ? NB_ERR : NB_OK; +} + +static int ip_no_msdp_mesh_group_source_cmd_worker(struct pim_instance *pim, + const char *mg, + char *errmsg, + size_t errmsg_len) +{ + enum pim_msdp_err result; + + result = pim_msdp_mg_src_del(pim, mg); + + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_NO_MG: + snprintf(errmsg, errmsg_len, + "%% mesh-group does not exist"); + break; + default: + snprintf(errmsg, errmsg_len, + "%% mesh-group source del failed"); + } + + return result ? NB_ERR : NB_OK; +} + +static int ip_msdp_peer_cmd_worker(struct pim_instance *pim, + struct in_addr peer_addr, + struct in_addr local_addr, + char *errmsg, size_t errmsg_len) +{ + enum pim_msdp_err result; + int ret = NB_OK; + + result = pim_msdp_peer_add(pim, peer_addr, local_addr, "default", + NULL /* mp_p */); + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_OOM: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% Out of memory"); + break; + case PIM_MSDP_ERR_PEER_EXISTS: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% Peer exists"); + break; + case PIM_MSDP_ERR_MAX_MESH_GROUPS: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% Only one mesh-group allowed currently"); + break; + default: + ret = NB_ERR; + snprintf(errmsg, errmsg_len, + "%% peer add failed"); + } + + return ret; +} + +static int ip_no_msdp_peer_cmd_worker(struct pim_instance *pim, + struct in_addr peer_addr, + char *errmsg, size_t errmsg_len) +{ + enum pim_msdp_err result; + + result = pim_msdp_peer_del(pim, peer_addr); + switch (result) { + case PIM_MSDP_ERR_NONE: + break; + case PIM_MSDP_ERR_NO_PEER: + snprintf(errmsg, errmsg_len, + "%% Peer does not exist"); + break; + default: + snprintf(errmsg, errmsg_len, + "%% peer del failed"); + } + + return result ? NB_ERR : NB_OK; +} + +static int pim_rp_cmd_worker(struct pim_instance *pim, + struct in_addr rp_addr, + struct prefix group, const char *plist, + char *errmsg, size_t errmsg_len) +{ + char rp_str[INET_ADDRSTRLEN]; + int result; + + inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str)); + + result = pim_rp_new(pim, rp_addr, group, plist, RP_SRC_STATIC); + + if (result == PIM_RP_NO_PATH) { + snprintf(errmsg, errmsg_len, + "No Path to RP address specified: %s", rp_str); + return NB_ERR_INCONSISTENCY; + } + + if (result == PIM_GROUP_OVERLAP) { + snprintf(errmsg, errmsg_len, + "Group range specified cannot exact match another"); + return NB_ERR_INCONSISTENCY; + } + + if (result == PIM_GROUP_PFXLIST_OVERLAP) { + snprintf(errmsg, errmsg_len, + "This group is already covered by a RP prefix-list"); + return NB_ERR_INCONSISTENCY; + } + + if (result == PIM_RP_PFXLIST_IN_USE) { + snprintf(errmsg, errmsg_len, + "The same prefix-list cannot be applied to multiple RPs"); + return NB_ERR_INCONSISTENCY; + } + + return NB_OK; +} + +static int pim_no_rp_cmd_worker(struct pim_instance *pim, + struct in_addr rp_addr, struct prefix group, + const char *plist, + char *errmsg, size_t errmsg_len) +{ + char rp_str[INET_ADDRSTRLEN]; + char group_str[PREFIX2STR_BUFFER]; + int result; + + inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str)); + prefix2str(&group, group_str, sizeof(group_str)); + + result = pim_rp_del(pim, rp_addr, group, plist, RP_SRC_STATIC); + + if (result == PIM_GROUP_BAD_ADDRESS) { + snprintf(errmsg, errmsg_len, + "Bad group address specified: %s", group_str); + return NB_ERR_INCONSISTENCY; + } + + if (result == PIM_RP_BAD_ADDRESS) { + snprintf(errmsg, errmsg_len, + "Bad RP address specified: %s", rp_str); + return NB_ERR_INCONSISTENCY; + } + + if (result == PIM_RP_NOT_FOUND) { + snprintf(errmsg, errmsg_len, + "Unable to find specified RP"); + return NB_ERR_INCONSISTENCY; + } + + return NB_OK; +} + +static bool is_pim_interface(const struct lyd_node *dnode) +{ + char if_xpath[XPATH_MAXLEN]; + const struct lyd_node *pim_enable_dnode; + const struct lyd_node *igmp_enable_dnode; + + yang_dnode_get_path(dnode, if_xpath, sizeof(if_xpath)); + pim_enable_dnode = yang_dnode_get(dnode, "%s/frr-pim:pim/pim-enable", + if_xpath); + igmp_enable_dnode = yang_dnode_get(dnode, + "%s/frr-igmp:igmp/igmp-enable", + if_xpath); + + if (((pim_enable_dnode) && + (yang_dnode_get_bool(pim_enable_dnode, "."))) || + ((igmp_enable_dnode) && + (yang_dnode_get_bool(igmp_enable_dnode, ".")))) + return true; + + return false; +} + +static int pim_cmd_igmp_start(struct interface *ifp) +{ + struct pim_interface *pim_ifp; + uint8_t need_startup = 0; + + pim_ifp = ifp->info; + + if (!pim_ifp) { + (void)pim_if_new(ifp, true, false, false, false); + need_startup = 1; + } else { + if (!PIM_IF_TEST_IGMP(pim_ifp->options)) { + PIM_IF_DO_IGMP(pim_ifp->options); + need_startup = 1; + } + } + + /* 'ip igmp' executed multiple times, with need_startup + * avoid multiple if add all and membership refresh + */ + if (need_startup) { + pim_if_addr_add_all(ifp); + pim_if_membership_refresh(ifp); + } + + return NB_OK; +} + +/* + * CLI reconfiguration affects the interface level (struct pim_interface). + * This function propagates the reconfiguration to every active socket + * for that interface. + */ +static void igmp_sock_query_interval_reconfig(struct igmp_sock *igmp) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + zassert(igmp); + + /* other querier present? */ + + if (igmp->t_other_querier_timer) + return; + + /* this is the querier */ + + zassert(igmp->interface); + zassert(igmp->interface->info); + + ifp = igmp->interface; + pim_ifp = ifp->info; + + if (PIM_DEBUG_IGMP_TRACE) { + char ifaddr_str[INET_ADDRSTRLEN]; + + pim_inet4_dump("<ifaddr?>", igmp->ifaddr, ifaddr_str, + sizeof(ifaddr_str)); + zlog_debug("%s: Querier %s on %s reconfig query_interval=%d", + __func__, ifaddr_str, ifp->name, + pim_ifp->igmp_default_query_interval); + } + + /* + * igmp_startup_mode_on() will reset QQI: + + * igmp->querier_query_interval = pim_ifp->igmp_default_query_interval; + */ + igmp_startup_mode_on(igmp); +} + +static void igmp_sock_query_reschedule(struct igmp_sock *igmp) +{ + if (igmp->mtrace_only) + return; + + if (igmp->t_igmp_query_timer) { + /* other querier present */ + zassert(igmp->t_igmp_query_timer); + zassert(!igmp->t_other_querier_timer); + + pim_igmp_general_query_off(igmp); + pim_igmp_general_query_on(igmp); + + zassert(igmp->t_igmp_query_timer); + zassert(!igmp->t_other_querier_timer); + } else { + /* this is the querier */ + + zassert(!igmp->t_igmp_query_timer); + zassert(igmp->t_other_querier_timer); + + pim_igmp_other_querier_timer_off(igmp); + pim_igmp_other_querier_timer_on(igmp); + + zassert(!igmp->t_igmp_query_timer); + zassert(igmp->t_other_querier_timer); + } +} + +static void change_query_interval(struct pim_interface *pim_ifp, + int query_interval) +{ + struct listnode *sock_node; + struct igmp_sock *igmp; + + pim_ifp->igmp_default_query_interval = query_interval; + + for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { + igmp_sock_query_interval_reconfig(igmp); + igmp_sock_query_reschedule(igmp); + } +} + +static void change_query_max_response_time(struct pim_interface *pim_ifp, + int query_max_response_time_dsec) +{ + struct listnode *sock_node; + struct igmp_sock *igmp; + + pim_ifp->igmp_query_max_response_time_dsec = + query_max_response_time_dsec; + + /* + * Below we modify socket/group/source timers in order to quickly + * reflect the change. Otherwise, those timers would args->eventually + * catch up. + */ + + /* scan all sockets */ + for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, igmp)) { + struct listnode *grp_node; + struct igmp_group *grp; + + /* reschedule socket general query */ + igmp_sock_query_reschedule(igmp); + + /* scan socket groups */ + for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list, grp_node, + grp)) { + struct listnode *src_node; + struct igmp_source *src; + + /* reset group timers for groups in EXCLUDE mode */ + if (grp->group_filtermode_isexcl) + igmp_group_reset_gmi(grp); + + /* scan group sources */ + for (ALL_LIST_ELEMENTS_RO(grp->group_source_list, + src_node, src)) { + + /* reset source timers for sources with running + * timers + */ + if (src->t_source_timer) + igmp_source_reset_gmi(igmp, grp, src); + } + } + } +} + +int routing_control_plane_protocols_name_validate( + struct nb_cb_create_args *args) +{ + const char *name; + + name = yang_dnode_get_string(args->dnode, "./name"); + if (!strmatch(name, "pim")) { + snprintf(args->errmsg, args->errmsg_len, + "pim supports only one instance with name pimd"); + return NB_ERR_VALIDATION; + } + return NB_OK; +} + +/* + * XPath: /frr-pim:pim/packets + */ +int pim_packets_modify(struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + router->packet_process = yang_dnode_get_uint8(args->dnode, + NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-pim:pim/join-prune-interval + */ +int pim_join_prune_interval_modify(struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + router->t_periodic = yang_dnode_get_uint16(args->dnode, NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-pim:pim/register-suppress-time + */ +int pim_register_suppress_time_modify(struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->keep_alive_time = yang_dnode_get_uint16(args->dnode, NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/ecmp + */ +int routing_control_plane_protocols_control_plane_protocol_pim_ecmp_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->ecmp_enable = yang_dnode_get_bool(args->dnode, NULL); + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/ecmp-rebalance + */ +int routing_control_plane_protocols_control_plane_protocol_pim_ecmp_rebalance_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->ecmp_rebalance_enable = + yang_dnode_get_bool(args->dnode, NULL); + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/keep-alive-timer + */ +int routing_control_plane_protocols_control_plane_protocol_pim_keep_alive_timer_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->keep_alive_time = yang_dnode_get_uint16(args->dnode, NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/rp-keep-alive-timer + */ +int routing_control_plane_protocols_control_plane_protocol_pim_rp_keep_alive_timer_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->rp_keep_alive_time = yang_dnode_get_uint16(args->dnode, + NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + /* TODO: implement me. */ + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/send-v6-secondary + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + pim->send_v6_secondary = yang_dnode_get_bool(args->dnode, NULL); + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_send_v6_secondary_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover + */ +void routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + int spt_switch_action; + const char *prefix_list = NULL; + + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + spt_switch_action = yang_dnode_get_enum(args->dnode, "./spt-action"); + + switch (spt_switch_action) { + case PIM_SPT_INFINITY: + if (yang_dnode_exists(args->dnode, + "./spt-infinity-prefix-list")) + prefix_list = yang_dnode_get_string( + args->dnode, "./spt-infinity-prefix-list"); + + pim_cmd_spt_switchover(pim, PIM_SPT_INFINITY, + prefix_list); + break; + case PIM_SPT_IMMEDIATE: + pim_cmd_spt_switchover(pim, PIM_SPT_IMMEDIATE, NULL); + } +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover/spt-action + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_action_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/spt-switchover/spt-infinity-prefix-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_spt_switchover_spt_infinity_prefix_list_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/ssm-prefix-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *plist_name; + int result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + plist_name = yang_dnode_get_string(args->dnode, NULL); + result = pim_ssm_cmd_worker(pim, plist_name, args->errmsg, + args->errmsg_len); + + if (result) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_prefix_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + int result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + result = pim_ssm_cmd_worker(pim, NULL, args->errmsg, + args->errmsg_len); + + if (result) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/ssm-pingd-source-ip + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_create( + struct nb_cb_create_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + int result; + struct ipaddr source_addr; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&source_addr, args->dnode, NULL); + result = pim_ssmpingd_start(pim, source_addr.ip._v4_addr); + if (result) { + char source_str[INET_ADDRSTRLEN]; + + ipaddr2str(&source_addr, source_str, + sizeof(source_str)); + snprintf(args->errmsg, args->errmsg_len, + "%% Failure starting ssmpingd for source %s: %d", + source_str, result); + return NB_ERR_INCONSISTENCY; + } + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ssm_pingd_source_ip_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + int result; + struct ipaddr source_addr; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&source_addr, args->dnode, NULL); + result = pim_ssmpingd_stop(pim, source_addr.ip._v4_addr); + if (result) { + char source_str[INET_ADDRSTRLEN]; + + ipaddr2str(&source_addr, source_str, + sizeof(source_str)); + snprintf(args->errmsg, args->errmsg_len, + "%% Failure stopping ssmpingd for source %s: %d", + source_str, result); + return NB_ERR_INCONSISTENCY; + } + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *mesh_group_name; + int result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + mesh_group_name = yang_dnode_get_string(args->dnode, "."); + + result = ip_no_msdp_mesh_group_cmd_worker(pim, mesh_group_name, + args->errmsg, + args->errmsg_len); + + if (result != PIM_MSDP_ERR_NONE) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/mesh-group-name + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_modify( + struct nb_cb_modify_args *args) +{ + const char *mesh_group_name; + const char *mesh_group_name_old; + char xpath[XPATH_MAXLEN]; + + switch (args->event) { + case NB_EV_VALIDATE: + mesh_group_name = yang_dnode_get_string(args->dnode, "."); + yang_dnode_get_path(args->dnode, xpath, sizeof(xpath)); + + if (yang_dnode_exists(running_config->dnode, xpath) == false) + break; + + mesh_group_name_old = yang_dnode_get_string( + running_config->dnode, + xpath); + if (strcmp(mesh_group_name, mesh_group_name_old)) { + /* currently only one mesh-group can exist at a time */ + snprintf(args->errmsg, args->errmsg_len, + "Only one mesh-group allowed currently"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_mesh_group_name_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/member-ip + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_create( + struct nb_cb_create_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *mesh_group_name; + struct ipaddr mbr_ip; + enum pim_msdp_err result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + mesh_group_name = yang_dnode_get_string(args->dnode, + "../mesh-group-name"); + yang_dnode_get_ip(&mbr_ip, args->dnode, NULL); + + result = ip_msdp_mesh_group_member_cmd_worker( + pim, mesh_group_name, mbr_ip.ip._v4_addr, + args->errmsg, args->errmsg_len); + + if (result != PIM_MSDP_ERR_NONE) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_member_ip_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *mesh_group_name; + struct ipaddr mbr_ip; + enum pim_msdp_err result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + mesh_group_name = yang_dnode_get_string(args->dnode, + "../mesh-group-name"); + yang_dnode_get_ip(&mbr_ip, args->dnode, NULL); + + result = ip_no_msdp_mesh_group_member_cmd_worker( + pim, mesh_group_name, mbr_ip.ip._v4_addr, + args->errmsg, args->errmsg_len); + + if (result != PIM_MSDP_ERR_NONE) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-mesh-group/source-ip + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *mesh_group_name; + struct ipaddr src_ip; + enum pim_msdp_err result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + mesh_group_name = yang_dnode_get_string(args->dnode, + "../mesh-group-name"); + yang_dnode_get_ip(&src_ip, args->dnode, NULL); + + result = ip_msdp_mesh_group_source_cmd_worker( + pim, mesh_group_name, src_ip.ip._v4_addr, + args->errmsg, args->errmsg_len); + + if (result != PIM_MSDP_ERR_NONE) + return NB_ERR_INCONSISTENCY; + + break; + } + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_mesh_group_source_ip_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *mesh_group_name; + enum pim_msdp_err result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + mesh_group_name = yang_dnode_get_string(args->dnode, + "../mesh-group-name"); + + result = ip_no_msdp_mesh_group_source_cmd_worker( + pim, mesh_group_name, args->errmsg, + args->errmsg_len); + + if (result != PIM_MSDP_ERR_NONE) + return NB_ERR_INCONSISTENCY; + + break; + } + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-peer + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_destroy( + struct nb_cb_destroy_args *args) +{ + int result; + struct pim_instance *pim; + struct ipaddr peer_ip; + struct vrf *vrf; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&peer_ip, args->dnode, "./peer-ip"); + result = ip_no_msdp_peer_cmd_worker(pim, peer_ip.ip._v4_addr, + args->errmsg, + args->errmsg_len); + + if (result) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/msdp-peer/source-ip + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_modify( + struct nb_cb_modify_args *args) +{ + int result; + struct vrf *vrf; + struct pim_instance *pim; + struct ipaddr peer_ip; + struct ipaddr source_ip; + const struct lyd_node *mesh_group_name_dnode; + const char *mesh_group_name; + + switch (args->event) { + case NB_EV_VALIDATE: + mesh_group_name_dnode = + yang_dnode_get(args->dnode, + "../../msdp-mesh-group/mesh-group-name"); + if (mesh_group_name_dnode) { + mesh_group_name = + yang_dnode_get_string(mesh_group_name_dnode, + "."); + if (strcmp(mesh_group_name, "default")) { + /* currently only one mesh-group can exist at a + * time + */ + snprintf(args->errmsg, args->errmsg_len, + "%% Only one mesh-group allowed currently"); + return NB_ERR_VALIDATION; + } + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&peer_ip, args->dnode, "../peer-ip"); + yang_dnode_get_ip(&source_ip, args->dnode, NULL); + + result = ip_msdp_peer_cmd_worker(pim, peer_ip.ip._v4_addr, + source_ip.ip._v4_addr, + args->errmsg, + args->errmsg_len); + + if (result) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_msdp_peer_source_ip_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_destroy( + struct nb_cb_destroy_args *args) +{ + struct in_addr addr; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + addr.s_addr = 0; + pim_vxlan_mlag_update(true/*mlag_enable*/, + false/*peer_state*/, MLAG_ROLE_NONE, + NULL/*peerlink*/, &addr); + } + + return NB_OK; +} + +/* + * XPath: + * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag + */ +void routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + const char *ifname; + uint32_t role; + bool peer_state; + struct interface *ifp; + struct ipaddr reg_addr; + + ifname = yang_dnode_get_string(args->dnode, "./peerlink-rif"); + ifp = if_lookup_by_name(ifname, VRF_DEFAULT); + if (!ifp) { + snprintf(args->errmsg, args->errmsg_len, + "No such interface name %s", ifname); + return; + } + role = yang_dnode_get_enum(args->dnode, "./my-role"); + peer_state = yang_dnode_get_bool(args->dnode, "./peer-state"); + yang_dnode_get_ip(®_addr, args->dnode, "./reg-address"); + + pim_vxlan_mlag_update(true, peer_state, role, ifp, + ®_addr.ip._v4_addr); +} + + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/peerlink-rif + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peerlink_rif_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/reg-address + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_reg_address_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/my-role + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_my_role_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/mlag/peer-state + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_mlag_peer_state_modify( + struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/register-accept-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + const char *plist; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + plist = yang_dnode_get_string(args->dnode, NULL); + + XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist); + pim->register_plist = XSTRDUP(MTYPE_PIM_PLIST_NAME, plist); + + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_register_accept_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + + XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim + */ +int lib_interface_pim_create(struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_pim_destroy(struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + if (!pim_ifp) + return NB_OK; + + if (!pim_cmd_interface_delete(ifp)) { + snprintf(args->errmsg, args->errmsg_len, + "Unable to delete interface information %s", + ifp->name); + return NB_ERR_INCONSISTENCY; + } + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/pim-enable + */ +int lib_interface_pim_pim_enable_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int mcast_if_count; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + mcast_if_count = + yang_get_list_elements_count(if_dnode); + + /* Limiting mcast interfaces to number of VIFs */ + if (mcast_if_count == MAXVIFS) { + snprintf(args->errmsg, args->errmsg_len, + "Max multicast interfaces(%d) reached.", + MAXVIFS); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + + if (yang_dnode_get_bool(args->dnode, NULL)) { + if (!pim_cmd_interface_add(ifp)) { + snprintf(args->errmsg, args->errmsg_len, + "Could not enable PIM SM on interface %s", + ifp->name); + return NB_ERR_INCONSISTENCY; + } + } else { + pim_ifp = ifp->info; + if (!pim_ifp) + return NB_ERR_INCONSISTENCY; + + if (!pim_cmd_interface_delete(ifp)) { + snprintf(args->errmsg, args->errmsg_len, + "Unable to delete interface information"); + return NB_ERR_INCONSISTENCY; + } + } + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/hello-interval + */ +int lib_interface_pim_hello_interval_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->pim_hello_period = + yang_dnode_get_uint8(args->dnode, NULL); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/hello-holdtime + */ +int lib_interface_pim_hello_holdtime_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->pim_default_holdtime = + yang_dnode_get_uint8(args->dnode, NULL); + break; + } + + return NB_OK; + +} + +int lib_interface_pim_hello_holdtime_destroy(struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->pim_default_holdtime = -1; + break; + } + + return NB_OK; +} +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bfd + */ +int lib_interface_pim_bfd_create(struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_pim_bfd_destroy(struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "Pim not enabled on this interface"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode->parent, NULL, true); + pim_ifp = ifp->info; + if (pim_ifp->bfd_info) { + pim_bfd_reg_dereg_all_nbr(ifp, + ZEBRA_BFD_DEST_DEREGISTER); + bfd_info_free(&(pim_ifp->bfd_info)); + } + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bfd + */ +void lib_interface_pim_bfd_apply_finish(struct nb_cb_apply_finish_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + uint32_t min_rx; + uint32_t min_tx; + uint8_t detect_mult; + + ifp = nb_running_get_entry(args->dnode->parent, NULL, true); + pim_ifp = ifp->info; + + if (!pim_ifp) { + zlog_debug("Pim not enabled on this interface"); + return; + } + + min_rx = yang_dnode_get_uint16(args->dnode, "./min-rx-interval"); + min_tx = yang_dnode_get_uint16(args->dnode, "./min-tx-interval"); + detect_mult = yang_dnode_get_uint8(args->dnode, "./detect_mult"); + + if ((min_rx == BFD_DEF_MIN_RX) && (min_tx == BFD_DEF_MIN_TX) + && (detect_mult == BFD_DEF_DETECT_MULT)) + pim_bfd_if_param_set(ifp, min_rx, min_tx, detect_mult, 1); + else + pim_bfd_if_param_set(ifp, min_rx, min_tx, detect_mult, 0); + + nb_running_set_entry(args->dnode, pim_ifp->bfd_info); +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bfd/min-rx-interval + */ +int lib_interface_pim_bfd_min_rx_interval_modify(struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bfd/min-tx-interval + */ +int lib_interface_pim_bfd_min_tx_interval_modify(struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bfd/detect_mult + */ +int lib_interface_pim_bfd_detect_mult_modify(struct nb_cb_modify_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/bsm + */ +int lib_interface_pim_bsm_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->bsm_enable = yang_dnode_get_bool(args->dnode, NULL); + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/unicast-bsm + */ +int lib_interface_pim_unicast_bsm_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->ucast_bsm_accept = + yang_dnode_get_bool(args->dnode, NULL); + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/active-active + */ +int lib_interface_pim_active_active_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + if (yang_dnode_get_bool(args->dnode, NULL)) { + if (PIM_DEBUG_MLAG) + zlog_debug( + "Configuring PIM active-active on Interface: %s", + ifp->name); + pim_if_configure_mlag_dualactive(pim_ifp); + } else { + if (PIM_DEBUG_MLAG) + zlog_debug( + "UnConfiguring PIM active-active on Interface: %s", + ifp->name); + pim_if_unconfigure_mlag_dualactive(pim_ifp); + } + + break; + } + + return NB_OK; + +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/dr-priority + */ +int lib_interface_pim_dr_priority_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + uint32_t old_dr_prio; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "Pim not enabled on this interface"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + old_dr_prio = pim_ifp->pim_dr_priority; + pim_ifp->pim_dr_priority = yang_dnode_get_uint32(args->dnode, + NULL); + + if (old_dr_prio != pim_ifp->pim_dr_priority) { + pim_if_dr_election(ifp); + pim_hello_restart_now(ifp); + } + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family + */ +int lib_interface_pim_address_family_create(struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_pim_address_family_destroy(struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family/use-source + */ +int lib_interface_pim_address_family_use_source_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct ipaddr source_addr; + int result; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "Pim not enabled on this interface"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + yang_dnode_get_ip(&source_addr, args->dnode, NULL); + + result = interface_pim_use_src_cmd_worker( + ifp, source_addr.ip._v4_addr, + args->errmsg, args->errmsg_len); + + if (result != PIM_SUCCESS) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +int lib_interface_pim_address_family_use_source_destroy( + struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct in_addr source_addr = {INADDR_ANY}; + int result; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "Pim not enabled on this interface"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + + result = interface_pim_use_src_cmd_worker(ifp, source_addr, + args->errmsg, + args->errmsg_len); + + if (result != PIM_SUCCESS) + return NB_ERR_INCONSISTENCY; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family/multicast-boundary-oil + */ +int lib_interface_pim_address_family_multicast_boundary_oil_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + const char *plist; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "Pim not enabled on this interface"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + plist = yang_dnode_get_string(args->dnode, NULL); + + if (pim_ifp->boundary_oil_plist) + XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); + + pim_ifp->boundary_oil_plist = + XSTRDUP(MTYPE_PIM_INTERFACE, plist); + + break; + } + + return NB_OK; +} + +int lib_interface_pim_address_family_multicast_boundary_oil_destroy( + struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "%% Enable PIM and/or IGMP on this interface first"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_ABORT: + case NB_EV_PREPARE: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + if (pim_ifp->boundary_oil_plist) + XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family/mroute + */ +int lib_interface_pim_address_family_mroute_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_pim_address_family_mroute_destroy( + struct nb_cb_destroy_args *args) +{ + struct pim_instance *pim; + struct pim_interface *pim_iifp; + struct interface *iif; + struct interface *oif; + const char *oifname; + struct ipaddr source_addr; + struct ipaddr group_addr; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "%% Enable PIM and/or IGMP on this interface first"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + iif = nb_running_get_entry(args->dnode, NULL, true); + pim_iifp = iif->info; + pim = pim_iifp->pim; + + oifname = yang_dnode_get_string(args->dnode, "./oif"); + oif = if_lookup_by_name(oifname, pim->vrf_id); + + if (!oif) { + snprintf(args->errmsg, args->errmsg_len, + "No such interface name %s", + oifname); + return NB_ERR_INCONSISTENCY; + } + + yang_dnode_get_ip(&source_addr, args->dnode, "./source-addr"); + yang_dnode_get_ip(&group_addr, args->dnode, "./group-addr"); + + if (pim_static_del(pim, iif, oif, group_addr.ip._v4_addr, + source_addr.ip._v4_addr)) { + snprintf(args->errmsg, args->errmsg_len, + "Failed to remove static mroute"); + return NB_ERR_INCONSISTENCY; + } + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-pim:pim/address-family/mroute/oif + */ +int lib_interface_pim_address_family_mroute_oif_modify( + struct nb_cb_modify_args *args) +{ + struct pim_instance *pim; + struct pim_interface *pim_iifp; + struct interface *iif; + struct interface *oif; + const char *oifname; + struct ipaddr source_addr; + struct ipaddr group_addr; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + snprintf(args->errmsg, args->errmsg_len, + "%% Enable PIM and/or IGMP on this interface first"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + iif = nb_running_get_entry(args->dnode, NULL, true); + pim_iifp = iif->info; + pim = pim_iifp->pim; + + oifname = yang_dnode_get_string(args->dnode, NULL); + oif = if_lookup_by_name(oifname, pim->vrf_id); + + if (!oif) { + snprintf(args->errmsg, args->errmsg_len, + "No such interface name %s", + oifname); + return NB_ERR_INCONSISTENCY; + } + + yang_dnode_get_ip(&source_addr, args->dnode, "../source-addr"); + yang_dnode_get_ip(&group_addr, args->dnode, "../group-addr"); + + if (pim_static_add(pim, iif, oif, group_addr.ip._v4_addr, + source_addr.ip._v4_addr)) { + snprintf(args->errmsg, args->errmsg_len, + "Failed to add static mroute"); + return NB_ERR_INCONSISTENCY; + } + + break; + } + + return NB_OK; +} + +int lib_interface_pim_address_family_mroute_oif_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_create( + struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + struct prefix group; + struct ipaddr rp_addr; + const char *plist; + int result = 0; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&rp_addr, args->dnode, "./rp-address"); + + if (yang_dnode_get(args->dnode, "./group-list")) { + yang_dnode_get_ipv4p(&group, args->dnode, + "./group-list"); + apply_mask_ipv4((struct prefix_ipv4 *)&group); + result = pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, + group, NULL, args->errmsg, + args->errmsg_len); + } + + else if (yang_dnode_get(args->dnode, "./prefix-list")) { + plist = yang_dnode_get_string(args->dnode, + "./prefix-list"); + if (!str2prefix("224.0.0.0/4", &group)) { + flog_err( + EC_LIB_DEVELOPMENT, + "Unable to convert 224.0.0.0/4 to prefix"); + return NB_ERR_INCONSISTENCY; + } + + result = pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, + group, plist, + args->errmsg, + args->errmsg_len); + } + + if (result) + return NB_ERR_INCONSISTENCY; + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list/group-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_create( + struct nb_cb_create_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + struct prefix group; + struct ipaddr rp_addr; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_ipv4p(&group, args->dnode, NULL); + apply_mask_ipv4((struct prefix_ipv4 *)&group); + + return pim_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, + NULL, args->errmsg, args->errmsg_len); + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_group_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + struct prefix group; + struct ipaddr rp_addr; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_ipv4p(&group, args->dnode, NULL); + apply_mask_ipv4((struct prefix_ipv4 *)&group); + + return pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, + NULL, args->errmsg, + args->errmsg_len); + } + + return NB_OK; +} + +/* + * XPath: /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-pim:pim/address-family/frr-pim-rp:rp/static-rp/rp-list/prefix-list + */ +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_modify( + struct nb_cb_modify_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + struct prefix group; + struct ipaddr rp_addr; + const char *plist; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + plist = yang_dnode_get_string(args->dnode, NULL); + yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + if (!str2prefix("224.0.0.0/4", &group)) { + flog_err(EC_LIB_DEVELOPMENT, + "Unable to convert 224.0.0.0/4 to prefix"); + return NB_ERR_INCONSISTENCY; + } + return pim_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, + plist, args->errmsg, args->errmsg_len); + } + + return NB_OK; +} + +int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp_static_rp_rp_list_prefix_list_destroy( + struct nb_cb_destroy_args *args) +{ + struct vrf *vrf; + struct pim_instance *pim; + struct prefix group; + struct ipaddr rp_addr; + const char *plist; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + vrf = nb_running_get_entry(args->dnode, NULL, true); + pim = vrf->info; + yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + plist = yang_dnode_get_string(args->dnode, NULL); + if (!str2prefix("224.0.0.0/4", &group)) { + flog_err(EC_LIB_DEVELOPMENT, + "Unable to convert 224.0.0.0/4 to prefix"); + return NB_ERR_INCONSISTENCY; + } + return pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, + plist, args->errmsg, + args->errmsg_len); + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp + */ +int lib_interface_igmp_create(struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_igmp_destroy(struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + + if (!pim_ifp) + return NB_OK; + + PIM_IF_DONT_IGMP(pim_ifp->options); + + pim_if_membership_clear(ifp); + + pim_if_addr_del_all_igmp(ifp); + + if (!PIM_IF_TEST_PIM(pim_ifp->options)) + pim_if_delete(ifp); + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/igmp-enable + */ +int lib_interface_igmp_igmp_enable_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + bool igmp_enable; + struct pim_interface *pim_ifp; + int mcast_if_count; + const char *ifp_name; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + ifp_name = yang_dnode_get_string(if_dnode, "."); + mcast_if_count = + yang_get_list_elements_count(if_dnode); + /* Limiting mcast interfaces to number of VIFs */ + if (mcast_if_count == MAXVIFS) { + snprintf(args->errmsg, args->errmsg_len, + "Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s", + MAXVIFS, ifp_name); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + igmp_enable = yang_dnode_get_bool(args->dnode, NULL); + + if (igmp_enable) + return pim_cmd_igmp_start(ifp); + + else { + pim_ifp = ifp->info; + + if (!pim_ifp) + return NB_ERR_INCONSISTENCY; + + PIM_IF_DONT_IGMP(pim_ifp->options); + + pim_if_membership_clear(ifp); + + pim_if_addr_del_all_igmp(ifp); + + if (!PIM_IF_TEST_PIM(pim_ifp->options)) + pim_if_delete(ifp); + } + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/version + */ +int lib_interface_igmp_version_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int igmp_version, old_version = 0; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + + if (!pim_ifp) + return NB_ERR_INCONSISTENCY; + + igmp_version = yang_dnode_get_uint8(args->dnode, NULL); + old_version = pim_ifp->igmp_version; + pim_ifp->igmp_version = igmp_version; + + /* Current and new version is different refresh existing + * membership. Going from 3 -> 2 or 2 -> 3. + */ + if (old_version != igmp_version) + pim_if_membership_refresh(ifp); + + break; + } + + return NB_OK; +} + +int lib_interface_igmp_version_destroy(struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + pim_ifp->igmp_version = IGMP_DEFAULT_VERSION; + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/query-interval + */ +int lib_interface_igmp_query_interval_modify(struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int query_interval; + int query_interval_dsec; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + query_interval = yang_dnode_get_uint16(args->dnode, NULL); + query_interval_dsec = 10 * query_interval; + if (query_interval_dsec <= + pim_ifp->igmp_query_max_response_time_dsec) { + snprintf(args->errmsg, args->errmsg_len, + "Can't set general query interval %d dsec <= query max response time %d dsec.", + query_interval_dsec, + pim_ifp->igmp_query_max_response_time_dsec); + return NB_ERR_INCONSISTENCY; + } + change_query_interval(pim_ifp, query_interval); + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/query-max-response-time + */ +int lib_interface_igmp_query_max_response_time_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int query_max_response_time_dsec; + int default_query_interval_dsec; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + query_max_response_time_dsec = + yang_dnode_get_uint8(args->dnode, NULL); + default_query_interval_dsec = + 10 * pim_ifp->igmp_default_query_interval; + + if (query_max_response_time_dsec + >= default_query_interval_dsec) { + snprintf(args->errmsg, args->errmsg_len, + "Can't set query max response time %d sec >= general query interval %d sec", + query_max_response_time_dsec, + pim_ifp->igmp_default_query_interval); + return NB_ERR_INCONSISTENCY; + } + + change_query_max_response_time(pim_ifp, + query_max_response_time_dsec); + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/last-member-query-interval + */ +int lib_interface_igmp_last_member_query_interval_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int last_member_query_interval; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + last_member_query_interval = yang_dnode_get_uint8(args->dnode, + NULL); + pim_ifp->igmp_specific_query_max_response_time_dsec = + last_member_query_interval; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/robustness-variable + */ +int lib_interface_igmp_robustness_variable_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct pim_interface *pim_ifp; + int last_member_query_count; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + pim_ifp = ifp->info; + last_member_query_count = yang_dnode_get_uint8(args->dnode, + NULL); + pim_ifp->igmp_last_member_query_count = last_member_query_count; + + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/address-family + */ +int lib_interface_igmp_address_family_create(struct nb_cb_create_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +int lib_interface_igmp_address_family_destroy(struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + case NB_EV_APPLY: + break; + } + + return NB_OK; +} + +/* + * XPath: /frr-interface:lib/interface/frr-igmp:igmp/address-family/static-group + */ +int lib_interface_igmp_address_family_static_group_create( + struct nb_cb_create_args *args) +{ + struct interface *ifp; + struct ipaddr source_addr; + struct ipaddr group_addr; + int result; + const char *ifp_name; + const struct lyd_node *if_dnode; + + switch (args->event) { + case NB_EV_VALIDATE: + if_dnode = yang_dnode_get_parent(args->dnode, "interface"); + if (!is_pim_interface(if_dnode)) { + ifp_name = yang_dnode_get_string(if_dnode, "."); + snprintf(args->errmsg, args->errmsg_len, + "multicast not enabled on interface %s", + ifp_name); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + yang_dnode_get_ip(&source_addr, args->dnode, "./source-addr"); + yang_dnode_get_ip(&group_addr, args->dnode, "./group-addr"); + + result = pim_if_igmp_join_add(ifp, group_addr.ip._v4_addr, + source_addr.ip._v4_addr); + if (result) { + snprintf(args->errmsg, args->errmsg_len, + "Failure joining IGMP group"); + return NB_ERR_INCONSISTENCY; + } + } + + return NB_OK; +} + +int lib_interface_igmp_address_family_static_group_destroy( + struct nb_cb_destroy_args *args) +{ + struct interface *ifp; + struct ipaddr source_addr; + struct ipaddr group_addr; + int result; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + ifp = nb_running_get_entry(args->dnode, NULL, true); + yang_dnode_get_ip(&source_addr, args->dnode, "./source-addr"); + yang_dnode_get_ip(&group_addr, args->dnode, "./group-addr"); + + result = pim_if_igmp_join_del(ifp, group_addr.ip._v4_addr, + source_addr.ip._v4_addr); + + if (result) { + char src_str[INET_ADDRSTRLEN]; + char grp_str[INET_ADDRSTRLEN]; + + ipaddr2str(&source_addr, src_str, sizeof(src_str)); + ipaddr2str(&group_addr, grp_str, sizeof(grp_str)); + + snprintf(args->errmsg, args->errmsg_len, + "%% Failure leaving IGMP group %s %s on interface %s: %d", + src_str, grp_str, ifp->name, result); + + return NB_ERR_INCONSISTENCY; + } + + break; + } + + return NB_OK; +} diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index f691e8b755..68e0a45690 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -55,7 +55,7 @@ void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient, p = &(pnc->rpf.rpf_addr); ret = zclient_send_rnh(zclient, command, p, false, pim->vrf_id); - if (ret < 0) + if (ret == ZCLIENT_SEND_FAILURE) zlog_warn("sendmsg_nexthop: zclient_send_message() failed"); if (PIM_DEBUG_PIM_NHT) diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index bf31d4e450..2ccff8b84a 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -484,9 +484,9 @@ void pim_sock_reset(struct interface *ifp) pim_ifp->pim_override_interval_msec = PIM_DEFAULT_OVERRIDE_INTERVAL_MSEC; if (PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION) { - PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp->options); + PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options); } else { - PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp->options); + PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options); } /* neighbors without lan_delay */ @@ -652,7 +652,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime) __func__, dst_str, ifp->name, holdtime, pim_ifp->pim_propagation_delay_msec, pim_ifp->pim_override_interval_msec, - PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION( + PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION( pim_ifp->options), pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id, listcount(ifp->connected)); @@ -664,7 +664,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime) pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id, pim_ifp->pim_propagation_delay_msec, pim_ifp->pim_override_interval_msec, - PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPRESSION(pim_ifp->options)); + PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options)); if (pim_tlv_size < 0) { return -1; } diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 7246482f02..727daa42c1 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -394,39 +394,6 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up) pim_zebra_update_all_interfaces(pim); } -int pim_rp_new_config(struct pim_instance *pim, const char *rp, - const char *group_range, const char *plist) -{ - int result = 0; - struct prefix group; - struct in_addr rp_addr; - - if (group_range == NULL) - result = str2prefix("224.0.0.0/4", &group); - else { - result = str2prefix(group_range, &group); - if (result) { - struct prefix temp; - - prefix_copy(&temp, &group); - apply_mask(&temp); - if (!prefix_same(&group, &temp)) - return PIM_GROUP_BAD_ADDR_MASK_COMBO; - } - } - - if (!result) - return PIM_GROUP_BAD_ADDRESS; - - result = inet_pton(AF_INET, rp, &rp_addr); - - if (result <= 0) - return PIM_RP_BAD_ADDRESS; - - result = pim_rp_new(pim, rp_addr, group, plist, RP_SRC_STATIC); - return result; -} - int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix group, const char *plist, enum rp_source rp_src_flag) diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index 6dc26c07a9..8a12cb076c 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -46,8 +46,6 @@ void pim_rp_free(struct pim_instance *pim); void pim_rp_list_hash_clean(void *data); -int pim_rp_new_config(struct pim_instance *pim, const char *rp, - const char *group, const char *plist); int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix group, const char *plist, enum rp_source rp_src_flag); diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index dc4c621e9c..05c9af8734 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -61,7 +61,7 @@ static int zclient_lookup_connect(struct thread *t) zlookup->fail = 0; /* reset counter on connection */ } - if (zclient_send_hello(zlookup) < 0) { + if (zclient_send_hello(zlookup) == ZCLIENT_SEND_FAILURE) { if (close(zlookup->sock)) { zlog_warn("%s: closing fd=%d: errno=%d %s", __func__, zlookup->sock, errno, safe_strerror(errno)); diff --git a/pimd/subdir.am b/pimd/subdir.am index 8952d15aaa..5a81df3ec8 100644 --- a/pimd/subdir.am +++ b/pimd/subdir.am @@ -41,6 +41,8 @@ pimd_libpim_a_SOURCES = \ pimd/pim_msdp_packet.c \ pimd/pim_msdp_socket.c \ pimd/pim_msg.c \ + pimd/pim_nb.c \ + pimd/pim_nb_config.c \ pimd/pim_neighbor.c \ pimd/pim_nht.c \ pimd/pim_oil.c \ @@ -66,6 +68,9 @@ pimd_libpim_a_SOURCES = \ pimd/pim_vxlan.c \ pimd/pim_zpthread.c \ pimd/pimd.c \ + yang/frr-pim.yang.c \ + yang/frr-pim-rp.yang.c \ + yang/frr-igmp.yang.c \ # end noinst_HEADERS += \ @@ -96,6 +101,7 @@ noinst_HEADERS += \ pimd/pim_msdp_packet.h \ pimd/pim_msdp_socket.h \ pimd/pim_msg.h \ + pimd/pim_nb.h \ pimd/pim_neighbor.h \ pimd/pim_nht.h \ pimd/pim_oil.h \ diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index bd0d5b27f4..e72d2e3f36 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -25,7 +25,6 @@ %{!?with_pbrd: %global with_pbrd 1 } %{!?with_pimd: %global with_pimd 1 } %{!?with_vrrpd: %global with_vrrpd 1 } -%{!?with_rpki: %global with_rpki 0 } %{!?with_rtadv: %global with_rtadv 1 } %{!?with_watchfrr: %global with_watchfrr 1 } @@ -192,9 +191,6 @@ Requires: initscripts %if %{with_pam} BuildRequires: pam-devel %endif -%if %{with_rpki} -BuildRequires: librtr-devel >= 0.5 -%endif %if "%{initsystem}" == "systemd" BuildRequires: systemd BuildRequires: systemd-devel @@ -261,6 +257,32 @@ The frr-devel package contains the header and object files neccessary for developing OSPF-API and frr applications. +%package rpki-rtrlib +Summary: BGP RPKI support (rtrlib) +Group: System Environment/Daemons +BuildRequires: librtr-devel >= 0.5 +Requires: %{name} = %{version}-%{release} + +%description rpki-rtrlib +Adds RPKI support to FRR's bgpd, allowing validation of BGP routes +against cryptographic information stored in WHOIS databases. This is +used to prevent hijacking of networks on the wider internet. It is only +relevant to internet service providers using their own autonomous system +number. + + +%package snmp +Summary: SNMP support +Group: System Environment/Daemons +BuildRequires: net-snmp-devel +Requires: %{name} = %{version}-%{release} + +%description snmp +Adds SNMP support to FRR's daemons by attaching to net-snmp's snmpd +through the AgentX protocol. Provides read-only access to current +routing state through standard SNMP MIBs. + + %prep %setup -q -n frr-%{frrversion} @@ -370,16 +392,13 @@ developing OSPF-API and frr applications. %if "%{initsystem}" == "systemd" --enable-systemd \ %endif -%if %{with_rpki} --enable-rpki \ -%else - --disable-rpki \ -%endif %if %{with_bfdd} --enable-bfdd \ %else --disable-bfdd \ %endif + --enable-snmp # end make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" @@ -425,10 +444,6 @@ ln -s %{_sbindir}/frrinit.sh %{buildroot}%{_initddir}/frr %endif install %{zeb_src}/tools/etc/frr/daemons %{buildroot}%{_sysconfdir}/frr -# add rpki module to daemon -%if %{with_rpki} - sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{buildroot}%{_sysconfdir}/frr/daemons -%endif install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr install -d -m750 %{buildroot}%{rundir} @@ -666,14 +681,12 @@ fi %if %{with_bfdd} %{_sbindir}/bfdd %endif -%{_libdir}/lib*.so.0 -%{_libdir}/lib*.so.0.* +%{_libdir}/libfrr.so* +%{_libdir}/libfrrcares* +%{_libdir}/libfrrospf* %if %{with_fpm} %{_libdir}/frr/modules/zebra_fpm.so %endif -%if %{with_rpki} - %{_libdir}/frr/modules/bgpd_rpki.so -%endif %{_libdir}/frr/modules/zebra_cumulus_mlag.so %{_libdir}/frr/modules/dplane_fpm_nl.so %{_libdir}/frr/modules/zebra_irdp.so @@ -706,12 +719,28 @@ fi %else %{_sbindir}/generate_support_bundle.pyc %{_sbindir}/generate_support_bundle.pyo -%{_sbindir}/frr-reload.py %{_sbindir}/frr-reload.pyc %{_sbindir}/frr-reload.pyo %endif +%post rpki-rtrlib +# add rpki module to daemons +sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{_sysconfdir}/frr/daemons + +%postun rpki-rtrlib +# remove rpki module from daemons +sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons + +%files rpki-rtrlib +%{_libdir}/frr/modules/bgpd_rpki.so + + +%files snmp +%{_libdir}/libfrrsnmp.so* +%{_libdir}/frr/modules/*snmp.so + + %files devel %{_libdir}/lib*.so %dir %{_includedir}/%{name} @@ -729,10 +758,288 @@ fi %changelog +* Fri Oct 30 2020 Martin Winter <mwinter@opensourcerouting.org> - %{version} +- Moved RPKI to subpackage +- Added SNMP subpackage + +* Tue Jun 30 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.4 +- BGPd +- Use sequence numbers for community lists +- Fixes to nexthop groups +- Add feature to limit outgoing number of routes +- Per Neighbor Graceful Restart +- Multiple Graceful Restart fixes +- Support sub-Type-4 and sub-Type-5 for the VPNv4 SRv6 backend +- rfc7606 support: treat certain malformed routes as withdraw +- allow origin override for route aggregates +- rfc6608 support: Subcodes for BGP Finite State Machine Error +- rfc7607 support: Codification of AS 0 Processing +- rfc6286 support: Autonomous-System-Wide Unique BGP Identifier for BGP-4 +- Unequal cost multipath (a.ka. weighted ECMP) with BGP link-bandwidth +- Enable rfc8212 by default except datacenter profile +- staticd +- Add debug support +- vtysh +- Add copy command to copy config from file into running config +- LDPd +- adding support for LDP ordered label distribution control +- ISISd +- IS-IS Segment Routing support +- SHARPd +- add initial support to add/remove lsps +- Zebra +- fix broadcast address in IPv4 networks with /31 mask +- Add Graceful Restart support for Protocol Daemon restarts +- lib +- migrate route-maps to use northbound interface +- plus countless bug fixes and other improvements + +* Wed May 06 2020 David Lamparter <equinox@opensourcerouting.org> - 7.3.1 +- upstream 7.3.1 + +* Fri Feb 14 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.3 +- BGPd +- EVPN PIP Support +- Route Aggregation code speed ups +- BGP Vector I/O speed ups +- New CLI: `set distance XXX` +- New CLI: `aggregate-address A.B.C.D/M route-map WORD` +- New CLI: `bgp reject-as-sets` +- New CLI: `advertise pip ...` +- New CLI: `match evpn rd ASN:NN_OR_IP-ADDRESS:NN` +- New CLI: `show bgp l2vpn evpn community|large-community X` +- New CLI: `show bgp l2vpn evpn A.B.C.D` +- Auto-completion for clear bgp command +- Add ability to set tcp socket buffer size +- OSPFd +- Partial MPLS TE support +- PBRd +- New CLI: `set vrf unchanged|NAME` +- BFDd +- VRF Support +- New CLI: 'show bfd peers brief' +- New CLI: 'clear bfd peer ...' +- PIMd +- Significant Speedups in accessing Internal Data for higher scale +- Support for joining any-source Multicast +- Updated CLI: 'show ip pim upstream-join-desired' +- New CLI: 'show ip pim channel' +- Debug Cleanup +- MLAG experimental support +- VRRPd +- VRF Support +- Northbound Conversion- NHRPd +- LDPd +- vtysh +- New CLI: `banner motd line LINE...` +- yang +- New CLI: `show yang operational-data XPATH` +- New CLI: `debug northbound` +- Zebra +- Nexthop Group support +- New CLI: 'debug zebra nexthop [detail]' +- New CLI: 'show router-id' +- MLAG experimental support +- watchfrr +- Additional status messages of system state to systemd +- New CLI: `watchfrr ignore DAEMON` +- Others +- As always all daemons have received too many bug fixes to fully list +- There has been a significant focus on increasing test coverage +- Change in Behavior: +- ISISd +- All areas created default automatically to level-1-2 +- Zebra +- Nexthop Group Installation in Kernel is turned on by default + if the kernel supports- New CLI: 'show nexthop-group rib [singleton]' +- Man Pages +- Renamed to frr-* to remove collision with other packages + +* Fri Jan 17 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.2.1 +- BGPd +- Fix Addpath issue +- Do not apply eBGP policy for iBGP peers +- Show `ip` and `fqdn` in json output for `show [ip] bgp <route> json` +- Fix large route-distinguisher's format +- Fix `no bgp listen range ...` configuration command +- Autocomplete neighbor for clear bgp +- Reflect the distance in RIB when it is changed for an arbitrary afi/safi +- Notify "Peer De-configured" after entering 'no neighbor <neighbor> cmd +- Fix per afi/safi addpath peer counting +- Rework BGP dampening to be per AFI/SAFI +- Do not send next-hop as :: in MP_REACH_NLRI if no link-local exists +- Override peer's TTL only if peer-group is configured with TTL +- Remove error message for unkown afi/safi combination +- Keep the session down if maximum-prefix is reached +- OSPFd +- Fix BFD down not tearing down OSPF adjacency for point-to-point net +- BFDd +- Fix multiple VRF handling +- VRF security improvement +- PIMd +- Fix rp crash +- NHRPd +- Make sure `no ip nhrp map <something>` works as expected +- LDPd +- Add missing sanity check in the parsing of label messages +- Zebra +- Use correct state when installing evpn macs +- Capture dplane plugin flags +- lib +- Fix interface config when vrf changes +- Fix Interface Infinite Loop Walk (for special interfaces such as bond) +- snapcraft +- fix missing vrrpd daemon +- Others +- Rename man pages (to avoid conflicts with other packages) +- Various other fixes for code cleanup and memory leaks + * Fri Dec 27 2019 Donatas Abraitis <donatas.abraitis@gmail.com> - Add CentOS 8 support -* Mon May 28 2018 Rafael Zalamena <rzalamena@opensourcerouting.org> - %{version} +* Tue Oct 15 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.2 +- ALL Daemons +- -N <namespace> to allow for config file locating when running FRR inside + of a namespace +- Impoved Testing across all daemons +- BFD +- VRF Support +- Conversion to Northbound interface +- BGP +- Aggregate-address add route-map support +- BMP Support +- Improved JSON output for many commands +- `show bgp afi safi summary failed` command +- `clear bop *` clears all peers +- Show FQDN for `show bgp ipv4 uni` commands +- Display BestPath selection reason as part of show commands +- EIGRP +- Infrastructure changes to allow VRF's +- SIGHUP signals the config reload +- Conversion to Northbound interface +- ISIS +- BFD Support +- Support for circuits with MTU > 8192 +- PBRD +- fwmark support as part of match criteria +- autocompletion of PBRMAPS +- Improved Nexthop Support +- PIMD +- PIM-BSM receive support +- Improved debugging support +- Store ECMP paths that are not currently legal for use +- Disallow igmp query from a non-connected source +- Many new cli improvements and changes +- VRRPD +- Add Support for RFC 3768 and RFC 5798 +- Route-Maps +- Add sequence numbers to access-lists +- Add `match ip next-hop type blackhole` +- Improved ability to notice dependency changes +- SHARPD +- `sharp watch [import|nexthop]` you can now specify a prefix instead + of assuming a /32 +- STATICD +- Significantly Improved NHT +- ZEBRA +- Many dataplane improvements for routes, neighbor table and EVPN +- NHT cli can now be specified per VRF and improved ability to control + NHT data being shown +- Removed duplicate processing of routes +- Improved debugablility +- RMAC and VxLan support for the FPM +- LIB +- RCU support +- Nexthop Group Improvements +- `log-filter WORD` added +- Building +- openssl support +- libcap should be used as part of build or significant slowdowns + will be experienced +- Lua builds have been fixed +- Improved Cross building + +* Mon Jun 17 2019 David Lamparter <equinox@opensourcerouting.org> - 7.1 +- gRPC northbound plugin +- "table NNN" removed from zebra +- more dataplane MT work +- EVPN in non-default VRFs +- RFC 8212 (default deny policy for eBGP) +- RFC 8106 (IPv6 RA DNS options) + +* Wed May 8 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.0.1 +- bgp: +- Don't send Updates with BGP Max-Prefix Overflow +- Make sure `next-hop-self all` backward compatible with force +- Fix as-path validation in "show bgp regexp" +- Fix interface-based peers to override peergroups +- Fix removing private AS numbers if local-as is used +- Fix show bgp labeled_unicast +- Add command to lookup prefixes in rpki table +- Fix peer count in "show bgp ipv6 summary" +- Add missing ipv6 only peer flag action +- Fix address family output in "show bgp [ipv4|ipv6] neighbors" +- Add missing checks for vpnv6 nexthops +- Fix nexthop for ipv6 vpn case +- rip: Fix removal of passive interfaces +- ospf: +- Fix json timer output +- Fix milliseconds in json output +- bfd: +- Fix source port according RFC 5881, Sec 4 +- Fix IPv6 link-local peer removal +- Fix interface clean up when deleting interface +- pim: Fix interface clean up when deleting interface +- nhrp: Fix interface clean up when deleting interface +- lib: +- Workaround to get FRR building with libyang 0.x and 1.x +- Fix in priv handling +- Make priv elevation thread-safe +- zebra: +- Pseudowire event recovery +- Fix race condition in label manager +- Fix system routes selection and next-hop tracking +- Set connected route metric based on devaddr metric +- Display metric for connected routes +- Add selected fib details to json output +- Always use replace if installing new route +- watchfrr: Silently ignore declare failures (for backward compatibility) +- RPM packages: Switch to new init script + +* Thu Feb 28 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.0 +- Added libyang dependency: New work for northbound interface based on libyang +- Fabricd: New Daemon based on https://datatracker.ietf.org/doc/draft-white-openfabric/ +- various bug fixes and other enhancements + +* Sun Oct 7 2018 Martin Winter <mwinter@opensourcerouting.org> - 6.0 +- Staticd: New daemon responsible for management of static routes +- ISISd: Implement dst-src routing as per draft-ietf-isis-ipv6-dst-src-routing +- BFDd: new daemon for BFD (Bidrectional Forwarding Detection). Responsible + for notifying link changes to make routing protocols converge faster. +- various bug fixes + +* Thu Jul 5 2018 Martin Winter <mwinter@opensourcerouting.org> - 5.0.1 +- Support Automake 1.16.1 +- BGPd: Support for flowspec ICMP, DSCP, packet length, fragment and tcp flags +- BGPd: fix rpki validation for ipv6 +- VRF: Workaround for kernel bug on Linux 4.14 and newer +- Zebra: Fix interface based routes from zebra not marked up +- Zebra: Fix large zebra memory usage when redistribute between protocols +- Zebra: Allow route-maps to match on source instance +- BGPd: Backport peer-attr overrides, peer-level enforce-first-as and filtered-routes fix +- BGPd: fix for crash during display of filtered-routes +- BGPd: Actually display labeled unicast routes received +- Label Manager: Fix to work correctly behind a label manager proxy + +* Thu Jun 7 2018 Martin Winter <mwinter@opensourcerouting.org> - 5.0 +- PIM: Add a Multicast Trace Command draft-ietf-idmr-traceroute-ipm-05 +- IS-IS: Implement Three-Way Handshake as per RFC5303 +- BGPD: Implement VPN-VRF route leaking per RFC4364. +- BGPD: Implement VRF with NETNS backend +- BGPD: Flowspec +- PBRD: Add a new Policy Based Routing Daemon + +* Mon May 28 2018 Rafael Zalamena <rzalamena@opensourcerouting.org> - Add BFDd support * Sun May 20 2018 Martin Winter <mwinter@opensourcerouting.org> diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 77c2db8ceb..061cefec30 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -43,27 +43,23 @@ struct rip_metric_modifier { /* `match metric METRIC' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_metric(void *rule, const struct prefix *prefix, void *object) { uint32_t *metric; uint32_t check; struct rip_info *rinfo; - if (type == RMAP_RIP) { - metric = rule; - rinfo = object; - - /* If external metric is available, the route-map should - work on this one (for redistribute purpose) */ - check = (rinfo->external_metric) ? rinfo->external_metric - : rinfo->metric; - if (check == *metric) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } - return RMAP_NOMATCH; + metric = rule; + rinfo = object; + + /* If external metric is available, the route-map should + work on this one (for redistribute purpose) */ + check = (rinfo->external_metric) ? rinfo->external_metric + : rinfo->metric; + if (check == *metric) + return RMAP_MATCH; + else + return RMAP_NOMATCH; } /* Route map `match metric' match statement. `arg' is METRIC value */ @@ -98,29 +94,25 @@ static const struct route_map_rule_cmd route_match_metric_cmd = { /* `match interface IFNAME' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_interface(void *rule, const struct prefix *prefix, void *object) { struct rip_info *rinfo; struct interface *ifp; char *ifname; - if (type == RMAP_RIP) { - ifname = rule; - ifp = if_lookup_by_name(ifname, VRF_DEFAULT); + ifname = rule; + ifp = if_lookup_by_name(ifname, VRF_DEFAULT); - if (!ifp) - return RMAP_NOMATCH; + if (!ifp) + return RMAP_NOMATCH; - rinfo = object; + rinfo = object; - if (rinfo->ifindex_out == ifp->ifindex - || rinfo->nh.ifindex == ifp->ifindex) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } - return RMAP_NOMATCH; + if (rinfo->ifindex_out == ifp->ifindex + || rinfo->nh.ifindex == ifp->ifindex) + return RMAP_MATCH; + else + return RMAP_NOMATCH; } /* Route map `match interface' match statement. `arg' is IFNAME value */ @@ -148,30 +140,25 @@ static const struct route_map_rule_cmd route_match_interface_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_next_hop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; struct rip_info *rinfo; struct prefix_ipv4 p; - if (type == RMAP_RIP) { - rinfo = object; - p.family = AF_INET; - p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY) - ? rinfo->nh.gate.ipv4 - : rinfo->from; - p.prefixlen = IPV4_MAX_BITLEN; + rinfo = object; + p.family = AF_INET; + p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY) + ? rinfo->nh.gate.ipv4 + : rinfo->from; + p.prefixlen = IPV4_MAX_BITLEN; - alist = access_list_lookup(AFI_IP, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_IP, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - return (access_list_apply(alist, &p) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `ip next-hop' match statement. `arg' should be @@ -199,29 +186,25 @@ static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { static enum route_map_cmd_result_t route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; struct rip_info *rinfo; struct prefix_ipv4 p; - if (type == RMAP_RIP) { - rinfo = object; - p.family = AF_INET; - p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY) - ? rinfo->nh.gate.ipv4 - : rinfo->from; - p.prefixlen = IPV4_MAX_BITLEN; + rinfo = object; + p.family = AF_INET; + p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY) + ? rinfo->nh.gate.ipv4 + : rinfo->from; + p.prefixlen = IPV4_MAX_BITLEN; - plist = prefix_list_lookup(AFI_IP, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + plist = prefix_list_lookup(AFI_IP, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, &p) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static void *route_match_ip_next_hop_prefix_list_compile(const char *arg) @@ -246,11 +229,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct rip_info *rinfo; - if (type == RMAP_RIP && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { rinfo = (struct rip_info *)object; if (!rinfo) return RMAP_NOMATCH; @@ -284,21 +267,16 @@ static const struct route_map_rule_cmd /* Match function should return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_address(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; - if (type == RMAP_RIP) { - alist = access_list_lookup(AFI_IP, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_IP, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - return (access_list_apply(alist, prefix) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `ip address' match statement. `arg' should be @@ -326,20 +304,16 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = { static enum route_map_cmd_result_t route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; - if (type == RMAP_RIP) { - plist = prefix_list_lookup(AFI_IP, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + plist = prefix_list_lookup(AFI_IP, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, prefix) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static void *route_match_ip_address_prefix_list_compile(const char *arg) @@ -363,25 +337,21 @@ static const struct route_map_rule_cmd /* `match tag TAG' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_tag(void *rule, const struct prefix *p, route_map_object_t type, - void *object) +route_match_tag(void *rule, const struct prefix *p, void *object) { route_tag_t *tag; struct rip_info *rinfo; route_tag_t rinfo_tag; - if (type == RMAP_RIP) { - tag = rule; - rinfo = object; + tag = rule; + rinfo = object; - /* The information stored by rinfo is host ordered. */ - rinfo_tag = rinfo->tag; - if (rinfo_tag == *tag) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } - return RMAP_NOMATCH; + /* The information stored by rinfo is host ordered. */ + rinfo_tag = rinfo->tag; + if (rinfo_tag == *tag) + return RMAP_MATCH; + else + return RMAP_NOMATCH; } /* Route map commands for tag matching. */ @@ -396,33 +366,30 @@ static const struct route_map_rule_cmd route_match_tag_cmd = { /* Set metric to attribute. */ static enum route_map_cmd_result_t -route_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric(void *rule, const struct prefix *prefix, void *object) { - if (type == RMAP_RIP) { - struct rip_metric_modifier *mod; - struct rip_info *rinfo; + struct rip_metric_modifier *mod; + struct rip_info *rinfo; - mod = rule; - rinfo = object; + mod = rule; + rinfo = object; - if (!mod->used) - return RMAP_OKAY; + if (!mod->used) + return RMAP_OKAY; - if (mod->type == metric_increment) - rinfo->metric_out += mod->metric; - else if (mod->type == metric_decrement) - rinfo->metric_out -= mod->metric; - else if (mod->type == metric_absolute) - rinfo->metric_out = mod->metric; + if (mod->type == metric_increment) + rinfo->metric_out += mod->metric; + else if (mod->type == metric_decrement) + rinfo->metric_out -= mod->metric; + else if (mod->type == metric_absolute) + rinfo->metric_out = mod->metric; - if ((signed int)rinfo->metric_out < 1) - rinfo->metric_out = 1; - if (rinfo->metric_out > RIP_METRIC_INFINITY) - rinfo->metric_out = RIP_METRIC_INFINITY; + if ((signed int)rinfo->metric_out < 1) + rinfo->metric_out = 1; + if (rinfo->metric_out > RIP_METRIC_INFINITY) + rinfo->metric_out = RIP_METRIC_INFINITY; - rinfo->metric_set = 1; - } + rinfo->metric_set = 1; return RMAP_OKAY; } @@ -495,22 +462,20 @@ static const struct route_map_rule_cmd route_set_metric_cmd = { /* `set ip next-hop IP_ADDRESS' */ /* Set nexthop to object. ojbect must be pointer to struct attr. */ -static enum route_map_cmd_result_t route_set_ip_nexthop(void *rule, - const struct prefix *prefix, - route_map_object_t type, - void *object) +static enum route_map_cmd_result_t +route_set_ip_nexthop(void *rule, const struct prefix *prefix, + + void *object) { struct in_addr *address; struct rip_info *rinfo; - if (type == RMAP_RIP) { - /* Fetch routemap's rule information. */ - address = rule; - rinfo = object; + /* Fetch routemap's rule information. */ + address = rule; + rinfo = object; - /* Set next hop value. */ - rinfo->nexthop_out = *address; - } + /* Set next hop value. */ + rinfo->nexthop_out = *address; return RMAP_OKAY; } @@ -552,20 +517,17 @@ static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = { /* Set tag to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type, - void *object) +route_set_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct rip_info *rinfo; - if (type == RMAP_RIP) { - /* Fetch routemap's rule information. */ - tag = rule; - rinfo = object; + /* Fetch routemap's rule information. */ + tag = rule; + rinfo = object; - /* Set next hop value. */ - rinfo->tag_out = *tag; - } + /* Set next hop value. */ + rinfo->tag_out = *tag; return RMAP_OKAY; } diff --git a/ripd/ripd.c b/ripd/ripd.c index 059a0e2efd..0cec847f05 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -462,7 +462,7 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from, if (ri->routemap[RIP_FILTER_IN]) { /* The object should be of the type of rip_info */ ret = route_map_apply(ri->routemap[RIP_FILTER_IN], - (struct prefix *)&p, RMAP_RIP, &newinfo); + (struct prefix *)&p, &newinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIP_DEBUG_PACKET) @@ -2251,7 +2251,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to, if (ri->routemap[RIP_FILTER_OUT]) { ret = route_map_apply( ri->routemap[RIP_FILTER_OUT], - (struct prefix *)p, RMAP_RIP, rinfo); + (struct prefix *)p, rinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIP_DEBUG_PACKET) @@ -2267,7 +2267,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to, && rinfo->sub_type != RIP_ROUTE_INTERFACE) { ret = route_map_apply( rip->redist[rinfo->type].route_map.map, - (struct prefix *)p, RMAP_RIP, rinfo); + (struct prefix *)p, rinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIP_DEBUG_PACKET) diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index b5f80d2ab0..9aed8d6963 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -39,21 +39,19 @@ struct rip_metric_modifier { /* `match metric METRIC' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_metric(void *rule, const struct prefix *prefix, void *object) { uint32_t *metric; struct ripng_info *rinfo; - if (type == RMAP_RIPNG) { - metric = rule; - rinfo = object; + metric = rule; + rinfo = object; + + if (rinfo->metric == *metric) + return RMAP_MATCH; + else + return RMAP_NOMATCH; - if (rinfo->metric == *metric) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } return RMAP_NOMATCH; } @@ -89,27 +87,25 @@ static const struct route_map_rule_cmd route_match_metric_cmd = { /* `match interface IFNAME' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_interface(void *rule, const struct prefix *prefix, void *object) { struct ripng_info *rinfo; struct interface *ifp; char *ifname; - if (type == RMAP_RIPNG) { - ifname = rule; - ifp = if_lookup_by_name(ifname, VRF_DEFAULT); + ifname = rule; + ifp = if_lookup_by_name(ifname, VRF_DEFAULT); - if (!ifp) - return RMAP_NOMATCH; + if (!ifp) + return RMAP_NOMATCH; - rinfo = object; + rinfo = object; + + if (rinfo->ifindex == ifp->ifindex) + return RMAP_MATCH; + else + return RMAP_NOMATCH; - if (rinfo->ifindex == ifp->ifindex) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } return RMAP_NOMATCH; } @@ -135,27 +131,24 @@ static const struct route_map_rule_cmd route_match_interface_cmd = { /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t route_match_tag(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) { route_tag_t *tag; struct ripng_info *rinfo; route_tag_t rinfo_tag; - if (type == RMAP_RIPNG) { - tag = rule; - rinfo = object; + tag = rule; + rinfo = object; - /* The information stored by rinfo is host ordered. */ - rinfo_tag = rinfo->tag; - if (rinfo_tag == *tag) - return RMAP_MATCH; - else - return RMAP_NOMATCH; - } - return RMAP_NOMATCH; + /* The information stored by rinfo is host ordered. */ + rinfo_tag = rinfo->tag; + if (rinfo_tag == *tag) + return RMAP_MATCH; + else + return RMAP_NOMATCH; } + static const struct route_map_rule_cmd route_match_tag_cmd = { "tag", route_match_tag, @@ -167,33 +160,31 @@ static const struct route_map_rule_cmd route_match_tag_cmd = { /* Set metric to attribute. */ static enum route_map_cmd_result_t -route_set_metric(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_set_metric(void *rule, const struct prefix *prefix, void *object) { - if (type == RMAP_RIPNG) { - struct rip_metric_modifier *mod; - struct ripng_info *rinfo; + struct rip_metric_modifier *mod; + struct ripng_info *rinfo; - mod = rule; - rinfo = object; + mod = rule; + rinfo = object; - if (!mod->used) - return RMAP_OKAY; + if (!mod->used) + return RMAP_OKAY; - if (mod->type == metric_increment) - rinfo->metric_out += mod->metric; - else if (mod->type == metric_decrement) - rinfo->metric_out -= mod->metric; - else if (mod->type == metric_absolute) - rinfo->metric_out = mod->metric; + if (mod->type == metric_increment) + rinfo->metric_out += mod->metric; + else if (mod->type == metric_decrement) + rinfo->metric_out -= mod->metric; + else if (mod->type == metric_absolute) + rinfo->metric_out = mod->metric; - if (rinfo->metric_out < 1) - rinfo->metric_out = 1; - if (rinfo->metric_out > RIPNG_METRIC_INFINITY) - rinfo->metric_out = RIPNG_METRIC_INFINITY; + if (rinfo->metric_out < 1) + rinfo->metric_out = 1; + if (rinfo->metric_out > RIPNG_METRIC_INFINITY) + rinfo->metric_out = RIPNG_METRIC_INFINITY; + + rinfo->metric_set = 1; - rinfo->metric_set = 1; - } return RMAP_OKAY; } @@ -265,20 +256,17 @@ static const struct route_map_rule_cmd route_set_metric_cmd = { /* Set nexthop to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, void *object) { struct in6_addr *address; struct ripng_info *rinfo; - if (type == RMAP_RIPNG) { - /* Fetch routemap's rule information. */ - address = rule; - rinfo = object; + /* Fetch routemap's rule information. */ + address = rule; + rinfo = object; - /* Set next hop value. */ - rinfo->nexthop_out = *address; - } + /* Set next hop value. */ + rinfo->nexthop_out = *address; return RMAP_OKAY; } @@ -321,20 +309,17 @@ static const struct route_map_rule_cmd /* Set tag to object. ojbect must be pointer to struct attr. */ static enum route_map_cmd_result_t -route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type, - void *object) +route_set_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct ripng_info *rinfo; - if (type == RMAP_RIPNG) { - /* Fetch routemap's rule information. */ - tag = rule; - rinfo = object; + /* Fetch routemap's rule information. */ + tag = rule; + rinfo = object; - /* Set next hop value. */ - rinfo->tag_out = *tag; - } + /* Set next hop value. */ + rinfo->tag_out = *tag; return RMAP_OKAY; } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 8d9249e4ae..1ebdae43fb 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -748,8 +748,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, /* Modify entry. */ if (ri->routemap[RIPNG_FILTER_IN]) { ret = route_map_apply(ri->routemap[RIPNG_FILTER_IN], - (struct prefix *)&p, RMAP_RIPNG, - &newinfo); + (struct prefix *)&p, &newinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIPNG_DEBUG_PACKET) @@ -1661,7 +1660,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to, if (ri->routemap[RIPNG_FILTER_OUT]) { ret = route_map_apply( ri->routemap[RIPNG_FILTER_OUT], - (struct prefix *)p, RMAP_RIPNG, rinfo); + (struct prefix *)p, rinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIPNG_DEBUG_PACKET) @@ -1677,7 +1676,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to, ret = route_map_apply(ripng->redist[rinfo->type] .route_map.map, (struct prefix *)p, - RMAP_RIPNG, rinfo); + rinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIPNG_DEBUG_PACKET) @@ -1773,8 +1772,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to, ret = route_map_apply( ri->routemap[RIPNG_FILTER_OUT], - (struct prefix *)p, RMAP_RIPNG, - &newinfo); + (struct prefix *)p, &newinfo); if (ret == RMAP_DENYMATCH) { if (IS_RIPNG_DEBUG_PACKET) diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c index 4cd92c7f3d..fe7f9851f9 100644 --- a/sharpd/sharp_main.c +++ b/sharpd/sharp_main.c @@ -139,6 +139,16 @@ static void sharp_global_init(void) sg.nhs = list_new(); } +static void sharp_start_configuration(void) +{ + zlog_debug("Configuration has started to be read"); +} + +static void sharp_end_configuration(void) +{ + zlog_debug("Configuration has finished being read"); +} + int main(int argc, char **argv, char **envp) { frr_preinit(&sharpd_di, argc, argv); @@ -163,6 +173,8 @@ int main(int argc, char **argv, char **envp) master = frr_init(); + cmd_init_config_callbacks(sharp_start_configuration, + sharp_end_configuration); sharp_global_init(); sharp_nhgroup_init(); diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 231de6403d..627caea37d 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -211,66 +211,217 @@ int sharp_install_lsps_helper(bool install_p, bool update_p, cmd = ZEBRA_MPLS_LABELS_DELETE; } - ret = zebra_send_mpls_labels(zclient, cmd, &zl); + if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE) + return -1; - return ret; + return 0; } -void sharp_install_routes_helper(struct prefix *p, vrf_id_t vrf_id, - uint8_t instance, uint32_t nhgid, - const struct nexthop_group *nhg, - const struct nexthop_group *backup_nhg, - uint32_t routes) +enum where_to_restart { + SHARP_INSTALL_ROUTES_RESTART, + SHARP_DELETE_ROUTES_RESTART, +}; + +struct buffer_delay { + struct prefix p; + uint32_t count; + uint32_t routes; + vrf_id_t vrf_id; + uint8_t instance; + uint32_t nhgid; + const struct nexthop_group *nhg; + const struct nexthop_group *backup_nhg; + enum where_to_restart restart; +} wb; + +/* + * route_add - Encodes a route to zebra + * + * This function returns true when the route was buffered + * by the underlying stream system + */ +static bool route_add(const struct prefix *p, vrf_id_t vrf_id, uint8_t instance, + uint32_t nhgid, const struct nexthop_group *nhg, + const struct nexthop_group *backup_nhg) +{ + struct zapi_route api; + struct zapi_nexthop *api_nh; + struct nexthop *nh; + int i = 0; + + memset(&api, 0, sizeof(api)); + api.vrf_id = vrf_id; + api.type = ZEBRA_ROUTE_SHARP; + api.instance = instance; + api.safi = SAFI_UNICAST; + memcpy(&api.prefix, p, sizeof(*p)); + + SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); + SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); + + /* Only send via ID if nhgroup has been successfully installed */ + if (nhgid && sharp_nhgroup_id_is_installed(nhgid)) { + SET_FLAG(api.message, ZAPI_MESSAGE_NHG); + api.nhgid = nhgid; + } else { + for (ALL_NEXTHOPS_PTR(nhg, nh)) { + api_nh = &api.nexthops[i]; + + zapi_nexthop_from_nexthop(api_nh, nh); + + i++; + } + api.nexthop_num = i; + } + + /* Include backup nexthops, if present */ + if (backup_nhg && backup_nhg->nexthop) { + SET_FLAG(api.message, ZAPI_MESSAGE_BACKUP_NEXTHOPS); + + i = 0; + for (ALL_NEXTHOPS_PTR(backup_nhg, nh)) { + api_nh = &api.backup_nexthops[i]; + + zapi_backup_nexthop_from_nexthop(api_nh, nh); + + i++; + } + + api.backup_nexthop_num = i; + } + + if (zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api) + == ZCLIENT_SEND_BUFFERED) + return true; + else + return false; +} + +/* + * route_delete - Encodes a route for deletion to zebra + * + * This function returns true when the route sent was + * buffered by the underlying stream system. + */ +static bool route_delete(struct prefix *p, vrf_id_t vrf_id, uint8_t instance) +{ + struct zapi_route api; + + memset(&api, 0, sizeof(api)); + api.vrf_id = vrf_id; + api.type = ZEBRA_ROUTE_SHARP; + api.safi = SAFI_UNICAST; + api.instance = instance; + memcpy(&api.prefix, p, sizeof(*p)); + + if (zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api) + == ZCLIENT_SEND_BUFFERED) + return true; + else + return false; +} + +static void sharp_install_routes_restart(struct prefix *p, uint32_t count, + vrf_id_t vrf_id, uint8_t instance, + uint32_t nhgid, + const struct nexthop_group *nhg, + const struct nexthop_group *backup_nhg, + uint32_t routes) { uint32_t temp, i; bool v4 = false; - zlog_debug("Inserting %u routes", routes); - if (p->family == AF_INET) { v4 = true; temp = ntohl(p->u.prefix4.s_addr); } else temp = ntohl(p->u.val32[3]); - /* Only use backup route/nexthops if present */ - if (backup_nhg && (backup_nhg->nexthop == NULL)) - backup_nhg = NULL; - - monotime(&sg.r.t_start); - for (i = 0; i < routes; i++) { - route_add(p, vrf_id, (uint8_t)instance, nhgid, nhg, backup_nhg); + for (i = count; i < routes; i++) { + bool buffered = route_add(p, vrf_id, (uint8_t)instance, nhgid, + nhg, backup_nhg); if (v4) p->u.prefix4.s_addr = htonl(++temp); else p->u.val32[3] = htonl(++temp); + + if (buffered) { + wb.p = *p; + wb.count = i+1; + wb.routes = routes; + wb.vrf_id = vrf_id; + wb.instance = instance; + wb.nhgid = nhgid; + wb.nhg = nhg; + wb.backup_nhg = backup_nhg; + wb.restart = SHARP_INSTALL_ROUTES_RESTART; + + return; + } } } -void sharp_remove_routes_helper(struct prefix *p, vrf_id_t vrf_id, - uint8_t instance, uint32_t routes) +void sharp_install_routes_helper(struct prefix *p, vrf_id_t vrf_id, + uint8_t instance, uint32_t nhgid, + const struct nexthop_group *nhg, + const struct nexthop_group *backup_nhg, + uint32_t routes) +{ + zlog_debug("Inserting %u routes", routes); + + /* Only use backup route/nexthops if present */ + if (backup_nhg && (backup_nhg->nexthop == NULL)) + backup_nhg = NULL; + + monotime(&sg.r.t_start); + sharp_install_routes_restart(p, 0, vrf_id, instance, nhgid, nhg, + backup_nhg, routes); +} + +static void sharp_remove_routes_restart(struct prefix *p, uint32_t count, + vrf_id_t vrf_id, uint8_t instance, + uint32_t routes) { uint32_t temp, i; bool v4 = false; - zlog_debug("Removing %u routes", routes); - if (p->family == AF_INET) { v4 = true; temp = ntohl(p->u.prefix4.s_addr); } else temp = ntohl(p->u.val32[3]); - monotime(&sg.r.t_start); - for (i = 0; i < routes; i++) { - route_delete(p, vrf_id, (uint8_t)instance); + for (i = count; i < routes; i++) { + bool buffered = route_delete(p, vrf_id, (uint8_t)instance); + if (v4) p->u.prefix4.s_addr = htonl(++temp); else p->u.val32[3] = htonl(++temp); + + if (buffered) { + wb.p = *p; + wb.count = i + 1; + wb.vrf_id = vrf_id; + wb.instance = instance; + wb.routes = routes; + wb.restart = SHARP_DELETE_ROUTES_RESTART; + + return; + } } } +void sharp_remove_routes_helper(struct prefix *p, vrf_id_t vrf_id, + uint8_t instance, uint32_t routes) +{ + zlog_debug("Removing %u routes", routes); + + monotime(&sg.r.t_start); + + sharp_remove_routes_restart(p, 0, vrf_id, instance, routes); +} + static void handle_repeated(bool installed) { struct prefix p = sg.r.orig_prefix; @@ -294,6 +445,21 @@ static void handle_repeated(bool installed) } } +static void sharp_zclient_buffer_ready(void) +{ + switch (wb.restart) { + case SHARP_INSTALL_ROUTES_RESTART: + sharp_install_routes_restart(&wb.p, wb.count, wb.vrf_id, + wb.instance, wb.nhgid, wb.nhg, + wb.backup_nhg, wb.routes); + return; + case SHARP_DELETE_ROUTES_RESTART: + sharp_remove_routes_restart(&wb.p, wb.count, wb.vrf_id, + wb.instance, wb.routes); + return; + } +} + static int route_notify_owner(ZAPI_CALLBACK_ARGS) { struct timeval r; @@ -301,7 +467,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) enum zapi_route_notify_owner note; uint32_t table; - if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e)) + if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e, + NULL, NULL)) return -1; switch (note) { @@ -407,74 +574,6 @@ void nhg_del(uint32_t id) zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg); } -void route_add(const struct prefix *p, vrf_id_t vrf_id, uint8_t instance, - uint32_t nhgid, const struct nexthop_group *nhg, - const struct nexthop_group *backup_nhg) -{ - struct zapi_route api; - struct zapi_nexthop *api_nh; - struct nexthop *nh; - int i = 0; - - memset(&api, 0, sizeof(api)); - api.vrf_id = vrf_id; - api.type = ZEBRA_ROUTE_SHARP; - api.instance = instance; - api.safi = SAFI_UNICAST; - memcpy(&api.prefix, p, sizeof(*p)); - - SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); - SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); - - /* Only send via ID if nhgroup has been successfully installed */ - if (nhgid && sharp_nhgroup_id_is_installed(nhgid)) { - SET_FLAG(api.message, ZAPI_MESSAGE_NHG); - api.nhgid = nhgid; - } else { - for (ALL_NEXTHOPS_PTR(nhg, nh)) { - api_nh = &api.nexthops[i]; - - zapi_nexthop_from_nexthop(api_nh, nh); - - i++; - } - api.nexthop_num = i; - } - - /* Include backup nexthops, if present */ - if (backup_nhg && backup_nhg->nexthop) { - SET_FLAG(api.message, ZAPI_MESSAGE_BACKUP_NEXTHOPS); - - i = 0; - for (ALL_NEXTHOPS_PTR(backup_nhg, nh)) { - api_nh = &api.backup_nexthops[i]; - - zapi_backup_nexthop_from_nexthop(api_nh, nh); - - i++; - } - - api.backup_nexthop_num = i; - } - - zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); -} - -void route_delete(struct prefix *p, vrf_id_t vrf_id, uint8_t instance) -{ - struct zapi_route api; - - memset(&api, 0, sizeof(api)); - api.vrf_id = vrf_id; - api.type = ZEBRA_ROUTE_SHARP; - api.safi = SAFI_UNICAST; - api.instance = instance; - memcpy(&api.prefix, p, sizeof(*p)); - zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); - - return; -} - void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, bool watch, bool connected) { @@ -492,7 +591,8 @@ void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, command = ZEBRA_IMPORT_ROUTE_UNREGISTER; } - if (zclient_send_rnh(zclient, command, p, connected, vrf_id) < 0) + if (zclient_send_rnh(zclient, command, p, connected, vrf_id) + == ZCLIENT_SEND_FAILURE) zlog_warn("%s: Failure to send nexthop to zebra", __func__); } @@ -678,7 +778,7 @@ void sharp_opaque_send(uint32_t type, uint32_t proto, uint32_t instance, ret = zclient_send_opaque_unicast(zclient, type, proto, instance, session_id, buf, sizeof(buf)); - if (ret < 0) { + if (ret == ZCLIENT_SEND_FAILURE) { zlog_debug("%s: send_opaque() failed => %d", __func__, ret); break; @@ -767,7 +867,7 @@ void sharp_zebra_init(void) zclient->nexthop_update = sharp_nexthop_update; zclient->import_check_update = sharp_nexthop_update; zclient->nhg_notify_owner = nhg_notify_owner; - + zclient->zebra_buffer_write_ready = sharp_zclient_buffer_ready; zclient->redistribute_route_add = sharp_redistribute_route; zclient->redistribute_route_del = sharp_redistribute_route; zclient->opaque_msg_handler = sharp_opaque_handler; diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h index 4a767ababf..8c5fa5e15e 100644 --- a/sharpd/sharp_zebra.h +++ b/sharpd/sharp_zebra.h @@ -32,10 +32,6 @@ extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label); extern void nhg_add(uint32_t id, const struct nexthop_group *nhg, const struct nexthop_group *backup_nhg); extern void nhg_del(uint32_t id); -extern void route_add(const struct prefix *p, vrf_id_t, uint8_t instance, - uint32_t nhgid, const struct nexthop_group *nhg, - const struct nexthop_group *backup_nhg); -extern void route_delete(struct prefix *p, vrf_id_t vrf_id, uint8_t instance); extern void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, bool watch, bool connected); diff --git a/staticd/static_memory.h b/staticd/static_memory.h index e9cc7ba469..077cd0f32b 100644 --- a/staticd/static_memory.h +++ b/staticd/static_memory.h @@ -23,6 +23,7 @@ DECLARE_MGROUP(STATIC) +DECLARE_MTYPE(STATIC_ROUTE); DECLARE_MTYPE(STATIC_NEXTHOP); DECLARE_MTYPE(STATIC_PATH); diff --git a/staticd/static_routes.c b/staticd/static_routes.c index d105b2123f..05355c48fe 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -35,7 +35,7 @@ #include "static_zebra.h" #include "static_debug.h" -DEFINE_MTYPE_STATIC(STATIC, STATIC_ROUTE, "Static Route Info"); +DEFINE_MTYPE(STATIC, STATIC_ROUTE, "Static Route Info"); DEFINE_MTYPE(STATIC, STATIC_PATH, "Static Path"); /* Install static path into rib. */ @@ -546,19 +546,15 @@ void static_fixup_vrf_ids(struct static_vrf *enable_svrf) svrf = vrf->info; /* Install any static routes configured for this VRF. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + FOREACH_AFI_SAFI (afi, safi) { + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_fixup_vrf(enable_svrf, stable, - afi, safi); + static_fixup_vrf(enable_svrf, stable, afi, safi); - if (enable_svrf == svrf) - static_enable_vrf(svrf, stable, - afi, safi); - } + if (enable_svrf == svrf) + static_enable_vrf(svrf, stable, afi, safi); } } } @@ -649,20 +645,17 @@ void static_cleanup_vrf_ids(struct static_vrf *disable_svrf) svrf = vrf->info; /* Uninstall any static routes configured for this VRF. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - struct route_table *stable; + FOREACH_AFI_SAFI (afi, safi) { + struct route_table *stable; - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_cleanup_vrf(disable_svrf, stable, - afi, safi); + static_cleanup_vrf(disable_svrf, stable, afi, safi); - if (disable_svrf == svrf) - static_disable_vrf(stable, afi, safi); - } + if (disable_svrf == svrf) + static_disable_vrf(stable, afi, safi); } } } @@ -725,14 +718,12 @@ void static_install_intf_nh(struct interface *ifp) continue; /* Install any static routes configured for this interface. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + FOREACH_AFI_SAFI (afi, safi) { + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_fixup_intf_nh(stable, ifp, afi, safi); - } + static_fixup_intf_nh(stable, ifp, afi, safi); } } } diff --git a/staticd/static_vrf.c b/staticd/static_vrf.c index 39b86787ff..83894e9267 100644 --- a/staticd/static_vrf.c +++ b/staticd/static_vrf.c @@ -38,6 +38,10 @@ static void zebra_stable_node_cleanup(struct route_table *table, struct static_nexthop *nh; struct static_path *pn; struct static_route_info *si; + struct route_table *src_table; + struct route_node *src_node; + struct static_path *src_pn; + struct static_route_info *src_si; si = node->info; @@ -51,6 +55,37 @@ static void zebra_stable_node_cleanup(struct route_table *table, static_path_list_del(&si->path_list, pn); XFREE(MTYPE_STATIC_PATH, pn); } + + /* clean up for dst table */ + src_table = srcdest_srcnode_table(node); + if (src_table) { + /* This means the route_node is part of the top + * hierarchy and refers to a destination prefix. + */ + for (src_node = route_top(src_table); src_node; + src_node = route_next(src_node)) { + src_si = src_node->info; + + frr_each_safe(static_path_list, + &src_si->path_list, src_pn) { + frr_each_safe(static_nexthop_list, + &src_pn->nexthop_list, + nh) { + static_nexthop_list_del( + &src_pn->nexthop_list, + nh); + XFREE(MTYPE_STATIC_NEXTHOP, nh); + } + static_path_list_del(&src_si->path_list, + src_pn); + XFREE(MTYPE_STATIC_PATH, src_pn); + } + + XFREE(MTYPE_STATIC_ROUTE, src_node->info); + } + } + + XFREE(MTYPE_STATIC_ROUTE, node->info); } } @@ -203,14 +238,12 @@ int static_vrf_has_config(struct static_vrf *svrf) * NOTE: This is a don't care for the default VRF, but we go through * the motions to keep things consistent. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - table = svrf->stable[afi][safi]; - if (!table) - continue; - if (route_table_count(table)) - return 1; - } + FOREACH_AFI_SAFI (afi, safi) { + table = svrf->stable[afi][safi]; + if (!table) + continue; + if (route_table_count(table)) + return 1; } return 0; diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index a9b570de83..19c578c60e 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -110,7 +110,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) enum zapi_route_notify_owner note; uint32_t table_id; - if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e)) + if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, + NULL, NULL)) return -1; switch (note) { @@ -330,7 +331,8 @@ void static_zebra_nht_register(struct route_node *rn, struct static_nexthop *nh, static_nht_hash_free(nhtd); } - if (zclient_send_rnh(zclient, cmd, &p, false, nh->nh_vrf_id) < 0) + if (zclient_send_rnh(zclient, cmd, &p, false, nh->nh_vrf_id) + == ZCLIENT_SEND_FAILURE) zlog_warn("%s: Failure to send nexthop to zebra", __func__); } /* diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index 99fb7b620d..520c460f15 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -106,15 +106,13 @@ static struct bgp *bgp_create_fake(as_t *as, const char *name) // bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp; bgp_evpn_init(bgp); - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - bgp->route[afi][safi] = bgp_table_init(bgp, afi, safi); - bgp->aggregate[afi][safi] = bgp_table_init( - bgp, afi, safi); - bgp->rib[afi][safi] = bgp_table_init(bgp, afi, safi); - bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM; - bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM; - } + FOREACH_AFI_SAFI (afi, safi) { + bgp->route[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->aggregate[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->rib[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM; + bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM; + } bgp_scan_init(bgp); bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF; @@ -152,36 +150,33 @@ static int run_bgp_cfg_maximum_paths(testcase_t *t) int test_result = TEST_PASSED; bgp = t->tmp_data; - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - /* test bgp_maximum_paths_set */ - api_result = bgp_maximum_paths_set( - bgp, afi, safi, BGP_PEER_EBGP, 10, 0); - EXPECT_TRUE(api_result == 0, test_result); - api_result = bgp_maximum_paths_set( - bgp, afi, safi, BGP_PEER_IBGP, 10, 0); - EXPECT_TRUE(api_result == 0, test_result); - EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ebgp - == 10, - test_result); - EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ibgp - == 10, - test_result); - - /* test bgp_maximum_paths_unset */ - api_result = bgp_maximum_paths_unset(bgp, afi, safi, - BGP_PEER_EBGP); - EXPECT_TRUE(api_result == 0, test_result); - api_result = bgp_maximum_paths_unset(bgp, afi, safi, - BGP_PEER_IBGP); - EXPECT_TRUE(api_result == 0, test_result); - EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ebgp - == MULTIPATH_NUM), - test_result); - EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ibgp - == MULTIPATH_NUM), - test_result); - } + FOREACH_AFI_SAFI (afi, safi) { + /* test bgp_maximum_paths_set */ + api_result = bgp_maximum_paths_set(bgp, afi, safi, + BGP_PEER_EBGP, 10, 0); + EXPECT_TRUE(api_result == 0, test_result); + api_result = bgp_maximum_paths_set(bgp, afi, safi, + BGP_PEER_IBGP, 10, 0); + EXPECT_TRUE(api_result == 0, test_result); + EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ebgp == 10, + test_result); + EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ibgp == 10, + test_result); + + /* test bgp_maximum_paths_unset */ + api_result = + bgp_maximum_paths_unset(bgp, afi, safi, BGP_PEER_EBGP); + EXPECT_TRUE(api_result == 0, test_result); + api_result = + bgp_maximum_paths_unset(bgp, afi, safi, BGP_PEER_IBGP); + EXPECT_TRUE(api_result == 0, test_result); + EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ebgp + == MULTIPATH_NUM), + test_result); + EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ibgp + == MULTIPATH_NUM), + test_result); + } return test_result; } diff --git a/tests/helpers/python/frrtest.py b/tests/helpers/python/frrtest.py index 0ac54fd900..584fa90374 100644 --- a/tests/helpers/python/frrtest.py +++ b/tests/helpers/python/frrtest.py @@ -168,8 +168,8 @@ class TestMultiOut(_TestMultiOut): class TestRefMismatch(Exception): def __init__(self, _test, outtext, reftext): - self.outtext = outtext.decode("utf8") if type(outtext) is bytes else outtext - self.reftext = reftext.decode("utf8") if type(reftext) is bytes else reftext + self.outtext = outtext + self.reftext = reftext def __str__(self): rv = "Expected output and actual output differ:\n" @@ -214,7 +214,12 @@ class TestRefOut(object): [binpath(program)], stdin=subprocess.PIPE, stdout=subprocess.PIPE ) outtext, _ = proc.communicate(intext) - if outtext != reftext: - raise TestRefMismatch(self, outtext, reftext) + + # Get rid of newline problems (Windows vs Unix Style) + outtext_str = outtext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n") + reftext_str = reftext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n") + + if outtext_str != reftext_str: + raise TestRefMismatch(self, outtext_str, reftext_str) if proc.wait() != 0: raise TestExitNonzero(self) diff --git a/tests/topotests/Dockerfile b/tests/topotests/Dockerfile index b7c6298228..b7042d84c6 100644 --- a/tests/topotests/Dockerfile +++ b/tests/topotests/Dockerfile @@ -48,7 +48,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && rm -rf /var/lib/apt/lists/* RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5418F291D0D4A1AA \ + && wget -qO- https://deb.frrouting.org/frr/keys.asc | apt-key add - \ && echo "deb https://deb.frrouting.org/frr bionic frr-stable" > /etc/apt/sources.list.d/frr.list \ && apt-get update \ && apt-get install -y libyang-dev \ diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py index 0254ff6af6..84bae74f6d 100644 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -269,6 +269,9 @@ def test_error_messages_daemons(): error_logs += log log = net["r1"].getStdErr("nhrpd") + # NHRPD shows YANG model not embedded messages + # Ignore these + log = re.sub(r".*YANG model.*not embedded.*", "", log).rstrip() if log: error_logs += "r%s NHRPd StdErr Output:\n" % i error_logs += log @@ -285,7 +288,7 @@ def test_error_messages_daemons(): log = net["r%s" % i].getStdErr("zebra") if log: - error_logs += "r%s Zebra StdErr Output:\n" + error_logs += "r%s Zebra StdErr Output:\n" % i error_logs += log if error_logs: @@ -1065,7 +1068,7 @@ def test_bgp_ipv4(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += "template %s: r%s failed SHOW BGP IPv4 check:\n%s\n" % ( f, i, @@ -1134,7 +1137,7 @@ def test_bgp_ipv6(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += "template %s: r%s failed SHOW BGP IPv6 check:\n%s\n" % ( f, i, diff --git a/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf b/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf index aab35073cf..dde3c090b5 100644 --- a/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf +++ b/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf @@ -1,4 +1,3 @@ -log file /tmp/topotests/test_bgp_auth/R1/bgpd.log debugging debug bgp neighbor-events router bgp 65001 vrf blue diff --git a/tests/topotests/bgp-auth/R1/bgpd_vrf.conf b/tests/topotests/bgp-auth/R1/bgpd_vrf.conf index 73aa8c1a03..781f906d3a 100644 --- a/tests/topotests/bgp-auth/R1/bgpd_vrf.conf +++ b/tests/topotests/bgp-auth/R1/bgpd_vrf.conf @@ -1,4 +1,3 @@ -log file /tmp/topotests/test_bgp_auth/R1/bgpd.log debugging debug bgp neighbor-events router bgp 65001 vrf blue diff --git a/tests/topotests/bgp-auth/R1/zebra.conf b/tests/topotests/bgp-auth/R1/zebra.conf index d39915335a..a0b062c44c 100644 --- a/tests/topotests/bgp-auth/R1/zebra.conf +++ b/tests/topotests/bgp-auth/R1/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 1.1.1.1/32 @@ -18,4 +17,4 @@ interface R1-eth4 vrf red ip address 10.10.0.1/24 interface R1-eth5 vrf red ip address 10.20.0.1/24 -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp-auth/R2/zebra.conf b/tests/topotests/bgp-auth/R2/zebra.conf index fece68472a..fed4c27c16 100644 --- a/tests/topotests/bgp-auth/R2/zebra.conf +++ b/tests/topotests/bgp-auth/R2/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 2.2.2.2/32 @@ -18,4 +17,4 @@ interface R2-eth4 vrf red ip address 10.10.0.2/24 interface R2-eth5 vrf red ip address 10.30.0.2/24 -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp-auth/R3/zebra.conf b/tests/topotests/bgp-auth/R3/zebra.conf index 0fe3acdfd0..d49c98b168 100644 --- a/tests/topotests/bgp-auth/R3/zebra.conf +++ b/tests/topotests/bgp-auth/R3/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 3.3.3.3/32 @@ -18,4 +17,4 @@ interface R3-eth4 vrf red ip address 10.20.0.3/24 interface R3-eth5 vrf red ip address 10.30.0.3/24 -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py index 12069a12dc..54a3c699f3 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -292,6 +292,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}} logger.info("Verifying %s routes on r3", addr_type) + + # Only test the count of nexthops; the actual nexthop addresses + # can vary and are not deterministic. + # result = verify_rib( tgen, addr_type, @@ -299,7 +303,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1, next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)], protocol=protocol, + count_only=True ) + assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py index 50aa281d34..73724ac069 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -293,6 +293,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}} logger.info("Verifying %s routes on r3", addr_type) + + # Test only the count of nexthops, not the specific nexthop addresses - + # they're not deterministic + # result = verify_rib( tgen, addr_type, @@ -300,7 +304,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1, next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)], protocol=protocol, + count_only=True ) + assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) diff --git a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py index 85cfd538ff..4c56d1a02d 100644 --- a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py +++ b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py @@ -720,6 +720,64 @@ def test_evpn_df(): # tgen.mininet_cli() +def check_protodown_rc(dut, protodown_rc): + ''' + check if specified protodown reason code is set + ''' + + out = dut.vtysh_cmd("show evpn json") + + evpn_js = json.loads(out) + tmp_rc = evpn_js.get("protodownReasons", []) + + if protodown_rc: + if protodown_rc not in tmp_rc: + return "protodown %s missing in %s" % (protodown_rc, tmp_rc) + else: + if tmp_rc: + return "unexpected protodown rc %s" % (tmp_rc) + + return None + +def test_evpn_uplink_tracking(): + ''' + 1. Wait for access ports to come out of startup-delay + 2. disable uplinks and check if access ports have been protodowned + 3. enable uplinks and check if access ports have been moved out + of protodown + ''' + + tgen = get_topogen() + + dut_name = "torm11" + dut = tgen.gears[dut_name] + + # wait for protodown rc to clear after startup + test_fn = partial(check_protodown_rc, dut, None) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + + # disable the uplinks + dut.run("ip link set %s-eth0 down" % dut_name) + dut.run("ip link set %s-eth1 down" % dut_name) + + # check if the access ports have been protodowned + test_fn = partial(check_protodown_rc, dut, "uplinkDown") + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + + # enable the uplinks + dut.run("ip link set %s-eth0 up" % dut_name) + dut.run("ip link set %s-eth1 up" % dut_name) + + # check if the access ports have been moved out of protodown + test_fn = partial(check_protodown_rc, dut, None) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp-evpn-mh/torm11/zebra.conf b/tests/topotests/bgp-evpn-mh/torm11/zebra.conf index ee4e87e1c2..33e89c06ae 100644 --- a/tests/topotests/bgp-evpn-mh/torm11/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm11/zebra.conf @@ -4,11 +4,15 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm11-eth0 ip addr 192.168.1.2/24 + evpn mh uplink ! int torm11-eth1 ip addr 192.168.5.2/24 + evpn mh uplink ! int lo ip addr 192.168.100.15/32 diff --git a/tests/topotests/bgp-evpn-mh/torm12/zebra.conf b/tests/topotests/bgp-evpn-mh/torm12/zebra.conf index 736af4159e..419f62b2ac 100644 --- a/tests/topotests/bgp-evpn-mh/torm12/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm12/zebra.conf @@ -4,11 +4,16 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm12-eth0 ip addr 192.168.2.2/24 + evpn mh uplink ! int torm12-eth1 ip addr 192.168.6.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.16/32 diff --git a/tests/topotests/bgp-evpn-mh/torm21/zebra.conf b/tests/topotests/bgp-evpn-mh/torm21/zebra.conf index 0ebe6f2d95..525f5eb099 100644 --- a/tests/topotests/bgp-evpn-mh/torm21/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm21/zebra.conf @@ -4,11 +4,17 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm21-eth0 ip addr 192.168.3.2/24 + evpn mh uplink +! ! int torm21-eth1 ip addr 192.168.7.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.17/32 diff --git a/tests/topotests/bgp-evpn-mh/torm22/evpn.conf b/tests/topotests/bgp-evpn-mh/torm22/evpn.conf index b4f4f1dc25..432135c94a 100644 --- a/tests/topotests/bgp-evpn-mh/torm22/evpn.conf +++ b/tests/topotests/bgp-evpn-mh/torm22/evpn.conf @@ -5,7 +5,6 @@ debug bgp evpn mh es debug bgp evpn mh route debug bgp zebra ! -! router bgp 65005 bgp router-id 192.168.100.18 no bgp ebgp-requires-policy diff --git a/tests/topotests/bgp-evpn-mh/torm22/zebra.conf b/tests/topotests/bgp-evpn-mh/torm22/zebra.conf index 356d8a43e7..398064df6c 100644 --- a/tests/topotests/bgp-evpn-mh/torm22/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm22/zebra.conf @@ -4,11 +4,17 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm22-eth0 ip addr 192.168.4.2/24 + evpn mh uplink +! ! int torm22-eth1 ip addr 192.168.8.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.18/32 diff --git a/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py index 3f3b71dea3..089b1acb1c 100644 --- a/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py +++ b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py @@ -156,7 +156,7 @@ def test_bgp_aggregate_address_matching_med_only(): assert result is None, assertmsg -def test_bgp_aggregate_address_match_and_supress(): +def test_bgp_aggregate_address_match_and_suppress(): "Test that the command matching-MED-only with suppression works." tgen = get_topogen() @@ -206,12 +206,15 @@ def test_bgp_aggregate_address_suppress_map(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - expect_route('r2', { - "192.168.2.0/24": [{"protocol": "bgp"}], - "192.168.2.1/32": None, - "192.168.2.2/32": [{"protocol": "bgp"}], - "192.168.2.3/32": [{"protocol": "bgp"}], - }) + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": None, + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) # Change route map and test again. tgen.gears["r1"].vtysh_multicmd( @@ -224,12 +227,15 @@ aggregate-address 192.168.2.0/24 suppress-map rm-sup-two """ ) - expect_route('r2', { - "192.168.2.0/24": [{"protocol": "bgp"}], - "192.168.2.1/32": [{"protocol": "bgp"}], - "192.168.2.2/32": None, - "192.168.2.3/32": [{"protocol": "bgp"}], - }) + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": None, + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) def test_bgp_aggregate_address_suppress_map_update_route_map(): @@ -248,12 +254,15 @@ aggregate-address 192.168.2.0/24 suppress-map rm-sup-three """ ) - expect_route('r2', { - "192.168.2.0/24": [{"protocol": "bgp"}], - "192.168.2.1/32": [{"protocol": "bgp"}], - "192.168.2.2/32": [{"protocol": "bgp"}], - "192.168.2.3/32": [{"protocol": "bgp"}], - }) + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) # Create missing route map and test again. tgen.gears["r1"].vtysh_multicmd( @@ -264,12 +273,15 @@ match ip address acl-sup-three """ ) - expect_route('r2', { - "192.168.2.0/24": [{"protocol": "bgp"}], - "192.168.2.1/32": [{"protocol": "bgp"}], - "192.168.2.2/32": [{"protocol": "bgp"}], - "192.168.2.3/32": None, - }) + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": None, + }, + ) def test_memory_leak(): diff --git a/tests/topotests/bgp_default-route_route-map/__init__.py b/tests/topotests/bgp_default-route/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/tests/topotests/bgp_default-route_route-map/__init__.py +++ b/tests/topotests/bgp_default-route/__init__.py diff --git a/tests/topotests/bgp_default-route/r1/bgpd.conf b/tests/topotests/bgp_default-route/r1/bgpd.conf new file mode 100644 index 0000000000..8699d62ff2 --- /dev/null +++ b/tests/topotests/bgp_default-route/r1/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + neighbor 192.168.255.2 default-originate + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf b/tests/topotests/bgp_default-route/r1/zebra.conf index 0a283c06d5..0a283c06d5 100644 --- a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf +++ b/tests/topotests/bgp_default-route/r1/zebra.conf diff --git a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf b/tests/topotests/bgp_default-route/r2/bgpd.conf index 00c96cc58b..00c96cc58b 100644 --- a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf +++ b/tests/topotests/bgp_default-route/r2/bgpd.conf diff --git a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf b/tests/topotests/bgp_default-route/r2/zebra.conf index 606c17bec9..606c17bec9 100644 --- a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf +++ b/tests/topotests/bgp_default-route/r2/zebra.conf diff --git a/tests/topotests/bgp_default-route/test_bgp_default-originate.py b/tests/topotests/bgp_default-route/test_bgp_default-originate.py new file mode 100644 index 0000000000..d8de0f0ac6 --- /dev/null +++ b/tests/topotests/bgp_default-route/test_bgp_default-originate.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works without route-map. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_is_valid(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"valid": True}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_is_valid, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_default-route_route-map_match/__init__.py b/tests/topotests/bgp_default-route_route-map_match/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf new file mode 100644 index 0000000000..97b440f5ce --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf @@ -0,0 +1,17 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + network 192.168.13.0/24 route-map internal + neighbor 192.168.255.2 default-originate route-map default + exit-address-family +! +bgp community-list standard default seq 5 permit 65000:1 +! +route-map default permit 10 + match community default +! +route-map internal permit 10 + set community 65000:1 +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf new file mode 100644 index 0000000000..9e581a7be7 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf @@ -0,0 +1,11 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip route 192.168.13.0./24 Null0 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py new file mode 100644 index 0000000000..089c9a964e --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works with ONLY match operations. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_is_valid(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"valid": True}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_is_valid, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_default-route_route-map_match_set/__init__.py b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf new file mode 100644 index 0000000000..6ef8b1c0f4 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf @@ -0,0 +1,18 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + network 192.168.13.0/24 route-map internal + neighbor 192.168.255.2 default-originate route-map default + exit-address-family +! +bgp community-list standard default seq 5 permit 65000:1 +! +route-map default permit 10 + match community default + set metric 123 +! +route-map internal permit 10 + set community 65000:1 +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf new file mode 100644 index 0000000000..9e581a7be7 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf @@ -0,0 +1,11 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip route 192.168.13.0./24 Null0 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py index a72c3a4cbf..d9ea5db278 100644 --- a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py +++ b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py @@ -1,10 +1,6 @@ #!/usr/bin/env python -# -# bgp_default-originate_route-map.py -# Part of NetDEF Topology Tests -# -# Copyright (c) 2019 by +# Copyright (c) 2020 by # Donatas Abraitis <donatas.abraitis@gmail.com> # # Permission to use, copy, modify, and/or distribute this software @@ -23,15 +19,8 @@ # """ -bgp_default-originate_route-map.py: - -Test if works the following commands: -router bgp 65031 - address-family ipv4 unicast - neighbor 192.168.255.2 default-originate route-map default - -route-map default permit 10 - set metric 123 +Test if default-originate works with match operations. +And verify if set operations work as well. """ import os @@ -109,12 +98,12 @@ def test_bgp_default_originate_route_map(): return topotest.json_cmp(output, expected) test_func = functools.partial(_bgp_converge, router) - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) test_func = functools.partial(_bgp_default_route_has_metric, router) - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) assert ( result is None diff --git a/tests/topotests/bgp_default-route_route-map_set/__init__.py b/tests/topotests/bgp_default-route_route-map_set/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf index cb07ea9fdf..cb07ea9fdf 100644 --- a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf +++ b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf diff --git a/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf new file mode 100644 index 0000000000..0a283c06d5 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf @@ -0,0 +1,9 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py new file mode 100644 index 0000000000..9a22c58b16 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works with ONLY set operations. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_has_metric(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"metric": 123}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_has_metric, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py index 003193f108..fa155dd5fe 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py +++ b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py @@ -31,9 +31,11 @@ to send advertisements. Scenario 1: r1 has a filter applied for outgoing direction, r2 receives 192.168.255.1/32. + Scenario 2: r3 hasn't a filter appied for outgoing direction, r4 does not receive 192.168.255.1/32. + Scenario 3: r5 and r6 establish iBGP session which in turn should ignore RFC8212. All routes for both directions MUST work. @@ -63,14 +65,17 @@ class TemplateTopo(Topo): for routern in range(1, 7): tgen.add_router("r{}".format(routern)) + # Scenario 1. switch = tgen.add_switch("s1") switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears["r2"]) + # Scenario 2. switch = tgen.add_switch("s2") switch.add_link(tgen.gears["r3"]) switch.add_link(tgen.gears["r4"]) + # Scenario 3. switch = tgen.add_switch("s3") switch.add_link(tgen.gears["r5"]) switch.add_link(tgen.gears["r6"]) @@ -120,41 +125,48 @@ def test_ebgp_requires_policy(): expected = {"routes": {"172.16.255.254/32": [{"valid": True}]}} return topotest.json_cmp(output, expected) + def _bgp_advertised_routes(router): + output = json.loads( + tgen.gears[router].vtysh_cmd( + "show ip bgp neighbor 192.168.255.2 advertised-routes json" + ) + ) + expected = { + "advertisedRoutes": {}, + "totalPrefixCounter": 0, + "filteredPrefixCounter": 0, + } + return topotest.json_cmp(output, expected) + + # Scenario 1. + logger.info("Scenario 1: r2 receives 192.168.255.1/32 from r1") test_func = functools.partial(_bgp_converge, "r2") - success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r2) in "{}"'.format( - tgen.gears["r2"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (r2)" test_func = functools.partial(_bgp_has_routes, "r2") - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r2) in "{}"'.format( - tgen.gears["r2"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r2 does not receive 192.168.255.1/32" + # Scenario 2. + logger.info("Scenario 2: r3 must not send 192.168.255.1/32 to r4") test_func = functools.partial(_bgp_converge, "r4") - success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r4) in "{}"'.format( - tgen.gears["r4"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (r4)" - test_func = functools.partial(_bgp_has_routes, "r4") - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is False, 'eBGP policy is not working (r4) in "{}"'.format( - tgen.gears["r4"] - ) + test_func = functools.partial(_bgp_advertised_routes, "r3") + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r3 announced 192.168.255.1/32 to r4" + # Scenario 3. + logger.info("Scenario 3: r6 receives 192.168.255.1/32 from r5 (iBGP)") test_func = functools.partial(_bgp_converge, "r6") - success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r6) in "{}"'.format( - tgen.gears["r6"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (r6)" test_func = functools.partial(_bgp_has_routes, "r6") - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r6) in "{}"'.format( - tgen.gears["r6"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r6 does not receive 192.168.255.1/32" if __name__ == "__main__": diff --git a/tests/topotests/bgp_features/r1/ospf6d.conf b/tests/topotests/bgp_features/r1/ospf6d.conf index 532da39fb7..a38e4b862a 100644 --- a/tests/topotests/bgp_features/r1/ospf6d.conf +++ b/tests/topotests/bgp_features/r1/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r1-lo ! -interface r1-eth0 -! interface r1-eth1 + ipv6 ospf6 priority 10 ! interface r1-eth2 + ipv6 ospf6 priority 10 ! router ospf6 ospf6 router-id 192.168.0.1 log-adjacency-changes interface r1-lo area 0.0.0.0 - interface r1-eth0 area 0.0.0.0 interface r1-eth1 area 0.0.0.0 interface r1-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r1/ospf_neighbor.json b/tests/topotests/bgp_features/r1/ospf_neighbor.json index ecb97d8d74..e742c119da 100644 --- a/tests/topotests/bgp_features/r1/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r1/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.2":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ], "192.168.0.3":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ] } diff --git a/tests/topotests/bgp_features/r1/ospfd.conf b/tests/topotests/bgp_features/r1/ospfd.conf index 8f1711db7b..68a1bb5c75 100644 --- a/tests/topotests/bgp_features/r1/ospfd.conf +++ b/tests/topotests/bgp_features/r1/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +interface r1-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! +interface r1-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! router ospf ospf router-id 192.168.0.1 log-adjacency-changes @@ -13,11 +23,4 @@ router ospf refresh timer 10 ! line vty -interface r1-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! -interface r1-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 ! diff --git a/tests/topotests/bgp_features/r2/ospf6d.conf b/tests/topotests/bgp_features/r2/ospf6d.conf index 283d205489..47bd5a99cc 100644 --- a/tests/topotests/bgp_features/r2/ospf6d.conf +++ b/tests/topotests/bgp_features/r2/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r2-lo ! -interface r2-eth0 -! interface r2-eth1 + ipv6 ospf6 priority 5 ! interface r2-eth2 + ipv6 ospf6 priority 10 ! router ospf6 ospf6 router-id 192.168.0.2 log-adjacency-changes interface r2-lo area 0.0.0.0 - interface r2-eth0 area 0.0.0.0 interface r2-eth1 area 0.0.0.0 interface r2-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r2/ospf_neighbor.json b/tests/topotests/bgp_features/r2/ospf_neighbor.json index 5fcbd82ee1..2fd589ae25 100644 --- a/tests/topotests/bgp_features/r2/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r2/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.1":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ], "192.168.0.3":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ] } diff --git a/tests/topotests/bgp_features/r2/ospfd.conf b/tests/topotests/bgp_features/r2/ospfd.conf index 2174fddb11..6f608e454b 100644 --- a/tests/topotests/bgp_features/r2/ospfd.conf +++ b/tests/topotests/bgp_features/r2/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +int r2-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! +int r2-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! router ospf ospf router-id 192.168.0.2 log-adjacency-changes @@ -12,12 +22,5 @@ router ospf timers throttle lsa all 0 refresh timer 10 ! -int r2-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -int r2-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! line vty ! diff --git a/tests/topotests/bgp_features/r3/ospf6d.conf b/tests/topotests/bgp_features/r3/ospf6d.conf index 7a6623f979..eb74901ba1 100644 --- a/tests/topotests/bgp_features/r3/ospf6d.conf +++ b/tests/topotests/bgp_features/r3/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r3-lo ! -interface r3-eth0 -! interface r3-eth1 + ipv6 ospf6 priority 5 ! interface r3-eth2 + ipv6 ospf6 priority 5 ! router ospf6 ospf6 router-id 192.168.0.3 log-adjacency-changes interface r3-lo area 0.0.0.0 - interface r3-eth0 area 0.0.0.0 interface r3-eth1 area 0.0.0.0 interface r3-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r3/ospf_neighbor.json b/tests/topotests/bgp_features/r3/ospf_neighbor.json index e90a70a8f6..80fc92c3bc 100644 --- a/tests/topotests/bgp_features/r3/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r3/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.1":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ], "192.168.0.2":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ] } diff --git a/tests/topotests/bgp_features/r3/ospfd.conf b/tests/topotests/bgp_features/r3/ospfd.conf index 795344fbe6..71e4f1e1df 100644 --- a/tests/topotests/bgp_features/r3/ospfd.conf +++ b/tests/topotests/bgp_features/r3/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +int r3-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! +int r3-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! router ospf ospf router-id 192.168.0.3 log-adjacency-changes @@ -12,12 +22,5 @@ router ospf timers throttle lsa all 0 refresh timer 10 ! -int r3-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -int r3-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! line vty ! diff --git a/tests/topotests/bgp_features/test_bgp_features.py b/tests/topotests/bgp_features/test_bgp_features.py index bd092c4340..9dce9d668b 100644 --- a/tests/topotests/bgp_features/test_bgp_features.py +++ b/tests/topotests/bgp_features/test_bgp_features.py @@ -102,7 +102,7 @@ def setup_module(module): # Starting Routers router_list = tgen.routers() - for rname, router in router_list.iteritems(): + for rname, router in router_list.items(): router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) ) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py index 18d2ac59d2..097b654e77 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py @@ -28,61 +28,63 @@ Basic Common Test steps for all the test case below : - Verify for bgp to converge - Configure BGP Garceful Restart on both the routers. -1. Helper BGP router R1, mark and unmark IPV4 routes - as stale as the restarting router R2 come up within the restart time. -2. Helper BGP router R1, mark IPV4 routes as stale and - deletes them as the restarting router R2 did-not come up within restart - time. -3. Restart BGP router R1, detects it is connected to R2, - which is a helper router. Verify the restart capability i.e. R bit - are sent after R1 reloads and comes back. -4. Verify that the restarting node sets "R" bit while sending the +1. Transition from Peer-level helper to Global Restarting +2. Transition from Peer-level helper to Global inherit helper +3. Transition from Peer-level restarting to Global inherit helper +4. Default GR functional mode is Helper. +5. Verify that the restarting node sets "R" bit while sending the BGP open messages after the node restart, only if GR is enabled. -5. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps as well, even when GR restarting mode is enabled. - Here link flap happen due to interface UP/DOWN. 6. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps as well, even when GR restarting mode is enabled. - Here link flap happen due to neigh router restarts -7. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps when GR helper mode is enabled. - Here link flap happen due to interface UP/DOWN. -8. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps when GR helper mode is enabled. - Here link flap happen due to neigh router restarts. -9. Verify that restarting nodes set "F" bit while sending + during normal BGP session flaps as well, even when GR restarting + mode is enabled. Here link flap happen due to interface UP/DOWN. +7. Verify if restarting node resets R bit in BGP + open message during normal BGP session flaps when GR is disabled. +8. Verify that restarting nodes set "F" bit while sending the BGP open messages after it restarts, only when BGP GR is enabled. -10. Verify that restarting nodes reset "F" bit while sending - the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. -11. Verify that only GR helper routers keep the stale +9. Verify that only GR helper routers keep the stale route entries, not any GR disabled router. -12. Verify that GR helper routers keeps all the routes received - from restarting node if both the routers are configured as GR restarting node. -13. Verify that GR helper routers delete all the routes - received from a node if both the routers are configured as GR helper node. -14. Test Objective : After BGP neighborship is established and GR capability - is exchanged, transition helper router to disabled state. -15.Test Objective : After BGP neighborship is established and GR capability - is exchanged, transition disabled router to helper state. -16. Verify transition from Global Restarting to Disable and then - Global Disable to Restarting. -17. Verify transition from Global Helper to Disable and then Global +10. Verify that GR helper routers keeps all the routes received + from restarting node if both the routers are configured as + GR restarting node. +11. Verify that GR helper routers delete all the routes + received from a node if both the routers are configured as GR + helper node. +12. After BGP neighborship is established and GR capability is exchanged, + transition restarting router to disabled state and vice versa. +13. After BGP neighborship is established and GR capability is exchanged, + transition restarting router to disabled state and vice versa. +14. Verify that restarting nodes reset "F" bit while sending + the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. +15. Verify that only GR helper routers keep the stale + route entries, not any GR disabled router. +16. Transition from Global Restarting to Disable and then Global + Disable to Restarting. +17. Transition from Global Helper to Disable and then Global Disable to Helper. -18. Verify transition from Global Restart to Helper and then Global - Helper to Restart. -19. Verify transition from Peer-level helper to Global Restarting. -20. Verify transition from Peer-level restart to Global Restart. -21. Verify transition from Peer-level disabled to Global Restart. -22. Verify Peer-level inherit from Global Restarting mode. -23. Verify transition from Peer-level helper to Global inherit helper. -24. Verify transition from Peer-level restart to Global inherit helper. -25. Verify transition from Peer-level disbale to Global inherit helper. -26. Verify default GR functional mode is Helper. -27. Verify transition from Peer-level Helper to Global Disable. -28. Verify transition from Peer-level Restarting to Global Disable. -29. Verify transition from Peer-level Disable to Global Disable. -30. Verfiy Peer-level inherit from Global Disable mode. - +18. Transition from Global Restart to Helper and then Global + Helper to Restart, Global Mode : GR Restarting + PerPeer Mode : GR Helper + GR Mode effective : GR Helper +19. Transition from Peer-level helper to Global Restarting, + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting +20. Transition from Peer-level restart to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting +21. Transition from Peer-level disabled to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Disabled + GR Mode effective : GR Disabled +22. Peer-level inherit from Global Restarting + Global Mode : GR Restart + PerPeer Mode : None + GR Mode effective : GR Restart +23. Transition from Peer-level disbale to Global inherit helper + Global Mode : None + PerPeer Mode : GR Disable + GR Mode effective : GR Disable """ import os @@ -91,7 +93,6 @@ import json import time import inspect import pytest -from time import sleep # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -116,8 +117,9 @@ from lib.bgp import ( create_router_bgp, verify_r_bit, verify_f_bit, - verify_bgp_convergence, verify_graceful_restart_timers, + verify_bgp_convergence, + verify_bgp_convergence_from_running_config, ) from lib.common_config import ( @@ -188,7 +190,7 @@ def setup_module(mod): global ADDR_TYPES # Required linux kernel version for this suite to run. - result = required_linux_kernel_version("4.15") + result = required_linux_kernel_version("4.16") if result is not True: pytest.skip("Kernel requirements are not met") @@ -219,11 +221,10 @@ def setup_module(mod): # Api call verify whether BGP is converged ADDR_TYPES = check_address_types() - for addr_type in ADDR_TYPES: - BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) - assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format( - BGP_CONVERGENCE - ) + BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) + assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format( + BGP_CONVERGENCE + ) logger.info("Running setup_module() done") @@ -259,6 +260,12 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, dut) + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, peer) + + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + return True @@ -351,6 +358,32 @@ def test_BGP_GR_TC_46_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -423,7 +456,8 @@ def test_BGP_GR_TC_46_p1(request): } } - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = create_router_bgp(tgen, topo, input_dict) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) step("Verify on R2 that R1 advertises GR capabilities as a restarting node") @@ -440,6 +474,36 @@ def test_BGP_GR_TC_46_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, "r2", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R1") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -547,6 +611,9 @@ def test_BGP_GR_TC_50_p1(request): configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + step("Verify on R2 that R1 advertises GR capabilities as a helper node") for addr_type in ADDR_TYPES: @@ -557,6 +624,32 @@ def test_BGP_GR_TC_50_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -628,6 +721,9 @@ def test_BGP_GR_TC_50_p1(request): configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + step("Verify on R2 that R1 still advertises GR capabilities as a helper node") input_dict = { @@ -643,6 +739,36 @@ def test_BGP_GR_TC_50_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -756,6 +882,32 @@ def test_BGP_GR_TC_51_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, "r2", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R1") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -842,6 +994,36 @@ def test_BGP_GR_TC_51_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGPd on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -933,14 +1115,6 @@ def test_BGP_GR_TC_53_p1(request): tc_name, result ) - step("Kill BGPd on R2") - - kill_router_daemons(tgen, "r2", ["bgpd"]) - - step( - "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" - ) - for addr_type in ADDR_TYPES: protocol = "bgp" next_hop = next_hop_per_address_family( @@ -967,674 +1141,43 @@ def test_BGP_GR_TC_53_p1(request): tc_name, result ) - step("Start BGP on R2") - - start_router_daemons(tgen, "r2", ["bgpd"]) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_1_3_p0(request): - """ - Test Objective : Helper BGP router R1, mark and unmark IPV4 routes - as stale as the restarting router R2 come up within the restart time - - Test Objective : Helper BGP router R1, mark IPV4 routes as stale and - deletes them as the restarting router R2 did-not come up within - restart time. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Create route-map to prefer global next-hop - input_dict = { - "r1": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - "r2": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - } - result = create_route_maps(tgen, input_dict) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure neighbor for route map - input_dict_1 = { - "r1": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - } - - result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}}, - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - }, - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r2", peer="r1") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r2", peer="r1" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, "bgp") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - logger.info("[Phase 2] : R2 goes for reload ") + step("Kill BGPd on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) - logger.info( - "[Phase 3] : R2 is still down, restart time 120 sec." - " So time verify the routes are present in BGP RIB" - " and ZEBRA" + step( + "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" ) for addr_type in ADDR_TYPES: - # Verifying BGP RIB routes - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - logger.info("[Phase 4] : sleep for {} sec".format(GR_RESTART_TIMER)) - sleep(GR_RESTART_TIMER) - - logger.info("[Phase 5] : Verify the routes from r2 ") - - for addr_type in ADDR_TYPES: - # Verifying BGP RIB routes - next_hop = NEXT_HOP_IP_2[addr_type] - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - logger.info(" Expected behavior: {}".format(result)) - - # Verifying RIB routes - result = verify_rib( - tgen, addr_type, dut, input_topo, next_hop, "bgp", expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - logger.info(" Expected behavior: {}".format(result)) - - logger.info("[Phase 5] : R2 is about to come up now ") - start_router_daemons(tgen, "r2", ["bgpd"]) - - logger.info("[Phase 5] : R2 is UP Now ! ") - - for addr_type in ADDR_TYPES: - # Verifying GR stats - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r2", peer="r1" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_15_TC_9_p1(request): - """ - Test Objective : Restart BGP router R1, detects it is connected to R2, - which is a helper router. Verify the restart capability i.e. R bit - are sent after R1 reloads and comes back. - - Test Objective : Verify that restarting nodes reset "F" bit while sending - the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Checking router status, starting if not running - check_router_status(tgen) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Creating configuration from JSON - # reset_config_on_routers(tgen) - - # Create route-map to prefer global next-hop - input_dict = { - "r1": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - "r2": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - } - result = create_route_maps(tgen, input_dict) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure neighbor for route map - input_dict_1 = { - "r1": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - } - - result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - logger.info( - "[Phase 1] : Test Setup " "[Helper Mode]R1-----R2[Restart Mode] initialized " - ) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - } - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 ) - - # Verifying RIB routes - protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - logger.info("[Phase 2] : R1 goes for reload ") - - kill_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 6] : R1 is about to come up now ") - start_router_daemons(tgen, "r1", ["bgpd"]) - for addr_type in ADDR_TYPES: - # Verifying GR stats - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r2", peer="r1") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_f_bit( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_35_p1(request): - """ - Test Objective : Restart BGP router R1 connected to R2, - which is a restart router. - R1 should not send any GR capability in the open message, - however it would process open message from R2 with GR -restart - capability, but would not perform any BGP GR functionality. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Check router status - check_router_status(tgen) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Creating configuration from JSON - reset_config_on_routers(tgen) - - logger.info( - "[Phase 1] : Test Setup" " [Disable Mode]R1-----R2[Restart Mode] initialized " - ) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-disable": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-disable": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - } - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2 - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 ) - - # Verifying RIB routes - protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - logger.info("[Phase 2] : R1 goes for reload ") - - kill_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 3] : R1 is about to come up now ") - start_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - # Verifying BGP RIB routes - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2 - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) + step("Start BGP on R2") - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) + start_router_daemons(tgen, "r2", ["bgpd"]) write_test_footer(tc_name) @@ -2151,6 +1694,9 @@ def test_BGP_GR_TC_6_1_2_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r2": { @@ -3097,6 +2643,9 @@ def test_BGP_GR_TC_31_1_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r1": { @@ -3374,6 +2923,9 @@ def test_BGP_GR_TC_31_2_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r2": { @@ -3444,6 +2996,46 @@ def test_BGP_GR_TC_31_2_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + # Verifying RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + logger.info("[Phase 6] : R1 is about to come up now ") + start_router_daemons(tgen, "r1", ["bgpd"]) + + logger.info("[Phase 4] : R1 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + logger.info("[Phase 3] : R1 goes for reload ") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -3496,6 +3088,2326 @@ def test_BGP_GR_TC_31_2_p1(request): write_test_footer(tc_name) +def test_BGP_GR_TC_9_p1(request): + """ + Test Objective : Verify that restarting nodes reset "F" bit while sending + the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Phase 1] : Test Setup" " [Restart Mode]R1-----R2[Helper Mode] Initiliazed " + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + } + } + }, + "r2": { + "bgp": { + "graceful-restart": {"preserve-fw-state": True}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("[Phase 2] : R2 goes for reload ") + kill_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info( + "[Phase 3] : R2 is still down, restart time 120 sec." + "So time verify the routes are present in BGP RIB and ZEBRA " + ) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + logger.info("[Phase 5] : R2 is about to come up now ") + start_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert ( + result is True + ), "BGP Convergence after BGPd restart" " :Failed \n Error:{}".format(result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_f_bit( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_17_p1(request): + """ + Test Objective : Verify that only GR helper routers keep the stale + route entries, not any GR disabled router. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info("[Phase 1] : Test Setup [Disable]R1-----R2[Restart] " "Initiliazed ") + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + }, + } + }, + "r2": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("[Phase 2] : R2 goes for reload ") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info( + "[Phase 3] : R2 is still down, restart time 120 sec." + " So time verify the routes are present in BGP RIB and ZEBRA " + ) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + logger.info("[Phase 5] : R2 is about to come up now ") + start_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert ( + result is True + ), "BGP Convergence after BGPd restart" " :Failed \n Error:{}".format(result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_r_bit( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_43_p1(request): + """ + Test Objective : Transition from Global Restarting to Disable + and then Global Disable to Restarting. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2 retains" + " the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R1 and configure it as GR disabled node in global level") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": False, + "graceful-restart-disable": True, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 doesn't advertise any GR capabilities") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 flush all BGP routes from RIB & FIB and FIB and R2" + " does not retain stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step( + "Bring up BGPd on R1 and configure it as GR" " restarting node in global level" + ) + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_44_p1(request): + """ + Test Objective : Transition from Global Helper to Disable + and then Global Disable to Helper. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R2 as GR restating node in global level and" + " leave R1 without any GR related config" + ) + + input_dict = {"r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R2 and configure R1 as GR disabled node in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}} + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 doesn't advertise any GR capabilities") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 does not retain stale entry for received routes from R2") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + next_hop = NEXT_HOP_IP_2[addr_type] + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd on R2 and remove GR related config from R1 in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": False}}} + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_45_p1(request): + """ + Test Objective : Transition from Global Restart to Helper + and then Global Helper to Restart. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R1 and remove GR related config in global level") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": False,}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd on R2 and configure R1 as GR restarting node in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_46_p1(request): + """ + Test Objective : transition from Peer-level helper to Global Restarting + Global Mode : GR Restarting + PerPeer Mode : GR Helper + GR Mode effective : GR Helper + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 and R2 as GR restarting node in global" + " and helper in per-Peer-level" + ) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in RIB & FIB and R2 keeps stale entries in FIB using" + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "Bring up BGP on R1 and remove Peer-level GR config" + " from R1 following by a session reset" + ) + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB command and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_47_p1(request): + """ + Test Objective : transition from Peer-level restart to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global and per-Peer-level") + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "Bring up BGP on R1 and remove Peer-level GR" + " config from R1 following by a session reset" + ) + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 still advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_48_p1(request): + """ + Test Objective : transition from Peer-level disabled to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Disabled + GR Mode effective : GR Disabled + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 as GR restarting node in global level and" + " GR Disabled in per-Peer-level" + ) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 does't advertise any GR capabilities") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step("Verify on R2 and R1 that none of the routers keep stale entries") + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGP on R1 and remove Peer-level GR config from R1") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_49_p1(request): + """ + Test Objective : Peer-level inherit from Global Restarting + Global Mode : GR Restart + PerPeer Mode : None + GR Mode effective : GR Restart + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step( + "Verify that R2 receives GR restarting capabilities" + " from R1 based on inheritence" + ) + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGPd on router R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_52_p1(request): + """ + Test Objective : Transition from Peer-level disbale to Global inherit helper + Global Mode : None + PerPeer Mode : GR Disable + GR Mode effective : GR Disable + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 as GR disabled node at per Peer-level for R2" + " & R2 as GR restarting node" + ) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 does't advertise any GR capabilities") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R2 keeps the stale entries in FIB & R1 doesn't keep RIB & FIB entries." + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGP on R2 and remove Peer-level GR config from R1") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step( + "Verify on R2 that R1 advertises GR capabilities as a helper node from global inherit" + ) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index da1a47cd29..6926121a6b 100644 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -118,6 +118,7 @@ from lib.bgp import ( verify_gr_address_family, modify_bgp_config_when_bgpd_down, verify_graceful_restart_timers, + verify_bgp_convergence_from_running_config, ) from lib.common_config import ( @@ -150,6 +151,7 @@ except IOError: BGP_CONVERGENCE = False GR_RESTART_TIMER = 5 GR_SELECT_DEFER_TIMER = 5 +GR_STALEPATH_TIMER = 5 PREFERRED_NEXT_HOP = "link_local" NEXT_HOP_4 = ["192.168.1.1", "192.168.4.2"] NEXT_HOP_6 = ["fd00:0:0:1::1", "fd00:0:0:4::2"] @@ -185,7 +187,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version("4.15") + result = required_linux_kernel_version("4.16") if result is not True: pytest.skip("Kernel requirements are not met") @@ -251,6 +253,12 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, dut) + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, peer) + + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + return True @@ -653,6 +661,9 @@ def test_BGP_GR_TC_11_p0(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r3") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + for addr_type in ADDR_TYPES: result = verify_graceful_restart( tgen, topo, addr_type, input_dict, dut="r1", peer="r3" @@ -1169,7 +1180,7 @@ def test_BGP_GR_16_p2(request): tc_name, result ) - result = verify_bgp_convergence(tgen, topo) + result = verify_bgp_convergence_from_running_config(tgen, topo) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) @@ -1812,7 +1823,7 @@ def test_BGP_GR_chaos_29_p1(request): reset_config_on_routers(tgen) logger.info( - " Test Case : BGP_GR_UTP_29" + " Test Case : test_BGP_GR_chaos_29" " BGP GR [Helper Mode]R3-----R1[Restart Mode]" " and [restart-time 150]R1 initialized" ) @@ -1928,10 +1939,9 @@ def test_BGP_GR_chaos_29_p1(request): # Kill BGPd daemon on R1 kill_router_daemons(tgen, "r1", ["bgpd"]) - # Waiting for 120 sec logger.info("[Step 3] : Wait for {} seconds..".format(GR_RESTART_TIMER)) - # Waiting for 120 sec + # Waiting for GR_RESTART_TIMER sleep(GR_RESTART_TIMER) for addr_type in ADDR_TYPES: @@ -2197,7 +2207,13 @@ def test_BGP_GR_chaos_33_p1(request): else: next_hop_6 = NEXT_HOP_6[1] - result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6) + result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6, + expected=False) + assert result is not True,\ + "Testcase {} :Failed \n Error {}". \ + format(tc_name, result) + logger.info(" Expected behavior: {}".\ + format(result)) logger.info("[Step 4] : Start BGPd daemon on R1 and R4..") @@ -2523,6 +2539,9 @@ def test_BGP_GR_chaos_34_1_p1(request): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, "r1") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + for addr_type in ADDR_TYPES: # Verify f-bit after starting BGPd daemon result = verify_f_bit( @@ -2538,7 +2557,7 @@ def test_BGP_GR_chaos_34_1_p1(request): # Kill BGPd daemon on R1 kill_router_daemons(tgen, "r1", ["bgpd"]) - # Waiting for 120 sec + # Waiting for GR_RESTART_TIMER logger.info("Waiting for {} sec..".format(GR_RESTART_TIMER)) sleep(GR_RESTART_TIMER) @@ -2743,7 +2762,7 @@ def test_BGP_GR_chaos_32_p1(request): logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_dict_1) + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) assert result is not True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) @@ -3086,6 +3105,1165 @@ def test_BGP_GR_chaos_30_p1(request): write_test_footer(tc_name) +def test_BGP_GR_15_p2(request): + """ + Test Objective : Test GR scenarios by enabling Graceful Restart + for multiple address families.. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r6": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r6": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + } + } + }, + "r6": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r6") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r6" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Helper Mode]R6-----R1[Restart Mode]" + "--------R2[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + } + } + }, + "r2": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def BGP_GR_TC_7_p1(request): + """ + Verify that BGP restarting node deletes all the routes received from peer + if BGP Graceful capability is not present in BGP Open message from the + peer + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + " Verify route download to RIB: BGP_GR_TC_7 >> " + "BGP GR [Helper Mode]R3-----R1[Restart Mode] " + ) + + # Configure graceful-restart + input_dict = { + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r3"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R1 goes for reload") + kill_router_daemons(tgen, "r1", ["bgpd"]) + + # Change the configuration on router R1 + input_dict_2 = { + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + } + } + + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + + # Change the configuration on R1 + network = {"ipv4": "103.0.20.1/32", "ipv6": "3::1/128"} + for addr_type in ADDR_TYPES: + input_dict_2 = { + "r3": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + { + "network": network[addr_type], + "no_of_network": 5, + "delete": True, + } + ] + } + } + } + } + } + } + + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R1 is about to come up now") + start_router_daemons(tgen, "r1", ["bgpd"]) + logger.info("R1 is UP Now") + + # Wait for RIB stale timeout + logger.info("Verify routes are not present" "in restart router") + + for addr_type in ADDR_TYPES: + # Verifying RIB routes + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r3"]} + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_23_p1(request): + """ + Verify that helper routers are deleting stale routes after stale route + timer's expiry. If all the routes are not received from restating node + after restart. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "Verify Stale Routes are deleted on helper: BGP_GR_TC_23 >> " + "BGP GR [Helper Mode]R1-----R2[Restart Mode] " + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"timer": {"stalepath-time": GR_STALEPATH_TIMER}}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + "r2": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": {"dest_link": {"r2": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": {"dest_link": {"r2": {"graceful-restart": True}}} + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R2 goes for reload") + kill_router_daemons(tgen, "r2", ["bgpd"]) + + # Modify configuration to delete routes and include disable-eor + input_dict_3 = {"r2": {"bgp": {"graceful-restart": {"disable-eor": True}}}} + + result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3) + + # Modify configuration to delete routes and include disable-eor + network = {"ipv4": "102.0.20.1/32", "ipv6": "2::1/128"} + for addr_type in ADDR_TYPES: + input_dict_3 = { + "r2": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + { + "network": network[addr_type], + "no_of_network": 3, + "delete": True, + } + ] + } + } + } + } + } + } + + result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("BGPd comes up for r2") + start_router_daemons(tgen, "r2", ["bgpd"]) + + # Wait for stalepath timer + logger.info("Waiting for stalepath timer({} sec..)".format(GR_STALEPATH_TIMER)) + sleep(GR_STALEPATH_TIMER) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r2") + + # Verifying RIB routes + dut = "r1" + network = {"ipv4": "102.0.20.4/32", "ipv6": "2::4/128"} + for addr_type in ADDR_TYPES: + input_dict_1 = { + "r1": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + {"network": network[addr_type], "no_of_network": 2} + ] + } + } + } + } + } + } + + # Verify EOR on helper router + result = verify_eor( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, ( + "Testcase " + tc_name + " :Failed \n Error: {}".format(result) + ) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_20_p1(request): + """ + Test Objective : Verify that GR routers delete all the routes + received from a node if both the routers are configured as GR + helper node + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Restart Mode]R3-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_21_p2(request): + """ + Test Objective : VVerify BGP-GR feature when helper node is + a transit router for it's eBGP peers. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Helper Mode]R6-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r6": { + "dest_link": { + "r1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r6": { + "dest_link": { + "r1": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + }, + "r6": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r6") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r6" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]" + "--------R6[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes after bringing up BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_22_p2(request): + """ + Test Objective : Verify BGP-GR feature when helper node + is a transit router for it's iBGP peers. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": { + "graceful-restart-disable": True, + "next_hop_self": True, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": { + "graceful-restart-disable": True, + "next_hop_self": True, + } + } + } + } + } + }, + } + } + }, + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]" + "--------R3[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py index 3f1157ad72..0deb181f3e 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", 'vtysh -c "show bgp next"', "99.0.0.. valid", "wait", "See CE static NH" diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py index ea059c576e..789f93b837 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("ce1", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping") luCommand("ce2", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping") diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py index 96b4978261..af39a951b7 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "ce1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py index 9f21d99913..38eac14c64 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py index 5c7427763d..375bca8a63 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", 'vtysh -c "add vrf r1-cust1 prefix 99.0.0.1/32"', ".", "none", "IP Address" diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py index 53cf353fa0..f5145753a5 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("ce1", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180) luCommand("ce2", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180) diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py index 20113b1058..a5f95f94bf 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py @@ -1,4 +1,4 @@ -from lutil import luCommand, luLast +from lib.lutil import luCommand, luLast from lib import topotest ret = luCommand( diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py index b552ea0406..7c154ecd15 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand from customize import l3mdev_accept l3mdev_rtrs = ["r1", "r3", "r4", "ce4"] diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py index 98d2a3bafc..d55169a19e 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py @@ -1,5 +1,5 @@ -from lutil import luCommand -from bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes +from lib.lutil import luCommand +from lib.bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes ######################################################################## # CE routers: contain routes they originate diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py index af77ab01c1..a27b178548 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py index 477578bdbd..fcbc3df6ef 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py index 2b0a85a91a..dd2e24722f 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand rtrs = ["ce1", "ce2", "ce3", "r1", "r2", "r3", "r4"] for rtr in rtrs: diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py index 7990533f3a..6ce81baf11 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand ret = luCommand( "ce1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py index 3c768640a1..04ca03973d 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand num = 50000 b = int(num / (256 * 256)) diff --git a/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json b/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json index ab570fcc16..bcee7e1a12 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json +++ b/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json @@ -43,7 +43,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link1": {} + "red1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -54,7 +57,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link1": {} + "red1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -71,7 +77,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link2": {} + "red1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -82,7 +91,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link2": {} + "red1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -118,7 +130,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link1": {} + "blue1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -129,7 +144,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link1": {} + "blue1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -146,7 +164,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link2": {} + "blue1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -157,7 +178,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link2": {} + "blue1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -211,18 +235,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link1": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -233,18 +267,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link1": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -261,18 +305,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link2": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -283,18 +337,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link2": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -311,18 +375,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link3": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link3": {} + "r1-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -333,18 +407,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link3": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link3": {} + "r1-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -361,18 +445,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link4": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link4": {} + "r1-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -383,18 +477,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link4": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link4": {} + "r1-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -444,12 +548,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -460,12 +570,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -482,12 +598,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -498,12 +620,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -520,12 +648,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -536,12 +670,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -558,12 +698,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -574,12 +720,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -633,17 +785,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "red2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -658,7 +819,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -668,7 +831,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -678,7 +843,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -696,17 +863,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "red2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -721,7 +897,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -731,7 +909,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -741,7 +921,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -759,17 +941,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link3": {} + "r3-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link3": {} + "r3-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "blue2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -784,7 +975,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -794,7 +987,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -804,7 +999,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -822,17 +1019,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link4": {} + "r3-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link4": {} + "r3-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "blue2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -847,7 +1053,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -857,7 +1065,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -867,7 +1077,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -928,12 +1140,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link1": {} + "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link1": {} + "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -945,6 +1163,8 @@ "r1": { "dest_link": { "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -955,6 +1175,8 @@ "r3": { "dest_link": { "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -976,12 +1198,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link2": {} + "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link2": {} + "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -993,6 +1221,8 @@ "r1": { "dest_link": { "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1003,6 +1233,8 @@ "r3": { "dest_link": { "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1024,12 +1256,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link3": {} + "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link3": {} + "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1041,6 +1279,8 @@ "r1": { "dest_link": { "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1051,6 +1291,8 @@ "r3": { "dest_link": { "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1072,12 +1314,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link4": {} + "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link4": {} + "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1089,6 +1337,8 @@ "r1": { "dest_link": { "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1099,6 +1349,8 @@ "r3": { "dest_link": { "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1149,7 +1401,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link1": {} + "red2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1160,7 +1415,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link1": {} + "red2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1177,7 +1435,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link2": {} + "red2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1188,7 +1449,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link2": {} + "red2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1224,7 +1488,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link1": {} + "blue2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1235,7 +1502,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link1": {} + "blue2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1252,7 +1522,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link2": {} + "blue2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1263,7 +1536,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link2": {} + "blue2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index cafe758209..3190070223 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -35,7 +35,20 @@ CHAOS_5: CHAOS_9: Verify that all vrf instances fall back to backup path, if primary link goes down. - +CHAOS_6: + Restart BGPd daemon on DUT to check if all the + routes in respective vrfs are reinstalled.. +CHAOS_2: + Delete a VRF instance from DUT and check if the routes get + deleted from subsequent neighbour routers and appears again once VRF + is re-added. +CHAOS_4: + Verify that VRF names are locally significant + to a router, and end to end connectivity depends on unique + virtual circuits (using VLANs or separate physical interfaces). +CHAOS_8: + Restart all FRR services (reboot DUT) to check if all + the routes in respective vrfs are reinstalled. """ import os @@ -79,6 +92,10 @@ from lib.common_config import ( check_router_status, apply_raw_config, required_linux_kernel_version, + kill_router_daemons, + start_router_daemons, + stop_router, + start_router ) from lib.topolog import logger @@ -112,7 +129,7 @@ LOOPBACK_2 = { "ipv4": "20.20.20.20/32", "ipv6": "20::20:20/128", "ipv4_mask": "255.255.255.255", - "ipv6_mask": None, + "ipv6_mask": None } MAX_PATHS = 2 @@ -143,7 +160,7 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version("4.15") + result = required_linux_kernel_version("4.14") if result is not True: pytest.skip("Kernel requirements are not met") @@ -1194,7 +1211,7 @@ def test_shut_noshut_p1(request): result = create_router_bgp(tgen, topo, input_dict_3) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - step("Api call to modfiy BGP timerse") + step("Api call to modfiy BGP timers") input_dict_4 = { "r1": { @@ -1508,7 +1525,7 @@ def test_shut_noshut_p1(request): " when the interface is shut" ) - step("Sleeping for holddowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) result = verify_bgp_convergence(tgen, topo, expected=False) @@ -1718,7 +1735,7 @@ def test_vrf_vlan_routing_table_p1(request): tc_name, result ) - step("Api call to modfiy BGP timerse") + step("Api call to modfiy BGP timers") input_dict_4 = { "r3": { @@ -1780,7 +1797,7 @@ def test_vrf_vlan_routing_table_p1(request): tc_name, result ) - step("Sleeping for holdowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) for addr_type in ADDR_TYPES: @@ -1811,7 +1828,7 @@ def test_vrf_vlan_routing_table_p1(request): ) step( - "After deleting VRFs ipv6 addresses wil be deleted from kernel " + "After deleting VRFs ipv6 addresses will be deleted from kernel " " Adding back ipv6 addresses" ) @@ -1829,7 +1846,7 @@ def test_vrf_vlan_routing_table_p1(request): tgen, dut, intf_name, intf_ipv6, vrf, create=False ) - step("Sleeping for holdowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) for addr_type in ADDR_TYPES: @@ -2011,6 +2028,1782 @@ def test_vrf_route_leaking_next_hop_interface_flapping_p1(request): write_test_footer(tc_name) +def test_restart_bgpd_daemon_p1(request): + """ + CHAOS_6: + Restart BGPd daemon on DUT to check if all the + routes in respective vrfs are reinstalled.. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + reset_config_on_routers(tgen) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from RED_1" + " in vrf instances(RED_A and RED_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from BLUE_1 in" + " vrf instances(BLUE_A and BLUE_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static..") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Kill BGPd daemon on R1.") + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd daemon on R1.") + start_router_daemons(tgen, "r1", ["bgpd"]) + + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_delete_and_re_add_vrf_p1(request): + """ + CHAOS_2: + Delete a VRF instance from DUT and check if the routes get + deleted from subsequent neighbour routers and appears again once VRF + is re-added. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + step( + "Advertise unique prefixes in BGP using static redistribution" + "for both vrfs (RED_A and RED_B) on router RED_1" + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique prefixes in BGP using static redistribution" + " for both vrfs (BLUE_A and BLUE_B) on router BLUE_1." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static for vrfs RED_A and RED_B and BLUE_A and BLUE_B") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Verifying RIB and FIB before deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r1": { + "bgp": [ + { + "local_as": "100", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link3": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link3": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link4": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link4": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + } + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r1", vrf=["RED_A", "RED_B", "BLUE_A", "BLUE_B"]) + + step("Delete vrfs RED_A and BLUE_A from R1.") + + input_dict = { + "r1": { + "vrfs": [ + {"name": "RED_A", "id": "1", "delete": True}, + {"name": "BLUE_A", "id": "3", "delete": True}, + ] + } + } + + result = create_vrf_cfg(tgen, input_dict) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "R2 must not receive the prefixes(in respective vrfs)" + "originated from RED_1 and BLUE_1." + ) + + step("Wait for {}+1 sec..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + }, + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + }, + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour:" + " Routes are not present \n Error {}".format(tc_name, result) + ) + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour:" + " Routes are not present \n Error {}".format(tc_name, result) + ) + + step("Add vrfs again RED_A and BLUE_A on R1.") + + result = create_vrf_cfg(tgen, {"r1": topo["routers"]["r1"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + create_interfaces_cfg(tgen, {"r1": topo["routers"]["r1"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "After deleting VRFs ipv6 addresses will be deleted from kernel " + " Adding back ipv6 addresses" + ) + + dut = "r1" + vrfs = ["RED_A", "BLUE_A"] + + for vrf in vrfs: + for c_link, c_data in topo["routers"][dut]["links"].items(): + if c_data["vrf"] != vrf: + continue + + intf_name = c_data["interface"] + intf_ipv6 = c_data["ipv6"] + + create_interface_in_kernel( + tgen, dut, intf_name, intf_ipv6, vrf, create=False + ) + + step( + "R2 should now receive the prefixes(in respective vrfs)" + "again. Check the debugging logs as well. For verification" + " use same commands as mention in step-3." + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_vrf_name_significance_p1(request): + """ + CHAOS_4: + Verify that VRF names are locally significant + to a router, and end to end connectivity depends on unique + virtual circuits (using VLANs or separate physical interfaces). + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + step( + "Advertise unique prefixes in BGP using static redistribution" + "for both vrfs (RED_A and RED_B) on router RED_1" + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique prefixes in BGP using static redistribution" + " for both vrfs (BLUE_A and BLUE_B) on router BLUE_1." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static for vrfs RED_A and RED_B and BLUE_A and BLUE_B") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Configure allowas-in on red2 and blue2") + + input_dict_4 = { + "red2": { + "bgp": [ + { + "local_as": "500", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + { + "local_as": "500", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + ] + }, + "blue2": { + "bgp": [ + { + "local_as": "800", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + { + "local_as": "800", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + ] + }, + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Verifying RIB and FIB before deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_3 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + input_dict_4 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r3": { + "bgp": [ + { + "local_as": "200", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + "red2": { + "bgp": [ + { + "local_as": "500", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "500", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + "blue2": { + "bgp": [ + { + "local_as": "800", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "800", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r3", vrf=["RED_A", "RED_B", "BLUE_A", "BLUE_B"]) + + clear_bgp(tgen, addr_type, "red2", vrf=["RED_A", "RED_B"]) + + clear_bgp(tgen, addr_type, "blue2", vrf=["BLUE_A", "BLUE_B"]) + + step("Delete vrfs RED_A and BLUE_A from R3") + + input_dict = { + "r3": { + "vrfs": [ + {"name": "RED_A", "id": "1", "delete": True}, + {"name": "BLUE_A", "id": "3", "delete": True}, + ] + } + } + + result = create_vrf_cfg(tgen, input_dict) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Waiting for {}+1..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + step("Verify RIB and FIB after deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert ( + result is not True + ), "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert ( + result is not True + ), "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + ) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + ) + + step("Create 2 new VRFs PINK_A and GREY_A IN R3") + + topo_modify = deepcopy(topo) + topo_modify["routers"]["r3"]["vrfs"][0]["name"] = "PINK_A" + topo_modify["routers"]["r3"]["vrfs"][0]["id"] = "1" + topo_modify["routers"]["r3"]["vrfs"][2]["name"] = "GREY_A" + topo_modify["routers"]["r3"]["vrfs"][2]["id"] = "3" + + topo_modify["routers"]["r3"]["links"]["red2-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["blue2-link1"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["links"]["r2-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["r2-link3"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["links"]["r4-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["r4-link3"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["bgp"][0]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["bgp"][2]["vrf"] = "GREY_A" + + result = create_vrf_cfg(tgen, {"r3": topo_modify["routers"]["r3"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + create_interfaces_cfg(tgen, {"r3": topo_modify["routers"]["r3"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = create_router_bgp(tgen, topo_modify["routers"]) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r3": { + "bgp": [ + { + "local_as": "200", + "vrf": "PINK_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "GREY_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + } + } + + result = create_router_bgp(tgen, topo_modify, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r3", vrf=["PINK_A", "RED_B", "GREY_A", "BLUE_B"]) + + step( + "After deleting VRFs ipv6 addresses will be deleted from kernel " + " Adding back ipv6 addresses" + ) + + dut = "r3" + vrfs = ["GREY_A", "PINK_A"] + + for vrf in vrfs: + for c_link, c_data in topo_modify["routers"][dut]["links"].items(): + if c_data["vrf"] != vrf: + continue + + intf_name = c_data["interface"] + intf_ipv6 = c_data["ipv6"] + + create_interface_in_kernel( + tgen, dut, intf_name, intf_ipv6, vrf, create=False + ) + + step("Waiting for {}+1 sec..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + step( + "Advertised prefixes should appear again in respective VRF" + " table on routers RED_2 and BLUE_2. Verify fib and rib entries" + ) + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_3 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + input_dict_4 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_restart_frr_services_p1(request): + """ + CHAOS_8: + Restart all FRR services (reboot DUT) to check if all + the routes in respective vrfs are reinstalled. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from RED_1" + " in vrf instances(RED_A and RED_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from BLUE_1 in" + " vrf instances(BLUE_A and BLUE_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static..") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Restart frr on R1") + stop_router(tgen, "r1") + start_router(tgen, "r1") + + for addr_type in ADDR_TYPES: + dut = "r2" + + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py index 6344f7bb40..7635f74125 100644 --- a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py +++ b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py @@ -332,7 +332,7 @@ def test_bgp_routingTable(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += ( "template %s: r%s failed Routing Table Check for view %s:\n%s\n" % (f, i, view, diffresult[f]) diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py index f4b4da55d2..bc47dfc85c 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py index 9fdef84cdf..e68fac86fa 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py index 1caa827ce2..24b3cba96e 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("r1", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI") luCommand("r2", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI") diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py index e68e9e93ab..f5c2db25ff 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py index eea977bfaf..7201ac8111 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_suppress_fib/r1/bgpd.conf b/tests/topotests/bgp_suppress_fib/r1/bgpd.conf new file mode 100644 index 0000000000..69c563d37c --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r1/bgpd.conf @@ -0,0 +1,15 @@ +! exit1 +router bgp 1 + no bgp ebgp-requires-policy + neighbor 10.0.0.2 remote-as 2 + + address-family ipv4 unicast + redistribute static + neighbor 10.0.0.2 route-map rmap out + exit-address-family + +ip prefix-list plist seq 5 permit any + +route-map rmap permit 1 + match ip address prefix-list plist +! diff --git a/tests/topotests/bgp_suppress_fib/r1/zebra.conf b/tests/topotests/bgp_suppress_fib/r1/zebra.conf new file mode 100644 index 0000000000..7b442164ff --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r1/zebra.conf @@ -0,0 +1,9 @@ +! exit1 +interface r1-eth0 + ip address 10.0.0.1/30 +! +ip forwarding +! +ip route 40.0.0.0/8 blackhole +ip route 50.0.0.0/8 blackhole +! diff --git a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf new file mode 100644 index 0000000000..8321c915e3 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf @@ -0,0 +1,6 @@ +! +router bgp 2 + no bgp ebgp-requires-policy + bgp suppress-fib-pending + neighbor 10.0.0.1 remote-as 1 + neighbor 10.0.0.10 remote-as 3 diff --git a/tests/topotests/bgp_suppress_fib/r2/zebra.conf b/tests/topotests/bgp_suppress_fib/r2/zebra.conf new file mode 100644 index 0000000000..443fffc703 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r2/zebra.conf @@ -0,0 +1,13 @@ +! +interface r2-eth0 + ip address 10.0.0.2/30 +! +interface r2-eth1 + ip address 10.0.0.9/30 + +access-list access seq 5 permit 40.0.0.0/8 + +route-map LIMIT permit 10 + match ip address access + +ip protocol bgp route-map LIMIT diff --git a/tests/topotests/bgp_suppress_fib/r3/bgpd.conf b/tests/topotests/bgp_suppress_fib/r3/bgpd.conf new file mode 100644 index 0000000000..11715d45d7 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/bgpd.conf @@ -0,0 +1,9 @@ +! +router bgp 3 + no bgp ebgp-requires-policy + neighbor 10.0.0.9 remote-as 2 + +route-map rmap permit 1 + match ip address prefix-list plist + ! +! diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_route.json b/tests/topotests/bgp_suppress_fib/r3/v4_route.json new file mode 100644 index 0000000000..19294eb492 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/v4_route.json @@ -0,0 +1,29 @@ +{ + "40.0.0.0\/8":[ + { + "prefix":"40.0.0.0\/8", + "protocol":"bgp", + "selected":true, + "destSelected":true, + "distance":20, + "metric":0, + "installed":true, + "table":254, + "internalStatus":16, + "internalFlags":8, + "internalNextHopNum":1, + "internalNextHopActiveNum":1, + "nexthops":[ + { + "flags":3, + "fib":true, + "ip":"10.0.0.9", + "afi":"ipv4", + "interfaceIndex":2, + "interfaceName":"r3-eth0", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_route2.json b/tests/topotests/bgp_suppress_fib/r3/v4_route2.json new file mode 100644 index 0000000000..a35d49e9e8 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/v4_route2.json @@ -0,0 +1,4 @@ +{ + "0.0.0.0\/0":[ + ] +} diff --git a/tests/topotests/bgp_suppress_fib/r3/zebra.conf b/tests/topotests/bgp_suppress_fib/r3/zebra.conf new file mode 100644 index 0000000000..793b043a7b --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/zebra.conf @@ -0,0 +1,6 @@ +! +interface r3-eth0 + ip address 10.0.0.10/30 +! +ip forwarding +! diff --git a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py new file mode 100644 index 0000000000..cf8be5f44f --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python + +# +# test_bgp_suppress_fib.py +# +# Copyright (c) 2019 by +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +""" + +import os +import sys +import json +import time +import pytest +from functools import partial +from time import sleep + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 4): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r2"]) + switch.add_link(tgen.gears["r3"]) + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_route(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r3 = tgen.gears["r3"] + + sleep(5) + + json_file = "{}/r3/v4_route.json".format(CWD) + expected = json.loads(open(json_file).read()) + + test_func = partial( + topotest.router_json_cmp, + r3, + "show ip route 40.0.0.0 json", + expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=2, wait=0.5) + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + + json_file = "{}/r3/v4_route2.json".format(CWD) + expected = json.loads(open(json_file).read()) + + test_func = partial( + topotest.router_json_cmp, + r3, + "show ip route 50.0.0.0 json", + expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=3, wait=0.5) + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref index 387d3b43d7..b7d52cecca 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref @@ -134,27 +134,6 @@ ] } ], - "10.0.2.0\/24":[ - { - "prefix":"10.0.2.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.2.4", - "afi":"ipv4", - "interfaceName":"eth-rt4-1" - }, - { - "ip":"10.0.3.4", - "afi":"ipv4", - "interfaceName":"eth-rt4-2", - "active":true - } - ] - } - ], "10.0.3.0\/24":[ { "prefix":"10.0.3.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref index 4dc0dd7cac..f2a54bf958 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref @@ -278,21 +278,6 @@ ] } ], - "10.0.7.0\/24":[ - { - "prefix":"10.0.7.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.7.6", - "afi":"ipv4", - "interfaceName":"eth-rt6" - } - ] - } - ], "10.0.8.0\/24":[ { "prefix":"10.0.8.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref index 620f5eac67..29f4782482 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref @@ -274,21 +274,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref index 19cdf9d896..dc61b86410 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref index 48b5e6491e..2d983c43b6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref @@ -254,21 +254,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref index dba5e8d8a2..88485477e3 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref @@ -275,21 +275,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref index ece747bdac..769bc4d31e 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref @@ -275,21 +275,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref index 156beef0f1..0a64db60f6 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref index 90588c6708..34cbf68b21 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref @@ -281,21 +281,6 @@ ] } ], - "10.0.6.0\/24":[ - { - "prefix":"10.0.6.0\/24", - "protocol":"isis", - "distance":115, - "metric":20, - "nexthops":[ - { - "ip":"10.0.6.4", - "afi":"ipv4", - "interfaceName":"eth-rt4" - } - ] - } - ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref index e3ed7c20b2..aa0357d750 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref @@ -103,13 +103,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.1.2" + "nexthop":"10.0.1.3" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.1.3" + "nexthop":"10.0.1.2" } ] }, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff index 1a9307ddb9..10b336f5b8 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step3/show_ip_route.ref 2020-09-25 17:48:05.062911204 -0300 -+++ rt1/step4/show_ip_route.ref 2020-09-25 17:49:01.563647190 -0300 +--- a/rt1/step3/show_ip_route.ref ++++ b/rt1/step4/show_ip_route.ref @@ -60,10 +60,7 @@ "ip":"10.0.1.2", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff index f5036aeda8..904aaa1ce2 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step3/show_ipv6_route.ref 2020-09-25 17:48:06.358928078 -0300 -+++ rt1/step4/show_ipv6_route.ref 2020-09-25 17:49:02.791663194 -0300 +--- a/rt1/step3/show_ipv6_route.ref ++++ b/rt1/step4/show_ipv6_route.ref @@ -57,10 +57,7 @@ "fib":true, "afi":"ipv6", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff index 30c612b544..d7d8753131 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step3/show_mpls_table.ref 2020-09-25 17:48:03.782894539 -0300 -+++ rt1/step4/show_mpls_table.ref 2020-09-25 17:49:00.343631290 -0300 +--- a/rt1/step3/show_mpls_table.ref ++++ b/rt1/step4/show_mpls_table.ref @@ -47,30 +47,6 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff index 79a452ef69..b583fa97bd 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step4/show_ip_route.ref 2020-09-25 17:49:01.563647190 -0300 -+++ rt1/step5/show_ip_route.ref 2020-09-25 17:50:12.144567593 -0300 +--- a/rt1/step4/show_ip_route.ref ++++ b/rt1/step5/show_ip_route.ref @@ -60,7 +60,10 @@ "ip":"10.0.1.2", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff index 805266aaaa..d608abec98 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step4/show_ipv6_route.ref 2020-09-25 17:49:02.791663194 -0300 -+++ rt1/step5/show_ipv6_route.ref 2020-09-25 17:50:13.428584346 -0300 +--- a/rt1/step4/show_ipv6_route.ref ++++ b/rt1/step5/show_ipv6_route.ref @@ -57,7 +57,10 @@ "fib":true, "afi":"ipv6", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff index d7ab66ee18..b5161fcd55 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step4/show_mpls_table.ref 2020-09-25 17:49:00.343631290 -0300 -+++ rt1/step5/show_mpls_table.ref 2020-09-25 17:50:10.868550944 -0300 +--- a/rt1/step4/show_mpls_table.ref ++++ b/rt1/step5/show_mpls_table.ref @@ -47,6 +47,30 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff index 9aa0cd2e39..726aed514f 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step6/show_ip_route.ref 2020-09-25 17:51:15.105389461 -0300 -+++ rt1/step7/show_ip_route.ref 2020-09-25 17:52:02.014002243 -0300 +--- a/rt1/step6/show_ip_route.ref ++++ b/rt1/step7/show_ip_route.ref @@ -83,10 +83,7 @@ "ip":"10.0.1.3", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff index 52fd7caf91..2049f6fa19 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step6/show_ipv6_route.ref 2020-09-25 17:51:16.345405655 -0300 -+++ rt1/step7/show_ipv6_route.ref 2020-09-25 17:52:03.230018133 -0300 +--- a/rt1/step6/show_ipv6_route.ref ++++ b/rt1/step7/show_ipv6_route.ref @@ -79,10 +79,7 @@ "fib":true, "afi":"ipv6", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff index 53332be569..22301ba1ff 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step6/show_mpls_table.ref 2020-09-25 17:51:13.861373215 -0300 -+++ rt1/step7/show_mpls_table.ref 2020-09-25 17:52:00.769985988 -0300 +--- a/rt1/step6/show_mpls_table.ref ++++ b/rt1/step7/show_mpls_table.ref @@ -71,30 +71,6 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff index af9f72e718..4a1d4805a4 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step7/show_ip_route.ref 2020-09-25 17:52:02.014002243 -0300 -+++ rt1/step8/show_ip_route.ref 2020-09-25 17:53:20.003021800 -0300 +--- a/rt1/step7/show_ip_route.ref ++++ b/rt1/step8/show_ip_route.ref @@ -83,7 +83,10 @@ "ip":"10.0.1.3", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff index b733b33ed9..eaece74e48 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step7/show_ipv6_route.ref 2020-09-25 17:52:03.230018133 -0300 -+++ rt1/step8/show_ipv6_route.ref 2020-09-25 17:53:21.239037966 -0300 +--- a/rt1/step7/show_ipv6_route.ref ++++ b/rt1/step8/show_ipv6_route.ref @@ -79,7 +79,10 @@ "fib":true, "afi":"ipv6", diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff index b6f8c962f0..46c17de019 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step7/show_mpls_table.ref 2020-09-25 17:52:00.769985988 -0300 -+++ rt1/step8/show_mpls_table.ref 2020-09-25 17:53:18.671004379 -0300 +--- a/rt1/step7/show_mpls_table.ref ++++ b/rt1/step8/show_mpls_table.ref @@ -71,6 +71,30 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff index 1d96341557..06efdc96ce 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step8/show_ip_route.ref 2020-09-25 17:53:20.003021800 -0300 -+++ rt1/step9/show_ip_route.ref 2020-09-25 17:54:37.700038367 -0300 +--- a/rt1/step8/show_ip_route.ref ++++ b/rt1/step9/show_ip_route.ref @@ -85,7 +85,7 @@ "interfaceName":"eth-sw1", "active":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff index 232b823ac2..a58f2d447c 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step8/show_ipv6_route.ref 2020-09-25 17:53:21.239037966 -0300 -+++ rt1/step9/show_ipv6_route.ref 2020-09-25 17:54:38.912054230 -0300 +--- a/rt1/step8/show_ipv6_route.ref ++++ b/rt1/step9/show_ipv6_route.ref @@ -81,7 +81,7 @@ "interfaceName":"eth-sw1", "active":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff index 7f0d50f5f2..c0a1ac592b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt1/step8/show_mpls_table.ref 2020-09-25 17:53:18.671004379 -0300 -+++ rt1/step9/show_mpls_table.ref 2020-09-25 17:54:36.428021718 -0300 +--- a/rt1/step8/show_mpls_table.ref ++++ b/rt1/step9/show_mpls_table.ref @@ -71,30 +71,6 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref index 23e07b7cda..7e1ccd10a2 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref @@ -233,7 +233,10 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref index d9bd04ef30..6d31f6f26b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref @@ -104,7 +104,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, "backupIndex":[ 0 @@ -116,7 +116,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "backupIndex":[ 0 @@ -152,7 +152,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", "active":true, "labels":[ 16051 @@ -161,7 +161,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ 16051 @@ -170,7 +170,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "labels":[ 16051 @@ -192,7 +192,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, "backupIndex":[ 0 @@ -204,7 +204,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "backupIndex":[ 0 @@ -218,7 +218,10 @@ { "afi":"ipv6", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref index cd2f879593..b9b906a31d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref @@ -247,7 +247,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.1.3" } ] @@ -278,7 +278,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-sw1" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff index 22b896f684..90e0895639 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step1/show_ip_route.ref 2020-09-25 17:46:27.537642781 -0300 -+++ rt2/step2/show_ip_route.ref 2020-09-25 17:46:57.306029668 -0300 +--- a/rt2/step1/show_ip_route.ref ++++ b/rt2/step2/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -74,7 +74,7 @@ ] } ], -@@ -248,40 +196,12 @@ +@@ -251,40 +199,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -117,7 +117,7 @@ } ] } -@@ -377,24 +297,6 @@ +@@ -380,24 +300,6 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", @@ -142,7 +142,7 @@ "active":true } ] -@@ -415,24 +317,6 @@ +@@ -418,24 +320,6 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff index 08c7d2b1fc..2d19f20f63 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step1/show_ipv6_route.ref 2020-09-25 17:46:28.865660035 -0300 -+++ rt2/step2/show_ipv6_route.ref 2020-09-25 17:46:58.514045373 -0300 +--- a/rt2/step1/show_ipv6_route.ref ++++ b/rt2/step2/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff index 4feb927156..01fc74a60b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step1/show_mpls_table.ref 2020-09-25 17:46:26.261626203 -0300 -+++ rt2/step2/show_mpls_table.ref 2020-09-25 17:46:56.086013807 -0300 +--- a/rt2/step1/show_mpls_table.ref ++++ b/rt2/step2/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff index af1cebc76d..d93f036229 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step2/show_ip_route.ref 2020-09-25 17:46:57.306029668 -0300 -+++ rt2/step3/show_ip_route.ref 2020-09-25 17:48:05.274913964 -0300 +--- a/rt2/step2/show_ip_route.ref ++++ b/rt2/step3/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -74,7 +74,7 @@ ] } ], -@@ -196,12 +248,40 @@ +@@ -199,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -117,7 +117,7 @@ } ] } -@@ -297,6 +377,24 @@ +@@ -300,6 +380,24 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", @@ -142,7 +142,7 @@ "active":true } ] -@@ -317,6 +415,24 @@ +@@ -320,6 +418,24 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff index 9809c316e8..68b618e91d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step2/show_ipv6_route.ref 2020-09-25 17:46:58.514045373 -0300 -+++ rt2/step3/show_ipv6_route.ref 2020-09-25 17:48:06.570930838 -0300 +--- a/rt2/step2/show_ipv6_route.ref ++++ b/rt2/step3/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff index 180323e4c8..966e153a6b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step2/show_mpls_table.ref 2020-09-25 17:46:56.086013807 -0300 -+++ rt2/step3/show_mpls_table.ref 2020-09-25 17:48:03.994897300 -0300 +--- a/rt2/step2/show_mpls_table.ref ++++ b/rt2/step3/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff index 12d45bbe07..dd75d76b9b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step3/show_ip_route.ref 2020-09-25 17:48:05.274913964 -0300 -+++ rt2/step4/show_ip_route.ref 2020-09-25 17:49:01.763649797 -0300 +--- a/rt2/step3/show_ip_route.ref ++++ b/rt2/step4/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -147,7 +147,7 @@ ] } ], -@@ -248,40 +177,12 @@ +@@ -251,40 +180,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff index fdf658d59d..63731237ec 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step3/show_ipv6_route.ref 2020-09-25 17:48:06.570930838 -0300 -+++ rt2/step4/show_ipv6_route.ref 2020-09-25 17:49:02.995665853 -0300 +--- a/rt2/step3/show_ipv6_route.ref ++++ b/rt2/step4/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -100,10 +100,10 @@ ] } ] -@@ -162,19 +107,13 @@ +@@ -153,10 +98,7 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", - "active":true, - "labels":[ - 16051 @@ -112,8 +112,10 @@ }, { "fib":true, +@@ -171,10 +113,7 @@ + "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true, - "labels":[ - 16051 diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff index a78f79c576..3872ce4980 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step3/show_mpls_table.ref 2020-09-25 17:48:03.994897300 -0300 -+++ rt2/step4/show_mpls_table.ref 2020-09-25 17:49:00.551634001 -0300 +--- a/rt2/step3/show_mpls_table.ref ++++ b/rt2/step4/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff index 7d20fad3f4..4d5636436c 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step4/show_ip_route.ref 2020-09-25 17:49:01.763649797 -0300 -+++ rt2/step5/show_ip_route.ref 2020-09-25 17:50:12.360570411 -0300 +--- a/rt2/step4/show_ip_route.ref ++++ b/rt2/step5/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -147,7 +147,7 @@ ] } ], -@@ -177,12 +248,40 @@ +@@ -180,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff index 9330964338..f9e0276f85 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step4/show_ipv6_route.ref 2020-09-25 17:49:02.995665853 -0300 -+++ rt2/step5/show_ipv6_route.ref 2020-09-25 17:50:13.636587060 -0300 +--- a/rt2/step4/show_ipv6_route.ref ++++ b/rt2/step5/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -100,10 +100,10 @@ ] } ] -@@ -107,13 +162,19 @@ +@@ -98,7 +153,10 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", - "active":true + "active":true, + "labels":[ @@ -112,8 +112,10 @@ }, { "fib":true, +@@ -113,7 +171,10 @@ + "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true + "active":true, + "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff index b1e44a727f..6aebbd6c82 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step4/show_mpls_table.ref 2020-09-25 17:49:00.551634001 -0300 -+++ rt2/step5/show_mpls_table.ref 2020-09-25 17:50:11.068553553 -0300 +--- a/rt2/step4/show_mpls_table.ref ++++ b/rt2/step5/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff index c92195d704..5e73b97844 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step6/show_ip_route.ref 2020-09-25 17:51:15.313392177 -0300 -+++ rt2/step7/show_ip_route.ref 2020-09-25 17:52:02.210004805 -0300 +--- a/rt2/step6/show_ip_route.ref ++++ b/rt2/step7/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ } ] } -@@ -248,40 +169,12 @@ +@@ -251,40 +172,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -296,30 +189,13 @@ +@@ -299,30 +192,13 @@ { "ip":"10.0.2.4", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -335,29 +211,12 @@ +@@ -338,29 +214,12 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", @@ -252,7 +252,7 @@ } ] } -@@ -494,31 +353,14 @@ +@@ -497,31 +356,14 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff index 140c7b08bf..5dc4e59151 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step6/show_ipv6_route.ref 2020-09-25 17:51:16.549408319 -0300 -+++ rt2/step7/show_ipv6_route.ref 2020-09-25 17:52:03.438020851 -0300 +--- a/rt2/step6/show_ipv6_route.ref ++++ b/rt2/step7/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -72,7 +72,7 @@ ], @@ -106,9 +58,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, - "backupIndex":[ - 0 @@ -82,7 +82,7 @@ ] @@ -118,24 +67,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, - "backupIndex":[ - 0 @@ -108,7 +108,7 @@ @@ -153,28 +88,19 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", - "active":true, - "labels":[ - 16051 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", - "active":true, - "labels":[ - 16051 @@ -128,7 +128,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true, - "labels":[ - 16051 diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff index f8476cd0bb..6c0d7392f0 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step6/show_mpls_table.ref 2020-09-25 17:51:14.073375985 -0300 -+++ rt2/step7/show_mpls_table.ref 2020-09-25 17:52:00.973988653 -0300 +--- a/rt2/step6/show_mpls_table.ref ++++ b/rt2/step7/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff index 7d5237e740..f5df607613 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step7/show_ip_route.ref 2020-09-25 17:52:02.210004805 -0300 -+++ rt2/step8/show_ip_route.ref 2020-09-25 17:53:20.207024469 -0300 +--- a/rt2/step7/show_ip_route.ref ++++ b/rt2/step8/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ } ] } -@@ -169,12 +248,40 @@ +@@ -172,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -189,13 +296,30 @@ +@@ -192,13 +299,30 @@ { "ip":"10.0.2.4", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -211,12 +335,29 @@ +@@ -214,12 +338,29 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", @@ -252,7 +252,7 @@ } ] } -@@ -353,14 +494,31 @@ +@@ -356,14 +497,31 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff index 45322214e6..125f36b1b4 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step7/show_ipv6_route.ref 2020-09-25 17:52:03.438020851 -0300 -+++ rt2/step8/show_ipv6_route.ref 2020-09-25 17:53:21.443040633 -0300 +--- a/rt2/step7/show_ipv6_route.ref ++++ b/rt2/step8/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -72,7 +72,7 @@ ], @@ -58,6 +106,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, + "backupIndex":[ + 0 @@ -82,7 +82,7 @@ ] @@ -67,10 +118,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, + "backupIndex":[ + 0 @@ -108,7 +108,7 @@ @@ -88,19 +153,28 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", - "active":true + "active":true, + "labels":[ @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ @@ -128,7 +128,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true + "active":true, + "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff index 083c647802..a1d5d795c5 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step7/show_mpls_table.ref 2020-09-25 17:52:00.973988653 -0300 -+++ rt2/step8/show_mpls_table.ref 2020-09-25 17:53:18.923007676 -0300 +--- a/rt2/step7/show_mpls_table.ref ++++ b/rt2/step8/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff index 15370a0a62..2475c639c1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step8/show_ip_route.ref 2020-09-25 17:53:20.207024469 -0300 -+++ rt2/step9/show_ip_route.ref 2020-09-25 17:54:37.908041089 -0300 +--- a/rt2/step8/show_ip_route.ref ++++ b/rt2/step9/show_ip_route.ref @@ -31,7 +31,7 @@ "interfaceName":"eth-rt4-1", "active":true, @@ -72,7 +72,7 @@ ] } ] -@@ -271,7 +271,7 @@ +@@ -274,7 +274,7 @@ "interfaceName":"eth-rt4-1", "active":true, "labels":[ @@ -81,7 +81,7 @@ ] }, { -@@ -280,7 +280,7 @@ +@@ -283,7 +283,7 @@ "interfaceName":"eth-rt4-2", "active":true, "labels":[ @@ -90,7 +90,7 @@ ] } ] -@@ -318,7 +318,7 @@ +@@ -321,7 +321,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ @@ -99,7 +99,7 @@ ] } ] -@@ -356,7 +356,7 @@ +@@ -359,7 +359,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ @@ -108,7 +108,7 @@ ] } ] -@@ -517,7 +517,7 @@ +@@ -520,7 +520,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff index 2585f32595..2d21fbcde2 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step8/show_ipv6_route.ref 2020-09-25 17:53:21.443040633 -0300 -+++ rt2/step9/show_ipv6_route.ref 2020-09-25 17:54:39.112056848 -0300 +--- a/rt2/step8/show_ipv6_route.ref ++++ b/rt2/step9/show_ipv6_route.ref @@ -29,7 +29,7 @@ "interfaceName":"eth-rt4-1", "active":true, @@ -46,7 +46,7 @@ ] } @@ -155,7 +155,7 @@ - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", "active":true, "labels":[ - 16051 @@ -55,7 +55,7 @@ }, { @@ -164,7 +164,7 @@ - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ - 16051 @@ -64,7 +64,7 @@ }, { @@ -173,7 +173,7 @@ - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "labels":[ - 16051 diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff index b90b889eba..bc0ec3157e 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt2/step8/show_mpls_table.ref 2020-09-25 17:53:18.923007676 -0300 -+++ rt2/step9/show_mpls_table.ref 2020-09-25 17:54:36.640024493 -0300 +--- a/rt2/step8/show_mpls_table.ref ++++ b/rt2/step9/show_mpls_table.ref @@ -17,12 +17,12 @@ "backupNexthops":[ { diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref index 8c37180daf..d70e9fe882 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref @@ -233,7 +233,10 @@ "ip":"10.0.1.2", "afi":"ipv4", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref index 5ddb24af5a..058d33609b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref @@ -104,7 +104,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16041 @@ -113,7 +113,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ 16041 @@ -122,7 +122,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16041 @@ -144,7 +144,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "backupIndex":[ 0 @@ -156,7 +156,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "backupIndex":[ 0 @@ -192,7 +192,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "backupIndex":[ 0 @@ -204,7 +204,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "backupIndex":[ 0 @@ -218,7 +218,10 @@ { "afi":"ipv6", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref index f68d1f4244..1912df3f05 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref @@ -247,7 +247,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.1.2" } ] @@ -278,7 +278,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-sw1" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff index 707f95495d..9ba73b057a 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step3/show_ip_route.ref 2020-09-25 17:48:05.506916984 -0300 -+++ rt3/step4/show_ip_route.ref 2020-09-25 17:49:01.963652403 -0300 +--- a/rt3/step3/show_ip_route.ref ++++ b/rt3/step4/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ ] } ], -@@ -248,40 +169,12 @@ +@@ -251,40 +172,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -372,30 +265,13 @@ +@@ -375,30 +268,13 @@ { "ip":"10.0.4.5", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -411,29 +287,12 @@ +@@ -414,29 +290,12 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", @@ -252,7 +252,7 @@ } ] } -@@ -528,31 +387,14 @@ +@@ -531,31 +390,14 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff index 76d0ebc913..04f61c4eb4 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step3/show_ipv6_route.ref 2020-09-25 17:48:06.790933702 -0300 -+++ rt3/step4/show_ipv6_route.ref 2020-09-25 17:49:03.199668512 -0300 +--- a/rt3/step3/show_ipv6_route.ref ++++ b/rt3/step4/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -73,7 +73,7 @@ @@ -105,28 +57,19 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", - "active":true, - "labels":[ - 16041 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", - "active":true, - "labels":[ - 16041 @@ -93,7 +93,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", - "active":true, - "labels":[ - 16041 @@ -104,7 +104,7 @@ } @@ -146,9 +89,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, - "backupIndex":[ - 0 @@ -114,7 +114,7 @@ ] @@ -158,24 +98,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, - "backupIndex":[ - 0 diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff index b888c9d273..b3588ca791 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step3/show_mpls_table.ref 2020-09-25 17:48:04.214900164 -0300 -+++ rt3/step4/show_mpls_table.ref 2020-09-25 17:49:00.759636711 -0300 +--- a/rt3/step3/show_mpls_table.ref ++++ b/rt3/step4/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff index 8eac75bec7..1af024fc2e 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step4/show_ip_route.ref 2020-09-25 17:49:01.963652403 -0300 -+++ rt3/step5/show_ip_route.ref 2020-09-25 17:50:12.592573438 -0300 +--- a/rt3/step4/show_ip_route.ref ++++ b/rt3/step5/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ ] } ], -@@ -169,12 +248,40 @@ +@@ -172,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -265,13 +372,30 @@ +@@ -268,13 +375,30 @@ { "ip":"10.0.4.5", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -287,12 +411,29 @@ +@@ -290,12 +414,29 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", @@ -252,7 +252,7 @@ } ] } -@@ -387,14 +528,31 @@ +@@ -390,14 +531,31 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff index fc55267ad1..7cc79d0e58 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step4/show_ipv6_route.ref 2020-09-25 17:49:03.199668512 -0300 -+++ rt3/step5/show_ipv6_route.ref 2020-09-25 17:50:13.840589722 -0300 +--- a/rt3/step4/show_ipv6_route.ref ++++ b/rt3/step5/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -73,7 +73,7 @@ @@ -57,19 +105,28 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", - "active":true + "active":true, + "labels":[ @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ @@ -93,7 +93,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", - "active":true + "active":true, + "labels":[ @@ -104,7 +104,7 @@ } @@ -89,6 +146,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, + "backupIndex":[ + 0 @@ -114,7 +114,7 @@ ] @@ -98,10 +158,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, + "backupIndex":[ + 0 diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff index 4ed491e241..75a0f01f55 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step4/show_mpls_table.ref 2020-09-25 17:49:00.759636711 -0300 -+++ rt3/step5/show_mpls_table.ref 2020-09-25 17:50:11.280556320 -0300 +--- a/rt3/step4/show_mpls_table.ref ++++ b/rt3/step5/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff index 9273c75352..c814a2876b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step5/show_ip_route.ref 2020-09-25 17:50:12.592573438 -0300 -+++ rt3/step6/show_ip_route.ref 2020-09-25 17:51:15.521394894 -0300 +--- a/rt3/step5/show_ip_route.ref ++++ b/rt3/step6/show_ip_route.ref @@ -31,7 +31,7 @@ "interfaceName":"eth-rt5-1", "active":true, @@ -81,7 +81,7 @@ ] } ], -@@ -271,7 +271,7 @@ +@@ -274,7 +274,7 @@ "interfaceName":"eth-rt5-1", "active":true, "labels":[ @@ -90,7 +90,7 @@ ] }, { -@@ -280,7 +280,7 @@ +@@ -283,7 +283,7 @@ "interfaceName":"eth-rt5-2", "active":true, "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff index f50be893e4..6f9405f20c 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step5/show_ipv6_route.ref 2020-09-25 17:50:13.840589722 -0300 -+++ rt3/step6/show_ipv6_route.ref 2020-09-25 17:51:16.757411035 -0300 +--- a/rt3/step5/show_ipv6_route.ref ++++ b/rt3/step6/show_ipv6_route.ref @@ -29,7 +29,7 @@ "interfaceName":"eth-rt5-1", "active":true, @@ -36,8 +36,8 @@ 16021 ] } -@@ -116,7 +116,7 @@ - "interfaceName":"eth-rt5-2", +@@ -107,7 +107,7 @@ + "interfaceName":"eth-rt5-1", "active":true, "labels":[ - 16041 @@ -46,7 +46,7 @@ }, { @@ -125,7 +125,7 @@ - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ - 16041 diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff index b63a728ef1..d8c39685de 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step5/show_mpls_table.ref 2020-09-25 17:50:11.280556320 -0300 -+++ rt3/step6/show_mpls_table.ref 2020-09-25 17:51:14.281378700 -0300 +--- a/rt3/step5/show_mpls_table.ref ++++ b/rt3/step6/show_mpls_table.ref @@ -17,12 +17,12 @@ "backupNexthops":[ { diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff index 0ae87afa3b..c928fcdb4b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step6/show_ip_route.ref 2020-09-25 17:51:15.521394894 -0300 -+++ rt3/step7/show_ip_route.ref 2020-09-25 17:52:02.414007470 -0300 +--- a/rt3/step6/show_ip_route.ref ++++ b/rt3/step7/show_ip_route.ref @@ -158,9 +158,6 @@ "active":true, "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff index f392f644c0..0170971781 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step6/show_ipv6_route.ref 2020-09-25 17:51:16.757411035 -0300 -+++ rt3/step7/show_ipv6_route.ref 2020-09-25 17:52:03.650023622 -0300 +--- a/rt3/step6/show_ipv6_route.ref ++++ b/rt3/step7/show_ipv6_route.ref @@ -148,9 +148,6 @@ "active":true, "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff index b74eb9579c..d7a3ed978f 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step6/show_mpls_table.ref 2020-09-25 17:51:14.281378700 -0300 -+++ rt3/step7/show_mpls_table.ref 2020-09-25 17:52:01.181991371 -0300 +--- a/rt3/step6/show_mpls_table.ref ++++ b/rt3/step7/show_mpls_table.ref @@ -159,68 +159,6 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff index 25b42f2825..41a7ff3255 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step7/show_ip_route.ref 2020-09-25 17:52:02.414007470 -0300 -+++ rt3/step8/show_ip_route.ref 2020-09-25 17:53:20.419027241 -0300 +--- a/rt3/step7/show_ip_route.ref ++++ b/rt3/step8/show_ip_route.ref @@ -158,6 +158,9 @@ "active":true, "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff index 42d9356c8a..bd49f8606b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step7/show_ipv6_route.ref 2020-09-25 17:52:03.650023622 -0300 -+++ rt3/step8/show_ipv6_route.ref 2020-09-25 17:53:21.643043250 -0300 +--- a/rt3/step7/show_ipv6_route.ref ++++ b/rt3/step8/show_ipv6_route.ref @@ -148,6 +148,9 @@ "active":true, "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff index bd40f954eb..4cc69b66f2 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step7/show_mpls_table.ref 2020-09-25 17:52:01.181991371 -0300 -+++ rt3/step8/show_mpls_table.ref 2020-09-25 17:53:19.135010448 -0300 +--- a/rt3/step7/show_mpls_table.ref ++++ b/rt3/step8/show_mpls_table.ref @@ -159,6 +159,68 @@ } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff index 687e84ad40..cc0a482eee 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step8/show_ip_route.ref 2020-09-25 17:53:20.419027241 -0300 -+++ rt3/step9/show_ip_route.ref 2020-09-25 17:54:38.112043759 -0300 +--- a/rt3/step8/show_ip_route.ref ++++ b/rt3/step9/show_ip_route.ref @@ -185,7 +185,7 @@ "active":true, "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff index 4b76be66ac..650b982f0b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step8/show_ipv6_route.ref 2020-09-25 17:53:21.643043250 -0300 -+++ rt3/step9/show_ipv6_route.ref 2020-09-25 17:54:39.320059571 -0300 +--- a/rt3/step8/show_ipv6_route.ref ++++ b/rt3/step9/show_ipv6_route.ref @@ -173,7 +173,7 @@ "active":true, "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff index 6f6451e510..8ce4f1d266 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt3/step8/show_mpls_table.ref 2020-09-25 17:53:19.135010448 -0300 -+++ rt3/step9/show_mpls_table.ref 2020-09-25 17:54:36.852027268 -0300 +--- a/rt3/step8/show_mpls_table.ref ++++ b/rt3/step9/show_mpls_table.ref @@ -159,13 +159,13 @@ } ] @@ -31,7 +31,7 @@ { "type":"SR (IS-IS)", - "outLabel":16040, -+ "outLabel":3, ++ "outLabel":16060, "nexthop":"10.0.1.2" } ] @@ -63,7 +63,7 @@ { "type":"SR (IS-IS)", - "outLabel":16041, -+ "outLabel":3, ++ "outLabel":16061, "interface":"eth-sw1" } ] @@ -94,7 +94,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16060, + "outLabel":16040, "nexthop":"10.0.1.2" } @@ -126,7 +126,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16061, + "outLabel":16041, "interface":"eth-sw1" } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref index 168b90a3f6..0ef5d1bc3f 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref @@ -41,7 +41,10 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16010 + ] } ] } @@ -169,7 +172,10 @@ "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16050 + ] } ] } @@ -203,7 +209,10 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref index a4442ee089..b640df30c1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "backupIndex":[ 0 @@ -24,7 +24,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "backupIndex":[ 0 @@ -38,7 +38,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16011 + ] } ] } @@ -56,7 +59,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "backupIndex":[ 0 @@ -68,7 +71,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "backupIndex":[ 0 @@ -104,7 +107,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 @@ -113,7 +116,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -122,7 +125,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16031 @@ -158,7 +161,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16051 + ] } ] } @@ -190,7 +196,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref index 18354e947d..f60937ccbc 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref @@ -25,7 +25,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16010, "nexthop":"10.0.6.5" } ] @@ -56,7 +56,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16011, "interface":"eth-rt5" } ] @@ -188,7 +188,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16050, "nexthop":"10.0.7.6" } ] @@ -210,7 +210,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16051, "interface":"eth-rt6" } ] @@ -232,7 +232,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.6.5" } ] @@ -254,7 +254,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-rt5" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff index 7dcdb744ac..8b115c2058 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step3/show_ip_route.ref 2020-09-25 17:48:05.722919797 -0300 -+++ rt4/step4/show_ip_route.ref 2020-09-25 17:49:02.163655010 -0300 +--- a/rt4/step3/show_ip_route.ref ++++ b/rt4/step4/show_ip_route.ref @@ -15,9 +15,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -10,29 +10,28 @@ "labels":[ 16010 ] -@@ -28,21 +25,10 @@ +@@ -28,20 +25,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 - ], - "labels":[ - 16010 - ] - } +- "labels":[ +- 16010 +- ] +- } - ], - "backupNexthops":[ - { - "ip":"10.0.6.5", - "afi":"ipv4", - "interfaceName":"eth-rt5", -- "active":true -- } - ] - } - ], -@@ -62,9 +48,6 @@ +- "active":true, + "labels":[ + 16010 + ] +@@ -65,9 +48,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", "active":true, @@ -42,7 +41,7 @@ "labels":[ 3 ] -@@ -75,25 +58,10 @@ +@@ -78,25 +58,10 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, @@ -68,7 +67,7 @@ ] } ], -@@ -156,21 +124,10 @@ +@@ -159,24 +124,10 @@ "afi":"ipv4", "interfaceName":"eth-rt5", "active":true, @@ -85,12 +84,15 @@ - "ip":"10.0.7.6", - "afi":"ipv4", - "interfaceName":"eth-rt6", -- "active":true +- "active":true, +- "labels":[ +- 16050 +- ] - } ] } ], -@@ -190,21 +147,10 @@ +@@ -196,24 +147,10 @@ "afi":"ipv4", "interfaceName":"eth-rt6", "active":true, @@ -107,12 +109,15 @@ - "ip":"10.0.6.5", - "afi":"ipv4", - "interfaceName":"eth-rt5", -- "active":true +- "active":true, +- "labels":[ +- 16060 +- ] - } ] } ], -@@ -223,27 +169,13 @@ +@@ -232,27 +169,13 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -141,7 +146,7 @@ "active":true } ] -@@ -259,30 +191,13 @@ +@@ -268,30 +191,13 @@ { "ip":"10.0.2.2", "afi":"ipv4", @@ -174,7 +179,7 @@ } ] } -@@ -298,29 +213,12 @@ +@@ -307,29 +213,12 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -206,7 +211,7 @@ } ] } -@@ -340,31 +238,6 @@ +@@ -349,31 +238,6 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -238,7 +243,7 @@ "active":true } ] -@@ -385,31 +258,6 @@ +@@ -394,31 +258,6 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -270,7 +275,7 @@ "active":true } ] -@@ -425,18 +273,7 @@ +@@ -434,18 +273,7 @@ { "ip":"10.0.6.5", "afi":"ipv4", @@ -290,7 +295,7 @@ } ] } -@@ -451,18 +288,7 @@ +@@ -460,18 +288,7 @@ { "ip":"10.0.7.6", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff index b84ceaff1a..7f39285089 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff @@ -1,8 +1,8 @@ ---- rt4/step3/show_ipv6_route.ref 2020-09-25 17:48:06.998936410 -0300 -+++ rt4/step4/show_ipv6_route.ref 2020-09-25 17:49:03.399671119 -0300 +--- a/rt4/step3/show_ipv6_route.ref ++++ b/rt4/step4/show_ipv6_route.ref @@ -14,9 +14,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 @@ -10,30 +10,29 @@ "labels":[ 16011 ] -@@ -26,20 +23,10 @@ +@@ -26,19 +23,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, - "backupIndex":[ - 0 - ], - "labels":[ - 16011 - ] - } +- "labels":[ +- 16011 +- ] +- } - ], - "backupNexthops":[ - { - "afi":"ipv6", - "interfaceName":"eth-rt5", -- "active":true -- } - ] - } - ], -@@ -58,9 +45,6 @@ +- "active":true, + "labels":[ + 16011 + ] +@@ -61,9 +45,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 @@ -41,9 +40,9 @@ "labels":[ 3 ] -@@ -70,24 +54,10 @@ +@@ -73,24 +54,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, - "backupIndex":[ - 0 @@ -66,7 +65,7 @@ ] } ], -@@ -146,20 +116,10 @@ +@@ -149,23 +116,10 @@ "afi":"ipv6", "interfaceName":"eth-rt5", "active":true, @@ -82,12 +81,15 @@ - { - "afi":"ipv6", - "interfaceName":"eth-rt6", -- "active":true +- "active":true, +- "labels":[ +- 16051 +- ] - } ] } ], -@@ -178,20 +138,10 @@ +@@ -184,23 +138,10 @@ "afi":"ipv6", "interfaceName":"eth-rt6", "active":true, @@ -103,7 +105,10 @@ - { - "afi":"ipv6", - "interfaceName":"eth-rt5", -- "active":true +- "active":true, +- "labels":[ +- 16061 +- ] - } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff index 70e0108b0d..3dcd36c176 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step3/show_mpls_table.ref 2020-09-25 17:48:04.418902820 -0300 -+++ rt4/step4/show_mpls_table.ref 2020-09-25 17:49:00.959639319 -0300 +--- a/rt4/step3/show_mpls_table.ref ++++ b/rt4/step4/show_mpls_table.ref @@ -7,26 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -23,7 +23,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16010, - "nexthop":"10.0.6.5" + "nexthop":"10.0.2.2" } @@ -52,7 +52,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16011, - "interface":"eth-rt5" + "interface":"eth-rt2-1" } @@ -129,7 +129,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" + "nexthop":"10.0.6.5" } @@ -148,7 +148,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" + "interface":"eth-rt5" } @@ -167,7 +167,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16060, - "nexthop":"10.0.6.5" + "nexthop":"10.0.7.6" } @@ -186,7 +186,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16061, - "interface":"eth-rt5" + "interface":"eth-rt6" } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff index aa319a3232..484a3147dc 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step4/show_ip_route.ref 2020-09-25 17:49:02.163655010 -0300 -+++ rt4/step5/show_ip_route.ref 2020-09-25 17:50:12.800576153 -0300 +--- a/rt4/step4/show_ip_route.ref ++++ b/rt4/step5/show_ip_route.ref @@ -15,6 +15,9 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -10,29 +10,28 @@ "labels":[ 16010 ] -@@ -25,10 +28,21 @@ +@@ -25,6 +28,20 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 + ], - "labels":[ - 16010 - ] - } ++ "labels":[ ++ 16010 ++ ] ++ } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", -+ "active":true -+ } - ] - } - ], -@@ -48,6 +62,9 @@ ++ "active":true, + "labels":[ + 16010 + ] +@@ -48,6 +65,9 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", "active":true, @@ -42,7 +41,7 @@ "labels":[ 3 ] -@@ -58,10 +75,25 @@ +@@ -58,10 +78,25 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, @@ -68,7 +67,7 @@ ] } ], -@@ -124,10 +156,21 @@ +@@ -124,10 +159,24 @@ "afi":"ipv4", "interfaceName":"eth-rt5", "active":true, @@ -85,12 +84,15 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } ] } ], -@@ -147,10 +190,21 @@ +@@ -147,10 +196,24 @@ "afi":"ipv4", "interfaceName":"eth-rt6", "active":true, @@ -107,12 +109,15 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16060 ++ ] + } ] } ], -@@ -169,13 +223,27 @@ +@@ -169,13 +232,27 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -141,7 +146,7 @@ "active":true } ] -@@ -191,13 +259,30 @@ +@@ -191,13 +268,30 @@ { "ip":"10.0.2.2", "afi":"ipv4", @@ -174,7 +179,7 @@ } ] } -@@ -213,12 +298,29 @@ +@@ -213,12 +307,29 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -206,7 +211,7 @@ } ] } -@@ -238,6 +340,31 @@ +@@ -238,6 +349,31 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -238,7 +243,7 @@ "active":true } ] -@@ -258,6 +385,31 @@ +@@ -258,6 +394,31 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -270,7 +275,7 @@ "active":true } ] -@@ -273,7 +425,18 @@ +@@ -273,7 +434,18 @@ { "ip":"10.0.6.5", "afi":"ipv4", @@ -290,7 +295,7 @@ } ] } -@@ -288,7 +451,18 @@ +@@ -288,7 +460,18 @@ { "ip":"10.0.7.6", "afi":"ipv4", diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff index 1bd207854c..3ad0085120 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff @@ -1,8 +1,8 @@ ---- rt4/step4/show_ipv6_route.ref 2020-09-25 17:49:03.399671119 -0300 -+++ rt4/step5/show_ipv6_route.ref 2020-09-25 17:50:14.040592332 -0300 +--- a/rt4/step4/show_ipv6_route.ref ++++ b/rt4/step5/show_ipv6_route.ref @@ -14,6 +14,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 @@ -10,30 +10,29 @@ "labels":[ 16011 ] -@@ -23,10 +26,20 @@ +@@ -23,6 +26,19 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, + "backupIndex":[ + 0 + ], - "labels":[ - 16011 - ] - } ++ "labels":[ ++ 16011 ++ ] ++ } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", -+ "active":true -+ } - ] - } - ], -@@ -45,6 +58,9 @@ ++ "active":true, + "labels":[ + 16011 + ] +@@ -45,6 +61,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 @@ -41,9 +40,9 @@ "labels":[ 3 ] -@@ -54,10 +70,24 @@ +@@ -54,10 +73,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, + "backupIndex":[ + 0 @@ -66,7 +65,7 @@ ] } ], -@@ -116,10 +146,20 @@ +@@ -116,10 +149,23 @@ "afi":"ipv6", "interfaceName":"eth-rt5", "active":true, @@ -82,12 +81,15 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } ] } ], -@@ -138,10 +178,20 @@ +@@ -138,10 +184,23 @@ "afi":"ipv6", "interfaceName":"eth-rt6", "active":true, @@ -103,7 +105,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16061 ++ ] + } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff index 664b129a1b..20e363375b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step4/show_mpls_table.ref 2020-09-25 17:49:00.959639319 -0300 -+++ rt4/step5/show_mpls_table.ref 2020-09-25 17:50:11.488559034 -0300 +--- a/rt4/step4/show_mpls_table.ref ++++ b/rt4/step5/show_mpls_table.ref @@ -7,13 +7,26 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -24,7 +24,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16010, + "nexthop":"10.0.6.5" } ] @@ -53,7 +53,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16011, + "interface":"eth-rt5" } ] @@ -130,7 +130,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.6" } ] @@ -149,7 +149,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt6" } ] @@ -168,7 +168,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16060, + "nexthop":"10.0.6.5" } ] @@ -187,7 +187,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16061, + "interface":"eth-rt5" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff index c758b89839..9070414730 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff @@ -1,6 +1,15 @@ ---- rt4/step5/show_ip_route.ref 2020-09-25 17:50:12.800576153 -0300 -+++ rt4/step6/show_ip_route.ref 2020-09-25 17:51:15.725397558 -0300 -@@ -90,7 +90,7 @@ +--- a/rt4/step5/show_ip_route.ref ++++ b/rt4/step6/show_ip_route.ref +@@ -43,7 +43,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16010 ++ 30010 + ] + } + ] +@@ -93,7 +93,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -9,7 +18,7 @@ 16020 ] } -@@ -134,7 +134,7 @@ +@@ -137,7 +137,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -18,7 +27,16 @@ ] } ] -@@ -281,7 +281,7 @@ +@@ -211,7 +211,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16060 ++ 30060 + ] + } + ] +@@ -290,7 +290,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -27,7 +45,7 @@ ] } ] -@@ -319,7 +319,7 @@ +@@ -328,7 +328,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff index ca495216dd..57a57647a1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff @@ -1,6 +1,15 @@ ---- rt4/step5/show_ipv6_route.ref 2020-09-25 17:50:14.040592332 -0300 -+++ rt4/step6/show_ipv6_route.ref 2020-09-25 17:51:16.969413804 -0300 -@@ -84,7 +84,7 @@ +--- a/rt4/step5/show_ipv6_route.ref ++++ b/rt4/step6/show_ipv6_route.ref +@@ -40,7 +40,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16011 ++ 30011 + ] + } + ] +@@ -87,7 +87,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -9,12 +18,21 @@ 16021 ] } -@@ -116,7 +116,7 @@ +@@ -128,7 +128,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ - 16031 + 30031 ] - }, - { + } + ] +@@ -198,7 +198,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16061 ++ 30061 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff index 630e0419cf..94f87854d1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff @@ -1,5 +1,23 @@ ---- rt4/step5/show_mpls_table.ref 2020-09-25 17:50:11.488559034 -0300 -+++ rt4/step6/show_mpls_table.ref 2020-09-25 17:51:14.481381312 -0300 +--- a/rt4/step5/show_mpls_table.ref ++++ b/rt4/step6/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16010, ++ "outLabel":30010, + "nexthop":"10.0.6.5" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16011, ++ "outLabel":30011, + "interface":"eth-rt5" + } + ] @@ -87,7 +87,7 @@ "backupNexthops":[ { @@ -36,3 +54,21 @@ "installed":true, "interface":"eth-rt5" } +@@ -232,7 +232,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":30060, + "nexthop":"10.0.6.5" + } + ] +@@ -254,7 +254,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":30061, + "interface":"eth-rt5" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff index 30e0dcf3c0..e54873d5ab 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff @@ -1,6 +1,6 @@ ---- rt4/step6/show_ip_route.ref 2020-09-25 17:51:15.725397558 -0300 -+++ rt4/step7/show_ip_route.ref 2020-09-25 17:52:02.614010084 -0300 -@@ -158,9 +158,6 @@ +--- a/rt4/step6/show_ip_route.ref ++++ b/rt4/step7/show_ip_route.ref +@@ -161,9 +161,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -172,10 +169,7 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff index 2606027d75..92e08f99a0 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt4/step6/show_ipv6_route.ref 2020-09-25 17:51:16.969413804 -0300 -+++ rt4/step7/show_ipv6_route.ref 2020-09-25 17:52:03.854026287 -0300 -@@ -148,9 +148,6 @@ +--- a/rt4/step6/show_ipv6_route.ref ++++ b/rt4/step7/show_ipv6_route.ref +@@ -151,9 +151,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -161,10 +158,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff index 5334cfd048..fb614ebf6a 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step6/show_mpls_table.ref 2020-09-25 17:51:14.481381312 -0300 -+++ rt4/step7/show_mpls_table.ref 2020-09-25 17:52:01.385994037 -0300 +--- a/rt4/step6/show_mpls_table.ref ++++ b/rt4/step7/show_mpls_table.ref @@ -171,50 +171,6 @@ } ] @@ -21,7 +21,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" - } - ] @@ -43,7 +43,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" - } - ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff index b393970e42..252da6e764 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff @@ -1,6 +1,6 @@ ---- rt4/step7/show_ip_route.ref 2020-09-25 17:52:02.614010084 -0300 -+++ rt4/step8/show_ip_route.ref 2020-09-25 17:53:20.623029909 -0300 -@@ -158,6 +158,9 @@ +--- a/rt4/step7/show_ip_route.ref ++++ b/rt4/step8/show_ip_route.ref +@@ -161,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -169,7 +172,10 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff index 8bad2edcf3..7057d2166a 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt4/step7/show_ipv6_route.ref 2020-09-25 17:52:03.854026287 -0300 -+++ rt4/step8/show_ipv6_route.ref 2020-09-25 17:53:21.843045865 -0300 -@@ -148,6 +148,9 @@ +--- a/rt4/step7/show_ipv6_route.ref ++++ b/rt4/step8/show_ipv6_route.ref +@@ -151,6 +151,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -158,7 +161,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff index d296dbdcaf..3dc4303b9b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step7/show_mpls_table.ref 2020-09-25 17:52:01.385994037 -0300 -+++ rt4/step8/show_mpls_table.ref 2020-09-25 17:53:19.371013534 -0300 +--- a/rt4/step7/show_mpls_table.ref ++++ b/rt4/step8/show_mpls_table.ref @@ -171,6 +171,50 @@ } ] @@ -21,7 +21,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.6" + } + ] @@ -43,7 +43,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt6" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff index e69de29bb2..56f9cc534f 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff @@ -0,0 +1,11 @@ +--- a/rt4/step8/show_ip_route.ref ++++ b/rt4/step9/show_ip_route.ref +@@ -174,7 +174,7 @@ + "interfaceName":"eth-rt6", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff index e69de29bb2..41e552177a 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff @@ -0,0 +1,11 @@ +--- a/rt4/step8/show_ipv6_route.ref ++++ b/rt4/step9/show_ipv6_route.ref +@@ -163,7 +163,7 @@ + "interfaceName":"eth-rt6", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff index 408cbfb0ba..627e292518 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt4/step8/show_mpls_table.ref 2020-09-25 17:53:19.371013534 -0300 -+++ rt4/step9/show_mpls_table.ref 2020-09-25 17:54:37.064030042 -0300 +--- a/rt4/step8/show_mpls_table.ref ++++ b/rt4/step9/show_mpls_table.ref @@ -171,15 +171,15 @@ } ] @@ -19,11 +19,13 @@ "backupIndex":[ 0 ] -@@ -189,19 +189,19 @@ +@@ -188,20 +188,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" ++ "outLabel":30060, + "nexthop":"10.0.6.5" } ] @@ -43,11 +45,13 @@ "backupIndex":[ 0 ] -@@ -211,19 +211,19 @@ +@@ -210,20 +210,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" ++ "outLabel":30061, + "interface":"eth-rt5" } ] @@ -67,11 +71,13 @@ "backupIndex":[ 0 ] -@@ -233,19 +233,19 @@ +@@ -232,20 +232,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":30060, - "nexthop":"10.0.6.5" ++ "outLabel":16500, + "nexthop":"10.0.7.6" } ] @@ -91,11 +97,13 @@ "backupIndex":[ 0 ] -@@ -255,7 +255,7 @@ +@@ -254,8 +254,8 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":30061, - "interface":"eth-rt5" ++ "outLabel":16501, + "interface":"eth-rt6" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref index f747065f9c..93740e22e0 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref @@ -41,7 +41,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16010 + ] } ] } @@ -169,7 +172,10 @@ "ip":"10.0.8.6", "afi":"ipv4", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16040 + ] } ] } @@ -203,7 +209,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref index 6c0a5e0b9b..6dafa69adb 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "backupIndex":[ 0 @@ -24,7 +24,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "backupIndex":[ 0 @@ -38,7 +38,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16011 + ] } ] } @@ -65,7 +68,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "labels":[ 16021 @@ -74,7 +77,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "labels":[ 16021 @@ -96,7 +99,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "backupIndex":[ 0 @@ -108,7 +111,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "backupIndex":[ 0 @@ -158,7 +161,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16041 + ] } ] } @@ -190,7 +196,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref index 2b70392adc..0c5861b5e8 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref @@ -25,7 +25,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16010, "nexthop":"10.0.6.4" } ] @@ -56,7 +56,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16011, "interface":"eth-rt4" } ] @@ -188,7 +188,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16040, "nexthop":"10.0.8.6" } ] @@ -210,7 +210,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16041, "interface":"eth-rt6" } ] @@ -232,7 +232,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.6.4" } ] @@ -254,7 +254,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-rt4" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff index 6402b51893..7545a31b9b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff @@ -1,6 +1,18 @@ ---- rt5/step3/show_ip_route.ref 2020-09-25 17:48:05.950922766 -0300 -+++ rt5/step4/show_ip_route.ref 2020-09-25 17:49:02.363657616 -0300 -@@ -81,10 +81,7 @@ +--- a/rt5/step3/show_ip_route.ref ++++ b/rt5/step4/show_ip_route.ref +@@ -41,10 +41,7 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16010 +- ] ++ "active":true + } + ] + } +@@ -84,10 +81,7 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", @@ -12,7 +24,7 @@ } ] } -@@ -105,9 +102,6 @@ +@@ -108,9 +102,6 @@ "afi":"ipv4", "interfaceName":"eth-rt3-1", "active":true, @@ -22,7 +34,7 @@ "labels":[ 3 ] -@@ -118,25 +112,10 @@ +@@ -121,25 +112,10 @@ "afi":"ipv4", "interfaceName":"eth-rt3-2", "active":true, @@ -48,7 +60,7 @@ ] } ], -@@ -158,9 +137,6 @@ +@@ -161,9 +137,6 @@ "active":true, "backupIndex":[ 0 @@ -58,7 +70,31 @@ ] } ], -@@ -349,30 +325,13 @@ +@@ -172,10 +145,7 @@ + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -209,10 +179,7 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16060 +- ] ++ "active":true + } + ] + } +@@ -358,30 +325,13 @@ { "ip":"10.0.4.3", "afi":"ipv4", @@ -91,7 +127,7 @@ } ] } -@@ -388,29 +347,12 @@ +@@ -397,29 +347,12 @@ "ip":"10.0.4.3", "afi":"ipv4", "interfaceName":"eth-rt3-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff index 7a0135bf04..1de62bb58e 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff @@ -1,6 +1,18 @@ ---- rt5/step3/show_ipv6_route.ref 2020-09-25 17:48:07.218939274 -0300 -+++ rt5/step4/show_ipv6_route.ref 2020-09-25 17:49:03.599673726 -0300 -@@ -57,10 +57,7 @@ +--- a/rt5/step3/show_ipv6_route.ref ++++ b/rt5/step4/show_ipv6_route.ref +@@ -38,10 +38,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16011 +- ] ++ "active":true + } + ] + } +@@ -60,10 +57,7 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -12,9 +24,9 @@ }, { "fib":true, -@@ -98,9 +95,6 @@ +@@ -101,9 +95,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, - "backupIndex":[ - 0 @@ -22,9 +34,9 @@ "labels":[ 3 ] -@@ -110,24 +104,10 @@ +@@ -113,24 +104,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, - "backupIndex":[ - 0 @@ -47,7 +59,7 @@ ] } ], -@@ -148,9 +128,6 @@ +@@ -151,9 +128,6 @@ "active":true, "backupIndex":[ 0 @@ -57,3 +69,27 @@ ] } ], +@@ -161,10 +135,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } +@@ -196,10 +167,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16061 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff index 299dac7640..b3d5252430 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff @@ -1,5 +1,23 @@ ---- rt5/step3/show_mpls_table.ref 2020-09-25 17:48:04.626905528 -0300 -+++ rt5/step4/show_mpls_table.ref 2020-09-25 17:49:01.159641924 -0300 +--- a/rt5/step3/show_mpls_table.ref ++++ b/rt5/step4/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16010, ++ "outLabel":3, + "nexthop":"10.0.6.4" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16011, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] @@ -76,12 +76,6 @@ "outLabel":16020, "installed":true, @@ -100,7 +118,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16040, - "nexthop":"10.0.8.6" - } - ] @@ -122,9 +140,27 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16041, - "interface":"eth-rt6" + "interface":"eth-rt3-1" } ] }, +@@ -232,7 +150,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":3, + "nexthop":"10.0.6.4" + } + ] +@@ -254,7 +172,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff index 31f70b17a3..be5d83f463 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff @@ -1,6 +1,18 @@ ---- rt5/step4/show_ip_route.ref 2020-09-25 17:49:02.363657616 -0300 -+++ rt5/step5/show_ip_route.ref 2020-09-25 17:50:13.012578918 -0300 -@@ -81,7 +81,10 @@ +--- a/rt5/step4/show_ip_route.ref ++++ b/rt5/step5/show_ip_route.ref +@@ -41,7 +41,10 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16010 ++ ] + } + ] + } +@@ -81,7 +84,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", @@ -12,7 +24,7 @@ } ] } -@@ -102,6 +105,9 @@ +@@ -102,6 +108,9 @@ "afi":"ipv4", "interfaceName":"eth-rt3-1", "active":true, @@ -22,7 +34,7 @@ "labels":[ 3 ] -@@ -112,10 +118,25 @@ +@@ -112,10 +121,25 @@ "afi":"ipv4", "interfaceName":"eth-rt3-2", "active":true, @@ -48,7 +60,7 @@ ] } ], -@@ -137,6 +158,9 @@ +@@ -137,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -58,7 +70,31 @@ ] } ], -@@ -325,13 +349,30 @@ +@@ -145,7 +172,10 @@ + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -179,7 +209,10 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16060 ++ ] + } + ] + } +@@ -325,13 +358,30 @@ { "ip":"10.0.4.3", "afi":"ipv4", @@ -91,7 +127,7 @@ } ] } -@@ -347,12 +388,29 @@ +@@ -347,12 +397,29 @@ "ip":"10.0.4.3", "afi":"ipv4", "interfaceName":"eth-rt3-1", diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff index 59d9755e18..a856019622 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff @@ -1,6 +1,18 @@ ---- rt5/step4/show_ipv6_route.ref 2020-09-25 17:49:03.599673726 -0300 -+++ rt5/step5/show_ipv6_route.ref 2020-09-25 17:50:14.248595046 -0300 -@@ -57,7 +57,10 @@ +--- a/rt5/step4/show_ipv6_route.ref ++++ b/rt5/step5/show_ipv6_route.ref +@@ -38,7 +38,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16011 ++ ] + } + ] + } +@@ -57,7 +60,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -12,9 +24,9 @@ }, { "fib":true, -@@ -95,6 +98,9 @@ +@@ -95,6 +101,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, + "backupIndex":[ + 0 @@ -22,9 +34,9 @@ "labels":[ 3 ] -@@ -104,10 +110,24 @@ +@@ -104,10 +113,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, + "backupIndex":[ + 0 @@ -47,7 +59,7 @@ ] } ], -@@ -128,6 +148,9 @@ +@@ -128,6 +151,9 @@ "active":true, "backupIndex":[ 0 @@ -57,3 +69,27 @@ ] } ], +@@ -135,7 +161,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } +@@ -167,7 +196,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16061 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff index 669c07e344..74caa8620e 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff @@ -1,5 +1,23 @@ ---- rt5/step4/show_mpls_table.ref 2020-09-25 17:49:01.159641924 -0300 -+++ rt5/step5/show_mpls_table.ref 2020-09-25 17:50:11.696561748 -0300 +--- a/rt5/step4/show_mpls_table.ref ++++ b/rt5/step5/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16010, + "nexthop":"10.0.6.4" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16011, + "interface":"eth-rt4" + } + ] @@ -69,6 +69,12 @@ "type":"SR (IS-IS)", "outLabel":16020, @@ -101,7 +119,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16040, + "nexthop":"10.0.8.6" + } + ] @@ -123,8 +141,26 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16041, + "interface":"eth-rt6" } ] }, +@@ -150,7 +232,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16060, + "nexthop":"10.0.6.4" + } + ] +@@ -172,7 +254,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16061, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff index a4f82cbf10..2883c046fd 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt5/step5/show_mpls_table.ref 2020-09-25 17:50:11.696561748 -0300 -+++ rt5/step6/show_mpls_table.ref 2020-09-25 17:51:14.685383977 -0300 +--- a/rt5/step5/show_mpls_table.ref ++++ b/rt5/step6/show_mpls_table.ref @@ -1,6 +1,6 @@ { - "16010":{ diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref index 5bcef4c2f6..b9b43c4139 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref @@ -61,7 +61,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16020 + ] } ] } @@ -95,7 +98,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16030 + ] } ] } @@ -129,7 +135,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16040 + ] } ] } @@ -163,7 +172,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16050 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref index 8294b07136..1b1942939d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -57,7 +57,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16021 + ] } ] } @@ -89,7 +92,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16031 + ] } ] } @@ -121,7 +127,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16041 + ] } ] } @@ -153,7 +162,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16051 + ] } ] } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref index 33dbf59204..5b52a16f48 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.7.4" + "nexthop":"10.0.8.5" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.8.5" + "nexthop":"10.0.7.4" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt4" + "interface":"eth-rt5" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt5" + "interface":"eth-rt4" } ] }, @@ -52,7 +52,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16020, "nexthop":"10.0.8.5" } ] @@ -74,7 +74,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16021, "interface":"eth-rt5" } ] @@ -96,7 +96,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16030, "nexthop":"10.0.7.4" } ] @@ -118,7 +118,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16031, "interface":"eth-rt4" } ] @@ -140,7 +140,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16040, "nexthop":"10.0.8.5" } ] @@ -162,7 +162,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16041, "interface":"eth-rt5" } ] @@ -184,7 +184,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16050, "nexthop":"10.0.7.4" } ] @@ -206,7 +206,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16051, "interface":"eth-rt4" } ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff index 04adaefe78..7c2f00419a 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step3/show_ip_route.ref 2020-09-25 17:48:06.154925422 -0300 -+++ rt6/step4/show_ip_route.ref 2020-09-25 17:49:02.583660484 -0300 +--- a/rt6/step3/show_ip_route.ref ++++ b/rt6/step4/show_ip_route.ref @@ -14,10 +14,7 @@ "ip":"10.0.7.4", "afi":"ipv4", @@ -22,7 +22,19 @@ ] } ], -@@ -118,9 +112,6 @@ +@@ -98,10 +92,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16030 +- ] ++ "active":true + } + ] + } +@@ -124,9 +115,6 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -135,10 +123,7 @@ + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -172,10 +157,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff index 20aa1ec83b..70f872e9de 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step3/show_ipv6_route.ref 2020-09-25 17:48:07.434942087 -0300 -+++ rt6/step4/show_ipv6_route.ref 2020-09-25 17:49:03.847676958 -0300 -@@ -22,10 +22,7 @@ +--- a/rt6/step3/show_ipv6_route.ref ++++ b/rt6/step4/show_ipv6_route.ref +@@ -13,10 +13,7 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -9,9 +9,9 @@ - 16011 - ] + "active":true - } - ] - } + }, + { + "fib":true, @@ -47,9 +44,6 @@ "active":true, "backupIndex":[ @@ -22,7 +22,19 @@ ] } ], -@@ -111,9 +105,6 @@ +@@ -92,10 +86,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16031 +- ] ++ "active":true + } + ] + } +@@ -117,9 +108,6 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -127,10 +115,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } +@@ -162,10 +147,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff index 3f24547f6d..c191763a73 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff @@ -1,35 +1,49 @@ ---- rt6/step3/show_mpls_table.ref 2020-09-25 17:48:04.842908340 -0300 -+++ rt6/step4/show_mpls_table.ref 2020-09-25 17:49:01.363644584 -0300 -@@ -7,12 +7,6 @@ - "type":"SR (IS-IS)", +--- a/rt6/step3/show_mpls_table.ref ++++ b/rt6/step4/show_mpls_table.ref +@@ -8,12 +8,6 @@ "outLabel":16010, "installed":true, -- "nexthop":"10.0.7.4" + "nexthop":"10.0.8.5" - }, - { - "type":"SR (IS-IS)", - "outLabel":16010, - "installed":true, - "nexthop":"10.0.8.5" +- "nexthop":"10.0.7.4" } ] -@@ -25,12 +19,6 @@ - "type":"SR (IS-IS)", + }, +@@ -26,12 +20,6 @@ "outLabel":16011, "installed":true, -- "interface":"eth-rt4" + "interface":"eth-rt5" - }, - { - "type":"SR (IS-IS)", - "outLabel":16011, - "installed":true, - "interface":"eth-rt5" +- "interface":"eth-rt4" } ] -@@ -123,50 +111,6 @@ + }, +@@ -96,7 +84,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16030, ++ "outLabel":3, + "nexthop":"10.0.7.4" } ] - }, +@@ -118,52 +106,8 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16031, +- "interface":"eth-rt4" +- } +- ] +- }, - "16040":{ - "inLabel":16040, - "installed":true, @@ -47,7 +61,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16040, - "nexthop":"10.0.8.5" - } - ] @@ -58,7 +72,7 @@ - "nexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, + "outLabel":3, - "installed":true, - "interface":"eth-rt4", - "backupIndex":[ @@ -69,11 +83,27 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16041, - "interface":"eth-rt5" -- } -- ] -- }, - "16050":{ - "inLabel":16050, - "installed":true, ++ "interface":"eth-rt4" + } + ] + }, +@@ -184,7 +128,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":3, + "nexthop":"10.0.7.4" + } + ] +@@ -206,7 +150,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff index 9f73a2904e..9f017d2492 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step4/show_ip_route.ref 2020-09-25 17:49:02.583660484 -0300 -+++ rt6/step5/show_ip_route.ref 2020-09-25 17:50:13.220581632 -0300 +--- a/rt6/step4/show_ip_route.ref ++++ b/rt6/step5/show_ip_route.ref @@ -14,7 +14,10 @@ "ip":"10.0.7.4", "afi":"ipv4", @@ -22,7 +22,19 @@ ] } ], -@@ -112,6 +118,9 @@ +@@ -92,7 +98,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16030 ++ ] + } + ] + } +@@ -115,6 +124,9 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -123,7 +135,10 @@ + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -157,7 +172,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff index c9358d45b2..1209504e94 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step4/show_ipv6_route.ref 2020-09-25 17:49:03.847676958 -0300 -+++ rt6/step5/show_ipv6_route.ref 2020-09-25 17:50:14.456597760 -0300 -@@ -22,7 +22,10 @@ +--- a/rt6/step4/show_ipv6_route.ref ++++ b/rt6/step5/show_ipv6_route.ref +@@ -13,7 +13,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -9,9 +9,9 @@ + "labels":[ + 16011 + ] - } - ] - } + }, + { + "fib":true, @@ -44,6 +47,9 @@ "active":true, "backupIndex":[ @@ -22,7 +22,19 @@ ] } ], -@@ -105,6 +111,9 @@ +@@ -86,7 +92,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16031 ++ ] + } + ] + } +@@ -108,6 +117,9 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -115,7 +127,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } +@@ -147,7 +162,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff index c9d67955ef..abf7c2a32d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step4/show_mpls_table.ref 2020-09-25 17:49:01.363644584 -0300 -+++ rt6/step5/show_mpls_table.ref 2020-09-25 17:50:11.904564461 -0300 +--- a/rt6/step4/show_mpls_table.ref ++++ b/rt6/step5/show_mpls_table.ref @@ -7,6 +7,12 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -26,7 +26,22 @@ "interface":"eth-rt5" } ] -@@ -111,6 +123,50 @@ +@@ -84,7 +96,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16030, + "nexthop":"10.0.7.4" + } + ] +@@ -106,11 +118,55 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16031, + "interface":"eth-rt4" } ] }, @@ -47,7 +62,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16040, + "nexthop":"10.0.8.5" + } + ] @@ -69,7 +84,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16041, + "interface":"eth-rt5" + } + ] @@ -77,3 +92,21 @@ "16050":{ "inLabel":16050, "installed":true, +@@ -128,7 +184,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.4" + } + ] +@@ -150,7 +206,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff index 527ec74958..f318f95e21 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step5/show_ip_route.ref 2020-09-25 17:50:13.220581632 -0300 -+++ rt6/step6/show_ip_route.ref 2020-09-25 17:51:16.137402938 -0300 +--- a/rt6/step5/show_ip_route.ref ++++ b/rt6/step6/show_ip_route.ref @@ -26,7 +26,7 @@ "interfaceName":"eth-rt5", "active":true, @@ -9,7 +9,16 @@ ] } ] -@@ -86,7 +86,7 @@ +@@ -63,7 +63,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16020 ++ 30020 + ] + } + ] +@@ -89,7 +89,7 @@ 0 ], "labels":[ @@ -18,3 +27,12 @@ ] } ], +@@ -137,7 +137,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff index 7b8f8022f2..9208491fc8 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff @@ -1,15 +1,24 @@ ---- rt6/step5/show_ipv6_route.ref 2020-09-25 17:50:14.456597760 -0300 -+++ rt6/step6/show_ipv6_route.ref 2020-09-25 17:51:17.401419446 -0300 -@@ -15,7 +15,7 @@ +--- a/rt6/step5/show_ipv6_route.ref ++++ b/rt6/step6/show_ipv6_route.ref +@@ -24,7 +24,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ - 16011 + 30011 ] - }, - { -@@ -81,7 +81,7 @@ + } + ] +@@ -59,7 +59,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16021 ++ 30021 + ] + } + ] +@@ -84,7 +84,7 @@ 0 ], "labels":[ @@ -18,3 +27,12 @@ ] } ], +@@ -129,7 +129,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16041 ++ 30041 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff index edd5afeeb8..aee8969ded 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step5/show_mpls_table.ref 2020-09-25 17:50:11.904564461 -0300 -+++ rt6/step6/show_mpls_table.ref 2020-09-25 17:51:14.893386692 -0300 +--- a/rt6/step5/show_mpls_table.ref ++++ b/rt6/step6/show_mpls_table.ref @@ -11,7 +11,7 @@ }, { @@ -18,6 +18,24 @@ "installed":true, "interface":"eth-rt5" } +@@ -52,7 +52,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16020, ++ "outLabel":30020, + "nexthop":"10.0.8.5" + } + ] +@@ -74,7 +74,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16021, ++ "outLabel":30021, + "interface":"eth-rt5" + } + ] @@ -85,7 +85,7 @@ "nexthops":[ { @@ -36,3 +54,21 @@ "installed":true, "interface":"eth-rt5", "backupIndex":[ +@@ -140,7 +140,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.8.5" + } + ] +@@ -162,7 +162,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff index 7553dd22e5..0e6c3ff5cd 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step6/show_ip_route.ref 2020-09-25 17:51:16.137402938 -0300 -+++ rt6/step7/show_ip_route.ref 2020-09-25 17:52:03.018015363 -0300 -@@ -152,9 +152,6 @@ +--- a/rt6/step6/show_ip_route.ref ++++ b/rt6/step7/show_ip_route.ref +@@ -161,9 +161,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -172,10 +169,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff index b56890de0f..2fe46c8265 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step6/show_ipv6_route.ref 2020-09-25 17:51:17.401419446 -0300 -+++ rt6/step7/show_ipv6_route.ref 2020-09-25 17:52:04.270031723 -0300 -@@ -143,9 +143,6 @@ +--- a/rt6/step6/show_ipv6_route.ref ++++ b/rt6/step7/show_ipv6_route.ref +@@ -152,9 +152,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -162,10 +159,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff index ff043fb0bf..179a4f460b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step6/show_mpls_table.ref 2020-09-25 17:51:14.893386692 -0300 -+++ rt6/step7/show_mpls_table.ref 2020-09-25 17:52:01.809999577 -0300 +--- a/rt6/step6/show_mpls_table.ref ++++ b/rt6/step7/show_mpls_table.ref @@ -166,49 +166,5 @@ "interface":"eth-rt5" } @@ -22,7 +22,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.4" - } - ] @@ -44,7 +44,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt4" - } - ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff index d0b25bffa3..9d5c440a22 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step7/show_ip_route.ref 2020-09-25 17:52:03.018015363 -0300 -+++ rt6/step8/show_ip_route.ref 2020-09-25 17:53:21.035035298 -0300 -@@ -152,6 +152,9 @@ +--- a/rt6/step7/show_ip_route.ref ++++ b/rt6/step8/show_ip_route.ref +@@ -161,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -169,7 +172,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff index 203175510c..21cab20a47 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff @@ -1,6 +1,6 @@ ---- rt6/step7/show_ipv6_route.ref 2020-09-25 17:52:04.270031723 -0300 -+++ rt6/step8/show_ipv6_route.ref 2020-09-25 17:53:22.239051045 -0300 -@@ -143,6 +143,9 @@ +--- a/rt6/step7/show_ipv6_route.ref ++++ b/rt6/step8/show_ipv6_route.ref +@@ -152,6 +152,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -159,7 +162,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff index 535f30bf35..760c5542cb 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step7/show_mpls_table.ref 2020-09-25 17:52:01.809999577 -0300 -+++ rt6/step8/show_mpls_table.ref 2020-09-25 17:53:19.799019132 -0300 +--- a/rt6/step7/show_mpls_table.ref ++++ b/rt6/step8/show_mpls_table.ref @@ -166,5 +166,49 @@ "interface":"eth-rt5" } @@ -22,7 +22,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.4" + } + ] @@ -44,7 +44,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff index e69de29bb2..ee296470c0 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff @@ -0,0 +1,11 @@ +--- a/rt6/step8/show_ip_route.ref ++++ b/rt6/step9/show_ip_route.ref +@@ -174,7 +174,7 @@ + "interfaceName":"eth-rt4", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff index e69de29bb2..bebca4dcf1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff @@ -0,0 +1,11 @@ +--- a/rt6/step8/show_ipv6_route.ref ++++ b/rt6/step9/show_ipv6_route.ref +@@ -164,7 +164,7 @@ + "interfaceName":"eth-rt4", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff index b6e5396554..57347d15be 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff @@ -1,5 +1,5 @@ ---- rt6/step8/show_mpls_table.ref 2020-09-25 17:53:19.799019132 -0300 -+++ rt6/step9/show_mpls_table.ref 2020-09-25 17:54:37.492035644 -0300 +--- a/rt6/step8/show_mpls_table.ref ++++ b/rt6/step9/show_mpls_table.ref @@ -167,8 +167,8 @@ } ] @@ -11,7 +11,13 @@ "installed":true, "nexthops":[ { -@@ -189,8 +189,8 @@ +@@ -184,13 +184,13 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.7.4" } ] }, @@ -22,3 +28,12 @@ "installed":true, "nexthops":[ { +@@ -206,7 +206,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py index 6bc097b0e7..514ea53552 100755 --- a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py +++ b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py @@ -179,7 +179,7 @@ def setup_module(mod): router_list = tgen.routers() # For all registered routers, load the zebra configuration file - for rname, router in router_list.iteritems(): + for rname, router in router_list.items(): router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, '{}/zebra.conf'.format(rname)) diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf index 87d5703d9e..877e14ff36 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r1-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json index 2c493173f5..aa3f74fc5f 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json @@ -2,7 +2,7 @@ "neighbors":{ "2.2.2.2":[ { - "priority":1, + "priority":2, "state":"Full\/DR", "address":"10.0.1.2", "ifaceName":"r1-eth0:10.0.1.1" diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf index 51317202bb..8cba1529e8 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json index 55f12359e5..aa68198957 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json @@ -5,15 +5,12 @@ "priority":1, "state":"Full\/Backup", "address":"10.0.1.1", - "ifaceName":"r2-eth0:10.0.1.2", - "retransmitCounter":0, - "requestCounter":0, - "dbSummaryCounter":0 + "ifaceName":"r2-eth0:10.0.1.2" } ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r2-eth1:10.0.2.2" @@ -21,7 +18,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r2-eth1:10.0.2.2" diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf index 4566976b7b..0d3a74c4ac 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf @@ -9,4 +9,5 @@ router ospf int r3-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json index 24502ed813..905774fc46 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json @@ -10,7 +10,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r3-eth0:10.0.2.3" diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf index 5aae885a12..7bbd228d02 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r4-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 3 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json index 794410522d..67593952ca 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json @@ -11,7 +11,7 @@ ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r4-eth0:10.0.2.4" diff --git a/tests/topotests/ldp-oc-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf index 87d5703d9e..877e14ff36 100644 --- a/tests/topotests/ldp-oc-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r1-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json index 2c493173f5..aa3f74fc5f 100644 --- a/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json @@ -2,7 +2,7 @@ "neighbors":{ "2.2.2.2":[ { - "priority":1, + "priority":2, "state":"Full\/DR", "address":"10.0.1.2", "ifaceName":"r1-eth0:10.0.1.1" diff --git a/tests/topotests/ldp-oc-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf index 51317202bb..8cba1529e8 100644 --- a/tests/topotests/ldp-oc-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json index 55f12359e5..aa68198957 100644 --- a/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json @@ -5,15 +5,12 @@ "priority":1, "state":"Full\/Backup", "address":"10.0.1.1", - "ifaceName":"r2-eth0:10.0.1.2", - "retransmitCounter":0, - "requestCounter":0, - "dbSummaryCounter":0 + "ifaceName":"r2-eth0:10.0.1.2" } ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r2-eth1:10.0.2.2" @@ -21,7 +18,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r2-eth1:10.0.2.2" diff --git a/tests/topotests/ldp-oc-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf index 4566976b7b..0d3a74c4ac 100644 --- a/tests/topotests/ldp-oc-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf @@ -9,4 +9,5 @@ router ospf int r3-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json index 24502ed813..905774fc46 100644 --- a/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json @@ -10,7 +10,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r3-eth0:10.0.2.3" diff --git a/tests/topotests/ldp-oc-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf index 5aae885a12..7bbd228d02 100644 --- a/tests/topotests/ldp-oc-topo1/r4/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r4-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 3 ! diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json index 794410522d..67593952ca 100644 --- a/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json @@ -11,7 +11,7 @@ ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r4-eth0:10.0.2.4" diff --git a/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf index 76ea32fb61..a66fb92ba3 100644 --- a/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r1-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! int r1-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json index 6e6c3c8cb8..7e281abb5f 100644 --- a/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json @@ -4,8 +4,8 @@ { "dbSummaryCounter": 0, "retransmitCounter": 0, - "priority": 1, - "state": "Full/DR", + "priority": 2, + "state": "Full\/DR", "address": "10.0.1.2", "ifaceName": "r1-eth1:10.0.1.1", "requestCounter": 0 @@ -15,8 +15,8 @@ { "dbSummaryCounter": 0, "retransmitCounter": 0, - "priority": 1, - "state": "Full/DR", + "priority": 2, + "state": "Full\/DR", "address": "10.0.2.3", "ifaceName": "r1-eth2:10.0.2.1", "requestCounter": 0 diff --git a/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf index 7b3ddfe371..b4692feec8 100644 --- a/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json index b5b10cc535..22fd98f519 100644 --- a/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json @@ -3,7 +3,7 @@ "1.1.1.1": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.1.1", "ifaceName":"r2-eth1:10.0.1.2", "retransmitCounter":0, @@ -13,8 +13,8 @@ ], "3.3.3.3": [ { - "priority":1, - "state":"Full/DR", + "priority":2, + "state":"Full\/DR", "address":"10.0.3.3", "ifaceName":"r2-eth2:10.0.3.2", "retransmitCounter":0, diff --git a/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf index b424f2e108..2413bfa9d5 100644 --- a/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r3-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r3-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json index bc7bb1e894..970eb2fc1d 100644 --- a/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json @@ -3,7 +3,7 @@ "1.1.1.1": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.2.1", "ifaceName":"r3-eth1:10.0.2.3", "retransmitCounter":0, @@ -14,7 +14,7 @@ "2.2.2.2": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.3.2", "ifaceName":"r3-eth2:10.0.3.3", "retransmitCounter":0, diff --git a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf Binary files differindex dd7c6f74d0..4d26732ea7 100644 --- a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf +++ b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 72b99eeba8..8427b241b7 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -991,7 +991,7 @@ def modify_bgp_config_when_bgpd_down(tgen, topo, input_dict): ############################################# # Verification APIs ############################################# -@retry(attempts=3, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_router_id(tgen, topo, input_dict): """ Running command "show ip bgp json" for DUT and reading router-id @@ -1246,7 +1246,7 @@ def verify_bgp_convergence(tgen, topo, dut=None): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_community( tgen, addr_type, router, network, input_dict=None, vrf=None, bestpath=False ): @@ -1411,7 +1411,7 @@ def modify_as_number(tgen, topo, input_dict): return True -@retry(attempts=3, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_as_numbers(tgen, topo, input_dict): """ This API is to verify AS numbers for given DUT by running @@ -2062,7 +2062,7 @@ def verify_bgp_timers_and_functionality(tgen, topo, input_dict): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_attributes( tgen, addr_type, @@ -2198,7 +2198,7 @@ def verify_bgp_attributes( return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_best_path_as_per_bgp_attribute( tgen, addr_type, router, input_dict, attribute ): @@ -2402,6 +2402,7 @@ def verify_best_path_as_per_bgp_attribute( return True +@retry(attempts=5, wait=2, return_is_str=True) def verify_best_path_as_per_admin_distance( tgen, addr_type, router, input_dict, attribute ): @@ -3303,7 +3304,7 @@ def verify_eor(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_f_bit(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify f_bit in the BGP gr capability advertised @@ -3569,7 +3570,7 @@ def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer) return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut): """ This API is to verify gr_address_family in the BGP gr capability advertised @@ -4060,7 +4061,7 @@ def verify_attributes_for_evpn_routes( return False -@retry(attempts=6, wait=2, return_is_str=True) +@retry(attempts=5, wait=2, return_is_str=True) def verify_evpn_routes( tgen, topo, dut, input_dict, routeType=5, EthTag=0, next_hop=None ): diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py index a23092de83..abab9600a1 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -45,7 +45,7 @@ class BgpRib: def routes_include_wanted(self, pfxtbl, want, debug): # helper function to RequireVpnRoutes - for pfx in pfxtbl.iterkeys(): + for pfx in pfxtbl.keys(): if debug: self.log("trying pfx %s" % pfx) if pfx != want["p"]: @@ -107,7 +107,7 @@ class BgpRib: found = 0 if debug: self.log("want rd %s" % want["rd"]) - for rd in rds.iterkeys(): + for rd in rds.keys(): if rd != want["rd"]: continue if debug: diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index d83f946c42..6c24b6ddbb 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -1150,6 +1150,9 @@ def generate_ips(network, no_of_ips): if "/" in start_ipaddr: start_ip = start_ipaddr.split("/")[0] mask = int(start_ipaddr.split("/")[1]) + else: + logger.debug("start_ipaddr {} must have a / in it".format(start_ipaddr)) + assert(0) addr_type = validate_ip_address(start_ip) if addr_type == "ipv4": @@ -2559,6 +2562,7 @@ def verify_rib( tag=None, metric=None, fib=None, + count_only=False ): """ Data will be read from input_dict or input JSON file, API will generate @@ -2576,6 +2580,8 @@ def verify_rib( * `next_hop`[optional]: next_hop which needs to be verified, default: static * `protocol`[optional]: protocol, default = None + * `count_only`[optional]: count of nexthops only, not specific addresses, + default = False Usage ----- @@ -2739,7 +2745,23 @@ def verify_rib( for rib_r in rib_routes_json[st_rt][0]["nexthops"] ] - if found_hops: + # Check only the count of nexthops + if count_only: + if len(next_hop) == len(found_hops): + nh_found = True + else: + errormsg = ( + "Nexthops are missing for " + "route {} in RIB of router {}: " + "expected {}, found {}\n".format( + st_rt, dut, len(next_hop), + len(found_hops) + ) + ) + return errormsg + + # Check the actual nexthops + elif found_hops: missing_list_of_nexthops = set( found_hops ).difference(next_hop) @@ -2846,7 +2868,7 @@ def verify_rib( for advertise_network_dict in advertise_network: if "vrf" in advertise_network_dict: - cmd = "{} vrf {} json".format(command, static_route["vrf"]) + cmd = "{} vrf {} json".format(command, advertise_network_dict["vrf"]) else: cmd = "{} json".format(command) @@ -2925,264 +2947,7 @@ def verify_rib( logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return True - -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) -def verify_fib_routes(tgen, addr_type, dut, input_dict, next_hop=None): - """ - Data will be read from input_dict or input JSON file, API will generate - same prefixes, which were redistributed by either create_static_routes() or - advertise_networks_using_network_command() and will verify next_hop and - each prefix/routes is present in "show ip/ipv6 fib json" - command o/p. - - Parameters - ---------- - * `tgen` : topogen object - * `addr_type` : ip type, ipv4/ipv6 - * `dut`: Device Under Test, for which user wants to test the data - * `input_dict` : input dict, has details of static routes - * `next_hop`[optional]: next_hop which needs to be verified, - default: static - - Usage - ----- - input_routes_r1 = { - "r1": { - "static_routes": [{ - "network": ["1.1.1.1/32], - "next_hop": "Null0", - "vrf": "RED" - }] - } - } - result = result = verify_fib_routes(tgen, "ipv4, "r1", input_routes_r1) - - Returns - ------- - errormsg(str) or True - """ - - logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name)) - - router_list = tgen.routers() - for routerInput in input_dict.keys(): - for router, rnode in router_list.items(): - if router != dut: - continue - - logger.info("Checking router %s FIB routes:", router) - - # Verifying RIB routes - if addr_type == "ipv4": - command = "show ip fib" - else: - command = "show ipv6 fib" - - found_routes = [] - missing_routes = [] - - if "static_routes" in input_dict[routerInput]: - static_routes = input_dict[routerInput]["static_routes"] - - for static_route in static_routes: - if "vrf" in static_route and static_route["vrf"] is not None: - - logger.info( - "[DUT: {}]: Verifying routes for VRF:" - " {}".format(router, static_route["vrf"]) - ) - - cmd = "{} vrf {}".format(command, static_route["vrf"]) - - else: - cmd = "{}".format(command) - - cmd = "{} json".format(cmd) - - rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True) - - # Verifying output dictionary rib_routes_json is not empty - if bool(rib_routes_json) is False: - errormsg = "[DUT: {}]: No route found in fib".format(router) - return errormsg - - network = static_route["network"] - if "no_of_ip" in static_route: - no_of_ip = static_route["no_of_ip"] - else: - no_of_ip = 1 - - # Generating IPs for verification - ip_list = generate_ips(network, no_of_ip) - st_found = False - nh_found = False - - for st_rt in ip_list: - st_rt = str(ipaddress.ip_network(frr_unicode(st_rt))) - # st_rt = str(ipaddr.IPNetwork(unicode(st_rt))) - - _addr_type = validate_ip_address(st_rt) - if _addr_type != addr_type: - continue - - if st_rt in rib_routes_json: - st_found = True - found_routes.append(st_rt) - - if next_hop: - if type(next_hop) is not list: - next_hop = [next_hop] - - count = 0 - for nh in next_hop: - for nh_dict in rib_routes_json[st_rt][0][ - "nexthops" - ]: - if nh_dict["ip"] != nh: - continue - else: - count += 1 - - if count == len(next_hop): - nh_found = True - else: - missing_routes.append(st_rt) - errormsg = ( - "Nexthop {} is Missing" - " for route {} in " - "RIB of router {}\n".format( - next_hop, st_rt, dut - ) - ) - return errormsg - - else: - missing_routes.append(st_rt) - - if len(missing_routes) > 0: - errormsg = "[DUT: {}]: Missing route in FIB:" " {}".format( - dut, missing_routes - ) - return errormsg - - if nh_found: - logger.info( - "Found next_hop {} for all routes in RIB" - " of router {}\n".format(next_hop, dut) - ) - - if found_routes: - logger.info( - "[DUT: %s]: Verified routes in FIB, found" " routes are: %s\n", - dut, - found_routes, - ) - - continue - - if "bgp" in input_dict[routerInput]: - if ( - "advertise_networks" - not in input_dict[routerInput]["bgp"]["address_family"][addr_type][ - "unicast" - ] - ): - continue - - found_routes = [] - missing_routes = [] - advertise_network = input_dict[routerInput]["bgp"]["address_family"][ - addr_type - ]["unicast"]["advertise_networks"] - - # Continue if there are no network advertise - if len(advertise_network) == 0: - continue - - for advertise_network_dict in advertise_network: - if "vrf" in advertise_network_dict: - cmd = "{} vrf {} json".format(command, static_route["vrf"]) - else: - cmd = "{} json".format(command) - - rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True) - - # Verifying output dictionary rib_routes_json is not empty - if bool(rib_routes_json) is False: - errormsg = "No route found in rib of router {}..".format(router) - return errormsg - - start_ip = advertise_network_dict["network"] - if "no_of_network" in advertise_network_dict: - no_of_network = advertise_network_dict["no_of_network"] - else: - no_of_network = 1 - - # Generating IPs for verification - ip_list = generate_ips(start_ip, no_of_network) - st_found = False - nh_found = False - - for st_rt in ip_list: - # st_rt = str(ipaddr.IPNetwork(unicode(st_rt))) - st_rt = str(ipaddress.ip_network(frr_unicode(st_rt))) - - _addr_type = validate_ip_address(st_rt) - if _addr_type != addr_type: - continue - - if st_rt in rib_routes_json: - st_found = True - found_routes.append(st_rt) - - if next_hop: - if type(next_hop) is not list: - next_hop = [next_hop] - - count = 0 - for nh in next_hop: - for nh_dict in rib_routes_json[st_rt][0]["nexthops"]: - if nh_dict["ip"] != nh: - continue - else: - count += 1 - - if count == len(next_hop): - nh_found = True - else: - missing_routes.append(st_rt) - errormsg = ( - "Nexthop {} is Missing" - " for route {} in " - "RIB of router {}\n".format(next_hop, st_rt, dut) - ) - return errormsg - else: - missing_routes.append(st_rt) - - if len(missing_routes) > 0: - errormsg = "[DUT: {}]: Missing route in FIB: " "{} \n".format( - dut, missing_routes - ) - return errormsg - - if nh_found: - logger.info( - "Found next_hop {} for all routes in RIB" - " of router {}\n".format(next_hop, dut) - ) - - if found_routes: - logger.info( - "[DUT: {}]: Verified routes FIB" - ", found routes are: {}\n".format(dut, found_routes) - ) - - logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) - return True - - -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_fib_routes(tgen, addr_type, dut, input_dict, next_hop=None): """ Data will be read from input_dict or input JSON file, API will generate @@ -3633,7 +3398,7 @@ def verify_route_maps(tgen, input_dict): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_community(tgen, addr_type, router, network, input_dict=None): """ API to veiryf BGP large community is attached in route for any given diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py index 1fb4f48b0f..9cbea67af1 100644 --- a/tests/topotests/lib/lutil.py +++ b/tests/topotests/lib/lutil.py @@ -23,7 +23,7 @@ import time import datetime import json import math -from topolog import logger +from lib.topolog import logger from mininet.net import Mininet @@ -58,14 +58,14 @@ class lUtil: def log(self, str, level=6): if self.l_level > 0: if self.fout == "": - self.fout = open(self.fout_name, "w", 0) + self.fout = open(self.fout_name, "w") self.fout.write(str + "\n") if level <= self.l_level: print(str) def summary(self, str): if self.fsum == "": - self.fsum = open(self.fsum_name, "w", 0) + self.fsum = open(self.fsum_name, "w") self.fsum.write( "\ ******************************************************************************\n" @@ -380,7 +380,8 @@ def luInclude(filename, CallOnFail=None): LUtil.setCallOnFail(CallOnFail) if filename.endswith(".py"): LUtil.log("luInclude: execfile " + tstFile) - execfile(tstFile) + with open(tstFile) as infile: + exec(infile.read()) else: LUtil.log("luInclude: execTestFile " + tstFile) LUtil.execTestFile(tstFile) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 3e92bd7565..7ae4223f72 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -336,7 +336,7 @@ class Topogen(object): for gear in self.gears.values(): errors += gear.stop() if len(errors) > 0: - assert "Errors found post shutdown - details follow:" == 0, errors + logger.error("Errors found post shutdown - details follow: {}".format(errors)) self.net.stop() @@ -714,7 +714,7 @@ class TopoRouter(TopoGear): """ self.logger.debug("stopping") self.__stop_internal(False, False) - return self.__stop_internal() + return self.__stop_internal(True, False) def startDaemons(self, daemons): """ diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 4b18862101..7047c52b18 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -910,31 +910,63 @@ def sleep(amount, reason=None): time.sleep(amount) -def checkAddressSanitizerError(output, router, component): +def checkAddressSanitizerError(output, router, component, logdir=""): "Checks for AddressSanitizer in output. If found, then logs it and returns true, false otherwise" - addressSantizerError = re.search( - "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", output - ) - if addressSantizerError: + def processAddressSanitizerError(asanErrorRe, output, router, component): sys.stderr.write( "%s: %s triggered an exception by AddressSanitizer\n" % (router, component) ) # Sanitizer Error found in log - pidMark = addressSantizerError.group(1) + pidMark = asanErrorRe.group(1) addressSantizerLog = re.search( "%s(.*)%s" % (pidMark, pidMark), output, re.DOTALL ) if addressSantizerLog: - callingTest = os.path.basename( - sys._current_frames().values()[0].f_back.f_back.f_globals["__file__"] - ) - callingProc = sys._getframe(2).f_code.co_name + # Find Calling Test. Could be multiple steps back + testframe=sys._current_frames().values()[0] + level=0 + while level < 10: + test=os.path.splitext(os.path.basename(testframe.f_globals["__file__"]))[0] + if (test != "topotest") and (test != "topogen"): + # Found the calling test + callingTest=os.path.basename(testframe.f_globals["__file__"]) + break + level=level+1 + testframe=testframe.f_back + if (level >= 10): + # somehow couldn't find the test script. + callingTest="unknownTest" + # + # Now finding Calling Procedure + level=0 + while level < 20: + callingProc=sys._getframe(level).f_code.co_name + if ((callingProc != "processAddressSanitizerError") and + (callingProc != "checkAddressSanitizerError") and + (callingProc != "checkRouterCores") and + (callingProc != "stopRouter") and + (callingProc != "__stop_internal") and + (callingProc != "stop") and + (callingProc != "stop_topology") and + (callingProc != "checkRouterRunning") and + (callingProc != "check_router_running") and + (callingProc != "routers_have_failure")): + # Found the calling test + break + level=level+1 + if (level >= 20): + # something wrong - couldn't found the calling test function + callingProc="unknownProc" with open("/tmp/AddressSanitzer.txt", "a") as addrSanFile: sys.stderr.write( + "AddressSanitizer error in topotest `%s`, test `%s`, router `%s`\n\n" + % (callingTest, callingProc, router) + ) + sys.stderr.write( "\n".join(addressSantizerLog.group(1).splitlines()) + "\n" ) - addrSanFile.write("## Error: %s\n\n" % addressSantizerError.group(2)) + addrSanFile.write("## Error: %s\n\n" % asanErrorRe.group(2)) addrSanFile.write( "### AddressSanitizer error in topotest `%s`, test `%s`, router `%s`\n\n" % (callingTest, callingProc, router) @@ -945,7 +977,29 @@ def checkAddressSanitizerError(output, router, component): + "\n" ) addrSanFile.write("\n---------------\n") + return + + + addressSantizerError = re.search( + "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", output + ) + if addressSantizerError: + processAddressSanitizerError(addressSantizerError, output, router, component) return True + + # No Address Sanitizer Error in Output. Now check for AddressSanitizer daemon file + if logdir: + filepattern=logdir+"/"+router+"/"+component+".asan.*" + sys.stderr.write("Log check for %s on %s, pattern %s\n" % (component, router, filepattern)) + for file in glob.glob(filepattern): + with open(file, "r") as asanErrorFile: + asanError=asanErrorFile.read() + addressSantizerError = re.search( + "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", asanError + ) + if addressSantizerError: + processAddressSanitizerError(addressSantizerError, asanError, router, component) + return True return False @@ -1011,7 +1065,7 @@ class Router(Node): if self.logdir is None: cur_test = os.environ["PYTEST_CURRENT_TEST"] self.logdir = "/tmp/topotests/" + cur_test[ - 0 : cur_test.find(".py") + cur_test.find("/")+1 : cur_test.find(".py") ].replace("/", ".") # If the logdir is not created, then create it and set the @@ -1019,6 +1073,8 @@ class Router(Node): if not os.path.isdir(self.logdir): os.system("mkdir -p " + self.logdir + "/" + name) os.system("chmod -R go+rw /tmp/topotests") + # Erase logs of previous run + os.system("rm -rf " + self.logdir + "/" + name) self.daemondir = None self.hasmpls = False @@ -1185,7 +1241,7 @@ class Router(Node): if self.checkRouterVersion("<", minErrorVersion): # ignore errors in old versions errors = "" - if assertOnError and len(errors) > 0: + if assertOnError and errors is not None and len(errors) > 0: assert "Errors found - details follow:" == 0, errors return errors @@ -1324,6 +1380,7 @@ class Router(Node): # Starts actual daemons without init (ie restart) # cd to per node directory + self.cmd("install -d {}/{}".format(self.logdir, self.name)) self.cmd("cd {}/{}".format(self.logdir, self.name)) self.cmd("umask 000") @@ -1353,7 +1410,7 @@ class Router(Node): zebra_path = os.path.join(self.daemondir, "zebra") zebra_option = self.daemons_options["zebra"] self.cmd( - "{0} {1} --log stdout --log-level debug -s 90000000 -d > zebra.out 2> zebra.err".format( + "ASAN_OPTIONS=log_path=zebra.asan {0} {1} --log file:zebra.log --log-level debug -s 90000000 -d > zebra.out 2> zebra.err".format( zebra_path, zebra_option, self.logdir, self.name ) ) @@ -1368,7 +1425,7 @@ class Router(Node): staticd_path = os.path.join(self.daemondir, "staticd") staticd_option = self.daemons_options["staticd"] self.cmd( - "{0} {1} --log stdout --log-level debug -d > staticd.out 2> staticd.err".format( + "ASAN_OPTIONS=log_path=staticd.asan {0} {1} --log file:staticd.log --log-level debug -d > staticd.out 2> staticd.err".format( staticd_path, staticd_option, self.logdir, self.name ) ) @@ -1392,7 +1449,7 @@ class Router(Node): daemon_path = os.path.join(self.daemondir, daemon) self.cmd( - "{0} {1} --log stdout --log-level debug -d > {2}.out 2> {2}.err".format( + "ASAN_OPTIONS=log_path={2}.asan {0} {1} --log file:{2}.log --log-level debug -d > {2}.out 2> {2}.err".format( daemon_path, self.daemons_options.get(daemon, ""), daemon ) ) @@ -1514,7 +1571,7 @@ class Router(Node): reportMade = True # Look for AddressSanitizer Errors and append to /tmp/AddressSanitzer.txt if found if checkAddressSanitizerError( - self.getStdErr(daemon), self.name, daemon + self.getStdErr(daemon), self.name, daemon, self.logdir ): sys.stderr.write( "%s: Daemon %s killed by AddressSanitizer" % (self.name, daemon) @@ -1578,7 +1635,7 @@ class Router(Node): # Look for AddressSanitizer Errors and append to /tmp/AddressSanitzer.txt if found if checkAddressSanitizerError( - self.getStdErr(daemon), self.name, daemon + self.getStdErr(daemon), self.name, daemon, self.logdir ): return "%s: Daemon %s not running - killed by AddressSanitizer" % ( self.name, diff --git a/tests/topotests/route-scale/test_route_scale.py b/tests/topotests/route-scale/test_route_scale.py index 8aedfc198c..bbd6ef8d60 100644 --- a/tests/topotests/route-scale/test_route_scale.py +++ b/tests/topotests/route-scale/test_route_scale.py @@ -122,15 +122,20 @@ def run_one_setup(r1, s): expected_installed = s["expect_in"] expected_removed = s["expect_rem"] - count = s["count"] + retries = s["retries"] wait = s["wait"] - logger.info("Testing 1 million routes X {} ecmp".format(s["ecmp"])) + for d in expected_installed["routes"]: + if d["type"] == "sharp": + count = d["rib"] + break + + logger.info("Testing {} routes X {} ecmp".format(count, s["ecmp"])) r1.vtysh_cmd( "sharp install route 1.0.0.0 \ - nexthop-group {} 1000000".format( - s["nhg"] + nexthop-group {} {}".format( + s["nhg"], count ), isjson=False, ) @@ -138,21 +143,21 @@ def run_one_setup(r1, s): test_func = partial( topotest.router_json_cmp, r1, "show ip route summary json", expected_installed ) - success, result = topotest.run_and_expect(test_func, None, count, wait) + success, result = topotest.run_and_expect(test_func, None, retries, wait) assert success, "Route scale test install failed:\n{}".format(result) output = r1.vtysh_cmd("sharp data route", isjson=False) - logger.info("1 million routes X {} ecmp installed".format(s["ecmp"])) + logger.info("{} routes X {} ecmp installed".format(count, s["ecmp"])) logger.info(output) - r1.vtysh_cmd("sharp remove route 1.0.0.0 1000000", isjson=False) + r1.vtysh_cmd("sharp remove route 1.0.0.0 {}".format(count), isjson=False) test_func = partial( topotest.router_json_cmp, r1, "show ip route summary json", expected_removed ) - success, result = topotest.run_and_expect(test_func, None, count, wait) + success, result = topotest.run_and_expect(test_func, None, retries, wait) assert success, "Route scale test remove failed:\n{}".format(result) output = r1.vtysh_cmd("sharp data route", isjson=False) - logger.info("1 million routes x {} ecmp removed".format(s["ecmp"])) + logger.info("{} routes x {} ecmp removed".format(count, s["ecmp"])) logger.info(output) @@ -174,7 +179,7 @@ def test_route_install(): # dict keys of params: ecmp number, corresponding nhg name, timeout, # number of times to wait - scale_keys = ["ecmp", "nhg", "wait", "count", "expect_in", "expect_rem"] + scale_keys = ["ecmp", "nhg", "wait", "retries", "expect_in", "expect_rem"] # Table of defaults, used for timeout values and 'expected' objects scale_defaults = dict( diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 951383beb2..0de6c1c2e3 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1301,6 +1301,12 @@ def compare_context_objects(newconf, running): ): continue + # same thing for a pseudowire sub-context inside an l2vpn context + elif (len(running_ctx_keys) > 1 and running_ctx_keys[0].startswith('l2vpn') and + running_ctx_keys[1].startswith('member pseudowire') and + (running_ctx_keys[:1], None) in lines_to_del): + continue + # Non-global context elif running_ctx_keys and not any( "address-family" in key for key in running_ctx_keys diff --git a/tools/gcc-plugins/frr-format.c b/tools/gcc-plugins/frr-format.c index be56517171..6d91d2cdcd 100644 --- a/tools/gcc-plugins/frr-format.c +++ b/tools/gcc-plugins/frr-format.c @@ -2729,6 +2729,16 @@ tree type_normalize (tree type, tree *cousin, tree target = NULL) return type; } +/* gcc-10 asserts when you give a TYPE_DECL instead of the actual TYPE */ +static tree +decl_deref(tree typ) +{ + while (TREE_CODE (typ) == TYPE_DECL) + typ = DECL_ORIGINAL_TYPE (typ); + + return typ; +} + static void check_format_types (const substring_loc &fmt_loc, format_wanted_type *types, const format_kind_info *fki, @@ -2750,6 +2760,8 @@ check_format_types (const substring_loc &fmt_loc, wanted_type = types->wanted_type; arg_num = types->arg_num; + wanted_type = decl_deref(wanted_type); + /* The following should not occur here. */ gcc_assert (wanted_type); gcc_assert (wanted_type != void_type_node || types->pointer_count); @@ -2873,7 +2885,7 @@ check_format_types (const substring_loc &fmt_loc, || cur_type == signed_char_type_node || cur_type == unsigned_char_type_node); - int compat = lang_hooks.types_compatible_p (wanted_type, cur_type); + int compat = lang_hooks.types_compatible_p (decl_deref (wanted_type), decl_deref (cur_type)); /* Check the type of the "real" argument, if there's a type we want. */ if ((TREE_CODE (wanted_type) != INTEGER_TYPE || types->pointer_count) && compat) @@ -3180,6 +3192,9 @@ matching_type_p (tree spec_type, tree arg_type) gcc_assert (spec_type); gcc_assert (arg_type); + spec_type = decl_deref (spec_type); + arg_type = decl_deref (arg_type); + /* If any of the types requires structural equality, we can't compare their canonical types. */ if (TYPE_STRUCTURAL_EQUALITY_P (spec_type) diff --git a/vrrpd/vrrp_zebra.c b/vrrpd/vrrp_zebra.c index 37a1e4a624..385d443571 100644 --- a/vrrpd/vrrp_zebra.c +++ b/vrrpd/vrrp_zebra.c @@ -179,14 +179,13 @@ void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable) enable, VRRP_RADV_INT); } -int vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down) +void vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down) { DEBUGD(&vrrp_dbg_zebra, VRRP_LOGPFX "Requesting Zebra to set %s protodown %s", ifp->name, down ? "on" : "off"); - return zclient_send_interface_protodown(zclient, ifp->vrf_id, ifp, - down); + zclient_send_interface_protodown(zclient, ifp->vrf_id, ifp, down); } void vrrp_zebra_init(void) diff --git a/vrrpd/vrrp_zebra.h b/vrrpd/vrrp_zebra.h index 02d7055b86..c09943dcef 100644 --- a/vrrpd/vrrp_zebra.h +++ b/vrrpd/vrrp_zebra.h @@ -26,8 +26,8 @@ extern void vrrp_zebra_init(void); extern void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable); -extern int vrrp_zclient_send_interface_protodown(struct interface *ifp, - bool down); +extern void vrrp_zclient_send_interface_protodown(struct interface *ifp, + bool down); extern int vrrp_ifp_create(struct interface *ifp); extern int vrrp_ifp_up(struct interface *ifp); diff --git a/vtysh/subdir.am b/vtysh/subdir.am index 1e4439d274..86861b0390 100644 --- a/vtysh/subdir.am +++ b/vtysh/subdir.am @@ -33,8 +33,9 @@ BUILT_SOURCES += vtysh/vtysh_daemons.h # force vtysh_daemons.h $(vtysh_vtysh_OBJECTS): vtysh/vtysh_daemons.h +CLEANFILES += vtysh/vtysh_daemons.h vtysh/vtysh_daemons.h: - $(PERL) vtysh/daemons.pl $(vtysh_daemons) > vtysh/vtysh_daemons.h + $(PERL) $(top_srcdir)/vtysh/daemons.pl $(vtysh_daemons) > vtysh/vtysh_daemons.h AM_V_EXTRACT = $(am__v_EXTRACT_$(V)) am__v_EXTRACT_ = $(am__v_EXTRACT_$(AM_DEFAULT_VERBOSITY)) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 8a1e71a37d..ace4139551 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1720,11 +1720,16 @@ DEFUNSH(VTYSH_BGPD, address_family_evpn, address_family_evpn_cmd, } #if defined(HAVE_CUMULUS) +#if CONFDATE > 20211115 +CPP_NOTICE("Use of `address-family evpn` is deprecated please remove don't forget frr-reload.py") +#endif DEFUNSH_HIDDEN(VTYSH_BGPD, address_family_evpn2, address_family_evpn2_cmd, "address-family evpn", "Enter Address Family command mode\n" "EVPN Address family\n") { + vty_out(vty, + "This command is deprecated please convert to `address-family l2vpn evpn`\n"); vty->node = BGP_EVPN_NODE; return CMD_SUCCESS; } @@ -2095,7 +2100,7 @@ DEFUNSH(VTYSH_REALLYALL, vtysh_exit_all, vtysh_exit_all_cmd, "exit", return vtysh_exit(vty); } -DEFUNSH(VTYSH_ALL, vtysh_quit_all, vtysh_quit_all_cmd, "quit", +DEFUNSH(VTYSH_REALLYALL, vtysh_quit_all, vtysh_quit_all_cmd, "quit", "Exit current mode and down to previous mode\n") { return vtysh_exit_all(self, vty, argc, argv); @@ -2447,28 +2452,64 @@ DEFUNSH(VTYSH_INTERFACE, vtysh_quit_interface, vtysh_quit_interface_cmd, "quit", return vtysh_exit_interface(self, vty, argc, argv); } -DEFUN (vtysh_show_poll, - vtysh_show_poll_cmd, - "show thread poll", - SHOW_STR - "Thread information\n" - "Thread Poll Information\n") +static char *do_prepend(struct vty *vty, struct cmd_token **argv, int argc) +{ + const char *argstr[argc + 1]; + int i, off = 0; + + if (vty->node != VIEW_NODE) { + off = 1; + argstr[0] = "do"; + } + + for (i = 0; i < argc; i++) + argstr[i + off] = argv[i]->arg; + + return frrstr_join(argstr, argc + off, " "); +} + +static int show_per_daemon(struct vty *vty, struct cmd_token **argv, int argc, + const char *headline) { unsigned int i; int ret = CMD_SUCCESS; - char line[100]; + char *line = do_prepend(vty, argv, argc); - snprintf(line, sizeof(line), "do show thread poll\n"); for (i = 0; i < array_size(vtysh_client); i++) if (vtysh_client[i].fd >= 0) { - vty_out(vty, "Thread statistics for %s:\n", - vtysh_client[i].name); + vty_out(vty, headline, vtysh_client[i].name); ret = vtysh_client_execute(&vtysh_client[i], line); vty_out(vty, "\n"); } + + XFREE(MTYPE_TMP, line); + return ret; } +static int show_one_daemon(struct vty *vty, struct cmd_token **argv, int argc, + const char *name) +{ + int ret; + char *line = do_prepend(vty, argv, argc); + + ret = vtysh_client_execute_name(name, line); + + XFREE(MTYPE_TMP, line); + + return ret; +} + +DEFUN (vtysh_show_poll, + vtysh_show_poll_cmd, + "show thread poll", + SHOW_STR + "Thread information\n" + "Thread Poll Information\n") +{ + return show_per_daemon(vty, argv, argc, "Thread statistics for %s:\n"); +} + #ifndef EXCLUDE_CPU_TIME DEFUN (vtysh_show_thread, vtysh_show_thread_cmd, @@ -2478,23 +2519,7 @@ DEFUN (vtysh_show_thread, "Thread CPU usage\n" "Display filter (rwtexb)\n") { - unsigned int i; - int idx = 0; - int ret = CMD_SUCCESS; - char line[100]; - - const char *filter = - argv_find(argv, argc, "FILTER", &idx) ? argv[idx]->arg : ""; - - snprintf(line, sizeof(line), "do show thread cpu %s\n", filter); - for (i = 0; i < array_size(vtysh_client); i++) - if (vtysh_client[i].fd >= 0) { - vty_out(vty, "Thread statistics for %s:\n", - vtysh_client[i].name); - ret = vtysh_client_execute(&vtysh_client[i], line); - vty_out(vty, "\n"); - } - return ret; + return show_per_daemon(vty, argv, argc, "Thread statistics for %s:\n"); } #endif @@ -2504,19 +2529,8 @@ DEFUN (vtysh_show_work_queues, SHOW_STR "Work Queue information\n") { - unsigned int i; - int ret = CMD_SUCCESS; - char line[] = "do show work-queues\n"; - - for (i = 0; i < array_size(vtysh_client); i++) - if (vtysh_client[i].fd >= 0) { - vty_out(vty, "Work queue statistics for %s:\n", - vtysh_client[i].name); - ret = vtysh_client_execute(&vtysh_client[i], line); - vty_out(vty, "\n"); - } - - return ret; + return show_per_daemon(vty, argv, argc, + "Work queue statistics for %s:\n"); } DEFUN (vtysh_show_work_queues_daemon, @@ -2526,10 +2540,7 @@ DEFUN (vtysh_show_work_queues_daemon, "Work Queue information\n" DAEMONS_STR) { - int idx_protocol = 2; - - return vtysh_client_execute_name(argv[idx_protocol]->text, - "show work-queues\n"); + return show_one_daemon(vty, argv, argc - 1, argv[argc - 1]->text); } DEFUNSH(VTYSH_ZEBRA, vtysh_link_params, vtysh_link_params_cmd, "link-params", @@ -2547,21 +2558,6 @@ DEFUNSH(VTYSH_ZEBRA, exit_link_params, exit_link_params_cmd, "exit-link-params", return CMD_SUCCESS; } -static int show_per_daemon(const char *line, const char *headline) -{ - unsigned int i; - int ret = CMD_SUCCESS; - - for (i = 0; i < array_size(vtysh_client); i++) - if (vtysh_client[i].fd >= 0) { - vty_out(vty, headline, vtysh_client[i].name); - ret = vtysh_client_execute(&vtysh_client[i], line); - vty_out(vty, "\n"); - } - - return ret; -} - DEFUNSH_HIDDEN (0x00, vtysh_debug_all, vtysh_debug_all_cmd, @@ -2579,7 +2575,7 @@ DEFUN (vtysh_show_debugging, SHOW_STR DEBUG_STR) { - return show_per_daemon("do show debugging\n", ""); + return show_per_daemon(vty, argv, argc, ""); } DEFUN (vtysh_show_debugging_hashtable, @@ -2590,6 +2586,8 @@ DEFUN (vtysh_show_debugging_hashtable, "Statistics about hash tables\n" "Statistics about hash tables\n") { + bool stats = strmatch(argv[argc - 1]->text, "statistics"); + vty_out(vty, "\n"); vty_out(vty, "Load factor (LF) - average number of elements across all buckets\n"); @@ -2601,7 +2599,7 @@ DEFUN (vtysh_show_debugging_hashtable, "and indicates the typical deviation of bucket chain length\n"); vty_out(vty, "from the value in the corresponding load factor.\n\n"); - return show_per_daemon("do show debugging hashtable\n", + return show_per_daemon(vty, argv, stats ? argc - 1 : argc, "Hashtable statistics for %s:\n"); } @@ -2621,12 +2619,7 @@ DEFUN (vtysh_show_error_code, /* If it's not a shared code, send it to all the daemons */ if (arg < LIB_FERR_START || arg > LIB_FERR_END) { - char *fcmd = argv_concat(argv, argc, 0); - char cmd[256]; - - snprintf(cmd, sizeof(cmd), "do %s", fcmd); - show_per_daemon(cmd, ""); - XFREE(MTYPE_TMP, fcmd); + show_per_daemon(vty, argv, argc, ""); /* Otherwise, print it ourselves to avoid duplication */ } else { bool json = strmatch(argv[argc - 1]->text, "json"); @@ -2659,11 +2652,7 @@ DEFUN (show_yang_operational_data, "YANG module translator\n" DAEMONS_STR) { - int idx_protocol = argc - 1; - char *fcmd = argv_concat(argv, argc - 1, 0); - int ret = vtysh_client_execute_name(argv[idx_protocol]->text, fcmd); - XFREE(MTYPE_TMP, fcmd); - return ret; + return show_one_daemon(vty, argv, argc - 1, argv[argc - 1]->text); } DEFUNSH(VTYSH_ALL, debug_nb, @@ -2696,7 +2685,7 @@ DEFUN (vtysh_show_memory, SHOW_STR "Memory statistics\n") { - return show_per_daemon("do show memory\n", "Memory statistics for %s:\n"); + return show_per_daemon(vty, argv, argc, "Memory statistics for %s:\n"); } DEFUN (vtysh_show_modules, @@ -2705,8 +2694,7 @@ DEFUN (vtysh_show_modules, SHOW_STR "Loaded modules\n") { - return show_per_daemon("do show modules\n", - "Module information for %s:\n"); + return show_per_daemon(vty, argv, argc, "Module information for %s:\n"); } /* Logging commands. */ @@ -2716,7 +2704,7 @@ DEFUN (vtysh_show_logging, SHOW_STR "Show current logging configuration\n") { - return show_per_daemon("do show logging\n", + return show_per_daemon(vty, argv, argc, "Logging configuration for %s:\n"); } @@ -4194,7 +4182,7 @@ void vtysh_init_vty(void) install_element(VRF_NODE, &vtysh_end_all_cmd); install_element(VRF_NODE, &vtysh_exit_vrf_cmd); install_element(VRF_NODE, &vtysh_quit_vrf_cmd); - + install_node(&rmap_node); install_element(CONFIG_NODE, &vtysh_route_map_cmd); install_element(RMAP_NODE, &vtysh_exit_rmap_cmd); @@ -4279,7 +4267,7 @@ void vtysh_init_vty(void) install_element(CONFIG_NODE, &vtysh_debug_memstats_cmd); /* northbound */ - install_element(VIEW_NODE, &show_yang_operational_data_cmd); + install_element(ENABLE_NODE, &show_yang_operational_data_cmd); install_element(ENABLE_NODE, &debug_nb_cmd); install_element(CONFIG_NODE, &debug_nb_cmd); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index 4b6c648d2f..7dcf019888 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -526,9 +526,13 @@ static int vtysh_read_file(FILE *confp) vtysh_execute_no_pager("enable"); vtysh_execute_no_pager("configure terminal"); + vtysh_execute_no_pager("start_configuration"); + /* Execute configuration file. */ ret = vtysh_config_from_file(vty, confp); + vtysh_execute_no_pager("end_configuration"); + vtysh_execute_no_pager("end"); vtysh_execute_no_pager("disable"); diff --git a/yang/frr-bgp-common-structure.yang b/yang/frr-bgp-common-structure.yang index 6543b1d1c3..7b987a93cd 100644 --- a/yang/frr-bgp-common-structure.yang +++ b/yang/frr-bgp-common-structure.yang @@ -110,7 +110,6 @@ submodule frr-bgp-common-structure { container local-as { leaf local-as { type inet:as-number; - mandatory true; description "The local autonomous system number that is to be used when establishing sessions with the remote peer or peer group, if @@ -200,7 +199,6 @@ submodule frr-bgp-common-structure { container neighbor-remote-as { leaf remote-as-type { type frr-bt:as-type; - mandatory true; description "Remote AS type."; } @@ -346,7 +344,7 @@ submodule frr-bgp-common-structure { default "true"; description "When set to 'true' sending Capability Negotiation in the open - message is supressed to this peer."; + message is suppressed to this peer."; } leaf override-capability { @@ -363,18 +361,18 @@ submodule frr-bgp-common-structure { description "Structural grouping used to include default-originate configuration for both BGP neighbors and peer groups."; - container default-originate-options { + container default-originate { description "default originate parameters for the BGP neighbor or group."; - leaf send-default-route { + leaf originate { type boolean; default "false"; description "If set to 'true', send the default-route to the neighbour(s)."; } - leaf rmap-policy-export { + leaf route-map { type frr-route-map:route-map-ref; description "Route-map to specify criteria to originate default."; @@ -402,7 +400,14 @@ submodule frr-bgp-common-structure { neighbour."; } - container prefix-limit-options { + leaf force-check { + type boolean; + default false; + description + "Force check all received routes."; + } + + container options { when "../direction = 'in'"; choice options { case warning { @@ -446,7 +451,7 @@ submodule frr-bgp-common-structure { } leaf tr-restart-timer { - type uint32; + type uint16; units "minutes"; description "Time interval in seconds after which the BGP session is @@ -598,7 +603,7 @@ submodule frr-bgp-common-structure { leaf send-large-community { type boolean; - default "false"; + default "true"; description "Send large community attribute to this neighbor."; } @@ -614,7 +619,6 @@ submodule frr-bgp-common-structure { "BGP Administrative Shutdown Communication."; leaf enable { type boolean; - mandatory true; description "When set to 'true', BGP shutdown communication is enabled."; } @@ -803,9 +807,9 @@ submodule frr-bgp-common-structure { uses as-path-filter-list-policy-export; - uses unsupress-map-policy-import; + uses unsuppress-map-policy-import; - uses unsupress-map-policy-export; + uses unsuppress-map-policy-export; } } } diff --git a/yang/frr-bgp-common.yang b/yang/frr-bgp-common.yang index de78758dbb..cb1a6a8f56 100644 --- a/yang/frr-bgp-common.yang +++ b/yang/frr-bgp-common.yang @@ -87,14 +87,14 @@ submodule frr-bgp-common { } } - grouping unsupress-map-policy-import { - leaf unsupress-map-import { + grouping unsuppress-map-policy-import { + leaf unsuppress-map-import { type frr-route-map:route-map-ref; } } - grouping unsupress-map-policy-export { - leaf unsupress-map-export { + grouping unsuppress-map-policy-export { + leaf unsuppress-map-export { type frr-route-map:route-map-ref; } } diff --git a/yang/frr-bgp-neighbor.yang b/yang/frr-bgp-neighbor.yang index 3b8d63c447..a4b50b156b 100644 --- a/yang/frr-bgp-neighbor.yang +++ b/yang/frr-bgp-neighbor.yang @@ -97,8 +97,6 @@ submodule frr-bgp-neighbor { uses neighbor-update-source; - uses neighbor-remote-as; - uses structure-neighbor-group-ebgp-multihop; uses neighbor-local-as-options; @@ -124,7 +122,6 @@ submodule frr-bgp-neighbor { leaf enabled { type boolean; - default "false"; description "This leaf indicates whether the IPv4 Unicast AFI, SAFI is enabled for the neighbour or group."; diff --git a/yang/frr-bgp-peer-group.yang b/yang/frr-bgp-peer-group.yang index 3ce628d2b7..452ff1a12f 100644 --- a/yang/frr-bgp-peer-group.yang +++ b/yang/frr-bgp-peer-group.yang @@ -9,6 +9,10 @@ submodule frr-bgp-peer-group { prefix inet; } + import frr-bgp-types { + prefix frr-bt; + } + include frr-bgp-common-structure; include frr-bgp-neighbor; @@ -72,6 +76,8 @@ submodule frr-bgp-peer-group { "Configure BGP dynamic neighbors listen range."; } + uses neighbor-remote-as; + uses neighbor-parameters; } diff --git a/yang/frr-bgp.yang b/yang/frr-bgp.yang index 820c4b2861..2fb5d13fa7 100644 --- a/yang/frr-bgp.yang +++ b/yang/frr-bgp.yang @@ -19,6 +19,10 @@ module frr-bgp { prefix frr-interface; } + import frr-bgp-types { + prefix frr-bt; + } + include "frr-bgp-common-structure"; include "frr-bgp-common"; @@ -206,6 +210,25 @@ module frr-bgp { "The peer-group with which this neighbor is associated."; } + container neighbor-remote-as { + leaf remote-as-type { + type frr-bt:as-type; + mandatory true; + description + "Remote AS type."; + } + + leaf remote-as { + when "../remote-as-type = 'as-specified'"; + type inet:as-number; + description + "The remote autonomous system number received in + the BGP OPEN message."; + reference + "RFC 4271"; + } + } + uses neighbor-parameters; } @@ -238,6 +261,8 @@ module frr-bgp { "The peer-group with which this neighbor is associated."; } + uses neighbor-remote-as; + uses neighbor-parameters; } } @@ -552,6 +577,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -578,6 +605,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -604,6 +633,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -630,6 +661,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -656,6 +689,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -799,6 +834,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -825,6 +862,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -851,6 +890,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -877,6 +918,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -903,6 +946,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -1046,6 +1091,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -1072,6 +1119,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -1098,6 +1147,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -1124,6 +1175,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; @@ -1150,6 +1203,8 @@ module frr-bgp { uses structure-neighbor-group-as-path-options; + uses structure-neighbor-default-originate-options; + uses structure-neighbor-group-attr-unchanged; uses structure-neighbor-group-orf-capability; diff --git a/yang/frr-filter.yang b/yang/frr-filter.yang index 400a093178..eb84dd7460 100644 --- a/yang/frr-filter.yang +++ b/yang/frr-filter.yang @@ -154,29 +154,33 @@ module frr-filter { } } case cisco { - leaf host { - description "Host to match"; - type inet:ipv4-address; - } - container network { - leaf address { - mandatory true; - description "Network address part."; + choice standard-value { + description "Source value to match"; + + leaf host { + description "Host to match"; type inet:ipv4-address; } - leaf mask { - mandatory true; - description "Network mask/wildcard part."; - type inet:ipv4-address; + container network { + leaf address { + mandatory true; + description "Network address part."; + type inet:ipv4-address; + } + leaf mask { + mandatory true; + description "Network mask/wildcard part."; + type inet:ipv4-address; + } + } + leaf source-any { + /* + * Was `any`, however it conflicts with `any` leaf + * outside this choice. + */ + description "Match any"; + type empty; } - } - leaf source-any { - /* - * Was `any`, however it conflicts with `any` leaf - * outside this choice. - */ - description "Match any"; - type empty; } choice extended-value { diff --git a/yang/frr-igmp.yang b/yang/frr-igmp.yang index b63d0f97ec..e2971dc5cf 100644 --- a/yang/frr-igmp.yang +++ b/yang/frr-igmp.yang @@ -71,14 +71,13 @@ module frr-igmp { type boolean; default "false"; description - "Enable IGMP protocol on the interface."; + "Enable IGMP flag on the interface."; } leaf version { type uint8 { range "2..3"; } - default "3"; description "IGMP version."; } @@ -156,8 +155,8 @@ module frr-igmp { */ augment "/frr-interface:lib/frr-interface:interface" { container igmp { - description - "IGMP interface parameters."; + presence + "Configure IGMP on an interface."; uses interface-config-attributes; list address-family { key "address-family"; diff --git a/yang/frr-pim.yang b/yang/frr-pim.yang index 2135d22f67..f959ff8be5 100644 --- a/yang/frr-pim.yang +++ b/yang/frr-pim.yang @@ -82,26 +82,19 @@ module frr-pim { "A grouping defining pim global attributes."; leaf ecmp { - type empty; + type boolean; + default "false"; description "Enable PIM ECMP."; } leaf ecmp-rebalance { - type empty; + type boolean; + default "false"; description "Enable PIM ECMP Rebalance."; } - leaf join-prune-interval { - type uint16 { - range "60..600"; - } - default "60"; - description - "Join Prune Send Interval in seconds."; - } - leaf keep-alive-timer { type uint16 { range "31..60000"; @@ -119,26 +112,7 @@ module frr-pim { description "RP keep alive Timer in seconds."; } - - leaf packets { - type uint8 { - range "1..100"; - } - default "3"; - description - "Number of packets to process at one time per fd."; - } - - leaf register-suppress-time { - type uint16 { - range "5..60000"; - } - default "60"; - description - "Register Suppress Timer."; - } } - grouping per-af-global-pim-config-attributes { description "A grouping defining per address family pim global attributes"; @@ -148,7 +122,8 @@ module frr-pim { description "Only applicable to IPv4 address family."; } - type empty; + type boolean; + default "true"; description "Send v6 secondary addresses."; } @@ -241,7 +216,7 @@ module frr-pim { } container mlag { - description + presence "Multi-chassis link aggregation."; leaf peerlink-rif { @@ -300,22 +275,14 @@ module frr-pim { "A grouping defining pim interface attributes."; leaf pim-enable { - type empty; + type boolean; + default "false"; description "Enable PIM flag on the interface."; } - leaf dr-priority { - type uint32 { - range "1..4294967295"; - } - default 1; - description - "DR (Designated Router) priority"; - } - leaf hello-interval { - type uint16 { + type uint8 { range "1..180"; } default "30"; @@ -324,7 +291,7 @@ module frr-pim { } leaf hello-holdtime { - type uint16 { + type uint8 { range "1..180"; } description @@ -364,22 +331,34 @@ module frr-pim { } leaf bsm { - type empty; + type boolean; + default "false"; description "Enables BSM support on the interface."; } leaf unicast-bsm { - type empty; + type boolean; + default "false"; description "Accept/Send unicast BSM on the interface."; } leaf active-active { - type empty; + type boolean; + default "false"; description "Mark interface as Active-Active for MLAG operations."; } + + leaf dr-priority { + type uint32 { + range "1..4294967295"; + } + default 1; + description + "DR (Designated Router) priority"; + } } // interface-pim-config-attributes grouping per-af-interface-pim-config-attributes { @@ -455,8 +434,8 @@ module frr-pim { */ augment "/frr-interface:lib/frr-interface:interface" { container pim { - description - "PIM interface parameters."; + presence + "Configure PIM on an interface."; uses interface-pim-config-attributes; list address-family { key "address-family"; @@ -467,5 +446,33 @@ module frr-pim { } } } -} + container pim { + description + "PIM router parameters."; + leaf packets { + type uint8 { + range "1..100"; + } + default "3"; + description + "Number of packets to process at one time per fd."; + } + leaf join-prune-interval { + type uint16 { + range "60..600"; + } + default "60"; + description + "Join Prune Send Interval in seconds."; + } + leaf register-suppress-time { + type uint16 { + range "5..60000"; + } + default "60"; + description + "Register Suppress Timer."; + } + } +} diff --git a/zebra/connected.c b/zebra/connected.c index 6a1efc3e65..70ea2e3805 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -41,6 +41,7 @@ #include "zebra/zebra_mpls.h" #include "zebra/debug.h" #include "zebra/zebra_errors.h" +#include "zebra/zebra_router.h" /* communicate the withdrawal of a connected address */ static void connected_withdraw(struct connected *ifc) @@ -207,6 +208,7 @@ void connected_up(struct interface *ifp, struct connected *ifc) }; struct zebra_vrf *zvrf; uint32_t metric; + uint32_t flags = 0; zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); if (!zvrf) { @@ -251,11 +253,22 @@ void connected_up(struct interface *ifp, struct connected *ifc) metric = (ifc->metric < (uint32_t)METRIC_MAX) ? ifc->metric : ifp->metric; - rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, - 0, 0, &p, NULL, &nh, 0, zvrf->table_id, metric, 0, 0, 0); - rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, - 0, 0, &p, NULL, &nh, 0, zvrf->table_id, metric, 0, 0, 0); + /* + * Since we are hand creating the connected routes + * in our main routing table, *if* we are working + * in an offloaded environment then we need to + * pretend like the route is offloaded so everything + * else will work + */ + if (zrouter.asic_offloaded) + flags |= ZEBRA_FLAG_OFFLOADED; + + rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, 0, + flags, &p, NULL, &nh, 0, zvrf->table_id, metric, 0, 0, 0); + + rib_add(afi, SAFI_MULTICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT, 0, + flags, &p, NULL, &nh, 0, zvrf->table_id, metric, 0, 0, 0); /* Schedule LSP forwarding entries for processing, if appropriate. */ if (zvrf->vrf->vrf_id == VRF_DEFAULT) { diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 90a08bbd6c..a68873882d 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -691,6 +691,36 @@ static int netlink_bridge_interface(struct nlmsghdr *h, int len, ns_id_t ns_id, return 0; } +/* If the interface is and es bond member then it must follow EVPN's + * protodown setting + */ +static void netlink_proc_dplane_if_protodown(struct zebra_if *zif, + bool protodown) +{ + bool zif_protodown; + + zif_protodown = !!(zif->flags & ZIF_FLAG_PROTODOWN); + if (protodown == zif_protodown) + return; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("interface %s dplane change, protdown %s", + zif->ifp->name, protodown ? "on" : "off"); + + if (zebra_evpn_is_es_bond_member(zif->ifp)) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( + "bond mbr %s re-instate protdown %s in the dplane", + zif->ifp->name, zif_protodown ? "on" : "off"); + netlink_protodown(zif->ifp, zif_protodown); + } else { + if (protodown) + zif->flags |= ZIF_FLAG_PROTODOWN; + else + zif->flags &= ~ZIF_FLAG_PROTODOWN; + } +} + /* * Called from interface_lookup_netlink(). This function is only used * during bootstrap. @@ -849,11 +879,20 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup) */ netlink_interface_update_l2info(ifp, linkinfo[IFLA_INFO_DATA], 1, link_nsid); + if (IS_ZEBRA_IF_BOND(ifp)) + zebra_l2if_update_bond(ifp, true); if (IS_ZEBRA_IF_BRIDGE_SLAVE(ifp)) zebra_l2if_update_bridge_slave(ifp, bridge_ifindex, ns_id); else if (IS_ZEBRA_IF_BOND_SLAVE(ifp)) zebra_l2if_update_bond_slave(ifp, bond_ifindex); + if (tb[IFLA_PROTO_DOWN]) { + uint8_t protodown; + + protodown = *(uint8_t *)RTA_DATA(tb[IFLA_PROTO_DOWN]); + netlink_proc_dplane_if_protodown(zif, !!protodown); + } + return 0; } @@ -1284,6 +1323,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) uint8_t old_hw_addr[INTERFACE_HWADDR_MAX]; struct zebra_if *zif; ns_id_t link_nsid = ns_id; + ifindex_t master_infindex = IFINDEX_INTERNAL; zns = zebra_ns_lookup(ns_id); ifi = NLMSG_DATA(h); @@ -1373,16 +1413,17 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) if (slave_kind && (strcmp(slave_kind, "vrf") == 0) && !vrf_is_backend_netns()) { zif_slave_type = ZEBRA_IF_SLAVE_VRF; - vrf_id = *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]); + master_infindex = vrf_id = + *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]); } else if (slave_kind && (strcmp(slave_kind, "bridge") == 0)) { zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE; - bridge_ifindex = + master_infindex = bridge_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]); } else if (slave_kind && (strcmp(slave_kind, "bond") == 0)) { zif_slave_type = ZEBRA_IF_SLAVE_BOND; - bond_ifindex = + master_infindex = bond_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_MASTER]); } else zif_slave_type = ZEBRA_IF_SLAVE_OTHER; @@ -1396,7 +1437,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) zlog_debug( "RTM_NEWLINK ADD for %s(%u) vrf_id %u type %d sl_type %d master %u flags 0x%x", name, ifi->ifi_index, vrf_id, zif_type, - zif_slave_type, bridge_ifindex, + zif_slave_type, master_infindex, ifi->ifi_flags); if (ifp == NULL) { @@ -1446,6 +1487,15 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) ns_id); else if (IS_ZEBRA_IF_BOND_SLAVE(ifp)) zebra_l2if_update_bond_slave(ifp, bond_ifindex); + + if (tb[IFLA_PROTO_DOWN]) { + uint8_t protodown; + + protodown = *(uint8_t *)RTA_DATA( + tb[IFLA_PROTO_DOWN]); + netlink_proc_dplane_if_protodown(ifp->info, + !!protodown); + } } else if (ifp->vrf_id != vrf_id) { /* VRF change for an interface. */ if (IS_ZEBRA_DEBUG_KERNEL) @@ -1463,7 +1513,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) zlog_debug( "RTM_NEWLINK update for %s(%u) sl_type %d master %u flags 0x%x", name, ifp->ifindex, zif_slave_type, - bridge_ifindex, ifi->ifi_flags); + master_infindex, ifi->ifi_flags); set_ifindex(ifp, ifi->ifi_index, zns); if (!tb[IFLA_MTU]) { @@ -1542,12 +1592,23 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) netlink_interface_update_l2info( ifp, linkinfo[IFLA_INFO_DATA], 0, link_nsid); + if (IS_ZEBRA_IF_BOND(ifp)) + zebra_l2if_update_bond(ifp, true); if (IS_ZEBRA_IF_BRIDGE_SLAVE(ifp) || was_bridge_slave) zebra_l2if_update_bridge_slave(ifp, bridge_ifindex, ns_id); else if (IS_ZEBRA_IF_BOND_SLAVE(ifp) || was_bond_slave) zebra_l2if_update_bond_slave(ifp, bond_ifindex); + + if (tb[IFLA_PROTO_DOWN]) { + uint8_t protodown; + + protodown = *(uint8_t *)RTA_DATA( + tb[IFLA_PROTO_DOWN]); + netlink_proc_dplane_if_protodown(ifp->info, + !!protodown); + } } zif = ifp->info; @@ -1572,6 +1633,8 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK); + if (IS_ZEBRA_IF_BOND(ifp)) + zebra_l2if_update_bond(ifp, false); /* Special handling for bridge or VxLAN interfaces. */ if (IS_ZEBRA_IF_BRIDGE(ifp)) zebra_l2_bridge_del(ifp); diff --git a/zebra/interface.c b/zebra/interface.c index 3b7d6f2432..ddad9c9e56 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1069,6 +1069,9 @@ void if_up(struct interface *ifp) if (zif->es_info.es) zebra_evpn_es_if_oper_state_change(zif, true /*up*/); + + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) + zebra_evpn_mh_uplink_oper_update(zif); } /* Interface goes down. We have to manage different behavior of based @@ -1106,6 +1109,9 @@ void if_down(struct interface *ifp) if (zif->es_info.es) zebra_evpn_es_if_oper_state_change(zif, false /*up*/); + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) + zebra_evpn_mh_uplink_oper_update(zif); + /* Notify to the protocol daemons. */ zebra_interface_down_update(ifp); @@ -1156,6 +1162,18 @@ void zebra_if_update_all_links(void) if (!ifp) continue; zif = ifp->info; + /* update bond-member to bond linkages */ + if ((IS_ZEBRA_IF_BOND_SLAVE(ifp)) + && (zif->bondslave_info.bond_ifindex != IFINDEX_INTERNAL) + && !zif->bondslave_info.bond_if) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("bond mbr %s map to bond %d", + zif->ifp->name, + zif->bondslave_info.bond_ifindex); + zebra_l2_map_slave_to_bond(zif, ifp->vrf_id); + } + + /* update SVI linkages */ if ((zif->link_ifindex != IFINDEX_INTERNAL) && !zif->link) { zif->link = if_lookup_by_index_per_ns(ns, zif->link_ifindex); @@ -1382,6 +1400,34 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf) vty_out(vty, "\n"); } +const char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc, + char *pd_buf, uint32_t pd_buf_len) +{ + bool first = true; + + pd_buf[0] = '\0'; + + strlcat(pd_buf, "(", pd_buf_len); + + if (protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) { + if (first) + first = false; + else + strlcat(pd_buf, ",", pd_buf_len); + strlcat(pd_buf, "startup-delay", pd_buf_len); + } + + if (protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) { + if (!first) + strlcat(pd_buf, ",", pd_buf_len); + strlcat(pd_buf, "uplinks-down", pd_buf_len); + } + + strlcat(pd_buf, ")", pd_buf_len); + + return pd_buf; +} + /* Interface's information print out to vty interface. */ static void if_dump_vty(struct vty *vty, struct interface *ifp) { @@ -1391,6 +1437,7 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp) struct route_node *rn; struct zebra_if *zebra_if; struct vrf *vrf; + char pd_buf[ZEBRA_PROTODOWN_RC_STR_LEN]; zebra_if = ifp->info; @@ -1545,6 +1592,14 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp) } zebra_evpn_if_es_print(vty, zebra_if); + vty_out(vty, " protodown: %s", + (zebra_if->flags & ZIF_FLAG_PROTODOWN) ? "on" : "off"); + if (zebra_if->protodown_rc) + vty_out(vty, " rc: %s\n", + zebra_protodown_rc_str(zebra_if->protodown_rc, pd_buf, + sizeof(pd_buf))); + else + vty_out(vty, "\n"); if (zebra_if->link_ifindex != IFINDEX_INTERNAL) { if (zebra_if->link) diff --git a/zebra/interface.h b/zebra/interface.h index 2791edf2f1..ab1a245e5e 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -29,6 +29,7 @@ #include "zebra/zebra_l2.h" #include "zebra/zebra_nhg_private.h" +#include "zebra/zebra_router.h" #ifdef __cplusplus extern "C" { @@ -284,11 +285,24 @@ struct zebra_es_if_info { struct zebra_evpn_es *es; /* local ES */ }; +enum zebra_if_flags { + /* device has been configured as an uplink for + * EVPN multihoming + */ + ZIF_FLAG_EVPN_MH_UPLINK = (1 << 0), + ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP = (1 << 1), + + /* Dataplane protodown-on */ + ZIF_FLAG_PROTODOWN = (1 << 2) +}; + /* `zebra' daemon local interface structure. */ struct zebra_if { /* back pointer to the interface */ struct interface *ifp; + enum zebra_if_flags flags; + /* Shutdown configuration. */ uint8_t shutdown; @@ -352,6 +366,7 @@ struct zebra_if { struct zebra_l2info_brslave brslave_info; struct zebra_l2info_bondslave bondslave_info; + struct zebra_l2info_bond bond_info; /* ethernet segment */ struct zebra_es_if_info es_info; @@ -359,6 +374,14 @@ struct zebra_if { /* bitmap of vlans associated with this interface */ bitfield_t vlan_bitmap; + /* An interface can be error-disabled if a protocol (such as EVPN or + * VRRP) detects a problem with keeping it operationally-up. + * If any of the protodown bits are set protodown-on is programmed + * in the dataplane. This results in a carrier/L1 down on the + * physical device. + */ + enum protodown_reasons protodown_rc; + /* Link fields - for sub-interfaces. */ ifindex_t link_ifindex; struct interface *link; @@ -400,6 +423,9 @@ DECLARE_HOOK(zebra_if_config_wr, (struct vty * vty, struct interface *ifp), #define IS_ZEBRA_IF_VETH(ifp) \ (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_VETH) +#define IS_ZEBRA_IF_BOND(ifp) \ + (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_BOND) + #define IS_ZEBRA_IF_BRIDGE_SLAVE(ifp) \ (((struct zebra_if *)(ifp->info))->zif_slave_type \ == ZEBRA_IF_SLAVE_BRIDGE) @@ -463,6 +489,10 @@ extern unsigned int if_nhg_dependents_count(const struct interface *ifp); extern bool if_nhg_dependents_is_empty(const struct interface *ifp); extern void vrf_add_update(struct vrf *vrfp); +extern void zebra_l2_map_slave_to_bond(struct zebra_if *zif, vrf_id_t vrf); +extern void zebra_l2_unmap_slave_from_bond(struct zebra_if *zif); +extern const char *zebra_protodown_rc_str(enum protodown_reasons protodown_rc, + char *pd_buf, uint32_t pd_buf_len); #ifdef HAVE_PROC_NET_DEV extern void ifstat_update_proc(void); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 8fd0c96bd9..9d74aeca28 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -1001,7 +1001,7 @@ static int rtm_read_mesg(struct rt_msghdr *rtm, union sockunion *dest, void rtm_read(struct rt_msghdr *rtm) { int flags; - uint8_t zebra_flags; + uint32_t zebra_flags; union sockunion dest, mask, gate; char ifname[INTERFACE_NAMSIZ + 1]; short ifnlen = 0; diff --git a/zebra/main.c b/zebra/main.c index ced29e1a25..55fd3244cb 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -83,6 +83,8 @@ uint32_t nl_rcvbufsize = 4194304; #endif /* HAVE_NETLINK */ #define OPTION_V6_RR_SEMANTICS 2000 +#define OPTION_ASIC_OFFLOAD 2001 + /* Command line options. */ const struct option longopts[] = { {"batch", no_argument, NULL, 'b'}, @@ -92,6 +94,7 @@ const struct option longopts[] = { {"retain", no_argument, NULL, 'r'}, {"vrfdefaultname", required_argument, NULL, 'o'}, {"graceful_restart", required_argument, NULL, 'K'}, + {"asic-offload", optional_argument, NULL, OPTION_ASIC_OFFLOAD}, #ifdef HAVE_NETLINK {"vrfwnetns", no_argument, NULL, 'n'}, {"nl-bufsize", required_argument, NULL, 's'}, @@ -281,6 +284,8 @@ int main(int argc, char **argv) char *vrf_default_name_configured = NULL; struct sockaddr_storage dummy; socklen_t dummylen; + bool asic_offload = false; + bool notify_on_ack = true; graceful_restart = 0; vrf_configure_backend(VRF_BACKEND_VRF_LITE); @@ -301,6 +306,7 @@ int main(int argc, char **argv) " -r, --retain When program terminates, retain added route by zebra.\n" " -o, --vrfdefaultname Set default VRF name.\n" " -K, --graceful_restart Graceful restart at the kernel level, timer in seconds for expiration\n" + " -A, --asic-offload FRR is interacting with an asic underneath the linux kernel\n" #ifdef HAVE_NETLINK " -n, --vrfwnetns Use NetNS as VRF backend\n" " -s, --nl-bufsize Set netlink receive buffer size\n" @@ -366,6 +372,13 @@ int main(int argc, char **argv) case OPTION_V6_RR_SEMANTICS: v6_rr_semantics = true; break; + case OPTION_ASIC_OFFLOAD: + if (!strcmp(optarg, "notify_on_offload")) + notify_on_ack = false; + if (!strcmp(optarg, "notify_on_ack")) + notify_on_ack = true; + asic_offload = true; + break; #endif /* HAVE_NETLINK */ default: frr_help_exit(1); @@ -376,7 +389,7 @@ int main(int argc, char **argv) zrouter.master = frr_init(); /* Zebra related initialize. */ - zebra_router_init(); + zebra_router_init(asic_offload, notify_on_ack); zserv_init(); rib_init(); zebra_if_init(); diff --git a/zebra/rib.h b/zebra/rib.h index c02156b378..3bce62bfa8 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -366,7 +366,7 @@ extern void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re); * All rib_add function will not just add prefix into RIB, but * also implicitly withdraw equal prefix of same type. */ extern int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - unsigned short instance, int flags, struct prefix *p, + unsigned short instance, uint32_t flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, uint32_t nhe_id, uint32_t table_id, uint32_t metric, uint32_t mtu, uint8_t distance, route_tag_t tag); @@ -382,10 +382,11 @@ extern int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p, struct nhg_hash_entry *nhe); extern void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - unsigned short instance, int flags, struct prefix *p, - struct prefix_ipv6 *src_p, const struct nexthop *nh, - uint32_t nhe_id, uint32_t table_id, uint32_t metric, - uint8_t distance, bool fromkernel, bool connected_down); + unsigned short instance, uint32_t flags, + struct prefix *p, struct prefix_ipv6 *src_p, + const struct nexthop *nh, uint32_t nhe_id, + uint32_t table_id, uint32_t metric, uint8_t distance, + bool fromkernel, bool connected_down); extern struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id, union g_addr *addr, diff --git a/zebra/router-id.c b/zebra/router-id.c index 7e81f29827..7af60a389b 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -331,7 +331,7 @@ DEFUN (ip_router_id_in_vrf, ip_router_id_in_vrf_cmd, "ip router-id A.B.C.D", IP_STR - "Manuall set the router-id\n" + "Manually set the router-id\n" "IP address to use for router-id\n") { ZEBRA_DECLVAR_CONTEXT(vrf, zvrf); @@ -361,7 +361,7 @@ DEFUN (ipv6_router_id_in_vrf, ipv6_router_id_in_vrf_cmd, "ipv6 router-id X:X::X:X", IP6_STR - "Manuall set the IPv6 router-id\n" + "Manually set the IPv6 router-id\n" "IPV6 address to use for router-id\n") { ZEBRA_DECLVAR_CONTEXT(vrf, zvrf); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 19fe7b5180..3402edf467 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -574,7 +574,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, int len; struct rtmsg *rtm; struct rtattr *tb[RTA_MAX + 1]; - uint8_t flags = 0; + uint32_t flags = 0; struct prefix p; struct prefix_ipv6 src_p = {}; vrf_id_t vrf_id; @@ -642,7 +642,9 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, selfroute = is_selfroute(rtm->rtm_protocol); - if (!startup && selfroute && h->nlmsg_type == RTM_NEWROUTE) { + if (!startup && selfroute + && h->nlmsg_type == RTM_NEWROUTE + && !zrouter.asic_offloaded) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug("Route type: %d Received that we think we have originated, ignoring", rtm->rtm_protocol); @@ -672,6 +674,8 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, flags |= ZEBRA_FLAG_TRAPPED; if (rtm->rtm_flags & RTM_F_OFFLOAD) flags |= ZEBRA_FLAG_OFFLOADED; + if (rtm->rtm_flags & RTM_F_OFFLOAD_FAILED) + flags |= ZEBRA_FLAG_OFFLOAD_FAILED; /* Route which inserted by Zebra. */ if (selfroute) { @@ -3179,10 +3183,14 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, update_flags = dplane_ctx_mac_get_update_flags(ctx); if (update_flags & DPLANE_MAC_REMOTE) { flags |= NTF_SELF; - if (dplane_ctx_mac_is_sticky(ctx)) + if (dplane_ctx_mac_is_sticky(ctx)) { + /* NUD_NOARP prevents the entry from expiring */ + state |= NUD_NOARP; + /* sticky the entry from moving */ flags |= NTF_STICKY; - else + } else { flags |= NTF_EXT_LEARNED; + } /* if it was static-local previously we need to clear the * notify flags on replace with remote */ diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 18017c9700..f7c123231e 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -742,7 +742,8 @@ static int nhg_notify(uint16_t type, uint16_t instance, uint32_t id, static int route_notify_internal(const struct prefix *p, int type, uint16_t instance, vrf_id_t vrf_id, uint32_t table_id, - enum zapi_route_notify_owner note) + enum zapi_route_notify_owner note, + afi_t afi, safi_t safi) { struct zserv *client; struct stream *s; @@ -763,7 +764,11 @@ static int route_notify_internal(const struct prefix *p, int type, "Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u", zebra_route_string(type), p, table_id, note, vrf_id); - s = stream_new(ZEBRA_MAX_PACKET_SIZ); + /* We're just allocating a small-ish buffer here, since we only + * encode a small amount of data. + */ + s = stream_new(ZEBRA_SMALL_PACKET_SIZE); + stream_reset(s); zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, vrf_id); @@ -778,16 +783,21 @@ static int route_notify_internal(const struct prefix *p, int type, stream_putl(s, table_id); + /* Encode AFI, SAFI in the message */ + stream_putc(s, afi); + stream_putc(s, safi); + stream_putw_at(s, 0, stream_get_endp(s)); return zserv_send_message(client, s); } int zsend_route_notify_owner(struct route_entry *re, const struct prefix *p, - enum zapi_route_notify_owner note) + enum zapi_route_notify_owner note, + afi_t afi, safi_t safi) { return (route_notify_internal(p, re->type, re->instance, re->vrf_id, - re->table, note)); + re->table, note, afi, safi)); } /* @@ -801,7 +811,19 @@ int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx *ctx, dplane_ctx_get_instance(ctx), dplane_ctx_get_vrf(ctx), dplane_ctx_get_table(ctx), - note)); + note, + dplane_ctx_get_afi(ctx), + dplane_ctx_get_safi(ctx))); +} + +static void zread_route_notify_request(ZAPI_HANDLER_ARGS) +{ + uint8_t notify; + + STREAM_GETC(msg, notify); + client->notify_owner = notify; +stream_failure: + return; } void zsend_rule_notify_owner(const struct zebra_dplane_ctx *ctx, @@ -3275,6 +3297,7 @@ void (*const zserv_handlers[])(ZAPI_HANDLER_ARGS) = { [ZEBRA_NEIGH_DISCOVER] = zread_neigh_discover, [ZEBRA_NHG_ADD] = zread_nhg_add, [ZEBRA_NHG_DEL] = zread_nhg_del, + [ZEBRA_ROUTE_NOTIFY_REQUEST] = zread_route_notify_request, }; /* diff --git a/zebra/zapi_msg.h b/zebra/zapi_msg.h index 9f23a313bf..efc52059b6 100644 --- a/zebra/zapi_msg.h +++ b/zebra/zapi_msg.h @@ -77,7 +77,8 @@ extern int zsend_interface_link_params(struct zserv *zclient, extern int zsend_pw_update(struct zserv *client, struct zebra_pw *pw); extern int zsend_route_notify_owner(struct route_entry *re, const struct prefix *p, - enum zapi_route_notify_owner note); + enum zapi_route_notify_owner note, + afi_t afi, safi_t safi); extern int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx *ctx, enum zapi_route_notify_owner note); diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index d3bcffe960..22cc234b2f 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -40,12 +40,18 @@ /* Memory type for context blocks */ DEFINE_MTYPE_STATIC(ZEBRA, DP_CTX, "Zebra DPlane Ctx") +DEFINE_MTYPE_STATIC(ZEBRA, DP_INTF, "Zebra DPlane Intf") DEFINE_MTYPE_STATIC(ZEBRA, DP_PROV, "Zebra DPlane Provider") #ifndef AOK # define AOK 0 #endif +/* Control for collection of extra interface info with route updates; a plugin + * can enable the extra info via a dplane api. + */ +static bool dplane_collect_extra_intf_info; + /* Enable test dataplane provider */ /*#define DPLANE_TEST_PROVIDER 1 */ @@ -85,6 +91,18 @@ struct dplane_nexthop_info { }; /* + * Optional extra info about interfaces used in route updates' nexthops. + */ +struct dplane_intf_extra { + vrf_id_t vrf_id; + uint32_t ifindex; + uint32_t flags; + uint32_t status; + + TAILQ_ENTRY(dplane_intf_extra) link; +}; + +/* * Route information captured for route updates. */ struct dplane_route_info { @@ -127,8 +145,8 @@ struct dplane_route_info { struct nexthop_group zd_old_ng; struct nexthop_group old_backup_ng; - /* TODO -- use fixed array of nexthops, to avoid mallocs? */ - + /* Optional list of extra interface info */ + TAILQ_HEAD(dp_intf_extra_q, dplane_intf_extra) intf_extra_q; }; /* @@ -507,6 +525,8 @@ void dplane_enable_sys_route_notifs(void) */ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx) { + struct dplane_intf_extra *if_extra, *if_tmp; + /* * Some internal allocations may need to be freed, depending on * the type of info captured in the ctx. @@ -549,6 +569,14 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx) ctx->u.rinfo.old_backup_ng.nexthop = NULL; } + /* Optional extra interface info */ + TAILQ_FOREACH_SAFE(if_extra, &ctx->u.rinfo.intf_extra_q, + link, if_tmp) { + TAILQ_REMOVE(&ctx->u.rinfo.intf_extra_q, if_extra, + link); + XFREE(MTYPE_DP_INTF, if_extra); + } + break; case DPLANE_OP_NH_INSTALL: @@ -1819,6 +1847,45 @@ dplane_ctx_get_br_port_backup_nhg_id(const struct zebra_dplane_ctx *ctx) * End of dplane context accessors */ +/* Optional extra info about interfaces in nexthops - a plugin must enable + * this extra info. + */ +const struct dplane_intf_extra * +dplane_ctx_get_intf_extra(const struct zebra_dplane_ctx *ctx) +{ + return TAILQ_FIRST(&ctx->u.rinfo.intf_extra_q); +} + +const struct dplane_intf_extra * +dplane_ctx_intf_extra_next(const struct zebra_dplane_ctx *ctx, + const struct dplane_intf_extra *ptr) +{ + return TAILQ_NEXT(ptr, link); +} + +vrf_id_t dplane_intf_extra_get_vrfid(const struct dplane_intf_extra *ptr) +{ + return ptr->vrf_id; +} + +uint32_t dplane_intf_extra_get_ifindex(const struct dplane_intf_extra *ptr) +{ + return ptr->ifindex; +} + +uint32_t dplane_intf_extra_get_flags(const struct dplane_intf_extra *ptr) +{ + return ptr->flags; +} + +uint32_t dplane_intf_extra_get_status(const struct dplane_intf_extra *ptr) +{ + return ptr->status; +} + +/* + * End of interface extra info accessors + */ /* * Retrieve the limit on the number of pending, unprocessed updates. @@ -1887,10 +1954,14 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, struct zebra_vrf *zvrf; struct nexthop *nexthop; zebra_l3vni_t *zl3vni; + const struct interface *ifp; + struct dplane_intf_extra *if_extra; if (!ctx || !rn || !re) goto done; + TAILQ_INIT(&ctx->u.rinfo.intf_extra_q); + ctx->zd_op = op; ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; @@ -1952,6 +2023,27 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, nexthop->nh_encap_type = NET_VXLAN; nexthop->nh_encap.vni = zl3vni->vni; } + + /* Optionally capture extra interface info while we're in the + * main zebra pthread - a plugin has to ask for this info. + */ + if (dplane_collect_extra_intf_info) { + ifp = if_lookup_by_index(nexthop->ifindex, + nexthop->vrf_id); + + if (ifp) { + if_extra = XCALLOC( + MTYPE_DP_INTF, + sizeof(struct dplane_intf_extra)); + if_extra->vrf_id = nexthop->vrf_id; + if_extra->ifindex = nexthop->ifindex; + if_extra->flags = ifp->flags; + if_extra->status = ifp->status; + + TAILQ_INSERT_TAIL(&ctx->u.rinfo.intf_extra_q, + if_extra, link); + } + } } /* Don't need some info when capturing a system notification */ @@ -4244,6 +4336,14 @@ bool dplane_is_in_shutdown(void) } /* + * Enable collection of extra info about interfaces in route updates. + */ +void dplane_enable_intf_extra_info(void) +{ + dplane_collect_extra_intf_info = true; +} + +/* * Early or pre-shutdown, de-init notification api. This runs pretty * early during zebra shutdown, as a signal to stop new work and prepare * for updates generated by shutdown/cleanup activity, as zebra tries to diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index b37bf665ae..1b2ea9d96b 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -204,6 +204,9 @@ void dplane_enable_sys_route_notifs(void); */ TAILQ_HEAD(dplane_ctx_q, zebra_dplane_ctx); +/* Declare a type for (optional) extended interface info objects. */ +TAILQ_HEAD(dplane_intf_extra_q, dplane_intf_extra); + /* Allocate a context object */ struct zebra_dplane_ctx *dplane_ctx_alloc(void); @@ -313,6 +316,21 @@ const struct nexthop_group *dplane_ctx_get_ng( const struct nexthop_group *dplane_ctx_get_old_ng( const struct zebra_dplane_ctx *ctx); +/* Optional extra info about interfaces in nexthops - a plugin must enable + * this extra info. + */ +const struct dplane_intf_extra * +dplane_ctx_get_intf_extra(const struct zebra_dplane_ctx *ctx); + +const struct dplane_intf_extra * +dplane_ctx_intf_extra_next(const struct zebra_dplane_ctx *ctx, + const struct dplane_intf_extra *ptr); + +vrf_id_t dplane_intf_extra_get_vrfid(const struct dplane_intf_extra *ptr); +uint32_t dplane_intf_extra_get_ifindex(const struct dplane_intf_extra *ptr); +uint32_t dplane_intf_extra_get_flags(const struct dplane_intf_extra *ptr); +uint32_t dplane_intf_extra_get_status(const struct dplane_intf_extra *ptr); + /* Backup nexthop information (list of nexthops) if present. */ const struct nexthop_group * dplane_ctx_get_backup_ng(const struct zebra_dplane_ctx *ctx); @@ -743,6 +761,12 @@ void dplane_provider_enqueue_out_ctx(struct zebra_dplane_provider *prov, /* Enqueue a context directly to zebra main. */ void dplane_provider_enqueue_to_zebra(struct zebra_dplane_ctx *ctx); +/* Enable collection of extra info about interfaces in route updates; + * this allows a provider/plugin to see some extra info in route update + * context objects. + */ +void dplane_enable_intf_extra_info(void); + /* * Initialize the dataplane modules at zebra startup. This is currently called * by the rib module. Zebra registers a results callback with the dataplane. diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 7a383ef8c2..b08adc5541 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -38,6 +38,7 @@ #include "zebra/rib.h" #include "zebra/rt.h" #include "zebra/rt_netlink.h" +#include "zebra/if_netlink.h" #include "zebra/zebra_errors.h" #include "zebra/zebra_l2.h" #include "zebra/zebra_memory.h" @@ -65,6 +66,9 @@ static int zebra_evpn_local_es_update(struct zebra_if *zif, uint32_t lid, struct ethaddr *sysmac); static bool zebra_evpn_es_br_port_dplane_update(struct zebra_evpn_es *es, const char *caller); +static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set); +static void zebra_evpn_mh_update_protodown_es(struct zebra_evpn_es *es); +static void zebra_evpn_mh_clear_protodown_es(struct zebra_evpn_es *es); esi_t zero_esi_buf, *zero_esi = &zero_esi_buf; @@ -1020,8 +1024,8 @@ static void zebra_evpn_nhg_update(struct zebra_evpn_es *es) nh_ids[i].id); strlcat(nh_str, nh_buf, sizeof(nh_str)); } - zlog_debug("es %s nhg 0x%x add %s", - es->esi_str, es->nhg_id, nh_str); + zlog_debug("es %s nhg %u add %s", es->esi_str, + es->nhg_id, nh_str); } es->flags |= ZEBRA_EVPNES_NHG_ACTIVE; @@ -1036,8 +1040,8 @@ static void zebra_evpn_nhg_update(struct zebra_evpn_es *es) } else { if (es->flags & ZEBRA_EVPNES_NHG_ACTIVE) { if (IS_ZEBRA_DEBUG_EVPN_MH_NH) - zlog_debug("es %s nhg 0x%x del", - es->esi_str, es->nhg_id); + zlog_debug("es %s nhg %u del", es->esi_str, + es->nhg_id); es->flags &= ~ZEBRA_EVPNES_NHG_ACTIVE; /* remove backup NHG from the br-port */ if ((es->flags & ZEBRA_EVPNES_LOCAL)) @@ -1061,9 +1065,8 @@ static void zebra_evpn_nh_add(struct zebra_evpn_es_vtep *es_vtep) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NH) - zlog_debug("es %s vtep %pI4 nh 0x%x add", - es_vtep->es->esi_str, - &es_vtep->vtep_ip, es_vtep->nh_id); + zlog_debug("es %s vtep %pI4 nh %u add", es_vtep->es->esi_str, + &es_vtep->vtep_ip, es_vtep->nh_id); /* install the NH */ kernel_upd_mac_nh(es_vtep->nh_id, es_vtep->vtep_ip); /* add the NH to the parent NHG */ @@ -1078,9 +1081,8 @@ static void zebra_evpn_nh_del(struct zebra_evpn_es_vtep *es_vtep) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NH) - zlog_debug("es %s vtep %pI4 nh 0x%x del", - es_vtep->es->esi_str, - &es_vtep->vtep_ip, es_vtep->nh_id); + zlog_debug("es %s vtep %pI4 nh %u del", es_vtep->es->esi_str, + &es_vtep->vtep_ip, es_vtep->nh_id); nh_id = es_vtep->nh_id; es_vtep->nh_id = 0; @@ -1423,7 +1425,7 @@ static struct zebra_evpn_es *zebra_evpn_es_new(esi_t *esi) es->nhg_id = zebra_evpn_nhid_alloc(true); if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("es %s nhg 0x%x new", es->esi_str, es->nhg_id); + zlog_debug("es %s nhg %u new", es->esi_str, es->nhg_id); return es; } @@ -1663,8 +1665,8 @@ static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es, return; if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("local es %s add; nhg 0x%x if %s", - es->esi_str, es->nhg_id, zif->ifp->name); + zlog_debug("local es %s add; nhg %u if %s", es->esi_str, + es->nhg_id, zif->ifp->name); es->flags |= ZEBRA_EVPNES_LOCAL; listnode_init(&es->local_es_listnode, es); @@ -1713,6 +1715,9 @@ static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es, */ zebra_evpn_es_local_mac_update(es, false /* force_clear_static */); + + /* inherit EVPN protodown flags on the access port */ + zebra_evpn_mh_update_protodown_es(es); } static void zebra_evpn_es_local_info_clear(struct zebra_evpn_es **esp) @@ -1729,6 +1734,9 @@ static void zebra_evpn_es_local_info_clear(struct zebra_evpn_es **esp) /* remove the DF filter */ dplane_updated = zebra_evpn_es_run_df_election(es, __func__); + /* clear EVPN protodown flags on the access port */ + zebra_evpn_mh_clear_protodown_es(es); + /* if there any local macs referring to the ES as dest we * need to clear the static reference on them */ @@ -1768,9 +1776,8 @@ static void zebra_evpn_local_es_del(struct zebra_evpn_es **esp) if (IS_ZEBRA_DEBUG_EVPN_MH_ES) { zif = es->zif; - zlog_debug("local es %s del; nhg 0x%x if %s", - es->esi_str, es->nhg_id, - zif ? zif->ifp->name : "-"); + zlog_debug("local es %s del; nhg %u if %s", es->esi_str, + es->nhg_id, zif ? zif->ifp->name : "-"); } /* remove all ES-EVIs associated with the ES */ @@ -1794,15 +1801,15 @@ static void zebra_evpn_es_remote_info_re_eval(struct zebra_evpn_es **esp) if (!(es->flags & ZEBRA_EVPNES_REMOTE)) { es->flags |= ZEBRA_EVPNES_REMOTE; if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("remote es %s add; nhg 0x%x", - es->esi_str, es->nhg_id); + zlog_debug("remote es %s add; nhg %u", + es->esi_str, es->nhg_id); } } else { if (es->flags & ZEBRA_EVPNES_REMOTE) { es->flags &= ~ZEBRA_EVPNES_REMOTE; if (IS_ZEBRA_DEBUG_EVPN_MH_ES) - zlog_debug("remote es %s del; nhg 0x%x", - es->esi_str, es->nhg_id); + zlog_debug("remote es %s del; nhg %u", + es->esi_str, es->nhg_id); zebra_evpn_es_free(esp); } } @@ -2144,12 +2151,34 @@ bool zebra_evpn_is_if_es_capable(struct zebra_if *zif) void zebra_evpn_if_es_print(struct vty *vty, struct zebra_if *zif) { char buf[ETHER_ADDR_STRLEN]; + char mh_buf[80]; + bool vty_print = false; + + mh_buf[0] = '\0'; + snprintf(mh_buf + strlen(mh_buf), sizeof(mh_buf) - strlen(mh_buf), + " EVPN-MH:"); + if (zif->es_info.lid || !is_zero_mac(&zif->es_info.sysmac)) { + vty_print = true; + snprintf( + mh_buf + strlen(mh_buf), + sizeof(mh_buf) - strlen(mh_buf), + " ES id %u ES sysmac %s", zif->es_info.lid, + prefix_mac2str(&zif->es_info.sysmac, buf, sizeof(buf))); + } + + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) { + vty_print = true; + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP) + snprintf(mh_buf + strlen(mh_buf), + sizeof(mh_buf) - strlen(mh_buf), " uplink-up"); + else + snprintf(mh_buf + strlen(mh_buf), + sizeof(mh_buf) - strlen(mh_buf), + " uplink-down"); + } - if (zif->es_info.lid || !is_zero_mac(&zif->es_info.sysmac)) - vty_out(vty, " EVPN MH: ES id %u ES sysmac %s\n", - zif->es_info.lid, - prefix_mac2str(&zif->es_info.sysmac, - buf, sizeof(buf))); + if (vty_print) + vty_out(vty, "%s\n", mh_buf); } void zebra_evpn_es_if_oper_state_change(struct zebra_if *zif, bool up) @@ -2366,7 +2395,7 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty, vty_out(vty, " DF: status: %s preference: %u\n", (es->flags & ZEBRA_EVPNES_NON_DF) ? "non-df" : "df", es->df_pref); - vty_out(vty, " Nexthop group: 0x%x\n", es->nhg_id); + vty_out(vty, " Nexthop group: %u\n", es->nhg_id); vty_out(vty, " VTEPs:\n"); for (ALL_LIST_ELEMENTS_RO(es->es_vtep_list, node, es_vtep)) { vty_out(vty, " %pI4", @@ -2377,7 +2406,7 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty, alg_buf, sizeof(alg_buf)), es_vtep->df_pref); - vty_out(vty, " nh: 0x%x\n", es_vtep->nh_id); + vty_out(vty, " nh: %u\n", es_vtep->nh_id); } vty_out(vty, "\n"); @@ -2478,6 +2507,9 @@ int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp) if (zif->es_info.df_pref) vty_out(vty, " evpn mh es-df-pref %u\n", zif->es_info.df_pref); + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) + vty_out(vty, " evpn mh uplink\n"); + return 0; } @@ -2600,6 +2632,70 @@ DEFPY(zebra_evpn_es_id, return CMD_SUCCESS; } +/* CLI for tagging an interface as an uplink */ +DEFPY(zebra_evpn_mh_uplink, zebra_evpn_mh_uplink_cmd, "[no] evpn mh uplink", + NO_STR "EVPN\n" EVPN_MH_VTY_STR "uplink to the VxLAN core\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + struct zebra_if *zif; + + zif = ifp->info; + zebra_evpn_mh_uplink_cfg_update(zif, no ? false : true); + + return CMD_SUCCESS; +} + +void zebra_evpn_mh_json(json_object *json) +{ + json_object *json_array; + char thread_buf[THREAD_TIMER_STRLEN]; + + json_object_int_add(json, "macHoldtime", zmh_info->mac_hold_time); + json_object_int_add(json, "neighHoldtime", zmh_info->neigh_hold_time); + json_object_int_add(json, "startupDelay", zmh_info->startup_delay_time); + json_object_string_add( + json, "startupDelayTimer", + thread_timer_to_hhmmss(thread_buf, sizeof(thread_buf), + zmh_info->startup_delay_timer)); + json_object_int_add(json, "uplinkConfigCount", + zmh_info->uplink_cfg_cnt); + json_object_int_add(json, "uplinkActiveCount", + zmh_info->uplink_oper_up_cnt); + + if (zmh_info->protodown_rc) { + json_array = json_object_new_array(); + if (zmh_info->protodown_rc & ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) + json_object_array_add( + json_array, + json_object_new_string("startupDelay")); + if (zmh_info->protodown_rc & ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN) + json_object_array_add( + json_array, + json_object_new_string("uplinkDown")); + json_object_object_add(json, "protodownReasons", json_array); + } +} + +void zebra_evpn_mh_print(struct vty *vty) +{ + char pd_buf[ZEBRA_PROTODOWN_RC_STR_LEN]; + char thread_buf[THREAD_TIMER_STRLEN]; + + vty_out(vty, "EVPN MH:\n"); + vty_out(vty, " mac-holdtime: %ds, neigh-holdtime: %ds\n", + zmh_info->mac_hold_time, zmh_info->neigh_hold_time); + vty_out(vty, " startup-delay: %ds, start-delay-timer: %s\n", + zmh_info->startup_delay_time, + thread_timer_to_hhmmss(thread_buf, sizeof(thread_buf), + zmh_info->startup_delay_timer)); + vty_out(vty, " uplink-cfg-cnt: %u, uplink-active-cnt: %u\n", + zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); + if (zmh_info->protodown_rc) + vty_out(vty, " protodown: %s\n", + zebra_protodown_rc_str(zmh_info->protodown_rc, pd_buf, + sizeof(pd_buf))); +} + /*****************************************************************************/ /* A base L2-VNI is maintained to derive parameters such as ES originator-IP. * XXX: once single vxlan device model becomes available this will not be @@ -2705,23 +2801,316 @@ static void zebra_evpn_es_get_one_base_evpn(void) hash_walk(zvrf->evpn_table, zebra_evpn_es_get_one_base_evpn_cb, NULL); } +/***************************************************************************** + * local ethernet segments can be error-disabled if the switch is not + * ready to start transmitting traffic via the VxLAN overlay + */ +bool zebra_evpn_is_es_bond(struct interface *ifp) +{ + struct zebra_if *zif = ifp->info; + + return !!(struct zebra_if *)zif->es_info.es; +} + +bool zebra_evpn_is_es_bond_member(struct interface *ifp) +{ + struct zebra_if *zif = ifp->info; + + return IS_ZEBRA_IF_BOND_SLAVE(zif->ifp) && zif->bondslave_info.bond_if + && ((struct zebra_if *)zif->bondslave_info.bond_if->info) + ->es_info.es; +} + +void zebra_evpn_mh_update_protodown_bond_mbr(struct zebra_if *zif, bool clear, + const char *caller) +{ + bool old_protodown; + bool new_protodown; + enum protodown_reasons old_protodown_rc = 0; + enum protodown_reasons protodown_rc = 0; + + if (!clear) { + struct zebra_if *bond_zif; + + bond_zif = zif->bondslave_info.bond_if->info; + protodown_rc = bond_zif->protodown_rc; + } + + if (zif->protodown_rc == protodown_rc) + return; + + old_protodown = !!(zif->flags & ZIF_FLAG_PROTODOWN); + old_protodown_rc = zif->protodown_rc; + zif->protodown_rc &= ~ZEBRA_PROTODOWN_EVPN_ALL; + zif->protodown_rc |= (protodown_rc & ZEBRA_PROTODOWN_EVPN_ALL); + new_protodown = !!zif->protodown_rc; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug( + "%s bond mbr %s protodown_rc changed; old 0x%x new 0x%x", + caller, zif->ifp->name, old_protodown_rc, + zif->protodown_rc); + + if (old_protodown == new_protodown) + return; + + if (new_protodown) + zif->flags |= ZIF_FLAG_PROTODOWN; + else + zif->flags &= ~ZIF_FLAG_PROTODOWN; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug("%s protodown %s", zif->ifp->name, + new_protodown ? "on" : "off"); + + zebra_if_set_protodown(zif->ifp, new_protodown); +} + +/* The bond members inherit the protodown reason code from the bond */ +static void zebra_evpn_mh_update_protodown_bond(struct zebra_if *bond_zif) +{ + struct zebra_if *zif; + struct listnode *node; + + if (!bond_zif->bond_info.mbr_zifs) + return; + + for (ALL_LIST_ELEMENTS_RO(bond_zif->bond_info.mbr_zifs, node, zif)) { + zebra_evpn_mh_update_protodown_bond_mbr(zif, false /*clear*/, + __func__); + } +} + +/* The global EVPN MH protodown rc is applied to all local ESs */ +static void zebra_evpn_mh_update_protodown_es(struct zebra_evpn_es *es) +{ + struct zebra_if *zif; + enum protodown_reasons old_protodown_rc; + + zif = es->zif; + if ((zif->protodown_rc & ZEBRA_PROTODOWN_EVPN_ALL) + == (zmh_info->protodown_rc & ZEBRA_PROTODOWN_EVPN_ALL)) + return; + + old_protodown_rc = zif->protodown_rc; + zif->protodown_rc &= ~ZEBRA_PROTODOWN_EVPN_ALL; + zif->protodown_rc |= + (zmh_info->protodown_rc & ZEBRA_PROTODOWN_EVPN_ALL); + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug( + "es %s ifp %s protodown_rc changed; old 0x%x new 0x%x", + es->esi_str, zif->ifp->name, old_protodown_rc, + zif->protodown_rc); + + /* update dataplane with the new protodown setting */ + zebra_evpn_mh_update_protodown_bond(zif); +} + +static void zebra_evpn_mh_clear_protodown_es(struct zebra_evpn_es *es) +{ + struct zebra_if *zif; + enum protodown_reasons old_protodown_rc; + + zif = es->zif; + if (!(zif->protodown_rc & ZEBRA_PROTODOWN_EVPN_ALL)) + return; + + old_protodown_rc = zif->protodown_rc; + zif->protodown_rc &= ~ZEBRA_PROTODOWN_EVPN_ALL; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug( + "clear: es %s ifp %s protodown_rc cleared; old 0x%x new 0x%x", + es->esi_str, zif->ifp->name, old_protodown_rc, + zif->protodown_rc); + + /* update dataplane with the new protodown setting */ + zebra_evpn_mh_update_protodown_bond(zif); +} + +static void zebra_evpn_mh_update_protodown_es_all(void) +{ + struct listnode *node; + struct zebra_evpn_es *es; + + for (ALL_LIST_ELEMENTS_RO(zmh_info->local_es_list, node, es)) + zebra_evpn_mh_update_protodown_es(es); +} + +static void zebra_evpn_mh_update_protodown(enum protodown_reasons protodown_rc, + bool set) +{ + enum protodown_reasons old_protodown_rc = zmh_info->protodown_rc; + + if (set) { + if ((protodown_rc & zmh_info->protodown_rc) == protodown_rc) + return; + + zmh_info->protodown_rc |= protodown_rc; + } else { + if (!(protodown_rc & zmh_info->protodown_rc)) + return; + zmh_info->protodown_rc &= ~protodown_rc; + } + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug("mh protodown_rc changed; old 0x%x new 0x%x", + old_protodown_rc, zmh_info->protodown_rc); + zebra_evpn_mh_update_protodown_es_all(); +} + +static inline bool zebra_evpn_mh_is_all_uplinks_down(void) +{ + return zmh_info->uplink_cfg_cnt && !zmh_info->uplink_oper_up_cnt; +} + +static void zebra_evpn_mh_uplink_oper_flags_update(struct zebra_if *zif, + bool set) +{ + if (set) { + if (if_is_operative(zif->ifp)) { + if (!(zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP)) { + zif->flags |= ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP; + ++zmh_info->uplink_oper_up_cnt; + } + } else { + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP) { + zif->flags &= ~ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP; + if (zmh_info->uplink_oper_up_cnt) + --zmh_info->uplink_oper_up_cnt; + } + } + } else { + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP) { + zif->flags &= ~ZIF_FLAG_EVPN_MH_UPLINK_OPER_UP; + if (zmh_info->uplink_oper_up_cnt) + --zmh_info->uplink_oper_up_cnt; + } + } +} + +static void zebra_evpn_mh_uplink_cfg_update(struct zebra_if *zif, bool set) +{ + bool old_protodown = zebra_evpn_mh_is_all_uplinks_down(); + bool new_protodown; + + if (set) { + if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) + return; + + zif->flags |= ZIF_FLAG_EVPN_MH_UPLINK; + ++zmh_info->uplink_cfg_cnt; + } else { + if (!(zif->flags & ZIF_FLAG_EVPN_MH_UPLINK)) + return; + + zif->flags &= ~ZIF_FLAG_EVPN_MH_UPLINK; + if (zmh_info->uplink_cfg_cnt) + --zmh_info->uplink_cfg_cnt; + } + + zebra_evpn_mh_uplink_oper_flags_update(zif, set); + new_protodown = zebra_evpn_mh_is_all_uplinks_down(); + if (old_protodown == new_protodown) + return; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug( + "mh-uplink-cfg-chg on if %s/%d %s uplinks cfg %u up %u", + zif->ifp->name, zif->ifp->ifindex, set ? "set" : "down", + zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); + + zebra_evpn_mh_update_protodown(ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN, + new_protodown); +} + +void zebra_evpn_mh_uplink_oper_update(struct zebra_if *zif) +{ + bool old_protodown = zebra_evpn_mh_is_all_uplinks_down(); + bool new_protodown; + + zebra_evpn_mh_uplink_oper_flags_update(zif, true /*set*/); + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug( + "mh-uplink-oper-chg on if %s/%d %s; uplinks cfg %u up %u", + zif->ifp->name, zif->ifp->ifindex, + if_is_operative(zif->ifp) ? "up" : "down", + zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); + + new_protodown = zebra_evpn_mh_is_all_uplinks_down(); + if (old_protodown == new_protodown) + return; + + zebra_evpn_mh_update_protodown(ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN, + new_protodown); +} + +static int zebra_evpn_mh_startup_delay_exp_cb(struct thread *t) +{ + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug("startup-delay expired"); + + zebra_evpn_mh_update_protodown(ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY, + false /* set */); + + return 0; +} + +static void zebra_evpn_mh_startup_delay_timer_start(bool init) +{ + /* 1. This timer can be started during init. + * 2. It can also be restarted if it is alreay running and the + * admin wants to increase or decrease its value + */ + if (!init && !zmh_info->startup_delay_timer) + return; + + if (zmh_info->startup_delay_timer) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug("startup-delay timer cancelled"); + thread_cancel(&zmh_info->startup_delay_timer); + zmh_info->startup_delay_timer = NULL; + } + + if (zmh_info->startup_delay_time) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES) + zlog_debug("startup-delay timer started for %d sec", + zmh_info->startup_delay_time); + thread_add_timer(zrouter.master, + zebra_evpn_mh_startup_delay_exp_cb, NULL, + zmh_info->startup_delay_time, + &zmh_info->startup_delay_timer); + zebra_evpn_mh_update_protodown( + ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY, true /* set */); + } else { + zebra_evpn_mh_update_protodown( + ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY, false /* set */); + } +} + /*****************************************************************************/ void zebra_evpn_mh_config_write(struct vty *vty) { - if (zmh_info->mac_hold_time != EVPN_MH_MAC_HOLD_TIME_DEF) - vty_out(vty, "evpn mh mac-holdtime %ld\n", + if (zmh_info->mac_hold_time != ZEBRA_EVPN_MH_MAC_HOLD_TIME_DEF) + vty_out(vty, "evpn mh mac-holdtime %d\n", zmh_info->mac_hold_time); - if (zmh_info->neigh_hold_time != EVPN_MH_NEIGH_HOLD_TIME_DEF) - vty_out(vty, "evpn mh neigh-holdtime %ld\n", + if (zmh_info->neigh_hold_time != ZEBRA_EVPN_MH_NEIGH_HOLD_TIME_DEF) + vty_out(vty, "evpn mh neigh-holdtime %d\n", zmh_info->neigh_hold_time); + + if (zmh_info->startup_delay_time != ZEBRA_EVPN_MH_STARTUP_DELAY_DEF) + vty_out(vty, "evpn mh startup-delay %d\n", + zmh_info->startup_delay_time); } int zebra_evpn_mh_neigh_holdtime_update(struct vty *vty, uint32_t duration, bool set_default) { if (set_default) - duration = EVPN_MH_NEIGH_HOLD_TIME_DEF; + duration = ZEBRA_EVPN_MH_NEIGH_HOLD_TIME_DEF; zmh_info->neigh_hold_time = duration; @@ -2732,26 +3121,39 @@ int zebra_evpn_mh_mac_holdtime_update(struct vty *vty, uint32_t duration, bool set_default) { if (set_default) - duration = EVPN_MH_MAC_HOLD_TIME_DEF; + duration = ZEBRA_EVPN_MH_MAC_HOLD_TIME_DEF; zmh_info->mac_hold_time = duration; return 0; } +int zebra_evpn_mh_startup_delay_update(struct vty *vty, uint32_t duration, + bool set_default) +{ + if (set_default) + duration = ZEBRA_EVPN_MH_STARTUP_DELAY_DEF; + + zmh_info->startup_delay_time = duration; + zebra_evpn_mh_startup_delay_timer_start(false /* init */); + + return 0; +} + void zebra_evpn_interface_init(void) { install_element(INTERFACE_NODE, &zebra_evpn_es_id_cmd); install_element(INTERFACE_NODE, &zebra_evpn_es_sys_mac_cmd); install_element(INTERFACE_NODE, &zebra_evpn_es_pref_cmd); + install_element(INTERFACE_NODE, &zebra_evpn_mh_uplink_cmd); } void zebra_evpn_mh_init(void) { zrouter.mh_info = XCALLOC(MTYPE_ZMH_INFO, sizeof(*zrouter.mh_info)); - zmh_info->mac_hold_time = EVPN_MH_MAC_HOLD_TIME_DEF; - zmh_info->neigh_hold_time = EVPN_MH_NEIGH_HOLD_TIME_DEF; + zmh_info->mac_hold_time = ZEBRA_EVPN_MH_MAC_HOLD_TIME_DEF; + zmh_info->neigh_hold_time = ZEBRA_EVPN_MH_NEIGH_HOLD_TIME_DEF; /* setup ES tables */ RB_INIT(zebra_es_rb_head, &zmh_info->es_rb_tree); zmh_info->local_es_list = list_new(); @@ -2763,6 +3165,9 @@ void zebra_evpn_mh_init(void) /* setup broadcast domain tables */ zmh_info->evpn_vlan_table = hash_create(zebra_evpn_acc_vl_hash_keymake, zebra_evpn_acc_vl_cmp, "access VLAN hash table"); + + zmh_info->startup_delay_time = ZEBRA_EVPN_MH_STARTUP_DELAY_DEF; + zebra_evpn_mh_startup_delay_timer_start(true /*init*/); } void zebra_evpn_mh_terminate(void) diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h index ee162ad486..09af26a3a3 100644 --- a/zebra/zebra_evpn_mh.h +++ b/zebra/zebra_evpn_mh.h @@ -195,10 +195,25 @@ struct zebra_evpn_mh_info { #define EVPN_NHG_ID_TYPE_BIT (2 << EVPN_NH_ID_TYPE_POS) /* XXX - re-visit the default hold timer value */ -#define EVPN_MH_MAC_HOLD_TIME_DEF (18 * 60) - long mac_hold_time; -#define EVPN_MH_NEIGH_HOLD_TIME_DEF (18 * 60) - long neigh_hold_time; + int mac_hold_time; +#define ZEBRA_EVPN_MH_MAC_HOLD_TIME_DEF (18 * 60) + int neigh_hold_time; +#define ZEBRA_EVPN_MH_NEIGH_HOLD_TIME_DEF (18 * 60) + + /* During this period access ports will be held in a protodown + * state + */ + int startup_delay_time; /* seconds */ +#define ZEBRA_EVPN_MH_STARTUP_DELAY_DEF (3 * 60) + struct thread *startup_delay_timer; + + /* Number of configured uplinks */ + uint32_t uplink_cfg_cnt; + /* Number of operationally-up uplinks */ + uint32_t uplink_oper_up_cnt; + + /* These protodown bits are inherited by all ES bonds */ + enum protodown_reasons protodown_rc; }; static inline bool zebra_evpn_mac_is_es_local(zebra_mac_t *mac) @@ -258,5 +273,16 @@ void zebra_evpn_mh_config_write(struct vty *vty); int zebra_evpn_mh_neigh_holdtime_update(struct vty *vty, uint32_t duration, bool set_default); void zebra_evpn_es_local_br_port_update(struct zebra_if *zif); +extern int zebra_evpn_mh_startup_delay_update(struct vty *vty, + uint32_t duration, + bool set_default); +extern void zebra_evpn_mh_uplink_oper_update(struct zebra_if *zif); +extern void zebra_evpn_mh_update_protodown_bond_mbr(struct zebra_if *zif, + bool clear, + const char *caller); +extern bool zebra_evpn_is_es_bond(struct interface *ifp); +extern bool zebra_evpn_is_es_bond_member(struct interface *ifp); +extern void zebra_evpn_mh_print(struct vty *vty); +extern void zebra_evpn_mh_json(json_object *json); #endif /* _ZEBRA_EVPN_MH_H */ diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c index 19d8bfd733..c1ad91c8ca 100644 --- a/zebra/zebra_l2.c +++ b/zebra/zebra_l2.c @@ -41,6 +41,7 @@ #include "zebra/zebra_memory.h" #include "zebra/zebra_vrf.h" #include "zebra/rt_netlink.h" +#include "zebra/interface.h" #include "zebra/zebra_l2.h" #include "zebra/zebra_vxlan.h" #include "zebra/zebra_evpn_mh.h" @@ -109,24 +110,99 @@ void zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave) br_slave->br_if = NULL; } -void zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave, - vrf_id_t vrf_id) +void zebra_l2_map_slave_to_bond(struct zebra_if *zif, vrf_id_t vrf_id) { struct interface *bond_if; + struct zebra_if *bond_zif; + struct zebra_l2info_bondslave *bond_slave = &zif->bondslave_info; - /* TODO: Handle change of master */ bond_if = if_lookup_by_index_all_vrf(bond_slave->bond_ifindex); - if (bond_if) - bond_slave->bond_if = bond_if; - else - bond_slave->bond_if = if_create_ifindex(bond_slave->bond_ifindex, - vrf_id); + if (bond_if == bond_slave->bond_if) + return; + + /* unlink the slave from the old master */ + zebra_l2_unmap_slave_from_bond(zif); + + /* If the bond is present and ready link the bond-member + * to it + */ + if (bond_if && (bond_zif = bond_if->info)) { + if (bond_zif->bond_info.mbr_zifs) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond mbr %s linked to %s", + zif->ifp->name, bond_if->name); + bond_slave->bond_if = bond_if; + /* link the slave to the new bond master */ + listnode_add(bond_zif->bond_info.mbr_zifs, zif); + /* inherit protodown flags from the es-bond */ + if (zebra_evpn_is_es_bond(bond_if)) + zebra_evpn_mh_update_protodown_bond_mbr( + zif, false /*clear*/, __func__); + } + } else { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond mbr %s link to bond skipped", + zif->ifp->name); + } +} + +void zebra_l2_unmap_slave_from_bond(struct zebra_if *zif) +{ + struct zebra_l2info_bondslave *bond_slave = &zif->bondslave_info; + struct zebra_if *bond_zif; + + if (!bond_slave->bond_if) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond mbr %s unlink from bond skipped", + zif->ifp->name); + return; + } + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond mbr %s un-linked from %s", zif->ifp->name, + bond_slave->bond_if->name); + + /* unlink the slave from the bond master */ + bond_zif = bond_slave->bond_if->info; + /* clear protodown flags */ + if (zebra_evpn_is_es_bond(bond_zif->ifp)) + zebra_evpn_mh_update_protodown_bond_mbr(zif, true /*clear*/, + __func__); + listnode_delete(bond_zif->bond_info.mbr_zifs, zif); + bond_slave->bond_if = NULL; } -void zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave) +void zebra_l2if_update_bond(struct interface *ifp, bool add) { - if (bond_slave != NULL) - bond_slave->bond_if = NULL; + struct zebra_if *zif; + struct zebra_l2info_bond *bond; + + zif = ifp->info; + assert(zif); + bond = &zif->bond_info; + + if (add) { + if (!bond->mbr_zifs) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond %s mbr list create", + ifp->name); + bond->mbr_zifs = list_new(); + } + } else { + struct listnode *node; + struct listnode *nnode; + struct zebra_if *bond_mbr; + + if (!bond->mbr_zifs) + return; + + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_EVENT) + zlog_debug("bond %s mbr list delete", ifp->name); + for (ALL_LIST_ELEMENTS(bond->mbr_zifs, node, nnode, bond_mbr)) + zebra_l2_unmap_slave_from_bond(bond_mbr); + + list_delete(&bond->mbr_zifs); + } } /* @@ -318,9 +394,9 @@ void zebra_l2if_update_bond_slave(struct interface *ifp, ifindex_t bond_ifindex) /* Set up or remove link with master */ if (bond_ifindex != IFINDEX_INTERNAL) - zebra_l2_map_slave_to_bond(&zif->bondslave_info, ifp->vrf_id); + zebra_l2_map_slave_to_bond(zif, ifp->vrf_id); else if (old_bond_ifindex != IFINDEX_INTERNAL) - zebra_l2_unmap_slave_from_bond(&zif->bondslave_info); + zebra_l2_unmap_slave_from_bond(zif); } void zebra_vlan_bitmap_compute(struct interface *ifp, diff --git a/zebra/zebra_l2.h b/zebra/zebra_l2.h index f3b15c7770..4b84eb071e 100644 --- a/zebra/zebra_l2.h +++ b/zebra/zebra_l2.h @@ -40,6 +40,10 @@ struct zebra_l2info_brslave { ns_id_t ns_id; /* network namespace where bridge is */ }; +struct zebra_l2info_bond { + struct list *mbr_zifs; /* slaves using this bond as a master */ +}; + /* zebra L2 interface information - bridge interface */ struct zebra_l2info_bridge { uint8_t vlan_aware; /* VLAN-aware bridge? */ @@ -86,10 +90,6 @@ extern void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave, struct zebra_ns *zns); extern void zebra_l2_unmap_slave_from_bridge(struct zebra_l2info_brslave *br_slave); -extern void -zebra_l2_map_slave_to_bond(struct zebra_l2info_bondslave *bond_slave, vrf_id_t); -extern void -zebra_l2_unmap_slave_from_bond(struct zebra_l2info_bondslave *bond_slave); extern void zebra_l2_bridge_add_update(struct interface *ifp, struct zebra_l2info_bridge *bridge_info, int add); @@ -112,6 +112,7 @@ extern void zebra_vlan_bitmap_compute(struct interface *ifp, uint32_t vid_start, uint16_t vid_end); extern void zebra_vlan_mbr_re_eval(struct interface *ifp, bitfield_t vlan_bitmap); +extern void zebra_l2if_update_bond(struct interface *ifp, bool add); #ifdef __cplusplus } diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index f5a85519bb..ea2e20ed3b 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -1550,12 +1550,14 @@ int lib_route_map_entry_set_action_source_v4_modify( if (pif != NULL) break; } - if (pif == NULL) { - snprintf(args->errmsg, args->errmsg_len, - "is not a local adddress: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } + /* + * On startup the local address *may* not have come up + * yet. We need to allow startup configuration of + * set src or we are fudged. Log it for future fun + */ + if (pif == NULL) + zlog_warn("set src %pI4 is not a local address", + &p.u.prefix4); return NB_OK; case NB_EV_PREPARE: case NB_EV_ABORT: @@ -1618,12 +1620,14 @@ int lib_route_map_entry_set_action_source_v6_modify( if (pif != NULL) break; } - if (pif == NULL) { - snprintf(args->errmsg, args->errmsg_len, - "is not a local adddress: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } + /* + * On startup the local address *may* not have come up + * yet. We need to allow startup configuration of + * set src or we are fudged. Log it for future fun + */ + if (pif == NULL) + zlog_warn("set src %pI6 is not a local address", + &p.u.prefix6); return NB_OK; case NB_EV_PREPARE: case NB_EV_ABORT: diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 08daddb164..88f6ec2634 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -481,7 +481,8 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re, * know that they've lost */ if (old && (old != re) && (old->type != re->type)) - zsend_route_notify_owner(old, p, ZAPI_ROUTE_BETTER_ADMIN_WON); + zsend_route_notify_owner(old, p, ZAPI_ROUTE_BETTER_ADMIN_WON, + info->afi, info->safi); /* Update fib selection */ dest->selected_fib = re; @@ -1748,6 +1749,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) uint32_t seq; rib_dest_t *dest; bool fib_changed = false; + struct rib_table_info *info; zvrf = vrf_info_lookup(dplane_ctx_get_vrf(ctx)); vrf = vrf_lookup_by_id(dplane_ctx_get_vrf(ctx)); @@ -1767,6 +1769,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) dest = rib_dest_from_rnode(rn); srcdest_rnode_prefixes(rn, &dest_pfx, &src_pfx); + info = srcdest_rnode_table_info(rn); op = dplane_ctx_get_op(ctx); status = dplane_ctx_get_status(ctx); @@ -1818,8 +1821,12 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) "%s(%u):%pFX Stale dplane result for re %p", VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), dest_pfx, re); - } else - UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); + } else { + if (!zrouter.asic_offloaded || + (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED) || + CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))) + UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); + } } if (old_re) { @@ -1896,8 +1903,23 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) zvrf->installs++; /* Notify route owner */ - zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED); - + if (zebra_router_notify_on_ack()) + zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED); + else { + if (re) { + if (CHECK_FLAG(re->flags, + ZEBRA_FLAG_OFFLOADED)) + zsend_route_notify_owner_ctx( + ctx, + ZAPI_ROUTE_INSTALLED); + if (CHECK_FLAG( + re->flags, + ZEBRA_FLAG_OFFLOAD_FAILED)) + zsend_route_notify_owner_ctx( + ctx, + ZAPI_ROUTE_FAIL_INSTALL); + } + } } else { if (re) { SET_FLAG(re->status, ROUTE_ENTRY_FAILED); @@ -1906,7 +1928,8 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx) SET_FLAG(old_re->status, ROUTE_ENTRY_FAILED); if (re) zsend_route_notify_owner(re, dest_pfx, - ZAPI_ROUTE_FAIL_INSTALL); + ZAPI_ROUTE_FAIL_INSTALL, + info->afi, info->safi); zlog_warn("%s(%u:%u):%pFX: Route install failed", VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), @@ -2063,7 +2086,8 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx) } /* Ensure we clear the QUEUED flag */ - UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); + if (!zrouter.asic_offloaded) + UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); /* Is this a notification that ... matters? We mostly care about * the route that is currently selected for installation; we may also @@ -3053,7 +3077,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, } void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - unsigned short instance, int flags, struct prefix *p, + unsigned short instance, uint32_t flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, uint32_t nhe_id, uint32_t table_id, uint32_t metric, uint8_t distance, bool fromkernel, bool connected_down) @@ -3083,16 +3107,15 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, /* Lookup route node. */ rn = srcdest_rnode_lookup(table, p, src_p); if (!rn) { - char src_buf[PREFIX_STRLEN]; - - if (src_p && src_p->prefixlen) - prefix2str(src_p, src_buf, sizeof(src_buf)); - else - src_buf[0] = '\0'; - if (IS_ZEBRA_DEBUG_RIB) { + char src_buf[PREFIX_STRLEN]; struct vrf *vrf = vrf_lookup_by_id(vrf_id); + if (src_p && src_p->prefixlen) + prefix2str(src_p, src_buf, sizeof(src_buf)); + else + src_buf[0] = '\0'; + zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib", vrf->name, table_id, p, (src_buf[0] != '\0') ? " from " : "", @@ -3282,7 +3305,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, - unsigned short instance, int flags, struct prefix *p, + unsigned short instance, uint32_t flags, struct prefix *p, struct prefix_ipv6 *src_p, const struct nexthop *nh, uint32_t nhe_id, uint32_t table_id, uint32_t metric, uint32_t mtu, uint8_t distance, route_tag_t tag) @@ -3705,6 +3728,7 @@ static int handle_pw_result(struct zebra_dplane_ctx *ctx) } done: + dplane_ctx_fini(&ctx); return 0; } diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 521f969fcc..3c4dbc5e9c 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -152,7 +152,7 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, enum rnh_type type, flog_warn(EC_ZEBRA_RNH_NO_TABLE, "%s(%u): Add RNH %pFX type %s - table not found", VRF_LOGNAME(vrf), vrfid, p, rnh_type2str(type)); - exists = false; + *exists = false; return NULL; } diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 294f2c17ff..7b0a1e3d9c 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -64,19 +64,17 @@ static void zebra_route_map_set_delay_timer(uint32_t value); * Match function return 1 if match is success else return 0 */ static enum route_map_cmd_result_t -route_match_tag(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_tag(void *rule, const struct prefix *prefix, void *object) { route_tag_t *tag; struct nh_rmap_obj *nh_data; - if (type == RMAP_ZEBRA) { - tag = rule; - nh_data = object; + tag = rule; + nh_data = object; + + if (nh_data->tag == *tag) + return RMAP_MATCH; - if (nh_data->tag == *tag) - return RMAP_MATCH; - } return RMAP_NOMATCH; } @@ -92,25 +90,23 @@ static const struct route_map_rule_cmd route_match_tag_cmd = { /* `match interface IFNAME' */ /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_interface(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_interface(void *rule, const struct prefix *prefix, void *object) { struct nh_rmap_obj *nh_data; char *ifname = rule; ifindex_t ifindex; - if (type == RMAP_ZEBRA) { - if (strcasecmp(ifname, "any") == 0) - return RMAP_MATCH; - nh_data = object; - if (!nh_data || !nh_data->nexthop) - return RMAP_NOMATCH; - ifindex = ifname2ifindex(ifname, nh_data->vrf_id); - if (ifindex == 0) - return RMAP_NOMATCH; - if (nh_data->nexthop->ifindex == ifindex) - return RMAP_MATCH; - } + if (strcasecmp(ifname, "any") == 0) + return RMAP_MATCH; + nh_data = object; + if (!nh_data || !nh_data->nexthop) + return RMAP_NOMATCH; + ifindex = ifname2ifindex(ifname, nh_data->vrf_id); + if (ifindex == 0) + return RMAP_NOMATCH; + if (nh_data->nexthop->ifindex == ifindex) + return RMAP_MATCH; + return RMAP_NOMATCH; } @@ -938,40 +934,35 @@ DEFPY_YANG (show_ipv6_protocol_nht, /* Match function return 1 if match is success else return zero. */ static enum route_map_cmd_result_t -route_match_ip_next_hop(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_next_hop(void *rule, const struct prefix *prefix, void *object) { struct access_list *alist; struct nh_rmap_obj *nh_data; struct prefix_ipv4 p; - if (type == RMAP_ZEBRA) { - nh_data = object; - if (!nh_data) - return RMAP_NOMATCH; - - switch (nh_data->nexthop->type) { - case NEXTHOP_TYPE_IFINDEX: - /* Interface routes can't match ip next-hop */ - return RMAP_NOMATCH; - case NEXTHOP_TYPE_IPV4_IFINDEX: - case NEXTHOP_TYPE_IPV4: - p.family = AF_INET; - p.prefix = nh_data->nexthop->gate.ipv4; - p.prefixlen = IPV4_MAX_BITLEN; - break; - default: - return RMAP_NOMATCH; - } - alist = access_list_lookup(AFI_IP, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + nh_data = object; + if (!nh_data) + return RMAP_NOMATCH; - return (access_list_apply(alist, &p) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); + switch (nh_data->nexthop->type) { + case NEXTHOP_TYPE_IFINDEX: + /* Interface routes can't match ip next-hop */ + return RMAP_NOMATCH; + case NEXTHOP_TYPE_IPV4_IFINDEX: + case NEXTHOP_TYPE_IPV4: + p.family = AF_INET; + p.prefix = nh_data->nexthop->gate.ipv4; + p.prefixlen = IPV4_MAX_BITLEN; + break; + default: + return RMAP_NOMATCH; } - return RMAP_NOMATCH; + alist = access_list_lookup(AFI_IP, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; + + return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } /* Route map `ip next-hop' match statement. `arg' should be @@ -999,39 +990,35 @@ static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { static enum route_map_cmd_result_t route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct prefix_list *plist; struct nh_rmap_obj *nh_data; struct prefix_ipv4 p; - if (type == RMAP_ZEBRA) { - nh_data = (struct nh_rmap_obj *)object; - if (!nh_data) - return RMAP_NOMATCH; - - switch (nh_data->nexthop->type) { - case NEXTHOP_TYPE_IFINDEX: - /* Interface routes can't match ip next-hop */ - return RMAP_NOMATCH; - case NEXTHOP_TYPE_IPV4_IFINDEX: - case NEXTHOP_TYPE_IPV4: - p.family = AF_INET; - p.prefix = nh_data->nexthop->gate.ipv4; - p.prefixlen = IPV4_MAX_BITLEN; - break; - default: - return RMAP_NOMATCH; - } - plist = prefix_list_lookup(AFI_IP, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + nh_data = (struct nh_rmap_obj *)object; + if (!nh_data) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, &p) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); + switch (nh_data->nexthop->type) { + case NEXTHOP_TYPE_IFINDEX: + /* Interface routes can't match ip next-hop */ + return RMAP_NOMATCH; + case NEXTHOP_TYPE_IPV4_IFINDEX: + case NEXTHOP_TYPE_IPV4: + p.family = AF_INET; + p.prefix = nh_data->nexthop->gate.ipv4; + p.prefixlen = IPV4_MAX_BITLEN; + break; + default: + return RMAP_NOMATCH; } - return RMAP_NOMATCH; + plist = prefix_list_lookup(AFI_IP, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; + + return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static void *route_match_ip_next_hop_prefix_list_compile(const char *arg) @@ -1058,34 +1045,28 @@ static const struct route_map_rule_cmd zero. */ static enum route_map_cmd_result_t route_match_address(afi_t afi, void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct access_list *alist; - if (type == RMAP_ZEBRA) { - alist = access_list_lookup(afi, (char *)rule); - if (alist == NULL) - return RMAP_NOMATCH; + alist = access_list_lookup(afi, (char *)rule); + if (alist == NULL) + return RMAP_NOMATCH; - return (access_list_apply(alist, prefix) == FILTER_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static enum route_map_cmd_result_t -route_match_ip_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ip_address(void *rule, const struct prefix *prefix, void *object) { - return route_match_address(AFI_IP, rule, prefix, type, object); + return route_match_address(AFI_IP, rule, prefix, object); } static enum route_map_cmd_result_t -route_match_ipv6_address(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) +route_match_ipv6_address(void *rule, const struct prefix *prefix, void *object) { - return route_match_address(AFI_IP6, rule, prefix, type, object); + return route_match_address(AFI_IP6, rule, prefix, object); } /* Route map `ip address' match statement. `arg' should be @@ -1121,28 +1102,23 @@ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { static enum route_map_cmd_result_t route_match_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object, afi_t afi) + void *object, afi_t afi) { struct prefix_list *plist; - if (type == RMAP_ZEBRA) { - plist = prefix_list_lookup(afi, (char *)rule); - if (plist == NULL) - return RMAP_NOMATCH; + plist = prefix_list_lookup(afi, (char *)rule); + if (plist == NULL) + return RMAP_NOMATCH; - return (prefix_list_apply(plist, prefix) == PREFIX_DENY - ? RMAP_NOMATCH - : RMAP_MATCH); - } - return RMAP_NOMATCH; + return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH + : RMAP_MATCH); } static enum route_map_cmd_result_t route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { - return (route_match_address_prefix_list(rule, prefix, type, object, - AFI_IP)); + return (route_match_address_prefix_list(rule, prefix, object, AFI_IP)); } static void *route_match_address_prefix_list_compile(const char *arg) @@ -1165,10 +1141,9 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { - return (route_match_address_prefix_list(rule, prefix, type, object, - AFI_IP6)); + return (route_match_address_prefix_list(rule, prefix, object, AFI_IP6)); } static const struct route_map_rule_cmd @@ -1183,11 +1158,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct nh_rmap_obj *nh_data; - if (type == RMAP_ZEBRA && prefix->family == AF_INET6) { + if (prefix->family == AF_INET6) { nh_data = (struct nh_rmap_obj *)object; if (!nh_data) return RMAP_NOMATCH; @@ -1195,6 +1170,7 @@ route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix, if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE) return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -1220,15 +1196,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_address_prefix_len(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { uint32_t *prefixlen = (uint32_t *)rule; - if (type == RMAP_ZEBRA) { - return ((prefix->prefixlen == *prefixlen) ? RMAP_MATCH - : RMAP_NOMATCH); - } - return RMAP_NOMATCH; + return ((prefix->prefixlen == *prefixlen) ? RMAP_MATCH : RMAP_NOMATCH); } static void *route_match_address_prefix_len_compile(const char *arg) @@ -1277,34 +1249,30 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_nexthop_prefix_len(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { uint32_t *prefixlen = (uint32_t *)rule; struct nh_rmap_obj *nh_data; struct prefix_ipv4 p; - if (type == RMAP_ZEBRA) { - nh_data = (struct nh_rmap_obj *)object; - if (!nh_data || !nh_data->nexthop) - return RMAP_NOMATCH; + nh_data = (struct nh_rmap_obj *)object; + if (!nh_data || !nh_data->nexthop) + return RMAP_NOMATCH; - switch (nh_data->nexthop->type) { - case NEXTHOP_TYPE_IFINDEX: - /* Interface routes can't match ip next-hop */ - return RMAP_NOMATCH; - case NEXTHOP_TYPE_IPV4_IFINDEX: - case NEXTHOP_TYPE_IPV4: - p.family = AF_INET; - p.prefix = nh_data->nexthop->gate.ipv4; - p.prefixlen = IPV4_MAX_BITLEN; - break; - default: - return RMAP_NOMATCH; - } - return ((p.prefixlen == *prefixlen) ? RMAP_MATCH - : RMAP_NOMATCH); + switch (nh_data->nexthop->type) { + case NEXTHOP_TYPE_IFINDEX: + /* Interface routes can't match ip next-hop */ + return RMAP_NOMATCH; + case NEXTHOP_TYPE_IPV4_IFINDEX: + case NEXTHOP_TYPE_IPV4: + p.family = AF_INET; + p.prefix = nh_data->nexthop->gate.ipv4; + p.prefixlen = IPV4_MAX_BITLEN; + break; + default: + return RMAP_NOMATCH; } - return RMAP_NOMATCH; + return ((p.prefixlen == *prefixlen) ? RMAP_MATCH : RMAP_NOMATCH); } static const struct route_map_rule_cmd @@ -1319,11 +1287,11 @@ static const struct route_map_rule_cmd static enum route_map_cmd_result_t route_match_ip_next_hop_type(void *rule, const struct prefix *prefix, - route_map_object_t type, void *object) + void *object) { struct nh_rmap_obj *nh_data; - if (type == RMAP_ZEBRA && prefix->family == AF_INET) { + if (prefix->family == AF_INET) { nh_data = (struct nh_rmap_obj *)object; if (!nh_data) return RMAP_NOMATCH; @@ -1331,6 +1299,7 @@ route_match_ip_next_hop_type(void *rule, const struct prefix *prefix, if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE) return RMAP_MATCH; } + return RMAP_NOMATCH; } @@ -1355,21 +1324,17 @@ static const struct route_map_rule_cmd /* `match source-protocol PROTOCOL' */ static enum route_map_cmd_result_t -route_match_source_protocol(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_match_source_protocol(void *rule, const struct prefix *p, void *object) { uint32_t *rib_type = (uint32_t *)rule; struct nh_rmap_obj *nh_data; - if (type == RMAP_ZEBRA) { - nh_data = (struct nh_rmap_obj *)object; - if (!nh_data) - return RMAP_NOMATCH; + nh_data = (struct nh_rmap_obj *)object; + if (!nh_data) + return RMAP_NOMATCH; - return ((nh_data->source_protocol == *rib_type) ? RMAP_MATCH - : RMAP_NOMATCH); - } - return RMAP_NOMATCH; + return ((nh_data->source_protocol == *rib_type) ? RMAP_MATCH + : RMAP_NOMATCH); } static void *route_match_source_protocol_compile(const char *arg) @@ -1399,15 +1364,11 @@ static const struct route_map_rule_cmd route_match_source_protocol_cmd = { /* `source-instance` */ static enum route_map_cmd_result_t -route_match_source_instance(void *rule, const struct prefix *p, - route_map_object_t type, void *object) +route_match_source_instance(void *rule, const struct prefix *p, void *object) { uint8_t *instance = (uint8_t *)rule; struct nh_rmap_obj *nh_data; - if (type != RMAP_ZEBRA) - return RMAP_NOMATCH; - nh_data = (struct nh_rmap_obj *)object; if (!nh_data) return RMAP_NOMATCH; @@ -1444,15 +1405,13 @@ static const struct route_map_rule_cmd route_match_source_instance_cmd = { /* Set src. */ static enum route_map_cmd_result_t -route_set_src(void *rule, const struct prefix *prefix, route_map_object_t type, - void *object) +route_set_src(void *rule, const struct prefix *prefix, void *object) { struct nh_rmap_obj *nh_data; - if (type == RMAP_ZEBRA) { - nh_data = (struct nh_rmap_obj *)object; - nh_data->nexthop->rmap_src = *(union g_addr *)rule; - } + nh_data = (struct nh_rmap_obj *)object; + nh_data->nexthop->rmap_src = *(union g_addr *)rule; + return RMAP_OKAY; } @@ -1738,7 +1697,7 @@ zebra_route_map_check(int family, int rib_type, uint8_t instance, if (!rmap && PROTO_RM_NAME(zvrf, family, ZEBRA_ROUTE_MAX)) rmap = PROTO_RM_MAP(zvrf, family, ZEBRA_ROUTE_MAX); if (rmap) { - ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj); + ret = route_map_apply(rmap, p, &nh_obj); } return (ret); @@ -1782,7 +1741,7 @@ zebra_import_table_route_map_check(int family, int re_type, uint8_t instance, if (re_type >= 0 && re_type < ZEBRA_ROUTE_MAX) rmap = route_map_lookup_by_name(rmap_name); if (rmap) { - ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj); + ret = route_map_apply(rmap, p, &nh_obj); } return (ret); @@ -1810,7 +1769,7 @@ route_map_result_t zebra_nht_route_map_check(afi_t afi, int client_proto, if (!rmap && NHT_RM_MAP(zvrf, afi, ZEBRA_ROUTE_MAX)) rmap = NHT_RM_MAP(zvrf, afi, ZEBRA_ROUTE_MAX); if (rmap) - ret = route_map_apply(rmap, p, RMAP_ZEBRA, &nh_obj); + ret = route_map_apply(rmap, p, &nh_obj); return ret; } diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index fc4390f7f8..249ec38a69 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -257,7 +257,12 @@ void zebra_router_terminate(void) hash_free(zrouter.iptable_hash); } -void zebra_router_init(void) +bool zebra_router_notify_on_ack(void) +{ + return !zrouter.asic_offloaded || zrouter.notify_on_ack; +} + +void zebra_router_init(bool asic_offload, bool notify_on_ack) { zrouter.sequence_num = 0; @@ -291,5 +296,6 @@ void zebra_router_init(void) hash_create_size(8, zebra_nhg_id_key, zebra_nhg_hash_id_equal, "Zebra Router Nexthop Groups ID index"); - zrouter.asic_offloaded = false; + zrouter.asic_offloaded = asic_offload; + zrouter.notify_on_ack = notify_on_ack; } diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index 67f94bfcfe..08c5fcaf8d 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -61,6 +61,29 @@ enum multicast_mode { /* on equal value, MRIB wins for last 2 */ }; +/* An interface can be error-disabled if a protocol (such as EVPN or + * VRRP) detects a problem with keeping it operationally-up. + * If any of the protodown bits are set protodown-on is programmed + * in the dataplane. This results in a carrier/L1 down on the + * physical device. + */ +enum protodown_reasons { + /* On startup local ESs are held down for some time to + * allow the underlay to converge and EVPN routes to + * get learnt + */ + ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY = (1 << 0), + /* If all the uplinks are down the switch has lost access + * to the VxLAN overlay and must shut down the access + * ports to allow servers to re-direct their traffic to + * other switches on the Ethernet Segment + */ + ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN = (1 << 1), + ZEBRA_PROTODOWN_EVPN_ALL = (ZEBRA_PROTODOWN_EVPN_UPLINK_DOWN + | ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY) +}; +#define ZEBRA_PROTODOWN_RC_STR_LEN 80 + struct zebra_mlag_info { /* Role this zebra router is playing */ enum mlag_role role; @@ -187,13 +210,14 @@ struct zebra_router { * Does the underlying system provide an asic offload */ bool asic_offloaded; + bool notify_on_ack; }; #define GRACEFUL_RESTART_TIME 60 extern struct zebra_router zrouter; -extern void zebra_router_init(void); +extern void zebra_router_init(bool asic_offload, bool notify_on_ack); extern void zebra_router_cleanup(void); extern void zebra_router_terminate(void); @@ -232,6 +256,8 @@ extern void multicast_mode_ipv4_set(enum multicast_mode mode); extern enum multicast_mode multicast_mode_ipv4_get(void); +extern bool zebra_router_notify_on_ack(void); + /* zebra_northbound.c */ extern const struct frr_yang_module_info frr_zebra_info; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ed235ba799..8f73825700 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -204,12 +204,16 @@ static char re_status_output_char(const struct route_entry *re, star_p = true; } + if (zrouter.asic_offloaded && + CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED)) + return 'q'; + if (zrouter.asic_offloaded && CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED)) return 't'; if (zrouter.asic_offloaded - && !CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED)) + && CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED)) return 'o'; if (star_p) @@ -870,6 +874,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED)) json_object_boolean_true_add(json_route, "offloaded"); + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED)) + json_object_boolean_false_add(json_route, "offloaded"); + if (re->tag) json_object_int_add(json_route, "tag", re->tag); @@ -1270,6 +1277,9 @@ DEFPY (show_ip_nht, if (addr) p = sockunion2hostprefix(addr, &prefix); + if (!p) + return CMD_WARNING; + zebra_print_rnh_table(vrf_id, afi, vty, rtype, p); return CMD_SUCCESS; } @@ -1766,9 +1776,11 @@ DEFPY (show_route, if (vrf_name) VRF_GET_ID(vrf_id, vrf_name, !!json); vrf = vrf_lookup_by_id(vrf_id); - if (vrf) - zvrf = vrf->info; - if (!vrf || !zvrf) + if (!vrf) + return CMD_SUCCESS; + + zvrf = vrf->info; + if (!zvrf) return CMD_SUCCESS; if (table_all) @@ -2003,6 +2015,8 @@ static void vty_show_ip_route_summary(struct vty *vty, #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1) uint32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1]; uint32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t offload_cnt[ZEBRA_ROUTE_TOTAL + 1]; + uint32_t trap_cnt[ZEBRA_ROUTE_TOTAL + 1]; uint32_t i; uint32_t is_ibgp; json_object *json_route_summary = NULL; @@ -2010,6 +2024,8 @@ static void vty_show_ip_route_summary(struct vty *vty, memset(&rib_cnt, 0, sizeof(rib_cnt)); memset(&fib_cnt, 0, sizeof(fib_cnt)); + memset(&offload_cnt, 0, sizeof(offload_cnt)); + memset(&trap_cnt, 0, sizeof(trap_cnt)); if (use_json) { json_route_summary = json_object_new_object(); @@ -2037,6 +2053,20 @@ static void vty_show_ip_route_summary(struct vty *vty, else fib_cnt[re->type]++; } + + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED)) { + if (is_ibgp) + trap_cnt[ZEBRA_ROUTE_IBGP]++; + else + trap_cnt[re->type]++; + } + + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED)) { + if (is_ibgp) + offload_cnt[ZEBRA_ROUTE_IBGP]++; + else + offload_cnt[re->type]++; + } } if (!use_json) @@ -2060,6 +2090,13 @@ static void vty_show_ip_route_summary(struct vty *vty, json_object_int_add( json_route_ebgp, "rib", rib_cnt[ZEBRA_ROUTE_BGP]); + json_object_int_add( + json_route_ebgp, "fibOffLoaded", + offload_cnt[ZEBRA_ROUTE_BGP]); + json_object_int_add( + json_route_ebgp, "fibTrapped", + trap_cnt[ZEBRA_ROUTE_BGP]); + json_object_string_add(json_route_ebgp, "type", "ebgp"); json_object_array_add(json_route_routes, @@ -2074,6 +2111,12 @@ static void vty_show_ip_route_summary(struct vty *vty, json_object_int_add( json_route_ibgp, "rib", rib_cnt[ZEBRA_ROUTE_IBGP]); + json_object_int_add( + json_route_ibgp, "fibOffLoaded", + offload_cnt[ZEBRA_ROUTE_IBGP]); + json_object_int_add( + json_route_ibgp, "fibTrapped", + trap_cnt[ZEBRA_ROUTE_IBGP]); json_object_string_add(json_route_ibgp, "type", "ibgp"); json_object_array_add(json_route_routes, @@ -2097,6 +2140,13 @@ static void vty_show_ip_route_summary(struct vty *vty, "fib", fib_cnt[i]); json_object_int_add(json_route_type, "rib", rib_cnt[i]); + + json_object_int_add(json_route_type, + "fibOffLoaded", + offload_cnt[i]); + json_object_int_add(json_route_type, + "fibTrapped", + trap_cnt[i]); json_object_string_add( json_route_type, "type", zebra_route_string(i)); @@ -2433,6 +2483,20 @@ DEFPY (evpn_mh_neigh_holdtime, no ? true : false); } +DEFPY (evpn_mh_startup_delay, + evpn_mh_startup_delay_cmd, + "[no] evpn mh startup-delay(0-3600)$duration", + NO_STR + "EVPN\n" + "Multihoming\n" + "Startup delay\n" + "duration in seconds\n") +{ + + return zebra_evpn_mh_startup_delay_update(vty, duration, + no ? true : false); +} + DEFUN (default_vrf_vni_mapping, default_vrf_vni_mapping_cmd, "vni " CMD_VNI_RANGE "[prefix-routes-only]", @@ -3990,6 +4054,7 @@ void zebra_vty_init(void) install_element(CONFIG_NODE, &evpn_mh_mac_holdtime_cmd); install_element(CONFIG_NODE, &evpn_mh_neigh_holdtime_cmd); + install_element(CONFIG_NODE, &evpn_mh_startup_delay_cmd); install_element(CONFIG_NODE, &default_vrf_vni_mapping_cmd); install_element(CONFIG_NODE, &no_default_vrf_vni_mapping_cmd); install_element(VRF_NODE, &vrf_vni_mapping_cmd); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index cca7680953..4b3b142d40 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -3427,7 +3427,7 @@ void zebra_vxlan_print_evpn(struct vty *vty, bool uj) json_object_int_add(json, "detectionTime", zvrf->dad_time); json_object_int_add(json, "detectionFreezeTime", zvrf->dad_freeze_time); - + zebra_evpn_mh_json(json); } else { vty_out(vty, "L2 VNIs: %u\n", num_l2vnis); vty_out(vty, "L3 VNIs: %u\n", num_l3vnis); @@ -3447,6 +3447,7 @@ void zebra_vxlan_print_evpn(struct vty *vty, bool uj) vty_out(vty, " Detection freeze %s\n", "permanent"); } + zebra_evpn_mh_print(vty); } if (uj) { |
