diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-12-30 09:31:44 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-12-30 09:31:44 +0100 |
commit | 360a0d6f4ca68fda0eb5d64a8633018a3b5a4a1d (patch) | |
tree | 8625475ae2fd7d71e296c027a53af32b2584c46d | |
parent | Merge pull request #17720 from jvoss/srv6_cli (diff) | |
download | frr-360a0d6f4ca68fda0eb5d64a8633018a3b5a4a1d.tar.xz frr-360a0d6f4ca68fda0eb5d64a8633018a3b5a4a1d.zip |
isisd: Show correct level information for `show isis interface detail 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: 9fee4d4c6038ef6b14e9f509d6b04d189660c4cd ("isisd: Add json to show isis interface command.")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
-rw-r--r-- | isisd/isis_circuit.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 9a967bc1e..9ea2cfd0a 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -1008,45 +1008,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); |