module Havox::OpenFlow10::OVS::Actions

Public Class Methods

treat(actions_array, opts = {}) click to toggle source
# File lib/havox/modules/openflow10/ovs/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])
      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/ovs/actions.rb, line 23
def self.basic_action_from_set_field(obj)
  if obj[:arg_a].eql?('vlan')
    obj[:arg_b].eql?('<none>') ? basic_action(:strip_vlan) : basic_action(:mod_vlan_vid, obj[:arg_b])
  else
    raise_unknown_action(obj)
  end
end
output_or_enqueue(obj, change_to_output) click to toggle source
# File lib/havox/modules/openflow10/ovs/actions.rb, line 31
def self.output_or_enqueue(obj, change_to_output)
  if change_to_output
    basic_action(:output, obj[:arg_a])
  else
    basic_action(:enqueue, obj[:arg_a], obj[:arg_b])
  end
end