Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions features/open_flow10/port_mod.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@open_flow10
Feature: FlowMod
Scenario: new
When I create an OpenFlow message with:
"""
Pio::PortMod.new(
port_no: 1,
mac_address: '11:22:33:44:55:66',
config: [],
mask: [:port_down],
advertised: []
)
"""
Then the message has the following fields and values:
| field | value |
| port_no | 1 |
| mac_address | 11:22:33:44:55:66 |
| config | [] |
| mask | [:port_down] |
| advertised | [] |

Scenario: read
When I parse a file named "open_flow10/port_mod.raw" with "PortMod" class
Then the packet has the following fields and values:
| field | value |
| port_no | 1 |
| mac_address | 11:22:33:44:55:66 |
| config | [:port_down] |
| mask | [:port_down] |
| advertised | [] |
1 change: 1 addition & 0 deletions lib/pio/open_flow10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
require 'pio/open_flow10/stats_reply'
require 'pio/open_flow10/stats_request'
require 'pio/open_flow10/table_stats/request'
require 'pio/open_flow10/port_mod'

# Actions
require 'pio/open_flow/nicira_resubmit'
Expand Down
46 changes: 46 additions & 0 deletions lib/pio/open_flow10/port_mod.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'pio/open_flow'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing frozen string literal comment.

require 'pio/open_flow/flags'
require 'pio/type/mac_address'

module Pio
module OpenFlow10
# OpenFlow 1.0 Port Mod Message
class PortMod < OpenFlow::Message
open_flow_header version: 1, type: 15, length: 32

uint16 :port_no
mac_address :mac_address
flags_32bit :config,
[:port_down,
:no_stp,
:no_receive,
:no_receive_stp,
:no_flood,
:no_forward,
:no_packet_in]
flags_32bit :mask,
[:port_down,
:no_stp,
:no_receive,
:no_receive_stp,
:no_flood,
:no_forward,
:no_packet_in]
flags_32bit :advertised,
[:port_10mb_hd,
:port_10mb_fd,
:port_100mb_hd,
:port_100mb_fd,
:port_1gb_hd,
:port_1gb_fd,
:port_10gb_fd,
:port_copper,
:port_fiber,
:port_autoneg,
:port_pause,
:port_pause_asym]
string :_pad, length: 4
hide :_pad
end
end
end