test helpers
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
+Qyvlix3dlTne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00YBgjOVXa8YwVUYdP/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 7612c45..0a8def6 100644
--- a/xos/configurations/test-standalone/Makefile
+++ b/xos/configurations/test-standalone/Makefile
@@ -1,8 +1,16 @@
MYIP:=$(shell hostname -i)
test: frontend
+ # MOCK CORD
+ # MOVE THIS TO FIXTURES inside dredd hooks
+ #sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
+ #sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/frontend/mocks/cord.yaml
+
+ # INSTALL DEPS
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
+
+ # RUN TESTS
sudo docker exec -i teststandalone_xos_1 bash -c "cd /opt/xos/tests/api; npm test"
frontend:
@@ -28,3 +36,6 @@
enter-xos:
sudo docker exec -ti teststandalone_xos_1 bash
+
+enter-xos-db:
+ sudo docker exec -ti teststandalone_xos_db_1 bash
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..eaae294
--- /dev/null
+++ b/xos/tests/api/helpers/subscriber.py
@@ -0,0 +1,20 @@
+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 createTestSubscriber():
+ # deleting all subscribers
+ for s in CordSubscriberRoot.objects.all():
+ print(s.name)
+ s.delete(purge=True)
+
+ # creating the test subscriber
+ subscriber = CordSubscriberRoot(name='Test Subscriber 1')
+ subscriber.save()
+ print "Subscriber Created"
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index 3158e88..3ad996e 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -1,15 +1,16 @@
import dredd_hooks as hooks
import sys
-import commands
+# HELPERS
+from helpers import subscriber
-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;\"'"
-
+restoreSubscriber = "sudo docker exec teststandalone_xos_1_db psql -U postgres -d xos -c \"UPDATE core_tenantroot SET deleted=false WHERE id=1;\""
@hooks.before_each
def my_before_each_hook(transaction):
# print('before each restore', transaction['name'])
- commands.getstatusoutput(restoreSubscriber)
+ # commands.getstatusoutput(restoreSubscriber)
+ Subs.createTestSubscriber()
sys.stdout.flush()