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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b3c2cc02ad9c527fce130fcc17d73725e11eee9
4
- data.tar.gz: 8634ee93a57d512ce5761216cf785a1f1ce91fe0
3
+ metadata.gz: 81aa569a1b37a5364c278606cf508f2f0b70d5d3
4
+ data.tar.gz: 035cf3a2d02eca3440dd6394390445260bfeba0c
5
5
  SHA512:
6
- metadata.gz: 07f09c082d23fadc7b94e7611f65fd69edd02a93de43da0de34cab13454e56063c2f682d088a3ebc938f6ef039fcf3591ced849d38ca7fccd35aae79217b6ba5
7
- data.tar.gz: dec8ff130b3e240d12bd45b4ce8f72517c34964efbdf7fdf40cb522cc6bfb7a3d662bcde8a65ac8f5740101ad6d5e4f6d0034b192da4f7daff3e52f7175cda40
6
+ metadata.gz: d8319896aeb7ba1390bebb00216204078e25c27c3fff705eec45e2d25527f689be0d8e47b62333971039fc81c54f5264e4269d8d18533b5eb0775b1256bb068b
7
+ data.tar.gz: 2d3f0d517f0d42125b325696a1eee89abbf064b3ae9197386be572aae9bb6b40c72d37892ff55fbedbe25ea52c36720d7182341d58ae62629e0382a35e4ec5ae
@@ -28,6 +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
+ ##
32
+ # Class that represents a Controller device.
33
+ #
31
34
  class Controller
32
35
  require 'json'
33
36
  require 'utils/rest_agent'
@@ -36,15 +39,28 @@ class Controller
36
39
  require 'controller/netconf_node'
37
40
  require 'nokogiri'
38
41
 
42
+ # String : IP address of the BVC. e.g. 192.168.56.101
39
43
  attr_reader :ip
44
+ # String : Port number of the BVC RESTCONF API. e.g. 8181
40
45
  attr_reader :port
46
+ # String : Admin userid for logon to BVC RESTCONF API. e.g. admin
41
47
  attr_reader :username
48
+ # String : Admin password for logon to BVC RESTCONF API. e.g. admin
42
49
  attr_reader :password
50
+ # Integer : Number of seconds to wait for a response from BVC to RESTCONF request. e.g. 5
43
51
  attr_reader :timeout
52
+ # RestAgent : The REST agent connected to controller.
44
53
  attr_reader :rest_agent
45
54
 
55
+ # _Parameters_
56
+ # * +ip_addr+:: String : IP address of the BVC. e.g. 192.168.56.101
57
+ # * +port_number+:: String : Port number of the BVC RESTCONF API. e.g. 8181
58
+ # * +admin_name+:: String : Admin userid for logon to BVC RESTCONF API. e.g. admin
59
+ # * +admin_password+:: String : Admin password for logon to BVC RESTCONF API. e.g. admin
60
+ # * +timeout_in_s+:: Integer : Number of seconds to wait for a response from BVC to RESTCONF request. e.g. 5
61
+ #
46
62
  def initialize(ip_addr: nil, port_number: 8181, admin_name: nil,
47
- admin_password: nil, timeout_in_s: 5)
63
+ admin_password: nil, timeout_in_s: 5)
48
64
  raise ArgumentError, "IP Address (ip_addr) required" unless ip_addr
49
65
  raise ArgumentError, "Admin Username (admin_name) required" unless admin_name
50
66
  raise ArgumentError, "Admin Password (admin_password) required" unless admin_password
@@ -58,6 +74,14 @@ class Controller
58
74
  password: @password, open_timeout: @timeout)
59
75
  end
60
76
 
77
+ ##
78
+ # Return a list of YANG schemas for the node.
79
+ #
80
+ # _Parameters_
81
+ # * +node_name+:: String : name of the node from the #get_all_nodes_in_config
82
+ # _Return_ _Value_
83
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of YANG schemas for the node.
84
+
61
85
  def get_schemas(node_name)
