bird-lg icon indicating copy to clipboard operation
bird-lg copied to clipboard

Add JSON API on bird-lg

Open beufanet opened this issue 6 years ago • 3 comments

Allow to show route as for "prefix_detail" route but as JSON value

Example : https://[[LG_MASTER]]/api/[[LG_NODES_LIST]]/ipv4?q=8.8.8.8

Return :

{

"[[LG_NODES_LIST]]": {
    "result": [
        {
            "origin": "IGP",
            "med": 0,
            "via": "1.1.1.2",
            "last": "2018-07-10",
            "network": "8.8.8.0",
            "localPref": 350,
            "asPath": "15169",
            "originatorId": {
                "addr": "4.4.4.4",
                "reverse": "router.fr.eu"
            },
            "community": [
                "65000:65000"
            ],
            "clusterList": [
                "9.89.6.6",
                "9.89.8.8"
            ],
            "netmask": "24",
            "fromPeer": "bird",
            "from": "4.4.4.4",
            "nextHop": {
                "addr": "1.1.1.2",
                "reverse": "google.fr.eu"
            },
            "ipType": "IPv4"
        }
    ]
}

}

beufanet avatar Jul 16 '18 12:07 beufanet

Thanks for this contribution!

I have a few questions:

  • what is the mipv4/mipv6 stuff you add? It seems unrelated to JSON output
  • is the JSON structure standardized / common in some way?

There have been upstream discussions about structured output in Bird: https://bird.network.cz/pipermail/bird-users/2017-June/011356.html And a patch from Netflix enabling JSON output directly in Bird: https://bird.network.cz/pipermail/bird-users/2018-March/012088.html If Bird ever gains structure output, it would make sense to use the same format.

There's also Periscope from CAIDA, that parses many kind of looking glasses and outputs JSON: https://www.caida.org/tools/utilities/looking-glass-api/ https://www.nanog.org/sites/default/files/20161018_Giotsas_Periscope_Standardizing_And_v1.pdf

zorun avatar Aug 22 '18 10:08 zorun

Thanks for your feedback. mipv4 / mipv6 are here to add the reverse on links for whois. I can split into another pull/merge request

For structured output Bird, I would love it also ;) But waiting for this, perhaps we can rework a bit the output format and include a better patch ?

beufanet avatar Aug 23 '18 07:08 beufanet

Sorry for not being more reactive (see #65)

Having an API is definitely necessary for bird-lg, but it's also a big change with lots of implications. If you are still interested in this, I think it's best to discuss the design in #84

zorun avatar May 10 '21 21:05 zorun