rubybvc 0.3.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,23 +28,44 @@
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
+ ##
32
+ # Class that represents a VRouter 5600 device.
33
+ #
31
34
  class VRouter5600 < NetconfNode
32
35
  require 'netconfdev/vrouter/firewall'
33
36
  require 'netconfdev/vrouter/rules'
34
37
  require 'netconfdev/vrouter/rule'
35
38
  require 'netconfdev/vrouter/dataplane_firewall'
36
39
 
40
+ ##
41
+ # Return a list of YANG schemas for this VRouter5600.
42
+ #
43
+ # _Return_ _Value_
44
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of YANG schemas for the node.
37
45
  def get_schemas
38
46
  @controller.get_schemas(@name)
39
47
  end
40
-
48
+
49
+ ##
50
+ # Return a YANG schema for the indicated schema on the VRouter5600.
51
+ #
52
+ # _Parameters_
53
+ # * +id+:: String : Identifier for schema
54
+ # * +version+:: String : Version/date for schema
55
+ # _Return_ _Value_
56
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and YANG schema.
41
57
  def get_schema(id: nil, version: nil)
42
58
  raise ArgumentError, "Identifier (id) required" unless id
43
59
  raise ArgumentError, "Version (version) required" unless version
44
60
 
45
61
  @controller.get_schema(@name, id: id, version: version)
46
62
  end
47
-
63
+
64
+ ##
65
+ # Return configuration of the VRouter5600.
66
+ #
67
+ # _Return_ _Value_
68
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration of VRouter5600.
48
69
  def get_cfg
49
70
  get_uri = @controller.get_ext_mount_config_uri(self)
50
71
  response = @controller.rest_agent.get_request(get_uri)
@@ -52,7 +73,12 @@ class VRouter5600 < NetconfNode
52
73
  NetconfResponse.new(NetconfResponseStatus::OK, body)
53
74
  end
54
75
  end
55
-
76
+
77
+ ##
78
+ # Return firewall configuration of the VRouter5600.
79
+ #
80
+ # _Return_ _Value_
81
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and Firewall configuration JSON.
56
82
  def get_firewalls_cfg
57
83
  get_uri = "#{@controller.get_ext_mount_config_uri(self)}/"\
58
84
  "vyatta-security:security/vyatta-security-firewall:firewall"
@@ -61,7 +87,14 @@ class VRouter5600 < NetconfNode
61
87
  NetconfResponse.new(NetconfResponseStatus::OK, body)
62
88
  end
63
89
  end
64
-
90
+
91
+ ##
92
+ # Return configuration for a specific firewall on the VRouter5600.
93
+ #
94
+ # _Parameters_
95
+ # * +firewall_or_name+:: Firewall or String : A Firewall object or name of firewall for which you want the configuration.
96
+ # _Return_ _Value_
97
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration of requested firewall.
65
98
  def get_firewall_instance_cfg(firewall_or_name)
66
99
  firewall_name = firewall_or_name.is_a?(Firewall) ? firewall_or_name.rules.name :
67
100
  firewall_or_name
@@ -73,7 +106,14 @@ class VRouter5600 < NetconfNode
73
106
  NetconfResponse.new(NetconfResponseStatus::OK, body)
74
107
  end
75
108
  end
76
-
109
+
110
+ ##
111
+ # Create a firewall on the VRouter5600.
112
+ #
113
+ # _Parameters_
114
+ # * +firewall+:: Firewall : firewall object describing the firewall to be created.
115
+ # _Return_ _Value_
116
+ # * NetconfResponse : Status ( NetconfResponseStatus ).
77
117
  def create_firewall_instance(firewall)
78
118
  raise ArgumentError, "Firewall must be instance of 'Firewall'" unless firewall.is_a?(Firewall)
79
119
  post_uri = @controller.get_ext_mount_config_uri(self)
@@ -83,7 +123,14 @@ class VRouter5600 < NetconfNode
83
123
  NetconfResponse.new(NetconfResponseStatus::OK)
84
124
  end
85
125
  end