62
86
  get_uri = "/restconf/operational/opendaylight-inventory:nodes/node/"\
63
87
  "#{node_name}/yang-ext:mount/ietf-netconf-monitoring:netconf-state/schemas"
@@ -71,6 +95,16 @@ class Controller
71
95
  end
72
96
  end
73
97
 
98
+ ##
99
+ # Return a YANG schema for the indicated schema on the indicated node.
100
+ #
101
+ # _Parameters_
102
+ # * +node_name+:: String : name of the node from the #get_all_nodes_in_config
103
+ # * +id+:: String : Identifier for schema
104
+ # * +version+:: String : Version/date for schema
105
+ # _Return_ _Value_
106
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and YANG schema.
107
+
74
108
  def get_schema(node_name, id: nil, version: nil)
75
109
  raise ArgumentError, "Identifier (id) required" unless id
76
110
  raise ArgumentError, "Version (version) required" unless version
@@ -90,6 +124,12 @@ class Controller
90
124
  end
91
125
  end
92
126
 
127
+ ##
128
+ # Return a list of service providers available.
129
+ #
130
+ # _Return_ _Value_
131
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing a list of service providers.
132
+
93
133
  def get_service_providers_info
94
134
  get_uri = "/restconf/config/opendaylight-inventory:nodes/node/"\
95
135
  "controller-config/yang-ext:mount/config:services"
@@ -103,6 +143,14 @@ class Controller
103
143
  end
104
144
  end
105
145
 
146
+ ##
147
+ # Return info about a single service provider.
148
+ #
149
+ # _Parameters_
150
+ # * +provider_name+:: name of the service provider from get_service_providers_info
151
+ # _Return_ _Value_
152
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing info about the service provider.
153
+
106
154
  def get_service_provider_info(provider_name)
107
155
  get_uri = "/restconf/config/opendaylight-inventory:nodes/node/"\
108
156
  "controller-config/yang-ext:mount/config:services/service/#{provider_name}"
@@ -116,6 +164,14 @@ class Controller
116
164
  end
117
165
  end
118
166
 
167
+ ##
168
+ # Return a list of operations supported by the indicated node.
169
+ #
170
+ # _Parameters_
171
+ # * +node_name+:: String : name of the node from the #get_all_nodes_in_config
172
+ # _Return_ _Value_
173
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and operations supported by indicated node.
174
+
119
175
  def get_netconf_operations(node_name)
120
176
  get_uri = "/restconf/operations/opendaylight-inventory:nodes/node/"\
121
177
  "#{node_name}/yang-ext:mount"
@@ -129,6 +185,12 @@ class Controller
129
185
  end
130
186
  end
131
187
 
188
+ ##
189
+ # Return a list of modules and their operational state.
190
+ #
191
+ # _Return_ _Value_
192
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON listing modules and their operational state
193
+
132
194
  def get_all_modules_operational_state
133
195
  get_uri = "/restconf/operational/opendaylight-inventory:nodes/node/"\
134
196
  "controller-config/yang-ext:mount/config:modules"
@@ -143,6 +205,15 @@ class Controller
143
205
  end
144
206
  end
145
207
 
208
+ ##
209
+ # Return operational state for specified module.
210
+ #
211
+ # _Parameters_
212
+ # * +type+:: String : module type
213
+ # * +name+:: String : module name
214
+ # _Return_ _Value_
215
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing operational state
216
+
146
217
  def get_module_operational_state(type: nil, name: nil)
147
218
  raise ArgumentError, "Type (type) required" unless type
148
219
  raise ArgumentError, "Name (name) required" unless name
@@ -159,6 +230,14 @@ class Controller
159
230
  end
160
231
  end
161
232
 
233
+ ##
234
+ # Return sessions for indicated node.
235
+ #
236
+ # _Parameters_
237
+ # * +node_name+:: String : name of the node from the #get_all_nodes_in_config
238
+ # _Return_ _Value_
239
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing list of sessions.
240
+
162
241
  def get_sessions_info(node_name)
