Skip to content

Commit

Permalink
Add archived connection API
Browse files Browse the repository at this point in the history
  • Loading branch information
congwang09 committed Oct 8, 2024
1 parent 11e0d55 commit 2e599be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sdx_controller/controllers/l2vpn_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,20 @@ def patch_connection(service_id, body=None): # noqa: E501

return response, code


def get_archived_connections_by_id(service_id):
return "Do some magic"
"""
List archived connection by ID.
:param service_id: ID of connection that needs to be fetched
:type service_id: str
:rtype: Connection
"""

value = get_connection_status(db_instance, service_id)

if not value:
return "Connection not found", 404

return value
8 changes: 8 additions & 0 deletions sdx_controller/handlers/connection_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ def handle_link_failure(self, te_manager, failed_links):
logger.debug(connection)
self.place_connection(te_manager, connection)

def get_archived_connections(self, service_id: str):
historical_connections = self.db_instance.read_from_db(
"historical_connections", service_id
)
if not historical_connections:
return None
return historical_connections[service_id]


def get_connection_status(db, service_id: str):
"""
Expand Down

0 comments on commit 2e599be

Please sign in to comment.