From 3fe70c777050581f090f1bcc9ebf9e44857d0b56 Mon Sep 17 00:00:00 2001 From: vrvarma Date: Fri, 28 Sep 2018 10:30:00 -0400 Subject: Initial implementation of optf-osdf csit Fixing osdf, simulator startup scripts Split the setup & functional test cases Add robot keywords for test suites Refactoring test suites based on comments Change-Id: Ic96343968ec919ac3c5272bc953bbaeb974f2393 Signed-off-by: vrvarma Issue-ID: OPTFRA-286 --- .../osdf/osdf-properties/osdf_config.yaml | 64 +++++++++++++++++++ scripts/optf-osdf/osdf/osdf_proxy_settings.sh | 35 ++++++++++ scripts/optf-osdf/osdf/osdf_script.sh | 57 +++++++++++++++++ scripts/optf-osdf/osdf/simulator_script.sh | 74 ++++++++++++++++++++++ scripts/optf-osdf/osdf/wait_for_port.sh | 36 +++++++++++ 5 files changed, 266 insertions(+) create mode 100755 scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml create mode 100755 scripts/optf-osdf/osdf/osdf_proxy_settings.sh create mode 100755 scripts/optf-osdf/osdf/osdf_script.sh create mode 100755 scripts/optf-osdf/osdf/simulator_script.sh create mode 100755 scripts/optf-osdf/osdf/wait_for_port.sh (limited to 'scripts') diff --git a/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml b/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml new file mode 100755 index 00000000..78399660 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml @@ -0,0 +1,64 @@ +osdfUserNameForSO: "" # The OSDF Manager username for MSO. +odfPasswordForSO: "" # The OSDF Manager password for MSO. + +# msoUrl: "" # The SO url for call back. This will be part of the request, so no need +soUsername: "" # SO username for call back. +soPassword: "" # SO password for call back. + +conductorUrl: "http://127.0.0.1:5000/simulated/oof/has-api/flow1-success-simple/main.json" +conductorUsername: "CONDUCTOR-USER" +conductorPassword: "CONDUCTOR-PASSWD" +conductorPingWaitTime: 2 # seconds to wait before calling the conductor retry URL +conductorMaxRetries: 5 # if we don't get something in 30 minutes, give up + +# Policy Platform -- requires ClientAuth, Authorization, and Environment +policyPlatformUrl: http://127.0.0.1:5000/simulated/policy/pdp-has-vcpe-good/getConfig # Policy Dev platform URL +policyPlatformEnv: TEST # Environment for policy platform +policyPlatformUsername: POLICY-USER # Policy platform username. +policyPlatformPassword: POLICY-PASSWD # Policy platform password. +policyClientUsername: POLICY-CLIENT-USER # For use with ClientAuth +policyClientPassword: POLICY-CLIENT-PASSWD # For use with ClientAuth + +messageReaderHosts: https://DMAAP-HOST1:3905,https://DMAAP-HOST2:3905,https://DMAAP-HOST3:3905 +messageReaderTopic: org.onap.oof.osdf.multicloud +messageReaderAafUserId: DMAAP-OSDF-MC-USER +messageReaderAafPassword: DMAAP-OSDF-MC-PASSWD + +sdcUrl: https://SDC-HOST:8443/sdc/v1/catalog +sdcUsername: SDC-OSDF-USER +sdcPassword: SDC-OSDF-PASSWD +sdcONAPInstanceID: ONAP-OSDF + +osdfPlacementUrl: "http://127.0.0.1:24699/osdf/api/v2/placement" + +# Credentials for the OOF placement service - Generic +osdfPlacementUsername: test +osdfPlacementPassword: testpwd + +# Credentials for the OOF placement service - SO +osdfPlacementSOUsername: so_test +osdfPlacementSOPassword: so_testpwd + +# Credentials for the OOF placement service - VFC +osdfPlacementVFCUsername: vfc_test +osdfPlacementVFCPassword: vfc_testpwd + +# Credentials for the OOF CM scheduling service - Generic +osdfCMSchedulerUsername: test1 +osdfCMSchedulerPassword: testpwd1 + +# config db api +configDbUrl: http://127.0.0.1:5000/simulated/configdb +configDbUserName: osdf +configDbPassword: passwd +configDbGetCellListUrl: 'getCellList' +configDbGetNbrListUrl: 'getNbrList' + +# Credentials for PCIHandler +pciHMSUsername: "" # pcihandler username for call back. +pciHMSPassword: "" # pcihandler password for call back. + +#Credentials for the OOF PCI Opt Service +osdfPCIOptUsername: pci_test +osdfPCIOptPassword: pci_testpwd + diff --git a/scripts/optf-osdf/osdf/osdf_proxy_settings.sh b/scripts/optf-osdf/osdf/osdf_proxy_settings.sh new file mode 100755 index 00000000..b68fca97 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf_proxy_settings.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +# put into this file local proxy settings in case they are needed on your local environment +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_proxy_settings.sh" + +echo "optf/osdf proxy settings" +if [ "$#" -eq "1" ]; then + echo "$1" + cd $1 + pwd +else + exit 1 +fi + +# don't remove following lines: commands can be attached here + + diff --git a/scripts/optf-osdf/osdf/osdf_script.sh b/scripts/optf-osdf/osdf/osdf_script.sh new file mode 100755 index 00000000..71d19fe4 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf_script.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_script.sh" +# +# add here whatever commands is needed to prepare the optf/osdf CSIT testing +# + +# assume the base is /tmp dir +DIR=/tmp + +# the directory of the script +echo ${DIR} +cd ${DIR} + +# create directory for volume and copy configuration file +# run docker containers +OSDF_CONF=/tmp/osdf/properties/osdf_config.yaml +IMAGE_NAME=nexus3.onap.org:10001/onap/optf-osdf +IMAGE_VER=1.2.1-SNAPSHOT-latest + +mkdir -p /tmp/osdf/properties + +cp ${WORKSPACE}/scripts/optf-osdf/osdf/osdf-properties/*.yaml /tmp/osdf/properties/. + +#change conductor/configdb simulator urls +OSDF_SIM_IP=`get-instance-ip.sh osdf_sim` +echo "OSDF_SIM_IP=${OSDF_SIM_IP}" + +sed -i -e "s%127.0.0.1:5000%${OSDF_SIM_IP}:5000%g" $OSDF_CONF + +docker run -d --name optf-osdf -v ${OSDF_CONF}:/opt/osdf/config/osdf_config.yaml -p "8698:8699" ${IMAGE_NAME}:${IMAGE_VER} + +sleep 20 + +OSDF_IP=`get-instance-ip.sh optf-osdf` +${WORKSPACE}/scripts/optf-osdf/osdf/wait_for_port.sh ${OSDF_IP} 8699 + +echo "inspect docker things for tracing purpose" +docker inspect optf-osdf diff --git a/scripts/optf-osdf/osdf/simulator_script.sh b/scripts/optf-osdf/osdf/simulator_script.sh new file mode 100755 index 00000000..8f3f7d36 --- /dev/null +++ b/scripts/optf-osdf/osdf/simulator_script.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/simulator_script.sh" +# +# add here whatever commands is needed to prepare the optf/osdf CSIT testing +# +# assume the base is /tmp dir + +DIR=/tmp + +# the directory of the script +echo ${DIR} +cd ${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} + +# clone optf-osdf project +git clone https://gerrit.onap.org/r/optf/osdf + +#echo "i am ${USER} : only non jenkins users may need proxy settings" +if [ ${USER} != 'jenkins' ]; then + + # add proxy settings into this script when you work behind a proxy + ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_proxy_settings.sh ${WORK_DIR} + +fi + +# prepare osdf_sim +cd ${WORK_DIR}/osdf/test/functest/simulators + +# check Dockerfile content +cat ./Dockerfile + +# build osdf_sim +chmod +x ./build_sim_image.sh +./build_sim_image.sh + +# run osdf_sim +docker run -d --name osdf_sim -p "5000:5000" osdf_sim:latest; + +OSDF_SIM_IP=`get-instance-ip.sh osdf_sim` +echo "OSDF_SIM_IP=${OSDF_SIM_IP}" + +${WORKSPACE}/scripts/optf-osdf/osdf/wait_for_port.sh ${OSDF_SIM_IP} 5000 + + +# wait a while before continuing +sleep 2 + +echo "inspect docker things for tracing purpose" +docker inspect osdf_sim + diff --git a/scripts/optf-osdf/osdf/wait_for_port.sh b/scripts/optf-osdf/osdf/wait_for_port.sh new file mode 100755 index 00000000..360fc210 --- /dev/null +++ b/scripts/optf-osdf/osdf/wait_for_port.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +if [[ $# -ne 2 ]]; then + echo "Usage: wait-for-port hostname port" >&2 + exit 1 +fi + +host=$1 +port=$2 + +echo "Waiting for $host port $port open" +until telnet $host $port /dev/null | grep -q '^Connected'; do + sleep 1 +done + +echo "$host port $port is open" + +exit 0 -- cgit 1.2.3-korg