163
242
  get_uri = "/restconf/operational/opendaylight-inventory:nodes/node/"\
164
243
  "#{node_name}/yang-ext:mount/ietf-netconf-monitoring:netconf-state/"\
@@ -173,6 +252,12 @@ class Controller
173
252
  end
174
253
  end
175
254
 
255
+ ##
256
+ # Return streams available for subscription.
257
+ #
258
+ # _Return_ _Value_
259
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing list of streams.
260
+
176
261
  def get_streams_info
177
262
  get_uri = "restconf/streams"
178
263
  response = @rest_agent.get_request(get_uri)
@@ -185,6 +270,12 @@ class Controller
185
270
  end
186
271
  end
187
272
 
273
+ ##
274
+ # Return a list of nodes in the controller's config data store
275
+ #
276
+ # _Return_ _Value_
277
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of nodes in the config data store of the controller
278
+
188
279
  def get_all_nodes_in_config
189
280
  get_uri = "/restconf/config/opendaylight-inventory:nodes"
190
281
  response = @rest_agent.get_request(get_uri)
@@ -201,7 +292,13 @@ class Controller
201
292
  end
202
293
  end
203
294
 
204
- def get_netconf_nodes_in_config
295
+ ##
296
+ # Return a list of NETCONF nodes in the controller's configuration data store
297
+ #
298
+ # _Return_ _Value_
299
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of nodes in the config data store of the controller
300
+
301
+ def get_netconf_nodes_in_config
205
302
  get_uri = "/restconf/config/opendaylight-inventory:nodes"
206
303
  response = @rest_agent.get_request(get_uri)
207
304
  check_response_for_success(response) do |body|
@@ -217,6 +314,12 @@ class Controller
217
314
  end
218
315
  end
219
316
 
317
+ ##
318
+ # Return a list of NETCONF nodes in the operational data store of controller and the status of their connection to the controller.
319
+ #
320
+ # _Return_ _Value_
321
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of nodes the status of their connection to the controller.
322
+
220
323
  def get_netconf_nodes_conn_status
221
324
  get_uri = "/restconf/operational/opendaylight-inventory:nodes"
222
325
  response = @rest_agent.get_request(get_uri)
@@ -237,6 +340,12 @@ class Controller
237
340
  end
238
341
  end
239
342
 
343
+ ##
344
+ # Return a list of nodes in the controllers operational data store.
345
+ #
346
+ # _Return_ _Value_
347
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of nodes in controller's operational data store.
348
+
240
349
  def get_nodes_operational_list
241
350
  get_uri = "/restconf/operational/opendaylight-inventory:nodes"
242
351
  response = @rest_agent.get_request(get_uri)
@@ -253,6 +362,12 @@ class Controller
253
362
  end
254
363
  end
255
364
 
365
+ ##
366
+ # Return a list of nodes that support OpenFlow in the Controller's operational data store.
367
+ #
368
+ # _Return_ _Value_
369
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of OpenFlow-capable nodes in the Controller's operational database.
370
+
256
371
  def get_openflow_nodes_operational_list
257
372
  get_uri = "/restconf/operational/opendaylight-inventory:nodes"
258
373
  response = @rest_agent.get_request(get_uri)
@@ -269,6 +384,14 @@ class Controller
269
384
  end
270
385
  end
271
386
 
387
+ ##
388
+ # Return information about a node in the operational data store.
389
+ #
390
+ # _Parameters_
391
+ # * +node_name+:: String : name of the node in operational data store from the #get_nodes_operational_list
392
+ # _Return_ _Value_
393
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON data about the requested node.
394
+
272
395
  def get_node_info(node_name)
273
396
  get_uri = "/restconf/operational/opendaylight-inventory:nodes/node/"\
274
397
  "#{node_name}"
@@ -282,6 +405,14 @@ class Controller
282
405
  end
