Added documentation for utility endpoints
Change-Id: Iaa88cd26cb725c92f9837d131491e3aab61888be
diff --git a/apiary.apib b/apiary.apib
index 0f9632d..1c8816a 100644
--- a/apiary.apib
+++ b/apiary.apib
@@ -555,7 +555,7 @@
+ Response 200 (application/json)
{
- "humanReadableName": "MySite",
+ "humanReadableName": "mysite",
"id": 1,
"created": "2016-04-29T16:19:03.587770Z",
"updated": "2016-04-29T16:19:05.651933Z",
@@ -690,6 +690,7 @@
"service_message": "This is the test message"
}
]
+
# Group ONOS Services
@@ -761,10 +762,156 @@
### Log a user out of the system [POST]
+ Request (application/json)
- {xossessionid: "sessionId"}
+
+ {
+ "xossessionid": "sessionId"
+ }
+ Response 200 (application/json)
+## Port Forwarding [/api/utility/portforwarding/]
+
+Contains the set of port forwarding mappings for each compute node.
+Used on OpenCloud to setup port forwarding for nat-net.
+
+### List port forwarding objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 79,
+ "ip": "172.16.0.36",
+ "ports": "tcp 2222, tcp 25566",
+ "hostname": "node1.opencloud.us"
+ },
+ {
+ "id": 131,
+ "ip": "172.16.0.16",
+ "ports": "udp 53, tcp 8017",
+ "hostname": "node2.opencloud.us"
+ }
+ ]
+
+## Slices Plus [/api/utility/slicesplus/]
+
+A list of slices with addictional information, it is used in the Tenant custom dashboard.
+
+### List Slices objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "mysite_management",
+ "id": 2,
+ "created": "2016-06-29T18:43:50.730912Z",
+ "updated": "2016-06-29T18:43:50.730789Z",
+ "enacted": null,
+ "name": "mysite_management",
+ "enabled": true,
+ "omf_friendly": false,
+ "description": "",
+ "slice_url": "",
+ "site": 2,
+ "max_instances": 10,
+ "service": null,
+ "network": "noauto",
+ "mount_data_sets": "GenBank",
+ "default_image": null,
+ "default_flavor": null,
+ "serviceClass": null,
+ "creator": 2,
+ "networks": [],
+ "network_ports": "",
+ "backendIcon": "/static/admin/img/icon_clock.gif",
+ "backendHtml": "<span title=\"Pending sync, last_status = 0 - Provisioning in progress\"><img src=\"/static/admin/img/icon_clock.gif\"></span>",
+ "current_user_roles": [],
+ "instance_distribution": {},
+ "instance_distribution_ready": {},
+ "instance_total": 0,
+ "instance_total_ready": 0,
+ "instance_status": {},
+ "users": [],
+ "user_names": [],
+ "current_user_can_see": true
+ }
+ ]
+
+## Synchronizer [/api/utility/synchronizer/]
+
+Lists the Diag objects for synchronizers. From here you can get the synchronizer status.
+
+### List Diag objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 3,
+ "name": "onboarding",
+ "backend_status": "1 - Bottom Of Loop",
+ "backend_register": "{\"last_duration\": 0.18996095657348633, \"last_run\": 1467923907.908469}"
+ }
+ ]
+
+## Onboarding [/api/utility/onboarding/{service}/ready]
+
+Used to get the status of onboarding, to determine if services have been to successfully onboarded and if the XOS UI container has been built.
+
+### Get service status [GET]
+
++ Parameters
+ + service: services/vsg (string) - Name of the service to wait for
+
+
++ Response 200 (text/plain)
+
+ true
+
+## Tosca [/api/utility/tosca/run/]
+
+### Load a Tosca recipe [POST]
+
++ Request (application/json)
+
+ {
+ "recipe": "tosca_definitions_version: tosca_simple_yaml_1_0\n\ndescription: Onboard the exampleservice\n\nimports:\n - custom_types/xos.yaml\n\ntopology_template:\n node_templates:\n test_site:\n type: tosca.nodes.Site\n properties:\n display_name: Test Site\n site_url: https://www.onlab.us/"
+ }
+
++ Response 200 (application/json)
+
+ {
+ "log_msgs":[
+ "ordered_names: ['test_site']",
+ "Created Site 'Test Site'"
+ ]
+ }
+
+## Ssh Keys [/api/utility/sshkeys/]
+
+Returns the set of ssh keys for instances. Used on OpenCloud to configure ssh-proxy to instances.
+
+### List ssh keys by instance [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": "instance-00000001",
+ "public_keys": [
+ "ssh-rsa xxyyzz\r\n"
+ ],
+ "node_name": "node1.opencloud.us"
+ },
+ {
+ "id": "instance-00000001",
+ "public_keys": [
+ "ssh-rsa xxyyzz\r\n"
+ ],
+ "node_name": "node2.opencloud.us"
+ }
+ ]
# Group Subscribers
diff --git a/xos/api/utility/portforwarding.py b/xos/api/utility/portforwarding.py
index 0bb7a93..53f56d4 100644
--- a/xos/api/utility/portforwarding.py
+++ b/xos/api/utility/portforwarding.py
@@ -25,6 +25,7 @@
base_name = "portforwarding"
method_name = "portforwarding"
method_kind = "viewset"
+ read_only = True
serializer_class = PortForwardingSerializer
def get_queryset(self):
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index 449ca16..61d00c7 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -378,5 +378,18 @@
@hooks.before("Utility > Logout > Log a user out of the system")
-def skip_for_now(transaction):
+def skip_logout(transaction):
transaction['skip'] = True
+
+
+@hooks.before("Utility > Onboarding > Get service status")
+def skip_onboarding(transaction):
+ transaction['skip'] = True
+
+
+@hooks.after("Utility > Tosca > Load a Tosca recipe")
+def check_tosca(transaction):
+ try:
+ site = Site.objects.get(name='Test Site')
+ except Exception, e:
+ transaction['fail'] = "Test Site has not been created"
diff --git a/xos/tests/api/source/service/exampleservice.md b/xos/tests/api/source/service/exampleservice.md
index 96a19c7..b2d031b 100644
--- a/xos/tests/api/source/service/exampleservice.md
+++ b/xos/tests/api/source/service/exampleservice.md
@@ -12,4 +12,4 @@
"id": 1,
"service_message": "This is the test message"
}
- ]
\ No newline at end of file
+ ]
diff --git a/xos/tests/api/source/utility/utility.md b/xos/tests/api/source/utility/utility.md
index 63379be..962ba6e 100644
--- a/xos/tests/api/source/utility/utility.md
+++ b/xos/tests/api/source/utility/utility.md
@@ -26,6 +26,153 @@
### Log a user out of the system [POST]
+ Request (application/json)
- {xossessionid: "sessionId"}
+
+ {
+ "xossessionid": "sessionId"
+ }
+ Response 200 (application/json)
+
+## Port Forwarding [/api/utility/portforwarding/]
+
+Contains the set of port forwarding mappings for each compute node.
+Used on OpenCloud to setup port forwarding for nat-net.
+
+### List port forwarding objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 79,
+ "ip": "172.16.0.36",
+ "ports": "tcp 2222, tcp 25566",
+ "hostname": "node1.opencloud.us"
+ },
+ {
+ "id": 131,
+ "ip": "172.16.0.16",
+ "ports": "udp 53, tcp 8017",
+ "hostname": "node2.opencloud.us"
+ }
+ ]
+
+## Slices Plus [/api/utility/slicesplus/]
+
+A list of slices with addictional information, it is used in the Tenant custom dashboard.
+
+### List Slices objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "mysite_management",
+ "id": 2,
+ "created": "2016-06-29T18:43:50.730912Z",
+ "updated": "2016-06-29T18:43:50.730789Z",
+ "enacted": null,
+ "name": "mysite_management",
+ "enabled": true,
+ "omf_friendly": false,
+ "description": "",
+ "slice_url": "",
+ "site": 2,
+ "max_instances": 10,
+ "service": null,
+ "network": "noauto",
+ "mount_data_sets": "GenBank",
+ "default_image": null,
+ "default_flavor": null,
+ "serviceClass": null,
+ "creator": 2,
+ "networks": [],
+ "network_ports": "",
+ "backendIcon": "/static/admin/img/icon_clock.gif",
+ "backendHtml": "<span title=\"Pending sync, last_status = 0 - Provisioning in progress\"><img src=\"/static/admin/img/icon_clock.gif\"></span>",
+ "current_user_roles": [],
+ "instance_distribution": {},
+ "instance_distribution_ready": {},
+ "instance_total": 0,
+ "instance_total_ready": 0,
+ "instance_status": {},
+ "users": [],
+ "user_names": [],
+ "current_user_can_see": true
+ }
+ ]
+
+## Synchronizer [/api/utility/synchronizer/]
+
+Lists the Diag objects for synchronizers. From here you can get the synchronizer status.
+
+### List Diag objects [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 3,
+ "name": "onboarding",
+ "backend_status": "1 - Bottom Of Loop",
+ "backend_register": "{\"last_duration\": 0.18996095657348633, \"last_run\": 1467923907.908469}"
+ }
+ ]
+
+## Onboarding [/api/utility/onboarding/{service}/ready]
+
+Used to get the status of onboarding, to determine if services have been to successfully onboarded and if the XOS UI container has been built.
+
+### Get service status [GET]
+
++ Parameters
+ + service: services/vsg (string) - Name of the service to wait for
+
+
++ Response 200 (text/plain)
+
+ true
+
+## Tosca [/api/utility/tosca/run/]
+
+### Load a Tosca recipe [POST]
+
++ Request (application/json)
+
+ {
+ "recipe": "tosca_definitions_version: tosca_simple_yaml_1_0\n\ndescription: Onboard the exampleservice\n\nimports:\n - custom_types/xos.yaml\n\ntopology_template:\n node_templates:\n test_site:\n type: tosca.nodes.Site\n properties:\n display_name: Test Site\n site_url: https://www.onlab.us/"
+ }
+
++ Response 200 (application/json)
+
+ {
+ "log_msgs":[
+ "ordered_names: ['test_site']",
+ "Created Site 'Test Site'"
+ ]
+ }
+
+## Ssh Keys [/api/utility/sshkeys/]
+
+Returns the set of ssh keys for instances. Used on OpenCloud to configure ssh-proxy to instances.
+
+### List ssh keys by instance [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": "instance-00000001",
+ "public_keys": [
+ "ssh-rsa xxyyzz\r\n"
+ ],
+ "node_name": "node1.opencloud.us"
+ },
+ {
+ "id": "instance-00000001",
+ "public_keys": [
+ "ssh-rsa xxyyzz\r\n"
+ ],
+ "node_name": "node2.opencloud.us"
+ }
+ ]
\ No newline at end of file