Added API docs and test
diff --git a/apiary.apib b/apiary.apib
index 7a4a916..d7034d8 100644
--- a/apiary.apib
+++ b/apiary.apib
@@ -3,97 +3,6 @@
# XOS
-# Group Instances
-
-List of the XOS instances
-
-## Instances [/api/core/instances/{id}/]
-
-### List all Instances [GET]
-
-+ Response 200 (application/json)
-
- [
- {
- "id": 1,
- "humanReadableName": "uninstantiated-1",
- "created": "2016-04-26T00:36:22.465259Z",
- "updated": "2016-04-26T00:36:22.465288Z",
- "enacted": null,
- "policed": null,
- "backend_register": "{}",
- "backend_status": "0 - Provisioning in progress",
- "deleted": false,
- "write_protect": false,
- "lazy_blocked": false,
- "no_sync": false,
- "instance_id": null,
- "instance_uuid": null,
- "name": "mysite_vcpe",
- "instance_name": null,
- "ip": null,
- "image": "http://xos.dev:9999/api/core/images/1/",
- "creator": "http://xos.dev:9999/api/core/users/1/",
- "slice": "http://xos.dev:9999/api/core/slices/1/",
- "deployment": "http://xos.dev:9999/api/core/deployments/1/",
- "node": "http://xos.dev:9999/api/core/nodes/1/",
- "numberCores": 0,
- "flavor": "http://xos.dev:9999/api/core/flavors/1/",
- "userData": null,
- "isolation": "vm",
- "volumes": "/etc/dnsmasq.d,/etc/ufw",
- "parent": null,
- "networks": [
- "http://xos.dev:9999/api/core/networks/2/"
- ]
- }
- ]
-
-
-
-# Group Users
-
-List of the XOS users
-
-## Users [/api/core/users/{id}/]
-
-### List all Users [GET]
-
-+ Response 200 (application/json)
-
- [
- {
- "id": 2,
- "password": "pbkdf2_sha256$12000$9gn8DmZuIoz2$YPQkx3AOOV7jZNYr2ddrgUCkiuaPpvb8+aJR7RwLZNA=",
- "last_login": "2016-04-12T18:50:45.880823Z",
- "email": "johndoe@myhouse.com",
- "username": "johndoe@myhouse.com",
- "firstname": "john",
- "lastname": "doe",
- "phone": null,
- "user_url": null,
- "site": "http://xos.dev:9999/api/core/sites/1/",
- "public_key": null,
- "is_active": true,
- "is_admin": false,
- "is_staff": true,
- "is_readonly": false,
- "is_registering": false,
- "is_appuser": false,
- "login_page": null,
- "created": "2016-04-12T18:50:45.912602Z",
- "updated": "2016-04-12T18:50:45.912671Z",
- "enacted": null,
- "policed": null,
- "backend_status": "Provisioning in progress",
- "deleted": false,
- "write_protect": false,
- "timezone": "America/New_York"
- }
- ]
-
-
-
# Group Example
## Example Services Collection [/api/service/exampleservice/]
@@ -152,6 +61,326 @@
]
+# Group Deployments
+
+List of the XOS deployments
+
+## Deployments [/api/core/deployments/{id}/]
+
+### List all deployments [GET]
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "MyDeployment",
+ "id": 1,
+ "created": "2016-04-29T16:19:03.549901Z",
+ "updated": "2016-04-29T16:19:05.624151Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "MyDeployment",
+ "accessControl": "allow all",
+ "images": [
+ "1"
+ ],
+ "sites": [
+ "1"
+ ],
+ "flavors": [
+ "1",
+ "2",
+ "3"
+ ],
+ "dashboardviews": [
+ "1"
+ ]
+ }
+
+
+# Group Flavors
+
+List of the XOS flavors
+
+## Flavors [/api/core/flavors/{id}/]
+
+### List all flavors [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "m1.large",
+ "id": 1,
+ "created": "2016-04-29T16:19:01.979548Z",
+ "updated": "2016-04-29T16:19:03.568238Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "m1.large",
+ "description": null,
+ "flavor": "m1.large",
+ "order": 0,
+ "default": false,
+ "deployments": [
+ "1"
+ ]
+ }
+ ]
+
+### View a Flavors Detail [GET]
+
++ Parameters
+ + id: 1 (number) - ID of the Flavors in the form of an integer
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "m1.large",
+ "id": 1,
+ "created": "2016-04-29T16:19:01.979548Z",
+ "updated": "2016-04-29T16:19:03.568238Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "m1.large",
+ "description": null,
+ "flavor": "m1.large",
+ "order": 0,
+ "default": false,
+ "deployments": [
+ "1"
+ ]
+ }
+
+
+# Group Instances
+
+List of the XOS instances
+
+## Instances [/api/core/instances/{id}/]
+
+### List all Instances [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 1,
+ "humanReadableName": "uninstantiated-1",
+ "created": "2016-04-26T00:36:22.465259Z",
+ "updated": "2016-04-26T00:36:22.465288Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "instance_id": null,
+ "instance_uuid": null,
+ "name": "mysite_vcpe",
+ "instance_name": null,
+ "ip": null,
+ "image": "1",
+ "creator": "1",
+ "slice": "1",
+ "deployment": "1",
+ "node": "1",
+ "numberCores": 0,
+ "flavor": "1",
+ "userData": null,
+ "isolation": "vm",
+ "volumes": "/etc/dnsmasq.d,/etc/ufw",
+ "parent": null,
+ "networks": [
+ "1"
+ ]
+ }
+ ]
+
+
+
+# Group Nodes
+
+List of the XOS nodes
+
+## Nodes [/api/core/nodes/{id}/]
+
+### List all nodes [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "node2.opencloud.us",
+ "id": 1,
+ "created": "2016-04-29T16:19:05.661567Z",
+ "updated": "2016-04-29T16:19:05.661454Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "node2.opencloud.us",
+ "site_deployment": "1",
+ "site": "1",
+ "nodelabels": []
+ }
+ ]
+
+
+
+# Group Sites
+
+List of the XOS sites
+
+## Sites [/api/core/sites/{id}/]
+
+### List all sites [GET]
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "MySite",
+ "id": 1,
+ "created": "2016-04-29T16:19:03.587770Z",
+ "updated": "2016-04-29T16:19:05.651933Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "name": "MySite",
+ "site_url": "http://opencord.us/",
+ "enabled": true,
+ "hosts_nodes": true,
+ "hosts_users": true,
+ "location": null,
+ "longitude": null,
+ "latitude": null,
+ "login_base": "mysite",
+ "is_public": true,
+ "abbreviated_name": "",
+ "deployments": [
+ "1"
+ ]
+ }
+
+
+# Group Slices
+
+List of the XOS slices
+
+## Slices [/api/core/slices/{id}/]
+
+### List all slices [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "mysite_slice",
+ "id": 1,
+ "created": "2016-04-29T16:23:22.505072Z",
+ "updated": "2016-04-29T16:23:22.504691Z",
+ "enacted": null,
+ "policed": "2016-04-29T16:23:22.781298Z",
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "name": "mysite_slice",
+ "enabled": true,
+ "omf_friendly": false,
+ "description": "",
+ "slice_url": "",
+ "site": "http://apt118.apt.emulab.net/api/core/sites/1/",
+ "max_instances": 10,
+ "service": null,
+ "network": null,
+ "exposed_ports": null,
+ "serviceClass": "http://apt118.apt.emulab.net/api/core/serviceclasses/1/",
+ "creator": "http://apt118.apt.emulab.net/api/core/users/1/",
+ "default_flavor": null,
+ "default_image": null,
+ "mount_data_sets": "GenBank",
+ "default_isolation": "vm",
+ "networks": [
+ "http://apt118.apt.emulab.net/api/core/networks/1/"
+ ]
+ }
+ ]
+
+
+
+# Group Users
+
+List of the XOS users
+
+## Users [/api/core/users/{id}/]
+
+### List all Users [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 2,
+ "password": "pbkdf2_sha256$12000$9gn8DmZuIoz2$YPQkx3AOOV7jZNYr2ddrgUCkiuaPpvb8+aJR7RwLZNA=",
+ "last_login": "2016-04-12T18:50:45.880823Z",
+ "email": "johndoe@myhouse.com",
+ "username": "johndoe@myhouse.com",
+ "firstname": "john",
+ "lastname": "doe",
+ "phone": null,
+ "user_url": null,
+ "site": "http://xos.dev:9999/api/core/sites/1/",
+ "public_key": null,
+ "is_active": true,
+ "is_admin": false,
+ "is_staff": true,
+ "is_readonly": false,
+ "is_registering": false,
+ "is_appuser": false,
+ "login_page": null,
+ "created": "2016-04-12T18:50:45.912602Z",
+ "updated": "2016-04-12T18:50:45.912671Z",
+ "enacted": null,
+ "policed": null,
+ "backend_status": "Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "timezone": "America/New_York"
+ }
+ ]
+
+
+
# Group Subscribers
Resource related to the CORD Subscribers.
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Slices.js b/views/ngXosLib/xosHelpers/src/services/rest/Slices.js
new file mode 100644
index 0000000..5a0da11
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Slices.js
@@ -0,0 +1,15 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Slices
+ * @description Angular resource to fetch /api/core/slices/:id/
+ **/
+ .service('Slices', function($resource){
+ return $resource('/api/core/slices/:id/', { id: '@id' }, {
+ update: { method: 'PUT' }
+ });
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosViews/helperView/src/js/main.js b/views/ngXosViews/helperView/src/js/main.js
index 20de1ec..6dc1d0f 100644
--- a/views/ngXosViews/helperView/src/js/main.js
+++ b/views/ngXosViews/helperView/src/js/main.js
@@ -26,7 +26,7 @@
controller: function(Users){
this.tableConfig = {
- resource: 'Users'
+ resource: 'Instances'
};
// retrieving user list
diff --git a/xos/tests/api/helpers/flavors.py b/xos/tests/api/helpers/flavors.py
new file mode 100644
index 0000000..e16d41f
--- /dev/null
+++ b/xos/tests/api/helpers/flavors.py
@@ -0,0 +1,24 @@
+import dredd_hooks as hooks
+import sys
+
+# HELPERS
+# NOTE move in separated module
+import os
+import sys
+sys.path.append("/opt/xos")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
+import django
+from core.models import *
+from services.cord.models import *
+from services.vtr.models import *
+import urllib2
+import json
+django.setup()
+
+def createFlavor():
+ fl = Flavor(id=1)
+ fl.name = 'm1.large'
+ fl.save()
+ print(fl, fl.id)
+
+createFlavor()
\ No newline at end of file
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index ccf0c6c..83354c7 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -174,6 +174,13 @@
tn.save()
+def createFlavor():
+ fl = Flavor(id=1)
+ fl.name = 'm1.large'
+ fl.save()
+ print(fl)
+
+
@hooks.before_all
def my_before_all_hook(transactions):
# print "-------------------------------- Before All Hook --------------------------------"
@@ -214,6 +221,11 @@
VOLTTenant.objects.get(kind='vOLT').delete()
+@hooks.before("Flavors > Flavors > View a Flavors Detail")
+def test5(transaction):
+ createFlavor()
+
+
@hooks.before("Example > Example Services Collection > List all Example Services")
def exampleTest(transaction):
transaction['skip'] = True
diff --git a/xos/tests/api/source/core/deployment.md b/xos/tests/api/source/core/deployment.md
new file mode 100644
index 0000000..bcd1e0e
--- /dev/null
+++ b/xos/tests/api/source/core/deployment.md
@@ -0,0 +1,40 @@
+# Group Deployments
+
+List of the XOS deployments
+
+## Deployments [/api/core/deployments/{id}/]
+
+### List all deployments [GET]
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "MyDeployment",
+ "id": 1,
+ "created": "2016-04-29T16:19:03.549901Z",
+ "updated": "2016-04-29T16:19:05.624151Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "MyDeployment",
+ "accessControl": "allow all",
+ "images": [
+ "1"
+ ],
+ "sites": [
+ "1"
+ ],
+ "flavors": [
+ "1",
+ "2",
+ "3"
+ ],
+ "dashboardviews": [
+ "1"
+ ]
+ }
\ No newline at end of file
diff --git a/xos/tests/api/source/core/flavors.md b/xos/tests/api/source/core/flavors.md
new file mode 100644
index 0000000..cb63a57
--- /dev/null
+++ b/xos/tests/api/source/core/flavors.md
@@ -0,0 +1,64 @@
+# Group Flavors
+
+List of the XOS flavors
+
+## Flavors [/api/core/flavors/{id}/]
+
+### List all flavors [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "m1.large",
+ "id": 1,
+ "created": "2016-04-29T16:19:01.979548Z",
+ "updated": "2016-04-29T16:19:03.568238Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "m1.large",
+ "description": null,
+ "flavor": "m1.large",
+ "order": 0,
+ "default": false,
+ "deployments": [
+ "1"
+ ]
+ }
+ ]
+
+### View a Flavors Detail [GET]
+
++ Parameters
+ + id: 1 (number) - ID of the Flavors in the form of an integer
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "m1.large",
+ "id": 1,
+ "created": "2016-04-29T16:19:01.979548Z",
+ "updated": "2016-04-29T16:19:03.568238Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "m1.large",
+ "description": null,
+ "flavor": "m1.large",
+ "order": 0,
+ "default": false,
+ "deployments": [
+ "1"
+ ]
+ }
\ No newline at end of file
diff --git a/xos/tests/api/source/core/instances.md b/xos/tests/api/source/core/instances.md
index f0da502..4b95259 100644
--- a/xos/tests/api/source/core/instances.md
+++ b/xos/tests/api/source/core/instances.md
@@ -27,19 +27,19 @@
"name": "mysite_vcpe",
"instance_name": null,
"ip": null,
- "image": "http://xos.dev:9999/api/core/images/1/",
- "creator": "http://xos.dev:9999/api/core/users/1/",
- "slice": "http://xos.dev:9999/api/core/slices/1/",
- "deployment": "http://xos.dev:9999/api/core/deployments/1/",
- "node": "http://xos.dev:9999/api/core/nodes/1/",
+ "image": "1",
+ "creator": "1",
+ "slice": "1",
+ "deployment": "1",
+ "node": "1",
"numberCores": 0,
- "flavor": "http://xos.dev:9999/api/core/flavors/1/",
+ "flavor": "1",
"userData": null,
"isolation": "vm",
"volumes": "/etc/dnsmasq.d,/etc/ufw",
"parent": null,
"networks": [
- "http://xos.dev:9999/api/core/networks/2/"
+ "1"
]
}
]
diff --git a/xos/tests/api/source/core/nodes.md b/xos/tests/api/source/core/nodes.md
new file mode 100644
index 0000000..d9931dc
--- /dev/null
+++ b/xos/tests/api/source/core/nodes.md
@@ -0,0 +1,30 @@
+# Group Nodes
+
+List of the XOS nodes
+
+## Nodes [/api/core/nodes/{id}/]
+
+### List all nodes [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "node2.opencloud.us",
+ "id": 1,
+ "created": "2016-04-29T16:19:05.661567Z",
+ "updated": "2016-04-29T16:19:05.661454Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": true,
+ "name": "node2.opencloud.us",
+ "site_deployment": "1",
+ "site": "1",
+ "nodelabels": []
+ }
+ ]
diff --git a/xos/tests/api/source/core/sites.md b/xos/tests/api/source/core/sites.md
new file mode 100644
index 0000000..c3784db
--- /dev/null
+++ b/xos/tests/api/source/core/sites.md
@@ -0,0 +1,38 @@
+# Group Sites
+
+List of the XOS sites
+
+## Sites [/api/core/sites/{id}/]
+
+### List all sites [GET]
+
++ Response 200 (application/json)
+
+ {
+ "humanReadableName": "MySite",
+ "id": 1,
+ "created": "2016-04-29T16:19:03.587770Z",
+ "updated": "2016-04-29T16:19:05.651933Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "name": "MySite",
+ "site_url": "http://opencord.us/",
+ "enabled": true,
+ "hosts_nodes": true,
+ "hosts_users": true,
+ "location": null,
+ "longitude": null,
+ "latitude": null,
+ "login_base": "mysite",
+ "is_public": true,
+ "abbreviated_name": "",
+ "deployments": [
+ "1"
+ ]
+ }
\ No newline at end of file
diff --git a/xos/tests/api/source/core/slices.md b/xos/tests/api/source/core/slices.md
new file mode 100644
index 0000000..6ec5c7e
--- /dev/null
+++ b/xos/tests/api/source/core/slices.md
@@ -0,0 +1,46 @@
+# Group Slices
+
+List of the XOS slices
+
+## Slices [/api/core/slices/{id}/]
+
+### List all slices [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "mysite_slice",
+ "id": 1,
+ "created": "2016-04-29T16:23:22.505072Z",
+ "updated": "2016-04-29T16:23:22.504691Z",
+ "enacted": null,
+ "policed": "2016-04-29T16:23:22.781298Z",
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "name": "mysite_slice",
+ "enabled": true,
+ "omf_friendly": false,
+ "description": "",
+ "slice_url": "",
+ "site": "http://apt118.apt.emulab.net/api/core/sites/1/",
+ "max_instances": 10,
+ "service": null,
+ "network": null,
+ "exposed_ports": null,
+ "serviceClass": "http://apt118.apt.emulab.net/api/core/serviceclasses/1/",
+ "creator": "http://apt118.apt.emulab.net/api/core/users/1/",
+ "default_flavor": null,
+ "default_image": null,
+ "mount_data_sets": "GenBank",
+ "default_isolation": "vm",
+ "networks": [
+ "http://apt118.apt.emulab.net/api/core/networks/1/"
+ ]
+ }
+ ]
+
\ No newline at end of file