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