mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 20:27:14 +00:00
Merge pull request #16195 from opensourcerouting/fix/drop_recent_confdate
ospfd: Drop `interfaceIp` from `show ip ospf neigh json`
This commit is contained in:
commit
b94fc2d2d6
198
ospfd/ospf_vty.c
198
ospfd/ospf_vty.c
@ -3576,8 +3576,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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) {
|
||||
@ -3628,33 +3626,17 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
if (use_json)
|
||||
json_object_boolean_true_add(json_interface_sub,
|
||||
"ifUnnumbered");
|
||||
json_object_boolean_true_add(json_oi,
|
||||
"ifUnnumbered");
|
||||
} else
|
||||
else
|
||||
vty_out(vty, " This interface is UNNUMBERED,");
|
||||
} else {
|
||||
struct in_addr dest;
|
||||
@ -3668,13 +3650,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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);
|
||||
@ -3700,26 +3675,14 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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);
|
||||
@ -3728,16 +3691,10 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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);
|
||||
@ -3754,18 +3711,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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));
|
||||
@ -3809,13 +3754,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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",
|
||||
@ -3841,13 +3779,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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,",
|
||||
@ -3863,43 +3794,28 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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:");
|
||||
@ -3915,23 +3831,14 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
}
|
||||
|
||||
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",
|
||||
@ -3939,14 +3846,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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 ");
|
||||
@ -3975,23 +3874,17 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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");
|
||||
}
|
||||
@ -4002,11 +3895,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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",
|
||||
@ -4016,14 +3904,11 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
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);
|
||||
@ -4031,84 +3916,53 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
|
||||
|
||||
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);
|
||||
|
||||
ospf_interface_auth_show(vty, oi, json_oi, 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,22 +140,6 @@ def verify_p2mp_interface(tgen, router, nbr_cnt, nbr_adj_cnt, nbr_filter):
|
||||
"interfaces": {
|
||||
"r1-eth0": {
|
||||
"ospfEnabled": True,
|
||||
"interfaceIp": {
|
||||
"10.1.0.1": {
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
"routerId": "1.1.1.1",
|
||||
"networkType": "POINTOMULTIPOINT",
|
||||
"cost": 10,
|
||||
"state": "Point-To-Point",
|
||||
"nbrCount": nbr_cnt,
|
||||
"nbrAdjacentCount": nbr_adj_cnt,
|
||||
"prefixSuppression": False,
|
||||
"p2mpDelayReflood": False,
|
||||
"nbrFilterPrefixList": nbr_filter,
|
||||
}
|
||||
},
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
@ -201,17 +185,6 @@ def verify_non_p2mp_interface(tgen):
|
||||
"interfaces": {
|
||||
"r1-eth0": {
|
||||
"ospfEnabled": True,
|
||||
"interfaceIp": {
|
||||
"10.1.0.1": {
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
"routerId": "1.1.1.1",
|
||||
"networkType": "BROADCAST",
|
||||
"cost": 10,
|
||||
"prefixSuppression": False,
|
||||
}
|
||||
},
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
|
@ -144,22 +144,6 @@ def verify_p2mp_interface(tgen, router, nbr_cnt, nbr_adj_cnt, non_broadcast):
|
||||
"interfaces": {
|
||||
"r1-eth0": {
|
||||
"ospfEnabled": True,
|
||||
"interfaceIp": {
|
||||
"10.1.0.1": {
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
"routerId": "1.1.1.1",
|
||||
"networkType": "POINTOMULTIPOINT",
|
||||
"cost": 10,
|
||||
"state": "Point-To-Point",
|
||||
"nbrCount": nbr_cnt,
|
||||
"nbrAdjacentCount": nbr_adj_cnt,
|
||||
"prefixSuppression": False,
|
||||
"p2mpDelayReflood": False,
|
||||
"p2mpNonBroadcast": non_broadcast,
|
||||
}
|
||||
},
|
||||
"ipAddress": "10.1.0.1",
|
||||
"ipAddressPrefixlen": 24,
|
||||
"ospfIfType": "Broadcast",
|
||||
|
Loading…
Reference in New Issue
Block a user