Introduction

Index:1 - Update the CentOS2 - Add the RPMforge repository3 - Install the NetFPGA Base package4 - Install OpenFlow and the OpenFlow bitfiles5 - Initialization script6 - Details

For this guide, the pre-requirement is to have the CentOS 5 install, it can be any version, since it's going to be updated to the most recent version of the CentOS 5.

The root user will be the one always through this installation.

1 - Update the CentOS

For this step, just accept the update listed by the OS.

 

Optional:

In case the system isn't booting into the graphical interface and there is a need to use it, just edit the following file:

vim /etc/inittab

Change the following line:

id:3:initdefault:

to:

id:5:initdefault:

2 - Add the RPMforge repository

For this step use the commands below to add the RPMforge repository.

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.*.rpm

If the command above doesn't work, try this option:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

Optional:

It's possible to verify that the repository was added by install the htop tool.

yum install htop

3 - Install the NetFPGA Base package

3.1 - Add the NetFPGA repository:
rpm -Uhv http://wiki.netfpga.org/yum/el5/RPMS/noarch/netfpga-repo-1-1_CentOS5.noarch.rpm

If the command above doesn't work, try this option:

wget http://wiki.netfpga.org/yum/el5/RPMS/noarch/netfpga-repo-1-1_CentOS5.noarch.rpm
 
rpm -i netfpga-repo-1-1_CentOS5.noarch.rpm


3.2 - Install the kernel sources, which are necessary for the compilation of the netfpa-base:

yum -y update kernel


Optional:

Edit the grub file so as to the system can boot at the latest version of the kernel:

vim /boot/grub/menu.lst

Change the line "default=k" to the one corresponding to the latest version, which is always the first one:

default=0

Optional - Only if the server is updated:

Boot at the most recent version of the kernel:

reboot

3.3 - Download the sources of the kernel:

yum -y install kernel-devel

Optional:

Verify the version of the current kernel:

uname --r

Optional:

Verify if the directory 'build' exists:

ls /lib/modules/`uname -r`/build

 

3.4 - Install the netfpa-base package:

yum -y install netfpga-base

3.5 - Verify if the new kernel was installed:

vim /boot/grub/menu.lst

3.6 - Then reboot:

reboot

Optional:

Verify the current kernel:

uname --r

3.7 - Execute the following script, so as to create the netfpga directory and environment variables:

/usr/local/netfpga/lib/scripts/user_account_setup/user_account_setup.pl

3.8 - Add to the boot the CPCI reprogram script.

vim /etc/rc.local

Add at the last line, the following code:

/usr/local/netfpga/lib/scripts/cpci_reprogram/cpci_reprogram.pl --all

3.9 - Reprogram the NetFPGA:

/usr/local/netfpga/lib/scripts/cpci_reprogram/cpci_reprogram.pl --all

Optional:

Execute the selftest.

Connect the network cables at the netfpga in a loopback fashion (port0 at port 1, port 2 at port 3).

Activate all the ports:

for i in `seq 0 3`; do ifconfig nf2c$i up; done

Load the bitfile for tests:

nf_download ~/netfpga/bitfiles/selftest.bit

