diff options
Diffstat (limited to 'plans')
-rwxr-xr-x | plans/appc/healthcheck/bundle_query.sh | 14 | ||||
-rwxr-xr-x | plans/appc/healthcheck/setup.sh | 58 | ||||
-rwxr-xr-x | plans/policy/drools-applications/setup.sh | 66 | ||||
-rwxr-xr-x | plans/policy/drools-applications/teardown.sh | 12 | ||||
-rw-r--r-- | plans/policy/xacml-pdp/setup.sh | 4 |
5 files changed, 107 insertions, 47 deletions
diff --git a/plans/appc/healthcheck/bundle_query.sh b/plans/appc/healthcheck/bundle_query.sh index 3801d0a1..2c9da710 100755 --- a/plans/appc/healthcheck/bundle_query.sh +++ b/plans/appc/healthcheck/bundle_query.sh @@ -17,19 +17,15 @@ SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo $SCRIPTS +num_active_bundles=$(docker exec --tty appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Active | wc -l) +num_failed_bundles=$(docker exec --tty appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) +failed_bundles=$(docker exec --tty appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure) -num_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | tail -1 | cut -d\| -f1) -#num_failed_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) -num_failed_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) -failed_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure) +echo "There are $num_failed_bundles failed bundles and $num_active_bundles active bundles." -echo "There are $num_failed_bundles failed bundles out of $num_bundles installed bundles." - -if [ "$num_failed_bundles" -ge 1 ] || [ "$num_bundles" == "" ]; then - echo "There are $num_bundles bundles with $num_failed_bundles in a failed state. " +if [ "$num_failed_bundles" -ge 1 ] || [ "$num_active_bundles" == "" ]; then echo "The following bundle(s) are in a failed state: " echo " $failed_bundles" exit 1; fi - exit 0 diff --git a/plans/appc/healthcheck/setup.sh b/plans/appc/healthcheck/setup.sh index c78f4a82..9a145f86 100755 --- a/plans/appc/healthcheck/setup.sh +++ b/plans/appc/healthcheck/setup.sh @@ -20,9 +20,9 @@ SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source ${WORKSPACE}/scripts/appc/script1.sh -export APPC_DOCKER_IMAGE_VERSION=1.6.2-SNAPSHOT-latest +export APPC_DOCKER_IMAGE_VERSION=1.7.2-SNAPSHOT-latest export DGBUILDER_DOCKER_IMAGE_VERSION=0.6.0 -export ANSIBLE_DOCKER_IMAGE_VERSION=0.6.1-STAGING-latest +export ANSIBLE_DOCKER_IMAGE_VERSION=0.4.4 export BRANCH=master export SOLUTION_NAME=onap @@ -63,16 +63,13 @@ docker tag $NEXUS_DOCKER_REPO/${SOLUTION_NAME}/appc-cdt-image:$APPC_DOCKER_IMAGE # start APPC containers with docker compose and configuration from docker-compose.yml docker-compose up -d # WAIT 5 minutes maximum and test every 5 seconds if APPC is up using HealthCheck API -TIME_OUT=2000 +TIME_OUT=1000 INTERVAL=30 TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-appc" -H "X-TransactionId: csit-appc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); echo $response -startODL_status=$(docker exec appc_controller_container ps -e | grep startODL | wc -l) -waiting_bundles=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Waiting | wc -l) -run_level=$(docker exec appc_controller_container /opt/opendaylight/current/bin/client system:start-level) - - if [ "$run_level" == "Level 100" ] && [ "$startODL_status" -lt "1" ] && [ "$waiting_bundles" -lt "1" ] ; then + if [ "$response" == "200" ]; then echo APPC started in $TIME seconds break; fi @@ -83,9 +80,52 @@ run_level=$(docker exec appc_controller_container /opt/opendaylight/current/bin/ done if [ "$TIME" -ge "$TIME_OUT" ]; then - echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities... + echo TIME OUT: APPC Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + +TIME_OUT=1000 +INTERVAL=60 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(docker exec --tty appc_controller_container /opt/opendaylight/current/bin/client system:start-level) + + if grep -q 'Level 100' <<< ${response}; then + echo APPC karaf started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... fi + +TIME_OUT=1000 +INTERVAL=60 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(docker exec --tty appc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep appc-design-services-provider) + + if grep -q 'appc-design-services-provider' <<< ${response}; then + echo APPC features started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if APPC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + + +# Sleep additional 5 minutes (300 secs) to give application time to finish sleep 300 # Pass any variables required by Robot test suites in ROBOT_VARIABLES diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh index c66c4929..1a1dc331 100755 --- a/plans/policy/drools-applications/setup.sh +++ b/plans/policy/drools-applications/setup.sh @@ -1,7 +1,8 @@ #!/bin/bash -# ============LICENSE_START======================================================= +# +# ===========LICENSE_START==================================================== # Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. -# ================================================================================ +# ============================================================================ # 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 @@ -13,9 +14,8 @@ # 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. +# ============LICENSE_END===================================================== # -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= # OS upgrades @@ -24,41 +24,67 @@ export POLICY_MARIADB_VER echo ${GERRIT_BRANCH} echo ${POLICY_MARIADB_VER} +SCR2=${WORKSPACE}/scripts/policy/drools-apps + echo "Uninstall docker-py and reinstall docker." pip uninstall -y docker-py pip uninstall -y docker pip install -U docker==2.7.0 sudo apt-get -y install libxml2-utils +${SCRIPTS}/policy/policy-models-simulators.sh + +POLICY_API_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" +export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" +POLICY_PAP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" +export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" +POLICY_XACML_PDP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" +export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" POLICY_DROOLS_APPS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT} export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" + +echo ${POLICY_XACML_PDP_VERSION} echo ${POLICY_DROOLS_APPS_VERSION} echo "user information: $(id)" echo "docker and docker-compose versions:" docker -v && docker-compose -v -docker container ls -a +# Adding this waiting container due to race condition between drools and mariadb +docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_dependencies + +# Adding this waiting container due to race condition between pap and xacml +docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_pap -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml up -d -sleep 2m +# now bring everything else up +docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all -docker container ls -a +unset http_proxy https_proxy -POLICY_DROOLS_IP=`get-instance-ip.sh drools` -MARIADB_IP=`get-instance-ip.sh mariadb` +DROOLS_IP=`get-instance-ip.sh drools` +API_IP=`get-instance-ip.sh policy-api` +PAP_IP=`get-instance-ip.sh policy-pap` +XACML_IP=`get-instance-ip.sh policy-xacml-pdp` +SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org` +export SIM_IP -echo DROOLS IP IS ${POLICY_DROOLS_IP} -echo MARIADB IP IS ${MARIADB_IP} +echo DROOLS IP IS ${DROOLS_IP} +echo API IP IS ${API_IP} +echo PAP IP IS ${PAP_IP} +echo XACML IP IS ${XACML_IP} +echo SIMULATORS IP IS ${SIM_IP} -for i in {1..10}; do - curl -sS ${POLICY_DROOLS_IP}:6969 && break - echo sleep $i - sleep $i -done +# give enough time for the controllers to come up +sleep 15 -# to give enough time to the usecases controller to come up -sleep 2m +DATA=${WORKSPACE}/simulators/models/models-examples/src/main/resources/policies -ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" +ROBOT_VARIABLES="" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}" diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh index 886b1ea3..8b577d8e 100755 --- a/plans/policy/drools-applications/teardown.sh +++ b/plans/policy/drools-applications/teardown.sh @@ -1,21 +1,23 @@ #!/bin/bash # -# Copyright 2020 AT&T Intellectual Property. All rights reserved. -# +# ===========LICENSE_START==================================================== +# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. +# ============================================================================ # 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 +# 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. +# ============LICENSE_END===================================================== # mkdir -p $WORKSPACE/archives/ +docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log -docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml down -v +docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml down -v diff --git a/plans/policy/xacml-pdp/setup.sh b/plans/policy/xacml-pdp/setup.sh index 79c43070..72d1115e 100644 --- a/plans/policy/xacml-pdp/setup.sh +++ b/plans/policy/xacml-pdp/setup.sh @@ -61,10 +61,6 @@ echo ${POLICY_XACML_PDP_VERSION} # Adding this waiting container due to race condition between pap and mariadb docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies -#Configure the database -docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh -docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh - # now bring everything else up docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all |