aboutsummaryrefslogtreecommitdiffstats
path: root/tools/netbox/scripts/create-switch/create-switch.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/netbox/scripts/create-switch/create-switch.py')
-rw-r--r--tools/netbox/scripts/create-switch/create-switch.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/netbox/scripts/create-switch/create-switch.py b/tools/netbox/scripts/create-switch/create-switch.py
index 23b7250..36477a2 100644
--- a/tools/netbox/scripts/create-switch/create-switch.py
+++ b/tools/netbox/scripts/create-switch/create-switch.py
@@ -164,6 +164,9 @@ class CreateSwitch(Script):
)
mgmt_vlan_interface.ip_addresses.add(v4_mgmt_addr)
mgmt_vlan_interface.ip_addresses.add(v6_mgmt_addr)
+ switch.primary_ip4 = v4_mgmt_addr
+ switch.primary_ip6 = v6_mgmt_addr
+ switch.save()
num_uplinks = len(data['destination_interfaces'])
interfaces = list(Interface.objects.filter(device=switch).exclude(type=InterfaceTypeChoices.TYPE_VIRTUAL).exclude(type=InterfaceTypeChoices.TYPE_LAG))