python3-pytest <!nocheck>,
python3-sphinx,
texinfo (>= 4.7),
+ lua5.3 <pkg.frr.lua>,
liblua5.3-dev <pkg.frr.lua>
Standards-Version: 4.5.0.3
Homepage: https://www.frrouting.org/
apiserv->t_sync_read = NULL;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("API: ospf_apiserver_read: Peer: %pI4/%u",
+ zlog_debug("API: %s: Peer: %pI4/%u", __func__,
&apiserv->peer_sync.sin_addr,
ntohs(apiserv->peer_sync.sin_port));
}
apiserv->t_async_read = NULL;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("API: ospf_apiserver_read: Peer: %pI4/%u",
+ zlog_debug("API: %s: Peer: %pI4/%u", __func__,
&apiserv->peer_async.sin_addr,
ntohs(apiserv->peer_async.sin_port));
}
#endif /* USE_ASYNC_READ */
else {
- zlog_warn("ospf_apiserver_read: Unknown fd(%d)", fd);
+ zlog_warn("%s: Unknown fd(%d)", __func__, fd);
ospf_apiserver_free(apiserv);
return;
}
/* Read message from fd. */
msg = msg_read(fd);
if (msg == NULL) {
- zlog_warn(
- "ospf_apiserver_read: read failed on fd=%d, closing connection",
- fd);
+ zlog_warn("%s: read failed on fd=%d, closing connection",
+ __func__, fd);
/* Perform cleanup. */
ospf_apiserver_free(apiserv);
/* Sanity check */
if (fd != apiserv->fd_sync) {
- zlog_warn("ospf_apiserver_sync_write: Unknown fd=%d", fd);
+ zlog_warn("%s: Unknown fd=%d", __func__, fd);
goto out;
}
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("API: ospf_apiserver_sync_write: Peer: %pI4/%u",
+ zlog_debug("API: %s: Peer: %pI4/%u", __func__,
&apiserv->peer_sync.sin_addr,
ntohs(apiserv->peer_sync.sin_port));
/* Check whether there is really a message in the fifo. */
msg = msg_fifo_pop(apiserv->out_sync_fifo);
if (!msg) {
- zlog_warn(
- "API: ospf_apiserver_sync_write: No message in Sync-FIFO?");
+ zlog_warn("API: %s: No message in Sync-FIFO?", __func__);
return;
}
msg_free(msg);
if (rc < 0) {
- zlog_warn("ospf_apiserver_sync_write: write failed on fd=%d",
- fd);
+ zlog_warn("%s: write failed on fd=%d", __func__, fd);
goto out;
}
/* Sanity check */
if (fd != apiserv->fd_async) {
- zlog_warn("ospf_apiserver_async_write: Unknown fd=%d", fd);
+ zlog_warn("%s: Unknown fd=%d", __func__, fd);
goto out;
}
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("API: ospf_apiserver_async_write: Peer: %pI4/%u",
+ zlog_debug("API: %s: Peer: %pI4/%u", __func__,
&apiserv->peer_async.sin_addr,
ntohs(apiserv->peer_async.sin_port));
/* Check whether there is really a message in the fifo. */
msg = msg_fifo_pop(apiserv->out_async_fifo);
if (!msg) {
- zlog_warn(
- "API: ospf_apiserver_async_write: No message in Async-FIFO?");
+ zlog_warn("API: %s: No message in Async-FIFO?", __func__);
return;
}
msg_free(msg);
if (rc < 0) {
- zlog_warn("ospf_apiserver_async_write: write failed on fd=%d",
- fd);
+ zlog_warn("%s: write failed on fd=%d", __func__, fd);
goto out;
}
/* Listen socket under queue length 3. */
rc = listen(accept_sock, 3);
if (rc < 0) {
- zlog_warn("ospf_apiserver_serv_sock_family: listen: %s",
- safe_strerror(errno));
+ zlog_warn("%s: listen: %s", __func__, safe_strerror(errno));
close(accept_sock); /* Close socket */
return rc;
}
/* Accept connection for synchronous messages */
new_sync_sock = sockunion_accept(accept_sock, &su);
if (new_sync_sock < 0) {
- zlog_warn("ospf_apiserver_accept: accept: %s",
- safe_strerror(errno));
+ zlog_warn("%s: accept: %s", __func__, safe_strerror(errno));
return;
}
ret = getpeername(new_sync_sock, (struct sockaddr *)&peer_sync,
&peerlen);
if (ret < 0) {
- zlog_warn("ospf_apiserver_accept: getpeername: %s",
+ zlog_warn("%s: getpeername: %s", __func__,
safe_strerror(errno));
close(new_sync_sock);
return;
}
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("API: ospf_apiserver_accept: New peer: %pI4/%u",
- &peer_sync.sin_addr,
- ntohs(peer_sync.sin_port));
+ zlog_debug("API: %s: New peer: %pI4/%u", __func__,
+ &peer_sync.sin_addr, ntohs(peer_sync.sin_port));
/* Create new socket for asynchronous messages. */
peer_async = peer_sync;
/* Check if remote port number to make reverse connection is valid one.
*/
if (ntohs(peer_async.sin_port) == ospf_apiserver_getport()) {
- zlog_warn(
- "API: ospf_apiserver_accept: Peer(%pI4/%u): Invalid async port number?",
- &peer_async.sin_addr,
- ntohs(peer_async.sin_port));
+ zlog_warn("API: %s: Peer(%pI4/%u): Invalid async port number?",
+ __func__, &peer_async.sin_addr,
+ ntohs(peer_async.sin_port));
close(new_sync_sock);
return;
}
new_async_sock = socket(AF_INET, SOCK_STREAM, 0);
if (new_async_sock < 0) {
- zlog_warn("ospf_apiserver_accept: socket: %s",
- safe_strerror(errno));
+ zlog_warn("%s: socket: %s", __func__, safe_strerror(errno));
close(new_sync_sock);
return;
}
sizeof(struct sockaddr_in));
if (ret < 0) {
- zlog_warn("ospf_apiserver_accept: connect: %s",
- safe_strerror(errno));
+ zlog_warn("%s: connect: %s", __func__, safe_strerror(errno));
close(new_sync_sock);
close(new_async_sock);
return;
/* Make the asynchronous channel write-only. */
ret = shutdown(new_async_sock, SHUT_RD);
if (ret < 0) {
- zlog_warn("ospf_apiserver_accept: shutdown: %s",
- safe_strerror(errno));
+ zlog_warn("%s: shutdown: %s", __func__, safe_strerror(errno));
close(new_sync_sock);
close(new_async_sock);
return;
event = OSPF_APISERVER_ASYNC_WRITE;
break;
default:
- zlog_warn("ospf_apiserver_send_msg: Unknown message type %d",
+ zlog_warn("%s: Unknown message type %d", __func__,
msg->hdr.msgtype);
return -1;
}
int ret;
if (!msg) {
- zlog_warn("ospf_apiserver_send_reply: msg_new failed");
+ zlog_warn("%s: msg_new failed", __func__);
#ifdef NOTYET
/* Cannot allocate new message. What should we do? */
ospf_apiserver_free(apiserv);
rc = ospf_apiserver_handle_sync_router_id(apiserv, msg);
break;
default:
- zlog_warn("ospf_apiserver_handle_msg: Unknown message type: %d",
+ zlog_warn("%s: Unknown message type: %d", __func__,
msg->hdr.msgtype);
rc = -1;
}
originator_func = ospf_apiserver_lsa11_originator;
break;
default:
- zlog_warn("ospf_apiserver_register_opaque_type: lsa_type(%d)",
- lsa_type);
+ zlog_warn("%s: lsa_type(%d)", __func__, lsa_type);
return OSPF_API_ILLEGALLSATYPE;
}
0, OSPF_OPAQUE_LINK_LSA, r->opaque_type,
oi->address->u.prefix4);
if (!msg) {
- zlog_warn(
- "apiserver_notify_ready_type9: msg_new failed");
+ zlog_warn("%s: msg_new failed",
+ __func__);
#ifdef NOTYET
/* Cannot allocate new message. What
* should we do? */
0, OSPF_OPAQUE_AREA_LSA, r->opaque_type,
area->area_id);
if (!msg) {
- zlog_warn(
- "apiserver_notify_ready_type10: msg_new failed");
+ zlog_warn("%s: msg_new failed",
+ __func__);
#ifdef NOTYET
/* Cannot allocate new message. What
* should we do? */
r->opaque_type, noarea_id);
if (!msg) {
- zlog_warn(
- "apiserver_notify_ready_type11: msg_new failed");
+ zlog_warn("%s: msg_new failed", __func__);
#ifdef NOTYET
/* Cannot allocate new message. What should we
* do? */
MSG_LSA_UPDATE_NOTIFY, seqnum, ifaddr, area_id,
lsa->flags & OSPF_LSA_SELF, lsa->data);
if (!msg) {
- zlog_warn(
- "apiserver_sync_callback: new_msg_update failed");
+ zlog_warn("%s: new_msg_update failed", __func__);
#ifdef NOTYET
/* Cannot allocate new message. What should we do? */
/* ospf_apiserver_free (apiserv);*/ /* Do nothing
/* Create a stream for internal opaque LSA */
if ((s = stream_new(OSPF_MAX_LSA_SIZE)) == NULL) {
- zlog_warn("ospf_apiserver_opaque_lsa_new: stream_new failed");
+ zlog_warn("%s: stream_new failed", __func__);
return NULL;
}
case OSPF_OPAQUE_LINK_LSA:
oi = ospf_apiserver_if_lookup_by_addr(omsg->ifaddr);
if (!oi) {
- zlog_warn("apiserver_originate: unknown interface %pI4",
+ zlog_warn("%s: unknown interface %pI4", __func__,
&omsg->ifaddr);
rc = OSPF_API_NOSUCHINTERFACE;
goto out;
case OSPF_OPAQUE_AREA_LSA:
area = ospf_area_lookup_by_area_id(ospf, omsg->area_id);
if (!area) {
- zlog_warn("apiserver_originate: unknown area %pI4",
+ zlog_warn("%s: unknown area %pI4", __func__,
&omsg->area_id);
rc = OSPF_API_NOSUCHAREA;
goto out;
break;
default:
/* We can only handle opaque types here */
- zlog_warn(
- "apiserver_originate: Cannot originate non-opaque LSA type %d",
- data->type);
+ zlog_warn("%s: Cannot originate non-opaque LSA type %d",
+ __func__, data->type);
rc = OSPF_API_ILLEGALLSATYPE;
goto out;
}
if (!apiserver_is_opaque_type_registered(apiserv, lsa_type,
opaque_type)) {
- zlog_warn(
- "apiserver_originate: LSA-type(%d)/Opaque-type(%d): Not registered",
- lsa_type, opaque_type);
+ zlog_warn("%s: LSA-type(%d)/Opaque-type(%d): Not registered",
+ __func__, lsa_type, opaque_type);
rc = OSPF_API_OPAQUETYPENOTREGISTERED;
goto out;
}
*/
assert(!ospf_opaque_is_owned(old));
if (IS_LSA_MAX_SEQ(old)) {
- flog_warn(
- EC_OSPF_LSA_INSTALL_FAILURE,
- "ospf_apiserver_originate1: old LSA at maxseq");
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
+ "%s: old LSA at maxseq", __func__);
return -1;
}
lsa->data->ls_seqnum = lsa_seqnum_increment(old);
apiserv = lookup_apiserver_by_lsa(lsa);
if (!apiserv) {
- zlog_warn(
- "ospf_apiserver_lsa_refresher: LSA[%s]: No apiserver?",
- dump_lsa_key(lsa));
+ zlog_warn("%s: LSA[%s]: No apiserver?", __func__,
+ dump_lsa_key(lsa));
lsa->data->ls_age =
htons(OSPF_LSA_MAXAGE); /* Flush it anyway. */
goto out;
new = ospf_apiserver_opaque_lsa_new(lsa->area, lsa->oi,
lsa->data);
if (!new) {
- zlog_warn(
- "ospf_apiserver_lsa_refresher: Cannot create a new LSA?");
+ zlog_warn("%s: Cannot create a new LSA?", __func__);
goto out;
}
} else {
/* Install LSA into LSDB. */
if (ospf_lsa_install(ospf, new->oi, new) == NULL) {
- flog_warn(
- EC_OSPF_LSA_INSTALL_FAILURE,
- "ospf_apiserver_lsa_refresher: ospf_lsa_install failed");
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
+ "%s: ospf_lsa_install failed", __func__);
ospf_lsa_unlock(&new);
goto out;
}
case OSPF_OPAQUE_AREA_LSA:
area = ospf_area_lookup_by_area_id(ospf, dmsg->area_id);
if (!area) {
- zlog_warn("ospf_apiserver_lsa_delete: unknown area %pI4",
+ zlog_warn("%s: unknown area %pI4", __func__,
&dmsg->area_id);
rc = OSPF_API_NOSUCHAREA;
goto out;
area = NULL;
break;
default:
- zlog_warn(
- "ospf_apiserver_lsa_delete: Cannot delete non-opaque LSA type %d",
- dmsg->lsa_type);
+ zlog_warn("%s: Cannot delete non-opaque LSA type %d", __func__,
+ dmsg->lsa_type);
rc = OSPF_API_ILLEGALLSATYPE;
goto out;
}
if (!apiserver_is_opaque_type_registered(apiserv, lsa_type,
opaque_type)) {
- zlog_warn(
- "ospf_apiserver_lsa_delete: LSA-type(%d)/Opaque-type(%d): Not registered",
- lsa_type, opaque_type);
+ zlog_warn("%s: LSA-type(%d)/Opaque-type(%d): Not registered",
+ __func__, lsa_type, opaque_type);
rc = OSPF_API_OPAQUETYPENOTREGISTERED;
goto out;
}
*/
old = ospf_lsa_lookup(ospf, area, dmsg->lsa_type, id, ospf->router_id);
if (!old) {
- zlog_warn(
- "ospf_apiserver_lsa_delete: LSA[Type%d:%pI4] not in LSDB",
- dmsg->lsa_type, &id);
+ zlog_warn("%s: LSA[Type%d:%pI4] not in LSDB", __func__,
+ dmsg->lsa_type, &id);
rc = OSPF_API_NOSUCHLSA;
goto out;
}
if (ifp->name[0] == '\0') {
/* interface has empty name */
- zlog_warn("ospf_apiserver_new_if: interface has no name?");
+ zlog_warn("%s: interface has no name?", __func__);
return 0;
}
if (ifp->name[0] == '\0') {
/* interface has empty name */
- zlog_warn("ospf_apiserver_new_if: interface has no name?");
+ zlog_warn("%s: interface has no name?", __func__);
return 0;
}
if (!oi) {
/* This interface is known to Zebra but not to OSPF daemon yet.
*/
- zlog_warn(
- "ospf_apiserver_new_if: interface %s not known to OSPFd?",
- ifp->name);
+ zlog_warn("%s: interface %s not known to OSPFd?", __func__,
+ ifp->name);
return 0;
}
struct ospf_interface *oi;
/* zlog_warn for debugging */
- zlog_warn("ospf_apiserver_del_if");
- zlog_warn("ifp name=%s status=%d index=%d", ifp->name, ifp->status,
- ifp->ifindex);
+ zlog_warn("%s ifp name=%s status=%d index=%d", __func__, ifp->name,
+ ifp->status, ifp->ifindex);
oi = ospf_apiserver_if_lookup_by_ifp(ifp);
/* Tell clients about interface change */
/* zlog_warn for debugging */
- zlog_warn("ospf_apiserver_ism_change");
+ zlog_warn("%s", __func__);
if (listcount(apiserver_list) > 0) {
ospf_apiserver_clients_notify_ism_change(oi);
}
- zlog_warn("oi->ifp->name=%s", oi->ifp->name);
- zlog_warn("old_state=%d", old_state);
- zlog_warn("oi->state=%d", oi->state);
+ zlog_warn("%s oi->ifp->name=%s old_state=%d oi->state=%d", __func__,
+ oi->ifp->name, old_state, oi->state);
}
void ospf_apiserver_nsm_change(struct ospf_neighbor *nbr, int old_status)
{
/* Neighbor status changed, tell clients about it */
- zlog_warn("ospf_apiserver_nsm_change");
+ zlog_warn("%s", __func__);
if (listcount(apiserver_list) > 0) {
ospf_apiserver_clients_notify_nsm_change(nbr);
}
oi->address->u.prefix4);
if (!msg) {
zlog_warn(
- "ospf_apiserver_clients_notify_ready_type9: new_msg_ready_notify failed");
+ "%s: new_msg_ready_notify failed",
+ __func__);
#ifdef NOTYET
/* Cannot allocate new message. What
* should we do? */
area->area_id);
if (!msg) {
zlog_warn(
- "ospf_apiserver_clients_notify_ready_type10: new_msg_ready_nofity failed");
+ "%s: new_msg_ready_nofity failed",
+ __func__);
#ifdef NOTYET
/* Cannot allocate new message. What
* should we do? */
id_null);
if (!msg) {
zlog_warn(
- "ospf_apiserver_clients_notify_ready_type11: new_msg_ready_notify failed");
+ "%s: new_msg_ready_notify failed",
+ __func__);
#ifdef NOTYET
/* Cannot allocate new message. What
* should we do? */
msg = new_msg_ism_change(0, ifaddr, area_id, oi->state);
if (!msg) {
- zlog_warn(
- "apiserver_clients_notify_ism_change: msg_new failed");
+ zlog_warn("%s: msg_new failed", __func__);
return;
}
msg = new_msg_nsm_change(0, ifaddr, nbraddr, nbr->router_id,
nbr->state);
if (!msg) {
- zlog_warn(
- "apiserver_clients_notify_nsm_change: msg_new failed");
+ zlog_warn("%s: msg_new failed", __func__);
return;
}
ifaddr, area_id,
lsa->flags & OSPF_LSA_SELF, lsa->data);
if (!msg) {
- zlog_warn(
- "apiserver_clients_lsa_change_notify: msg_new failed");
+ zlog_warn("%s: msg_new failed", __func__);
return -1;
}
struct ospf_route * or ;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_network_route(): processing summary route to %pFX",
- p);
+ zlog_debug("%s: processing summary route to %pFX", __func__, p);
/* Find a route to the same dest */
if ((rn1 = route_node_lookup(rt, (struct prefix *)p))) {
if ((or = rn1->info)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_ia_network_route(): Found a route to the same network");
+ "%s: Found a route to the same network",
+ __func__);
/* Check the existing route. */
if ((res = ospf_route_cmp(ospf, new_or, or)) < 0) {
/* New route is better, so replace old one. */
} /*if (rn1)*/
else { /* no route */
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_network_route(): add new route to %pFX",
- p);
+ zlog_debug("%s: add new route to %pFX", __func__, p);
ospf_route_add(rt, p, new_or, abr_or);
}
}
int ret;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_ia_router_route(): considering %pFX", p);
+ zlog_debug("%s: considering %pFX", __func__, p);
/* Find a route to the same dest */
rn = route_node_get(rtrs, (struct prefix *)p);
if (or) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_ia_router_route(): a route to the same ABR through the same area exists");
+ "%s: a route to the same ABR through the same area exists",
+ __func__);
/* New route is better */
if ((ret = ospf_route_cmp(ospf, new_or, or)) < 0) {
listnode_delete(rn->info, or);
/* Routes are the same */
else if (ret == 0) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_router_route(): merging the new route");
+ zlog_debug("%s: merging the new route",
+ __func__);
ospf_route_copy_nexthops(or, abr_or->paths);
ospf_route_free(new_or);
/* New route is worse */
else {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_router_route(): skipping the new route");
+ zlog_debug("%s: skipping the new route",
+ __func__);
ospf_route_free(new_or);
return;
}
ospf_route_copy_nexthops(new_or, abr_or->paths);
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_ia_router_route(): adding the new route");
+ zlog_debug("%s: adding the new route", __func__);
listnode_add(rn->info, new_or);
}
sl = (struct summary_lsa *)lsa->data;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("process_summary_lsa(): LS ID: %pI4",
- &sl->header.id);
+ zlog_debug("%s: LS ID: %pI4", __func__, &sl->header.id);
metric = GET_METRIC(sl->metric);
if (abr_or == NULL) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_network_route(): can't find a route to the ABR");
+ zlog_debug("%s: can't find a route to the ABR",
+ __func__);
return;
}
installed
backbone paths */
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_network_route(): Allowing Shortcut ABR to add new route");
+ zlog_debug("%s: Allowing Shortcut ABR to add new route",
+ __func__);
new_or = ospf_route_new();
new_or->type = OSPF_DESTINATION_NETWORK;
new_or->id = lsa->header.id;
if (or->path_type != OSPF_PATH_INTRA_AREA &&
or->path_type != OSPF_PATH_INTER_AREA) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_network_route(): ERR: path type is wrong");
+ zlog_debug("%s: ERR: path type is wrong", __func__);
return;
}
or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_update_network_route(): Shortcut: this intra-area path is not backbone");
+ "%s: Shortcut: this intra-area path is not backbone",
+ __func__);
return;
}
} else /* Not Shortcut ABR */
{
if (!OSPF_IS_AREA_ID_BACKBONE(or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_network_route(): route is not BB-associated");
+ zlog_debug("%s: route is not BB-associated",
+ __func__);
return; /* We can update only BB routes */
}
}
if (or->cost < cost) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_network_route(): new route is worse");
+ zlog_debug("%s: new route is worse", __func__);
return;
}
if (or->cost == cost) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_update_network_route(): new route is same distance, adding nexthops");
+ "%s: new route is same distance, adding nexthops",
+ __func__);
ospf_route_copy_nexthops(or, abr_or->paths);
}
if (or->cost > cost) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_update_network_route(): new route is better, overriding nexthops");
+ "%s: new route is better, overriding nexthops",
+ __func__);
ospf_route_subst_nexthops(or, abr_or->paths);
or->cost = cost;
if (abr_or == NULL) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_update_router_route(): can't find a route to the ABR");
+ zlog_debug("%s: can't find a route to the ABR",
+ __func__);
return;
}
if (!(or->u.std.flags & ROUTER_LSA_EXTERNAL)) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_upd_router_route(): the remote router is not an ASBR");
+ zlog_debug("%s: the remote router is not an ASBR",
+ __func__);
return;
}
sl = (struct summary_lsa *)lsa->data;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("process_transit_summaries(): LS ID: %pI4",
- &lsa->data->id);
+ zlog_debug("%s: LS ID: %pI4", __func__, &lsa->data->id);
metric = GET_METRIC(sl->metric);
if (metric == OSPF_LS_INFINITY) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "process_transit_summaries(): metric is infinity, skip");
+ zlog_debug("%s: metric is infinity, skip", __func__);
return 0;
}
if (IS_LSA_MAXAGE(lsa)) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "process_transit_summaries(): This LSA is too old");
+ zlog_debug("%s: This LSA is too old", __func__);
return 0;
}
if (ospf_lsa_is_self_originated(area->ospf, lsa)) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "process_transit_summaries(): This LSA is mine, skip");
+ zlog_debug("%s: This LSA is mine, skip", __func__);
return 0;
}
struct ospf_area *area;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_ia_routing():start");
+ zlog_debug("%s:start", __func__);
if (IS_OSPF_ABR(ospf)) {
switch (ospf->abr_type) {
case OSPF_ABR_STAND:
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_ia_routing():Standard ABR");
+ zlog_debug("%s:Standard ABR", __func__);
if ((area = ospf->backbone)) {
if (IS_DEBUG_OSPF_EVENT) {
zlog_debug(
- "ospf_ia_routing():backbone area found");
- zlog_debug(
- "ospf_ia_routing():examining summaries");
+ "%s:backbone area found, examining summaries",
+ __func__);
}
OSPF_EXAMINE_SUMMARIES_ALL(area, rt, rtrs);
OSPF_EXAMINE_TRANSIT_SUMMARIES_ALL(
area, rt, rtrs);
} else if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_routing():backbone area NOT found");
+ zlog_debug("%s:backbone area NOT found",
+ __func__);
break;
case OSPF_ABR_IBM:
case OSPF_ABR_CISCO:
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_routing():Alternative Cisco/IBM ABR");
+ zlog_debug("%s:Alternative Cisco/IBM ABR",
+ __func__);
area = ospf->backbone; /* Find the BB */
/* If we have an active BB connection */
if (area && ospf_act_bb_connection(ospf)) {
if (IS_DEBUG_OSPF_EVENT) {
zlog_debug(
- "ospf_ia_routing(): backbone area found");
- zlog_debug(
- "ospf_ia_routing(): examining BB summaries");
+ "%s: backbone area found, examining BB summaries",
+ __func__);
}
OSPF_EXAMINE_SUMMARIES_ALL(area, rt, rtrs);
*/
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_ia_routing(): Active BB connection not found");
+ "%s: Active BB connection not found",
+ __func__);
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node,
area))
OSPF_EXAMINE_SUMMARIES_ALL(area, rt,
break;
case OSPF_ABR_SHORTCUT:
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_routing():Alternative Shortcut");
+ zlog_debug("%s:Alternative Shortcut", __func__);
area = ospf->backbone; /* Find the BB */
/* If we have an active BB connection */
if (area && ospf_act_bb_connection(ospf)) {
if (IS_DEBUG_OSPF_EVENT) {
zlog_debug(
- "ospf_ia_routing(): backbone area found");
- zlog_debug(
- "ospf_ia_routing(): examining BB summaries");
+ "%s: backbone area found, examining BB summaries",
+ __func__);
}
OSPF_EXAMINE_SUMMARIES_ALL(area, rt, rtrs);
}
}
} else {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_ia_routing():not ABR, considering all areas");
+ zlog_debug("%s:not ABR, considering all areas",
+ __func__);
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area))
OSPF_EXAMINE_SUMMARIES_ALL(area, rt, rtrs);
struct prefix_ipv4 *p;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_vl_new()(%s): Start", ospf_get_name(ospf));
+ zlog_debug("%s: (%s): Start", __func__, ospf_get_name(ospf));
if (vlink_count == OSPF_VL_MAX_COUNT) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_vl_new(): Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links");
+ "%s: Alarm: cannot create more than OSPF_MAX_VL_COUNT virtual links",
+ __func__);
+
return NULL;
}
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_vl_new(): creating pseudo zebra interface vrf id %u",
- ospf->vrf_id);
+ zlog_debug("%s: creating pseudo zebra interface vrf id %u",
+ __func__, ospf->vrf_id);
snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name);
if (voi == NULL) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_vl_new(): Alarm: OSPF int structure is not created");
+ "%s: Alarm: OSPF int structure is not created",
+ __func__);
+
return NULL;
}
voi->connected = co;
vlink_count++;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_vl_new(): Created name: %s", ifname);
- if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_vl_new(): set if->name to %s", vi->name);
+ zlog_debug("%s: Created name: %s set if->name to %s", __func__,
+ ifname, vi->name);
area_id.s_addr = INADDR_ANY;
area = ospf_area_get(ospf, area_id);
voi->area = area;
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_vl_new(): set associated area to the backbone");
+ zlog_debug("%s: set associated area to the backbone", __func__);
/* Add pseudo neighbor. */
ospf_nbr_self_reset(voi, voi->ospf->router_id);
ospf_area_add_if(voi->area, voi);
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("ospf_vl_new(): Stop");
+ zlog_debug("%s: Stop", __func__);
return voi;
}
struct ospf_interface *oi;
if (IS_DEBUG_OSPF_EVENT) {
- zlog_debug("ospf_vl_up_check(): Start");
- zlog_debug("ospf_vl_up_check(): Router ID is %pI4",
- &rid);
- zlog_debug("ospf_vl_up_check(): Area is %pI4",
+ zlog_debug("%s: Start", __func__);
+ zlog_debug("%s: Router ID is %pI4 Area is %pI4", __func__, &rid,
&area->area_id);
}
SET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED);
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug(
- "ospf_vl_up_check(): this VL matched");
+ zlog_debug("%s: this VL matched", __func__);
if (oi->state == ISM_Down) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_vl_up_check(): VL is down, waking it up");
+ "%s: VL is down, waking it up",
+ __func__);
SET_FLAG(oi->ifp->flags, IFF_UP);
OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceUp);
}
if (ospf_vl_set_params(area, vl_data, v)) {
if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
zlog_debug(
- "ospf_vl_up_check: VL cost change, scheduling router lsa refresh");
+ "%s: VL cost change, scheduling router lsa refresh",
+ __func__);
if (ospf->backbone)
ospf_router_lsa_update_area(
ospf->backbone);
else if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
zlog_debug(
- "ospf_vl_up_check: VL cost change, no backbone!");
+ "%s: VL cost change, no backbone!",
+ __func__);
}
}
}
Following tests are covered.
1. Verify default-originate route with default static and network command
2. Verify default-originate route with aggregate summary command
+3. Verfiy default-originate behaviour in ecmp
"""
import os
import sys
from lib.common_config import (
verify_fib_routes,
step,
+ create_prefix_lists,
run_frr_cmd,
+ create_route_maps,
+ shutdown_bringup_interface,
get_frr_ipv6_linklocal,
start_topology,
apply_raw_config,
return True
+def get_best_path_route_in_FIB(tgen, topo, dut, network):
+ """
+ API to verify the best route in FIB and return the ipv4 and ipv6 nexthop for the given route
+ command
+ =======
+ show ip route
+ show ipv6 route
+ params
+ ======
+ dut : device under test :
+ network ; route (ip) to which the best route to be retrieved
+ Returns
+ ========
+ on success : return dict with next hops for the best hop
+ on failure : return error message with boolean False
+ """
+ is_ipv4_best_path_found = False
+ is_ipv6_best_path_found = False
+ rnode = tgen.routers()[dut]
+ ipv4_show_bgp_json = run_frr_cmd(rnode, "sh ip bgp json ", isjson=True)
+ ipv6_show_bgp_json = run_frr_cmd(
+ rnode, "sh ip bgp ipv6 unicast json ", isjson=True
+ )
+ output_dict = {"ipv4": None, "ipv6": None}
+ ipv4_nxt_hop_count = len(ipv4_show_bgp_json["routes"][network["ipv4"]])
+ for index in range(ipv4_nxt_hop_count):
+ if "bestpath" in ipv4_show_bgp_json["routes"][network["ipv4"]][index].keys():
+ best_path_ip = ipv4_show_bgp_json["routes"][network["ipv4"]][index][
+ "nexthops"
+ ][0]["ip"]
+ output_dict["ipv4"] = best_path_ip
+ logger.info(
+ "[DUT [{}]] Best path for the route {} is {} ".format(
+ dut, network["ipv4"], best_path_ip
+ )
+ )
+ is_ipv4_best_path_found = True
+ else:
+ logger.error("ERROR....! No Best Path Found in BGP RIB.... FAILED")
+
+ ipv6_nxt_hop_count = len(ipv6_show_bgp_json["routes"][network["ipv6"]])
+ for index in range(ipv6_nxt_hop_count):
+ if "bestpath" in ipv6_show_bgp_json["routes"][network["ipv6"]][index].keys():
+ ip_add_count = len(
+ ipv6_show_bgp_json["routes"][network["ipv6"]][index]["nexthops"]
+ )
+ for i_index in range(ip_add_count):
+ if (
+ "global"
+ in ipv6_show_bgp_json["routes"][network["ipv6"]][index]["nexthops"][
+ i_index
+ ]["scope"]
+ ):
+ best_path_ip = ipv6_show_bgp_json["routes"][network["ipv6"]][index][
+ "nexthops"
+ ][i_index]["ip"]
+ output_dict["ipv6"] = best_path_ip
+ logger.info(
+ "[DUT [{}]] Best path for the route {} is {} ".format(
+ dut, network["ipv6"], best_path_ip
+ )
+ )
+
+ else:
+ logger.error("ERROR....! No Best Path Found in BGP RIB.... FAILED")
+ if is_ipv4_best_path_found:
+ return output_dict
+ else:
+ logger.error("ERROR...! Unable to find the Best Path in the RIB")
+ return False
+
+
#####################################################
#
# Testcases
write_test_footer(tc_name)
+def test_verify_default_originate_with_2way_ecmp_p2(request):
+ """
+ Summary: "Verify default-originate route with 3 way ECMP and traffic "
+ """
+
+ tgen = get_topogen()
+ global BGP_CONVERGENCE
+ global DEFAULT_ROUTES
+ DEFAULT_ROUTES = {"ipv4": "0.0.0.0/0", "ipv6": "0::0/0"}
+
+ if BGP_CONVERGENCE != True:
+ pytest.skip("skipped because of BGP Convergence failure")
+ # test case name
+ 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("Populating next-hops details")
+ r1_r2_ipv4_neighbor_ips = []
+ r1_r2_ipv6_neighbor_ips = []
+ r1_link = None
+ for index in range(1, 3):
+ r1_link = "r1-link" + str(index)
+ r1_r2_ipv4_neighbor_ips.append(
+ topo["routers"]["r2"]["links"][r1_link]["ipv4"].split("/")[0]
+ )
+ r1_r2_ipv6_neighbor_ips.append(
+ topo["routers"]["r2"]["links"][r1_link]["ipv6"].split("/")[0]
+ )
+
+ step(
+ "Configure default-originate on R1 for all the neighbor of IPv4 and IPv6 peers "
+ )
+ local_as = get_dut_as_number(tgen, dut="r1")
+ for index in range(2):
+ raw_config = {
+ "r1": {
+ "raw_config": [
+ "router bgp {}".format(local_as),
+ "address-family ipv4 unicast",
+ "neighbor {} default-originate".format(
+ r1_r2_ipv4_neighbor_ips[index]
+ ),
+ "exit-address-family",
+ "address-family ipv6 unicast",
+ "neighbor {} default-originate ".format(
+ r1_r2_ipv6_neighbor_ips[index]
+ ),
+ "exit-address-family",
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step(
+ "After configuring default-originate command , verify default routes are advertised on R2 "
+ )
+
+ r2_link = None
+ for index in range(1, 3):
+ r2_link = "r2-link" + str(index)
+ ipv4_nxt_hop = topo["routers"]["r1"]["links"][r2_link]["ipv4"].split("/")[0]
+ interface = topo["routers"]["r1"]["links"][r2_link]["interface"]
+ ipv6_link_local_nxt_hop = get_frr_ipv6_linklocal(tgen, "r1", intf=interface)
+ DEFAULT_ROUTE_NXT_HOP = {"ipv4": ipv4_nxt_hop, "ipv6": ipv6_link_local_nxt_hop}
+
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("Ping R1 configure IPv4 and IPv6 loopback address from R2")
+ pingaddr = topo["routers"]["r1"]["links"]["lo"]["ipv4"].split("/")[0]
+ router = tgen.gears["r2"]
+ output = router.run("ping -c 4 -w 4 {}".format(pingaddr))
+ assert " 0% packet loss" in output, "Ping R1->R2 FAILED"
+ logger.info("Ping from R1 to R2 ... success")
+
+ step("Shuting up the active route")
+ network = {"ipv4": "0.0.0.0/0", "ipv6": "::/0"}
+ ipv_dict = get_best_path_route_in_FIB(tgen, topo, dut="r2", network=network)
+ dut_links = topo["routers"]["r1"]["links"]
+ active_interface = None
+ for key, values in dut_links.items():
+ ipv4_address = dut_links[key]["ipv4"].split("/")[0]
+ ipv6_address = dut_links[key]["ipv6"].split("/")[0]
+ if ipv_dict["ipv4"] == ipv4_address and ipv_dict["ipv6"] == ipv6_address:
+ active_interface = dut_links[key]["interface"]
+
+ logger.info(
+ "Shutting down the interface {} on router {} ".format(active_interface, "r1")
+ )
+ shutdown_bringup_interface(tgen, "r1", active_interface, False)
+
+ step("Verify the complete convergence to fail after shutting the interface")
+ result = verify_bgp_convergence(tgen, topo, expected=False)
+ assert (
+ result is not True
+ ), " Testcase {} : After shuting down the interface Convergence is expected to be Failed".format(
+ tc_name
+ )
+
+ step(
+ "Verify routes from active best path is not received from r1 after shuting the interface"
+ )
+ r2_link = None
+ for index in range(1, 3):
+ r2_link = "r2-link" + str(index)
+ ipv4_nxt_hop = topo["routers"]["r1"]["links"][r2_link]["ipv4"].split("/")[0]
+ interface = topo["routers"]["r1"]["links"][r2_link]["interface"]
+ ipv6_link_local_nxt_hop = get_frr_ipv6_linklocal(tgen, "r1", intf=interface)
+ DEFAULT_ROUTE_NXT_HOP = {"ipv4": ipv4_nxt_hop, "ipv6": ipv6_link_local_nxt_hop}
+ if index == 1:
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ expected=False,
+ )
+ assert result is not True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+ else:
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("Ping R1 configure IPv4 and IPv6 loopback address from R2")
+ pingaddr = topo["routers"]["r1"]["links"]["lo"]["ipv4"].split("/")[0]
+ router = tgen.gears["r2"]
+ output = router.run("ping -c 4 -w 4 {}".format(pingaddr))
+ assert " 0% packet loss" in output, "Ping R1->R2 FAILED"
+ logger.info("Ping from R1 to R2 ... success")
+
+ step("No Shuting up the active route")
+
+ shutdown_bringup_interface(tgen, "r1", active_interface, True)
+
+ step("Verify the complete convergence after bringup the interface")
+ result = verify_bgp_convergence(tgen, topo)
+ assert (
+ result is True
+ ), " Testcase {} : After bringing up the interface complete convergence is expected ".format(
+ tc_name
+ )
+
+ step("Verify all the routes are received from r1 after no shuting the interface")
+ r2_link = None
+ for index in range(1, 3):
+ r2_link = "r2-link" + str(index)
+ ipv4_nxt_hop = topo["routers"]["r1"]["links"][r2_link]["ipv4"].split("/")[0]
+ interface = topo["routers"]["r1"]["links"][r2_link]["interface"]
+ ipv6_link_local_nxt_hop = get_frr_ipv6_linklocal(tgen, "r1", intf=interface)
+ DEFAULT_ROUTE_NXT_HOP = {"ipv4": ipv4_nxt_hop, "ipv6": ipv6_link_local_nxt_hop}
+ if index == 1:
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+ else:
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step(
+ "Configure IPv4 and IPv6 route-map with deny option on R2 to filter default route 0.0.0.0/0 and 0::0/0"
+ )
+ DEFAULT_ROUTES = {"ipv4": "0.0.0.0/0", "ipv6": "0::0/0"}
+ input_dict_3 = {
+ "r2": {
+ "prefix_lists": {
+ "ipv4": {
+ "Pv4": [
+ {
+ "seqid": "1",
+ "network": DEFAULT_ROUTES["ipv4"],
+ "action": "permit",
+ }
+ ]
+ },
+ "ipv6": {
+ "Pv6": [
+ {
+ "seqid": "1",
+ "network": DEFAULT_ROUTES["ipv6"],
+ "action": "permit",
+ }
+ ]
+ },
+ }
+ }
+ }
+ result = create_prefix_lists(tgen, input_dict_3)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ input_dict_3 = {
+ "r2": {
+ "route_maps": {
+ "RMv4": [
+ {
+ "action": "deny",
+ "seq_id": "1",
+ "match": {"ipv4": {"prefix_lists": "Pv4"}},
+ },
+ ],
+ "RMv6": [
+ {
+ "action": "deny",
+ "seq_id": "1",
+ "match": {"ipv6": {"prefix_lists": "Pv6"}},
+ },
+ ],
+ }
+ }
+ }
+ result = create_route_maps(tgen, input_dict_3)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ step("Apply route-map IN direction of R2 ( R2-R1) for IPv4 and IPv6 BGP neighbors")
+ r2_link = None
+ for index in range(1, 3):
+ r2_link = "r2-link" + str(index)
+ input_dict_4 = {
+ "r2": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ r2_link: {
+ "route_maps": [
+ {"name": "RMv4", "direction": "in"}
+ ]
+ },
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ r2_link: {
+ "route_maps": [
+ {"name": "RMv6", "direction": "in"}
+ ]
+ },
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ }
+ }
+ result = create_router_bgp(tgen, topo, input_dict_4)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("After applying the route-map the routes are not expected in RIB ")
+ r2_link = None
+ for index in range(1, 3):
+ r2_link = "r2-link" + str(index)
+ ipv4_nxt_hop = topo["routers"]["r1"]["links"][r2_link]["ipv4"].split("/")[0]
+ interface = topo["routers"]["r1"]["links"][r2_link]["interface"]
+ ipv6_link_local_nxt_hop = get_frr_ipv6_linklocal(tgen, "r1", intf=interface)
+ DEFAULT_ROUTE_NXT_HOP = {"ipv4": ipv4_nxt_hop, "ipv6": ipv6_link_local_nxt_hop}
+
+ result = verify_rib_default_route(
+ tgen,
+ topo,
+ dut="r2",
+ routes=DEFAULT_ROUTES,
+ expected_nexthop=DEFAULT_ROUTE_NXT_HOP,
+ expected=False,
+ )
+ assert result is not 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))
# Check environment now that we have config
if not diagnose_env(rundir):
- pytest.exit("environment has errors, please read the logs")
+ pytest.exit("environment has errors, please read the logs in %s" % rundir)
@pytest.fixture(autouse=True, scope="session")
)
continue
- logger.warning("could not find {} in {}".format(fname, frrdir))
+ logger.error("could not find {} in {}".format(fname, frrdir))
ret = False
else:
if fname != "zebra":