From 3aff25d7f35518153987c47a8740eece30addfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Solbj=C3=B8rg?= Date: Mon, 6 Mar 2023 23:27:29 +0100 Subject: feat(create-switch): Set primary ip address --- tools/netbox/scripts/create-switch/create-switch.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/netbox/scripts/create-switch/create-switch.py') 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)) -- cgit v1.2.3