Skip to content

Commit

Permalink
swagger description #20
Browse files Browse the repository at this point in the history
  • Loading branch information
student committed Jun 26, 2024
1 parent f92a64c commit 2349743
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
21 changes: 16 additions & 5 deletions os-base/nginx-base/oxpoapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
"info": {
"title": "Oxpo Api Wrapper",
"description": "The wrapper abstracts the complexities of direct API calls and offers a consistent method to interact with different OXPO services",
"version": "1.0.0",
"version": "2.0.0",
"contact": {
"email": "[email protected]"
}
},
"servers": [
{
"url": "http://0.0.0.0"
},
{
"url": "http://67.17.206.221"
},
Expand All @@ -26,12 +29,20 @@
}
},
{
"name": "/switch/operation/dpId",
"description": "operation: enable | disable, dpId: aa:00:00:00:00:00:00:01 | all"
"name": "/switch/enable/all",
"description": "switch operation: enable, dpId: all"
},
{
"name": "/switch/enable/aa:00:00:00:00:00:00:01",
"description": "switch operation: enable, dpId: aa:00:00:00:00:00:00:01"
},
{
"name": "/link/enable/all",
"description": "link operation: enable, dpId: all"
},
{
"name": "/link/operation/dpId",
"description": "operation: enable | disable, dpId: aa:00:00:00:00:00:00:01 | all"
"name": "/link/enable/aa:00:00:00:00:00:00:01",
"description": "link operation: enable, dpId: aa:00:00:00:00:00:00:01"
},
{
"name": "user",
Expand Down
25 changes: 17 additions & 8 deletions topology-conversion/controllers/operational_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def post_topology_object(topology_object):

def get_switch_enable(dp_id):
"""getting switch enable"""
print("#####################################")
print("######### switch enable ##########")
print("######### %s ##########", dp_id)
print("#####################################")
if dp_id == "all":
switches = get_topology_object("switches")
if "switches" in switches:
Expand All @@ -47,14 +43,27 @@ def get_switch_enable(dp_id):
topology_object = "switches/" + dp_id + "/enable"
switch_enable = post_topology_object(topology_object)
print(switch_enable)
else:
topology_object = "switches/" + dp_id + "/enable"
switch_enable = post_topology_object(topology_object)
print(switch_enable)

return f"switch/enable/{dp_id}"


def get_switch_disable(dp_id):
"""getting switch disable"""
print("#####################################")
print("######### switch disable ##########")
print("######### %s ##########", dp_id)
print("#####################################")
if dp_id == "all":
switches = get_topology_object("switches")
if "switches" in switches:
for key in switches["switches"].keys():
dp_id = switches["switches"][key]["id"]
topology_object = "switches/" + dp_id + "/disable"
switch_disable = post_topology_object(topology_object)
print(switch_disable)
else:
topology_object = "switches/" + dp_id + "/disable"
switch_disable = post_topology_object(topology_object)
print(switch_disable)

return f"switch/disable/{dp_id}"

0 comments on commit 2349743

Please sign in to comment.