#!/bin/bash if [ -z $1 ] then echo "Please type the superuser for the netconf server:" read SUPERUSER else SUPERUSER=$1 fi if [ -z $2 ] then echo "Please type the NOX_HOME for the netconf server:" read NOX_HOME else NOX_HOME=$2 fi sudo apt-get update ##### install depedencies of NOX ##### sudo apt-get install -y autoconf automake g++ libtool swig make git-core libboost-dev libboost-test-dev libboost-filesystem-dev libssl-dev libpcap-dev python-twisted python-simplejson python-dev #swig doxygen ##### install depedencies of JSON-RPC-CPP and JSON-CPP ##### sudo apt-get install -y subversion scons libcurl3 ##### installation of JSON-CPP ##### # Download # cd svn co https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk jsoncpp # Build # cd jsoncpp/jsoncpp scons platform=linux-gcc # Install # sudo cp libs/linux-gcc-*/libjson_linux-gcc*libmt.so /usr/local/lib/libjson.so sudo cp -r include/json /usr/local/include/json ##### installation of JSON-RPC-CPP ##### # Download # cd wget http://sb.tmit.bme.hu/mediawiki/images/b/b4/Jsonrpc-cpp.tgz tar xzf Jsonrpc-cpp.tgz rm Jsonrpc-cpp.tgz # Build # cd jsonrpc-cpp scons build # Install # sudo scons install ##### installation of Cyclone ##### # Download # cd wget http://sb.tmit.bme.hu/mediawiki/images/3/3a/Cyclone.tgz tar xzf Cyclone.tgz rm Cyclone.tgz # Install # cd cyclone sudo python setup.py install ##### installation of NOX 1.1 ##### cd $NOX_HOME git clone git://github.com/TrafficLab/nox11oflib.git wget http://sb.tmit.bme.hu/mediawiki/images/d/d6/Nox11oflib-JSONRPC.tgz tar xzf Nox11oflib-JSONRPC.tgz rm Nox11oflib-JSONRPC.tgz cd nox11oflib sed -i "s/ds->reason = ss->reason;/ds->reason = (enum ofp_port_reason)ss->reason;/g" ./src/oflib/ofl-messages-unpack.c ./boot.sh mkdir build cd build ../configure make ##### installation of NOX (Zaku) ##### cd $NOX_HOME git clone git://noxrepo.org/nox wget http://sb.tmit.bme.hu/mediawiki/images/9/9b/Nox-JSONRPC.tgz tar xzf Nox-JSONRPC.tgz rm Nox-JSONRPC.tgz cd nox ./boot.sh mkdir build cd build ../configure # do not insert if it is exist if [ $(grep -m1 -n "/* Edit added by script 2012-02-15 - Kurucz */" $NOX_HOME/nox/src/nox/coreapps/pyrt/pyrt.cc | cut -d : -f 1)!=" " ] then # insert the following lines to avoid the failure linenum=$(grep -m1 -n "\"sys.path.append('.')\\\n\"" $NOX_HOME/nox/src/nox/coreapps/pyrt/pyrt.cc | cut -d : -f 1) sed -i ""$((linenum+1))"i\ \n\ /* Edit added by script 2012-02-15 - Kurucz */\n\ \"sys.path.append('$NOX_HOME/nox/build/src/')"'\\n'"\"\n\ /* Edit end */\n" $NOX_HOME/nox/src/nox/coreapps/pyrt/pyrt.cc fi make # do not insert if it is exist if [ $(grep -m1 -n "/* Edit added by script 2012-02-21 - Kurucz */" /usr/lib/python2.6/dist-packages/twisted/internet/base.py | cut -d : -f 1)!=" " ] then # insert the following lines to avoid the failure linenum=$(grep -m1 -n "__name__ = \"twisted.internet.reactor\"" /usr/lib/python2.6/dist-packages/twisted/internet/base.py | cut -d : -f 1) sudo sed -i ""$((linenum+1))"i\ \n\ # Edit added by script 2012-02-21 - Kurucz\n\ def _handleSigchld(self, signum, frame, _threadSupport=platform.supportsThreads()):\n\ from twisted.internet.process import reapAllProcesses\n\ if _threadSupport:\n\ self.callFromThread(reapAllProcesses)\n\ else:\n\ self.callLater(0, reapAllProcesses)\n\ # Edit end - Kurucz\n" /usr/lib/python2.6/dist-packages/twisted/internet/base.py fi ##### install dependecies of Yuma tools v2 ##### sudo apt-get install -y libxml2-dev libssh2-1-dev libncurses5-dev libz-dev ##### installation of Yuma tools v2 with NOX extension ##### cd wget http://downloads.sourceforge.net/project/yuma/yuma/2.2/yuma-2.2-1.tar.gz tar xzf yuma-2.2-1.tar.gz rm yuma-2.2-1.tar.gz # download NOX extension wget http://sb.tmit.bme.hu/mediawiki/images/f/fd/Yuma-nox_module.tar tar xzf Yuma-nox_module.tar rm Yuma-nox_module.tar tar xzf yuma-2.2-1.tar rm yuma-2.2-1.tar # install Yuma tools v2 cd yuma-2.2-1 make sudo make install # install NOX extension cd libnox make sudo make install ##### modify the /etc/ssh/sshd_config file, and add the 'netconf' subsystem ##### # do not insert if it is exist if [ $(grep -m1 -n "/* Edit added by script 2012-02-21 - Kurucz */" /etc/ssh/sshd_config | cut -d : -f 1)!=" " ] then # find the line number where to insert the rows linenum=$(grep -m1 -n "Port 22" /etc/ssh/sshd_config | cut -d : -f 1) sudo sed -i ""$((linenum+1))"i\ \n\ # Edit added by script 2012-02-21 - Kurucz\n\ Port 830\n\ Subsystem netconf /usr/sbin/netconf-subsystem\n\ # Edit end - Kurucz\n" /etc/ssh/sshd_config fi # restart the ssh server sudo /etc/init.d/ssh restart ##### run the netconf server with the given superuser and NOX module ##### cd /usr/sbin sudo ./netconfd --superuser=$SUPERUSER --module=nox