Skip to content

Commit

Permalink
Merge pull request #399 from marcusgc/master
Browse files Browse the repository at this point in the history
Workaround bad dbtable - do not create prefix-lists for bgp route-maps
  • Loading branch information
renan-lopes-rodrigues authored Jul 23, 2024
2 parents 83ecc17 + 8fd248d commit f462837
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
10 changes: 6 additions & 4 deletions networkapi/api_neighbor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,12 @@ def deploy(self):
list_config_bgp=entry.list_config_bgp
)
if not eqpt_list_config:
EquipmentListConfig().create_v4({
'equipment': equipment.id,
'list_config_bgp': entry.list_config_bgp.id
})
self.log.debug('equipment id %s' % equipment.id)
self.log.debug('id_list_config_bgp %s' % entry.list_config_bgp.id)
# EquipmentListConfig().create_v4({
# 'equipment': equipment.id,
# 'list_config_bgp': entry.list_config_bgp.id
# })

def undeploy(self):
"""Undeploy NeighborV4."""
Expand Down
28 changes: 23 additions & 5 deletions networkapi/api_rack/rackenvironments.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ def spines_environment_save(self):
environment_spn_lf_list = list()
spines = int(self.rack.dcroom.spines)
fabric = self.rack.dcroom.name
rackname = self.rack.nome
grupoL3name = fabric+"_"+racknome

try:
id_grupo_l3 = models_env.GrupoL3().get_by_name(fabric).id
id_grupo_l3 = models_env.GrupoL3().get_by_name(grupoL3name).id
except:
grupo_l3_dict = models_env.GrupoL3()
grupo_l3_dict.nome = fabric
grupo_l3_dict.nome = grupoL3name
grupo_l3_dict.save()
id_grupo_l3 = grupo_l3_dict.id
pass
Expand Down Expand Up @@ -483,13 +485,29 @@ def manage_vlan_save(self):
def rack_environment_remove(self):
log.info("_remove_envs")

envs = models_env.Ambiente.objects.filter(dcroom=int(self.rack.dcroom.id),
envs_racks = models_env.Ambiente.objects.filter(dcroom=int(self.rack.dcroom.id),
grupo_l3__nome=str(self.rack.nome))

for env in envs:
log.debug("PROD RACK environments to be removed: %s. Total: %s" % (str(envs_racks), len(envs_racks)))

for env in envs_racks:
env.delete_v3()

log.debug("PROD RACK environments removed.")

envs_spines = models_env.Ambiente.objects.filter(dcroom=int(rack.dcroom.id),
grupo_l3__nome=str(rack.dcroom.name),
ambiente_logico__nome__in=["SPINE01LEAF",
"SPINE02LEAF",
"SPINE03LEAF",
"SPINE04LEAF"])

log.debug("PROD SPINELEAF environments to be removed: %s. Total: %s" % (str(envs_spines), len(envs_spines)))

for env in envs_spines:
env.delete_v3()

log.debug("PROD environments: %s. Total: %s" % (str(envs), len(envs)))
log.debug("PROD SPINELEAF environments removed.")

def rack_vlans_remove(self):
log.info("remove_vlans")
Expand Down
4 changes: 2 additions & 2 deletions networkapi/plugins/Dell/FTOS/BGP/Cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def _deploy_pre_req(self, neighbor):

for rm_entry in rms:
list_config_bgp = rm_entry.list_config_bgp
if not list_config_bgp.equipments.filter(id=self.equipment.id):
self.deploy_list_config_bgp(list_config_bgp)
# if not list_config_bgp.equipments.filter(id=self.equipment.id):
# self.deploy_list_config_bgp(list_config_bgp)

if not route_map_in.equipments.filter(id=self.equipment.id):
self.deploy_route_map(neighbor.peer_group.route_map_in)
Expand Down
12 changes: 6 additions & 6 deletions networkapi/plugins/Juniper/JUNOS/BGP/Cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def _deploy_pre_req(self, neighbor):
route_map_out.route_map_entries
for rm_entry in rms:
list_config_bgp = rm_entry.list_config_bgp
if not list_config_bgp.equipments.filter(id=self.equipment.id):
self.deploy_list_config_bgp(list_config_bgp)
# if not list_config_bgp.equipments.filter(id=self.equipment.id):
# self.deploy_list_config_bgp(list_config_bgp)

if not route_map_in.equipments.filter(id=self.equipment.id):
self.deploy_route_map(neighbor.peer_group.route_map_in)
# if not route_map_in.equipments.filter(id=self.equipment.id):
# self.deploy_route_map(neighbor.peer_group.route_map_in)

if not route_map_out.equipments.filter(id=self.equipment.id):
self.deploy_route_map(neighbor.peer_group.route_map_out)
# if not route_map_out.equipments.filter(id=self.equipment.id):
# self.deploy_route_map(neighbor.peer_group.route_map_out)

def _undeploy_pre_req(self, neighbor, ip_version):
log.info("_undeploy_pre_req")
Expand Down

0 comments on commit f462837

Please sign in to comment.