Class: Pio::OpenFlow10::Match::MatchIpAddress

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pio/open_flow10/match.rb

Overview

IP address

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



101
102
103
# File 'lib/pio/open_flow10/match.rb', line 101

def ==(other)
  get == other
end

#getObject



95
96
97
98
99
# File 'lib/pio/open_flow10/match.rb', line 95

def get
  ipaddr = octets.map { |each| format('%d', each) }.join('.')
  prefixlen = 32 - eval_parameter(:bitcount)
  IPv4Address.new(ipaddr + "/#{prefixlen}")
end

#set(value) ⇒ Object



91
92
93
# File 'lib/pio/open_flow10/match.rb', line 91

def set(value)
  self.octets = IPv4Address.new(value).to_a
end