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

Add JSON API on bird-lg #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add JSON API on bird-lg #35

wants to merge 2 commits into from

Conversation

beufanet
Copy link

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"
        }
    ]
}

}

Fabien VINCENT added 2 commits July 16, 2018 12:51
…ow route 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"
            }
        ]
    }

}
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"
            }
        ]
    }

}
@zorun
Copy link
Collaborator

zorun commented Aug 22, 2018

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

@beufanet
Copy link
Author

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 ?

@zorun
Copy link
Collaborator

zorun commented May 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants