blob: d038de74e8cb521671eeed9c18976a7b2647e17f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/usr/bin/env bash
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
sysctl -w vm.nr_hugepages=1024
HUGEPAGES=`sysctl -n vm.nr_hugepages`
if [ $HUGEPAGES != 1024 ]; then
echo "ERROR: Unable to get 1024 hugepages, only got $HUGEPAGES. Cannot finish."
exit
fi
echo "deb https://nexus.fd.io/content/repositories/fd.io.stable.1701.ubuntu.trusty.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
apt-get -qq update
apt-get -qq install -y --force-yes vpp vpp-lib vpp-dpdk-dkms bridge-utils lxc
service vpp start
#Configure LXC network to create an inteface for Linux bridge and a unconsumed second inteface
echo -e "lxc.network.name=veth0\nlxc.network.type = veth\nlxc.network.name = veth_link1" | sudo tee -a /etc/lxc/default.conf
lxc-checkconfig
containers=( cone ctwo )
for i in "${containers[@]}"
do
sudo lxc-create -t download -n $i -- --dist ubuntu --release trusty --arch amd64
done
for i in "${containers[@]}"
do
sudo lxc-start -n $i -d
done
function lxc_exec() {
cntr="$1"
rCMD="$2"
CMD="sudo lxc-attach -n $cntr -- $rCMD"
echo "$CMD"
eval "${CMD}"
}
for i in "${containers[@]}"
do
lxc_exec $i "resolvconf -d eth0"
lxc_exec $i "dhclient"
lxc_exec $i "sh -c 'echo \"deb https://nexus.fd.io/content/repositories/fd.io.master.ubuntu.trusty.main/ ./\" >> /etc/apt/sources.list.d/99fd.io.list'"
lxc_exec $i "apt-get -qq install -y wget"
lxc_exec $i "apt-get -qq update"
lxc_exec $i "apt-get -qq install -y --force-yes vpp"
lxc_exec $i "sh -c 'echo \"\\ndpdk {\\n no-pci\\n}\" >> /etc/vpp/startup.conf'"
lxc_exec $i "service vpp start"
done
for i in "${containers[@]}"
do
sudo lxc-stop -n $i
done
#UI dependencies
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
#setup the npm proxy config correctly
if [[ -v http_proxy ]]; then
sudo npm config set proxy $http_proxy
fi
if [[ -v https_proxy ]]; then
npm_https_proxy=$(sed 's/https/http/' <<< $https_proxy)
sudo npm config set https-proxy $npm_https_proxy
fi
#install nodeJS backend
sudo npm install /vagrant/ui/backend/
sudo mv node_modules/vppsb/node_modules/ /vagrant/ui/backend/
sudo npm install -g forever
sudo forever start /vagrant/ui/backend/server.js
|