86
-
126
+
127
+ ##
128
+ # Delete a firewall from the VRouter5600.
129
+ #
130
+ # _Parameters_
131
+ # * +firewall_or_name+:: Firewall or String : A Firewall object or name of firewall for which you want to remove from vRouter5600.
132
+ # _Return_ _Value_
133
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and error info if an error.
87
134
  def delete_firewall_instance(firewall_or_name)
88
135
  firewall_name = firewall_or_name.is_a?(Firewall) ? firewall_or_name.rules.name :
89
136
  firewall_or_name
@@ -97,7 +144,12 @@ class VRouter5600 < NetconfNode
97
144
  handle_error_response(response)
98
145
  end
99
146
  end
100
-
147
+
148
+ ##
149
+ # Return a list of interfaces on the VRouter5600
150
+ #
151
+ # _Return_ _Value_
152
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and a list of datapath interfaces.
101
153
  def get_dataplane_interfaces_list
102
154
  response = get_interfaces_config
103
155
  check_response_for_success(response) do |body|
@@ -113,7 +165,12 @@ class VRouter5600 < NetconfNode
113
165
  end
114
166
  end
115
167
  end
116
-
168
+
169
+ ##
170
+ # Return the configuration for the dataplane interfaces on the VRouter5600.
171
+ #
172
+ # _Return_ _Value_
173
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and the configuration of the dataplane interfaces.
117
174
  def get_dataplane_interfaces_cfg
118
175
  response = get_interfaces_config
119
176
  check_response_for_success(response) do |body|
@@ -126,7 +183,14 @@ class VRouter5600 < NetconfNode
126
183
  end
127
184
  end
128
185
  end
129
-
186
+
187
+ ##
188
+ # Return the configuration for a dataplane interface on the VRouter5600
189
+ #
190
+ # _Parameters_
191
+ # * +interface_name+:: String : name of the dataplane interface from #get_dataplane_interfaces_list
192
+ # _Return_ _Value_
193
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration of the requested dataplane interface.
130
194
  def get_dataplane_interface_cfg(interface_name)
131
195
  get_uri = "#{@controller.get_ext_mount_config_uri(self)}/"\
132
196
  "vyatta-interfaces:interfaces/vyatta-interfaces-dataplane:dataplane/"\
@@ -136,7 +200,12 @@ class VRouter5600 < NetconfNode
136
200
  NetconfResponse.new(NetconfResponseStatus::OK, body)
137
201
  end
138
202
  end
139
-
203
+
204
+ ##
205
+ # Return a list of loopback interfaces on the VRouter5600
206
+ #
207
+ # _Return_ _Value_
208
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of loopback interfaces.
140
209
  def get_loopback_interfaces_list
141
210
  response = get_interfaces_config
142
211
  check_response_for_success(response) do |body|
@@ -152,7 +221,12 @@ class VRouter5600 < NetconfNode
152
221
  end
153
222
  end
154
223
  end
155
-
224
+
225
+ ##
226
+ # Return the configuration for the loopback interfaces on the VRouter 5600.
227
+ #
228
+ # _Return_ _Value_
229
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of configurations of loopback interfaces.
156
230
  def get_loopback_interfaces_cfg
157
231
  response = get_interfaces_config
158
232
  check_response_for_success(response) do |body|
@@ -163,7 +237,14 @@ class VRouter5600 < NetconfNode
163
237
  end
164
238
  end
165
239
  end
166
-
240
+
241
+ ##
242
+ # Return the configuration for a single loopback interface on the VRouter 5600.
243
+ #
244
+ # _Parameters_
245
+ # * +interface_name+:: String : name of the loopback interface from the #get_loopback_interfaces_list
246
+ # _Return_ _Value_
247
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration for the requested loopback interface.
167
248
  def get_loopback_interface_cfg(interface_name)
168
249
  get_uri = "#{@controller.get_ext_mount_config_uri(self)}/"\
169
250
  "vyatta-interfaces:interfaces/vyatta-interfaces-loopback:loopback/"\
@@ -173,7 +254,16 @@ class VRouter5600 < NetconfNode
173
254
  NetconfResponse.new(NetconfResponseStatus::OK, body)
174
255
  end
175
256
  end
