class Havox::Translator

Public Instance Methods

actions_to(syntax, actions_array, opts = {}) click to toggle source
# File lib/havox/classes/translator.rb, line 18
def actions_to(syntax, actions_array, opts = {})
  translation_module(syntax)::Actions.treat(actions_array, opts)
end
fields_to(syntax) click to toggle source
# File lib/havox/classes/translator.rb, line 10
def fields_to(syntax)
  translation_module(syntax)::Matches::FIELDS
end
matches_to(syntax, matches_array) click to toggle source
# File lib/havox/classes/translator.rb, line 14
def matches_to(syntax, matches_array)
  translation_module(syntax)::Matches.treat(matches_array)
end

Private Instance Methods

raise_unknown_translator(syntax) click to toggle source
# File lib/havox/classes/translator.rb, line 33
def raise_unknown_translator(syntax)
  raise Havox::UnknownTranslator, "Unknown translator '#{syntax}'"
end
translation_module(syntax) click to toggle source
# File lib/havox/classes/translator.rb, line 24
def translation_module(syntax)
  case syntax
  when :ovs       then Havox::OpenFlow10::OVS
  when :routeflow then Havox::OpenFlow10::RouteFlow
  when :trema     then Havox::OpenFlow10::Trema
  else raise_unknown_translator(syntax)
  end
end