rbeapi 0.5.0 → 0.5.1

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 (57) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/Gemfile +1 -1
  3. data/README.md +17 -12
  4. data/guide/.gitignore +2 -0
  5. data/guide/api.rst +5894 -0
  6. data/guide/conf.py +5 -5
  7. data/guide/contributing.rst +6 -0
  8. data/guide/getting-started.rst +134 -0
  9. data/guide/index.rst +3 -5
  10. data/guide/installation.rst +56 -1
  11. data/guide/license.rst +13 -2
  12. data/guide/overview.rst +2 -5
  13. data/guide/testing.rst +5 -1
  14. data/guide/upgrading.rst +10 -0
  15. data/lib/rbeapi/api.rb +37 -36
  16. data/lib/rbeapi/api/aaa.rb +90 -90
  17. data/lib/rbeapi/api/acl.rb +70 -53
  18. data/lib/rbeapi/api/bgp.rb +186 -163
  19. data/lib/rbeapi/api/dns.rb +51 -45
  20. data/lib/rbeapi/api/interfaces.rb +344 -328
  21. data/lib/rbeapi/api/ipinterfaces.rb +92 -92
  22. data/lib/rbeapi/api/logging.rb +32 -32
  23. data/lib/rbeapi/api/mlag.rb +97 -97
  24. data/lib/rbeapi/api/ntp.rb +39 -39
  25. data/lib/rbeapi/api/ospf.rb +58 -58
  26. data/lib/rbeapi/api/prefixlists.rb +22 -22
  27. data/lib/rbeapi/api/radius.rb +77 -49
  28. data/lib/rbeapi/api/routemaps.rb +110 -64
  29. data/lib/rbeapi/api/snmp.rb +104 -100
  30. data/lib/rbeapi/api/staticroutes.rb +27 -20
  31. data/lib/rbeapi/api/stp.rb +100 -84
  32. data/lib/rbeapi/api/switchports.rb +98 -77
  33. data/lib/rbeapi/api/system.rb +93 -25
  34. data/lib/rbeapi/api/tacacs.rb +54 -35
  35. data/lib/rbeapi/api/users.rb +68 -68
  36. data/lib/rbeapi/api/varp.rb +56 -47
  37. data/lib/rbeapi/api/vlans.rb +86 -86
  38. data/lib/rbeapi/api/vrrp.rb +210 -173
  39. data/lib/rbeapi/client.rb +142 -108
  40. data/lib/rbeapi/eapilib.rb +73 -62
  41. data/lib/rbeapi/utils.rb +8 -8
  42. data/lib/rbeapi/version.rb +2 -2
  43. data/spec/fixtures/test.conf +3 -3
  44. data/spec/system/rbeapi/api/system_spec.rb +46 -2
  45. data/spec/system/rbeapi/api/vlans_spec.rb +5 -2
  46. data/spec/system/rbeapi/client_spec.rb +4 -4
  47. data/spec/unit/rbeapi/api/system/default_spec.rb +40 -4
  48. data/spec/unit/rbeapi/api/system/fixture_system.text +14 -0
  49. data/spec/unit/rbeapi/api/vlans/default_spec.rb +1 -1
  50. data/spec/unit/rbeapi/api/vlans/fixture_vlans.text +2 -0
  51. data/spec/unit/rbeapi/client_spec.rb +1 -0
  52. metadata +9 -9
  53. data/guide/cookbook.rst +0 -4
  54. data/guide/developing.rst +0 -4
  55. data/guide/faq.rst +0 -4
  56. data/guide/quickstart.rst +0 -4
  57. data/guide/troubleshooting.rst +0 -1
@@ -32,13 +32,13 @@
32
32
  require 'rbeapi/api'
33
33
 
34
34
  ##
35
- # Eos is the toplevel namespace for working with Arista EOS nodes
35
+ # Eos is the toplevel namespace for working with Arista EOS nodes.
36
36
  module Rbeapi
37
37
  ##
38
- # Api is module namespace for working with the EOS command API
38
+ # Api is module namespace for working with the EOS command API.
39
39
  module Api
40
40
  ##
41
- # The Bgp class implements global BGP router configuration
41
+ # The Bgp class implements global BGP router configuration.
42
42
  class Bgp < Entity
43
43
  attr_reader :neighbors
44
44
 
@@ -115,9 +115,9 @@ module Rbeapi
115
115
  # AS number. Defined as a class method. Used by the BgpNeighbors
116
116
  # class below.
117
117
  #
118
- # @param [String] :config The switch config.
118
+ # @param config [String] The switch config.
119
119
  #
120
- # @return [Hash<Symbol, Object>] resource hash attribute
120
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute.
121
121
  def self.parse_bgp_as(config)
122
122
  value = config.scan(/^router bgp (\d+)/).first
123
123
  { bgp_as: value[0] }
@@ -129,9 +129,9 @@ module Rbeapi
129
129
  #
130
130
  # @api private
