Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion sdx_controller/handlers/lc_message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,50 @@ def process_lc_json_msg(
logger.info("MQ received message:" + str(msg))
msg_json = json.loads(msg)

if msg_json.get("msg_type") and msg_json["msg_type"] == "oxp_conn_response":
if (
msg_json.get("msg_type")
and msg_json["msg_type"] == "oxp_conn_status_change"
):

service_id = msg_json.get("service_id")
new_status = msg_json.get("new_status")
existing_status = msg_json.get("existing_status")
logger.info(
f"Received OXP connection status change. service_id={service_id}, existing_status={existing_status}, new_status={new_status}."
)

if not service_id or new_status is None:
return

connection = self.db_instance.get_value_from_db(
MongoCollections.CONNECTIONS, service_id
)
if not connection:
return

current_status = connection.get("status")

# If status is unchanged, do nothing
if current_status == new_status:
logger.debug(f"Status unchanged for {service_id}")
return

logger.info(
f"Updating connection {service_id} status: "
f"{current_status} -> {new_status}"
)

# Directly reflect LC/OXP status into controller DB
connection["status"] = new_status

self.db_instance.add_key_value_pair_to_db(
MongoCollections.CONNECTIONS,
service_id,
connection,
)
logger.info(f"Connection {service_id} status updated.")
Comment thread
italovalcy marked this conversation as resolved.
return
elif msg_json.get("msg_type") and msg_json["msg_type"] == "oxp_conn_response":
logger.info("Received OXP connection response.")
service_id = msg_json.get("service_id")

Expand Down
Loading