6 APEX_PKGS="common undercloud" # removed onos for danube
10 echo "Starting the Apex deployment."
11 echo "--------------------------------------------------------"
14 if [ -z "$DEPLOY_SCENARIO" ]; then
15 echo "Deploy scenario not set!"
17 elif [[ "$DEPLOY_SCENARIO" == *gate* ]]; then
18 echo "Detecting Gating scenario..."
19 if [ -z "$GERRIT_EVENT_COMMENT_TEXT" ]; then
20 echo "ERROR: Gate job triggered without comment!"
23 DEPLOY_SCENARIO=$(echo ${GERRIT_EVENT_COMMENT_TEXT} | grep start-gate-scenario | grep -Eo 'os-.*$')
24 if [ -z "$DEPLOY_SCENARIO" ]; then
25 echo "ERROR: Unable to detect scenario in Gerrit Comment!"
26 echo "Format of comment to trigger gate should be 'start-gate-scenario: <scenario>'"
29 echo "Gate scenario detected: ${DEPLOY_SCENARIO}"
34 # Dev or RPM/ISO build
35 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
36 # Settings for deploying from git workspace
37 DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
38 NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
39 DEPLOY_CMD="${WORKSPACE}/ci/deploy.sh"
40 RESOURCES="${WORKSPACE}/.build/"
41 CONFIG="${WORKSPACE}/build"
44 LIB="${WORKSPACE}/lib"
46 # Ensure artifacts were downloaded and extracted correctly
47 # TODO(trozet) add verification here
50 DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
51 NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
52 DEPLOY_CMD="opnfv-deploy"
53 RESOURCES="/var/opt/opnfv/images"
54 CONFIG="/var/opt/opnfv"
57 LIB="/var/opt/opnfv/lib"
61 # Install Dependencies
62 # Make sure python34 dependencies are installed
63 for dep_pkg in epel-release python34 python34-PyYAML python34-setuptools; do
64 if ! rpm -q ${dep_pkg} > /dev/null; then
65 if ! sudo yum install -y ${dep_pkg}; then
66 echo "Failed to install ${dep_pkg}"
72 # Make sure jinja2 is installed
73 for python_pkg in jinja2; do
74 if ! python3.4 -c "import $python_pkg"; then
75 echo "$python_pkg package not found for python3.4, attempting to install..."
76 if ! sudo easy_install-3.4 $python_pkg; then
77 echo -e "Failed to install $python_pkg package for python3.4"
83 if [[ "$JOB_NAME" =~ "virtual" ]]; then
84 # Make sure ipxe-roms-qemu package is updated to latest.
85 # This package is needed for multi virtio nic PXE boot in virtual environment.
86 sudo yum update -y ipxe-roms-qemu
87 if [ -z ${PYTHONPATH:-} ]; then
88 export PYTHONPATH=${WORKSPACE}/lib/python
90 export PYTHONPATH=$PYTHONPATH:${WORKSPACE}/lib/python
94 # set env vars to deploy cmd
95 DEPLOY_CMD="BASE=${BASE} IMAGES=${IMAGES} LIB=${LIB} ${DEPLOY_CMD}"
97 if [ "$OPNFV_CLEAN" == 'yes' ]; then
98 if sudo test -e '/root/inventory/pod_settings.yaml'; then
99 clean_opts='-i /root/inventory/pod_settings.yaml'
104 if [[ "$ARTIFACT_VERSION" =~ "dev" ]]; then
105 sudo CONFIG=${CONFIG} LIB=${LIB} ./clean.sh ${clean_opts}
107 sudo BASE=${BASE} LIB=${LIB} opnfv-clean ${clean_opts}
111 if echo ${DEPLOY_SCENARIO} | grep ipv6; then
113 DEPLOY_SCENARIO=$(echo ${DEPLOY_SCENARIO} | sed 's/-ipv6//')
114 echo "INFO: IPV6 Enabled"
117 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
118 DEPLOY_FILE="${DEPLOY_SETTINGS_DIR}/${DEPLOY_SCENARIO}.yaml"
120 if [ ! -e "$DEPLOY_FILE" ]; then
121 echo "ERROR: Required settings file missing: Deploy settings file ${DEPLOY_FILE}"
124 if [[ "$JOB_NAME" =~ "virtual" ]]; then
125 # settings for virtual deployment
126 DEPLOY_CMD="${DEPLOY_CMD} -v"
127 if [[ "${DEPLOY_SCENARIO}" =~ fdio|ovs ]]; then
128 DEPLOY_CMD="${DEPLOY_CMD} --virtual-default-ram 12 --virtual-compute-ram 7"
130 if [[ "$JOB_NAME" == *csit* ]]; then
131 DEPLOY_CMD="${DEPLOY_CMD} -e csit-environment.yaml"
133 if [[ "$JOB_NAME" == *promote* ]]; then
134 DEPLOY_CMD="${DEPLOY_CMD} --virtual-computes 2"
137 # settings for bare metal deployment
138 NETWORK_SETTINGS_DIR="/root/network"
139 INVENTORY_FILE="/root/inventory/pod_settings.yaml"
141 if ! sudo test -e "$INVENTORY_FILE"; then
142 echo "ERROR: Required settings file missing: Inventory settings file ${INVENTORY_FILE}"
145 # include inventory file for bare metal deployment
146 DEPLOY_CMD="${DEPLOY_CMD} -i ${INVENTORY_FILE}"
149 if [ "$IPV6_FLAG" == "True" ]; then
150 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_v6.yaml"
151 elif echo ${DEPLOY_SCENARIO} | grep fdio; then
152 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings_vpp.yaml"
154 NETWORK_FILE="${NETWORK_SETTINGS_DIR}/network_settings.yaml"
157 # Check that network settings file exists
158 if ! sudo test -e "$NETWORK_FILE"; then
159 echo "ERROR: Required settings file missing: Network Settings file ${NETWORK_FILE}"
164 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
166 if [[ "$JOB_NAME" == *csit* ]]; then
167 echo "CSIT job: setting host route for floating ip routing"
168 # csit route to allow docker container to reach floating ips
169 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo "[0-9\.]+{3}[0-9]+")
170 if sudo route | grep 192.168.37.128 > /dev/null; then
171 sudo route del -net 192.168.37.128 netmask 255.255.255.128
173 sudo route add -net 192.168.37.128 netmask 255.255.255.128 gw ${UNDERCLOUD}
177 echo "--------------------------------------------------------"