131
131
  #
132
- # @param [String] :config The switch config.
132
+ # @param config [String] The switch config.
133
133
  #
134
- # @return [Hash<Symbol, Object>] resource hash attribute
134
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute.
135
135
  def parse_router_id(config)
136
136
  value = config.scan(/router-id ([^\s]+)/).first
137
137
  value = value ? value[0] : nil
@@ -145,7 +145,7 @@ module Rbeapi
145
145
  #
146
146
  # @api private
147
147
  #
148
- # @param [String] :config The switch config.
148
+ # @param config [String] The switch config.
149
149
  #
150
150
  # @return [Hash<Symbol, Object>] resource hash attribute. Returns
151
151
  # true if shutdown, false otherwise.
@@ -161,9 +161,9 @@ module Rbeapi
161
161
  #
162
162
  # @api private
163
163
  #
164
- # @param [String] :config The switch config.
164
+ # @param config [String] The switch config.
165
165
  #
166
- # @return [Hash<Symbol, Object>] resource hash attribute
166
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute.
167
167
  def parse_maximum_paths(config)
168
168
  values = config.scan(/maximum-paths\s+(\d+)\s+ecmp\s+(\d+)/).first
169
169
  { maximum_paths: values[0].to_i, maximum_ecmp_paths: values[1].to_i }
@@ -176,10 +176,9 @@ module Rbeapi
176
176
  #
177
177
  # @api private
178
178
  #
179
- # @param [String] :config The switch config.
179
+ # @param config [String] The switch config.
180
180
  #
181
- # @return [Hash<Symbol, Object>] resource hash attribute
182
- # @return [Array<Hash>] Single element hash with Array of network hashes
181
+ # @return [Array<Hash>] Single element hash with Array of network hashes.
183
182
  def parse_networks(config)
184
183
  networks = []
185
184
  lines = config.scan(%r{network (.+)/(\d+)(?: route-map (\w+))*})
@@ -196,16 +195,15 @@ module Rbeapi
196
195
  # Optional parameters can be passed in to initialize BGP specific
197
196
  # settings.
198
197
  #
199
- # @commands
198
+ # ===Commands
200
199
  # router bgp <bgp_as>
201
200
  #
202
- # @param [String] :bgp_as The BGP autonomous system number to be
201
+ # @param bgp_as [String] The BGP autonomous system number to be
203
202
  # configured for the local BGP routing instance.
204
203
  #
204
+ # @param opts [hash] Optional keyword arguments.
205
205
  #
206
- # @param [hash] :opts Optional keyword arguments
207
- #
208
- # @option :opts [String] :router_id The BGP routing process router-id
206
+ # @option opts router_id [String] The BGP routing process router-id
209
207
  # value. When no ID has been specified (i.e. value not set), the
210
208
  # local router ID is set to the following:
211
209
  # * The loopback IP address when a single loopback interface is
@@ -215,17 +213,17 @@ module Rbeapi
215
213
  # * The highest IP address on a physical interface when no loopback
216
214
  # interfaces are configure
217
215
  #
218
- # @option :opts [Integer] :maximum_paths Maximum number of equal cost
216
+ # @option opts maximum_paths [Integer] Maximum number of equal cost
219
217
  # paths.
220
218
  #
221
- # @option :opts [Integer] :maximum_ecmp_paths Maximum number of installed
219
+ # @option opts maximum_ecmp_paths [Integer] Maximum number of installed
222
220
  # ECMP routes. The maximum_paths option must be set if
223
221
  # maximum_ecmp_paths is set.
224
222
  #
225
- # @option :opts [Boolean] :enable If true then the BGP router is enabled.
223
+ # @option opts enable [Boolean] If true then the BGP router is enabled.
226
224
  # If false then the BGP router is disabled.
227
225
  #
228
- # @return [Boolean] returns true if the command completed successfully
226
+ # @return [Boolean] returns true if the command completed successfully.
229
227
  def create(bgp_as, opts = {})
230
228
  if opts[:maximum_ecmp_paths] && !opts[:maximum_paths]
231
229
  message = 'maximum_paths must be set if maximum_ecmp_paths is set'
@@ -249,10 +247,10 @@ module Rbeapi
249
247
  ##
250
248
  # delete will delete the BGP routing instance from the node.
251
249
  #
252
- # @commands
250
+ # ===Commands
253
251
  # no router bgp <bgp_as>
254
252
  #
255
- # @return [Boolean] returns true if the command completed successfully
253
+ # @return [Boolean] Returns true if the command completed successfully.
256
254
  def delete
257
255
  config = get
258
256
  return true unless config
@@ -264,7 +262,7 @@ module Rbeapi
264
262
  # keyword. This command has the same effect as deleting the BGP
265
263
  # routine instance from the nodes running configuration.
266
264
  #
267
- # @commands
265
+ # ===Commands
268
266
  # default router bgp <bgp_as>
269
267
  #
270
268
  # @return [Boolean] returns true if the command complete successfully
