Class: Trema::SwitchDaemon

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/switch-daemon.rb

Constant Summary collapse

MANDATORY_QUEUES =
[ :port_status, :packet_in, :state_notify ]

Instance Method Summary collapse

Constructor Details

#initialize(queues) ⇒ SwitchDaemon

Creates a new abstract representation of SwitchDaemon instance by accepting and validating a hash of queue options.

Parameters:

  • queues (Hash)

    a hash of queue arguments to assign.

Options Hash (queues):

  • :port_status (Symbol)

    the controller(s) to receive port status messages.

  • :packet_in (Symbol)

    the controller(s) to receive packet_in messages.

  • :state_notify (Symbol)

    the controller(s) to receive state notification messages.



38
39
40
41
# File 'ruby/trema/switch-daemon.rb', line 38

def initialize queues
  check_mandatory_options queues
  @queues = queues
end

Instance Method Details

#optionsArray<String>

Constructs switch daemon’s options associating one or more controller name to a queue name.

Returns:

  • (Array<String>)

    the switch daemon’s options.



49
50
51
52
53
54
# File 'ruby/trema/switch-daemon.rb', line 49

def options
  all_queues = MANDATORY_QUEUES + [ :vendor ]
  all_queues.collect! do | each |
    queue each
  end.flatten!
end