jeffsw / rpkilog

rpkilog.com web site and tools
MIT License
6 stars 0 forks source link

support routinator VRP output #29

Open jeffsw opened 10 months ago

jeffsw commented 10 months ago

Our Roa class accepts input in the data structure supplied by rpki-client. We can support the jsonext format from routinator easily with a wrapper. However, a slight refactor of our Roa class might be convenient at the same time.

ROAs from routinator look like below (doc link). I don't know if the source array really may contain multiple ROA references but it doesn't seem like they'd put that in the file format for no reason. This needs more investigation before implementation.

{
    "asn": "AS211321",
    "prefix": "185.49.142.0/24",
    "maxLength": 24,
    "source": [{
        "type": "roa",
        "tal": "ripe",
        "validity": {
            "notBefore": "2022-07-25T20:47:37Z",
            "notAfter": "2023-07-24T20:52:37Z"
        },
        "chainValidity": {
            "notBefore": "2022-07-25T20:47:37Z",
            "notAfter": "2023-02-24T12:31:01Z"
        },
        "uri": "rsync://testbed.krill.cloud/repo/local-testbed-child/0/3138352e34392e3134322e302f32342d3234203d3e20323131333231.roa"
    }]
}

Our constructor is called like this: Roa(**roa_dict_from_json_vrp_file) and its argument declaration is:

    def __init__(
        self,
        asn:int,
        prefix:netaddr.IPNetwork,
        maxLength:int,
        ta:str,
        expires:int=0,
        source_host:str=None,
        source_time:datetime=None,
    ):

The rpki-client data is in a simpler format; it's what our Roa class's constructor was based on:

{ "asn": 13335, "prefix": "1.0.0.0/24", "maxLength": 24, "ta": "apnic", "expires": 1697206723 }