Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isisd: Command "show isis interface IFNAME json" displays all interfaces's circuit id. #17158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,8 @@ void isis_circuit_print_json(struct isis_circuit *circuit,
char buf_prx[INET6_BUFSIZ];
char buf[255];

json_object_int_add(json, "circuit", circuit->circuit_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this value a second time, with a new key - isn't it being added just below with "circuit-id"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to print the circuit_id only when printing a specific interface, if this modification is allowed.


snprintfrr(buf, sizeof(buf), "0x%x", circuit->circuit_id);
if (detail == ISIS_UI_LEVEL_BRIEF) {
iface_json = json_object_new_object();
Expand Down
37 changes: 12 additions & 25 deletions isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,20 +1043,14 @@ int show_isis_interface_common_json(struct json_object *json,
for (ALL_LIST_ELEMENTS_RO(area->circuit_list,
cnode, circuit)) {
circuit_json = json_object_new_object();
json_object_int_add(
circuit_json, "circuit",
circuit->circuit_id);
if (!ifname)
if (!ifname || strmatch(circuit->interface->name, ifname)) {
isis_circuit_print_json(circuit,
circuit_json,
detail);
else if (strcmp(circuit->interface->name,
ifname) == 0)
isis_circuit_print_json(circuit,
circuit_json,
detail);
json_object_array_add(circuits_json,
circuit_json);
json_object_array_add(circuits_json, circuit_json);
if (ifname)
break;
}
}
json_object_array_add(areas_json, area_json);
}
Expand All @@ -1076,22 +1070,16 @@ int show_isis_interface_common_json(struct json_object *json,
circuits_json = json_object_new_array();
json_object_object_add(area_json, "circuits",
circuits_json);
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode,
circuit)) {
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
circuit_json = json_object_new_object();
json_object_int_add(circuit_json, "circuit",
circuit->circuit_id);
if (!ifname)
if (!ifname || strmatch(circuit->interface->name, ifname)) {
isis_circuit_print_json(circuit,
circuit_json,
detail);
else if (strcmp(circuit->interface->name,
ifname) == 0)
isis_circuit_print_json(circuit,
circuit_json,
detail);
json_object_array_add(circuits_json,
circuit_json);
json_object_array_add(circuits_json, circuit_json);
if (ifname)
break;
}
}
json_object_array_add(areas_json, area_json);
}
Expand Down Expand Up @@ -1297,8 +1285,7 @@ static void isis_neighbor_common_json(struct json_object *json, const char *id,
for (i = 0; i < 2; i++) {
adjdb = circuit->u.bc.adjdb[i];
if (adjdb && adjdb->count) {
for (ALL_LIST_ELEMENTS_RO(
adjdb, node, adj))
for (ALL_LIST_ELEMENTS_RO(adjdb, node, adj))
if (!id ||
!memcmp(adj->sysid,
sysid,
Expand Down
Loading