@@ -281,9 +279,9 @@ module Rbeapi
281
279
  #
282
280
  # @api private
283
281
  #
284
- # @param [String] :cmd Command to run under BGP mode
282
+ # @param cmd [String] Command to run under BGP mode.
285
283
  #
286
- # @return [Boolean] returns true if the command complete successfully
284
+ # @return [Boolean] Returns true if the command complete successfully.
287
285
  def configure_bgp(cmd)
288
286
  config = get_block('^router bgp .*')
289
287
  fail 'BGP router is not configured' unless config
@@ -296,14 +294,14 @@ module Rbeapi
296
294
  ##
297
295
  # set_router_id sets the router_id for the BGP routing instance.
298
296
  #
299
- # @commands
297
+ # ===Commands
300
298
  # router bgp <bgp_as>
301
299
  # {no | default} router-id <router_id>
302
300
  #
303
- # @param [hash] :opts Optional keyword arguments
301
+ # @param opts [hash] Optional keyword arguments
304
302
  #
305
- # @option :opts [String] :value The BGP routing process router-id
306
- # value. When no ID has been specified (i.e. value not set), the
303
+ # @option opts value [String] The BGP routing process router-id
304
+ # value. When no ID has been specified (i.e. value not set), the
307
305
  # local router ID is set to the following:
308
306
  # * The loopback IP address when a single loopback interface is
309
307
  # configured.
@@ -312,13 +310,13 @@ module Rbeapi
312
310
  # * The highest IP address on a physical interface when no loopback
313
311
  # interfaces are configure
314
312
  #
315
- # @option :opts [Boolean] :enable If false then the command is
313
+ # @option opts enable [Boolean] If false then the command is
316
314
  # negated. Default is true.
317
315
  #
318
- # @option :opts [Boolean] :default Configure the router-id using
319
- # the default keyword
316
+ # @option opts default [Boolean] Configure the router-id using
317
+ # the default keyword.
320
318
  #
321
- # @return [Boolean] returns true if the command complete successfully
319
+ # @return [Boolean] Returns true if the command complete successfully.
322
320
  def set_router_id(opts = {})
323
321
  configure_bgp(command_builder('router-id', opts))
324
322
  end
@@ -327,21 +325,21 @@ module Rbeapi
327
325
  # set_shutdown configures the administrative state for the global
328
326
  # BGP routing process. The value option is not used by this method.
329
327
  #
330
- # @commands
328
+ # ===Commands
331
329
  # router bgp <bgp_as>
332
330
  # {no | default} shutdown
333
331
  #
334
- # @param [hash] :opts Optional keyword arguments
332
+ # @param opts [hash] Optional keyword arguments.
335
333
  #
336
- # @option :opts [Boolean] :enable If enable is true then the BGP
334
+ # @option opts enable [Boolean] If enable is true then the BGP
337
335
  # routing process is administratively enabled and if enable is
338
336
  # False then the BGP routing process is administratively
339
337
  # disabled.
340
338
  #
341
- # @option :opts [Boolean] :default Configure the router-id using
342
- # the default keyword
339
+ # @option opts default [Boolean] Configure the router-id using
340
+ # the default keyword.
343
341
  #
344
- # @return [Boolean] returns true if the command complete successfully
342
+ # @return [Boolean] Returns true if the command complete successfully.
345
343
  def set_shutdown(opts = {})
346
344
  fail 'set_shutdown has the value option set' if opts[:value]
347
345
  # Shutdown semantics are opposite of enable semantics so invert enable
@@ -354,25 +352,25 @@ module Rbeapi
354
352
  # set_maximum_paths sets the maximum number of equal cost paths and
355
353
  # the maximum number of installed ECMP routes.
356
354
  #
357
- # @commands
355
+ # ===Commands
358
356
  # router bgp <bgp_as>
359
357
  # {no | default}
360
358
  # maximum-paths <maximum_paths> [ecmp <maximum_ecmp_paths>]
361
359
  #
362
- # @param [Integer] :maximum_paths Maximum number of equal cost paths.
360
+ # @param maximum_paths [Integer] Maximum number of equal cost paths.
363
361
  #
364
- # @param [Integer] :maximum_ecmp_paths Maximum number of installed ECMP
362
+ # @param maximum_ecmp_paths [Integer] Maximum number of installed ECMP
365
363
  # routes.
366
364
  #
367
- # @param [hash] :opts Optional keyword arguments
365
+ # @param opts [hash] Optional keyword arguments
368
366
  #
369
- # @option :opts [Boolean] :enable If false then the command is
367
+ # @option opts enable [Boolean] If false then the command is
370
368
  # negated. Default is true.
371
369
  #
372
- # @option :opts [Boolean] :default Configure the maximum paths using
373
- # the default keyword
370
+ # @option opts default [Boolean] Configure the maximum paths using
371
+ # the default keyword.
374
372
  #