283
406
  end
284
407
 
408
+ ##
409
+ # Return the configuration status of the node.
410
+ #
411
+ # _Parameters_
412
+ # * +node_name+:: String : name of the node from the #get_all_nodes_in_config
413
+ # _Return_ _Value_
414
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and configuration status of requested node.
415
+
285
416
  def check_node_config_status(node_name)
286
417
  get_uri = "/restconf/config/opendaylight-inventory:nodes/node/#{node_name}"
287
418
  response = @rest_agent.get_request(get_uri)
@@ -291,6 +422,14 @@ class Controller
291
422
  end
292
423
  end
293
424
 
425
+ ##
426
+ # Return the connection status of the node to the controller.
427
+ #
428
+ # _Parameters_
429
+ # * +node_name+:: String : name of the node from the #get_nodes_operational_list
430
+ # _Return_ _Value_
431
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and Status of the node's connection to the controller. Note: currently OpenFlow nodes are always shown disconnected..
432
+
294
433
  def check_node_conn_status(node_name)
295
434
  get_uri = "/restconf/operational/opendaylight-inventory:nodes/node/"\
296
435
  "#{node_name}"
@@ -316,6 +455,12 @@ class Controller
316
455
  end
317
456
  end
318
457
 
458
+ ##
459
+ # Return a list of nodes and the status of their connection to the controller.
460
+ #
461
+ # _Return_ _Value_
462
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and list of nodes and their connection to the controller.
463
+
319
464
  def get_all_nodes_conn_status
320
465
  get_uri = "/restconf/operational/opendaylight-inventory:nodes"
321
466
  response = @rest_agent.get_request(get_uri)
@@ -342,6 +487,14 @@ class Controller
342
487
  end
343
488
  end
344
489
 
490
+ ##
491
+ # Connect a netconf device to the controller (for example connect vrouter to controller via NetConf)
492
+ #
493
+ # _Parameters_
494
+ # * +node+:: NetconfNode : A netconf node.
495
+ # _Return_ _Value_
496
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and JSON providing response from adding the node.
497
+
345
498
  def add_netconf_node(node)
346
499
  post_uri = "/restconf/config/opendaylight-inventory:nodes/node/"\
347
500
  "controller-config/yang-ext:mount/config:modules"
@@ -354,6 +507,14 @@ class Controller
354
507
  end
355
508
  end
356
509
 
510
+ ##
511
+ # Disconnect a netconf device from the controller.
512
+ #
513
+ # _Parameters_
514
+ # * +node+:: NetconfNode : node to disconnect from the controller.
515
+ # _Return_ _Value_
516
+ # * NetconfResponse : Status ( NetconfResponseStatus ) and response if error.
517
+
357
518
  def delete_netconf_node(node)
358
519
  delete_uri = "/restconf/config/opendaylight-inventory:nodes/node/"\
359
520
  "controller-config/yang-ext:mount/config:modules/module/"\
@@ -368,6 +529,14 @@ class Controller
368
529
  end
369
530
  end
370
531
 
532
+ ##
533
+ # Return the url to the operational node.
534
+ #
535
+ # _Parameters_
536
+ # * +node+:: NetconfNode : node for which to return the url.
537
+ # _Return_ _Value_
538
+ # * String: Url
539
+
371
540
  def get_node_operational_uri(node)
372
541
  raise ArgumentError, "Node (node) must be a 'Node' object or a 'Node' "\
373
542
  "subclass object" unless node.is_a?(Node) ||
@@ -375,6 +544,14 @@ class Controller
375
544
  "/restconf/operational/opendaylight-inventory:nodes/node/#{node.name}"
376
545
  end
377
546
 
547
+ ##
548
+ # Return the url to the configured node.
549
+ #
550
+ # _Parameters_
551
+ # * +node+:: NetconfNode : node for which to return the url.
552
+ # _Return_ _Value_
553
+ # * String: Url
554
+
378
555
  def get_node_config_uri(node)
