Skip to content

Commit

Permalink
isisd: Show correct level information for `show isis interface detail…
Browse files Browse the repository at this point in the history
… json`

Having this configuration:

```
!
interface r1-eth0
 ip address 10.0.0.1/30
 ip router isis 1
 isis priority 44 level-1
 isis priority 88 level-2
 isis csnp-interval 90 level-1
 isis csnp-interval 99 level-2
 isis psnp-interval 70 level-1
 isis psnp-interval 50 level-2
 isis hello-interval level-1 120
 isis hello-interval level-2 150

!
interface r1-eth1
 ip address 10.0.0.10/30
 ip router isis 1
!
interface lo
 ip address 192.0.2.1/32
 ip router isis 1
 isis passive
!
router isis 1
net 49.0000.0000.0000.0001.00
 metric-style wide
```

Produces:

```
{
 "areas":[
   {
     "area":"1",
     "circuits":[
       {
         "circuit":2,
         "interface":{
           "name":"r1-eth0",
           "state":"Up",
           "is-passive":"active",
           "circuit-id":"0x2",
           "type":"lan",
           "level":"L1L2",
           "snpa":"6e28.9c92.da5e",
           "levels":[
             {
               "level":"L1",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120,
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90,
               "psnp-interval":70,
               "lan":{
                 "priority":44,
                 "is-dis":"no"
               }
             },
             {
               "level":"L2",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120, <<<<<<<<<<<<<<<<<<
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90, <<<<<<<<<<<<<<<<<<
               "psnp-interval":70, <<<<<<<<<<<<<<<<<<
               "lan":{
                 "priority":44, <<<<<<<<<<<<<<<<<<
                 "is-dis":"no"
               }
             }
           ],
...
```

Fixes: 9fee4d4 ("isisd: Add json to show isis interface command.")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 360a0d6)
  • Loading branch information
ton31337 authored and mergify[bot] committed Jan 3, 2025
1 parent ff82618 commit 73c4eda
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,45 +1006,40 @@ void isis_circuit_print_json(struct isis_circuit *circuit,
circuit_t2string(level));
if (circuit->area->newmetric)
json_object_int_add(level_json, "metric",
circuit->te_metric[0]);
circuit->te_metric[level - 1]);
else
json_object_int_add(level_json, "metric",
circuit->metric[0]);
circuit->metric[level - 1]);
if (!circuit->is_passive) {
json_object_int_add(level_json,
"active-neighbors",
circuit->upadjcount[0]);
json_object_int_add(level_json,
"hello-interval",
circuit->hello_interval[0]);
json_object_int_add(level_json, "active-neighbors",
circuit->upadjcount[level - 1]);
json_object_int_add(level_json, "hello-interval",
circuit->hello_interval[level - 1]);
hold_json = json_object_new_object();
json_object_object_add(level_json, "holddown",
hold_json);
json_object_int_add(
hold_json, "count",
circuit->hello_multiplier[0]);
json_object_int_add(hold_json, "count",
circuit->hello_multiplier[level - 1]);
json_object_string_add(
hold_json, "pad",
isis_hello_padding2string(
circuit->pad_hellos));
json_object_int_add(level_json, "cnsp-interval",
circuit->csnp_interval[0]);
circuit->csnp_interval[level - 1]);
json_object_int_add(level_json, "psnp-interval",
circuit->psnp_interval[0]);
circuit->psnp_interval[level - 1]);
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
lan_prio_json =
json_object_new_object();
json_object_object_add(level_json,
"lan",
lan_prio_json);
json_object_int_add(
lan_prio_json, "priority",
circuit->priority[0]);
json_object_string_add(
lan_prio_json, "is-dis",
(circuit->u.bc.is_dr[0]
? "yes"
: "no"));
json_object_int_add(lan_prio_json, "priority",
circuit->priority[level - 1]);
json_object_string_add(lan_prio_json, "is-dis",
(circuit->u.bc.is_dr[level - 1]
? "yes"
: "no"));
}
}
json_object_array_add(levels_json, level_json);
Expand Down

0 comments on commit 73c4eda

Please sign in to comment.