3 REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
4 REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
5 DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
6 INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
7 VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt)
8 VPP_SOURCE_REPO_BRANCH=$(cat /opt/config/vpp_source_repo_branch.txt)
9 HC2VPP_SOURCE_REPO_URL=$(cat /opt/config/hc2vpp_source_repo_url.txt)
10 HC2VPP_SOURCE_REPO_BRANCH=$(cat /opt/config/hc2vpp_source_repo_branch.txt)
11 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
13 # Convert Network CIDR to Netmask
15 # Number of args to shift, 255..255, first non-255 byte, zeroes
16 set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
17 [ $1 -gt 1 ] && shift $1 || shift
18 echo ${1-0}.${2-0}.${3-0}.${4-0}
21 # OpenStack network configuration
22 if [[ $CLOUD_ENV == "openstack" ]]
24 echo 127.0.0.1 $(hostname) >> /etc/hosts
26 # Allow remote login as root
27 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
28 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
30 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
32 IP=$(cat /opt/config/mux_gw_private_net_ipaddr.txt)
33 BITS=$(cat /opt/config/mux_gw_private_net_cidr.txt | cut -d"/" -f2)
34 NETMASK=$(cdr2mask $BITS)
35 echo "auto eth1" >> /etc/network/interfaces
36 echo "iface eth1 inet static" >> /etc/network/interfaces
37 echo " address $IP" >> /etc/network/interfaces
38 echo " netmask $NETMASK" >> /etc/network/interfaces
39 echo " mtu $MTU" >> /etc/network/interfaces
41 IP=$(cat /opt/config/oam_ipaddr.txt)
42 BITS=$(cat /opt/config/oam_cidr.txt | cut -d"/" -f2)
43 NETMASK=$(cdr2mask $BITS)
44 echo "auto eth2" >> /etc/network/interfaces
45 echo "iface eth2 inet static" >> /etc/network/interfaces
46 echo " address $IP" >> /etc/network/interfaces
47 echo " netmask $NETMASK" >> /etc/network/interfaces
48 echo " mtu $MTU" >> /etc/network/interfaces
54 # Download required dependencies
55 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
56 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
58 apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev
61 # Install the tools required for download codes
62 apt-get install -y expect git
64 #Download and build the VPP codes
66 git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_BRANCH} vpp
71 spawn make install-dep;
73 \"Do you want to continue?*\" {send \"Y\r\"; interact}
79 make V=0 PLATFORM=vpp TAG=vpp install-deb
81 # Install the VPP package
85 # Auto-start configuration for the VPP
86 cat > /etc/vpp/startup.conf << EOF
92 cli-listen localhost:5002
93 startup-config /etc/vpp/setup.gate
105 ## In the VPP there is one main thread and optionally the user can create worker(s)
106 ## The main thread and worker thread(s) can be pinned to CPU core(s) manually or automatically
108 ## Manual pinning of thread(s) to CPU core(s)
110 ## Set logical CPU core where main thread runs
113 ## Set logical CPU core(s) where worker threads are running
114 # corelist-workers 2-3,18-19
116 ## Automatic pinning of thread(s) to CPU core(s)
118 ## Sets number of CPU core(s) to be skipped (1 ... N-1)
119 ## Skipped CPU core(s) are not used for pinning main thread and working thread(s).
120 ## The main thread is automatically pinned to the first available CPU core and worker(s)
121 ## are pinned to next free CPU core(s) after core assigned to main thread
124 ## Specify a number of workers to be created
125 ## Workers are pinned to N consecutive CPU cores while skipping "skip-cores" CPU core(s)
126 ## and main thread's CPU core
129 ## Set scheduling policy and priority of main and worker threads
131 ## Scheduling policy options are: other (SCHED_OTHER), batch (SCHED_BATCH)
132 ## idle (SCHED_IDLE), fifo (SCHED_FIFO), rr (SCHED_RR)
133 # scheduler-policy fifo
135 ## Scheduling priority is used only for "real-time policies (fifo and rr),
136 ## and has to be in the range of priorities supported for a particular policy
137 # scheduler-priority 50
141 ## Change default settings for all intefaces
143 ## Number of receive queues, enables RSS
147 ## Number of transmit queues, Default is equal
148 ## to number of worker threads or 1 if no workers treads
151 ## Number of descriptors in transmit and receive rings
152 ## increasing or reducing number can impact performance
153 ## Default is 1024 for both rx and tx
157 ## VLAN strip offload mode for interface
159 # vlan-strip-offload on
162 ## Whitelist specific interface by specifying PCI address
165 ## Whitelist specific interface by specifying PCI address and in
166 ## addition specify custom parameters for this interface
171 ## Change UIO driver used by VPP, Options are: igb_uio, vfio-pci
172 ## and uio_pci_generic (default)
173 # uio-driver vfio-pci
175 ## Disable mutli-segment buffers, improves performance but
176 ## disables Jumbo MTU support
179 ## Increase number of buffers allocated, needed only in scenarios with
180 ## large number of interfaces and worker threads. Value is per CPU socket.
184 ## Change hugepages allocation per-socket, needed only if there is need for
185 ## larger number of mbufs. Default is 256M on each detected CPU socket
186 # socket-mem 2048,2048
191 cat > /etc/vpp/setup.gate << EOF
192 set int state GigabitEthernet0/8/0 up
193 set int ip address GigabitEthernet0/8/0 10.5.0.21/24
195 set int state GigabitEthernet0/9/0 up
196 set dhcp client intfc GigabitEthernet0/9/0 hostname vg-1
198 tap connect lstack address 192.168.1.1/24
199 set int state tap-0 up
201 create vxlan tunnel src 10.5.0.21 dst 10.5.0.20 vni 100
203 set interface l2 bridge tap-0 10 0
204 set interface l2 bridge vxlan_tunnel0 10 1
205 set bridge-domain arp term 10
207 set int ip address vxlan_tunnel0 192.168.1.254/24
208 set interface snat in vxlan_tunnel0 out GigabitEthernet0/9/0
211 # Download and install HC2VPP from source
213 git clone ${HC2VPP_SOURCE_REPO_URL} -b ${HC2VPP_SOURCE_REPO_BRANCH} hc2vpp
215 apt-get install -y maven
216 cat > ~/.m2/settings.xml << EOF
217 <?xml version="1.0" encoding="UTF-8"?>
218 <!-- vi: set et smarttab sw=2 tabstop=2: -->
219 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
220 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
221 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
225 <id>fd.io-release</id>
228 <id>fd.io-mirror</id>
229 <name>fd.io-mirror</name>
230 <url>https://nexus.fd.io/content/groups/public/</url>
232 <enabled>true</enabled>
233 <updatePolicy>never</updatePolicy>
236 <enabled>false</enabled>
242 <id>fd.io-mirror</id>
243 <name>fd.io-mirror</name>
244 <url>https://nexus.fd.io/content/repositories/public/</url>
246 <enabled>true</enabled>
247 <updatePolicy>never</updatePolicy>
250 <enabled>false</enabled>
253 </pluginRepositories>
257 <id>fd.io-snapshots</id>
260 <id>fd.io-snapshot</id>
261 <name>fd.io-snapshot</name>
262 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
264 <enabled>false</enabled>
267 <enabled>true</enabled>
273 <id>fd.io-snapshot</id>
274 <name>fd.io-snapshot</name>
275 <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url>
277 <enabled>false</enabled>
280 <enabled>true</enabled>
283 </pluginRepositories>
286 <id>opendaylight-snapshots</id>
289 <id>opendaylight-snapshot</id>
290 <name>opendaylight-snapshot</name>
291 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
293 <enabled>false</enabled>
296 <enabled>true</enabled>
302 <id>opendaylight-shapshot</id>
303 <name>opendaylight-snapshot</name>
304 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
306 <enabled>false</enabled>
309 <enabled>true</enabled>
312 </pluginRepositories>
317 <activeProfile>fd.io-release</activeProfile>
318 <activeProfile>fd.io-snapshots</activeProfile>
319 <activeProfile>opendaylight-snapshots</activeProfile>
326 l_version=$(cat pom.xml | grep "<version>" | head -1)
327 l_version=$(echo "${l_version%<*}")
328 l_version=$(echo "${l_version#*>}")
329 mv vpp-integration/minimal-distribution/target/vpp-integration-distribution-${l_version}-hc/vpp-integration-distribution-${l_version} /opt/honeycomb
330 sed -i 's/127.0.0.1/0.0.0.0/g' /opt/honeycomb/config/honeycomb.json
332 # Create systemctl service for Honeycomb
333 cat > /etc/systemd/system/honeycomb.service << EOF
335 Description=Honeycomb Agent for the VPP control plane
336 Documentation=https://wiki.fd.io/view/Honeycomb
341 ExecStart=/opt/honeycomb/honeycomb
346 WantedBy=multi-user.target
348 systemctl enable /etc/systemd/system/honeycomb.service
350 # Install the DHCP server and config
351 apt-get install -y isc-dhcp-server
352 cat >> /etc/dhcp/dhcpd.conf << EOF
353 subnet 192.168.1.0 netmask 255.255.255.0 {
354 range 192.168.1.2 192.168.1.253;
355 option subnet-mask 255.255.255.0;
356 option routers 192.168.1.254;
357 option broadcast-address 192.168.1.255;
358 default-lease-time 600;
363 # Download DHCP config files
365 wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw_init.sh
366 wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw.sh
367 chmod +x v_gw_init.sh
369 mv v_gw.sh /etc/init.d
370 update-rc.d v_gw.sh defaults
372 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
373 if [[ $CLOUD_ENV != "rackspace" ]]
375 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
376 grub-mkconfig -o /boot/grub/grub.cfg
377 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
378 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
379 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
380 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic