Sha256: b3b243d9f8b0bdc1282a19567d0cf031355a14c49511b819fab9de0e8f2c882c

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

require 'pio/open_flow/message'
require 'pio/open_flow10/aggregate_stats/reply'
require 'pio/open_flow10/description_stats/reply'
require 'pio/open_flow10/flow_stats/reply'

module Pio
  module OpenFlow10
    class Stats
      # Stats reply parser.
      class Reply
        TYPES = {
          description: OpenFlow10::DescriptionStats::Reply,
          flow: OpenFlow10::FlowStats::Reply,
          aggregate: OpenFlow10::AggregateStats::Reply
        }

        # Stats reply format.
        class Format < OpenFlow::Message
          open_flow_header version: 1, message_type: 17, message_length: 10
          stats_type :stats_type
        end

        def self.read(binary)
          TYPES.fetch(Format.read(binary).stats_type.to_sym).read(binary)
        rescue KeyError
          raise "Unknown stats type: #{stats_type}"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pio-0.30.0 lib/pio/open_flow10/stats_reply.rb
pio-0.29.0 lib/pio/open_flow10/stats_reply.rb
pio-0.28.1 lib/pio/open_flow10/stats_reply.rb
pio-0.28.0 lib/pio/open_flow10/stats_reply.rb
pio-0.27.2 lib/pio/open_flow10/stats_reply.rb