]> git.puffer.fish Git - matthieu/frr.git/commit
ospfd: Fix inconsistency in LSDB JSON output
authorRenato Westphal <renato@opensourcerouting.org>
Sat, 18 Mar 2023 01:48:59 +0000 (22:48 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 18 Mar 2023 02:00:31 +0000 (23:00 -0300)
commitf54232d0b2f5a54d4ec53ce2efff4877c15cc8d1
tree6ab751f7f20c12d9894148c43ba980ba2d5200e6
parenta08f41b95b7af2a5803d1cd18c80e361fa24c66d
ospfd: Fix inconsistency in LSDB JSON output

As it can be seen below, the LSDB JSON output varies depending
whether a filter option is specified or not (e.g. "adv-router",
"self-originate"):

> show ip ospf database router json
{
  "routerId":"3.3.3.3",
  "routerLinkStates":{
    "areas":{
      "0.0.0.0":[
        {
          "lsaAge":175,
          "options":"*|-|-|-|-|-|E|-",
          [snip]

> show ip ospf database router adv-router 2.2.2.2 json
{
  "routerId":"3.3.3.3",
  "Router Link States":{
    "0.0.0.0":{
      "2.2.2.2":{
        "lsaAge":193,
        "options":"*|-|-|-|-|-|E|-",
        [snip]

This inconsistency is undesirable since it makes this data harder to
consume programmatically. Also, in the second output, "Router Link
States" is used as a JSON key, which doesn't conform to our JSON
guidelines (JSON keys need to be camelCased).

Make the required changes to ensure the first output structure is used,
regardless if any output filter is used or not.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ospfd/ospf_vty.c