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