Class: OpenFlow::Controller::Switch
- Inherits:
-
Object
- Object
- OpenFlow::Controller::Switch
- Includes:
- Protocol
- Defined in:
- lib/openflow-controller/switch.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#features_reply ⇒ Object
readonly
Returns the value of attribute features_reply.
Instance Method Summary collapse
- #datapath_id ⇒ Object
-
#initialize(controller, socket) ⇒ Switch
constructor
A new instance of Switch.
- #receive ⇒ Object
- #send(msg) ⇒ Object
Constructor Details
#initialize(controller, socket) ⇒ Switch
Returns a new instance of Switch.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/openflow-controller/switch.rb', line 10 def initialize(controller, socket) @controller = controller @socket = socket begin rescue => exception controller.logger.debug "Switch error: #{exception}." raise exception end end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
8 9 10 |
# File 'lib/openflow-controller/switch.rb', line 8 def controller @controller end |
#features_reply ⇒ Object (readonly)
Returns the value of attribute features_reply.
8 9 10 |
# File 'lib/openflow-controller/switch.rb', line 8 def features_reply @features_reply end |
Instance Method Details
#datapath_id ⇒ Object
31 32 33 |
# File 'lib/openflow-controller/switch.rb', line 31 def datapath_id @features_reply.datapath_id end |
#receive ⇒ Object
27 28 29 |
# File 'lib/openflow-controller/switch.rb', line 27 def receive Parser.read @socket end |
#send(msg) ⇒ Object
23 24 25 |
# File 'lib/openflow-controller/switch.rb', line 23 def send(msg) @socket.write msg.to_binary_s end |