From 1bdfcff9b394e9cc40868c13d2aa6a5e8c7f4a98 Mon Sep 17 00:00:00 2001 From: Mariah Jacobs Date: Tue, 7 Aug 2018 08:18:28 -0700 Subject: Refactor vCPE vBRG and vBNG image creation process Separate templates and build scripts have been created for vBRG and vBNG. Build logic and parameters are removed from install scripts and base heat/env files used to deploy the VMs. For backwards compatibility, compile_state parameter was added to both VMs. Small corrections were made to the heat templates for clarity. Issue-ID: INT-615 Change-Id: Ia171994d2f4e17523f319b0a048d77fec29e487b Signed-off-by: Mariah Jacobs --- vnfs/vCPE/scripts/v_bng_build.sh | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 vnfs/vCPE/scripts/v_bng_build.sh (limited to 'vnfs/vCPE/scripts/v_bng_build.sh') diff --git a/vnfs/vCPE/scripts/v_bng_build.sh b/vnfs/vCPE/scripts/v_bng_build.sh new file mode 100644 index 00000000..5ad0eb97 --- /dev/null +++ b/vnfs/vCPE/scripts/v_bng_build.sh @@ -0,0 +1,70 @@ +#!/bin/bash +set -o xtrace # print commands during script execution +set -o errexit # exit on command errors + +VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt) +VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/vpp_source_repo_release_tag.txt) +VPP_PATCH_URL=$(cat /opt/config/vpp_patch_url.txt) +CLOUD_ENV=$(cat /opt/config/cloud_env.txt) + + +# Convert Network CIDR to Netmask +cdr2mask () { + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} + + +# Enable IPV4 forwarding through kernel + sed -i 's/^.*\(net.ipv4.ip_forward\).*/\1=1/g' /etc/sysctl.conf + sysctl -p /etc/sysctl.conf + +# Download required dependencies + echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + apt-get update + apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev + sleep 1 + +# Install the tools required for download codes + apt-get install -y expect git patch make autoconf libtool linux-image-extra-`uname -r` + +# Download and build the VPP codes + cd /opt + git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_RELEASE_TAG} vpp + wget -O Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch ${VPP_PATCH_URL} + cd vpp + # The patch will place a "dummy" version of dhcp.api.h so the build will succeed + mkdir -p build-root/build-vpp-native/vpp/vnet/dhcp/ + patch -p1 < ../Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch + UNATTENDED='y' make install-dep + +# Install the FreeRADIUS client since we need the lib + cd /opt + git clone https://github.com/FreeRADIUS/freeradius-client.git + cd freeradius-client + ./configure + make && make install + cd /usr/local/lib && ln -s -f libfreeradius-client.so.2.0.0 libfreeradiusclient.so + ldconfig + + cd /opt/vpp/build-root + ./bootstrap.sh + make V=0 PLATFORM=vpp TAG=vpp install-deb + +# Install additional dependencies for vpp + apt-get install -y python-cffi python-ply python-pycparser + +# Install the VPP package + cd /opt/vpp/build-root + dpkg -i *.deb + systemctl stop vpp + +# Disable automatic upgrades + if [[ $CLOUD_ENV != "rackspace" ]] + then + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades + fi -- cgit 1.2.3-korg