Skip to content

Commit 16fe748

Browse files
testing variales
1 parent ba9fda4 commit 16fe748

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

networkapi/api_rack/provision.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def spine_provision(self, rack, equips):
426426

427427
counter = 1
428428
for ipv4 in IPSPINEipv4[numero_rack]:
429-
variablestochangespine1["IPSPINE{}IPV4".format(counter)] = str(ipv6)
429+
variablestochangespine1["IPSPINE{}IPV4".format(counter)] = str(ipv4)
430430
variablestochangespine1["IPNEIGHLEAF{}IPV4".format(counter)] = str(IPLEAFipv4[numero_rack][counter -1])
431431

432432
counter += 1
@@ -441,16 +441,18 @@ def spine_provision(self, rack, equips):
441441
variablestochangespine1["VLANBORDA2CACHOSLEAF"] = str(vlanBOCA[spine_num - 2])
442442
variablestochangespine1["VLANBORDA2CACHOSB"] = str(vlanBOCAB[spine_num - 2])
443443
variablestochangespine1["VLANFE2LEAF"] = str(vlanFE[spine_num - 2])
444-
counter = 1
444+
counter = 0
445445
for ipv6 in IPSPINEipv6[numero_rack]:
446-
variablestochangespine1["IPSPINE{}IPV6".format(counter)] = str(ipv6)
447-
variablestochangespine1["IPNEIGHLEAF{}IPV6".format(counter)] = str(IPLEAFipv6[numero_rack][counter - 1])
446+
if spine_num + counter < len(IPLEAFipv6[numero_rack]):
447+
variablestochangespine1["IPSPINE{}IPV6".format(counter + 1)] = str(IPSPINEipv6[numero_rack][counter + spine_num])
448+
variablestochangespine1["IPNEIGHLEAF{}IPV6".format(counter + 1)] = str(IPLEAFipv6[numero_rack][counter + spine_num])
448449
counter += 1
449450

450-
counter = 1
451+
counter = 0
451452
for ipv4 in IPSPINEipv4[numero_rack]:
452-
variablestochangespine1["IPSPINE{}IPV4".format(counter)] = str(ipv6)
453-
variablestochangespine1["IPNEIGHLEAF{}IPV4".format(counter)] = str(IPLEAFipv4[numero_rack][counter - 1])
453+
if spine_num + counter < len(IPLEAFipv4[numero_rack]):
454+
variablestochangespine1["IPSPINE{}IPV4".format(counter + 1)] = str(IPSPINEipv4[numero_rack][counter + spine_num])
455+
variablestochangespine1["IPNEIGHLEAF{}IPV4".format(counter + 1)] = str(IPLEAFipv4[numero_rack][counter + spine_num])
454456

455457

456458
counter += 1

0 commit comments

Comments
 (0)