Merge branch 'feature/api-cleanup' of github.com:open-cloud/xos into feature/api-cleanup
diff --git a/.gitignore b/.gitignore
index 2083af5..4adf44a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@
npm-debug.log
xos/core/static/*.css
!xos/core/static/xos.css
+.DS_Store
\ No newline at end of file
diff --git a/xos/configurations/cord/ceilometer-plugins b/xos/configurations/cord/ceilometer-plugins
new file mode 160000
index 0000000..87cd53b
--- /dev/null
+++ b/xos/configurations/cord/ceilometer-plugins
@@ -0,0 +1 @@
+Subproject commit 87cd53b99e43b12f2a175a65440f02f53b564069
diff --git a/xos/configurations/setup/admin-openrc.sh b/xos/configurations/setup/admin-openrc.sh
new file mode 100644
index 0000000..84e53f6
--- /dev/null
+++ b/xos/configurations/setup/admin-openrc.sh
@@ -0,0 +1,8 @@
+export OS_PROJECT_DOMAIN_ID=default
+export OS_USER_DOMAIN_ID=default
+export OS_PROJECT_NAME=admin
+export OS_TENANT_NAME=admin
+export OS_USERNAME=adminapi
+export OS_PASSWORD=765e8807825bbd087333
+export OS_AUTH_URL=http://ctl:35357/v3
+export OS_IDENTITY_API_VERSION=3
diff --git a/xos/configurations/setup/ceilometer_url b/xos/configurations/setup/ceilometer_url
new file mode 100644
index 0000000..586594e
--- /dev/null
+++ b/xos/configurations/setup/ceilometer_url
@@ -0,0 +1 @@
+http://130.127.133.45/xosmetering/
diff --git a/xos/configurations/setup/controller_settings b/xos/configurations/setup/controller_settings
new file mode 100644
index 0000000..a4f0fab
--- /dev/null
+++ b/xos/configurations/setup/controller_settings
@@ -0,0 +1,48 @@
+GENIUSER=1
+CONTROLLER="ctl"
+NETWORKMANAGER="nm"
+STORAGEHOST="ctl"
+OBJECTHOST="ctl"
+COMPUTENODES="cp-1 cp-2 "
+DB_ROOT_PASS="f638fdd304e96fe6f264"
+RABBIT_USER="openstack"
+RABBIT_PASS="b3df6035e70fab63fafe"
+ADMIN_API="adminapi"
+ADMIN_API_PASS="765e8807825bbd087333"
+KEYSTONE_DBPASS="0785387a67431d0e679a"
+GLANCE_DBPASS="b8f8af1dbed9ef7c9672"
+GLANCE_PASS="070f62b5aae7bfcb82b1"
+NOVA_DBPASS="000c2e0391b6e6c1efe1"
+NOVA_PASS="4e5cd858d46a773490ac"
+NOVA_COMPUTENODES_DONE="1"
+NEUTRON_DBPASS="2c00ab52cd022784ab1c"
+NEUTRON_PASS="a54a81b15d2a86da80cf"
+NEUTRON_METADATA_SECRET="bace09098263e43cad83"
+NEUTRON_NETWORKMANAGER_DONE="1"
+NEUTRON_COMPUTENODES_DONE="1"
+NEUTRON_NETWORKS_DONE="1"
+DASHBOARD_DONE="1"
+CINDER_DBPASS="9b7303ea7e149a6f37f3"
+CINDER_PASS="1605df1e285197ec716e"
+STORAGE_HOST_DONE="1"
+SWIFT_PASS="bdfcbd193b99e4d53878"
+SWIFT_HASH_PATH_PREFIX="6622bbfb9a47a85353dc"
+SWIFT_HASH_PATH_SUFFIX="860e0d7ecfd3b622b7ff"
+OBJECT_HOST_DONE="1"
+OBJECT_RING_DONE="1"
+HEAT_DBPASS="b478c3dc47d08e5a2dd0"
+HEAT_PASS="e6a1ad28e1585e2d1dc5"
+HEAT_DOMAIN_PASS="0c499d0fd9cb03ef74fe"
+CEILOMETER_DBPASS="909b521d60d942f674df"
+CEILOMETER_PASS="e859d8ba439d808a0b0f"
+CEILOMETER_SECRET="9978523d156d88591b1c"
+TELEMETRY_COMPUTENODES_DONE="1"
+TELEMETRY_GLANCE_DONE="1"
+TELEMETRY_CINDER_DONE="1"
+TELEMETRY_SWIFT_DONE="1"
+TROVE_DBPASS="9df003b06314d65ef2be"
+TROVE_PASS="61be0107aab4211919a2"
+SAHARA_DBPASS="c5a218e87b1fd83c36bc"
+SAHARA_PASS="eb2133117dd1e48d9419"
+SETUP_BASIC_DONE="1"
+CONTROLLER_FLAT_LAN_IP=10.11.10.1
diff --git a/xos/configurations/setup/flat-lan-cp-1.cord.xos-pg0.clemson.cloudlab.us b/xos/configurations/setup/flat-lan-cp-1.cord.xos-pg0.clemson.cloudlab.us
new file mode 100644
index 0000000..5db289f
--- /dev/null
+++ b/xos/configurations/setup/flat-lan-cp-1.cord.xos-pg0.clemson.cloudlab.us
@@ -0,0 +1,8 @@
+DATABRIDGE=br-flat-lan-1
+DATAIP=10.11.10.3
+DATANETMASK=255.255.0.0
+DATAVLAN=0
+DATAVLANTAG=0
+DATAVLANDEV=
+DATAMAC=008cfa5b088a
+DATADEV=enp130s0f0
diff --git a/xos/configurations/setup/flat-lan-cp-2.cord.xos-pg0.clemson.cloudlab.us b/xos/configurations/setup/flat-lan-cp-2.cord.xos-pg0.clemson.cloudlab.us
new file mode 100644
index 0000000..f7943d8
--- /dev/null
+++ b/xos/configurations/setup/flat-lan-cp-2.cord.xos-pg0.clemson.cloudlab.us
@@ -0,0 +1,8 @@
+DATABRIDGE=br-flat-lan-1
+DATAIP=10.11.10.4
+DATANETMASK=255.255.0.0
+DATAVLAN=0
+DATAVLANTAG=0
+DATAVLANDEV=
+DATAMAC=008cfa5b088c
+DATADEV=enp130s0f0
diff --git a/xos/configurations/setup/flat_net_name b/xos/configurations/setup/flat_net_name
new file mode 100644
index 0000000..09246fa
--- /dev/null
+++ b/xos/configurations/setup/flat_net_name
@@ -0,0 +1 @@
+flat-lan-1-net
\ No newline at end of file
diff --git a/xos/configurations/setup/id_rsa b/xos/configurations/setup/id_rsa
new file mode 100644
index 0000000..3678ee0
--- /dev/null
+++ b/xos/configurations/setup/id_rsa
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAsTKLFAqVd6Co8xXihfuFzyilUpufjy01tVmVwIssmZRgWNlZ
+EvD7L+pAVMoQDEPLmv3jF/+u7QHoIN/KOniC2SzYLuqTbFZ2lYhb7Qbnq/gFzqbn
+aKelUqD/BCPi+FmZuOWrzHr80UApwD0rfwJSHdkFPooz9ADBVr739EFnwhywJdDc
+6fT8GLfr8au6FXiPMQMd1y+DxoYvBqC1yRW8aJ/+jHeJ6+8A0eLlHpAohx1GewhL
+ilI/doswoC+pxyoES3/6BApGZcp6xvmRrLTvvC8Nao3bMBvVOu91SFGUptj/gNse
+lhv7g1eDChn/sjnQ580lG/a9Lki427i0l1VIWQIDAQABAoIBAHkLnug85qfGr0MH
+Qyvlix3dlTneJ1xmNNdCcEMMj5YGPt7S8r82sVClA/cn5ViLg23IW7aMKhGriMfU
+OFBC/Jegw7kg8z5BvlYdxTYgzmeyUT0+1LuwMgZFBo/sd+LRSmp9MiPILCZBX4P8
+BVeI3VGYa7WyMRVQ4sIASF+pwlhdn5SJt7rUrNHPgztHkuWn9jaC0TYDCINFGAiU
+D1XgOkh9fils+gbeW1BVy03MwFJrpf2qFe3BA/hF51dUdH4+62aOb7OlBj3KE/K1
+1L3EkZLD8yTGjV5S2RxR9/7szh2XOPlct3TaWaqeplG40UOAToTqjFQKVzhnKvLD
+JSbAbCUCgYEA1jhsyyCrKgUdY50Ybx8KqYvs+Y80iDOmc7Be2cubvg7VrhPD/zkS
+gy/WLSnL3bEU3rB2PZ7B0M3w3gGjK8BzedoLKOQ77OM+qlYax/a7GIQvF+jNGM8n
+4w7S4L9svoTmukqjSCjOlCx0E1G7PvP1xyE2GCqX2TXD0hJpO7hHA6sCgYEA08Gj
+kDUwdNxYq2m4+CTcupEPn+BRlpUFQkWt9pSRAjHsij5M1XcwcegabthRdTf8ix9d
+rAB80IZRJJMf+mwuT7hHFi1h+mkyAr7YcZ4uOTu1PraervdLs40GImHPk2d3ggWe
+28amqCCUmW7CJzfQsI72bHli/S8Y+TAlkzi4YAsCgYEAuaOSHAFGcxaVnlJv7zQO
+UFky1h1Un8dqsoyf1cuNPomqgL0eN1llAox85Qx4X7hqZoSzIrkmKmWdGzZ+CZcw
+OuNKkngeui0/i+ssMCdPgXJjQSv8OEikvy6EbkFU4lFXhQ7TKuA6DMvtFyTXyDkv
+vw23y/91McVW2gAcc6VA3RsCgYBWyYor1GDjxFtjBZWVviXpIQLyV5GY0cKyArTl
+1sYHzEZR8m6zHoJwbNxIicf47tVGf7h4gkqlfCdNgi8dB7GDYtdfs4Hwi6S/k1BK
+YLY5JsuFxHsM4rXYBPh6pvPYShOk6oDNOoGbbp74s3hHcozJkA5XLvjvI5psptr/
+l8OZOQKBgQCu64v70zDXaaeDnbHfnABuo00YBgjOVXa8YwVUYdP/qpYR7vKLdrvx
+lT/658Lup7vD+9xTWqaLlp5KehyFXNBARGl7oNRWQjZbIWWVVGwx4WjcmEk93BjV
+cogv+YEeGyzsDHDYu7VmoPYc/WAugGD/c9btLFU2QMKQV4vvmf1+cg==
+-----END RSA PRIVATE KEY-----
diff --git a/xos/configurations/setup/id_rsa.pub b/xos/configurations/setup/id_rsa.pub
new file mode 100644
index 0000000..cc8fa0d
--- /dev/null
+++ b/xos/configurations/setup/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxMosUCpV3oKjzFeKF+4XPKKVSm5+PLTW1WZXAiyyZlGBY2VkS8Psv6kBUyhAMQ8ua/eMX/67tAegg38o6eILZLNgu6pNsVnaViFvtBuer+AXOpudop6VSoP8EI+L4WZm45avMevzRQCnAPSt/AlId2QU+ijP0AMFWvvf0QWfCHLAl0Nzp9PwYt+vxq7oVeI8xAx3XL4PGhi8GoLXJFbxon/6Md4nr7wDR4uUekCiHHUZ7CEuKUj92izCgL6nHKgRLf/oECkZlynrG+ZGstO+8Lw1qjdswG9U673VIUZSm2P+A2x6WG/uDV4MKGf+yOdDnzSUb9r0uSLjbuLSXVUhZ teone@ctl.cord.xos-pg0.clemson.cloudlab.us
diff --git a/xos/configurations/setup/node_key b/xos/configurations/setup/node_key
new file mode 100644
index 0000000..c6bd19b
--- /dev/null
+++ b/xos/configurations/setup/node_key
@@ -0,0 +1,16 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDKuGcchWTf4G/UXCzbKgKEnca8HvNv1nUW/h0NyZtXDFSpBldu
+dsXn5qPkeFkhvGz26KnuD+VOAV2eLfzRWdwkj3+GX8V18ifcm3j8j6Zxur7KQzPk
+P2SXRdFhKMv0iBVvu1qBg176TcqJBwBCNi9wVJV6RzYaY7LzhyNIn+SBWwIDAQAB
+AoGAFzYmGE3tzvST2Wz0dePJhgXKy59/oD6eCZPvH7UF5GG1D+V5/Vv8LSFrgq2F
+ByfcEilxy6BmURg27/W0DQSNAC5wx5wpt/dBFfaoYx9jC4vtXliFa2fwQLisE2mj
+htz36oMQplsOpbnJbFvuDvGb5ATZe44QR2ZSadLFLIEB9IECQQDv+qeAdrBLzc3T
+4kvwJaIdq/0C8G1Nq5HoMuI/o7UeyjDzbv8yL3ICVE/CbvwY6e96dM2RAVrZW3S1
+xMASQge3AkEA2ED60IZOn34toOPdqansCEzbPfOjP2FkCasvBdmhGaSCFzttLP1J
+x/Ff1wsr7N4lq9D3x9CsNfKCdj9x9n0rfQJBAN3NYVXF3YoirNPiu+c5EU61cQNv
+bsc0BYaEyUKir7vGi1nkRHCBE7H9dT6zT8RDK/mVzY3xn6N3+TYrpI77gp8CQHMD
+3GIbjKV3Tn1LtBEQtuCTP+frNN/4xGQAD7pkzTH+NNJ2YNKUxDD7R6Xv4yTP4elH
+8wDrEyx+FrUdeVdHq2ECQQDaQLzVDsBGDWgKh8ljoLgNCgp8QD8ykYe5xifWsr0r
+R2Eh7n1YMbS4S3Duomz3k2S6LdIwJaKVxK1Ak+2lvF0z
+-----END RSA PRIVATE KEY-----
+
diff --git a/xos/configurations/setup/node_key.pub b/xos/configurations/setup/node_key.pub
new file mode 100644
index 0000000..b917c9e
--- /dev/null
+++ b/xos/configurations/setup/node_key.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDKuGcchWTf4G/UXCzbKgKEnca8HvNv1nUW/h0NyZtXDFSpBldudsXn5qPkeFkhvGz26KnuD+VOAV2eLfzRWdwkj3+GX8V18ifcm3j8j6Zxur7KQzPkP2SXRdFhKMv0iBVvu1qBg176TcqJBwBCNi9wVJV6RzYaY7LzhyNIn+SBWw==
diff --git a/xos/configurations/setup/nodes.yaml b/xos/configurations/setup/nodes.yaml
new file mode 100644
index 0000000..f9ceb0e
--- /dev/null
+++ b/xos/configurations/setup/nodes.yaml
@@ -0,0 +1,31 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+ - custom_types/xos.yaml
+
+description: autogenerated nodes file
+
+topology_template:
+ node_templates:
+ MyDeployment:
+ type: tosca.nodes.Deployment
+ mysite:
+ type: tosca.nodes.Site
+ cp-1.cord.xos-pg0.clemson.cloudlab.us:
+ type: tosca.nodes.Node
+ requirements:
+ - site:
+ node: mysite
+ relationship: tosca.relationships.MemberOfSite
+ - deployment:
+ node: MyDeployment
+ relationship: tosca.relationships.MemberOfDeployment
+ cp-2.cord.xos-pg0.clemson.cloudlab.us:
+ type: tosca.nodes.Node
+ requirements:
+ - site:
+ node: mysite
+ relationship: tosca.relationships.MemberOfSite
+ - deployment:
+ node: MyDeployment
+ relationship: tosca.relationships.MemberOfDeployment
diff --git a/xos/configurations/setup/padmin_public_key b/xos/configurations/setup/padmin_public_key
new file mode 100644
index 0000000..cc8fa0d
--- /dev/null
+++ b/xos/configurations/setup/padmin_public_key
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxMosUCpV3oKjzFeKF+4XPKKVSm5+PLTW1WZXAiyyZlGBY2VkS8Psv6kBUyhAMQ8ua/eMX/67tAegg38o6eILZLNgu6pNsVnaViFvtBuer+AXOpudop6VSoP8EI+L4WZm45avMevzRQCnAPSt/AlId2QU+ijP0AMFWvvf0QWfCHLAl0Nzp9PwYt+vxq7oVeI8xAx3XL4PGhi8GoLXJFbxon/6Md4nr7wDR4uUekCiHHUZ7CEuKUj92izCgL6nHKgRLf/oECkZlynrG+ZGstO+8Lw1qjdswG9U673VIUZSm2P+A2x6WG/uDV4MKGf+yOdDnzSUb9r0uSLjbuLSXVUhZ teone@ctl.cord.xos-pg0.clemson.cloudlab.us
diff --git a/xos/configurations/setup/virtualbng.json b/xos/configurations/setup/virtualbng.json
new file mode 100644
index 0000000..843ac04
--- /dev/null
+++ b/xos/configurations/setup/virtualbng.json
@@ -0,0 +1,13 @@
+{
+ "localPublicIpPrefixes" : [
+ "10.254.0.128/25"
+ ],
+ "nextHopIpAddress" : "10.254.0.1",
+ "publicFacingMac" : "00:00:00:00:00:66",
+ "xosIpAddress" : "10.11.10.1",
+ "xosRestPort" : "9999",
+ "hosts" : {
+ "cp-1.cord.xos-pg0.clemson.cloudlab.us" : "of:0000000000000001/1",
+ "cp-2.cord.xos-pg0.clemson.cloudlab.us" : "of:0000000000000001/1"
+ }
+}
diff --git a/xos/configurations/setup/vtn-network-cfg.json b/xos/configurations/setup/vtn-network-cfg.json
new file mode 100644
index 0000000..4d7ab07
--- /dev/null
+++ b/xos/configurations/setup/vtn-network-cfg.json
@@ -0,0 +1,45 @@
+{
+ "apps" : {
+ "org.onosproject.cordvtn" : {
+ "cordvtn" : {
+ "privateGatewayMac" : "00:00:00:00:00:01",
+ "localManagementIp": "172.27.0.1/24",
+ "ovsdbPort": "6641",
+ "sshPort": "22",
+ "sshUser": "root",
+ "sshKeyFile": "/root/node_key",
+ "publicGateways": [
+ {
+ "gatewayIp": "10.123.0.1",
+ "gatewayMac": "00:8c:fa:5b:09:d8"
+ }
+ ],
+ "nodes" : [
+ {
+ "hostname": "cp-1.cord.xos-pg0.clemson.cloudlab.us",
+ "hostManagementIp": "130.127.133.46/24",
+ "bridgeId": "of:0000000000000001",
+ "dataPlaneIntf": "enp130s0f0",
+ "dataPlaneIp": "10.11.10.3/24"
+ },
+ {
+ "hostname": "cp-2.cord.xos-pg0.clemson.cloudlab.us",
+ "hostManagementIp": "130.127.133.39/24",
+ "bridgeId": "of:0000000000000002",
+ "dataPlaneIntf": "enp130s0f0",
+ "dataPlaneIp": "10.11.10.4/24"
+ }
+ ]
+ }
+ },
+ "org.onosproject.openstackinterface" : {
+ "openstackinterface" : {
+ "do_not_push_flows" : "true",
+ "neutron_server" : "http://130.127.133.45:9696/v2.0/",
+ "keystone_server" : "http://130.127.133.45:5000/v2.0/",
+ "user_name" : "adminapi",
+ "password" : "765e8807825bbd087333"
+ }
+ }
+ }
+}
diff --git a/xos/configurations/test-standalone/Makefile b/xos/configurations/test-standalone/Makefile
index cc2a3bc..c67b495 100644
--- a/xos/configurations/test-standalone/Makefile
+++ b/xos/configurations/test-standalone/Makefile
@@ -1,14 +1,22 @@
MYIP:=$(shell hostname -i)
-test: frontend
- sudo docker exec -i teststandalone_xos_1 bash -c "cd /opt/xos/tests/api; npm install --production"
- sudo docker exec -i teststandalone_xos_1 bash -c "cd /opt/xos/tests/api; npm test"
-
-frontend:
+xos:
sudo make -f ../common/Makefile.prereqs
sudo docker-compose up -d
bash ../common/wait_for_xos.sh
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/sample.yaml
+ sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
+
+prepare:
+ # INSTALL DEPS
+ # RUN ONCE BEFORE RUNNING TESTS
+ sudo docker exec -i teststandalone_xos_1 bash -c "cd /opt/xos/tests/api; npm install --production"
+ sudo docker exec teststandalone_xos_1 pip install dredd_hooks
+
+
+test:
+ # RUN TESTS
+ sudo docker exec -i teststandalone_xos_1 bash -c "cd /opt/xos/tests/api; npm test"
base-container:
cd ../../../containers/xos; make devel
@@ -26,4 +34,7 @@
sudo docker-compose rm
enter-xos:
- sudo docker exec -ti teststandalone_xos_1 bash
\ No newline at end of file
+ sudo docker exec -ti teststandalone_xos_1 bash
+
+enter-xos-db:
+ sudo docker exec -ti teststandalone_xos_db_1 bash
diff --git a/xos/configurations/test-standalone/README.md b/xos/configurations/test-standalone/README.md
new file mode 100644
index 0000000..bbee0ec
--- /dev/null
+++ b/xos/configurations/test-standalone/README.md
@@ -0,0 +1,10 @@
+# API Test Configuration
+
+This configuration is intended to be used to test the API,
+to use it:
+
+- `make containers` //rebuild the container with current code
+- `make xos` //start the container with fixtures data
+- `make prepare` //install test dependencies
+
+Then anytime is needed `make test` (`xos/api` folder is shared with the container)
\ No newline at end of file
diff --git a/xos/configurations/test-standalone/docker-compose.yml b/xos/configurations/test-standalone/docker-compose.yml
index b3be0ba..5039f08 100644
--- a/xos/configurations/test-standalone/docker-compose.yml
+++ b/xos/configurations/test-standalone/docker-compose.yml
@@ -25,3 +25,4 @@
- ../../templates/admin:/opt/xos/templates/admin
- ../../configurations:/opt/xos/configurations
- ../../tests:/opt/xos/tests
+ - ../../api:/opt/xos/api
diff --git a/xos/services/cord/models.py b/xos/services/cord/models.py
index 7adc4cc..07c169d 100644
--- a/xos/services/cord/models.py
+++ b/xos/services/cord/models.py
@@ -647,6 +647,7 @@
def get_slice(self):
if not self.provider_service.slices.count():
+ print self, "dio porco"
raise XOSConfigurationError("The service has no slices")
slice = self.provider_service.slices.all()[0]
return slice
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 e6092cb..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",
@@ -329,8 +370,8 @@
[
{
- "humanReadableName": "vOLT-tenant-3",
- "id": 3,
+ "humanReadableName": "vOLT-tenant-1",
+ "id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
@@ -352,13 +393,13 @@
{
"s_tag": "222",
"c_tag": "432",
- "subscriber": "1"
+ "subscriber": 1
}
+ Response 200 (application/json)
{
- "humanReadableName": "vOLT-tenant-3",
+ "humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
@@ -378,15 +419,15 @@
A virtual volt is complete once is_synced equal true
+ Parameters
- + volt_id: 3 (number) - ID of the vOLT in the form of an integer
+ + volt_id: 1 (number) - ID of the vOLT in the form of an integer
### View a vOLT Detail [GET]
+ Response 200 (application/json)
{
- "humanReadableName": "vOLT-tenant-3",
- "id": 3,
+ "humanReadableName": "vOLT-tenant-1",
+ "id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
@@ -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/dredd.yml b/xos/tests/api/dredd.yml
index d0856d2..a214c7c 100644
--- a/xos/tests/api/dredd.yml
+++ b/xos/tests/api/dredd.yml
@@ -32,4 +32,4 @@
hooks-worker-handler-host: localhost
hooks-worker-handler-port: 61321
blueprint: apiary.apib
-endpoint: 'http://xos.dev:9999/'
+endpoint: 'http://127.0.0.1:8000/'
diff --git a/xos/tests/api/helpers/nuke.sh b/xos/tests/api/helpers/__init__.py
similarity index 100%
rename from xos/tests/api/helpers/nuke.sh
rename to xos/tests/api/helpers/__init__.py
diff --git a/xos/tests/api/helpers/subscriber.py b/xos/tests/api/helpers/subscriber.py
new file mode 100644
index 0000000..8e6d004
--- /dev/null
+++ b/xos/tests/api/helpers/subscriber.py
@@ -0,0 +1,124 @@
+# NOT used, see https://github.com/apiaryio/dredd-hooks-python/issues/17#issuecomment-206950166
+
+import os
+import sys
+sys.path.append("/opt/xos")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
+import django
+from core.models import *
+#from hpc.models import *
+from services.cord.models import *
+django.setup()
+
+
+def cleanDB():
+ # deleting all subscribers
+ for s in CordSubscriberRoot.objects.all():
+ s.delete(purge=True)
+
+ # deleting all slices
+ for s in Slice.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Services
+ for s in Service.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Tenants
+ for s in Tenant.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Networks
+ for s in Network.objects.all():
+ s.delete(purge=True)
+
+ # deleting all NetworkTemplates
+ for s in NetworkTemplate.objects.all():
+ s.delete(purge=True)
+
+ for s in NetworkSlice.objects.all():
+ s.delete(purge=True)
+
+
+def createTestSubscriber():
+
+ cleanDB()
+
+ # load user
+ user = User.objects.get(email="padmin@vicci.org")
+
+ # network template
+ private_template = NetworkTemplate()
+ private_template.name = 'Private Network'
+ private_template.save()
+
+ # creating the test subscriber
+ subscriber = CordSubscriberRoot(name='Test Subscriber 1', id=1)
+ subscriber.save()
+
+ # Site
+ site = Site.objects.get(name='MySite')
+
+ # vSG service
+ vsg_service = VSGService()
+ vsg_service.name = 'service_vsg'
+
+ # vSG slice
+ vsg_slice = Slice()
+ vsg_slice.name = site.login_base + "_testVsg"
+ vsg_slice.service = vsg_service.id
+ vsg_slice.site = site
+ vsg_slice.caller = user
+
+ vsg_slice.save()
+
+ vsg_service.save()
+
+ # volt service
+ volt_service = VOLTService()
+ volt_service.name = 'service_volt'
+ volt_service.save()
+
+ # vcpe slice
+ vcpe_slice = Slice()
+ vcpe_slice.name = site.login_base + "_testVcpe"
+ vcpe_slice.service = Service.objects.get(kind='vCPE')
+ vcpe_slice.site = site
+ vcpe_slice.caller = user
+ vcpe_slice.save()
+
+ print 'vcpe_slice created'
+
+ # create a lan network
+ lan_net = Network()
+ lan_net.name = 'lan_network'
+ lan_net.owner = vcpe_slice
+ lan_net.template = private_template
+ lan_net.save()
+
+ print 'lan_network created'
+
+ # add relation between vcpe slice and lan network
+ vcpe_network = NetworkSlice()
+ vcpe_network.network = lan_net
+ vcpe_network.slice = vcpe_slice
+ vcpe_network.save()
+
+ print 'vcpe network relation added'
+
+ # vbng service
+ vbng_service = VBNGService()
+ vbng_service.name = 'service_vbng'
+ vbng_service.save()
+
+ # volt tenant
+ vt = VOLTTenant(subscriber=subscriber.id, id=1)
+ vt.s_tag = "222"
+ vt.c_tag = "432"
+ vt.provider_service_id = volt_service.id
+ vt.caller = user
+ vt.save()
+
+ print "Subscriber Created"
+
+createTestSubscriber()
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 3158e88..350156f 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -1,33 +1,171 @@
import dredd_hooks as hooks
import sys
-import commands
+
+# 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 *
+django.setup()
-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;\"'"
+def cleanDB():
+ # deleting all subscribers
+ for s in CordSubscriberRoot.objects.all():
+ s.delete(purge=True)
+
+ # deleting all slices
+ for s in Slice.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Services
+ for s in Service.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Tenants
+ for s in Tenant.objects.all():
+ s.delete(purge=True)
+
+ # deleting all Networks
+ for s in Network.objects.all():
+ s.delete(purge=True)
+
+ # deleting all NetworkTemplates
+ for s in NetworkTemplate.objects.all():
+ s.delete(purge=True)
+
+ for s in NetworkSlice.objects.all():
+ s.delete(purge=True)
+
+
+def createTestSubscriber():
+
+ cleanDB()
+
+ # load user
+ user = User.objects.get(email="padmin@vicci.org")
+
+ # network template
+ private_template = NetworkTemplate()
+ private_template.name = 'Private Network'
+ private_template.save()
+
+ # creating the test subscriber
+ subscriber = CordSubscriberRoot(name='Test Subscriber 1', id=1)
+ subscriber.save()
+
+ # Site
+ site = Site.objects.get(name='MySite')
+
+ # vSG service
+ vsg_service = VSGService()
+ vsg_service.name = 'service_vsg'
+
+ # vSG slice
+ vsg_slice = Slice()
+ vsg_slice.name = site.login_base + "_testVsg"
+ vsg_slice.service = vsg_service.id
+ vsg_slice.site = site
+ vsg_slice.caller = user
+
+ vsg_slice.save()
+
+ vsg_service.save()
+
+ # volt service
+ volt_service = VOLTService()
+ volt_service.name = 'service_volt'
+ volt_service.save()
+
+ # vcpe slice
+ vcpe_slice = Slice()
+ vcpe_slice.name = site.login_base + "_testVcpe"
+ vcpe_slice.service = Service.objects.get(kind='vCPE')
+ vcpe_slice.site = site
+ vcpe_slice.caller = user
+ vcpe_slice.save()
+
+ # print 'vcpe_slice created'
+
+ # create a lan network
+ lan_net = Network()
+ lan_net.name = 'lan_network'
+ lan_net.owner = vcpe_slice
+ lan_net.template = private_template
+ lan_net.save()
+
+ # print 'lan_network created'
+
+ # add relation between vcpe slice and lan network
+ vcpe_network = NetworkSlice()
+ vcpe_network.network = lan_net
+ vcpe_network.slice = vcpe_slice
+ vcpe_network.save()
+
+ # print 'vcpe network relation added'
+
+ # vbng service
+ vbng_service = VBNGService()
+ vbng_service.name = 'service_vbng'
+ vbng_service.save()
+
+ # volt tenant
+ vt = VOLTTenant(subscriber=subscriber.id, id=1)
+ vt.s_tag = "222"
+ vt.c_tag = "432"
+ vt.provider_service_id = volt_service.id
+ vt.caller = user
+ vt.save()
+
+ # 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 b9879ad..63c68ad 100644
--- a/xos/tests/api/source/tenant/cord/volt.md
+++ b/xos/tests/api/source/tenant/cord/volt.md
@@ -10,8 +10,8 @@
[
{
- "humanReadableName": "vOLT-tenant-3",
- "id": 3,
+ "humanReadableName": "vOLT-tenant-1",
+ "id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
@@ -33,13 +33,13 @@
{
"s_tag": "222",
"c_tag": "432",
- "subscriber": "1"
+ "subscriber": 1
}
+ Response 200 (application/json)
{
- "humanReadableName": "vOLT-tenant-3",
+ "humanReadableName": "vOLT-tenant-1",
"id": 1,
"service_specific_id": "123",
"s_tag": "222",
@@ -59,15 +59,15 @@
A virtual volt is complete once is_synced equal true
+ Parameters
- + volt_id: 3 (number) - ID of the vOLT in the form of an integer
+ + volt_id: 1 (number) - ID of the vOLT in the form of an integer
### View a vOLT Detail [GET]
+ Response 200 (application/json)
{
- "humanReadableName": "vOLT-tenant-3",
- "id": 3,
+ "humanReadableName": "vOLT-tenant-1",
+ "id": 1,
"service_specific_id": "123",
"s_tag": "222",
"c_tag": "432",
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