commit e1198320278285d59380df8539c28a24e14a6559 Author: Nico Schottelius Date: Thu Mar 17 12:37:05 2022 +0100 initial commit Signed-off-by: Nico Schottelius diff --git a/ripe.py b/ripe.py new file mode 100644 index 0000000..afcbfd7 --- /dev/null +++ b/ripe.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +import json + + + +base_object = { + "objects": { + "object": [ + { + "source": { + "id": "RIPE" + }, + "attributes": { + "attribute": [ + { + "name": "mnt-by", + "value": "mnt-ungleich" + }, + { + "name": "source", + "value": "RIPE" + } + ] + } + } + ] + } +} + + + +def gen_route6(route6, asn): + obj = base_object.copy() + + asn_obj = { 'name': 'origin', 'value': asn } + route6_obj = { 'name': 'origin', 'value': asn } + + obj['objects']['object'][0]['attributes']['attribute'].append(asn_obj) + obj['objects']['object'][0]['attributes']['attribute'].append(route6_obj) + + return obj + +def to_json(obj): + return json.dumps(obj, indent = 4) + +if __name__ == '__main__': + for route6 in [ "2a0a:e5c0::/48" ]: + print(to_json(gen_route6(route6, "AS213081")))