375
- # @return [Boolean] returns true if the command complete successfully
373
+ # @return [Boolean] Returns true if the command complete successfully.
376
374
  def set_maximum_paths(maximum_paths, maximum_ecmp_paths, opts = {})
377
375
  enable = opts.fetch(:enable, true)
378
376
  default = opts[:default] || false
@@ -393,19 +391,21 @@ module Rbeapi
393
391
  ##
394
392
  # add_network creates a new instance of a BGP network on the node.
395
393
  #
396
- # @commands
394
+ # ===Commands
397
395
  # router bgp <bgp_as>
398
396
  # network <prefix>/<masklen>
399
397
  # route-map <route_map>
400
398
  #
401
- # @param [String] :prefix The IPv4 prefix to configure as part of
402
- # the network statement. The value must be a valid IPv4 prefix.
403
- # @param [String] :masklen The IPv4 subnet mask length in bits.
399
+ # @param prefix [String] The IPv4 prefix to configure as part of
400
+ # the network statement. The value must be a valid IPv4 prefix.
401
+ #
402
+ # @param masklen [String] The IPv4 subnet mask length in bits.
404
403
  # The masklen must be in the valid range of 1 to 32.
405
- # @param [String] :route_map The route-map name to apply to the
404
+ #
405
+ # @param route_map [String] The route-map name to apply to the
406
406
  # network statement when configured.
407
407
  #
408
- # @return [Boolean] returns true if the command complete successfully
408
+ # @return [Boolean] Returns true if the command complete successfully.
409
409
  def add_network(prefix, masklen, route_map = nil)
410
410
  cmd = "network #{prefix}/#{masklen}"
411
411
  cmd << " route-map #{route_map}" if route_map
@@ -415,18 +415,20 @@ module Rbeapi
415
415
  ##
416
416
  # remove_network removes the instance of a BGP network on the node.
417
417
  #
418
- # @commands
418
+ # ===Commands
419
419
  # router bgp <bgp_as>
420
420
  # {no} shutdown
421
421
  #
422
- # @param [String] :prefix The IPv4 prefix to configure as part of
422
+ # @param prefix [String] The IPv4 prefix to configure as part of
423
423
  # the network statement. The value must be a valid IPv4 prefix.
424
- # @param [String] :masklen The IPv4 subnet mask length in bits.
424
+ #
425
+ # @param masklen [String] The IPv4 subnet mask length in bits.
425
426
  # The masklen must be in the valid range of 1 to 32.
426
- # @param [String] :route_map The route-map name to apply to the
427
+ #
428
+ # @param route_map [String] The route-map name to apply to the
427
429
  # network statement when configured.
428
430
  #
429
- # @return [Boolean] returns true if the command complete successfully
431
+ # @return [Boolean] Returns true if the command complete successfully.
430
432
  def remove_network(prefix, masklen, route_map = nil)
431
433
  cmd = "no network #{prefix}/#{masklen}"
432
434
  cmd << " route-map #{route_map}" if route_map
@@ -453,7 +455,7 @@ module Rbeapi
453
455
  # route_map_out: <string>
454
456
  # }
455
457
  #
456
- # @param [String] :name The name of the BGP neighbor to manage.
458
+ # @param name [String] The name of the BGP neighbor to manage.
457
459
  # This value can be either an IPv4 address or string (in the
458
460
  # case of managing a peer group).
459
461
  #
@@ -525,12 +527,13 @@ module Rbeapi
525
527
  #
526
528
  # @api private
527
529
  #
528
- # @param [String] :config The switch config.
529
- # @param [String] :name The name of the BGP neighbor to manage.
530
+ # @param config [String] The switch config.
531
+ #
532
+ # @param name [String] The name of the BGP neighbor to manage.
530
533
  # This value can be either an IPv4 address or string (in the
531
534
  # case of managing a peer group).
532
535
  #
533
- # @return [Hash<Symbol, Object>] resource hash attribute
536
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute.
534
537
  def parse_peer_group(config, name)
