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 #- device: server01
# enabled: true # enabled: true
# form_factor: Virtual # type: Virtual
# name: to-server02 # name: to-server02
#- device: server02 #- device: server02
# enabled: true # enabled: true
# form_factor: Virtual # type: Virtual
# name: to-server01 # name: to-server01

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,4 +6,3 @@
# name: vrf2 # name: vrf2
# rd: "6500:6500" # rd: "6500:6500"
# tenant: tenant2 # 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', []) group_permissions = group_details.get('permissions', [])
if group_permissions: if group_permissions:
group.permissions.clear() group.permissions.clear()
print("Permissions:", group.permissions.all())
for permission_codename in group_details.get('permissions', []): for permission_codename in group_details.get('permissions', []):
for permission in Permission.objects.filter(codename=permission_codename): for permission in Permission.objects.filter(codename=permission_codename):
group.permissions.add(permission) group.permissions.add(permission)

View File

@ -39,6 +39,7 @@ with file.open('r') as stream:
for vlan_status in VLAN_STATUS_CHOICES: for vlan_status in VLAN_STATUS_CHOICES:
if params['status'] in vlan_status: if params['status'] in vlan_status:
params['status'] = vlan_status[0] params['status'] = vlan_status[0]
break
vlan, created = VLAN.objects.get_or_create(**params) 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: for prefix_status in PREFIX_STATUS_CHOICES:
if params['status'] in prefix_status: if params['status'] in prefix_status:
params['status'] = prefix_status[0] params['status'] = prefix_status[0]
break
prefix, created = Prefix.objects.get_or_create(**params) 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: for vm_status in VM_STATUS_CHOICES:
if params['status'] in vm_status: if params['status'] in vm_status:
params['status'] = vm_status[0] params['status'] = vm_status[0]
break
virtual_machine, created = VirtualMachine.objects.get_or_create(**params) 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) params[assoc] = model.objects.get(**query)
if 'form_factor' in params: if 'type' in params:
for outer_list in IFACE_TYPE_CHOICES: for outer_list in IFACE_TYPE_CHOICES:
for ffactor_choices in outer_list[1]: for type_choices in outer_list[1]:
if params['form_factor'] in ffactor_choices: if params['type'] in type_choices:
params['form_factor'] = ffactor_choices[0] params['type'] = type_choices[0]
break break
else: else:
continue continue

View File

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