Add ability to build and test ExampleService
diff --git a/scripts/single-node-pod.sh b/scripts/single-node-pod.sh
index 420c038..cf25de0 100755
--- a/scripts/single-node-pod.sh
+++ b/scripts/single-node-pod.sh
@@ -4,7 +4,7 @@
VMS=$( sudo virsh list|grep running|awk '{print $2}' )
for VM in $VMS
do
- sudo uvt-kvm destroy $VM
+ sudo uvt-kvm destroy $VM
done
rm -rf ~/.juju
@@ -48,9 +48,9 @@
i=0
until juju status --format=summary|grep "started: 23" > /dev/null
do
- sleep 60
- (( i += 1 ))
- echo "Waited $i minutes"
+ sleep 60
+ (( i += 1 ))
+ echo "Waited $i minutes"
done
echo "All OpenStack services are up."
@@ -59,7 +59,24 @@
function simulate_fabric() {
echo ""
echo "Setting up simulated fabric on nova-compute node"
- ssh ubuntu@nova-compute "wget https://raw.githubusercontent.com/open-cloud/openstack-cluster-setup/master/scripts/compute-ext-net.sh; sudo bash compute-ext-net.sh"
+ if [[ $EXAMPLESERVICE -eq 1 ]]
+ then
+ SCRIPT=compute-ext-net-tutorial.sh
+ else
+ SCRIPT=compute-ext-net.sh
+ fi
+ ssh ubuntu@nova-compute "wget https://raw.githubusercontent.com/open-cloud/openstack-cluster-setup/master/scripts/$SCRIPT; sudo bash $SCRIPT"
+}
+
+function build_xos_with_exampleservice() {
+ echo ""
+ echo "Adding exampleservice to XOS"
+ ssh ubuntu@xos "cd xos; git config --global user.email 'ubuntu@localhost'; git config --global user.name 'XOS ExampleService'"
+ ssh ubuntu@xos "cd xos/xos/configurations/cord-pod; git cherry-pick 775e00549e535803522fbcd70152e5e1b0629c83"
+ echo ""
+ echo "Rebuilding XOS containers"
+ ssh ubuntu@xos "cd xos/xos/configurations/cord-pod; make local_containers"
+
}
function setup_xos() {
@@ -76,6 +93,11 @@
sleep 30
ssh ubuntu@xos "cd xos/xos/configurations/cord-pod; make cord"
+
+ if [[ $EXAMPLESERVICE -eq 1 ]]
+ then
+ ssh ubuntu@xos "cd xos/xos/configurations/cord-pod; make exampleservice"
+ fi
}
function setup_test_client() {
@@ -100,11 +122,11 @@
echo "*** Wait for vSG VM to come up"
i=0
- until nova list --all-tenants|grep ACTIVE > /dev/null
+ until nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null
do
- sleep 60
- (( i += 1 ))
- echo "Waited $i minutes"
+ sleep 60
+ (( i += 1 ))
+ echo "Waited $i minutes"
done
# get mgmt IP address
@@ -116,9 +138,9 @@
i=0
until ssh -o ProxyCommand="ssh -W %h:%p ubuntu@nova-compute" ubuntu@$MGMTIP "sudo docker ps|grep vcpe" > /dev/null
do
- sleep 60
- (( i += 1 ))
- echo "Waited $i minutes"
+ sleep 60
+ (( i += 1 ))
+ echo "Waited $i minutes"
done
echo ""
@@ -137,26 +159,68 @@
echo ""
if [ $? -eq 0 ]
then
- echo "*** [PASSED] End-to-end connectivity test"
- exit 0
+ echo "*** [PASSED] End-to-end connectivity test"
else
- echo "*** [FAILED] End-to-end connectivity test"
- exit 1
+ echo "*** [FAILED] End-to-end connectivity test"
+ exit 1
fi
}
+function run_exampleservice_test () {
+ source ~/admin-openrc.sh
+
+ echo "*** Wait for exampleservice VM to come up."
+ echo "!!! NOTE that currently the VM will only be created after you login"
+ echo "!!! to XOS and manually create an ExampleService tenant."
+ i=0
+ until nova list --all-tenants|grep exampleservice.*ACTIVE > /dev/null
+ do
+ sleep 60
+ (( i += 1 ))
+ echo "Waited $i minutes"
+ done
+
+ # get mgmt IP address
+ ID=$( nova list --all-tenants|grep mysite_exampleservice|awk '{print $2}' )
+ MGMTIP=$( nova interface-list $ID|grep 172.27|awk '{print $8}' )
+ PUBLICIP=$( nova interface-list $ID|grep 10.168|awk '{print $8}' )
+
+ echo ""
+ echo "*** ssh into exampleservice VM, wait for Apache come up"
+ i=0
+ until ssh -o ProxyCommand="ssh -W %h:%p ubuntu@nova-compute" ubuntu@$MGMTIP "ls /var/run/apache2/apache2.pid"
+ do
+ sleep 60
+ (( i += 1 ))
+ echo "Waited $i minutes"
+ done
+
+
+ echo ""
+ echo "*** Install curl in test client"
+ ssh ubuntu@nova-compute "sudo lxc-attach -n testclient -- apt-get -y install curl"
+
+ echo ""
+ echo "*** Test connectivity to ExampleService from test client"
+ ssh ubuntu@nova-compute "sudo lxc-attach -n testclient -- curl -s http://$PUBLICIP"
+}
+
# Parse options
RUN_TEST=0
-while getopts ":ht" opt; do
+EXAMPLESERVICE=0
+while getopts ":eht" opt; do
case ${opt} in
h ) "echo Usage:"
echo " $0 install OpenStack and prep XOS and ONOS VMs [default]"
+ echo " $0 -e add exampleservice to XOS"
echo " $0 -h display this help message"
echo " $0 -t do install, bring up cord-pod configuration, run E2E test"
exit 0
;;
t ) RUN_TEST=1
;;
+ e ) EXAMPLESERVICE=1
+ ;;
\? ) echo "Invalid option"
exit 1
;;
@@ -179,7 +243,17 @@
if [[ $RUN_TEST -eq 1 ]]
then
+ if [[ $EXAMPLESERVICE -eq 1 ]]
+ then
+ build_xos_with_exampleservice
+ fi
setup_xos
setup_test_client
run_e2e_test
+ if [[ $EXAMPLESERVICE -eq 1 ]]
+ then
+ run_exampleservice_test
+ fi
fi
+
+exit 0