Merge branch 'master' of https://github.com/axarriola/netbox-docker into axarriola-master

This commit is contained in:
Christian Mäder 2019-10-12 14:02:35 +02:00
commit 61c0a9b519
14 changed files with 15 additions and 18 deletions

View File

@ -1,8 +1,8 @@
#- device: server01
# enabled: true
# form_factor: Virtual
# type: Virtual
# name: to-server02
#- device: server02
# enabled: true
# form_factor: Virtual
# type: Virtual
# name: to-server01

View File

@ -1,11 +1,11 @@
#- address: 10.1.1.1/24
# device: server01
# interface: Loopback0
# interface: to-server02
# status: Active
# vrf: vrf1
#- address: 10.1.1.2/24
# device: server02
# interface: Vlan5
# interface: to-server01
# status: Active
#- address: 10.1.1.10/24
# description: reserved IP

View File

@ -1,19 +1,15 @@
# # Allowed rpc clients are: juniper-junos, cisco-ios, opengear
# - name: Platform 1
# slug: platform-1
# manufacturer: Manufacturer 1
# napalm_driver: driver1
# napalm_args: "{'arg1': 'value1', 'arg2': 'value2'}"
# rpc_client: juniper-junos
# - name: Platform 2
# slug: platform-2
# manufacturer: Manufacturer 2
# napalm_driver: driver2
# napalm_args: "{'arg1': 'value1', 'arg2': 'value2'}"
# rpc_client: opengear
# - name: Platform 3
# slug: platform-3
# manufacturer: NoName
# napalm_driver: driver3
# napalm_args: "{'arg1': 'value1', 'arg2': 'value2'}"
# rpc_client: juniper-junos

View File

@ -12,7 +12,6 @@
# vlan: vlan2
# is_pool: true
# vrf: vrf2
# tenant: tenant2
#- description: ipv6 prefix1
# prefix: fd00:ccdd:a000:1::/64
# site: AMS 2

View File

@ -3,10 +3,10 @@
# mac_address: 00:77:77:77:77:77
# mtu: 1500
# name: Network Interface 1
# virtual_machine: virtual_machine1
# virtual_machine: virtual machine 1
#- description: Network Interface 2
# enabled: true
# mac_address: 00:55:55:55:55:55
# mtu: 1500
# name: Network Interface 2
# virtual_machine: virtual_machine1
# virtual_machine: virtual machine 1

View File

@ -1,6 +1,6 @@
#- name: VLAN group 1
# site: AMS 1
# slug: vlan-group-2
# slug: vlan-group-1
#- name: VLAN group 2
# site: AMS 1
# slug: vlan-group-2

View File

@ -6,4 +6,3 @@
# name: vrf2
# rd: "6500:6500"
# tenant: tenant2
# tenant_group: Tenant Group 2

View File

@ -27,7 +27,6 @@ with file.open('r') as stream:
group_permissions = group_details.get('permissions', [])
if group_permissions:
group.permissions.clear()
print("Permissions:", group.permissions.all())
for permission_codename in group_details.get('permissions', []):
for permission in Permission.objects.filter(codename=permission_codename):
group.permissions.add(permission)

View File

@ -39,6 +39,7 @@ with file.open('r') as stream:
for vlan_status in VLAN_STATUS_CHOICES:
if params['status'] in vlan_status:
params['status'] = vlan_status[0]
break
vlan, created = VLAN.objects.get_or_create(**params)

View File

@ -42,6 +42,7 @@ with file.open('r') as stream:
for prefix_status in PREFIX_STATUS_CHOICES:
if params['status'] in prefix_status:
params['status'] = prefix_status[0]
break
prefix, created = Prefix.objects.get_or_create(**params)

View File

@ -47,6 +47,7 @@ with file.open('r') as stream:
for vm_status in VM_STATUS_CHOICES:
if params['status'] in vm_status:
params['status'] = vm_status[0]
break
virtual_machine, created = VirtualMachine.objects.get_or_create(**params)

View File

@ -28,11 +28,11 @@ with file.open('r') as stream:
params[assoc] = model.objects.get(**query)
if 'form_factor' in params:
if 'type' in params:
for outer_list in IFACE_TYPE_CHOICES:
for ffactor_choices in outer_list[1]:
if params['form_factor'] in ffactor_choices:
params['form_factor'] = ffactor_choices[0]
for type_choices in outer_list[1]:
if params['type'] in type_choices:
params['type'] = type_choices[0]
break
else:
continue

View File

@ -53,6 +53,7 @@ with file.open('r') as stream:
for ip_status in IPADDRESS_STATUS_CHOICES:
if params['status'] in ip_status:
params['status'] = ip_status[0]
break
ip_address, created = IPAddress.objects.get_or_create(**params)