struct route_node *rn;
uint32_t bandwidth = ifp->bandwidth ? ifp->bandwidth : ifp->speed;
struct ospf_if_params *params;
- json_object *json_ois = NULL;
json_object *json_oi = NULL;
/* Is interface up? */
}
}
- if (use_json) {
- json_ois = json_object_new_object();
- json_object_object_add(json_interface_sub, "interfaceIp",
- json_ois);
- }
-
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
struct ospf_interface *oi = rn->info;
if (oi == NULL)
continue;
-#if CONFDATE > 20240601
- CPP_NOTICE(
- "Use all fields following ospfEnabled from interfaceIp hierarchy")
-#endif
-
if (use_json)
json_oi = json_object_new_object();
if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) {
- if (use_json) {
- json_object_boolean_true_add(json_interface_sub,
- "ifUnnumbered");
+ if (use_json)
json_object_boolean_true_add(json_oi,
"ifUnnumbered");
- } else
+ else
vty_out(vty, " This interface is UNNUMBERED,");
} else {
struct in_addr dest;
json_object_int_add(json_interface_sub,
"ipAddressPrefixlen",
oi->address->prefixlen);
-
- json_object_string_addf(
- json_oi, "ipAddress", "%pI4",
- &oi->address->u.prefix4);
- json_object_int_add(json_oi,
- "ipAddressPrefixlen",
- oi->address->prefixlen);
} else
vty_out(vty, " Internet Address %pFX,",
oi->address);
json_object_string_add(json_interface_sub,
"ospfIfType", dstr);
- json_object_string_add(json_oi, "ospfIfType",
- dstr);
-
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK) {
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
json_object_string_addf(
json_interface_sub, "vlinkPeer",
"%pI4", &dest);
-
- json_object_string_addf(json_oi,
- "vlinkPeer",
- "%pI4", &dest);
- } else {
+ else
json_object_string_addf(
json_interface_sub,
"localIfUsed", "%pI4", &dest);
-
- json_object_string_addf(json_oi,
- "localIfUsed",
- "%pI4", &dest);
- }
} else
vty_out(vty, " %s %pI4,", dstr,
&dest);
json_object_string_add(json_interface_sub, "area",
ospf_area_desc_string(oi->area));
- json_object_string_add(json_oi, "area",
- ospf_area_desc_string(oi->area));
-
- if (OSPF_IF_PARAM(oi, mtu_ignore)) {
- json_object_boolean_true_add(
- json_oi, "mtuMismatchDetect");
+ if (OSPF_IF_PARAM(oi, mtu_ignore))
json_object_boolean_true_add(
json_interface_sub,
"mtuMismatchDetect");
- }
json_object_string_addf(json_interface_sub, "routerId",
"%pI4", &ospf->router_id);
oi->state, NULL));
json_object_int_add(json_interface_sub, "priority",
PRIORITY(oi));
-
- json_object_string_addf(json_oi, "routerId", "%pI4",
- &ospf->router_id);
- json_object_string_add(json_oi, "networkType",
- ospf_network_type_str[oi->type]);
- json_object_int_add(json_oi, "cost", oi->output_cost);
- json_object_int_add(json_oi, "transmitDelaySecs",
- OSPF_IF_PARAM(oi, transmit_delay));
- json_object_string_add(json_oi, "state",
- lookup_msg(ospf_ism_state_msg,
- oi->state, NULL));
- json_object_int_add(json_oi, "priority", PRIORITY(oi));
json_object_boolean_add(
json_interface_sub, "opaqueCapable",
OSPF_IF_PARAM(oi, opaque_capable));
json_interface_sub, "drAddress",
"%pI4",
&nbr->address.u.prefix4);
-
- json_object_string_addf(
- json_oi, "drId", "%pI4",
- &nbr->router_id);
- json_object_string_addf(
- json_oi, "drAddress", "%pI4",
- &nbr->address.u.prefix4);
} else {
vty_out(vty,
" Designated Router (ID) %pI4",
json_interface_sub,
"bdrAddress", "%pI4",
&nbr->address.u.prefix4);
-
- json_object_string_addf(
- json_oi, "bdrId", "%pI4",
- &nbr->router_id);
- json_object_string_addf(
- json_oi, "bdrAddress", "%pI4",
- &nbr->address.u.prefix4);
} else {
vty_out(vty,
" Backup Designated Router (ID) %pI4,",
if (oi->params
&& ntohl(oi->params->network_lsa_seqnum)
!= OSPF_INITIAL_SEQUENCE_NUMBER) {
- if (use_json) {
+ if (use_json)
json_object_int_add(
json_interface_sub,
"networkLsaSequence",
ntohl(oi->params->network_lsa_seqnum));
-
- json_object_int_add(
- json_oi, "networkLsaSequence",
- ntohl(oi->params->network_lsa_seqnum));
- } else {
+ else
vty_out(vty,
" Saved Network-LSA sequence number 0x%x\n",
ntohl(oi->params->network_lsa_seqnum));
- }
}
if (use_json) {
if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)
|| OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) {
- if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) {
+ if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS))
json_object_boolean_true_add(
json_interface_sub,
"mcastMemberOspfAllRouters");
-
- json_object_boolean_true_add(
- json_oi,
- "mcastMemberOspfAllRouters");
- }
- if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) {
+ if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS))
json_object_boolean_true_add(
json_interface_sub,
"mcastMemberOspfDesignatedRouters");
-
- json_object_boolean_true_add(
- json_oi,
- "mcastMemberOspfDesignatedRouters");
- }
}
} else {
vty_out(vty, " Multicast group memberships:");
}
if (use_json) {
- if (OSPF_IF_PARAM(oi, fast_hello) == 0) {
+ if (OSPF_IF_PARAM(oi, fast_hello) == 0)
json_object_int_add(
json_interface_sub, "timerMsecs",
OSPF_IF_PARAM(oi, v_hello) * 1000);
-
- json_object_int_add(json_oi, "timerMsecs",
- OSPF_IF_PARAM(oi, v_hello) *
- 1000);
- } else {
+ else
json_object_int_add(
json_interface_sub, "timerMsecs",
1000 / OSPF_IF_PARAM(oi, fast_hello));
-
- json_object_int_add(
- json_oi, "timerMsecs",
- 1000 / OSPF_IF_PARAM(oi, fast_hello));
- }
json_object_int_add(json_interface_sub, "timerDeadSecs",
OSPF_IF_PARAM(oi, v_wait));
json_object_int_add(json_interface_sub, "timerWaitSecs",
json_object_int_add(
json_interface_sub, "timerRetransmitSecs",
OSPF_IF_PARAM(oi, retransmit_interval));
-
- json_object_int_add(json_oi, "timerDeadSecs",
- OSPF_IF_PARAM(oi, v_wait));
- json_object_int_add(json_oi, "timerWaitSecs",
- OSPF_IF_PARAM(oi, v_wait));
- json_object_int_add(
- json_oi, "timerRetransmitSecs",
- OSPF_IF_PARAM(oi, retransmit_interval));
} else {
vty_out(vty, " Timer intervals configured,");
vty_out(vty, " Hello ");
json_object_int_add(json_interface_sub,
"timerHelloInMsecs",
time_store);
- json_object_int_add(json_oi,
- "timerHelloInMsecs",
- time_store);
} else
vty_out(vty, " Hello due in %s\n",
ospf_timer_dump(oi->t_hello, timebuf,
sizeof(timebuf)));
} else /* passive-interface is set */
{
- if (use_json) {
+ if (use_json)
json_object_boolean_true_add(
json_interface_sub,
"timerPassiveIface");
-
- json_object_boolean_true_add(
- json_oi, "timerPassiveIface");
- } else
+ else
vty_out(vty,
" No Hellos (Passive interface)\n");
}
json_object_int_add(json_interface_sub,
"nbrAdjacentCount",
ospf_nbr_count(oi, NSM_Full));
-
- json_object_int_add(json_oi, "nbrCount",
- ospf_nbr_count(oi, 0));
- json_object_int_add(json_oi, "nbrAdjacentCount",
- ospf_nbr_count(oi, NSM_Full));
} else
vty_out(vty,
" Neighbor Count is %d, Adjacent neighbor count is %d\n",
params = IF_DEF_PARAMS(ifp);
if (params &&
OSPF_IF_PARAM_CONFIGURED(params, v_gr_hello_delay)) {
- if (use_json) {
+ if (use_json)
json_object_int_add(json_interface_sub,
"grHelloDelaySecs",
params->v_gr_hello_delay);
-
- json_object_int_add(json_oi, "grHelloDelaySecs",
- params->v_gr_hello_delay);
- } else
+ else
vty_out(vty,
" Graceful Restart hello delay: %us\n",
params->v_gr_hello_delay);
ospf_interface_bfd_show(vty, ifp, json_interface_sub);
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"prefixSuppression",
OSPF_IF_PARAM(oi,
prefix_suppression));
- json_object_boolean_add(json_oi, "prefixSuppression",
- OSPF_IF_PARAM(oi,
- prefix_suppression));
- } else {
- if (OSPF_IF_PARAM(oi, prefix_suppression))
- vty_out(vty,
- " Suppress advertisement of interface IP prefix\n");
- }
+ else if (OSPF_IF_PARAM(oi, prefix_suppression))
+ vty_out(vty,
+ " Suppress advertisement of interface IP prefix\n");
/* OSPF Authentication information */
ospf_interface_auth_show(vty, oi, json_interface_sub, use_json);
/* Point-to-Multipoint Interface options. */
if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT) {
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"p2mpDelayReflood",
oi->p2mp_delay_reflood);
-
- json_object_boolean_add(json_oi,
- "p2mpDelayReflood",
- oi->p2mp_delay_reflood);
- } else {
+ else
vty_out(vty,
" %sDelay reflooding LSAs received on P2MP interface\n",
oi->p2mp_delay_reflood ? "" : "Don't ");
- }
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"p2mpNonBroadcast",
oi->p2mp_non_broadcast);
-
- json_object_boolean_add(json_oi,
- "p2mpNonBroadcast",
- oi->p2mp_non_broadcast);
- } else {
+ else
vty_out(vty,
" P2MP interface does %ssupport broadcast\n",
oi->p2mp_non_broadcast ? "not " : "");
- }
}
- /* Add ospf_interface object to main json blob using SIP as key
- */
- if (use_json)
- json_object_object_addf(json_ois, json_oi, "%pI4",
- &oi->address->u.prefix4);
-
if (oi->nbr_filter) {
- if (use_json) {
+ if (use_json)
json_object_string_add(json_interface_sub,
"nbrFilterPrefixList",
prefix_list_name(
oi->nbr_filter));
- json_object_string_add(json_oi,
- "nbrFilterPrefixList",
- prefix_list_name(
- oi->nbr_filter));
- } else
+ else
vty_out(vty,
" Neighbor filter prefix-list: %s\n",
prefix_list_name(oi->nbr_filter));
} else {
- if (use_json) {
+ if (use_json)
json_object_string_add(json_interface_sub,
"nbrFilterPrefixList",
"N/A");
- json_object_string_add(json_oi,
- "nbrFilterPrefixList",
- "N/A");
- }
}
}
}