Class: Dcmgr::NodeModules::OpenFlowForwardingDatabase

Inherits:
Object
  • Object
show all
Defined in:
lib/dcmgr/node_modules/openflow_controller.rb

Instance Method Summary collapse

Constructor Details

#initializeOpenFlowForwardingDatabase

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