2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
14 # source the file so we get OPNFV vars
15 source latest.properties
17 # echo the info about artifact that is used during the deployment
18 echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment"
20 if [[ "$JOB_NAME" =~ "merge" ]]; then
21 # set simplest scenario for virtual deploys to run for merges
22 DEPLOY_SCENARIO="os-nosdn-nofeature-ha"
24 # for none-merge deployments
25 # checkout the commit that was used for building the downloaded artifact
26 # to make sure the ISO and deployment mechanism uses same versions
27 echo "Checking out $OPNFV_GIT_SHA1"
28 git checkout $OPNFV_GIT_SHA1 --quiet
31 # set deployment parameters
32 export TMPDIR=$HOME/tmpdir
34 LAB_NAME=${NODE_NAME/-*}
35 POD_NAME=${NODE_NAME/*-}
37 if [[ "$NODE_NAME" == "opnfv-jump-2" ]]; then
42 if [[ "$NODE_NAME" =~ "virtual" ]]; then
43 POD_NAME="virtual_kvm"
46 # we currently support ericsson, intel, and lf labs
47 if [[ ! "$LAB_NAME" =~ (ericsson|intel|lf) ]]; then
48 echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!"
51 echo "Using configuration for $LAB_NAME"
54 # create TMPDIR if it doesn't exist
55 export TMPDIR=$HOME/tmpdir
58 # change permissions down to TMPDIR
62 # clone the securedlab repo
64 echo "Cloning securedlab repo ${GIT_BRANCH##origin/}"
65 git clone ssh://jenkins-ericsson@gerrit.opnfv.org:29418/securedlab --quiet --branch ${GIT_BRANCH##origin/}
67 # construct the command
68 DEPLOY_COMMAND="sudo $WORKSPACE/ci/deploy.sh -b file://$WORKSPACE/securedlab -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso -H -B $BRIDGE -S $TMPDIR"
71 echo "Deployment parameters"
72 echo "--------------------------------------------------------"
73 echo "Scenario: $DEPLOY_SCENARIO"
76 echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}"
78 echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..."
79 echo "--------------------------------------------------------"
82 # start the deployment
83 echo "Issuing command"
84 echo "$DEPLOY_COMMAND"
90 echo "--------------------------------------------------------"
91 echo "Deployment is done successfully!"
93 # Quick and dirty fix for SFC scenatio - will be fixed properly post-release
94 if [[ ! "$DEPLOY_SCENARIO" =~ "os-odl_l2-sfc" ]]; then
99 echo "SFC Scenario is deployed"
102 # The stuff below is here temporarily and will be fixed once the release is out
103 # The stuff below is here temporarily and will be fixed once the release is out
104 export FUEL_MASTER_IP=10.20.0.2
105 export TACKER_SCRIPT_URL="https://git.opnfv.org/cgit/fuel/plain/prototypes/sfc_tacker/poc.tacker-up.sh?h=${GIT_BRANCH#*/}"
106 export CONTROLLER_NODE_IP=$(sshpass -pr00tme /usr/bin/ssh -o UserKnownHostsFile=/dev/null \
107 -o StrictHostKeyChecking=no root@$FUEL_MASTER_IP 'fuel node list' | \
108 grep opendaylight | cut -d'|' -f5)
110 # we can't do much if we do not have the controller IP
111 if [[ ! "$CONTROLLER_NODE_IP" =~ "10.20.0" ]]; then
112 echo "Unable to retrieve controller IP"
117 echo "Copying and executing poc.tacker-up.sh script on controller node $CONTROLLER_NODE_IP"
121 spawn /usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root $::env(FUEL_MASTER_IP)
128 send "/usr/bin/ssh -l root $::env(CONTROLLER_NODE_IP)\r"
130 send "sudo apt-get install -y git\r"
132 send "/bin/mkdir -p /root/sfc-poc && cd /root/sfc-poc\r"
134 send "git clone https://gerrit.opnfv.org/gerrit/fuel && cd fuel\r"
136 send "git fetch https://gerrit.opnfv.org/gerrit/fuel refs/changes/97/10597/2 && git checkout FETCH_HEAD\r"
138 send "/bin/bash /root/sfc-poc/fuel/prototypes/sfc_tacker/poc.tacker-up.sh\r"
141 expect "Connection to $::env(CONTROLLER_NODE_IP) closed. "
143 expect "Connection to $::env(FUEL_MASTER_IP) closed. "