rubybvc 0.3.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/controller/controller.rb +189 -3
  3. data/lib/controller/netconf_node.rb +27 -3
  4. data/lib/controller/node.rb +7 -0
  5. data/lib/controller/openflow_node.rb +3 -1
  6. data/lib/netconfdev/vrouter/firewall.rb +6 -1
  7. data/lib/netconfdev/vrouter/rule.rb +16 -3
  8. data/lib/netconfdev/vrouter/rules.rb +18 -2
  9. data/lib/netconfdev/vrouter/vrouter5600.rb +123 -16
  10. data/lib/openflowdev/action_output.rb +37 -3
  11. data/lib/openflowdev/actions/action.rb +1 -0
  12. data/lib/openflowdev/actions/copy_ttl_inwards_action.rb +4 -0
  13. data/lib/openflowdev/actions/copy_ttl_outwards_action.rb +4 -0
  14. data/lib/openflowdev/actions/dec_mpls_ttl_action.rb +4 -0
  15. data/lib/openflowdev/actions/dec_nw_ttl_action.rb +4 -0
  16. data/lib/openflowdev/actions/drop_action.rb +1 -0
  17. data/lib/openflowdev/actions/flood_action.rb +4 -0
  18. data/lib/openflowdev/actions/flood_all_action.rb +4 -0
  19. data/lib/openflowdev/actions/group_action.rb +7 -1
  20. data/lib/openflowdev/actions/hw_path_action.rb +3 -0
  21. data/lib/openflowdev/actions/loopback_action.rb +5 -1
  22. data/lib/openflowdev/actions/output_action.rb +10 -1
  23. data/lib/openflowdev/actions/pop_mpls_header_action.rb +6 -1
  24. data/lib/openflowdev/actions/pop_pbb_header_action.rb +5 -1
  25. data/lib/openflowdev/actions/pop_vlan_header_action.rb +5 -1
  26. data/lib/openflowdev/actions/push_mpls_header_action.rb +6 -1
  27. data/lib/openflowdev/actions/push_pbb_header_action.rb +6 -1
  28. data/lib/openflowdev/actions/push_vlan_header_action.rb +11 -1
  29. data/lib/openflowdev/actions/set_dl_dst_action.rb +6 -1
  30. data/lib/openflowdev/actions/set_dl_src_action.rb +6 -1
  31. data/lib/openflowdev/actions/set_field_action.rb +7 -1
  32. data/lib/openflowdev/actions/set_mpls_ttl_action.rb +6 -1
  33. data/lib/openflowdev/actions/set_nw_dst_action.rb +6 -1
  34. data/lib/openflowdev/actions/set_nw_src_action.rb +6 -1
  35. data/lib/openflowdev/actions/set_nw_ttl_action.rb +6 -1
  36. data/lib/openflowdev/actions/set_queue_action.rb +7 -1
  37. data/lib/openflowdev/actions/set_tp_dst_action.rb +6 -1
  38. data/lib/openflowdev/actions/set_tp_src_action.rb +6 -1
  39. data/lib/openflowdev/actions/set_vlan_cfi_action.rb +6 -1
  40. data/lib/openflowdev/actions/set_vlan_id_action.rb +6 -1
  41. data/lib/openflowdev/actions/set_vlan_pcp_action.rb +6 -1
  42. data/lib/openflowdev/actions/strip_vlan_action.rb +2 -1
  43. data/lib/openflowdev/actions/sw_path_action.rb +5 -1
  44. data/lib/openflowdev/flow_entry.rb +86 -6
  45. data/lib/openflowdev/instruction.rb +12 -1
  46. data/lib/openflowdev/match.rb +119 -9
  47. data/lib/openflowdev/of_switch.rb +94 -3
  48. data/lib/utils/hash_with_compact.rb +1 -1
  49. data/lib/utils/netconf_response.rb +9 -1
  50. data/lib/utils/netconf_response_status.rb +1 -0
  51. data/lib/utils/rest_agent.rb +1 -1
  52. data/lib/utils/utilities.rb +2 -2
  53. metadata +2 -2
@@ -28,14 +28,20 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class to define OpenFlow action to set a field.
31
32
  class SetFieldAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +vlan_id+:: integer : VLAN identifier to set.
37
+ # * +mpls_label+:: integer : MPLS label to set.
32
38
  def initialize(order: 0, vlan_id: nil, mpls_label: nil)
