-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
203 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,2 @@ | ||
require 'pio/open_flow' | ||
require 'pio/open_flow10/phy_port16' | ||
|
||
module Pio | ||
module OpenFlow10 | ||
# Features Request and Reply message. | ||
class Features | ||
# Features Request message. | ||
class Request < OpenFlow::Message | ||
# Features Request message format. | ||
class Format < BinData::Record | ||
extend OpenFlow::Format | ||
|
||
header version: 1, message_type: 5 | ||
string :body, value: '' | ||
|
||
def user_data | ||
body | ||
end | ||
end | ||
end | ||
|
||
# OpenFlow 1.0 Features Reply message. | ||
class Reply < OpenFlow::Message | ||
# Message body of features reply. | ||
class Body < BinData::Record | ||
extend OpenFlow::Flags | ||
|
||
# enum ofp_capabilities | ||
flags_32bit :capabilities, | ||
[:flow_stats, | ||
:table_stats, | ||
:port_stats, | ||
:stp, | ||
:reserved, | ||
:ip_reasm, | ||
:queue_stats, | ||
:arp_match_ip] | ||
|
||
# enum ofp_action_type | ||
flags_32bit :actions_flag, | ||
[:output, | ||
:set_vlan_vid, | ||
:set_vlan_pcp, | ||
:strip_vlan, | ||
:set_ether_source_address, | ||
:set_ether_destination_address, | ||
:set_ip_source_address, | ||
:set_ip_destination_address, | ||
:set_ip_tos, | ||
:set_transport_source_port, | ||
:set_transport_destination_port, | ||
:enqueue] | ||
|
||
endian :big | ||
|
||
datapath_id :datapath_id | ||
uint32 :n_buffers | ||
uint8 :n_tables | ||
uint24 :padding | ||
hide :padding | ||
capabilities :capabilities | ||
actions_flag :actions | ||
array :ports, type: :phy_port16, read_until: :eof | ||
|
||
def dpid | ||
datapath_id | ||
end | ||
|
||
def empty? | ||
false | ||
end | ||
|
||
def length | ||
24 + ports.to_binary_s.length | ||
end | ||
end | ||
|
||
# OpenFlow 1.0 Features Reply message | ||
class Format < BinData::Record | ||
extend OpenFlow::Format | ||
|
||
header version: 1, message_type: 6 | ||
body :body | ||
|
||
def ports | ||
body.snapshot.ports.map do |each| | ||
each.instance_variable_set :@datapath_id, datapath_id | ||
each | ||
end | ||
end | ||
|
||
def physical_ports | ||
ports.select do |each| | ||
each.port_no <= Port16::MAX | ||
end | ||
end | ||
end | ||
|
||
body_option :dpid | ||
body_option :datapath_id | ||
body_option :n_buffers | ||
body_option :n_tables | ||
body_option :capabilities | ||
body_option :actions | ||
body_option :ports | ||
end | ||
end | ||
end | ||
end | ||
require 'pio/open_flow10/features/reply' | ||
require 'pio/open_flow10/features/request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
require 'pio/open_flow' | ||
require 'pio/open_flow10/phy_port16' | ||
|
||
module Pio | ||
module OpenFlow10 | ||
# Features Request and Reply message. | ||
class Features | ||
# OpenFlow 1.0 Features Reply message. | ||
class Reply < OpenFlow::Message | ||
# Message body of features reply. | ||
class Body < BinData::Record | ||
extend OpenFlow::Flags | ||
|
||
# enum ofp_capabilities | ||
flags_32bit :capabilities, | ||
[:flow_stats, | ||
:table_stats, | ||
:port_stats, | ||
:stp, | ||
:reserved, | ||
:ip_reasm, | ||
:queue_stats, | ||
:arp_match_ip] | ||
|
||
# enum ofp_action_type | ||
flags_32bit :actions_flag, | ||
[:output, | ||
:set_vlan_vid, | ||
:set_vlan_pcp, | ||
:strip_vlan, | ||
:set_ether_source_address, | ||
:set_ether_destination_address, | ||
:set_ip_source_address, | ||
:set_ip_destination_address, | ||
:set_ip_tos, | ||
:set_transport_source_port, | ||
:set_transport_destination_port, | ||
:enqueue] | ||
|
||
endian :big | ||
|
||
datapath_id :datapath_id | ||
uint32 :n_buffers | ||
uint8 :n_tables | ||
uint24 :padding | ||
hide :padding | ||
capabilities :capabilities | ||
actions_flag :actions | ||
array :ports, type: :phy_port16, read_until: :eof | ||
|
||
def empty? | ||
false | ||
end | ||
|
||
def length | ||
24 + ports.to_binary_s.length | ||
end | ||
end | ||
|
||
# OpenFlow 1.0 Features Reply message | ||
class Format < BinData::Record | ||
extend OpenFlow::Format | ||
|
||
header version: 1, message_type: 6 | ||
body :body | ||
|
||
def ports | ||
body.snapshot.ports.map do |each| | ||
each.instance_variable_set :@datapath_id, datapath_id | ||
each | ||
end | ||
end | ||
|
||
def physical_ports | ||
ports.select do |each| | ||
each.port_no <= Port16::MAX | ||
end | ||
end | ||
|
||
def datapath_id | ||
body.datapath_id.to_i | ||
end | ||
alias_method :dpid, :datapath_id | ||
end | ||
|
||
body_option :dpid | ||
body_option :datapath_id | ||
body_option :n_buffers | ||
body_option :n_tables | ||
body_option :capabilities | ||
body_option :actions | ||
body_option :ports | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'pio/open_flow' | ||
|
||
module Pio | ||
module OpenFlow10 | ||
# Features Request and Reply message. | ||
class Features | ||
# Features Request message. | ||
class Request < OpenFlow::Message | ||
# Features Request message format. | ||
class Format < BinData::Record | ||
extend OpenFlow::Format | ||
|
||
header version: 1, message_type: 5 | ||
string :body, value: '' | ||
|
||
def user_data | ||
body | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'pio/open_flow13/features/reply' | ||
require 'pio/open_flow13/features/request' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'pio/open_flow' | ||
|
||
# Base module. | ||
module Pio | ||
# OpenFlow 1.3 messages | ||
module OpenFlow13 | ||
# Features Request and Reply message. | ||
class Features | ||
# Features Reply message. | ||
class Reply < OpenFlow::Message | ||
# Features Reply message body. | ||
class Body < BinData::Record | ||
extend OpenFlow::Flags | ||
|
||
flags_32bit(:capabilities, | ||
[:flow_stats, | ||
:table_stats, | ||
:port_stats, | ||
:group_stats, | ||
:NOT_USED, | ||
:ip_reasm, | ||
:queue_stats, | ||
:NOT_USED, | ||
:port_blocked]) | ||
|
||
endian :big | ||
|
||
datapath_id :datapath_id | ||
uint32 :n_buffers | ||
uint8 :n_tables | ||
uint8 :auxiliary_id | ||
uint16 :padding | ||
hide :padding | ||
capabilities :capabilities | ||
uint32 :reserved | ||
|
||
def length | ||
24 | ||
end | ||
end | ||
|
||
# Features Reply message format. | ||
class Format < BinData::Record | ||
extend OpenFlow::Format | ||
|
||
header version: 4, message_type: 6 | ||
body :body | ||
|
||
def datapath_id | ||
body.datapath_id.to_i | ||
end | ||
alias_method :dpid, :datapath_id | ||
end | ||
|
||
body_option :dpid | ||
body_option :datapath_id | ||
body_option :n_buffers | ||
body_option :n_tables | ||
body_option :capabilities | ||
end | ||
end | ||
end | ||
end |
File renamed without changes.
Oops, something went wrong.