tragait | 9bbcb1b | 2020-02-24 16:33:50 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # ============LICENSE_START======================================================= |
| 4 | # Copyright (C) 2020 Nordix Foundation. |
| 5 | # ================================================================================ |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ============LICENSE_END========================================================= |
| 20 | |
| 21 | # @author Rahul Tyagi (rahul.tyagi@est.tech) |
| 22 | |
| 23 | |
| 24 | SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
efiacor | 125390b | 2020-05-06 01:14:00 +0100 | [diff] [blame] | 25 | export PARENT=usecases-pnf-sw-upgrade |
tragait | 9bbcb1b | 2020-02-24 16:33:50 +0000 | [diff] [blame] | 26 | export SUB_PARENT=pnf-sw-upgrade |
| 27 | source ${WORKSPACE}/plans/$PARENT/$SUB_PARENT/test.properties |
| 28 | export $PROJECT_NAME |
| 29 | export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') |
| 30 | export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) |
| 31 | |
| 32 | if [ "$MTU" == "" ]; then |
| 33 | export MTU="1450" |
| 34 | fi |
| 35 | unset http_proxy https_proxy |
| 36 | |
ajay_dp001 | ec3bb1a | 2020-11-20 21:16:50 +0530 | [diff] [blame] | 37 | # Prepare Environment |
| 38 | echo "Uninstall docker-py and reinstall docker." |
| 39 | pip uninstall -y docker-py |
| 40 | pip uninstall -y docker |
| 41 | pip install -U docker==2.7.0 |
| 42 | |
tragait | 9bbcb1b | 2020-02-24 16:33:50 +0000 | [diff] [blame] | 43 | HOST_IP_ADDR=localhost |
| 44 | |
| 45 | ###################### setup so ############################## |
| 46 | source $SO_DOCKER_PATH/so_setup.sh |
| 47 | |
| 48 | ###################### setup sdnc ############################ |
| 49 | source $SDNC_DOCKER_PATH/sdn_setup.sh |
| 50 | |
| 51 | ###################### setup cds ############################# |
| 52 | source $CDS_DOCKER_PATH/cds_setup.sh |
| 53 | |
| 54 | ###################### setup pnfsim ########################## |
| 55 | docker-compose -f $PNF_SIM_DOCKER_PATH/docker-compose.yml -p $PROJECT_NAME up -d |
| 56 | |
| 57 | ##### update pnf simulator ip in config deploy request ####### |
| 58 | RES_KEY=$(uuidgen -r) |
| 59 | sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount.json |
ajay_dp001 | 1feb0a7 | 2020-12-03 15:18:08 +0530 | [diff] [blame] | 60 | sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount2.json |
tragait | 9bbcb1b | 2020-02-24 16:33:50 +0000 | [diff] [blame] | 61 | |
| 62 | ############################################################## |
| 63 | |
| 64 | echo "sleeping for 30 sec" |
| 65 | sleep 30 |
| 66 | |
| 67 | REPO_IP='127.0.0.1' |
| 68 | ROBOT_VARIABLES+=" -v REPO_IP:${REPO_IP} " |
| 69 | ROBOT_VARIABLES+=" -v SCRIPTS:${SCRIPTS} " |
| 70 | |
| 71 | |
| 72 | echo "Finished executing setup for pnf-sw-upgrade" |