379
556
  raise ArgumentError, "Node (node) must be a 'Node' object or a 'Node' "\
380
557
  "subclass object" unless node.is_a?(Node) ||
@@ -382,13 +559,22 @@ class Controller
382
559
  "/restconf/config/opendaylight-inventory:nodes/node/#{node.name}"
383
560
  end
384
561
 
562
+ ##
563
+ # Return the netconf mountpoint url to the configured node.
564
+ #
565
+ # _Parameters_
566
+ # * +node+:: NetconfNode : node for which to return the url.
567
+ # _Return_ _Value_
568
+ # * String: Url
569
+
385
570
  def get_ext_mount_config_uri(node)
386
571
  raise ArgumentError, "Node (node) must be a 'Node' object or a 'Node' "\
387
572
  "subclass object" unless node.is_a?(Node)
388
573
  "/restconf/config/opendaylight-inventory:nodes/node/#{node.name}/yang-ext:mount"
389
574
  end
390
575
 
391
- def to_hash
576
+
577
+ def to_hash #:nodoc:
392
578
  {:ip_addr => @ip, :port_num => @port, :admin_name => @username,
393
579
  :admin_password => @password}
394
580
  end
@@ -29,9 +29,33 @@
29
29
  # THE POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
31
  require 'controller/node'
32
+
33
+ ##
34
+ # Class that represents a NetconfNode
35
+ #
32
36
  class NetconfNode < Node
33
- attr_reader :ip, :port, :username, :password, :tcp_only
34
-
37
+
38
+
39
+ # String : IP address for NETCONF protocol of NETCONF device. e.g. 172.22.11.44
40
+ attr_reader :ip
41
+ # String : Port number of the NETCONF protocol. e.g. 830
42
+ attr_reader :port
43
+ # String : Admin userid for logon to NETCONF device. e.g. vyatta
44
+ attr_reader :username
45
+ # String : Admin password for logon NETCONF device. e.g. vyatta
46
+ attr_reader :password
47
+ # Boolean : True if only TCP is used to communicate with NETCONF device.
48
+ attr_reader :tcp_only
49
+
50
+ # _Parameters_
51
+ # * +controller+:: Controller : The controller object through which NETCONF device is to be accessed.
52
+ # * +name+:: String : The name of the NETCONF node. e.g. vrouter
53
+ # * +ip_addr+:: String : IP address for NETCONF protocol of NETCONF device. e.g. 172.22.11.44
54
+ # * +port_number+:: String : Port number of the NETCONF protocol. e.g. 830
55
+ # * +admin_name+:: String : Admin userid for logon to NETCONF device. e.g. vyatta
56
+ # * +admin_password+:: String : Admin password for logon NETCONF device. e.g. vyatta
57
+ # * +tcp_only+:: Boolean : True if only TCP is used to communicate with NETCONF device.
58
+ #
35
59
  def initialize(controller: nil, name: nil, ip_addr: nil,
36
60
  port_number: nil, admin_name: nil, admin_password: nil,
37
61
  tcp_only: false)
@@ -48,7 +72,7 @@ class NetconfNode < Node
48
72
  @tcp_only = tcp_only
49
73
  end
50
74
 
51
- def to_hash
75
+ def to_hash #:nodoc:
52
76
  {:controller => @controller.to_hash, :name => @name, :ip_addr => @ip,
53
77
  :port_num => @port, :admin_name => @username, :admin_password => @password}
54
78
  end
@@ -28,9 +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
+ ##
32
+ # Class that represents a Controller device.
33
+ #
31
34
  class Node
35
+ # String : The name of the node. e.g. vrouter
32
36
  attr_reader :name
33
37
 
38
+ # _Parameters_
39
+ # * +controller+:: Controller : The controller object through which node is to be accessed.
40
+ # * +name+:: String : The name of the node. e.g. vrouter
34
41
  def initialize(controller: nil, name: nil)
35
42
  raise ArgumentError, "Controller (controller) required" unless controller
