mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 04:52:01 +00:00
ospfd: Add converged
and role
json output for neighbor command
The `show ip ospf neighbor json` command was displaying state:`Full\/DR` Where state was both the role and whether or not the neigbhor was converged. While from a OSPF perspective this is the state. This state is a combination of two things. This creates a problem in testing because we have no guarantee that a particular ospf router will actually have a particular role given how loaded our topotest systems are. So add a bit of json output to display both the converged status as well as the role this router is playing on this neighbor/interface. The above becomes: state:`Full\/DR` converged:`Full` role:`DR` Tests can now be modified to look for `Full` and allow it to continue. Most of the tests do not actually care if this router is the DR or Backup. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
d7374bd3b1
commit
3766c36a20
@ -146,8 +146,7 @@ const char *ospf_if_name_string(struct ospf_interface *oi)
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size)
|
||||
int ospf_nbr_ism_state(struct ospf_neighbor *nbr)
|
||||
{
|
||||
int state;
|
||||
struct ospf_interface *oi = nbr->oi;
|
||||
@ -159,6 +158,13 @@ void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size)
|
||||
else
|
||||
state = ISM_DROther;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void ospf_nbr_state_message(struct ospf_neighbor *nbr, char *buf, size_t size)
|
||||
{
|
||||
int state = ospf_nbr_ism_state(nbr);
|
||||
|
||||
snprintf(buf, size, "%s/%s",
|
||||
lookup_msg(ospf_nsm_state_msg, nbr->state, NULL),
|
||||
lookup_msg(ospf_ism_state_msg, state, NULL));
|
||||
|
@ -150,6 +150,7 @@ extern char *ospf_lsa_type_str[];
|
||||
extern const char *ospf_area_name_string(struct ospf_area *);
|
||||
extern const char *ospf_area_desc_string(struct ospf_area *);
|
||||
extern const char *ospf_if_name_string(struct ospf_interface *);
|
||||
extern int ospf_nbr_ism_state(struct ospf_neighbor *nbr);
|
||||
extern void ospf_nbr_state_message(struct ospf_neighbor *, char *, size_t);
|
||||
extern const char *ospf_timer_dump(struct thread *, char *, size_t);
|
||||
extern const char *ospf_timeval_dump(struct timeval *, char *, size_t);
|
||||
|
@ -4419,6 +4419,16 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
|
||||
json_object_string_add(json_neighbor, "state",
|
||||
msgbuf);
|
||||
|
||||
json_object_string_add(
|
||||
json_neighbor, "converged",
|
||||
lookup_msg(ospf_nsm_state_msg,
|
||||
nbr->state, NULL));
|
||||
json_object_string_add(
|
||||
json_neighbor, "role",
|
||||
lookup_msg(ospf_ism_state_msg,
|
||||
ospf_nbr_ism_state(nbr),
|
||||
NULL));
|
||||
|
||||
if (nbr->t_inactivity) {
|
||||
long time_store;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user