Skip to content

Commit

Permalink
Merge pull request #429 from globocom/develop
Browse files Browse the repository at this point in the history
changed variables local
  • Loading branch information
renan-lopes-rodrigues authored Jul 25, 2024
2 parents a7ff6d6 + 3179767 commit 89059a7
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions networkapi/api_rack/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,13 @@ def spine_provision(self, rack, equips):
if spine_num == 1:
# variablestochangespine1["DESCRIPTION1CONNECT"] = equips_sorted[0].get("nome")
# variablestochangespine1["DESCRIPTION2CONNECT"] = equips_sorted[1].get("nome")
for lf in equips_sorted[:2]:
interface_counter = 1
for iface in lf.get("interfaces"):
if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 1:
variablestochangespine1["SINGLE1{}INT".format(interface_counter)] = iface.get("interface")
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
interface_counter += 1
# interface_counter = 1
# for lf in equips_sorted[:2]:
# for iface in lf.get("interfaces"):
# if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 1:
# variablestochangespine1["SINGLE1{}INT".format(interface_counter)] = iface.get("interface")
# # variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
# interface_counter += 1

variablestochangespine1["VLANBORDA2LEAF"] = str(vlanBO[spine_num])
variablestochangespine1["VLANBORDA2CACHOSLEAF"] = str(vlanBOCA[spine_num])
Expand All @@ -462,13 +462,13 @@ def spine_provision(self, rack, equips):
# variablestochangespine1["IPNEIGHLEAF2IPV4"] = str(IPLEAFipv4[numero_rack][spine_num])
# variablestochangespine1["IPNEIGHLEAF2IPV6"] = str(IPLEAFipv6[numero_rack][spine_num])
elif spine_num == 2:
for lf in equips_sorted[:2]:
interface_counter = 1
for iface in lf.get("interfaces"):
if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 2:
variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
interface_counter += 1
# interface_counter = 1
# for lf in equips_sorted[:2]:
# for iface in lf.get("interfaces"):
# if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 2:
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
# # variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
# interface_counter += 1
variablestochangespine1["VLANBORDA2LEAF"] = str(vlanBO[spine_num - 2])
variablestochangespine1["VLANBORDA2CACHOSLEAF"] = str(vlanBOCA[spine_num - 2])
variablestochangespine1["VLANBORDA2CACHOSB"] = str(vlanBOCAB[spine_num - 2])
Expand Down Expand Up @@ -500,7 +500,16 @@ def spine_provision(self, rack, equips):
# # "DESCRIPTION{}CONNECT"

# e_counter += 1

interface_counter = 1
for lf in equips_sorted[:2]:
for iface in lf.get("interfaces"):
if iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 2:
variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
elif iface.get("nome")[:3] == self.spine_prefix and iface.get("nome")[-1] == 1:
variablestochangespine1["SINGLE1{}INT".format(interface_counter)] = iface.get("interface")
# variablestochangespine1["SINGLE2{}INT".format(interface_counter)] = iface.get("interface")
interface_counter += 1
variablestochangespine1["DESCRIPTION1CONNECT"] = equips_sorted[1].get("nome")
variablestochangespine1["DESCRIPTION2CONNECT"] = equips_sorted[0].get("nome")
#### END to Berrini Block #####
Expand Down

0 comments on commit 89059a7

Please sign in to comment.