176
-
257
+
258
+ ##
259
+ # Set a firewall for inbound, outbound or both for a dataplane interface on the VRouter 5600.
260
+ #
261
+ # _Parameters_
262
+ # * +interface_name+:: String : The dataplane interface to attach firewalls.
263
+ # * +inbound_firewall_name+:: String : [optional] name of firewall on VRouter5600 to use for traffic inbound towards router.
264
+ # * +outbound_firewall_name+:: String : [optional] name of firewall on VRouter5600 to use for traffic outbound from router.
265
+ # _Return_ _Value_
266
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and YANG schema.
177
267
  def set_dataplane_interface_firewall(interface_name,
178
268
  inbound_firewall_name: nil, outbound_firewall_name: nil)
179
269
  raise ArgumentError, "At least one firewall (inbound_firewall_name, "\
@@ -191,7 +281,14 @@ class VRouter5600 < NetconfNode
191
281
  handle_error_response(response)
192
282
  end
193
283
  end
194
-
284
+
285
+ ##
286
+ # Delete both inbound and outbound firewalls for a dataplane interface on the VRouter 5600.
287
+ #
288
+ # _Parameters_
289
+ # * +interface_name+:: String : name of the dataplane interface to detach firewalls from.
290
+ # _Return_ _Value_
291
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and error details (if status is error).
195
292
  def delete_dataplane_interface_firewall(interface_name)
196
293
  delete_uri = "#{@controller.get_ext_mount_config_uri(self)}/"\
197
294
  "vyatta-interfaces:interfaces/vyatta-interfaces-dataplane:dataplane/"\
@@ -203,7 +300,12 @@ class VRouter5600 < NetconfNode
203
300
  handle_error_response(response)
204
301
  end
205
302
  end
206
-
303
+
304
+ ##
305
+ # Get the list of interfaces on the VRouter 5600.
306
+ #
307
+ # _Return_ _Value_
308
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of all interfaces.
207
309
  def get_interfaces_list
208
310
  response = get_interfaces_config
209
311
  check_response_for_success(response) do |body|
@@ -220,7 +322,12 @@ class VRouter5600 < NetconfNode
220
322
  end
221
323
  end
222
324
  end
223
-
325
+
326
+ ##
327
+ # Return the configuration for the interfaces on the VRouter 5600.
328
+ #
329
+ # _Return_ _Value_
330
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration for interfaces.
224
331
  def get_interfaces_cfg
225
332
  response = get_interfaces_config
226
333
  check_response_for_success(response) do |body|
@@ -28,22 +28,56 @@
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
+ # OpenFlow 'Output' action type
31
32
  class ActionOutput
32
- attr_reader :type, :order, :port, :length
33
-
33
+ # string : type of action.
34
+ attr_reader :type
35
+ # integer : order
36
+ attr_reader :order
37
+ # integer : port to output
38
+ attr_reader :port
39
+ # integer : When the ’port’ is the controller, this indicates the max number of
40
+ # bytes to send. A value of zero means no bytes of the packet should be sent.
41
+ # A value of OFPCML_NO_BUFFER (0xffff) means that the packet is not buffered and the
42
+ # complete packet is to be sent to the controller.
43
+ attr_reader :length
44
+
45
+ # _Parameters_
46
+ # * +port+:: integer : the port to target for output
47
+ # * +length+:: integer : When the ’port’ is the controller, this indicates the max number of
48
+ # bytes to send. A value of zero means no bytes of the packet should be sent.
49
+ # A value of OFPCML_NO_BUFFER (0xffff) means that the packet is not buffered and the
50
+ # complete packet is to be sent to the controller.
51
+ # * +order+:: integer : order
34
52
  def initialize(port: nil, length: nil, order: nil)
35
53
  @type = 'output'
36
54
  @order = order
37
55
  @port = port
38
56
  @length = length
39
57
  end
40
-
58
+
59
+
60
+ ##
61
+ # Return a list of YANG schemas for the node.
62
+ #
63
+ # _Parameters_
64
+ # * +port+:: integer : the port to target for output
65
+ # * +length+:: integer : When the ’port’ is the controller, this indicates the max number of
66
+ # bytes to send. A value of zero means no bytes of the packet should be sent.
67
+ # A value of OFPCML_NO_BUFFER (0xffff) means that the packet is not buffered and the
68
+ # complete packet is to be sent to the controller.
69
+ # * +order+:: integer : order
41
70
  def update(port: nil, length: nil, order: nil)
