aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/scripts
diff options
context:
space:
mode:
authorma987d <ma987d@att.com>2017-09-28 16:33:03 -0500
committerma987d <ma987d@att.com>2017-09-29 18:03:47 -0500
commite38164bcd2a6d4e14c980fed52c510c8b6759f94 (patch)
tree2e8a695df90dd7b562d661ab0a30cb0bbabac0ae /test/csit/scripts
parent35921f6c42432336777607d1b2ff53191adaf420 (diff)
Policy CSIT test files with latest changes
Issue-Id: POLICY-77 Signed-off-by: ma987d <ma987d@att.com> Change-Id: I6704704b676c0c99817a61ca614e49ba980d79bd
Diffstat (limited to 'test/csit/scripts')
-rwxr-xr-xtest/csit/scripts/policy/script1.sh127
1 files changed, 127 insertions, 0 deletions
diff --git a/test/csit/scripts/policy/script1.sh b/test/csit/scripts/policy/script1.sh
index a005c3a84..473ef0dd8 100755
--- a/test/csit/scripts/policy/script1.sh
+++ b/test/csit/scripts/policy/script1.sh
@@ -15,3 +15,130 @@
# limitations under the License.
#
echo "This is ${WORKSPACE}/test/csit/scripts/policy/script1.sh"
+
+
+# the directory of the script
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+echo ${DIR}
+
+# the temp directory used, within $DIR
+# omit the -p parameter to create a temporal directory in the default location
+WORK_DIR=`mktemp -d -p "$DIR"`
+echo ${WORK_DIR}
+
+cd ${WORK_DIR}
+
+# check if tmp dir was created
+if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
+ echo "Could not create temp dir"
+ exit 1
+fi
+
+# bring down maven
+mkdir maven
+cd maven
+curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
+tar -xzvf apache-maven-3.3.9-bin.tar.gz
+ls -l
+export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin
+${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
+cd ..
+
+ifconfig
+
+if ! ifconfig eth0; then
+ if ! ifconfig ens3; then
+ echo "Could not determine IP address"
+ exit 1
+ fi
+ export IP=`ifconfig ens3 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
+else
+ export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
+fi
+echo $IP
+
+if ! ifconfig docker0; then
+ if ! ifconfig ens3; then
+ echo "Could not determine IP address"
+ exit 1
+ fi
+ export DOCKER_IP_IP=`ifconfig ens3 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
+else
+ export DOCKER_IP=`ifconfig docker0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
+fi
+echo $DOCKER_IP
+
+git clone http://gerrit.onap.org/r/oparent
+
+git clone http://gerrit.onap.org/r/policy/docker
+cd docker
+
+${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install prepare-package --settings ../oparent/settings.xml
+cp policy-pe/* target/policy-pe
+cp policy-drools/* target/policy-drools
+
+docker build -t onap/policy/policy-os policy-os
+docker build -t onap/policy/policy-db policy-db
+docker build -t onap/policy/policy-nexus policy-nexus
+docker build -t onap/policy/policy-base policy-base
+docker build -t onap/policy/policy-pe target/policy-pe
+docker build -t onap/policy/policy-drools target/policy-drools
+
+chmod +x config/drools/drools-tweaks.sh
+
+echo $IP > config/pe/ip_addr.txt
+ls -l config/pe/ip_addr.txt
+cat config/pe/ip_addr.txt
+
+export MTU=9126
+
+docker-compose -f docker-compose-integration.yml up -d
+
+docker ps
+
+docker inspect drools
+
+POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools`
+echo ${POLICY_IP}
+
+sleep 3m
+
+docker inspect pdp
+
+PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp`
+echo ${PDP_IP}
+
+sleep 3m
+
+#for i in {1..60}; do
+TIME_OUT=6000
+INTERVAL=20
+TIME=0
+while [ "$TIME" -lt "$TIME_OUT" ]; do
+ curl -i --user healthcheck:zb!XztG34 -H "ContentType: application/json" -H "Accept: application/json" ${POLICY_IP}:6969/healthcheck && break
+ echo sleep $i
+ sleep $i
+
+echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
+ sleep $INTERVAL
+ TIME=$(($TIME+$INTERVAL))
+
+done
+
+#curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}'
+
+TIME_OUT=6000
+INTERVAL=20
+TIME=0
+while [ "$TIME" -lt "$TIME_OUT" ]; do
+
+ curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break
+ echo sleep $i
+ sleep $i
+
+echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
+ sleep $INTERVAL
+ TIME=$(($TIME+$INTERVAL))
+
+done
+