33
39
  super(order: order)
34
40
  @vlan_id = vlan_id
35
41
  @mpls_label = mpls_label
36
42
  end
37
43
 
38
- def to_hash
44
+ def to_hash #:nodoc:
39
45
  {:order => @order, 'set-field' => {'vlan-match' => {'vlan-id' =>
40
46
  {'vlan-id' => @vlan_id, 'vlan-id-present' => !@vlan_id.nil?}},
41
47
  'protocol-match-fields' => {'mpls-label' => @mpls_label}}}
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class to define an OpenFlow action to set the MPLS Time To Live (TTL)
31
32
  class SetMplsTTLAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +mpls_ttl+:: integer : The Time To Live to set in the MPLS header.
32
37
  def initialize(order: 0, mpls_ttl: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "MPLS TTL (mpls_ttl) required" unless mpls_ttl
35
40
  @mpls_ttl = mpls_ttl
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => order, 'set-mpls-ttl-action' => {'mpls-ttl' => @mpls_ttl}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class to define OpenFlow action to set the destination IP (network layer) address
31
32
  class SetNwDstAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +ip_addr+:: string : The destination IP address to set.
32
37
  def initialize(order: nil, ip_addr: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "IP Address (ip_addr) required" unless ip_addr
35
40
  @ip = ip_addr
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-nw-dst-action' => {:address => @ip}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action for setting the Source IP address (network layer)
31
32
  class SetNwSrcAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +ip_addr+:: string : The IP address to set in source IP
32
37
  def initialize(order: nil, ip_addr: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "IP Address (ip_addr) required" unless ip_addr
35
40
  @ip = ip_addr
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-nw-src-action' => {:address => @ip}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to set IP header Time To Live (network layer)
31
32
  class SetNwTTLAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +ip_ttl+:: integer : The Time To Live to set in the IP header.
32
37
  def initialize(order: 0, ip_ttl: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "IP TTL (ip_ttl) required" unless ip_ttl
35
40
  @ip_ttl = ip_ttl
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-nw-ttl-action' => {'nw-ttl' => @ip_ttl}}
40
45
  end
41
46
  end
@@ -28,7 +28,13 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class to define OpenFlow action to set the queue for the packet
31
32
  class SetQueueAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +queue+::
37
+ # * +queue_id+:: integer : ID of the queue onto which the packet is to be queued.
32
38
  def initialize(order: nil, queue: nil, queue_id: nil)
33
39
  super(order: order)
34
40
  raise ArgumentError, "Queue (queue) required" unless queue
@@ -37,7 +43,7 @@ class SetQueueAction < Action
37
43
  @queue_id = queue
38
44
  end
39
45
 
40
- def to_hash
46
+ def to_hash #:nodoc:
41
47
  {:order => @order, 'queue-action' => {:queue => @queue,
42
48
  'queue-id' => @queue_id}}
43
49
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to set the TCP Destination port
31
32
  class SetTpDstAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +port+:: integer : The destination TCP port to set.
32
37
  def initialize(order: nil, port: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "Port (port) required" unless port
35
40
  @port = port
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => order, 'set-tp-dst-action' => {:port => @port}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to set TCP Source Port
31
32
  class SetTpSrcAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +port+:: integer : The port number to set for TCP source port.
32
37
  def initialize(order: nil, port: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "Port (port) required" unless port
35
40
  @port = port
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => order, 'set-tp-src-action' => {:port => @port}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to set the CFI field of VLAN header
31
32
  class SetVlanCfiAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +vlan_cfi+:: integer : The CFI field value to set.
32
37
  def initialize(order: nil, vlan_cfi: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "VLAN CFI (vlan_cfi) required" unless vlan_cfi
35
40
  @vlan_cfi = vlan_cfi
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-vlan-cfi-action' => {'vlan-cfi' => @vlan_cfi}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class to define OpenFlow action that will set the VLAN identifier in VLAN header
31
32
  class SetVlanIdAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +vlan_id+:: integer : The VLAN identifier to set in VLAN header.
32
37
  def initialize(order: nil, vlan_id: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "VLAN ID (vlan_id) required" unless vlan_id
35
40
  @vlan_id = vlan_id
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-vlan-id-action' => {'vlan-id' => @vlan_id}}
40
45
  end
41
46
  end
@@ -28,14 +28,19 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to set the PCP field in VLAN header
31
32
  class SetVlanPCPAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +vlan_pcp+:: integer : The valoue to set in the PCP field in VLAN header.
32
37
  def initialize(order: nil, vlan_pcp: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "VLAN PCP (vlan_pcp) required" unless vlan_pcp
35
40
  @vlan_pcp = vlan_pcp
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-vlan-pcp-action' => {'vlan-pcp' => @vlan_pcp}}
40
45
  end
41
46
  end
@@ -28,8 +28,9 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ #Class used to define OpenFlow action to strip the VLAN header.
31
32
  class StripVlanAction < Action
32
- def to_hash
33
+ def to_hash #:nodoc:
33
34
  {:order => @order, 'strip-vlan-action' => {}}
34
35
  end
35
36
  end
@@ -28,12 +28,16 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+
31
32
  class SwPathAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
32
36
  def initialize(order: 0)
33
37
  super(order: order)
34
38
  end
35
39
 
36
- def to_hash
40
+ def to_hash #:nodoc:
37
41
  {:order => @order, 'sw-path-action' => {}}
38
42
  end
39
43
  end
@@ -28,14 +28,84 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ # Class for creating and interacting with OpenFlow flows
31
32
  class FlowEntry
32
33
  require 'openflowdev/instruction'
33
34
  require 'openflowdev/match'
34
35
 
35
- attr_reader :table_id, :id, :priority, :idle_timeout, :hard_timeout, :strict,
36
- :install_hw, :barrier, :cookie, :cookie_mask, :name, :instructions, :match,
37
- :out_port, :out_group, :flags, :buffer_id
38
-
36
+ # string: ID of the table to put the flow in
37
+ attr_reader :table_id
38
+ # integer: Unique identifier of this FlowEntry in the Controller's data store
39
+ attr_reader :id
40
+ # integer: Priority level of flow entry
41
+ attr_reader :priority
42
+ # integer: Idle time before discarding (seconds)
43
+ attr_reader :idle_timeout
44
+ # integer: Max time before discarding (seconds)
45
+ attr_reader :hard_timeout
46
+ # boolean: Modify/Delete entry strictly matching wildcards and priority
47
+ attr_reader :strict
48
+ # internal Controller's inventory attribute
49
+ attr_reader :install_hw
50
+ # boolean: Boolean flag used to enforce OpenFlow switch to do ordered message processing.
51
+ # Barrier request/reply messages are used by the controller to ensure message dependencies
52
+ # have been met or to receive notifications for completed operations. When the controller
53
+ # wants to ensure message dependencies have been met or wants to receive notifications for
54
+ # completed operations, it may use an OFPT_BARRIER_REQUEST message. This message has no body.
55
+ # Upon receipt, the switch must finish processing all previously-received messages, including
56
+ # sending corresponding reply or error messages, before executing any messages beyond the
57
+ # Barrier Request.
58
+ attr_reader :barrier
59
+ # integer: Opaque Controller-issued identifier
60
+ attr_reader :cookie
61
+ # integer: Mask used to restrict the cookie bits that must match when the command is
62
+ # OFPFC_MODIFY* or OFPFC_DELETE*. A value of 0 indicates no restriction
63
+ attr_reader :cookie_mask
64
+ # string: FlowEntry name in the FlowTable (internal Controller's inventory attribute)
65
+ attr_reader :name
66
+ # list of Instruction: Instructions to be executed when a flow matches this entry flow match fields
67
+ attr_reader :instructions
68
+ # Match: Flow match fields
69
+ attr_reader :match
70
+ # integer: For delete commands, require matching entries to include this as an
71
+ # output port. A value of OFPP_ANY indicates no restriction.
72
+ attr_reader :out_port
73
+ # integer: For delete commands, require matching entries to include this as an
74
+ # output group. A value of OFPG_ANY indicates no restriction
75
+ attr_reader :out_group
76
+ # integer: Bitmap of OpenFlow flags (OFPFF_* from OpenFlow spec)
77
+ attr_reader :flags
78
+ # Buffered packet to apply to, or OFP_NO_BUFFER. Not meaningful for delete
79
+ attr_reader :buffer_id
80
+
81
+ # _Parameters_
82
+ # * +flow_table_id+:: string: ID of the table to put the flow in
83
+ # * +flow_id+:: integer: Unique identifier of this FlowEntry in the Controller's data store
84
+ # * +flow_priority+:: integer: Priority level of flow entry
85
+ # * +name+:: string: FlowEntry name in the FlowTable (internal Controller's inventory attribute)
86
+ # * +idle_timeout+:: integer: Idle time before discarding (seconds)
87
+ # * +hard_timeout+:: integer: Max time before discarding (seconds)
88
+ # * +strict+:: boolean: Modify/Delete entry strictly matching wildcards and priority
89
+ # * +install_hw+:: internal Controller's inventory attribute
90
+ # * +barrier+:: boolean: Boolean flag used to enforce OpenFlow switch to do ordered message processing.
91
+ # Barrier request/reply messages are used by the controller to ensure message dependencies
92
+ # have been met or to receive notifications for completed operations. When the controller
93
+ # wants to ensure message dependencies have been met or wants to receive notifications for
94
+ # completed operations, it may use an OFPT_BARRIER_REQUEST message. This message has no body.
95
+ # Upon receipt, the switch must finish processing all previously-received messages, including
96
+ # sending corresponding reply or error messages, before executing any messages beyond the
97
+ # Barrier Request.
98
+ # * +cookie+:: integer: Opaque Controller-issued identifier
99
+ # * +cookie_mask+:: integer: Mask used to restrict the cookie bits that must match when the command is
100
+ # OFPFC_MODIFY* or OFPFC_DELETE*. A value of 0 indicates no restriction
101
+ # * +out_port+:: integer: For delete commands, require matching entries to include this as an
102
+ # output port. A value of OFPP_ANY indicates no restriction.
103
+ # * +out_group+:: integer: For delete commands, require matching entries to include this as an
104
+ # output group. A value of OFPG_ANY indicates no restriction
105
+ # * +flags+:: integer: Bitmap of OpenFlow flags (OFPFF_* from OpenFlow spec)
106
+ # * +buffer_id+:: Buffered packet to apply to, or OFP_NO_BUFFER. Not meaningful for delete
107
+
108
+
39
109
  def initialize(flow_table_id: 0, flow_id: nil, flow_priority: nil, name: nil,
40
110
  idle_timeout: 0, hard_timeout: 0, strict: false, install_hw: false,
41
111
  barrier: false, cookie: nil, cookie_mask: nil, out_port: nil,
@@ -61,17 +131,27 @@ class FlowEntry
61
131
  @buffer_id = buffer_id
62
132
  end
63
133
 
134
+ ##
135
+ # Add an Instruction to the flow entry.
136
+ #
137
+ # _Parameters_
138
+ # * +instruction+:: Instruction : Instruction to add to the flow entry.
64
139
  def add_instruction(instruction)
65
140
  raise ArgumentError, "Instruction must be of type 'Instruction'" unless instruction.is_a?(Instruction)
66
141
  @instructions << instruction
67
142
  end
68
-
143
+
144
+ ##
145
+ # Add a match rule to the flow entry.
146
+ #
147
+ # _Parameters_
148
+ # * +match+:: Match : Match to add to the flow entry.
69
149
  def add_match(match)
70
150
  raise ArgumentError, "Match must be of type 'Match'" unless match.is_a?(Match)
71
151
  @match = match
72
152
  end
73
153
 
74
- def to_hash
154
+ def to_hash #:nodoc:
75
155
  instructions_hash = []
76
156
  @instructions.each do |instruction|
77
157
  instructions_hash << instruction.to_hash
@@ -28,22 +28,33 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ # Class representing OpenFlow flow instruction
31
32
  class Instruction
33
+ # integer : order that action is to be carried out relative to other instructions.
32
34
  attr_accessor :order
35
+ # Action : list of Action
33
36
  attr_reader :actions
34
37
 
38
+ ##
39
+ # _Parameters_
40
+ # * +instruction_order+:: Order in which to carry out this instruction relative to other instructions.
35
41
  def initialize(instruction_order: nil)
36
42
  raise ArgumentError, "Instruction Order (instruction_order) required" unless instruction_order
37
43
  @order = instruction_order
38
44
  @actions = []
39
45
  end
40
46
 
47
+ ##
48
+ # Add action to an Instruction.
49
+ #
50
+ # _Parameters_
51
+ # * +action+:: Action : What action to take
41
52
  def add_apply_action(action)
42
53
  raise ArgumentError, "Action must be a subclass of 'Action'" unless action.is_a?(Action)
43
54
  @actions << action
44
55
  end
45
56
 
46
- def to_hash
57
+ def to_hash #:nodoc:
47
58
  actions_hash = []
48
59
  @actions.each do |action|
49
60
  actions_hash << action.to_hash
@@ -28,16 +28,126 @@
28
28
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
+ # Class that represents OpenFlow flow matching attributes
31
32
  class Match
32
33
  require 'utils/hash_with_compact'
33
- attr_reader :eth_type, :ipv4_dst, :ipv4_src, :ipv6_src, :ipv6_dst,
34
- :ipv6_flabel, :ipv6_ext_hdr, :ethernet_dst, :ethernet_src, :in_phy_port,
35
- :in_port, :ip_proto, :ip_dscp, :ip_ecn, :tcp_src_port, :tcp_dst_port,
36
- :udp_src_port, :udp_dst_port, :icmpv4_type, :icmpv4_code, :icmpv6_type,
37
- :icmpv6_code, :arp_op_code, :arp_src_ipv4, :arp_tgt_ipv4, :arp_src_hw_addr,
38
- :arp_tgt_hw_addr, :vlan_id, :vlan_pcp, :sctp_dst, :sctp_src, :mpls_label,
39
- :mpls_tc, :mpls_bos, :tunnel_id, :metadata, :metadata_mask
40
-
34
+
35
+ # integer : Ethernet type
36
+ attr_reader :eth_type
37
+ # string : IPv4 Destination IP address
38
+ attr_reader :ipv4_dst
39
+ # string : IPv4 Source IP address
40
+ attr_reader :ipv4_src
41
+ # string : IPv6 Source IP address
42
+ attr_reader :ipv6_src
43
+ # string : IPv6 Destination IP address
44
+ attr_reader :ipv6_dst
45
+ # string : IPv6 Flow Label
46
+ attr_reader :ipv6_flabel
47
+ # integer : IPv6 Extension header
48
+ attr_reader :ipv6_ext_hdr
49
+ # string : Ethernet Destination address e.g. "00:11:22:33:44:55"
50
+ attr_reader :ethernet_dst
51
+ # string : Ethernet Source address e.g. "00:11:22:33:44:55"
52
+ attr_reader :ethernet_src
53
+ # integer : Input physical port - not used for matches
54
+ attr_reader :in_phy_port
55
+ # integer : Input port
56
+ attr_reader :in_port
57
+ # integer : Ip protocol
58
+ attr_reader :ip_proto
59
+ # integer : Differentiated Services Code Point
60
+ attr_reader :ip_dscp
61
+ # integer : Explicit Congestion Notificaiton
62
+ attr_reader :ip_ecn
63
+ # integer : TCP Source port number
64
+ attr_reader :tcp_src_port
65
+ # integer : TCP Destination port number
66
+ attr_reader :tcp_dst_port
67
+ # integer : UDP Source port number
68
+ attr_reader :udp_src_port
69
+ # integer : UDP Destination port number
70
+ attr_reader :udp_dst_port
71
+ # integer : ICMPv4 type
72
+ attr_reader :icmpv4_type
73
+ # integer : ICMPv4 code
74
+ attr_reader :icmpv4_code
75
+ # integer : ICMPv6 type
76
+ attr_reader :icmpv6_type
77
+ # integer : ICMPv6 code
78
+ attr_reader :icmpv6_code
79
+ # integer : ARP opcode
80
+ attr_reader :arp_op_code
81
+ # string : ARP source IPv4 address. e.g. "111.222.333.444"
82
+ attr_reader :arp_src_ipv4
83
+ # string : ARP target IPv4 address. e.g. "111.222.333.444"
84
+ attr_reader :arp_tgt_ipv4
85
+ # string : ARP source hardware address. e.g. "111.222.333.444"
86
+ attr_reader :arp_src_hw_addr
87
+ # string : ARP target hardware address. e.g. "111.222.333.444"
88
+ attr_reader :arp_tgt_hw_addr
89
+ # integer: VLAN identifier
90
+ attr_reader :vlan_id
91
+ # integer: VLAN priority code point
92
+ attr_reader :vlan_pcp
93
+ # integer : Stream control transmission protocol destination port
94
+ attr_reader :sctp_dst
95
+ # integer : Stream control transmission protocol source port
96
+ attr_reader :sctp_src
97
+ # integer : Multiprotocol Label Switching label
98
+ attr_reader :mpls_label
99
+ # integer : Multiprotocol Label Switching traffic class
100
+ attr_reader :mpls_tc
101
+ # integer : Multiprotocol Label Switching bottom of stack flag
102
+ attr_reader :mpls_bos
103
+ # integer : tunnel identifier
104
+ attr_reader :tunnel_id
105
+ # integer : Openflow intra-table metadata
106
+ attr_reader :metadata
107
+ # integer : Openflow intra-table metadata mask
108
+ attr_reader :metadata_mask
109
+
110
+
111
+
112
+ # _Parameters_
113
+ # * +eth_type+:: integer : Ethernet type
114
+ # * +ipv4_destination+:: string : IPv4 Destination IP address
115
+ # * +ipv4_source+:: string : IPv4 Source IP address
116
+ # * +ipv6_source+:: string : IPv6 Source IP address
117
+ # * +ipv6_destination+:: string : IPv6 Destination IP address
118
+ # * +ipv6_flabel+:: string : IPv6 Flow Label
119
+ # * +ipv6_ext_header+:: integer : IPv6 Extension header
120
+ # * +ethernet_destination+:: string : Ethernet Destination address e.g. "00:11:22:33:44:55"
121
+ # * +ethernet_source+:: string : Ethernet Source address e.g. "00:11:22:33:44:55"
122
+ # * +in_physical_port+:: integer : Input physical port - not used for matches
123
+ # * +in_port+:: integer : Input port
124
+ # * +ip_protocol_num+:: integer : Ip protocol
125
+ # * +ip_dscp+:: integer : Differentiated Services Code Point
126
+ # * +ip_ecn+:: integer : Explicit Congestion Notificaiton
127
+ # * +tcp_source_port+:: integer : TCP Source port number
128
+ # * +tcp_destination_port+:: integer : TCP Destination port number
129
+ # * +udp_source_port+:: integer : UDP Source port number
130
+ # * +udp_destination_port+:: integer : UDP Destination port number
131
+ # * +icmpv4_type+:: integer : ICMPv4 type
132
+ # * +icmpv4_code+:: integer : ICMPv4 code
133
+ # * +icmpv6_type+:: integer : ICMPv6 type
134
+ # * +icmpv6_code+:: integer : ICMPv6 code
135
+ # * +arp_op_code+:: integer : ARP opcode
136
+ # * +arp_source_ipv4+:: string : ARP source IPv4 address. e.g. "111.222.333.444"
137
+ # * +arp_target_ipv4+:: string : ARP target IPv4 address. e.g. "111.222.333.444"
138
+ # * +arp_source_hardware_address+:: string : ARP source hardware address. e.g. "111.222.333.444"
139
+ # * +arp_target_hardware_address+:: string : ARP target hardware address. e.g. "111.222.333.444"
140
+ # * +vlan_id+:: integer: VLAN identifier
141
+ # * +vlan_pcp+:: integer: VLAN priority code point
142
+ # * +sctp_destination+:: integer : Stream control transmission protocol destination port
143
+ # * +sctp_source+:: integer : Stream control transmission protocol source port
144
+ # * +mpls_label+:: integer : Multiprotocol Label Switching label
145
+ # * +mpls_tc+:: integer : Multiprotocol Label Switching traffic class
146
+ # * +mpls_bos+:: integer : Multiprotocol Label Switching bottom of stack flag
147
+ # * +tunnel_id+:: integer : tunnel identifier
148
+ # * +metadata+:: integer : Openflow intra-table metadata
149
+ # * +metadata_mask+:: integer : Openflow intra-table metadata mask
150
+
41
151
  def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,
42
152
  ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,
43
153
  ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,
@@ -89,7 +199,7 @@ class Match
89
199
  @metadata_mask = metadata_mask
90
200
  end
91
201
 
92
- def to_hash
202
+ def to_hash #:nodoc:
93
203
  hash = {'ethernet-match' => {'ethernet-type' => {:type => @eth_type},
94
204
  'ethernet-destination' => {:address => @ethernet_dst},
95
205
  'ethernet-source' => {:address => @ethernet_src}},