42
71
  @order = order unless order.nil?
43
72
  @port = port unless port.nil?
44
73
  @length = length unless length.nil?
45
74
  end
46
75
 
76
+ ##
77
+ # Update from an existing Action .
78
+ #
79
+ # _Parameters_
80
+ # * +action_object+:: Action : Update this action from an existing Action.
47
81
  def update_from_object(action_object)
48
82
  @order = action_object['order']
49
83
  if action_object.has_key?('output-action')
@@ -28,6 +28,7 @@
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
+ # Base class for all OpenFlow actions
31
32
  class Action
32
33
  attr_accessor :order
33
34
 
@@ -28,7 +28,11 @@
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 defining the action that copies Time To Live from outermost header to next-to-outermost header.
31
32
  class CopyTTLInwardsAction < 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
@@ -28,7 +28,11 @@
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 defining openflow action to copy Time To Live from next-to-outermost header to outermost header.
31
32
  class CopyTTLOutwardsAction < 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
@@ -28,7 +28,11 @@
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 action to decrement the MPLS Time To Live value.
31
32
  class DecMplsTTLAction < 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
@@ -28,7 +28,11 @@
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 decrements Time To Live
31
32
  class DecNwTTLAction < 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
@@ -30,6 +30,7 @@
30
30
 
31
31
  require 'openflowdev/actions/action'
32
32
 
33
+ #Class defining an OpenFlow action to drop the packet.
33
34
  class DropAction < Action
34
35
  def to_hash
35
36
  {:order => @order, 'drop-action' => {}}
@@ -28,7 +28,11 @@
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 defining an OpenFlow action to flood packet
31
32
  class FloodAction < 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
@@ -28,7 +28,11 @@
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 a Flood-all action. Floods to all bu the ingress port.
31
32
  class FloodAllAction < 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
@@ -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 an action to forward to a group
31
32
  class GroupAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +group+::
37
+ # * +group_id+:: integer : Identifier for the target group.
32
38
  def initialize(order: nil, group: nil, group_id: nil)
33
39
  super(order: order)
34
40
  raise ArgumentError, "Group (group) required" unless group
@@ -37,7 +43,7 @@ class GroupAction < Action
37
43
  @group_id = group_id
38
44
  end
39
45
 
40
- def to_hash
46
+ def to_hash #:nodoc:
41
47
  {:order => @order, 'group-action' => {:group => @group,
42
48
  'group-id' => @group_id}}
43
49
  end
@@ -29,6 +29,9 @@
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
31
  class HwPathAction < Action
32
+
33
+ # _Parameters_
34
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
32
35
  def initialize(order: 0)
33
36
  super(order: order)
34
37
  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
+ # Class to represent OpenFlow action for forwarding to the loopback interface of device
31
32
  class LoopbackAction
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, 'loopback_action' => {}}
38
42
  end
39
43
  end
@@ -28,7 +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
+ #Class to define an OpenFlow output action
31
32
  class OutputAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +port+:: integer : the port to target for output
37
+ # * +max_length+:: integer : When the ’port’ is the controller, this indicates the max number of
38
+ # bytes to send. A value of zero means no bytes of the packet should be sent.
39
+ # A value of OFPCML_NO_BUFFER (0xffff) means that the packet is not buffered and the
40
+ # complete packet is to be sent to the controller.
32
41
  def initialize(order: 0, port: nil, max_length: nil)
33
42
  super(order: order)
34
43
  raise ArgumentError, "Port (port) required" unless port
@@ -36,7 +45,7 @@ class OutputAction < Action
36
45
  @max_length = max_length
37
46
  end
38
47
 
39
- def to_hash
48
+ def to_hash #:nodoc:
40
49
  {:order => @order, 'output-action' => {'max-length' => @max_length,
41
50
  'output-node-connector' => @port}}
