Skip to content

TremaSliceableSwitch

Akihiro MOTOKI edited this page Dec 10, 2013 · 4 revisions

Havana Install Guide

Same setup procedure of Trema Sliceable Switch.

Ubuntu 12.04 LTS

Install dependency packages

Although Trema website says ruby 1.8 should be installed, I cannot install some dependency ruby module with ruby 1.8.7. https://github.com/trema/trema/issues/340 (Cannot run trema on Ubuntu 12.04 and ruby 1.8.7)

It seems good with Ruby 1.9.1.

sudo aptitude install gcc make ruby1.9.1 rubygems ruby1.9.1-dev ¥
    libpcap-dev libsqlite3-dev libglib2.0-dev sqlite3 libdbi-perl ¥
    libdbd-sqlite3-perl apache2 libjson-perl
sudo gem1.9.1 install trema
sudo bundle install

Install Sliceable Switch

mkdir trema
cd trema
git clone https://github.com/trema/apps.git
make -C apps/topology
make -C apps/flow_manager
make -C apps/sliceable_switch

Prepare SQLite3 database

mkdir -p work/sliceable_switch/{etc,db,script}
mkdir -p work/trema
cd ~/trema/apps/sliceable_switch/
./create_tables.sh
mv filter.db slice.db ~/trema/work/sliceable_switch/db/
sudo chown -R www-data.www-data ~/trema/work/sliceable_switch/db

Setup REST API

cp Slice.pm Filter.pm config.cgi ~/trema/work/sliceable_switch/script/
sed -i -e "s|/home/sliceable_switch/db|$HOME/trema/work/sliceable_switch/db|" ¥
    ~/trema/work/sliceable_switch/script/config.cgi
sudo cp apache/sliceable_switch /etc/apache2/sites-available/sliceable_switch.conf
sudo sed -i -e "s|/home/sliceable_switch/script|$HOME/trema/work/sliceable_switch/script|" ¥
    /etc/apache2/sites-available/sliceable_switch.conf
sudo a2enmod rewrite actions
sudo a2ensite sliceable_switch.conf
sudo service apache2 reload

Prepare configuration file for Sliceable Switch

cp sliceable_switch_null.conf ~/trema/work/sliceable_switch/etc/sliceable.conf
sed -i -e "s|^\$apps_dir.*$|\$apps_dir = \"$HOME/trema/apps\"|" ¥
    -e "s|^\$db_dir.*$|\$db_dir = \"$HOME/trema/work/sliceable_switch/db\"|" ¥
    ~/trema/work/sliceable_switch/etc/sliceable.conf

Start Trema (Sliceable Switch)

sudo LOGGING_LEVEL=info TREMA_TMP=$HOME/trema/work/trema ¥
    trema run -d -c ~/trema/work/sliceable_switch/etc/sliceable.conf

Stop Trema (Sliceable Switch)

sudo TREMA_TMP=$HOME/trema/work/trema trema killall

Alternative of trema installation

sudo aptitude install gcc make ruby rubygems ruby-dev libpcap-dev libsqlite3-dev libglib2.0-dev sqlite3 libdbi-perl libdbd-sqlite3-perl apache2 libjson-perl