module Havox::OpenFlow10::RouteFlow::Actions
Public Class Methods
treat(actions_array, opts = {})
click to toggle source
# File lib/havox/modules/openflow10/routeflow/actions.rb, line 7 def self.treat(actions_array, opts = {}) of_actions = [] actions_array.each do |obj| of_actions << case obj[:action] when 'Output' then basic_action(:output, obj[:arg_a].to_i) when 'Enqueue' then output_or_enqueue(obj, opts[:output]) when 'SetField' then basic_action_from_set_field(obj) else raise_unknown_action(obj) end end of_actions end
Private Class Methods
basic_action_from_set_field(obj)
click to toggle source
# File lib/havox/modules/openflow10/routeflow/actions.rb, line 23 def self.basic_action_from_set_field(obj) if obj[:arg_a].eql?('vlan') if obj[:arg_b].eql?('<none>') basic_action(:strip_vlan) # Inferred (vandervecken). else basic_action(:set_vlan_id, obj[:arg_b].to_i) # Inferred (vandervecken). end else raise_unknown_action(obj) end end
output_or_enqueue(obj, change_to_output)
click to toggle source
# File lib/havox/modules/openflow10/routeflow/actions.rb, line 35 def self.output_or_enqueue(obj, change_to_output) if change_to_output basic_action(:output, obj[:arg_a].to_i) else basic_action(:enqueue, obj[:arg_a].to_i, obj[:arg_b].to_i) # Inferred. end end