aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorslinderud <simen.linderud@gmail.com>2023-04-01 11:08:30 +0200
committerHåkon Solbjørg <hakon@solbj.org>2023-04-01 11:10:48 +0200
commitc7beda69ca759f0aaa4620bdc39ad58b44c605ca (patch)
tree00f1a0cb76404295182c2bd8d752bca5b48c4199 /tools
parentb95d3500b9e2b604034b7a6161d0b8dfb6f81c12 (diff)
Fixed uplinks
Diffstat (limited to 'tools')
-rw-r--r--tools/netbox/scripts/create-switch/create-switch.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/netbox/scripts/create-switch/create-switch.py b/tools/netbox/scripts/create-switch/create-switch.py
index 7537847..7af8523 100644
--- a/tools/netbox/scripts/create-switch/create-switch.py
+++ b/tools/netbox/scripts/create-switch/create-switch.py
@@ -407,11 +407,14 @@ class CreateSwitch(Script):
if len(interfaces) < 1:
raise AbortScript(f"You chose a device type without any {data['uplink_type']} interfaces! Pick another model :)")
interface_type = ContentType.objects.get_for_model(Interface)
+
+ # Ask Håkon about this, idfk
for uplink_num in range(0, num_uplinks):
# mark last ports as uplinks
- a_interface = data['destination_interfaces'][::-1][uplink_num]
- b_interface = interfaces[(uplink_num * -1) -1]
-
+ a_interface = data['destination_interfaces'][uplink_num]
+ # Ask Håkon ESPECIALLY about this madness
+ b_interface = interfaces[::-1][0:4][::-1][uplink_num]
+ self.log_debug(f'a_interface: {a_interface}, b_interface: {b_interface}')
# Fix Descriptions
a_interface.description = f'G: {switch.name} (ae0)'
b_interface.description = f"G: {data['destination_device'].name} (ae0)"