42
51
  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 that defines an OpenFlow Pop MPLS action ( remove the tunnel encapsulation )
31
32
  class PopMplsHeaderAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +eth_type+:: integer : The ethernet type of the packet.
32
37
  def initialize(order: 0, eth_type: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, 'Ethernet Type (eth_type) required' unless eth_type
35
40
  @eth_type = eth_type
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'pop-mpls-action' => {'ethernet-type' => @eth_type}}
40
45
  end
41
46
  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
+ #Class to represent OpenFlow action to Pop Provider Backbone Bridge (remove encapsulation)
31
32
  class PopPBBHeaderAction < 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, 'pop-pbb-aciton' => {}}
38
42
  end
39
43
  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
+ #Class that is used to define an OpenFlow POP VLAN header action. Remove the VLAN encapsulation (Q-in-Q).
31
32
  class PopVlanHeaderAction < 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, 'pop-vlan-action' => {}}
38
42
  end
39
43
  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 an OpenFlow action to add MPLS header to packet.
31
32
  class PushMplsHeaderAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +eth_type+:: integer : The ethernet type of the packet.
32
37
  def initialize(order: 0, eth_type: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "Ethernet Type (eth_type) required"
35
40
  @eth_type = eth_type
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'push-mpls-action' => {'ethernet-type' => @eth_type}}
40
45
  end
41
46
  end
@@ -28,13 +28,18 @@
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 add a Provider Backbone Bridge encapsulation
31
32
  class PushPBBHeaderAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +eth_type+:: integer : The ethernet type of the packet.
32
37
  def initialize(order: 0, eth_type: nil)
33
38
  super(order: order)
34
39
  @eth_type = eth_type
35
40
  end
36
41
 
37
- def to_hash
42
+ def to_hash #:nodoc:
38
43
  {:order => @order, 'push-pbb-aciton' => {'ethernet-type' => @eth_type}}
39
44
  end
40
45
  end
@@ -28,7 +28,17 @@
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 add a VLAN encapsulation.
31
32
  class PushVlanHeaderAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +eth_type+:: integer : The ethernet type of the packet.
37
+ # * +tag+:: integer : Tag protocol identifier.
38
+ # * +pcp+:: integer : Priority code point.
39
+ # * +cfi+:: integer : Drop eligible indicator (formerly cannonical format indicator).
40
+ # * +vlan_id+:: integer : VLAN identifier.
41
+
32
42
  def initialize(order: 0, eth_type: nil, tag: nil, pcp: nil, cfi: nil,
33
43
  vlan_id: nil)
34
44
  super(order: order)
@@ -39,7 +49,7 @@ class PushVlanHeaderAction < Action
39
49
  @vlan_id = vlan_id
40
50
  end
41
51
 
42
- def to_hash
52
+ def to_hash #:nodoc:
43
53
  {:order => @order, 'push-vlan-action' => {'ethernet-type' => @eth_type,
44
54
  :tag => @tag, :pcp => @pcp, :cfi => @cfi, 'vlan-id' => @vlan_id}}
45
55
  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 an OpenFlow action for setting the ethernet (data layer) destination
31
32
  class SetDlDstAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +mac_addr+:: string : The MAC address to set in destination field of ethernet header.
32
37
  def initialize(order: nil, mac_addr: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "MAC Address (mac_addr) required"
35
40
  @mac = mac_addr
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-dl-dst-action' => {:address => @mac}}
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 an OpenFlow action to set the Ethernet (data layer) source MAC address
31
32
  class SetDlSrcAction < Action
33
+
34
+ # _Parameters_
35
+ # * +order+:: integer : The order of the action relative to other actions in Instruction.
36
+ # * +mac_addr+:: string : The MAC address to set in source field of ethernet header.
32
37
  def initialize(order: nil, mac_addr: nil)
33
38
  super(order: order)
34
39
  raise ArgumentError, "MAC Address (mac_addr) required"
35
40
  @mac = mac_addr
36
41
  end
37
42
 
38
- def to_hash
43
+ def to_hash #:nodoc:
39
44
  {:order => @order, 'set-dl-src-action' => {:address => @mac}}
40
45
  end
41
46
  end