Documented cord API
diff --git a/xos/tests/api/.gitignore b/xos/tests/api/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/xos/tests/api/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/xos/tests/api/README.md b/xos/tests/api/README.md
index d70a5c5..67db53d 100644
--- a/xos/tests/api/README.md
+++ b/xos/tests/api/README.md
@@ -1,13 +1,11 @@
# xos-api-docs
-To execute the test:
+These folder contain the XOS API definition and specs. To run tests visit `configurations/test-standalone` folder.
+To document new API:
- run `npm install`
-- run `pip install dredd_hooks`
-- open `dredd.yml` and change `endpoint: 'http://xos.dev:9999'` to your experiment url
-- open `hooks.py` and change `restoreSubscriber` to ssh into your experiment
+- run `npm start`
+- add the appropriate endpont under `source` folder.
-# TODO
-
-Define helper to setup the DB in a consistent shape for tests.
+_API are documented using (Api BluePrint)[https://apiblueprint.org/] syntax and the documentation is published on (Apiary)[http://docs.xos.apiary.io/#]_
diff --git a/xos/tests/api/apiary.apib b/xos/tests/api/apiary.apib
index 62ec236..154f7d7 100644
--- a/xos/tests/api/apiary.apib
+++ b/xos/tests/api/apiary.apib
@@ -3,6 +3,47 @@
# XOS
+# Group ONOS Services
+
+## ONOS Services Collection [/api/service/onos/]
+
+### List all ONOS Services [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "service_ONOS_vBNG",
+ "id": 5,
+ "rest_hostname": "",
+ "rest_port": "8181",
+ "no_container": false,
+ "node_key": ""
+ }
+ ]
+
+
+# Group vSG
+
+## vSG Collection [/api/service/vsg/]
+
+### List all vSGs [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "service_vsg",
+ "id": 2,
+ "wan_container_gateway_ip": "",
+ "wan_container_gateway_mac": "",
+ "dns_servers": "8.8.8.8",
+ "url_filter_kind": null,
+ "node_label": null
+ }
+ ]
+
+
# Group Subscribers
Resource related to the CORD Subscribers.
@@ -261,7 +302,7 @@
### Create a Truckroll [POST]
-+ Request 200 (application/json)
++ Request (application/json)
{
"target_id": 2,
@@ -270,11 +311,11 @@
"argument": "8.8.8.8"
}
-+ Response 200 (application/json)
++ Response 201 (application/json)
{
- "humanReadableName": "vTR-tenant-10",
- "id": 10,
+ "humanReadableName": "vTR-tenant-1",
+ "id": 1,
"provider_service": 6,
"target_id": 2,
"scope": "container",
@@ -352,7 +393,7 @@
{
"s_tag": "222",
"c_tag": "432",
- "subscriber": "1"
+ "subscriber": 1
}
+ Response 200 (application/json)
@@ -399,3 +440,22 @@
"compute_node_name": "node2.opencloud.us"
}
}
+
+
+
+# Group ONOS Apps
+
+## app Collection [/api/tenant/onos/app/]
+
+### List all apps [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "onos-tenant-7",
+ "id": 7,
+ "name": "vBNG_ONOS_app",
+ "dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
+ }
+ ]
\ No newline at end of file
diff --git a/xos/tests/api/hooks.js b/xos/tests/api/hooks.js
deleted file mode 100644
index bd05a17..0000000
--- a/xos/tests/api/hooks.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var hooks = require('hooks');
-require('shelljs/global');
-
-var restoreSubscriber = `ssh xos 'sudo docker exec frontend_xos_db_1 psql -U postgres -d xos -c "UPDATE core_tenantroot SET deleted=false WHERE id=1"';`
-
-hooks.beforeEach(function (transaction, done) {
- hooks.log('before each');
- var child = exec(restoreSubscriber, {async:true});
- child.stdout.on('data', function(data) {
- done();
- });
-});
\ No newline at end of file
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index f806cb1..350156f 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -10,6 +10,7 @@
import django
from core.models import *
from services.cord.models import *
+from services.vtr.models import *
django.setup()
@@ -124,29 +125,47 @@
# print "Subscriber Created"
+def deleteTruckrolls():
+ for s in VTRTenant.objects.all():
+ s.delete(purge=True)
+
+
+def setUpTruckroll():
+ service_vtr = VTRService()
+ service_vtr.name = 'service_vtr'
+ service_vtr.save()
+
+
+def createTruckroll():
+ setUpTruckroll()
+ tn = VTRTenant(id=1)
+ tn.save()
+
+
@hooks.before_each
def my_before_each_hook(transaction):
- # print('before each restore', transaction['name'])
- # commands.getstatusoutput(restoreSubscriber)
createTestSubscriber()
sys.stdout.flush()
@hooks.before("Truckroll > Truckroll Collection > Create a Truckroll")
-def skip_test1(transaction):
- transaction['skip'] = True
+def test1(transaction):
+ setUpTruckroll()
@hooks.before("Truckroll > Truckroll Detail > View a Truckroll Detail")
-def skip_test2(transaction):
- transaction['skip'] = True
+def test2(transaction):
+ deleteTruckrolls()
+ createTruckroll()
@hooks.before("Truckroll > Truckroll Detail > Delete a Truckroll Detail")
-def skip_test3(transaction):
- transaction['skip'] = True
+def test3(transaction):
+ deleteTruckrolls()
+ createTruckroll()
@hooks.before("vOLT > vOLT Collection > Create a vOLT")
-def skip_test4(transaction):
+def test4(transaction):
transaction['skip'] = True
+ # VOLTTenant.objects.get(kind='vOLT').delete()
diff --git a/xos/tests/api/source/service/onos.md b/xos/tests/api/source/service/onos.md
new file mode 100644
index 0000000..3b5e623
--- /dev/null
+++ b/xos/tests/api/source/service/onos.md
@@ -0,0 +1,18 @@
+# Group ONOS Services
+
+## ONOS Services Collection [/api/service/onos/]
+
+### List all ONOS Services [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "service_ONOS_vBNG",
+ "id": 5,
+ "rest_hostname": "",
+ "rest_port": "8181",
+ "no_container": false,
+ "node_key": ""
+ }
+ ]
\ No newline at end of file
diff --git a/xos/tests/api/source/service/vsg.md b/xos/tests/api/source/service/vsg.md
new file mode 100644
index 0000000..9247450
--- /dev/null
+++ b/xos/tests/api/source/service/vsg.md
@@ -0,0 +1,19 @@
+# Group vSG
+
+## vSG Collection [/api/service/vsg/]
+
+### List all vSGs [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "service_vsg",
+ "id": 2,
+ "wan_container_gateway_ip": "",
+ "wan_container_gateway_mac": "",
+ "dns_servers": "8.8.8.8",
+ "url_filter_kind": null,
+ "node_label": null
+ }
+ ]
\ No newline at end of file
diff --git a/xos/tests/api/source/tenant/cord/truckroll.md b/xos/tests/api/source/tenant/cord/truckroll.md
index f5e8626..33b67db 100644
--- a/xos/tests/api/source/tenant/cord/truckroll.md
+++ b/xos/tests/api/source/tenant/cord/truckroll.md
@@ -26,7 +26,7 @@
### Create a Truckroll [POST]
-+ Request 200 (application/json)
++ Request (application/json)
{
"target_id": 2,
@@ -35,11 +35,11 @@
"argument": "8.8.8.8"
}
-+ Response 200 (application/json)
++ Response 201 (application/json)
{
- "humanReadableName": "vTR-tenant-10",
- "id": 10,
+ "humanReadableName": "vTR-tenant-1",
+ "id": 1,
"provider_service": 6,
"target_id": 2,
"scope": "container",
diff --git a/xos/tests/api/source/tenant/cord/volt.md b/xos/tests/api/source/tenant/cord/volt.md
index 8f045f7..63c68ad 100644
--- a/xos/tests/api/source/tenant/cord/volt.md
+++ b/xos/tests/api/source/tenant/cord/volt.md
@@ -33,7 +33,7 @@
{
"s_tag": "222",
"c_tag": "432",
- "subscriber": "1"
+ "subscriber": 1
}
+ Response 200 (application/json)
diff --git a/xos/tests/api/source/tenant/onos/app.md b/xos/tests/api/source/tenant/onos/app.md
new file mode 100644
index 0000000..a43aae9
--- /dev/null
+++ b/xos/tests/api/source/tenant/onos/app.md
@@ -0,0 +1,16 @@
+# Group ONOS Apps
+
+## app Collection [/api/tenant/onos/app/]
+
+### List all apps [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "onos-tenant-7",
+ "id": 7,
+ "name": "vBNG_ONOS_app",
+ "dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
+ }
+ ]
\ No newline at end of file