Execute the test ( the '-n' parameter doesn't test the satas)

~/netfpga/projects/selftest/sw/selftest -n

If the test fails use the '-c' parameter, so as to identify the cause of the error:

~/netfpga/projects/selftest/sw/selftest -n -c

 

4 - Install OpenFlow and the OpenFlow bitfiles

4.1 - Install the dependencies:

yum -y install git automake pkgconfig libtool gcc

4.2 - Install autoconf:

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.63.tar.gz
 
tar xvzf autoconf-2.63.tar.gz
 
cd autoconf-2.63
 
./configure --prefix=/usr
 
make
 
make install

4.3 - Download Openflow:

git clone git://gitosis.stanford.edu/openflow.git
 
cd openflow
 
git checkout -b 1.0.0-netfpga origin/devel/tyabe/1.0.0-netfpga
 
./boot.sh

4.4 - Download the bitfile for NetFPGA and the installation of the Openflow with bitfiles:

cd /root/openflow/hw-lib/nf2
 
wget http://openflow.org/downloads/netfpga/openflow_switch.bit.100_3.tar.gz
 
tar xfvz openflow_switch.bit.100_3.tar.gz
 
cd /root/openflow
 
./configure --enable-hw-lib=nf2
 
make
 
make install

 

Optional:

Realize simple NetFPGA tests with the OpenFlow bitfile.

1 - Initialize the Openflow Controller:

cd /root/openflow/controller
 
./controller ptcp:6633

2 - In another terminal:

cd /root/openflow
 
nf_download hw-lib/nf2/openflow_switch.bit

Screen of the first stage of the test:

Start the switch:

ofdatapath punix:/var/run/test -i nf2c0,nf2c1,nf2c2,nf2c3 &
 
ofprotocol unix:/var/run/test tcp:127.0.0.1:6633 &

The NetFPGA will work as a "dumb switch" using the OpenFlow protocol. To verify if it's working properly, just do a simple test in which 02 computers will be connect through the NetFPGA, and they need to ping each other.

5 - Initialization script

To use the OpenFlow Switch as a NetFPGA initialization service, save the script below as 'openflow' at the '/etc/init.d'.  Para iniciar o Switch OpenFlow como serviço na inicialização da NetFPGA save o script abaixo com o nome openflow em /etc/init.d/.

Use your Island's network code as a 02 digit hexadecimal (ie.: RNP: 88), the number of your NetFPGA server (1, 2 or 3) and the Flowvisor IP, at the line 5, 6 and 7 respectively.

#!/bin/sh
# chkconfig: 2345 95 20
# description: Switch OpenFlow

ID=<2-DIGITS-VPN-CODE-IN-HEX>
NETFPGA=<NETFPGA-NUMBER>
FLOWVISOR_ADDRESS=<FLOWVISOR-IP>
FLOWVISOR_PORT=6633
abend ()
{
  echo "$0: $2"
  exit $1
}
kill_process_tree() {
    top=$1
    pid=$2
    children=`ps -o pid --no-headers --ppid ${pid}`
    for child in $children
    do
        kill_process_tree 0 $child
    done
    if [ $top -eq 0 ]; then
        kill -9 $pid &> /dev/null
    fi
}
case "$1" in
start)
  /sbin/ifconfig nf2c0 hw ether 00:00:01:$ID:0$NETFPGA:00
  /sbin/ifconfig nf2c1 hw ether 00:00:01:$ID:0$NETFPGA:01
  /sbin/ifconfig nf2c2 hw ether 00:00:01:$ID:0$NETFPGA:02
  /sbin/ifconfig nf2c3 hw ether 00:00:01:$ID:0$NETFPGA:03

  /usr/local/bin/nf_download /root/openflow/hw-lib/nf2/openflow_switch.bit
  PID=
  if [ -z $PID ]; then
      /usr/local/bin/ofdatapath punix:/var/run/test -i nf2c0,nf2c1,nf2c2,nf2c3 -d 00000000${ID}0$NETFPGA >> /var/log/ofdatapath.log 2>&1 &
  fi
  PID=
  if [ -z $PID ]; then
    /usr/local/bin/ofprotocol unix:/var/run/test tcp:$FLOWVISOR_ADDRESS:$FLOWVISOR_PORT >> /var/log/ofprotocol.log 2>&1 &
  fi
  ;;
stop)
  kill_process_tree 1 $$
  killall ofdatapath
  killall ofprotocol
  ;;
restart)
  $0 stop
  echo Sleeping a bit to let it shutdown
  sleep 1
  $0 start
  ;;
*)
  abend 1 "Usage: $0 [start | stop | restart]"
  ;;
esac

After that, configure the permissions, so as to make the script executable and configure it as initialization service:

 

chmod +x /etc/init.d/openflow
chkconfig --add openflow --level 2345

To start, stop or restart the service manually, use the following commands:

service openflow start
service openflow stop
service openflow restart

6 - Details

After concluding the finishing steps, it may be required to do some few configurations. Below there is a list of guides that should be verified: