Merge "Clear registered table handlers on datapath set_up"

This commit is contained in:
Zuul 2019-03-28 19:24:32 +00:00 committed by Gerrit Code Review
commit c4e0ab10ae
2 changed files with 9 additions and 1 deletions

View File

@ -78,6 +78,7 @@ class Datapath(object):
Instantiate the applications (Including table and register allocation) Instantiate the applications (Including table and register allocation)
Wire the applications (including translating registers) Wire the applications (including translating registers)
""" """
self.clear_old_set_up()
self._dp = os_ken_base.datapath self._dp = os_ken_base.datapath
self._table_generator = _sequence_generator( self._table_generator = _sequence_generator(
cfg.CONF.df.datapath_autoalloc_table_offset) cfg.CONF.df.datapath_autoalloc_table_offset)
@ -121,6 +122,13 @@ class Datapath(object):
for edge in self._layout.edges: for edge in self._layout.edges:
self._install_edge(edge) self._install_edge(edge)
def clear_old_set_up(self):
if self.apps:
for name, app in self.apps.items():
dp_alloc = self._dp_allocs[name]
for state_name, table_num in dp_alloc.states.items():
app.api.unregister_table_handler(table_num)
def _get_app_class(self, app_type): def _get_app_class(self, app_type):
"""Get an application class (Python class) by app name""" """Get an application class (Python class) by app name"""
mgr = stevedore.NamedExtensionManager( mgr = stevedore.NamedExtensionManager(

View File

@ -87,7 +87,7 @@ class OsKenDFAdapter(ofp_handler.OFPHandler):
) )
self.table_handlers[table_id] = handler self.table_handlers[table_id] = handler
def unregister_table_handler(self, table_id, handler): def unregister_table_handler(self, table_id):
self.table_handlers.pop(table_id, None) self.table_handlers.pop(table_id, None)
def notify_switch_sync_finished(self): def notify_switch_sync_finished(self):