Sha256: 2cafb4e54419af89ec5b2c903d8d51587be4d1d6b449427ea202b60529924a18
Contents?: true
Size: 1.76 KB
Versions: 4
Compression:
Stored size: 1.76 KB
Contents
require 'pio/open_flow' # Base module. module Pio # OpenFlow 1.0 messages module OpenFlow10 # OpenFlow 1.0 Port Status message class PortStatus < OpenFlow::Message # What changed about the physical port class Reason < BinData::Primitive REASONS = { add: 0, delete: 1, modify: 2 } uint8 :reason def get REASONS.invert.fetch(reason) end def set(value) self.reason = REASONS.fetch(value) end end # Message body of Port Status class Body < BinData::Record endian :big reason :reason uint56 :padding hide :padding phy_port :desc end # OpenFlow 1.0 Flow Mod message format. class Format < BinData::Record extend OpenFlow::Format header version: 1, message_type: 12 body :body def reason body.reason.to_sym end end attr_writer :datapath_id def desc @desc ||= @format.body.desc.snapshot @desc.instance_variable_set :@datapath_id, @datapath_id @desc end # rubocop:disable MethodLength def initialize(user_options = {}) header_options = parse_header_options(user_options) body_options = if user_options.respond_to?(:fetch) user_options.delete :transaction_id user_options.delete :xid dpid = user_options[:dpid] user_options[:datapath_id] = dpid if dpid user_options else '' end @format = Format.new(header: header_options, body: body_options) end # rubocop:enable MethodLength end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pio-0.25.0 | lib/pio/open_flow10/port_status.rb |
pio-0.24.2 | lib/pio/open_flow10/port_status.rb |
pio-0.24.1 | lib/pio/open_flow10/port_status.rb |
pio-0.24.0 | lib/pio/open_flow10/port_status.rb |