Class: MainController
- Inherits:
-
Trema::Controller
- Object
- Trema::Controller
- MainController
- Defined in:
- lib/trema/controllers/main_controller.rb
Instance Method Summary collapse
- #packet_in(dp_id, packet_in) ⇒ Object
- #start(_argv) ⇒ Object
- #switch_disconnected(dp_id) ⇒ Object
- #switch_ready(dp_id) ⇒ Object
Instance Method Details
#packet_in(dp_id, packet_in) ⇒ Object
35 36 37 |
# File 'lib/trema/controllers/main_controller.rb', line 35 def packet_in(dp_id, packet_in) packet_details(packet_in) end |
#start(_argv) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/trema/controllers/main_controller.rb', line 7 def start(_argv) initialize_instance_vars logger.info "Generating rules based on the policies defined in #{ENV['HAVOX_MERLIN_POLICY'].bold}" \ " over the topology #{ENV['HAVOX_MERLIN_TOPOLOGY'].bold}..." @rules = Havox::Merlin.compile!(ENV['HAVOX_MERLIN_TOPOLOGY'], ENV['HAVOX_MERLIN_POLICY'], @opts) datapath_rules_info rescue => e handle_exception(e) end |
#switch_disconnected(dp_id) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/trema/controllers/main_controller.rb', line 28 def switch_disconnected(dp_id) @datapaths -= [dp_id] @datapaths_off << dp_id dp_name = "s#{dp_id}" logger.info "Datapath #{dp_name.bold} is #{'OFFLINE'.bold.red}" end |
#switch_ready(dp_id) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/trema/controllers/main_controller.rb', line 18 def switch_ready(dp_id) install_rules(dp_id) @datapaths << dp_id @datapaths_off -= [dp_id] dp_name = "s#{dp_id}" logger.info "Datapath #{dp_name.bold} is #{'ONLINE'.bold.green}" rescue => e handle_exception(e) end |