diff options
Diffstat (limited to 'tools/koblingsplan/koblingsplan-to-netbox.py')
-rw-r--r-- | tools/koblingsplan/koblingsplan-to-netbox.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/koblingsplan/koblingsplan-to-netbox.py b/tools/koblingsplan/koblingsplan-to-netbox.py index 33fbac6..48c1c24 100644 --- a/tools/koblingsplan/koblingsplan-to-netbox.py +++ b/tools/koblingsplan/koblingsplan-to-netbox.py @@ -14,9 +14,14 @@ with open('tg23-koblingsplan.yml', 'r') as f: koblingsplan = yaml.safe_load(f.read()) def device_from_edge(edge): + role = edge['type'] + if role == 'Distro': + role = 'Distribution Switch' + if role == 'Edge': + role = 'Access Switch' return { 'name': edge['node'], - 'role': edge['type'], + 'role': role, 'model': edge['model'], } @@ -38,7 +43,7 @@ def get_or_create_device(device): print(f"❌ Device role {device['role']} is missing from NetBox. Please add it manually.") # This could probably be done programatically. exit(1) - default_site = nb.dcim.sites.get(name='ringen') + default_site = nb.dcim.sites.get(name='Unknown') r = nb.dcim.devices.create( name=device['name'], device_role=device_role.id, |