The current script assumes that snapshot versions are always available.
However the Linux Foundation has now implemented a policy of deleting
snapshots on no-master branches that are older than a certain age. THis
breaks our CSITs.
THis updated script copes with this by checking if a snapshot is
avaialable and, if the snapshot is not available, the script falls back
to the released version.
This script will be needed on other branches besides master as well.
Issue-ID: POLICY-4233
Change-Id: Ie80756eb1d3abceb31ed3f697f1ebc9643cea51e
Signed-off-by: liamfallon <liam.fallon@est.tech>
source ${SCRIPTS}/get-branch-mariadb.sh
echo "Uninstall docker-py and reinstall docker."
-pip uninstall -y docker-py
-pip uninstall -y docker
-pip install -U docker==2.7.0
+python3 -m pip uninstall -y docker-py
+python3 -m pip uninstall -y docker
+python3 -m pip install -U docker
sudo apt-get -y install libxml2-utils
docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d policy-clamp-cl-runtime
-sleep 10
+sleep 300
unset http_proxy https_proxy
POLICY_CONTROLLOOP_RUNTIME_IP=`get-instance-ip.sh policy-clamp-cl-runtime`
CommissionControlLoopV1
[Documentation] Commission control loop.
${auth}= Create List healthcheck zb!XztG34
- Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970
+ Log Creating session https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969
${postyaml}= Get file ${CURDIR}/data/PMSHMultipleCLTosca.yaml
- ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth}
+ ${session}= Create Session policy https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
${resp}= POST On Session policy /onap/controlloop/v2/commission data=${postyaml} headers=${headers}
Log Received response from controlloop runtime ${resp.text}
InstantiateControlLoopV1
[Documentation] Instantiate control loop.
${auth}= Create List healthcheck zb!XztG34
- Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970
+ Log Creating session https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969
${postjson}= Get file ${CURDIR}/data/InstantiateCL.json
- ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth}
+ ${session}= Create Session policy https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= POST On Session policy /onap/controlloop/v2/instantiation data=${postjson} headers=${headers}
Log Received response from controlloop runtime ${resp.text}
PassivateControlLoop
[Documentation] Passivate control loop.
${auth}= Create List healthcheck zb!XztG34
- Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970
+ Log Creating session https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969
${postjson}= Get file ${CURDIR}/data/PassivateCL.json
- ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth}
+ ${session}= Create Session policy https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= PUT On Session policy /onap/controlloop/v2/instantiation/command data=${postjson} headers=${headers}
Log Received response from controlloop runtime ${resp.text}
StateChangeRunningControlLoop
[Documentation] ControlLoop State Change to RUNNING.
${auth}= Create List healthcheck zb!XztG34
- Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970
+ Log Creating session https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969
${postjson}= Get file ${CURDIR}/data/StateChangeRunningCL.json
- ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth}
+ ${session}= Create Session policy https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= PUT On Session policy /onap/controlloop/v2/instantiation/command data=${postjson} headers=${headers} expected_status=406
Log Received response from controlloop runtime ${resp.text}
QueryInstantiatedCLs
[Documentation] Get Instantiated ControlLoops
${auth}= Create List healthcheck zb!XztG34
- Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970
- ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth}
+ Log Creating session https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969
+ ${session}= Create Session policy https://${POLICY_CONTROLLOOP_RUNTIME_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= GET On Session policy /onap/controlloop/v2/instantiation headers=${headers}
Log Received response from controlloop runtime ${resp.text}
+#! /bin/bash
+
# ============LICENSE_START====================================================
# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
-# Modification Copyright 2021. Nordix Foundation.
+# Modification Copyright 2021-2022 Nordix Foundation.
+# Modifications Copyright (C) 2021 Bell Canada. 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.
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END======================================================
-source ${SCRIPTS}/get-branch-mariadb.sh
+if [[ -z "$GERRIT_BRANCH" ]]
+then
+ source "${SCRIPTS}"/get-branch.sh
+else
+ echo GERRIT_BRANCH="${GERRIT_BRANCH}"
+fi
+
+export POLICY_MARIADB_VER=10.5.8
echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER}
-function getVersion
+export POLICY_POSTGRES_VER=11.1
+echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER}
+
+function getDockerVersion
{
REPO=$1
- curl -qL --silent \
- https://github.com/onap/policy-$REPO/raw/${GERRIT_BRANCH}/pom.xml |
- xmllint --xpath \
- '/*[local-name()="project"]/*[local-name()="version"]/text()' -
+ DEFAULT_DOCKER_IMAGE_NAME=$2
+ DEFAULT_DOCKER_IMAGE_VERSION=$3
+
+ REPO_RELEASE_DATA=$(
+ curl -qL --silent \
+ "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" |
+ grep "^policy/$REPO"
+ )
+
+ # shellcheck disable=SC2034
+ read -r repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files \
+ docker_images \
+ <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )"
+
+ if [[ -z "$docker_images" ]]
+ then
+ if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]]
+ then
+ echo "repo $REPO does not produce a docker image, execution terminated"
+ exit 1
+ else
+ docker_images="$DEFAULT_DOCKER_IMAGE_NAME"
+ fi
+ fi
+
+ docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}')
+ docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//")
+
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$latest_released_tag"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ else
+ echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\""
+ exit 1
+ fi
}
-POLICY_MODELS_VERSION=$(getVersion models)
-export POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_MODELS_VERSION=${POLICY_MODELS_VERSION}
+getDockerVersion docker
+export POLICY_DOCKER_VERSION="$docker_image_version"
+
+getDockerVersion models "'policy-models-simulator'" 2.6.4
+export POLICY_MODELS_VERSION="$docker_image_version"
-POLICY_API_VERSION=$(getVersion api)
-export POLICY_API_VERSION=${POLICY_API_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_API_VERSION=${POLICY_API_VERSION}
+getDockerVersion api
+export POLICY_API_VERSION="$docker_image_version"
-POLICY_PAP_VERSION=$(getVersion pap)
-export POLICY_PAP_VERSION=${POLICY_PAP_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_PAP_VERSION=${POLICY_PAP_VERSION}
+getDockerVersion pap
+export POLICY_PAP_VERSION="$docker_image_version"
-POLICY_XACML_PDP_VERSION=$(getVersion xacml-pdp)
-export POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_XACML_PDP_VERSION=${POLICY_XACML_PDP_VERSION}
+getDockerVersion apex-pdp
+export POLICY_APEX_PDP_VERSION="$docker_image_version"
-POLICY_DROOLS_VERSION=$(getVersion drools-pdp)
-export POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_DROOLS_VERSION=${POLICY_DROOLS_VERSION}
+getDockerVersion drools-pdp
+export POLICY_DROOLS_PDP_VERSION="$docker_image_version"
-POLICY_DROOLS_APPS_VERSION=$(getVersion drools-applications)
-export POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_DROOLS_APPS_VERSION=${POLICY_DROOLS_APPS_VERSION}
+getDockerVersion xacml-pdp
+export POLICY_XACML_PDP_VERSION="$docker_image_version"
-POLICY_APEX_PDP_VERSION=$(getVersion apex-pdp)
-export POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_APEX_PDP_VERSION=${POLICY_APEX_PDP_VERSION}
+getDockerVersion distribution
+export POLICY_DISTRIBUTION_VERSION="$docker_image_version"
-POLICY_DISTRIBUTION_VERSION=$(getVersion distribution)
-export POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_DISTRIBUTION_VERSION=${POLICY_DISTRIBUTION_VERSION}
+getDockerVersion clamp
+export POLICY_CLAMP_VERSION="$docker_image_version"
-POLICY_CLAMP_VERSION=$(getVersion clamp)
-export POLICY_CLAMP_VERSION=${POLICY_CLAMP_VERSION:0:5}-SNAPSHOT-latest
-echo POLICY_CLAMP_VERSION=${POLICY_CLAMP_VERSION}
+getDockerVersion gui
+export POLICY_GUI_VERSION="$docker_image_version"
-POLICY_DOCKER_VERSION=$(getVersion docker)
-export POLICY_DOCKER_VERSION=${POLICY_DOCKER_VERSION:0:3}-SNAPSHOT-latest
-echo POLICY_DOCKER_VERSION=${POLICY_DOCKER_VERSION}
+getDockerVersion drools-applications
+export POLICY_DROOLS_APPS_VERSION="$docker_image_version"
'pap', '6969'
]
drools:
- image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION}
+ image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_PDP_VERSION}
container_name: drools
depends_on:
- mariadb
'apex-pdp', '6969'
]
policy-clamp-cl-runtime:
- image: onap/policy-clamp-cl-runtime:latest
+ image: nexus3.onap.org:10001/onap/policy-clamp-cl-runtime:${POLICY_CLAMP_VERSION}
container_name: policy-clamp-cl-runtime
depends_on:
- mariadb
entrypoint: /opt/app/policy/bin/wait_for_port.sh
command: [
'-c', './controlloop-runtime.sh',
- 'message-router', '3905'
+ 'message-router', '3905',
+ 'policy-clamp-cl-k8s-ppnt', '8083'
]
policy-clamp-cl-http-ppnt:
- image: onap/policy-clamp-cl-http-ppnt:latest
+ image: nexus3.onap.org:10001/onap/policy-clamp-cl-http-ppnt:${POLICY_CLAMP_VERSION}
container_name: policy-clamp-cl-http-ppnt
depends_on:
- simulator
hostname: policy-clamp-cl-http-ppnt
- expose:
- - 6971
volumes:
- ./config/policy-truststore:/opt/app/policy/clamp/etc/ssl/policy-truststore:ro
- ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
'message-router', '3905'
]
policy-clamp-cl-k8s-ppnt:
- image: onap/policy-clamp-cl-k8s-ppnt:latest
+ image: nexus3.onap.org:10001/onap/policy-clamp-cl-k8s-ppnt:${POLICY_CLAMP_VERSION}
container_name: policy-clamp-cl-k8s-ppnt
depends_on:
- simulator
hostname: policy-clamp-cl-k8s-ppnt
expose:
- - 6972
+ - 8083
volumes:
- ./config/policy-truststore:/opt/app/policy/clamp/etc/ssl/policy-truststore:ro
- ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
'message-router', '3905'
]
policy-clamp-cl-pf-ppnt:
- image: onap/policy-clamp-cl-pf-ppnt:latest
+ image: nexus3.onap.org:10001/onap/policy-clamp-cl-pf-ppnt:${POLICY_CLAMP_VERSION}
container_name: policy-clamp-cl-pf-ppnt
depends_on:
- simulator
- api
hostname: policy-clamp-cl-pf-ppnt
- expose:
- - 6973
volumes:
- ./config/policy-truststore:/opt/app/policy/clamp/etc/ssl/policy-truststore:ro
- ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END======================================================
-tmout=120
+tmout=300
cmd=
while getopts c:t: opt; do
case "$opt" in