initial commit

Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
Nico Schottelius 2022-03-17 12:37:05 +01:00
commit e119832027
1 changed files with 49 additions and 0 deletions

49
ripe.py Normal file
View File

@ -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")))