lib/pio/open_flow.rb in pio-0.25.0 vs lib/pio/open_flow.rb in pio-0.26.0

- old
+ new

@@ -1,12 +1,11 @@ require 'pio/open_flow/datapath_id' +require 'pio/open_flow/error' require 'pio/open_flow/flags' require 'pio/open_flow/format' require 'pio/open_flow/message' require 'pio/open_flow/open_flow_header' -require 'pio/open_flow/phy_port' -require 'pio/open_flow/port_number' require 'pio/open_flow10' require 'pio/open_flow13' module Pio # Common OpenFlow modules/classes. @@ -17,34 +16,35 @@ end def self.switch_version(version) [:Barrier, :Echo, :Features, :FlowMod, :Hello, :Match, :PacketIn, :PacketOut, :SendOutPort, :PortStatus, - :FlowStats].each do |each| + :FlowStats, :Error].each do |each| set_message_class_name each, version @version = version.to_s end end # rubocop:disable MethodLength def self.read(binary) parser = { 0 => Pio::Hello, + 1 => Pio::OpenFlow::Error, 2 => Pio::Echo::Request, 3 => Pio::Echo::Reply, 5 => Pio::Features::Request, 6 => Pio::Features::Reply, 10 => Pio::PacketIn, 12 => Pio::PortStatus, + 13 => Pio::PacketOut, + 14 => Pio::FlowMod, 16 => Pio::FlowStats::Request, 17 => Pio::FlowStats::Reply, 18 => Pio::Barrier::Request, 19 => Pio::Barrier::Reply } header = OpenFlowHeaderParser.read(binary) parser.fetch(header.message_type).read(binary) - rescue - raise "Unknown message type #{header.message_type}" end # rubocop:enable MethodLength def self.set_message_class_name(klass_name, version) open_flow_module = Pio.const_get(version)