Verified Commit 092ed407 authored by Adrian Schollmeyer's avatar Adrian Schollmeyer
Browse files

Make scripts compatible with new NetBox


Signed-off-by: Adrian Schollmeyer's avatarNexAdn <nex@nexadn.de>
parent ec8e142a
......@@ -20,9 +20,11 @@ class AddArubaAp(Script):
)
ap_type = ObjectVar(
label = "AP-Typ",
queryset = DeviceType.objects.filter(
tags__name__in = [ "aruba-ap" ]
)
model = DeviceType,
display_field = "model",
query_params = {
"tag": [ "aruba-ap" ]
}
)
ap_name = StringVar(
label = "AP-Name",
......@@ -45,7 +47,7 @@ class AddArubaAp(Script):
"^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$"
)
def run(self, data):
def run(self, data, commit):
site = data['ap_block']
ap_role = DeviceRole.objects.get(name='WLAN-AP')
......@@ -83,7 +85,7 @@ class AddArubaAp(Script):
self.log_success("Assigned primary IP to AP")
def ap_type_requires_uplink_passthrough_bridge(self, ap_type):
if (ap_type.model == "AP-205H"):
if (ap_type.slug == "ap-205h"):
return True
return False
......
#!/usr/bin/env python3
from dcim.models import *
......@@ -26,7 +25,7 @@ class EquivPatch(Script):
)
)
def run(self, data):
def run(self, data, commit):
patchpanel_a = data["patchpanel_a"]
patchpanel_b = data["patchpanel_b"]
......
......@@ -29,7 +29,7 @@ class AddSwitch(Script):
description = "Lowest unit occupied by the switch",
min_value = 1
)
name = StringVar(
switch_name = StringVar(
label = "Name",
description = "Form: [BLOCK]-switch-[NUM]",
regex = "^([a-z]+)-switch-([0-9]+)$"
......@@ -47,9 +47,9 @@ class AddSwitch(Script):
required = False
)
def run(self, data):
def run(self, data, commit):
block = data["block"]
name = data["name"]
name = data["switch_name"]
n_modules = data["n_modules"]
rack = data["rack"]
rack_position = data["rack_pos"]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment