From 73c321b0dae21abab1a0286dfa1c70028b731686 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Tue, 10 Feb 2015 08:27:17 +0900 Subject: [PATCH] Add play section. --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/README.md b/README.md index f2d4e26..e91831b 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,54 @@ OpenFlow switch liveness monitor. [codeclimate]: https://codeclimate.com/github/trema/switch_monitor [gemnasium]: https://gemnasium.com/trema/switch_monitor [inch]: http://inch-ci.org/github/trema/switch_monitor + +Install +------- + +``` +$ git clone https://github.com/trema/switch_monitor.git +$ cd switch_monitor +$ bundle install +``` + + +Play +---- + +Run this controller: + +``` +% bundle exec trema run ./lib/switch_monitor.rb -c trema.conf +All switches = +Switch 0x3 is UP +Switch 0x2 is UP +Switch 0x1 is UP +All switches = 0x1, 0x2, 0x3 +... +``` + +On another terminal, stop and restart running switches with `trema +kill` and `trema up` command, and switch_monitor.rb outputs the +current switch status. + +``` +(On another terminal) +% bundle exec trema kill 0x1 +% bundle exec trema up 0x1 +``` + +``` +% bundle exec trema run ./lib/switch_monitor.rb -c trema.conf +All switches = +Switch 0x3 is UP +Switch 0x2 is UP +Switch 0x1 is UP +All switches = 0x1, 0x2, 0x3 +... +Switch 0x1 is DOWN +All switches = 0x2, 0x3 +... +Switch 0x1 is UP +``` + +Enjoy!