Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use correct SI name to add route-target
For transit VN, the route target of the primary RI should be added to the first
service RI (for left VN), or last service RI (for right VN). Earlier, we were
always adding it to the first service RI.

Change-Id: I7e086753b4710431b419e19add132ba3ed5f1b45
Closes-Bug: 1505449
  • Loading branch information
Sachin Bansal committed Oct 14, 2015
1 parent 9427801 commit 2d871d8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/config/schema-transformer/config_db.py
Expand Up @@ -511,8 +511,15 @@ def set_properties(self, properties):
self.allow_transit = properties.allow_transit
for sc_list in self.service_chains.values():
for service_chain in sc_list:
ri_name = self.get_service_name(service_chain.name,
service_chain.service_list[0])
if not service_chain.created:
continue
if self.name == service_chain.left_vn:
si_name = service_chain.service_list[0]
elif self.name == service_chain.right_vn:
si_name = service_chain.service_list[-1]
else:
continue
ri_name = self.get_service_name(service_chain.name, si_name)
ri = RoutingInstanceST.get(ri_name)
if not ri:
continue
Expand All @@ -524,8 +531,7 @@ def set_properties(self, properties):
else:
# if the network is not a transit network any more, then we
# need to delete the route target from service RIs
ri.update_route_target_list([], [self.get_route_target()],
import_export='export')
ri.update_route_target_list([], [self.get_route_target()])
# end set_properties

def set_route_target_list(self, rt_list):
Expand Down Expand Up @@ -1832,10 +1838,10 @@ def update_route_target_list(self, rt_add, rt_del=None,
rtgt_obj = RouteTargetST.locate(rt).obj
inst_tgt_data = InstanceTargetType(import_export=import_export)
self.obj.add_route_target(rtgt_obj, inst_tgt_data)
for rt in rt_del or set():
for rt in rt_del or []:
rtgt_obj = RouteTarget(rt)
self.obj.del_route_target(rtgt_obj)
if len(rt_add) or len(rt_del or set()):
if rt_add or rt_del:
try:
self._vnc_lib.routing_instance_update(self.obj)
except NoIdError:
Expand Down

0 comments on commit 2d871d8

Please sign in to comment.