Skip to content

Commit

Permalink
Do not remove configured RT from RI on restart
Browse files Browse the repository at this point in the history
When Schema Transformer restarts, it currently resets all route targets on all
routing instances. If there were any RTs configured on the parent VN, those will
be removed and added back when notification is received for adding those targets
to the VN. This can cause lack of connectivity for some time. Instead, now we
read the configured targets when routing istance is created and add the
configured route targets to the RI.

Change-Id: Id9bdb45c5a782bd4e4ae03a29dd1cd37ca20b081
Closes-Bug: 1418701
(cherry picked from commit 28a871d)
  • Loading branch information
Sachin Bansal committed Feb 17, 2015
1 parent 3f271db commit 3ffbb76
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/config/schema-transformer/to_bgp.py
Expand Up @@ -240,7 +240,13 @@ def __init__(self, name):

self.ipams = {}
self.extend = False
self.rt_list = set()
rt_list = self.obj.get_route_target_list()
if rt_list:
self.rt_list = set(rt_list.get_route_target())
for rt in self.rt_list:
RouteTargetST.locate(rt)
else:
self.rt_list = set()
self._route_target = 0
self.route_table_refs = set()
self.route_table = {}
Expand Down Expand Up @@ -555,6 +561,7 @@ def locate_routing_instance(self, rinst_name, service_chain=None):
if rinst_name in self.rinst:
return self.rinst[rinst_name]

is_default = (rinst_name == self._default_ri_name)
alloc_new = False
rinst_fq_name_str = '%s:%s' % (self.obj.get_fq_name_str(), rinst_name)
old_rtgt = None
Expand Down Expand Up @@ -588,12 +595,29 @@ def locate_routing_instance(self, rinst_name, service_chain=None):
rinst_obj = None
else:
rinst_obj.set_route_target(rtgt_obj, inst_tgt_data)
for rt in self.rt_list:
rtgt_obj = RouteTarget(rt)
if is_default:
inst_tgt_data = InstanceTargetType()
else:
inst_tgt_data = InstanceTargetType(
import_export="export")
rinst_obj.add_route_target(rtgt_obj, inst_tgt_data)

_vnc_lib.routing_instance_update(rinst_obj)
except NoIdError:
rinst_obj = None
if rinst_obj is None:
rinst_obj = RoutingInstance(rinst_name, self.obj)
rinst_obj.set_route_target(rtgt_obj, inst_tgt_data)
for rt in self.rt_list:
rtgt_obj = RouteTarget(rt)
if is_default:
inst_tgt_data = InstanceTargetType()
else:
inst_tgt_data = InstanceTargetType(
import_export="export")
rinst_obj.add_route_target(rtgt_obj, inst_tgt_data)
_vnc_lib.routing_instance_create(rinst_obj)
except HttpError as he:
_sandesh._logger.error(
Expand Down

0 comments on commit 3ffbb76

Please sign in to comment.