From 0adc10ac2b12f1461ab5db61a5f4b5372045f58f Mon Sep 17 00:00:00 2001 From: Sachin Bansal Date: Wed, 11 Feb 2015 11:16:34 -0800 Subject: [PATCH] Do not remove configured RT from RI on restart 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. Closes-Bug: 1418701 (cherry picked from commit 28a871d77461175b0b5e76eb9602608df3062ec5) Conflicts: src/config/schema-transformer/to_bgp.py Change-Id: Id9bdb45c5a782bd4e4ae03a29dd1cd37ca20b081 --- src/config/schema-transformer/to_bgp.py | 26 ++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/config/schema-transformer/to_bgp.py b/src/config/schema-transformer/to_bgp.py index cecf34707e0..bc5ec36eaba 100644 --- a/src/config/schema-transformer/to_bgp.py +++ b/src/config/schema-transformer/to_bgp.py @@ -238,7 +238,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 = {} @@ -548,6 +554,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) try: @@ -579,12 +586,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.debug(