Skip to content

Commit

Permalink
Merge pull request #325 from atlanticwave-sdx/add-list-domains-api
Browse files Browse the repository at this point in the history
Add list domains api
  • Loading branch information
congwang09 authored Sep 5, 2024
2 parents 9afb868 + 5431157 commit def2444
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sdx_controller/controllers/topology_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_topology(): # noqa: E501

# TODO: this is a workaround because of the way we read values
# from MongoDB; refactor and test this more.
if topo_val is None:
if not topo_val:
return None

return topo_val["latest_topo"]
Expand Down Expand Up @@ -55,3 +55,11 @@ def topology_version(topology_id): # noqa: E501
:rtype: Topology
"""
return "do some magic!"


def get_topology_domains():
domain_list = db_instance.read_from_db("domains", "domain_list")
if not domain_list:
return []

return domain_list["domain_list"]
20 changes: 20 additions & 0 deletions sdx_controller/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,26 @@ paths:
"404":
description: Topology not found
x-openapi-router-controller: sdx_controller.controllers.topology_controller
/topology/domain:
get:
tags:
- topology
summary: List all domains
description: Returns a list of all domains
operationId: get_topology_domains
responses:
"200":
description: ok
content:
text/plain:
schema:
type: string
x-content-type: text/plain
"400":
description: Invalid ID supplied
"404":
description: Topology not found
x-openapi-router-controller: sdx_controller.controllers.topology_controller
/node:
get:
tags:
Expand Down

0 comments on commit def2444

Please sign in to comment.