aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkimandre1 <kimandre.tangnes@gmail.com>2025-03-16 14:43:51 +0100
committerkimandre1 <kimandre.tangnes@gmail.com>2025-03-16 14:43:51 +0100
commitea9631db25057e01e425d360320916e6a760121e (patch)
treec5649fd591ed13491510bcecab1a852370a1e684 /tools
parent5045ac6266400b97794ecf22c274c84dc9d7cde7 (diff)
fix prefix error when recieving mutiple prefixes
Diffstat (limited to 'tools')
-rw-r--r--tools/netbox/scripts/create-switch/create-switch-tg25.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/netbox/scripts/create-switch/create-switch-tg25.py b/tools/netbox/scripts/create-switch/create-switch-tg25.py
index ef09c8c..cd37bdd 100644
--- a/tools/netbox/scripts/create-switch/create-switch-tg25.py
+++ b/tools/netbox/scripts/create-switch/create-switch-tg25.py
@@ -48,13 +48,18 @@ FABRIC_CLIENTS_ROLE = Role.objects.get(slug='clients')
# VRF for fabric clients
FABRIC_CLIENTS_VRF = VRF.objects.get(name='CLIENTS')
+# Client and MGMT VRF object
+CLIENTS_VRF = VRF.objects.filter(name="CLIENTS")
+JUNIPER_MGMT_VRF = VRF.objects.filter(name="JUNIPER_MGMT")
+
+
# Client networks allocated from here
-FABRIC_V4_CLIENTS_PREFIX = Prefix.objects.get(prefix='10.25.0.0/16')
-FABRIC_V6_CLIENTS_PREFIX = Prefix.objects.get(prefix='2a06:5844:e::/48')
+FABRIC_V4_CLIENTS_PREFIX = Prefix.objects.filter(prefix='10.25.0.0/16', vrf__in=CLIENTS_VRF)
+FABRIC_V6_CLIENTS_PREFIX = Prefix.objects.filter(prefix='2a06:5844:e::/48', vrf__in=CLIENTS_VRF)
# Switch mgmt allocates from here
-FABRIC_V4_JUNIPER_MGMT_PREFIX = Prefix.objects.get(prefix='185.110.149.0/25')
-FABRIC_V6_JUNIPER_MGMT_PREFIX = Prefix.objects.get(prefix='2a06:5841:f::/64')
+FABRIC_V4_JUNIPER_MGMT_PREFIX = Prefix.objects.filter(prefix='185.110.149.0/25', vrf__in=JUNIPER_MGMT_VRF)
+FABRIC_V6_JUNIPER_MGMT_PREFIX = Prefix.objects.filter(prefix='2a06:5841:f::/64', vrf__in=JUNIPER_MGMT_VRF)
## TODO support 1G uplinks on EX3300
UPLINK_PORTS = {