Skip to content

trema/switch_monitor

Repository files navigation

switch_monitor

Build Status Coverage Status Dependency Status Code Climate Inline docs

OpenFlow switch liveness monitor.

Prerequisites

  • Ruby 2.0.0 or higher (RVM).
  • Open vSwitch (apt-get install openvswitch-switch).

Install

$ git clone https://github.com/trema/switch_monitor.git
$ cd switch_monitor
$ bundle install --binstubs

Play

Run this controller:

$ ./bin/trema run ./lib/switch_monitor.rb -c trema.conf
0x3 is up (All = 0x3)
0x2 is up (All = 0x2, 0x3)
0x1 is up (All = 0x1, 0x2, 0x3)
...

On another terminal, stop and restart running switches with trema stop and trema start command, and switch_monitor.rb outputs the current switch status.

(On another terminal)
$ ./bin/trema stop 0x2
$ ./bin/trema start 0x2
$ ./bin/trema run ./lib/switch_monitor.rb -c trema.conf
0x3 is up (All = 0x3)
0x2 is up (All = 0x2, 0x3)
0x1 is up (All = 0x1, 0x2, 0x3)
0x2 is down (All = 0x1, 0x3)
0x2 is up (All = 0x1, 0x2, 0x3)

Enjoy!