diff --git a/dragonflow/switch/drivers/ovs/datapath.py b/dragonflow/switch/drivers/ovs/datapath.py index e5d228784..46b3623c5 100644 --- a/dragonflow/switch/drivers/ovs/datapath.py +++ b/dragonflow/switch/drivers/ovs/datapath.py @@ -78,6 +78,7 @@ class Datapath(object): Instantiate the applications (Including table and register allocation) Wire the applications (including translating registers) """ + self.clear_old_set_up() self._dp = os_ken_base.datapath self._table_generator = _sequence_generator( cfg.CONF.df.datapath_autoalloc_table_offset) @@ -121,6 +122,13 @@ class Datapath(object): for edge in self._layout.edges: 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): """Get an application class (Python class) by app name""" mgr = stevedore.NamedExtensionManager( diff --git a/dragonflow/switch/drivers/ovs/os_ken_base_app.py b/dragonflow/switch/drivers/ovs/os_ken_base_app.py index 93d6d8ac8..232988660 100644 --- a/dragonflow/switch/drivers/ovs/os_ken_base_app.py +++ b/dragonflow/switch/drivers/ovs/os_ken_base_app.py @@ -87,7 +87,7 @@ class OsKenDFAdapter(ofp_handler.OFPHandler): ) 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) def notify_switch_sync_finished(self):