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/local_private_ipaddr.txt)
30 BITS=$(cat /opt/config/pktgen_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
48 # Download required dependencies
49 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
50 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
52 apt-get install --allow-unauthenticated -y make wget openjdk-8-jdk gcc libcurl4-openssl-dev python-pip bridge-utils apt-transport-https ca-certificates git maven
53 pip install jsonschema
55 # Download vFirewall demo code for packet generator
57 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip v_packetgen_init.sh > /opt/v_packetgen_init.sh
58 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip vpacketgen.sh > /opt/vpacketgen.sh
59 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip run_streams_dns.sh > /opt/run_streams_dns.sh
60 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip properties.conf > /opt/config/properties.conf
61 unzip -p -j /opt/vlbms-scripts-$INSTALL_SCRIPT_VERSION.zip run_health.sh > /opt/run_health.sh
62 wget -O vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vlb&a=vlb_dns_streams&c=demo&e=tar.gz&v=$DEMO_ARTIFACTS_VERSION"
64 sed -i 's/primary=.*/primary=false/g' /opt/config/properties.conf
65 sed -i 's/vnfc=.*/vnfc=vPacketGen/g' /opt/config/properties.conf
67 tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
68 mv vlb_dns_streams-$DEMO_ARTIFACTS_VERSION dns_streams
70 # Clone Honeycomb interface for the VNF component
72 git init honeycomb-api
74 git remote add origin https://gerrit.onap.org/r/p/demo.git
75 git config core.sparsecheckout true
76 echo "vnfs/vLBMS/apis" >> .git/info/sparse-checkout
77 git pull --depth=1 origin master
80 cat > ~/.m2/settings.xml << EOF
81 <?xml version="1.0" encoding="UTF-8"?>
82 <!-- vi: set et smarttab sw=2 tabstop=2: -->
83 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
84 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
85 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
89 <id>fd.io-release</id>
93 <name>fd.io-mirror</name>
94 <url>https://nexus.fd.io/content/groups/public/</url>
96 <enabled>true</enabled>
97 <updatePolicy>never</updatePolicy>
100 <enabled>false</enabled>
106 <id>fd.io-mirror</id>
107 <name>fd.io-mirror</name>
108 <url>https://nexus.fd.io/content/repositories/public/</url>
110 <enabled>true</enabled>
111 <updatePolicy>never</updatePolicy>
114 <enabled>false</enabled>
117 </pluginRepositories>
121 <id>fd.io-snapshots</id>
124 <id>fd.io-snapshot</id>
125 <name>fd.io-snapshot</name>
126 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
128 <enabled>false</enabled>
131 <enabled>true</enabled>
137 <id>fd.io-snapshot</id>
138 <name>fd.io-snapshot</name>
139 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
141 <enabled>false</enabled>
144 <enabled>true</enabled>
147 </pluginRepositories>
150 <id>opendaylight-snapshots</id>
153 <id>opendaylight-snapshot</id>
154 <name>opendaylight-snapshot</name>
155 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
157 <enabled>false</enabled>
160 <enabled>true</enabled>
166 <id>opendaylight-shapshot</id>
167 <name>opendaylight-snapshot</name>
168 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
170 <enabled>false</enabled>
173 <enabled>true</enabled>
176 </pluginRepositories>
181 <activeProfile>fd.io-release</activeProfile>
182 <activeProfile>fd.io-snapshots</activeProfile>
183 <activeProfile>opendaylight-snapshots</activeProfile>
188 cd /opt/honeycomb-api/vnfs/vLBMS/apis
191 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
192 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
196 chmod +x v_packetgen_init.sh
197 chmod +x vpacketgen.sh
198 chmod +x run_streams_dns.sh
199 chmod +x run_health.sh
201 echo "vpp" > config/service.txt
204 export UBUNTU="xenial"
205 export RELEASE=".stable.1707"
206 rm /etc/apt/sources.list.d/99fd.io.list
207 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
209 apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
212 # Run instantiation script
214 mv vpacketgen.sh /etc/init.d
215 update-rc.d vpacketgen.sh defaults
217 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
218 if [[ $CLOUD_ENV != "rackspace" ]]
220 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
221 grub-mkconfig -o /boot/grub/grub.cfg
222 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
223 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
224 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
225 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
229 ./v_packetgen_init.sh