From 3255c0d5f04bcd5c2578b799f5f82ce255c96352 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 3 Feb 2026 17:25:14 -0500 Subject: [PATCH 01/10] pce dependency --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3ba324a..2fe2192d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "pika >= 1.2.0", "dataset", "pymongo > 3.0", - "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@v3.2.0", + "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@302-port-nni-removed", ] [project.optional-dependencies] From c66c434df1af4442346e4176da1057026b4cfc73 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Wed, 11 Feb 2026 14:05:24 -0500 Subject: [PATCH 02/10] minor --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index dba8324e..2fe2192d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ dependencies = [ "dataset", "pymongo > 3.0", "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@302-port-nni-removed", +] [project.optional-dependencies] test = [ From da6e08a8fe7298eca3cb4e71e6bfc4b94627ec32 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Mon, 30 Mar 2026 15:03:57 -0400 Subject: [PATCH 03/10] ignore oxp_conn_response msg when connection is not under provisioning --- sdx_controller/handlers/connection_handler.py | 15 +++++++++------ sdx_controller/handlers/lc_message_handler.py | 8 ++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 6fc1e18e..8b1bbf0e 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -847,12 +847,15 @@ def get_connection_status(db, service_id: str): def connection_state_machine(connection, new_state): - conn_sm = ConnectionStateMachine() - status = connection.get("status") - value = conn_sm.State[status] - conn_sm.set_state(value) - conn_sm.transition(new_state) - connection["status"] = str(conn_sm.get_state()) + try: + conn_sm = ConnectionStateMachine() + status = connection.get("status") + value = conn_sm.State[status] + conn_sm.set_state(value) + conn_sm.transition(new_state) + connection["status"] = str(conn_sm.get_state()) + except Exception as e: + logger.error(f"Error in connection state machine: {e}") return connection, conn_sm diff --git a/sdx_controller/handlers/lc_message_handler.py b/sdx_controller/handlers/lc_message_handler.py index 76230361..626c5a83 100644 --- a/sdx_controller/handlers/lc_message_handler.py +++ b/sdx_controller/handlers/lc_message_handler.py @@ -86,6 +86,14 @@ def process_lc_json_msg( if not connection: return + if connection.get("status") and ( + connection.get("status") + != str(ConnectionStateMachine.State.UNDER_PROVISIONING) + ): + logger.info("Connection is not under provisioning: " + service_id) + logger.info("No need to process OXP response for down connection.") + return + breakdown = self.db_instance.get_value_from_db( MongoCollections.BREAKDOWNS, service_id ) From 5ea7ba53e928f6db859e75e5319fccfc6ab75e47 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Mon, 30 Mar 2026 15:08:58 -0400 Subject: [PATCH 04/10] not catch connection state machine transition exception for the unittest --- sdx_controller/handlers/connection_handler.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 8b1bbf0e..6fc1e18e 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -847,15 +847,12 @@ def get_connection_status(db, service_id: str): def connection_state_machine(connection, new_state): - try: - conn_sm = ConnectionStateMachine() - status = connection.get("status") - value = conn_sm.State[status] - conn_sm.set_state(value) - conn_sm.transition(new_state) - connection["status"] = str(conn_sm.get_state()) - except Exception as e: - logger.error(f"Error in connection state machine: {e}") + conn_sm = ConnectionStateMachine() + status = connection.get("status") + value = conn_sm.State[status] + conn_sm.set_state(value) + conn_sm.transition(new_state) + connection["status"] = str(conn_sm.get_state()) return connection, conn_sm From 6d904d9acc0239a8ab765da9a19d4538f99a4670 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Mon, 30 Mar 2026 15:31:02 -0400 Subject: [PATCH 05/10] logger msg --- sdx_controller/handlers/lc_message_handler.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sdx_controller/handlers/lc_message_handler.py b/sdx_controller/handlers/lc_message_handler.py index 626c5a83..d708e78c 100644 --- a/sdx_controller/handlers/lc_message_handler.py +++ b/sdx_controller/handlers/lc_message_handler.py @@ -86,14 +86,6 @@ def process_lc_json_msg( if not connection: return - if connection.get("status") and ( - connection.get("status") - != str(ConnectionStateMachine.State.UNDER_PROVISIONING) - ): - logger.info("Connection is not under provisioning: " + service_id) - logger.info("No need to process OXP response for down connection.") - return - breakdown = self.db_instance.get_value_from_db( MongoCollections.BREAKDOWNS, service_id ) @@ -114,6 +106,15 @@ def process_lc_json_msg( if oxp_response_code // 100 == 2: if msg_json.get("operation") != "delete": + if connection.get("status") and ( + connection.get("status") + != str(ConnectionStateMachine.State.UNDER_PROVISIONING) + ): + logger.info( + "Ignore oxp_conn_response, Connection is not under provisioning: " + + service_id + ) + return oxp_success_count += 1 connection["oxp_success_count"] = oxp_success_count if oxp_success_count == oxp_number: From 6a13acaa75fc9231be4629fe96a7864c5ac89678 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 31 Mar 2026 14:47:51 -0400 Subject: [PATCH 06/10] correct the transition on RECOVERING --- sdx_controller/handlers/connection_handler.py | 3 +++ sdx_controller/handlers/lc_message_handler.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 6fc1e18e..9f034814 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -526,6 +526,9 @@ def handle_link_failure(self, te_manager, failed_links): self.db_instance.add_key_value_pair_to_db( MongoCollections.CONNECTIONS, service_id, connection ) + connection, _ = connection_state_machine( + connection, ConnectionStateMachine.State.UNDER_PROVISIONING + ) _reason, code = self.place_connection(te_manager, connection) if code // 100 != 2: connection, _ = connection_state_machine( diff --git a/sdx_controller/handlers/lc_message_handler.py b/sdx_controller/handlers/lc_message_handler.py index d708e78c..386ca3ad 100644 --- a/sdx_controller/handlers/lc_message_handler.py +++ b/sdx_controller/handlers/lc_message_handler.py @@ -118,14 +118,14 @@ def process_lc_json_msg( oxp_success_count += 1 connection["oxp_success_count"] = oxp_success_count if oxp_success_count == oxp_number: - if connection.get("status") and ( - connection.get("status") - == str(ConnectionStateMachine.State.RECOVERING) - ): - connection, _ = connection_state_machine( - connection, - ConnectionStateMachine.State.UNDER_PROVISIONING, - ) + # if connection.get("status") and ( + # connection.get("status") + # == str(ConnectionStateMachine.State.RECOVERING) + # ): + # connection, _ = connection_state_machine( + # connection, + # ConnectionStateMachine.State.UNDER_PROVISIONING, + # ) connection, _ = connection_state_machine( connection, ConnectionStateMachine.State.UP ) From 1215e4454b2c0a6875981c1926d1722fa3e86113 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 31 Mar 2026 15:28:52 -0400 Subject: [PATCH 07/10] correct the transition on RECOVERING --- sdx_controller/handlers/connection_handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 9f034814..85590ea9 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -522,13 +522,13 @@ def handle_link_failure(self, te_manager, failed_links): connection, _ = connection_state_machine( connection, ConnectionStateMachine.State.RECOVERING ) + connection, _ = connection_state_machine( + connection, ConnectionStateMachine.State.UNDER_PROVISIONING + ) connection["oxp_success_count"] = 0 self.db_instance.add_key_value_pair_to_db( MongoCollections.CONNECTIONS, service_id, connection ) - connection, _ = connection_state_machine( - connection, ConnectionStateMachine.State.UNDER_PROVISIONING - ) _reason, code = self.place_connection(te_manager, connection) if code // 100 != 2: connection, _ = connection_state_machine( From 98c4426fcb74e1db20fe0bf62fe8bf17db11623f Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 31 Mar 2026 16:21:08 -0400 Subject: [PATCH 08/10] correct the transition on RECOVERING only from ERROR --- sdx_controller/handlers/connection_handler.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sdx_controller/handlers/connection_handler.py b/sdx_controller/handlers/connection_handler.py index 85590ea9..1c6b3add 100644 --- a/sdx_controller/handlers/connection_handler.py +++ b/sdx_controller/handlers/connection_handler.py @@ -496,7 +496,9 @@ def handle_link_failure(self, te_manager, failed_links): connection["status"] = str( ConnectionStateMachine.State.ERROR ) - else: + elif connection.get("status") == str( + ConnectionStateMachine.State.UP + ): connection, _ = connection_state_machine( connection, ConnectionStateMachine.State.ERROR ) @@ -517,8 +519,14 @@ def handle_link_failure(self, te_manager, failed_links): ) continue - logger.debug("Removed connection:") - logger.debug(connection) + logger.debug(f"Removed connection:{connection}") + if connection.get("status") != str( + ConnectionStateMachine.State.ERROR + ): + logger.info( + f"Connection {service_id} is in {connection.get('status')} state after link failure, no recovery needed." + ) + connection, _ = connection_state_machine( connection, ConnectionStateMachine.State.RECOVERING ) @@ -574,6 +582,8 @@ def handle_uni_ports_up_to_down(self, uni_ports_up_to_down): if not connection: logger.debug(f"Cannot find connection {service_id} in DB.") continue + + # special case on uni port status change, out of SM logger.info(f"Updating connection {service_id} status to 'down'.") connection["status"] = "DOWN" self.db_instance.add_key_value_pair_to_db( @@ -614,7 +624,7 @@ def handle_uni_ports_down_to_up(self, uni_ports_down_to_up): if not connection: logger.debug(f"Cannot find connection {service_id} in DB.") continue - + # special case on uni port status change, out of SM logger.info(f"Updating connection {service_id} status to 'up'.") connection["status"] = "UP" self.db_instance.add_key_value_pair_to_db( From b35e2feab67c0577a744b5a7922e594e832edb95 Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Tue, 31 Mar 2026 18:38:02 -0400 Subject: [PATCH 09/10] test pce@v3.2.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2fe2192d..8a3a4187 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "pika >= 1.2.0", "dataset", "pymongo > 3.0", - "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@302-port-nni-removed", + "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@v3.2.1", ] [project.optional-dependencies] From 2ac160668a472f971e523ebdfadd9f244bb5720f Mon Sep 17 00:00:00 2001 From: Yufeng Xin Date: Thu, 9 Apr 2026 11:41:41 -0400 Subject: [PATCH 10/10] bring back the needed pce branch --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8a3a4187..2fe2192d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "pika >= 1.2.0", "dataset", "pymongo > 3.0", - "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@v3.2.1", + "sdx-pce @ git+https://github.com/atlanticwave-sdx/pce@302-port-nni-removed", ] [project.optional-dependencies]