From f26f94b2da8ce2633c56f800179f253ba4d3ad83 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Fri, 8 Nov 2024 16:31:52 -0500 Subject: [PATCH 1/3] Add connection after failure handling --- sdx_controller/handlers/connection_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 034bc1a..2475c88 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -272,7 +272,9 @@ def handle_link_failure(self, te_manager, failed_links): del link_connections_dict[simple_link][index] logger.debug("Removed connection:") logger.debug(connection) - self.place_connection(te_manager, connection) + _reason, code = self.place_connection(te_manager, connection) + if code // 100 == 2: + self.db_instance.add_key("connections", connection["id"], json.dumps(connection)) def get_archived_connections(self, service_id: str): historical_connections = self.db_instance.read_from_db( From 4f0c7875a6bc7dd71f4a1db0106f1bb7afe289aa Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Fri, 8 Nov 2024 16:45:53 -0500 Subject: [PATCH 2/3] Format --- sdx_controller/handlers/connection_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 2475c88..10fd298 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -274,7 +274,9 @@ def handle_link_failure(self, te_manager, failed_links): logger.debug(connection) _reason, code = self.place_connection(te_manager, connection) if code // 100 == 2: - self.db_instance.add_key("connections", connection["id"], json.dumps(connection)) + self.db_instance.add_key( + "connections", connection["id"], json.dumps(connection) + ) def get_archived_connections(self, service_id: str): historical_connections = self.db_instance.read_from_db( From 45f2c21bea4b2aa4be3f3609dc715f65c975c415 Mon Sep 17 00:00:00 2001 From: Italo Valcy Date: Tue, 12 Nov 2024 11:34:58 -0300 Subject: [PATCH 3/3] fix func name to add connection to mongodb --- sdx_controller/handlers/connection_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 10fd298..66244c9 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -274,7 +274,7 @@ def handle_link_failure(self, te_manager, failed_links): logger.debug(connection) _reason, code = self.place_connection(te_manager, connection) if code // 100 == 2: - self.db_instance.add_key( + self.db_instance.add_key_value_pair_to_db( "connections", connection["id"], json.dumps(connection) )