Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | apt-get update |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 3 | on_cord=0 |
A R Karthick | bd82f36 | 2016-11-10 15:08:52 -0800 | [diff] [blame] | 4 | release=$(lsb_release -cs) |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 5 | if [ "$1" = "--cord" ]; then |
| 6 | echo "Skipping installation of Docker and ONOS" |
| 7 | on_cord=1 |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 8 | fi |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 9 | if [ $on_cord -eq 0 ]; then |
| 10 | apt-get -y install apt-transport-https ca-certificates |
| 11 | apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
| 12 | if [ ! -f /etc/apt/sources.list.d/docker.list ]; then |
A R Karthick | bd82f36 | 2016-11-10 15:08:52 -0800 | [diff] [blame] | 13 | echo deb https://apt.dockerproject.org/repo ubuntu-$release main | tee /etc/apt/sources.list.d/docker.list |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 14 | fi |
| 15 | apt-get update |
| 16 | apt-get purge lxc-docker || true |
| 17 | apt-get -y install linux-image-extra-$(uname -r) |
| 18 | apt-get -y install apparmor |
| 19 | echo "Installing Docker" |
| 20 | apt-get -y install docker-engine |
A R Karthick | c4108fe | 2016-11-17 15:15:28 -0800 | [diff] [blame] | 21 | service docker restart |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 22 | echo "Verifying Docker installation" |
| 23 | docker run --rm hello-world || exit 127 |
| 24 | docker rmi hello-world |
A R Karthick | b05acab | 2016-11-10 15:12:43 -0800 | [diff] [blame] | 25 | echo "Pulling ONOS latest" |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 26 | docker pull onosproject/onos:latest || exit 127 |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 27 | apt-get -y install openvswitch-common openvswitch-switch |
| 28 | fi |
A R Karthick | c1dc1d7 | 2016-10-27 15:35:19 -0700 | [diff] [blame] | 29 | apt-get -y install wget git python python-dev python-pip python-setuptools python-scapy python-pexpect python-maas-client tcpdump arping libssl-dev |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 30 | easy_install nose |
A R Karthick | c1dc1d7 | 2016-10-27 15:35:19 -0700 | [diff] [blame] | 31 | pip install scapy==2.3.2 |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 32 | pip install monotonic |
| 33 | pip install configObj |
A.R Karthick | e463106 | 2016-11-03 14:28:19 -0700 | [diff] [blame] | 34 | pip install docker-py==1.9.0 |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 35 | pip install -U pyyaml |
| 36 | pip install -U nsenter |
| 37 | pip install -U pyroute2 |
| 38 | pip install -U netaddr |
A R Karthick | ea9abc8 | 2016-06-17 14:55:19 -0700 | [diff] [blame] | 39 | pip install -U python-daemon |
A R Karthick | c1dc1d7 | 2016-10-27 15:35:19 -0700 | [diff] [blame] | 40 | pip install scapy-ssl_tls==1.2.2 |
A R Karthick | 5f4f3be | 2016-10-21 09:21:51 -0700 | [diff] [blame] | 41 | pip install -U robotframework |
| 42 | pip install -U robotframework-requests |
| 43 | pip install -U robotframework-sshlibrary |
A R Karthick | 19aaf5c | 2016-11-09 17:47:57 -0800 | [diff] [blame] | 44 | pip install paramiko==1.10.1 |
Chetan Gaonker | 66bff93 | 2016-05-09 10:06:37 -0700 | [diff] [blame] | 45 | ( cd /tmp && git clone https://github.com/jpetazzo/pipework.git && cp -v pipework/pipework /usr/bin && rm -rf pipework ) |
A R Karthick | 05e85fa | 2016-12-02 09:20:54 -0800 | [diff] [blame] | 46 | |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 47 | ## Special mode to pull cord-tester repo in case prereqs was installed by hand instead of repo |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 48 | if [ "$1" = "--test" ]; then |
Chetan Gaonker | cc19ac4 | 2016-05-04 17:21:50 -0700 | [diff] [blame] | 49 | rm -rf cord-tester |
A R Karthick | d49ca4b | 2016-07-27 11:52:50 -0700 | [diff] [blame] | 50 | git clone https://github.com/opencord/cord-tester.git |
Chetan Gaonker | 66bff93 | 2016-05-09 10:06:37 -0700 | [diff] [blame] | 51 | fi |
A R Karthick | 05e85fa | 2016-12-02 09:20:54 -0800 | [diff] [blame] | 52 | |
| 53 | install_ovs() { |
| 54 | mkdir -p /root/ovs |
| 55 | wget http://openvswitch.org/releases/openvswitch-2.5.0.tar.gz -O /root/ovs/openvswitch-2.5.0.tar.gz && \ |
| 56 | ( cd /root/ovs && tar zxpvf openvswitch-2.5.0.tar.gz && \ |
| 57 | cd openvswitch-2.5.0 && \ |
| 58 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-ssl && make && make install |
| 59 | ) |
| 60 | } |
| 61 | |
| 62 | ovs_install=0 |
| 63 | |
| 64 | if [ -f /usr/bin/ovs-vsctl ] || [ -f /usr/local/bin/ovs-vsctl ]; then |
| 65 | ##find the version. Install if ovs version less than 2.5 |
| 66 | version=`sudo ovs-vsctl --version | head -1 | awk '/[1-9].[0-9].[0-9]/ {print $NF}'` |
| 67 | major=$(echo $version | cut -d "." -f1) |
| 68 | minor=$(echo $version | cut -d "." -f2) |
| 69 | if [ $major -le 2 ]; then |
| 70 | if [ $major -lt 2 ]; then |
| 71 | ovs_install=1 |
| 72 | else |
| 73 | if [ $minor -lt 5 ]; then |
| 74 | ovs_install=1 |
| 75 | fi |
| 76 | fi |
| 77 | fi |
| 78 | else |
| 79 | ovs_install=1 |
| 80 | fi |
| 81 | |
| 82 | if [ $ovs_install -eq 1 ]; then |
| 83 | echo "Installing OVS 2.5.0" |
| 84 | service openvswitch-switch stop |
| 85 | install_ovs |
| 86 | fi |