Merge pull request #11847 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability
This commit is contained in:
mobash-rasool 2022-08-23 10:27:13 +05:30 committed by GitHub
commit c480bc4358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -909,18 +909,19 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
struct prefix_ipv4 *p; struct prefix_ipv4 *p;
if (IS_DEBUG_OSPF_EVENT) 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 (vlink_count == OSPF_VL_MAX_COUNT) {
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( 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; return NULL;
} }
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( zlog_debug("%s: creating pseudo zebra interface vrf id %u",
"ospf_vl_new(): creating pseudo zebra interface vrf id %u", __func__, ospf->vrf_id);
ospf->vrf_id);
snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count); snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name); vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name);
@ -944,7 +945,9 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
if (voi == NULL) { if (voi == NULL) {
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( zlog_debug(
"ospf_vl_new(): Alarm: OSPF int structure is not created"); "%s: Alarm: OSPF int structure is not created",
__func__);
return NULL; return NULL;
} }
voi->connected = co; voi->connected = co;
@ -954,17 +957,15 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
vlink_count++; vlink_count++;
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_vl_new(): Created name: %s", ifname); zlog_debug("%s: Created name: %s set if->name to %s", __func__,
if (IS_DEBUG_OSPF_EVENT) ifname, vi->name);
zlog_debug("ospf_vl_new(): set if->name to %s", vi->name);
area_id.s_addr = INADDR_ANY; area_id.s_addr = INADDR_ANY;
area = ospf_area_get(ospf, area_id); area = ospf_area_get(ospf, area_id);
voi->area = area; voi->area = area;
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( zlog_debug("%s: set associated area to the backbone", __func__);
"ospf_vl_new(): set associated area to the backbone");
/* Add pseudo neighbor. */ /* Add pseudo neighbor. */
ospf_nbr_self_reset(voi, voi->ospf->router_id); ospf_nbr_self_reset(voi, voi->ospf->router_id);
@ -972,7 +973,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
ospf_area_add_if(voi->area, voi); ospf_area_add_if(voi->area, voi);
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_vl_new(): Stop"); zlog_debug("%s: Stop", __func__);
return voi; return voi;
} }
@ -1167,10 +1168,8 @@ void ospf_vl_up_check(struct ospf_area *area, struct in_addr rid,
struct ospf_interface *oi; struct ospf_interface *oi;
if (IS_DEBUG_OSPF_EVENT) { if (IS_DEBUG_OSPF_EVENT) {
zlog_debug("ospf_vl_up_check(): Start"); zlog_debug("%s: Start", __func__);
zlog_debug("ospf_vl_up_check(): Router ID is %pI4", zlog_debug("%s: Router ID is %pI4 Area is %pI4", __func__, &rid,
&rid);
zlog_debug("ospf_vl_up_check(): Area is %pI4",
&area->area_id); &area->area_id);
} }
@ -1189,13 +1188,13 @@ void ospf_vl_up_check(struct ospf_area *area, struct in_addr rid,
SET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED); SET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED);
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( zlog_debug("%s: this VL matched", __func__);
"ospf_vl_up_check(): this VL matched");
if (oi->state == ISM_Down) { if (oi->state == ISM_Down) {
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug( 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); SET_FLAG(oi->ifp->flags, IFF_UP);
OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceUp); OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceUp);
} }
@ -1203,13 +1202,15 @@ void ospf_vl_up_check(struct ospf_area *area, struct in_addr rid,
if (ospf_vl_set_params(area, vl_data, v)) { if (ospf_vl_set_params(area, vl_data, v)) {
if (IS_DEBUG_OSPF(ism, ISM_EVENTS)) if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
zlog_debug( 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) if (ospf->backbone)
ospf_router_lsa_update_area( ospf_router_lsa_update_area(
ospf->backbone); ospf->backbone);
else if (IS_DEBUG_OSPF(ism, ISM_EVENTS)) else if (IS_DEBUG_OSPF(ism, ISM_EVENTS))
zlog_debug( zlog_debug(
"ospf_vl_up_check: VL cost change, no backbone!"); "%s: VL cost change, no backbone!",
__func__);
} }
} }
} }