Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -xe |
| 3 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 4 | ONOS_BRANCH_DEV="master" |
| 5 | ONOS_BRANCH_TUTORIAL="onos-1.14" |
Carmelo Cascone | a4dc3c1 | 2019-02-12 17:30:00 -0800 | [diff] [blame] | 6 | BAZEL_VER="0.22.0" |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 7 | |
Carmelo Cascone | 97d36a2 | 2019-04-12 11:05:50 -0700 | [diff] [blame] | 8 | # There is a known issue with some kernel versions that affects PTF tests: |
| 9 | # https://github.com/jafingerhut/p4-guide/tree/master/linux-veth-bug |
| 10 | KERNEL_VER="4.15.0-46-generic" |
| 11 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 12 | VM_TYPE=${1:-dev} |
| 13 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 14 | if [[ ${VM_TYPE} = "tutorial" ]] |
| 15 | then |
| 16 | ONOS_BRANCH=${ONOS_BRANCH_TUTORIAL} |
| 17 | else |
| 18 | ONOS_BRANCH=${ONOS_BRANCH_DEV} |
| 19 | fi |
| 20 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 21 | # Create user sdn |
| 22 | useradd -m -d /home/sdn -s /bin/bash sdn |
| 23 | echo "sdn:rocks" | chpasswd |
| 24 | echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn |
| 25 | chmod 440 /etc/sudoers.d/99_sdn |
| 26 | usermod -aG vboxsf sdn |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 27 | update-locale LC_ALL="en_US.UTF-8" |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 28 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 29 | if [[ ${VM_TYPE} = "tutorial" ]] |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 30 | then |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 31 | su sdn <<'EOF' |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 32 | cd /home/sdn |
| 33 | bash /vagrant/tutorial-bootstrap.sh |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 34 | EOF |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 35 | fi |
| 36 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 37 | # Java 8 |
| 38 | apt-get install software-properties-common -y |
| 39 | add-apt-repository ppa:webupd8team/java -y |
| 40 | apt-get update |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 41 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 42 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade |
| 43 | |
| 44 | echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 45 | apt-get -y --no-install-recommends install \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 46 | avahi-daemon \ |
| 47 | bridge-utils \ |
| 48 | git \ |
| 49 | git-review \ |
| 50 | htop \ |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 51 | oracle-java8-installer \ |
| 52 | oracle-java8-set-default \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 53 | python2.7 \ |
| 54 | python2.7-dev \ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 55 | valgrind \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 56 | zip unzip \ |
| 57 | tcpdump \ |
| 58 | vlan \ |
| 59 | ntp \ |
| 60 | vim nano emacs \ |
Charles Chan | 84431b9 | 2018-08-16 20:30:09 -0700 | [diff] [blame] | 61 | arping \ |
| 62 | gawk \ |
| 63 | texinfo \ |
| 64 | build-essential \ |
| 65 | iptables \ |
| 66 | automake \ |
| 67 | autoconf \ |
| 68 | libtool \ |
Carmelo Cascone | 97d36a2 | 2019-04-12 11:05:50 -0700 | [diff] [blame] | 69 | linux-image-${KERNEL_VER} \ |
Charles Chan | 84431b9 | 2018-08-16 20:30:09 -0700 | [diff] [blame] | 70 | isc-dhcp-server |
| 71 | |
| 72 | DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 73 | |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 74 | # Install Bazel |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 75 | BAZEL_SH="bazel-${BAZEL_VER}-installer-linux-x86_64.sh" |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 76 | wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_SH} |
| 77 | chmod +x ${BAZEL_SH} |
| 78 | ./${BAZEL_SH} |
| 79 | rm -f ${BAZEL_SH} |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 80 | |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 81 | # Install pip and some python deps (others are defined in install-p4-tools.sh) |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 82 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py |
| 83 | python2.7 get-pip.py --force-reinstall |
| 84 | rm -f get-pip.py |
Charles Chan | 84431b9 | 2018-08-16 20:30:09 -0700 | [diff] [blame] | 85 | pip install ipaddress |
| 86 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 87 | tee -a /etc/ssh/sshd_config <<EOF |
| 88 | |
| 89 | UseDNS no |
| 90 | EOF |
| 91 | |
| 92 | su sdn <<'EOF' |
| 93 | cd /home/sdn |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 94 | bash /vagrant/user-bootstrap.sh ${ONOS_BRANCH} |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 95 | EOF |