diff --git a/sdx_controller/controllers/topology_controller.py b/sdx_controller/controllers/topology_controller.py index f2c479b..2b63604 100644 --- a/sdx_controller/controllers/topology_controller.py +++ b/sdx_controller/controllers/topology_controller.py @@ -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"] @@ -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"] diff --git a/sdx_controller/swagger/swagger.yaml b/sdx_controller/swagger/swagger.yaml index 671dd2a..d40c2de 100644 --- a/sdx_controller/swagger/swagger.yaml +++ b/sdx_controller/swagger/swagger.yaml @@ -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: