Skip to content

Commit 8d8b9a1

Browse files
committed
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.
1 parent 4a58676 commit 8d8b9a1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

initializers/vlans.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
## Possible Choices:
2+
## status:
3+
## - active
4+
## - reserved
5+
## - deprecated
6+
##
7+
## Examples:
8+
19
# - name: vlan1
210
# site: AMS 1
3-
# status: Active
11+
# status: active
412
# vid: 5
513
# role: Main Management
614
# description: VLAN 5 for MGMT
715
# - group: VLAN group 2
816
# name: vlan2
917
# site: AMS 1
10-
# status: Active
18+
# status: active
1119
# vid: 1300

startup_scripts/210_vlans.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from dcim.models import Site
22
from ipam.models import VLAN, VLANGroup, Role
3-
from ipam.constants import VLAN_STATUS_CHOICES
43
from tenancy.models import Tenant, TenantGroup
54
from extras.models import CustomField, CustomFieldValue
65
from ruamel.yaml import YAML
@@ -35,12 +34,6 @@
3534

3635
params[assoc] = model.objects.get(**query)
3736

38-
if 'status' in params:
39-
for vlan_status in VLAN_STATUS_CHOICES:
40-
if params['status'] in vlan_status:
41-
params['status'] = vlan_status[0]
42-
break
43-
4437
vlan, created = VLAN.objects.get_or_create(**params)
4538

4639
if created:

0 commit comments

Comments
 (0)