Update VLAN Initializer for Netbox 2.7
The VLAN database model has changed in Netbox 2.7. Therefore the initializer code, that was used before, broke. As a user, you will need to update your vlans.yml file as follows: - Make sure the status is spelled lowercase. See the diff of this commit for further information how this is meant.
This commit is contained in:
parent
4a58676647
commit
8d8b9a157e
@ -1,11 +1,19 @@
|
||||
## Possible Choices:
|
||||
## status:
|
||||
## - active
|
||||
## - reserved
|
||||
## - deprecated
|
||||
##
|
||||
## Examples:
|
||||
|
||||
# - name: vlan1
|
||||
# site: AMS 1
|
||||
# status: Active
|
||||
# status: active
|
||||
# vid: 5
|
||||
# role: Main Management
|
||||
# description: VLAN 5 for MGMT
|
||||
# - group: VLAN group 2
|
||||
# name: vlan2
|
||||
# site: AMS 1
|
||||
# status: Active
|
||||
# status: active
|
||||
# vid: 1300
|
||||
|
@ -1,6 +1,5 @@
|
||||
from dcim.models import Site
|
||||
from ipam.models import VLAN, VLANGroup, Role
|
||||
from ipam.constants import VLAN_STATUS_CHOICES
|
||||
from tenancy.models import Tenant, TenantGroup
|
||||
from extras.models import CustomField, CustomFieldValue
|
||||
from ruamel.yaml import YAML
|
||||
@ -35,12 +34,6 @@ with file.open('r') as stream:
|
||||
|
||||
params[assoc] = model.objects.get(**query)
|
||||
|
||||
if 'status' in params:
|
||||
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)
|
||||
|
||||
if created:
|
||||
|
Loading…
Reference in New Issue
Block a user