3 NEXUS_ARTIFACT_REPO=$(cat /opt/config/nexus_artifact_repo.txt)
4 DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
5 if [[ "$DEMO_ARTIFACTS_VERSION" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
6 NB_API_VERSION=$(cat /opt/config/nb_api_version.txt)
7 INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
8 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
10 # Convert Network CIDR to Netmask
12 # Number of args to shift, 255..255, first non-255 byte, zeroes
13 set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
14 [ $1 -gt 1 ] && shift $1 || shift
15 echo ${1-0}.${2-0}.${3-0}.${4-0}
18 # OpenStack network configuration
19 if [[ $CLOUD_ENV == "openstack" ]]
21 echo 127.0.0.1 $(hostname) >> /etc/hosts
23 # Allow remote login as root
24 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
25 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
27 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
29 IP=$(cat /opt/config/ip_to_dns_net.txt)
30 BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
31 NETMASK=$(cdr2mask $BITS)
32 echo "auto eth1" >> /etc/network/interfaces
33 echo "iface eth1 inet static" >> /etc/network/interfaces
34 echo " address $IP" >> /etc/network/interfaces
35 echo " netmask $NETMASK" >> /etc/network/interfaces
36 echo " mtu $MTU" >> /etc/network/interfaces
38 IP=$(cat /opt/config/oam_private_ipaddr.txt)
39 BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
40 NETMASK=$(cdr2mask $BITS)
41 echo "auto eth2" >> /etc/network/interfaces
42 echo "iface eth2 inet static" >> /etc/network/interfaces
43 echo " address $IP" >> /etc/network/interfaces
44 echo " netmask $NETMASK" >> /etc/network/interfaces
45 echo " mtu $MTU" >> /etc/network/interfaces
47 IP=$(cat /opt/config/ip_to_pktgen_net.txt)
48 BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
49 NETMASK=$(cdr2mask $BITS)
50 echo "auto eth3" >> /etc/network/interfaces
51 echo "iface eth3 inet static" >> /etc/network/interfaces
52 echo " address $IP" >> /etc/network/interfaces
53 echo " netmask $NETMASK" >> /etc/network/interfaces
54 echo " mtu $MTU" >> /etc/network/interfaces
57 # Download required dependencies
58 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
59 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
61 apt-get install --allow-unauthenticated -y make gcc wget openjdk-8-jdk bridge-utils libcurl4-openssl-dev apt-transport-https ca-certificates git maven
64 # Download vLB demo code for load balancer
66 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip v_lb_init.sh > /opt/v_lb_init.sh
67 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip vlb.sh > /opt/vlb.sh
68 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip add_dns.sh > /opt/add_dns.sh
69 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip remove_dns.sh > /opt/remove_dns.sh
70 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip properties.conf > /opt/config/properties.conf
71 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip run_health.sh > /opt/run_health.sh
72 wget -O ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.ves5&a=ves&c=demo&e=tar.gz&v=$DEMO_ARTIFACTS_VERSION"
73 wget -O ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.ves5&a=ves_vlb_reporting&c=demo&e=tar.gz&v=$DEMO_ARTIFACTS_VERSION"
75 tar -zmxvf ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
76 mv ves-$DEMO_ARTIFACTS_VERSION VES
77 tar -zmxvf ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
78 mv ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION VESreporting_vLB
79 mv VESreporting_vLB /opt/VES/evel/evel-library/code/VESreporting
81 # Clone Honeycomb interface for the VNF component
83 git init honeycomb-api
85 git remote add origin https://gerrit.onap.org/r/p/demo.git
86 git config core.sparsecheckout true
87 echo "vnfs/vLBMS/apis" >> .git/info/sparse-checkout
88 git pull --depth=1 origin master
91 cat > ~/.m2/settings.xml << EOF
92 <?xml version="1.0" encoding="UTF-8"?>
93 <!-- vi: set et smarttab sw=2 tabstop=2: -->
94 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
95 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
96 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
100 <id>fd.io-release</id>
103 <id>fd.io-mirror</id>
104 <name>fd.io-mirror</name>
105 <url>https://nexus.fd.io/content/groups/public/</url>
107 <enabled>true</enabled>
108 <updatePolicy>never</updatePolicy>
111 <enabled>false</enabled>
117 <id>fd.io-mirror</id>
118 <name>fd.io-mirror</name>
119 <url>https://nexus.fd.io/content/repositories/public/</url>
121 <enabled>true</enabled>
122 <updatePolicy>never</updatePolicy>
125 <enabled>false</enabled>
128 </pluginRepositories>
132 <id>fd.io-snapshots</id>
135 <id>fd.io-snapshot</id>
136 <name>fd.io-snapshot</name>
137 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
139 <enabled>false</enabled>
142 <enabled>true</enabled>
148 <id>fd.io-snapshot</id>
149 <name>fd.io-snapshot</name>
150 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
152 <enabled>false</enabled>
155 <enabled>true</enabled>
158 </pluginRepositories>
161 <id>opendaylight-snapshots</id>
164 <id>opendaylight-snapshot</id>
165 <name>opendaylight-snapshot</name>
166 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
168 <enabled>false</enabled>
171 <enabled>true</enabled>
177 <id>opendaylight-shapshot</id>
178 <name>opendaylight-snapshot</name>
179 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
181 <enabled>false</enabled>
184 <enabled>true</enabled>
187 </pluginRepositories>
192 <activeProfile>fd.io-release</activeProfile>
193 <activeProfile>fd.io-snapshots</activeProfile>
194 <activeProfile>opendaylight-snapshots</activeProfile>
199 cd /opt/honeycomb-api/vnfs/vLBMS/apis
202 sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' /opt/honeycomb-api/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/target/vlb-vnf-onap-distribution-$NB_API_VERSION-hc/vlb-vnf-onap-distribution-$NB_API_VERSION/config/honeycomb.json
203 sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' /opt/honeycomb-api/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/target/vlb-vnf-onap-distribution-$NB_API_VERSION-hc/vlb-vnf-onap-distribution-$NB_API_VERSION/config/honeycomb.json
207 chmod +x v_lb_init.sh
209 chmod +x /opt/VES/evel/evel-library/code/VESreporting/go-client.sh
211 chmod +x remove_dns.sh
212 chmod +x run_health.sh
214 echo "vpp" > config/service.txt
217 export UBUNTU="xenial"
218 export RELEASE=".stable.1707"
219 rm /etc/apt/sources.list.d/99fd.io.list
220 echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
222 apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
226 cd /opt/VES/evel/evel-library/bldjobs/
231 # Run instantiation script
233 mv vlb.sh /etc/init.d
234 update-rc.d vlb.sh defaults
236 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
237 if [[ $CLOUD_ENV != "rackspace" ]]
239 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
240 grub-mkconfig -o /boot/grub/grub.cfg
241 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
242 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
243 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
244 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic