Skip to content

Commit

Permalink
Merge "Clean up all routing instances when a service chain is deleted…
Browse files Browse the repository at this point in the history
…" into R2.20
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 21, 2015
2 parents 5a3f313 + 5ae96f8 commit 3bd5523
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/config/schema-transformer/to_bgp.py
Expand Up @@ -1606,6 +1606,7 @@ def __init__(self, name, left_vn, right_vn, direction, sp_list, dp_list,

self.protocol = protocol
self.created = False
self.partially_created = False

self.present_stale = False
self.created_stale = False
Expand Down Expand Up @@ -1686,6 +1687,7 @@ def create(self):
# already created
return

self.partially_created = True
vn1_obj = VirtualNetworkST.locate(self.left_vn)
vn2_obj = VirtualNetworkST.locate(self.right_vn)
#sc_ip_address = vn1_obj.allocate_service_chain_ip(sc_name)
Expand Down Expand Up @@ -1790,6 +1792,7 @@ def create(self):
vn.add_route(prefix, nexthop)

self.created = True
self.partially_created = False
self._service_chain_uuid_cf.insert(self.name,
{'value': jsonpickle.encode(self)})

Expand Down Expand Up @@ -1884,10 +1887,11 @@ def process_in_network_service(self, vm_obj, service, vn1_obj, vn2_obj,
# end process_in_network_service

def destroy(self):
if not self.created:
if not self.created and not self.partially_created:
return

self.created = False
self.partially_created = False
self._service_chain_uuid_cf.insert(self.name,
{'value': jsonpickle.encode(self)})

Expand All @@ -1909,6 +1913,8 @@ def destroy(self):
# end destroy

def delete(self):
if self.created or self.partially_created:
self.destroy()
del self._dict[self.name]
try:
self._service_chain_uuid_cf.remove(self.name)
Expand Down

0 comments on commit 3bd5523

Please sign in to comment.