Added flavors, test passing (locally)
diff --git a/apiary.apib b/apiary.apib
index ee28967..cdee98c 100644
--- a/apiary.apib
+++ b/apiary.apib
@@ -13,11 +13,51 @@
+ 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"
+ ]
+ }
+ ]
+
+### View a Deployment Detail [GET]
+
++ Parameters
+ + id: 1 (number) - ID of the Deployment in the form of an integer
+
++ Response 200 (application/json)
+
{
"humanReadableName": "MyDeployment",
"id": 1,
- "created": "2016-04-29T16:19:03.549901Z",
- "updated": "2016-04-29T16:19:05.624151Z",
+ "created": "2016-04-27T21:46:57.354544Z",
+ "updated": "2016-04-27T21:47:05.221720Z",
"enacted": null,
"policed": null,
"backend_register": "{}",
@@ -28,21 +68,20 @@
"no_sync": true,
"name": "MyDeployment",
"accessControl": "allow all",
- "images": [
- "1"
- ],
+ "images": [],
"sites": [
"1"
],
"flavors": [
- "1",
+ "3",
"2",
- "3"
+ "1"
],
"dashboardviews": [
- "1"
+ "3"
]
}
+
# Group Flavors
@@ -323,40 +362,6 @@
-# Group Utility
-
-List of the XOS Utility API
-
-## Login [/api/utility/login/]
-
-### Log a user in the system [POST]
-
-+ Request (application/json)
-
- {
- "username": "padmin@vicci.org",
- "password": "letmein"
- }
-
-+ Response 200 (application/json)
-
- {
- "xoscsrftoken":"xuvsRC1jkXAsnrdRlgJvcXpmtthTAqqf",
- "xossessionid":"7ds5a3wzjlgbjqo4odkd25qsm0j2s6zg",
- "user": "{\"policed\": null, \"site\": 3, \"is_appuser\": false, \"is_staff\": true, \"backend_status\": \"Provisioning in progress\", \"id\": 3, \"is_registering\": false, \"last_login\": \"2016-04-30T22:51:04.788675+00:00\", \"email\": \"padmin@vicci.org\", \"no_sync\": false, \"username\": \"padmin@vicci.org\", \"dashboards\": [11], \"login_page\": null, \"firstname\": \"XOS\", \"user_url\": null, \"deleted\": false, \"lastname\": \"admin\", \"is_active\": true, \"lazy_blocked\": false, \"phone\": null, \"is_admin\": true, \"enacted\": null, \"public_key\": null, \"is_readonly\": false, \"no_policy\": false, \"write_protect\": false}"
- }
-
-## Logout [/api/utility/logout/]
-
-### Log a user out of the system [POST]
-
-+ Request (application/json)
- {xossessionid: "sessionId"}
-
-+ Response 200 (application/json)
-
-
-
# Group Example
## Example Services Collection [/api/service/exampleservice/]
@@ -415,6 +420,40 @@
]
+# Group Utility
+
+List of the XOS Utility API
+
+## Login [/api/utility/login/]
+
+### Log a user in the system [POST]
+
++ Request (application/json)
+
+ {
+ "username": "padmin@vicci.org",
+ "password": "letmein"
+ }
+
++ Response 200 (application/json)
+
+ {
+ "xoscsrftoken":"xuvsRC1jkXAsnrdRlgJvcXpmtthTAqqf",
+ "xossessionid":"7ds5a3wzjlgbjqo4odkd25qsm0j2s6zg",
+ "user": "{\"policed\": null, \"site\": 3, \"is_appuser\": false, \"is_staff\": true, \"backend_status\": \"Provisioning in progress\", \"id\": 3, \"is_registering\": false, \"last_login\": \"2016-04-30T22:51:04.788675+00:00\", \"email\": \"padmin@vicci.org\", \"no_sync\": false, \"username\": \"padmin@vicci.org\", \"dashboards\": [11], \"login_page\": null, \"firstname\": \"XOS\", \"user_url\": null, \"deleted\": false, \"lastname\": \"admin\", \"is_active\": true, \"lazy_blocked\": false, \"phone\": null, \"is_admin\": true, \"enacted\": null, \"public_key\": null, \"is_readonly\": false, \"no_policy\": false, \"write_protect\": false}"
+ }
+
+## Logout [/api/utility/logout/]
+
+### Log a user out of the system [POST]
+
++ Request (application/json)
+ {xossessionid: "sessionId"}
+
++ Response 200 (application/json)
+
+
+
# Group Subscribers
Resource related to the CORD Subscribers.
diff --git a/views/ngXosLib/apigen/blueprintToNgResource.js b/views/ngXosLib/apigen/blueprintToNgResource.js
index 21d65e7..fdb1050 100644
--- a/views/ngXosLib/apigen/blueprintToNgResource.js
+++ b/views/ngXosLib/apigen/blueprintToNgResource.js
@@ -26,10 +26,8 @@
// Loop APIs endpoint
const loopApiEndpoint = (group) => {
- // {name: 'ResourceName', attributes: {href: '/ahhsiiis'}}
+ // removing description
_.remove(group, {element: 'copy'})
- // console.log(group);
- // _.forEach(group, d => console.log(d));
return _.map(group, g => {
return {
@@ -46,6 +44,7 @@
}
_.forEach(defs, d => {
console.info(chalk.blue.bold(`Parsing Group: ${d.meta.title}`));
+
var data = {
description: getGroupDescription(d.content),
ngModule: angualarModuleName,
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Deployments.js b/views/ngXosLib/xosHelpers/src/services/rest/Deployments.js
new file mode 100644
index 0000000..4fecbc2
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Deployments.js
@@ -0,0 +1,15 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Deployments
+ * @description Angular resource to fetch /api/core/deployments/:id/
+ **/
+ .service('Deployments', function($resource){
+ return $resource('/api/core/deployments/:id/', { id: '@id' }, {
+ update: { method: 'PUT' }
+ });
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Flavors.js b/views/ngXosLib/xosHelpers/src/services/rest/Flavors.js
new file mode 100644
index 0000000..348b770
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Flavors.js
@@ -0,0 +1,15 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Flavors
+ * @description Angular resource to fetch /api/core/flavors/:id/
+ **/
+ .service('Flavors', function($resource){
+ return $resource('/api/core/flavors/:id/', { id: '@id' }, {
+ update: { method: 'PUT' }
+ });
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Nodes.js b/views/ngXosLib/xosHelpers/src/services/rest/Nodes.js
new file mode 100644
index 0000000..bf2e387
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Nodes.js
@@ -0,0 +1,15 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Nodes
+ * @description Angular resource to fetch /api/core/nodes/:id/
+ **/
+ .service('Nodes', function($resource){
+ return $resource('/api/core/nodes/:id/', { id: '@id' }, {
+ update: { method: 'PUT' }
+ });
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Sites.js b/views/ngXosLib/xosHelpers/src/services/rest/Sites.js
new file mode 100644
index 0000000..818d741
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Sites.js
@@ -0,0 +1,15 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Sites
+ * @description Angular resource to fetch /api/core/sites/:id/
+ **/
+ .service('Sites', function($resource){
+ return $resource('/api/core/sites/:id/', { id: '@id' }, {
+ update: { method: 'PUT' }
+ });
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Utility.js b/views/ngXosLib/xosHelpers/src/services/rest/Utility.js
new file mode 100644
index 0000000..a735c46
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Utility.js
@@ -0,0 +1,21 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Login
+ * @description Angular resource to fetch /api/utility/login/
+ **/
+ .service('Login', function($resource){
+ return $resource('/api/utility/login/');
+ })
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Logout
+ * @description Angular resource to fetch /api/utility/logout/
+ **/
+ .service('Logout', function($resource){
+ return $resource('/api/utility/logout/');
+ })
+})();
\ No newline at end of file
diff --git a/xos/configurations/test-standalone/Makefile b/xos/configurations/test-standalone/Makefile
index efea0b5..7de1598 100644
--- a/xos/configurations/test-standalone/Makefile
+++ b/xos/configurations/test-standalone/Makefile
@@ -28,6 +28,8 @@
sudo docker exec teststandalone_xos_db_1 psql -U postgres -d xos -c "$$TRUNCATE_FN" >/dev/null 2>&1
sudo docker exec teststandalone_xos_db_1 psql -U postgres -d xos -c "SELECT truncate_tables('postgres');" >/dev/null 2>&1
sudo docker exec teststandalone_xos_db_1 psql -U postgres -d xos -c "SELECT setval('core_tenant_id_seq', 1)" >/dev/null 2>&1
+ sudo docker exec teststandalone_xos_db_1 psql -U postgres -d xos -c "SELECT setval('core_deployment_id_seq', 1)" >/dev/null 2>&1
+ sudo docker exec teststandalone_xos_db_1 psql -U postgres -d xos -c "SELECT setval('core_flavor_id_seq', 1)" >/dev/null 2>&1
sudo docker-compose run xos python /opt/xos/manage.py --noobserver --nomodelpolicy loaddata /opt/xos/core/fixtures/core_initial_data.json
sudo docker-compose run xos python /opt/xos/tosca/run.py none /opt/xos/configurations/common/fixtures.yaml
sudo docker-compose run xos python /opt/xos/tosca/run.py none /opt/xos/configurations/common/mydeployment.yaml
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index 60440e0..03b2ca1 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -63,11 +63,7 @@
def createTestSubscriber():
cleanDB()
-
- # create flavors
- small = Flavor()
- small.name = "m1.small"
- small.save()
+ createFlavors()
# load user
user = User.objects.get(email="padmin@vicci.org")
@@ -182,11 +178,25 @@
tn.save()
-def createFlavor():
- fl = Flavor(id=1)
- fl.name = 'm1.large'
- fl.save()
- print(fl)
+def createFlavors():
+ small = Flavor(id=1)
+ small.name = "m1.small"
+ small.save()
+
+ medium = Flavor(id=2)
+ medium.name = "m1.medium"
+ medium.save()
+
+ large = Flavor(id=3)
+ large.name = "m1.large"
+ large.save()
+
+
+def createDeployment():
+ deployment = Deployment(id=1)
+ deployment.name = 'MyTestDeployment'
+ deployment.save()
+ print 'Created deployment: ', deployment.id
@hooks.before_all
@@ -231,7 +241,12 @@
@hooks.before("Flavors > Flavors > View a Flavors Detail")
def test5(transaction):
- createFlavor()
+ createFlavors()
+
+
+@hooks.before("Deployments > Deployments > View a Deployment Detail")
+def deployments_collection(transaction):
+ createDeployment()
@hooks.before("Example > Example Services Collection > List all Example Services")
diff --git a/xos/tests/api/source/core/deployment.md b/xos/tests/api/source/core/deployment.md
index bcd1e0e..d7599f3 100644
--- a/xos/tests/api/source/core/deployment.md
+++ b/xos/tests/api/source/core/deployment.md
@@ -8,11 +8,51 @@
+ 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"
+ ]
+ }
+ ]
+
+### View a Deployment Detail [GET]
+
++ Parameters
+ + id: 1 (number) - ID of the Deployment in the form of an integer
+
++ Response 200 (application/json)
+
{
"humanReadableName": "MyDeployment",
"id": 1,
- "created": "2016-04-29T16:19:03.549901Z",
- "updated": "2016-04-29T16:19:05.624151Z",
+ "created": "2016-04-27T21:46:57.354544Z",
+ "updated": "2016-04-27T21:47:05.221720Z",
"enacted": null,
"policed": null,
"backend_register": "{}",
@@ -23,18 +63,16 @@
"no_sync": true,
"name": "MyDeployment",
"accessControl": "allow all",
- "images": [
- "1"
- ],
+ "images": [],
"sites": [
"1"
],
"flavors": [
- "1",
+ "3",
"2",
- "3"
+ "1"
],
"dashboardviews": [
- "1"
+ "3"
]
- }
\ No newline at end of file
+ }