Class: Dcmgr::NodeModules::OpenFlowForwardingDatabase
- Inherits:
-
Object
- Object
- Dcmgr::NodeModules::OpenFlowForwardingDatabase
- Defined in:
- lib/dcmgr/node_modules/openflow_controller.rb
Instance Method Summary collapse
-
#initialize ⇒ OpenFlowForwardingDatabase
constructor
A new instance of OpenFlowForwardingDatabase.
- #learn(mac, port_no) ⇒ Object
- #port_no_of(mac) ⇒ Object
Constructor Details
#initialize ⇒ OpenFlowForwardingDatabase
Returns a new instance of OpenFlowForwardingDatabase.
701 702 703 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 701 def initialize @db = {} end |
Instance Method Details
#learn(mac, port_no) ⇒ Object
715 716 717 718 719 720 721 722 723 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 715 def learn mac, port_no entry = @db[mac] if entry entry.update port_no else @db[new_entry.mac] = ForwardingEntry.new(mac, port_no) end end |
#port_no_of(mac) ⇒ Object
705 706 707 708 709 710 711 712 713 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 705 def port_no_of mac dest = @db[mac] if dest dest.port_no else nil end end |