rework netbox-dump script and routeros bundle for better usability
This commit is contained in:
parent
c47b412cf3
commit
d1f182607d
3 changed files with 275 additions and 191 deletions
|
@ -26,7 +26,7 @@ defaults = {
|
|||
'routeros/vlans',
|
||||
)
|
||||
def get_ports_from_netbox_dump(metadata):
|
||||
with open(join(repo.path, 'configs', f'netbox_device_{node.name}.json')) as f:
|
||||
with open(join(repo.path, 'configs', 'netbox', f'{node.name}.json')) as f:
|
||||
netbox = load(f)
|
||||
|
||||
ips = {}
|
||||
|
@ -45,7 +45,7 @@ def get_ports_from_netbox_dump(metadata):
|
|||
for ip in conf['ips']:
|
||||
ips[ip] = {'interface': port}
|
||||
|
||||
if conf['type'] == 'VIRTUAL':
|
||||
if conf['type'].lower() == 'virtual':
|
||||
# these are VLAN interfaces (for management IPs)
|
||||
if conf['ips']:
|
||||
# this makes management services available in the VLAN
|
||||
|
@ -77,6 +77,8 @@ def get_ports_from_netbox_dump(metadata):
|
|||
if conf.get('ips', []):
|
||||
ports[port]['ips'] = set(conf['ips'])
|
||||
if conf['type'] in (
|
||||
'1000base-t',
|
||||
'10gbase-x-sfpp',
|
||||
'A_1000BASE_T',
|
||||
'A_10GBASE_X_SFPP',
|
||||
):
|
||||
|
@ -90,7 +92,7 @@ def get_ports_from_netbox_dump(metadata):
|
|||
|
||||
# tagged
|
||||
|
||||
if conf['mode'] == 'TAGGED_ALL':
|
||||
if conf['mode'] in ('TAGGED_ALL', 'tagged-all'):
|
||||
tagged = set(vlans.keys()) - {conf['untagged_vlan']}
|
||||
else:
|
||||
tagged = conf['tagged_vlans']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue