From 28a871d77461175b0b5e76eb9602608df3062ec5 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. Change-Id: Id9bdb45c5a782bd4e4ae03a29dd1cd37ca20b081 Closes-Bug: 1418701 --- src/config/schema-transformer/to_bgp.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/config/schema-transformer/to_bgp.py b/src/config/schema-transformer/to_bgp.py index f23e9499c72..a56f03b0f11 100644 --- a/src/config/schema-transformer/to_bgp.py +++ b/src/config/schema-transformer/to_bgp.py @@ -236,7 +236,13 @@ def __init__(self, name): self.dynamic_acl = acl_obj self.ipams = {} - 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 = {} @@ -569,6 +575,15 @@ def locate_routing_instance(self, rinst_name, service_chain=None): else: rinst_obj.set_route_target(rtgt_obj, inst_tgt_data) rinst_obj.set_routing_instance_is_default(is_default) + 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 @@ -576,6 +591,14 @@ def locate_routing_instance(self, rinst_name, service_chain=None): rinst_obj = RoutingInstance(rinst_name, self.obj) rinst_obj.set_route_target(rtgt_obj, inst_tgt_data) rinst_obj.set_routing_instance_is_default(is_default) + 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 (BadRequest, HttpError) as e: _sandesh._logger.error(