Skip to content

Commit a7ff6d6

Browse files
Merge pull request #428 from globocom/develop
fix variable
2 parents 2651a8c + 902cece commit a7ff6d6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

networkapi/api_rack/provision.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ def spine_provision(self, rack, equips):
429429
if spine_num == 1:
430430
# variablestochangespine1["DESCRIPTION1CONNECT"] = equips_sorted[0].get("nome")
431431
# variablestochangespine1["DESCRIPTION2CONNECT"] = equips_sorted[1].get("nome")
432+
for lf in equips_sorted[:2]:
433+
interface_counter = 1
434+
for iface in lf.get("interfaces"):
435+
if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 1:
436+
variablestochangespine1["SINGLE1{}INT".format(interface_counter)] = iface.get("interface")
437+
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
438+
interface_counter += 1
432439

433440
variablestochangespine1["VLANBORDA2LEAF"] = str(vlanBO[spine_num])
434441
variablestochangespine1["VLANBORDA2CACHOSLEAF"] = str(vlanBOCA[spine_num])
@@ -455,6 +462,13 @@ def spine_provision(self, rack, equips):
455462
# variablestochangespine1["IPNEIGHLEAF2IPV4"] = str(IPLEAFipv4[numero_rack][spine_num])
456463
# variablestochangespine1["IPNEIGHLEAF2IPV6"] = str(IPLEAFipv6[numero_rack][spine_num])
457464
elif spine_num == 2:
465+
for lf in equips_sorted[:2]:
466+
interface_counter = 1
467+
for iface in lf.get("interfaces"):
468+
if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 2:
469+
variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
470+
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
471+
interface_counter += 1
458472
variablestochangespine1["VLANBORDA2LEAF"] = str(vlanBO[spine_num - 2])
459473
variablestochangespine1["VLANBORDA2CACHOSLEAF"] = str(vlanBOCA[spine_num - 2])
460474
variablestochangespine1["VLANBORDA2CACHOSB"] = str(vlanBOCAB[spine_num - 2])
@@ -486,11 +500,7 @@ def spine_provision(self, rack, equips):
486500
# # "DESCRIPTION{}CONNECT"
487501

488502
# e_counter += 1
489-
interface_counter = 1
490-
for iface in equip.get("interfaces"):
491-
variablestochangespine1["SINGLE1{}INT".format(interface_counter)] = iface.get("interface")
492-
variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
493-
interface_counter += 1
503+
494504
variablestochangespine1["DESCRIPTION1CONNECT"] = equips_sorted[1].get("nome")
495505
variablestochangespine1["DESCRIPTION2CONNECT"] = equips_sorted[0].get("nome")
496506
#### END to Berrini Block #####

0 commit comments

Comments
 (0)