Module: Havox::OpenFlow10::RouteFlow::Matches

Extended by:
FieldParser
Defined in:
lib/havox/modules/openflow10/routeflow/matches.rb

Constant Summary collapse

FIELDS =
{
  'ethSrc'     => :ethernet_src, # Inferred.
  'ethDst'     => :ethernet,
  'ethTyp'     => :ethertype,
  'ipSrc'      => :ipv4_src,     # Inferred.
  'ipDst'      => :ipv4,
  'ipProto'    => :nw_proto,
  'nwProto'    => :nw_proto,
  'port'       => :in_port,      # Inferred.
  'switch'     => :dp_id,
  'tcpSrcPort' => :tp_src,
  'tcpDstPort' => :tp_dst,
  'vlanId'     => :vlan_id,      # Inferred (vandervecken).
  'vlanPcp'    => :vlan_pcp      # Inferred.
}

Class Method Summary collapse

Methods included from FieldParser

basic_action, parsed_ipv4, raise_unknown_action

Class Method Details

.treat(hash) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/havox/modules/openflow10/routeflow/matches.rb', line 30

def self.treat(hash)
  hash[:ethertype] = hash[:ethertype].to_i unless hash[:ethertype].nil?
  hash[:ipv4_src]  = parsed_ipv4(hash[:ipv4_src]) unless hash[:ipv4_src].nil?
  hash[:ipv4]      = parsed_ipv4(hash[:ipv4]) unless hash[:ipv4].nil?
  hash[:nw_proto]  = hash[:nw_proto].to_i unless hash[:nw_proto].nil?
  hash[:in_port]   = hash[:in_port].to_i unless hash[:in_port].nil?
  hash[:tp_src]    = hash[:tp_src].to_i unless hash[:tp_src].nil?
  hash[:tp_dst]    = hash[:tp_dst].to_i unless hash[:tp_dst].nil?
  hash[:vlan_id]   = hash[:vlan_id].to_i unless hash[:vlan_id].nil?
  hash
end