361eb8220f2f937dcc513417a9d8cd130bb12fcb
[releng/builder.git] / vagrant / ubuntu-mininet / bootstrap.sh
1 #!/bin/bash
2
3 # vim: sw=4 ts=4 sts=4 et tw=72 :
4
5 echo "---> Updating operating system"
6 apt-get update -qq
7 DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes -qq \
8     -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
9
10 # To handle the prompt style that is expected all over the environment
11 # with how use use robotframework we need to make sure that it is
12 # consistent for any of the users that are created during dynamic spin
13 # ups
14 echo 'PS1="[\u@\h \W]> "' >> /etc/skel/.bashrc
15
16 # Install mininet
17 # apt-get install -y --force-yes -qq mininet
18
19 # Install mininet with OF13 patch
20 cd /tmp
21 cat > newOptions.patch <<EOF
22 --- mininet/node.py     2014-09-12 13:48:03.165628683 +0100
23 +++ mininet/node.py     2014-09-12 13:50:39.021630236 +0100
24 @@ -952,6 +952,10 @@
25             datapath: userspace or kernel mode (kernel|user)"""
26          Switch.__init__( self, name, **params )
27          self.failMode = failMode
28 +        protKey = 'protocols'
29 +        if self.params and protKey in self.params:
30 +               print 'have protcol params!'
31 +               self.opts += protKey + '=' + self.params[protKey]
32          self.datapath = datapath
33
34      @classmethod
35 @@ -1027,8 +1031,9 @@
36          if self.datapath == 'user':
37              self.cmd( 'ovs-vsctl set bridge', self,'datapath_type=netdev' )
38          int( self.dpid, 16 ) # DPID must be a hex string
39 +        print 'OVSswitch opts: ',self.opts
40          self.cmd( 'ovs-vsctl -- set Bridge', self,
41 -                  'other_config:datapath-id=' + self.dpid )
42 +                  self.opts+' other_config:datapath-id=' + self.dpid )
43          self.cmd( 'ovs-vsctl set-fail-mode', self, self.failMode )
44          for intf in self.intfList():
45              if not intf.IP():
46 EOF
47
48 git clone git://github.com/mininet/mininet
49 cd mininet/
50 git checkout -b 2.1.0 2.1.0
51 git apply -p0 < ../newOptions.patch
52 cd ./util
53 ./install.sh -nfv
54
55 # Install CPqD
56 apt-get install -y --force-yes -qq build-essential cmake flex
57 apt-get install -y --force-yes -qq libpcre++-dev libxerces-c-dev libpcap-dev libboost-all-dev
58
59 cd /tmp
60 wget -nc http://de.archive.ubuntu.com/ubuntu/pool/main/b/bison/bison_2.5.dfsg-2.1_amd64.deb \
61          http://de.archive.ubuntu.com/ubuntu/pool/main/b/bison/libbison-dev_2.5.dfsg-2.1_amd64.deb
62
63 dpkg -i bison_2.5.dfsg-2.1_amd64.deb libbison-dev_2.5.dfsg-2.1_amd64.deb
64 rm bison_2.5.dfsg-2.1_amd64.deb libbison-dev_2.5.dfsg-2.1_amd64.deb
65
66 wget -nc http://www.nbee.org/download/nbeesrc-jan-10-2013.zip
67 unzip nbeesrc-jan-10-2013.zip
68 cd nbeesrc-jan-10-2013/src
69 cmake .
70 make
71 cp ../bin/libn*.so /usr/local/lib
72 ldconfig
73 cp -R ../include/* /usr/include/
74 cd ../..
75
76 git clone https://github.com/CPqD/ofsoftswitch13.git
77 cd ofsoftswitch13
78 ./boot.sh
79 ./configure
80 make
81 make install
82 cd ..
83
84 # cbench installation for running openflow performance tests
85
86 OF_DIR=$HOME/openflow  # Directory that contains OpenFlow code
87 OFLOPS_DIR=$HOME/oflops  # Directory that contains oflops repo
88
89 apt-get install -y --force-yes -qq libsnmp-dev libpcap-dev libconfig-dev
90
91 git clone git://gitosis.stanford.edu/openflow.git $OF_DIR
92 git clone https://github.com/andi-bigswitch/oflops.git $OFLOPS_DIR
93
94 cd $OFLOPS_DIR
95 ./boot.sh
96 ./configure --with-openflow-src-dir=$OF_DIR
97 make
98 make install
99
100 # Install vlan for vlan based tests in VTN suites
101 apt-get install -y --force-yes -qq vlan