Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete SetVlanVid::Format class Using Pio::OpenFlow::Action. Refs #253
- Loading branch information
Showing
6 changed files
with
28 additions
and
22 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,18 +1,24 @@ | ||
require 'pio/open_flow/action' | ||
require 'pio/open_flow10/set_vlan' | ||
|
||
module Pio | ||
# An action to modify the VLAN ID of a packet. | ||
class SetVlanVid < SetVlan | ||
def_format :vlan_id, 1 | ||
module OpenFlow10 | ||
# An action to modify the VLAN ID of a packet. | ||
class SetVlanVid < OpenFlow::Action | ||
action_header action_type: 1, action_length: 8 | ||
uint16 :vlan_id | ||
string :padding, length: 2 | ||
hide :padding | ||
|
||
def initialize(number) | ||
vlan_id = number.to_i | ||
unless vlan_id >= 1 && vlan_id <= 4095 | ||
fail ArgumentError, 'VLAN ID must be between 1 and 4095 inclusive' | ||
def initialize(number) | ||
vlan_id = number.to_i | ||
unless vlan_id >= 1 && vlan_id <= 4095 | ||
fail ArgumentError, 'VLAN ID must be between 1 and 4095 inclusive' | ||
end | ||
super(vlan_id: vlan_id) | ||
rescue NoMethodError | ||
raise TypeError, 'VLAN ID must be an Integer.' | ||
end | ||
@format = Format.new(vlan_id: vlan_id) | ||
rescue NoMethodError | ||
raise TypeError, 'VLAN ID must be an Integer.' | ||
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