36
43
  raise ArgumentError, "Name (name) required" unless name
@@ -27,7 +27,9 @@
27
27
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
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 an OpenFlow node.
32
+ #
31
33
  class OpenflowNode < Node
32
34
 
33
35
  end
@@ -28,16 +28,21 @@
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
+ # A class that defines a Firewall.
31
32
  class Firewall
33
+
34
+ # Rules : rules defining behavior of firewall.
32
35
  attr_reader :rules
33
36
 
37
+ # _Parameters_
38
+ # * +rules+:: Rules : rules defining behavior of firewall.
34
39
  def initialize(rules: nil)
35
40
  raise ArgumentError, "Rules (rules) required" unless rules
36
41
  raise ArgumentError, "Rules (rules) must be instance of 'Rules'" unless rules.is_a?(Rules)
37
42
  @rules = rules
38
43
  end
39
44
 
40
- def to_hash
45
+ def to_hash #:nodoc:
41
46
  {'vyatta-security:security' => {'vyatta-security-firewall:firewall' =>
42
47
  {:name => [@rules.to_hash]}}}
43
48
  end
@@ -28,9 +28,22 @@
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
+ # The class that defines a Firewall Rule.
31
32
  class Rule
32
- attr_reader :number, :action, :src_address
33
-
33
+
34
+ # Integer: The rule number. e.g. 40
35
+ attr_reader :number
36
+ # String: The action for the rule. e.g. "drop" or "accept"
37
+ attr_reader :action
38
+ # String: The source IP address on which the rule will match. e.g. "172.22.17.107"
39
+ attr_reader :src_address
40
+
41
+ # _Parameters_
42
+ # * +rule_number+:: Integer: The rule number. e.g. 40
43
+ # * +action+:: String: The action for the rule. e.g. "drop" or "accept"
44
+ # * +source_address+:: String: The source IP address on which the rule will match. e.g. "172.22.17.107"
45
+ # * +icmp_typename+:: String : [optional] ICMP type. e.g. "ping"
46
+
34
47
  def initialize(rule_number: nil, action: nil, source_address: nil,
35
48
  icmp_typename: nil)
36
49
  raise ArgumentError, "Rule number (rule_number) required" unless rule_number
@@ -44,7 +57,7 @@ class Rule
44
57
  @protocol = "icmp" if icmp_typename
45
58
  end
46
59
 
47
- def to_hash
60
+ def to_hash #:nodoc:
48
61
  hash = {:action => @action, :source => {:address => @src_address},
49
62
  :tagnode => @number, :protocol => @protocol, :icmp =>
50
63
  {'type-name' => @icmp_typename}}
@@ -28,9 +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
+ ##
32
+ # The class that defines firewall Rules.
31
33
  class Rules
32
- attr_reader :name, :rules
34
+
35
+ # String: Name of the firewall rule.
36
+ attr_reader :name
37
+
38
+ # List of Rule : List of Rule defining the firewall behavior.
39
+ attr_reader :rules
33
40
 
41
+ # _Parameters_
42
+ # * +name+:: String: Name of the firewall rule.
43
+ #
34
44
  def initialize(name: nil)
35
45
  raise ArgumentError, "Name (name) required" unless name
36
46
 
@@ -38,12 +48,18 @@ class Rules
38
48
  @rules = []
39
49
  end
40
50
 
51
+ ##
52
+ # Add a rule to this firewall.
53
+ #
54
+ # _Parameters_
55
+ # * +rule+:: Rule : A Firewall Rule to add to this Firewall.
56
+
41
57
  def add_rule(rule)
42
58
  raise ArgumentError, "Rule must be instance of 'Rule'" unless rule.is_a?(Rule)
43
59
  @rules << rule
44
60
  end
45
61
 
46
- def to_hash
62
+ def to_hash #:nodoc:
47
63
  rules_hash = []
48
64
  @rules.each do |rule|
49
65
  rules_hash << rule.to_hash