Skip to content

Commit

Permalink
ospf6d: add json attributes to 'show ipv6 ospf6 neighbor'
Browse files Browse the repository at this point in the history
Add the following attributes in each neighbor of the vty command:
'show ipv6 ospf6 neighbor json':
- nbrPriority : integer
- Role: DR, BDR, DROther, or PointToPoint
- nbrState : <state>/<Role> where:
   o Role is the above attribute
   o state is "None",    "Down",     "Attempt", "Init", "Twoway",
              "ExStart", "ExChange", "Loading", "Full"
- routerDeadIntervalTimerDueMsec: integer value otherwise "inactive"

Enter in a deprecation workflow for state and priority values, which
are replaced by nbrState.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND authored and root committed Nov 29, 2023
1 parent a1b7c86 commit 22e73af
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ospf6d/ospf6_neighbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on,
struct timeval res;
char nstate[17];
char deadtime[64];
long h, m, s;
long h, m, s, time_store;
json_object *json_route;

/* Router-ID (Name) */
Expand Down Expand Up @@ -940,10 +940,30 @@ static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on,
json_route = json_object_new_object();

json_object_string_add(json_route, "neighborId", router_id);
#if CONFDATE > 20241129
CPP_NOTICE(
"Remove %s() JSON keys: state, priority", __func__)
#endif
json_object_int_add(json_route, "priority", on->priority);
json_object_string_add(json_route, "deadTime", deadtime);
json_object_string_add(json_route, "state",
ospf6_neighbor_state_str[on->state]);
json_object_int_add(json_route, "nbrPriority", on->priority);
json_object_string_add(json_route, "nbrState", nstate);
json_object_string_add(json_route, "Role",
ospf6_neighbor_state_str[on->state]);
if (on->inactivity_timer) {
time_store =
monotime_until(&on->inactivity_timer->u.sands,
NULL)
/ 1000LL;
json_object_int_add(json_route,
"routerDeadIntervalTimerDueMsec",
time_store);
} else
json_object_string_add(json_route,
"routerDeadIntervalTimerDueMsec",
"inactive");
json_object_string_add(json_route, "ifState", nstate);
json_object_string_add(json_route, "duration", duration);
json_object_string_add(json_route, "interfaceName",
Expand Down

0 comments on commit 22e73af

Please sign in to comment.