Skip to content

Commit

Permalink
Remove static routes if a VN is deleted with exising ref to route table
Browse files Browse the repository at this point in the history
If we received networn delete before its link to route table is deleted, we were
not cleaning up corresponding static routes. With this change, we take care of
it. Also add a unit test case for it.

Change-Id: Iafbb808a0a12e0523bc79a9aa46adf15794f9ceb
Closes-Bug: 1483456
(cherry picked from commit 6db79ac72c901dbec8e71196dd9afd20bb6eb4ac)
(cherry picked from commit 242e639)
  • Loading branch information
Sachin Bansal authored and Hampapur Ajay committed Oct 2, 2015
1 parent 567a962 commit 17f92d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/config/schema-transformer/test/test_service.py
Expand Up @@ -522,7 +522,16 @@ def _match_route_table_cleanup(sc_ri_name, rt100):

_match_route_table_cleanup(sc_ri_name, rt100)

# add the route again, then delete the network without deleting the
# link to route table
routes.add_route(route)
rt.set_routes(routes)
self._vnc_lib.route_table_update(rt)
_match_route_table(rtgt_list.get_route_target())
self._vnc_lib.virtual_network_delete(fq_name=vn.get_fq_name())
_match_route_table_cleanup(sc_ri_name, rt100)

self._vnc_lib.route_table_delete(fq_name=rt.get_fq_name())
self.delete_network_policy(np, auto_policy=True)
gevent.sleep(2)
self._vnc_lib.virtual_network_delete(fq_name=lvn.get_fq_name())
Expand Down
3 changes: 3 additions & 0 deletions src/config/schema-transformer/to_bgp.py
Expand Up @@ -327,6 +327,9 @@ def delete(cls, name):
if name in policy.analyzer_vn_set:
analyzer_vn_set |= policy.networks_back_ref
policy.analyzer_vn_set.discard(name)

vn.route_table_refs = set()
vn.update_route_table()
del cls._dict[name]
vn.uve_send(deleted=True)
return analyzer_vn_set
Expand Down

0 comments on commit 17f92d4

Please sign in to comment.