Skip to content

Commit

Permalink
Fixes for crashes in schema transformer
Browse files Browse the repository at this point in the history
1. locate_routing_instance could fail if VN itself was deleted. Handle that case.
2. static_route_entries may not be present when route table entry is being deleted.
3. At reinit, use ri name instead of fq_name to find service chain id.

Change-Id: I56524610bc5fe370cb312a6cf633830911cf7e04
Closes-Bug: 1457223
  • Loading branch information
Sachin Bansal committed May 26, 2015
1 parent 0ce934a commit 873a6d9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/config/schema-transformer/to_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ def __init__(self, name, obj=None, acl_dict=None, ri_dict=None):
self._default_ri_name = self.obj.name
ri_obj = self.locate_routing_instance(self._default_ri_name, None,
ri_dict)
# if primary RI is connected to another primary RI, we need to
# also create connection between the VNs
for connection in ri_obj.connections:
remote_ri_fq_name = connection.split(':')
if remote_ri_fq_name[-1] == remote_ri_fq_name[-2]:
self.connections.add(':'.join(remote_ri_fq_name[0:-1] ))
if ri_obj is not None:
# if primary RI is connected to another primary RI, we need to
# also create connection between the VNs
for connection in ri_obj.connections:
remote_ri_fq_name = connection.split(':')
if remote_ri_fq_name[-1] == remote_ri_fq_name[-2]:
self.connections.add(':'.join(remote_ri_fq_name[0:-1] ))

for ri in self.obj.get_routing_instances() or []:
ri_name = ri['to'][-1]
Expand Down Expand Up @@ -847,6 +848,8 @@ def delete_route(self, prefix):
import_export="import")
update = False
static_route_entries = left_ri.obj.get_static_route_entries()
if static_route_entries is None:
return
for static_route in static_route_entries.get_route() or []:
if static_route.prefix != prefix:
continue
Expand Down Expand Up @@ -2674,7 +2677,7 @@ def reinit(self):
if ri.parent_uuid not in vn_id_list:
delete = True
else:
ri_name = ri.get_fq_name_str()
ri_name = ri.get_fq_name()[-1]
# if the RI was for a service chain and service chain no
# longer exists, delete the RI
sc_id = VirtualNetworkST._get_service_id_from_ri(ri_name)
Expand Down

0 comments on commit 873a6d9

Please sign in to comment.