535
538
  value = config.scan(/neighbor #{name} peer-group ([^\s]+)/)
536
539
  peer_group = value[0] ? value[0][0] : nil
@@ -544,12 +547,13 @@ module Rbeapi
544
547
  #
545
548
  # @api private
546
549
  #
547
- # @param [String] :config The switch config.
548
- # @param [String] :name The name of the BGP neighbor to manage.
550
+ # @param config [String] The switch config.
551
+ #
552
+ # @param name [String] The name of the BGP neighbor to manage.
549
553
  # This value can be either an IPv4 address or string (in the
550
554
  # case of managing a peer group).
551
555
  #
552
- # @return [Hash<Symbol, Object>] resource hash attribute
556
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute
553
557
  def parse_remote_as(config, name)
554
558
  value = config.scan(/neighbor #{name} remote-as (\d+)/)
555
559
  remote_as = value[0] ? value[0][0] : nil
@@ -563,12 +567,13 @@ module Rbeapi
563
567
  #
564
568
  # @api private
565
569
  #
566
- # @param [String] :config The switch config.
567
- # @param [String] :name The name of the BGP neighbor to manage.
570
+ # @param config [String] The switch config.
571
+ #
572
+ # @param name [String] The name of the BGP neighbor to manage.
568
573
  # This value can be either an IPv4 address or string (in the
569
574
  # case of managing a peer group).
570
575
  #
571
- # @return [Hash<Symbol, Object>] resource hash attribute
576
+ # @return [Hash<Symbol, Object>] Returns the resource hash attribute.
572
577
  def parse_send_community(config, name)
573
578
  value = config.scan(/no neighbor #{name} send-community/)
574
579
  enabled = value[0] ? false : true
@@ -582,13 +587,14 @@ module Rbeapi
582
587
  #
583
588
  # @api private
584
589
  #
585
- # @param [String] :config The switch config.
586
- # @param [String] :name The name of the BGP neighbor to manage.
590
+ # @param config [String] The switch config.
591
+ #
592
+ # @param name [String] The name of the BGP neighbor to manage.
587
593
  # This value can be either an IPv4 address or string (in the
588
594
  # case of managing a peer group).
589
595
  #
590
- # @return [Hash<Symbol, Object>] resource hash attribute. Returns
591
- # true if shutdown, false otherwise.
596
+ # @return [Hash<Symbol, Object>] Resource hash attribute. Returns
597
+ # true if shutdown, false otherwise.
592
598
  def parse_shutdown(config, name)
593
599
  value = config.scan(/no neighbor #{name} shutdown/)
594
600
  shutdown = value[0] ? false : true
@@ -602,12 +608,14 @@ module Rbeapi
602
608
  #
603
609
  # @api private
604
610
  #
605
- # @param [String] :config The switch config.
606
- # @param [String] :name The name of the BGP neighbor to manage.
611
+ # @param config [String] The switch config.
612
+ #
613
+ # @param name [String] The name of the BGP neighbor to manage.
607
614
  # This value can be either an IPv4 address or string (in the
608
615
  # case of managing a peer group).
609
616
  #
610
- # @return [Hash<Symbol, Object>] resource hash attribute
617
+ # @return [Hash<Symbol, Object>] Returns the resource hash
618
+ # attribute.
611
619
  def parse_description(config, name)
612
620
  value = config.scan(/neighbor #{name} description (.*)$/)
613
621
  description = value[0] ? value[0][0] : nil
@@ -621,12 +629,13 @@ module Rbeapi
621
629
  #
622
630
  # @api private
623
631
  #
624
- # @param [String] :config The switch config.
625
- # @param [String] :name The name of the BGP neighbor to manage.
632
+ # @param config [String] The switch config.
633
+ # @param name [String] The name of the BGP neighbor to manage.
626
634
  # This value can be either an IPv4 address or string (in the
627
635
  # case of managing a peer group).
628
636
  #
629
- # @return [Hash<Symbol, Object>] resource hash attribute
637
+ # @return [Hash<Symbol, Object>] Returns the resource hash
638
+ # attribute.
630
639
  def parse_next_hop_self(config, name)
631
640
  value = config.scan(/no neighbor #{name} next-hop-self/)
632
641
  enabled = value[0] ? false : true
@@ -640,12 +649,14 @@ module Rbeapi
640
649
  #
641
650
  # @api private
642
651
  #
643
- # @param [String] :config The switch config.
644
- # @param [String] :name The name of the BGP neighbor to manage.
652
+ # @param config [String] The switch config.
653
+ #
654
+ # @param name [String] The name of the BGP neighbor to manage.
645
655
  # This value can be either an IPv4 address or string (in the
646
656
  # case of managing a peer group).
647
657
  #
648
- # @return [Hash<Symbol, Object>] resource hash attribute
658
+ # @return [Hash<Symbol, Object>] Returns the resource hash
659
+ # attribute.
649
660
  def parse_route_map_in(config, name)
650
661
  value = config.scan(/neighbor #{name} route-map ([^\s]+) in/)
651
662
  route_map_in = value[0] ? value[0][0] : nil
@@ -659,12 +670,14 @@ module Rbeapi
659
670
  #
660
671
  # @api private
661
672
  #
662
- # @param [String] :config The switch config.
663
- # @param [String] :name The name of the BGP neighbor to manage.
673
+ # @param config [String] The switch config.
674
+ #
675
+ # @param name [String] The name of the BGP neighbor to manage.
664
676
  # This value can be either an IPv4 address or string (in the
665
677
  # case of managing a peer group).
666
678
  #
667
- # @return [Hash<Symbol, Object>] resource hash attribute
679
+ # @return [Hash<Symbol, Object>] Returns the resource hash
680
+ # attribute.
668
681
  def parse_route_map_out(config, name)
669
682
  value = config.scan(/neighbor #{name} route-map ([^\s]+) out/)
670
683
  route_map_out = value[0] ? value[0][0] : nil
@@ -679,9 +692,9 @@ module Rbeapi
679
692
  #
680
693
  # @api private
681
694
  #
682
- # @param [String] :cmd Command to run under BGP mode
695
+ # @param cmd [String] Command to run under BGP mode.
683
696
  #
684
- # @return [Boolean] returns true if the command complete successfully
697
+ # @return [Boolean] Returns true if the command complete successfully.
685
698
  def configure_bgp(cmd)
686
699
  config = get_block('^router bgp .*')
687
700
  fail 'BGP router is not configured' unless config
@@ -695,11 +708,11 @@ module Rbeapi
695
708
  # create will create a new instance of a BGP neighbor on the node.
696
709
  # The neighbor is created in the shutdown state and then enabled.
697
710
  #
698
- # @param [String] :name The name of the BGP neighbor to manage.
711
+ # @param name [String] The name of the BGP neighbor to manage.
699
712
  # This value can be either an IPv4 address or string (in the
700
713
  # case of managing a peer group).
701
714
  #
702
- # @return [Boolean] returns true if the command completed successfully
715
+ # @return [Boolean] Returns true if the command completed successfully.
703
716
  def create(name)
704
717
  set_shutdown(name, enable: false)
705
718
  end
@@ -707,16 +720,16 @@ module Rbeapi
707
720
  ##
708
721
  # delete will delete the BGP neighbor from the node.
709
722
  #
710
- # @commands
723
+ # ===Commands
711
724
  # no neighbor <name>
712
725
  # or
713
726
  # no neighbor <name> peer-group
714
727
  #
715
- # @param [String] :name The name of the BGP neighbor to manage.
728
+ # @param name [String] The name of the BGP neighbor to manage.
716
729
  # This value can be either an IPv4 address or string (in the
717
730
  # case of managing a peer group).
718
731
  #
719
- # @return [Boolean] returns true if the command completed successfully
732
+ # @return [Boolean] Returns true if the command completed successfully.
720
733
  def delete(name)
721
734
  cmd = "no neighbor #{name}"
722
735
  response = configure_bgp(cmd)
@@ -728,21 +741,23 @@ module Rbeapi
728
741
  end
729
742
 
730
743
  ##
731
- # neigh_command_builder for neighbors which calls command_builder
744
+ # neigh_command_builder for neighbors which calls command_builder.
745
+ #
746
+ # @param name [String] The name of the BGP neighbor to manage.
732
747
  #
733
- # @param [String] :name The name of the BGP neighbor to manage.
734
- # @param [String] :cmd The command portion of the neighbor command.
735
- # @param [hash] :opts Optional keyword arguments
748
+ # @param cmd [String] The command portion of the neighbor command.
736
749
  #
737
- # @option :opts [String] :value Value being set.
750
+ # @param opts [hash] Optional keyword arguments.
738
751
  #
739
- # @option :opts [Boolean] :enable If false then the command is
752
+ # @option opts value [String] Value being set.
753
+ #
754
+ # @option opts enable [Boolean] If false then the command is
740
755
  # negated. Default is true.
741
756
  #
742
- # @option :opts [Boolean] :default Configure the command using
757
+ # @option opts default [Boolean] Configure the command using
743
758
  # the default keyword.
744
759
  #
745
- # @return [String] Returns built command string
760
+ # @return [String] Returns built command string.
746
761
  def neigh_command_builder(name, cmd, opts)
747
762
  command_builder("neighbor #{name} #{cmd}", opts)
748
763
  end
@@ -750,22 +765,23 @@ module Rbeapi
750
765
  ##
751
766
  # set_peer_group creates a BGP static peer group name.
752
767
  #
753
- # @commands
768
+ # ===Commands
754
769
  # router bgp <bgp_as>
755
770
  # {no | default} neighbor <name> peer-group <group-name>
756
771
  #
757
- # @param [String] :name The IP address of the neighbor
758
- # @param [hash] :opts Optional keyword arguments
772
+ # @param name [String] The IP address of the neighbor.
773
+ #
774
+ # @param opts [hash] Optional keyword arguments.
759
775
  #
760
- # @option :opts [String] :value The group name.
776
+ # @option opts value [String] The group name.
761
777
  #
762
- # @option :opts [Boolean] :enable If false then the command is
778
+ # @option opts enable [Boolean] If false then the command is
763
779
  # negated. Default is true.
764
780
  #
765
- # @option :opts [Boolean] :default Configure the peer group using
766
- # the default keyword
781
+ # @option opts default [Boolean] Configure the peer group using
782
+ # the default keyword.
767
783
  #
768
- # @return [Boolean] returns true if the command complete successfully
784
+ # @return [Boolean] Returns true if the command complete successfully.
769
785
  def set_peer_group(name, opts = {})
770
786
  configure_bgp(neigh_command_builder(name, 'peer-group', opts))
771
787
  end
@@ -774,22 +790,23 @@ module Rbeapi
774
790
  # set_remote_as configures the expected AS number for a neighbor
775
791
  # (peer).
776
792
  #
777
- # @commands
793
+ # ===Commands
778
794
  # router bgp <bgp_as>
779
795
  # {no | default} neighbor <name> remote-as <as-id>
780
796
  #
781
- # @param [String] :name The IP address or name of the peer group.
782
- # @param [hash] :opts Optional keyword arguments
797
+ # @param name [String] The IP address or name of the peer group.
783
798
  #
784
- # @option :opts [String] :value The remote as-id.
799
+ # @param opts [hash] Optional keyword arguments.
785
800
  #
786
- # @option :opts [Boolean] :enable If false then the command is
801
+ # @option opts value [String] The remote as-id.
802
+ #
803
+ # @option opts enable [Boolean] If false then the command is
787
804
  # negated. Default is true.
788
805
  #
789
- # @option :opts [Boolean] :default Configure the peer group using
790
- # the default keyword
806
+ # @option opts default [Boolean] Configure the peer group using
807
+ # the default keyword.
791
808
  #
792
- # @return [Boolean] returns true if the command complete successfully
809
+ # @return [Boolean] Returns true if the command complete successfully.
793
810
  def set_remote_as(name, opts = {})
794
811
  configure_bgp(neigh_command_builder(name, 'remote-as', opts))
795
812
  end
@@ -798,23 +815,24 @@ module Rbeapi
798
815
  # set_shutdown disables the specified neighbor. The value option is
799
816
  # not used by this method.
800
817
  #
801
- # @commands
818
+ # ===Commands
802
819
  # router bgp <bgp_as>
803
820
  # {no | default} neighbor <name> shutdown
804
821
  #
805
- # @param [String] :name The IP address or name of the peer group.
806
- # @param [hash] :opts Optional keyword arguments
822
+ # @param name [String] The IP address or name of the peer group.
807
823
  #
808
- # @option :opts [String] :enable True enables the specified neighbor.
824
+ # @param opts [hash] Optional keyword arguments.
825
+ #
826
+ # @option opts enable [String] True enables the specified neighbor.
809
827
  # False disables the specified neighbor.
810
828
  #
811
- # @option :opts [Boolean] :default Configure the peer group using
812
- # the default keyword
829
+ # @option opts default [Boolean] Configure the peer group using
830
+ # the default keyword.
813
831
  #
814
- # @return [Boolean] returns true if the command complete successfully
832
+ # @return [Boolean] Returns true if the command complete successfully.
815
833
  def set_shutdown(name, opts = {})
816
834
  fail 'set_shutdown has value option set' if opts[:value]
817
- # Shutdown semantics are opposite of enable semantics so invert enable
835
+ # Shutdown semantics are opposite of enable semantics so invert enable.
818
836
  value = !opts[:enable]
819
837
  opts.merge!(enable: value)
820
838
  configure_bgp(neigh_command_builder(name, 'shutdown', opts))
@@ -825,20 +843,21 @@ module Rbeapi
825
843
  # attributes to the specified BGP neighbor. The value option is
826
844
  # not used by this method.
827
845
  #
828
- # @commands
846
+ # ===Commands
829
847
  # router bgp <bgp_as>
830
848
  # {no | default} neighbor <name> send-community
831
849
  #
832
- # @param [String] :name The IP address or name of the peer group.
833
- # @param [hash] :opts Optional keyword arguments
850
+ # @param name [String] The IP address or name of the peer group.
851
+ #
852
+ # @param opts [hash] Optional keyword arguments.
834
853
  #
835
- # @option :opts [String] :enable True enables the feature. False
854
+ # @option opts enable [String] True enables the feature. False
836
855
  # disables the feature.
837
856
  #
838
- # @option :opts [Boolean] :default Configure the peer group using
839
- # the default keyword
857
+ # @option opts default [Boolean] Configure the peer group using
858
+ # the default keyword.
840
859
  #
841
- # @return [Boolean] returns true if the command complete successfully
860
+ # @return [Boolean] Returns true if the command complete successfully.
842
861
  def set_send_community(name, opts = {})
843
862
  fail 'send_community has the value option set' if opts[:value]
844
863
  configure_bgp(neigh_command_builder(name, 'send-community', opts))
@@ -850,20 +869,21 @@ module Rbeapi
850
869
  # BGP-speaking neighbor or neighbors in the specified peer group.
851
870
  # The value option is not used by this method.
852
871
  #
853
- # @commands
872
+ # ===Commands
854
873
  # router bgp <bgp_as>
855
874
  # {no | default} neighbor <name> next-hop-self
856
875
  #
857
- # @param [String] :name The IP address or name of the peer group.
858
- # @param [hash] :opts Optional keyword arguments
876
+ # @param name [String] The IP address or name of the peer group.
877
+ #
878
+ # @param opts [hash] Optional keyword arguments.
859
879
  #
860
- # @option :opts [String] :enable True enables the feature. False
880
+ # @option opts enable [String] True enables the feature. False
861
881
  # disables the feature.
862
882
  #
863
- # @option :opts [Boolean] :default Configure the peer group using
864
- # the default keyword
883
+ # @option opts default [Boolean] Configure the peer group using
884
+ # the default keyword.
865
885
  #
866
- # @return [Boolean] returns true if the command complete successfully
886
+ # @return [Boolean] Returns true if the command complete successfully.
867
887
  def set_next_hop_self(name, opts = {})
868
888
  fail 'set_next_hop_self has the value option set' if opts[:value]
869
889
  configure_bgp(neigh_command_builder(name, 'next-hop-self', opts))
@@ -873,22 +893,23 @@ module Rbeapi
873
893
  # set_route_map_in command applies a route map to inbound BGP
874
894
  # routes.
875
895
  #
876
- # @commands
896
+ # ===Commands
877
897
  # router bgp <bgp_as>
878
898
  # {no | default} neighbor <name> route-map <name> in
879
899
  #
880
- # @param [String] :name The IP address or name of the peer group.
881
- # @param [hash] :opts Optional keyword arguments
900
+ # @param name [String] The IP address or name of the peer group.
882
901
  #
883
- # @option :opts [String] :value Name of a route map.
902
+ # @param opts [hash] Optional keyword arguments.
884
903
  #
885
- # @option :opts [Boolean] :enable If false then the command is
904
+ # @option opts value [String] Name of a route map.
905
+ #
906
+ # @option opts enable [Boolean] If false then the command is
886
907
  # negated. Default is true.
887
908
  #
888
- # @option :opts [Boolean] :default Configure the peer group using
889
- # the default keyword
909
+ # @option opts default [Boolean] Configure the peer group using
910
+ # the default keyword.
890
911
  #
891
- # @return [Boolean] returns true if the command complete successfully
912
+ # @return [Boolean] Returns true if the command complete successfully.
892
913
  def set_route_map_in(name, opts = {})
893
914
  cmd = neigh_command_builder(name, 'route-map', opts) + ' in'
894
915
  configure_bgp(cmd)
@@ -898,22 +919,23 @@ module Rbeapi
898
919
  # set_route_map_out command applies a route map to outbound BGP
899
920
  # routes.
900
921
  #
901
- # @commands
922
+ # ===Commands
902
923
  # router bgp <bgp_as>
903
924
  # {no | default} neighbor <name> route-map <name> out
904
925
  #
905
- # @param [String] :name The IP address or name of the peer group.
906
- # @param [hash] :opts Optional keyword arguments
926
+ # @param name [String] The IP address or name of the peer group.
907
927
  #
908
- # @option :opts [String] :value Name of a route map.
928
+ # @param opts [hash] Optional keyword arguments.
909
929
  #
910
- # @option :opts [Boolean] :enable If false then the command is
930
+ # @option opts value [String] Name of a route map.
931
+ #
932
+ # @option opts enable [Boolean] If false then the command is
911
933
  # negated. Default is true.
912
934
  #
913
- # @option :opts [Boolean] :default Configure the peer group using
914
- # the default keyword
935
+ # @option opts default [Boolean] Configure the peer group using
936
+ # the default keyword.
915
937
  #
916
- # @return [Boolean] returns true if the command complete successfully
938
+ # @return [Boolean] Returns true if the command complete successfully.
917
939
  def set_route_map_out(name, opts = {})
918
940
  cmd = neigh_command_builder(name, 'route-map', opts) + ' out'
919
941
  configure_bgp(cmd)
@@ -923,22 +945,23 @@ module Rbeapi
923
945
  # set_description associates descriptive text with the specified
924
946
  # peer or peer group.
925
947
  #
926
- # @commands
948
+ # ===Commands
927
949
  # router bgp <bgp_as>
928
950
  # {no | default} neighbor <name> description <string>
929
951
  #
930
- # @param [String] :name The IP address or name of the peer group.
931
- # @param [hash] :opts Optional keyword arguments
952
+ # @param name [String] The IP address or name of the peer group.
932
953
  #
933
- # @option :opts [String] :value The description string.
954
+ # @param opts [hash] Optional keyword arguments.
934
955
  #
935
- # @option :opts [Boolean] :enable If false then the command is
956
+ # @option opts value [String] The description string.
957
+ #
958
+ # @option opts enable [Boolean] If false then the command is
936
959
  # negated. Default is true.
937
960
  #
938
- # @option :opts [Boolean] :default Configure the peer group using
939
- # the default keyword
961
+ # @option opts default [Boolean] Configure the peer group using
962
+ # the default keyword.
940
963
  #
941
- # @return [Boolean] returns true if the command complete successfully
964
+ # @return [Boolean] Returns true if the command complete successfully.
942
965
  def set_description(name, opts = {})
943
966
  configure_bgp(neigh_command_builder(name, 'description', opts))
944
967
  end