summaryrefslogtreecommitdiffstats
path: root/tests/network_bridging-clean.sh
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2016-12-09 09:08:48 -0800
committerBryan Sullivan <bryan.sullivan@att.com>2016-12-09 09:08:48 -0800
commit50a8c9941eb059b5b4980924e28cc0dd0db65fad (patch)
tree978b984777f54166ab614fc3849d543d37f63ca0 /tests/network_bridging-clean.sh
parent430cddc6467da9d74fe5e791055ed04202278735 (diff)
Add network briding tests
JIRA: COPPER-4 Change-Id: I9b70411b9cb1e2d611443d28f970a0adec06700e Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tests/network_bridging-clean.sh')
-rw-r--r--tests/network_bridging-clean.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/network_bridging-clean.sh b/tests/network_bridging-clean.sh
new file mode 100644
index 0000000..689eaa2
--- /dev/null
+++ b/tests/network_bridging-clean.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Copyright 2015-2016 AT&T Intellectual Property, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# What this is: Cleanup script for the test network_bridging.sh
+#
+# Status: this is a work in progress, under test.
+#
+# Prequisite: OPFNV installed per JOID or Apex installer
+# - OpenStack CLI environment variables setup
+# How to use:
+# Install Congress test server per https://wiki.opnfv.org/copper/academy
+# # Create Congress policy and resources that exercise policy
+# $ bash network_briding.sh
+# # After test, cleanup
+# $ bash network_briding-clean.sh
+
+if [ $# -eq 1 ]; then
+ if [ $1 == "debug" ]; then
+ set -x #echo on
+ fi
+fi
+
+echo "Get Congress policy 'test' ID"
+test_policy_ID=$(openstack congress policy show test | awk "/ id / { print \$4 }")
+
+echo "Delete Congress policy 'test' if it exists"
+if [ "$test_policy_ID" != "" ]; then
+ openstack congress policy delete $test_policy_ID
+ echo "Existing policy 'test' deleted"
+fi
+
+echo "Delete cirros1 instance"
+instance=$(nova list | awk "/ cirros1 / { print \$2 }")
+if [ "$instance" != "" ]; then nova delete $instance; fi
+
+echo "Delete cirros2 instance"
+instance=$(nova list | awk "/ cirros2 / { print \$2 }")
+if [ "$instance" != "" ]; then nova delete $instance; fi
+
+echo "Wait for cirros1 and cirros2 to terminate"
+COUNTER=5
+RESULT="Wait!"
+until [[ $COUNTER -eq 0 || $RESULT == "Go!" ]]; do
+ cirros1_id=$(openstack server list | awk "/ cirros1 / { print \$4 }")
+ cirros2_id=$(openstack server list | awk "/ cirros2 / { print \$4 }")
+ if [[ "$cirros1_id" == "" && "$cirros2_id" == "" ]]; then RESULT="Go!"; fi
+ let COUNTER-=1
+ sleep 5
+done
+
+echo "Delete test_dmz subnet"
+neutron subnet-delete test_dmz
+
+echo "Delete test_dmz network"
+neutron net-delete test_dmz
+
+echo "Delete test_admin subnet"
+neutron subnet-delete test_dmz
+
+echo "Delete test_admin network"
+neutron net-delete test_dmz
+
+set +x #echo off
+