rbeapi 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +17 -12
- data/guide/.gitignore +2 -0
- data/guide/api.rst +5894 -0
- data/guide/conf.py +5 -5
- data/guide/contributing.rst +6 -0
- data/guide/getting-started.rst +134 -0
- data/guide/index.rst +3 -5
- data/guide/installation.rst +56 -1
- data/guide/license.rst +13 -2
- data/guide/overview.rst +2 -5
- data/guide/testing.rst +5 -1
- data/guide/upgrading.rst +10 -0
- data/lib/rbeapi/api.rb +37 -36
- data/lib/rbeapi/api/aaa.rb +90 -90
- data/lib/rbeapi/api/acl.rb +70 -53
- data/lib/rbeapi/api/bgp.rb +186 -163
- data/lib/rbeapi/api/dns.rb +51 -45
- data/lib/rbeapi/api/interfaces.rb +344 -328
- data/lib/rbeapi/api/ipinterfaces.rb +92 -92
- data/lib/rbeapi/api/logging.rb +32 -32
- data/lib/rbeapi/api/mlag.rb +97 -97
- data/lib/rbeapi/api/ntp.rb +39 -39
- data/lib/rbeapi/api/ospf.rb +58 -58
- data/lib/rbeapi/api/prefixlists.rb +22 -22
- data/lib/rbeapi/api/radius.rb +77 -49
- data/lib/rbeapi/api/routemaps.rb +110 -64
- data/lib/rbeapi/api/snmp.rb +104 -100
- data/lib/rbeapi/api/staticroutes.rb +27 -20
- data/lib/rbeapi/api/stp.rb +100 -84
- data/lib/rbeapi/api/switchports.rb +98 -77
- data/lib/rbeapi/api/system.rb +93 -25
- data/lib/rbeapi/api/tacacs.rb +54 -35
- data/lib/rbeapi/api/users.rb +68 -68
- data/lib/rbeapi/api/varp.rb +56 -47
- data/lib/rbeapi/api/vlans.rb +86 -86
- data/lib/rbeapi/api/vrrp.rb +210 -173
- data/lib/rbeapi/client.rb +142 -108
- data/lib/rbeapi/eapilib.rb +73 -62
- data/lib/rbeapi/utils.rb +8 -8
- data/lib/rbeapi/version.rb +2 -2
- data/spec/fixtures/test.conf +3 -3
- data/spec/system/rbeapi/api/system_spec.rb +46 -2
- data/spec/system/rbeapi/api/vlans_spec.rb +5 -2
- data/spec/system/rbeapi/client_spec.rb +4 -4
- data/spec/unit/rbeapi/api/system/default_spec.rb +40 -4
- data/spec/unit/rbeapi/api/system/fixture_system.text +14 -0
- data/spec/unit/rbeapi/api/vlans/default_spec.rb +1 -1
- data/spec/unit/rbeapi/api/vlans/fixture_vlans.text +2 -0
- data/spec/unit/rbeapi/client_spec.rb +1 -0
- metadata +9 -9
- data/guide/cookbook.rst +0 -4
- data/guide/developing.rst +0 -4
- data/guide/faq.rst +0 -4
- data/guide/quickstart.rst +0 -4
- data/guide/troubleshooting.rst +0 -1
data/lib/rbeapi/api/vrrp.rb
CHANGED
@@ -32,10 +32,10 @@
|
|
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
41
|
# The Vrrp class manages the set of virtual routers.
|
@@ -74,7 +74,7 @@ module Rbeapi
|
|
74
74
|
# }
|
75
75
|
# }
|
76
76
|
#
|
77
|
-
# @param [String]
|
77
|
+
# @param name [String] The layer 3 interface name.
|
78
78
|
#
|
79
79
|
# @return [nil, Hash<Symbol, Object>] Returns the VRRP resource as a
|
80
80
|
# Hash with the virtual router ID as the key. If the interface name
|
@@ -128,7 +128,7 @@ module Rbeapi
|
|
128
128
|
#
|
129
129
|
# @return [nil, Hash<Symbol, Object>] Returns a hash that represents
|
130
130
|
# the entire virtual router IPs collection for all the layer 3
|
131
|
-
# interfaces from the nodes running configuration.
|
131
|
+
# interfaces from the nodes running configuration. If there are no
|
132
132
|
# virtual routers configured, this method will return an empty hash.
|
133
133
|
def getall
|
134
134
|
interfaces = config.scan(/(?<=^interface\s).+$/)
|
@@ -144,8 +144,9 @@ module Rbeapi
|
|
144
144
|
#
|
145
145
|
# @api private
|
146
146
|
#
|
147
|
-
# @param [String]
|
148
|
-
#
|
147
|
+
# @param config [String] The interface config.
|
148
|
+
#
|
149
|
+
# @param vrid [String] The virtual router id.
|
149
150
|
#
|
150
151
|
# @return [Hash<'primary_ip', String>] Where string is the IPv4
|
151
152
|
# address or nil if the value is not set.
|
@@ -166,8 +167,9 @@ module Rbeapi
|
|
166
167
|
#
|
167
168
|
# @api private
|
168
169
|
#
|
169
|
-
# @param [String]
|
170
|
-
#
|
170
|
+
# @param config [String] The interface config.
|
171
|
+
#
|
172
|
+
# @param vrid [String] The virtual router id.
|
171
173
|
#
|
172
174
|
# @return [Hash<'priority', Integer>] The priority is between
|
173
175
|
# <1-255> or nil if the value is not set.
|
@@ -188,8 +190,9 @@ module Rbeapi
|
|
188
190
|
#
|
189
191
|
# @api private
|
190
192
|
#
|
191
|
-
# @param [String]
|
192
|
-
#
|
193
|
+
# @param config [String] The interface config.
|
194
|
+
#
|
195
|
+
# @param vrid [String] The virtual router id.
|
193
196
|
#
|
194
197
|
# @return [nil, Hash<'timers_advertise', Integer>] The timers_advertise
|
195
198
|
# is between <1-255> or nil if the value is not set.
|
@@ -210,8 +213,9 @@ module Rbeapi
|
|
210
213
|
#
|
211
214
|
# @api private
|
212
215
|
#
|
213
|
-
# @param [String]
|
214
|
-
#
|
216
|
+
# @param config [String] The interface config.
|
217
|
+
#
|
218
|
+
# @param vrid [String] The virtual router id.
|
215
219
|
#
|
216
220
|
# @return [nil, Hash<'preempt', Integer>] The preempt is
|
217
221
|
# between <1-255> or nil if the value is not set.
|
@@ -232,8 +236,9 @@ module Rbeapi
|
|
232
236
|
#
|
233
237
|
# @api private
|
234
238
|
#
|
235
|
-
# @param [String]
|
236
|
-
#
|
239
|
+
# @param config [String] The interface config.
|
240
|
+
#
|
241
|
+
# @param vrid [String] The virtual router id.
|
237
242
|
#
|
238
243
|
# @return [Hash<'enable', Boolean>]
|
239
244
|
def parse_enable(config, vrid)
|
@@ -253,8 +258,9 @@ module Rbeapi
|
|
253
258
|
#
|
254
259
|
# @api private
|
255
260
|
#
|
256
|
-
# @param [String]
|
257
|
-
#
|
261
|
+
# @param config [String] The interface config.
|
262
|
+
#
|
263
|
+
# @param vrid [String] The virtual router id.
|
258
264
|
#
|
259
265
|
# @return [nil, Hash<'secondary_ip', Array<Strings>>] Returns an empty
|
260
266
|
# array if the value is not set.
|
@@ -275,8 +281,9 @@ module Rbeapi
|
|
275
281
|
#
|
276
282
|
# @api private
|
277
283
|
#
|
278
|
-
# @param [String]
|
279
|
-
#
|
284
|
+
# @param config [String] The interface config.
|
285
|
+
#
|
286
|
+
# @param vrid [String] The virtual router id.
|
280
287
|
#
|
281
288
|
# @return [nil, Hash<'secondary_ip', String>] Returns nil if the
|
282
289
|
# value is not set.
|
@@ -297,8 +304,9 @@ module Rbeapi
|
|
297
304
|
#
|
298
305
|
# @api private
|
299
306
|
#
|
300
|
-
# @param [String]
|
301
|
-
#
|
307
|
+
# @param config [String] The interface config.
|
308
|
+
#
|
309
|
+
# @param vrid [String] The virtual router id.
|
302
310
|
#
|
303
311
|
# @return [Hash<'track', Array<Hashes>] Returns an empty array if the
|
304
312
|
# value is not set. An example array of hashes follows:
|
@@ -325,8 +333,9 @@ module Rbeapi
|
|
325
333
|
#
|
326
334
|
# @api private
|
327
335
|
#
|
328
|
-
# @param [String]
|
329
|
-
#
|
336
|
+
# @param config [String] The interface config.
|
337
|
+
#
|
338
|
+
# @param vrid [String] The virtual router id.
|
330
339
|
#
|
331
340
|
# @return [Hash<'ip_version', Integer>] Returns nil if the
|
332
341
|
# value is not set.
|
@@ -348,8 +357,9 @@ module Rbeapi
|
|
348
357
|
#
|
349
358
|
# @api private
|
350
359
|
#
|
351
|
-
# @param [String]
|
352
|
-
#
|
360
|
+
# @param config [String] The interface config.
|
361
|
+
#
|
362
|
+
# @param vrid [String] The virtual router id.
|
353
363
|
#
|
354
364
|
# @return [Hash<'mac_addr_adv_interval', Integer>] Returns nil if the
|
355
365
|
# value is not set.
|
@@ -368,12 +378,13 @@ module Rbeapi
|
|
368
378
|
|
369
379
|
##
|
370
380
|
# parse_preempt_delay_min scans the nodes configurations for the given
|
371
|
-
# virtual router id and extracts the preempt delay minimum value
|
381
|
+
# virtual router id and extracts the preempt delay minimum value.
|
372
382
|
#
|
373
383
|
# @api private
|
374
384
|
#
|
375
|
-
# @param [String]
|
376
|
-
#
|
385
|
+
# @param config [String] The interface config.
|
386
|
+
#
|
387
|
+
# @param vrid [String] The virtual router id.
|
377
388
|
#
|
378
389
|
# @return [Hash<'preempt_delay_min', Integer>] Returns nil if the
|
379
390
|
# value is not set.
|
@@ -394,8 +405,9 @@ module Rbeapi
|
|
394
405
|
#
|
395
406
|
# @api private
|
396
407
|
#
|
397
|
-
# @param [String]
|
398
|
-
#
|
408
|
+
# @param config [String] The interface config.
|
409
|
+
#
|
410
|
+
# @param vrid [String] The virtual router id.
|
399
411
|
#
|
400
412
|
# @return [Hash<'preempt_delay_reload', Integer>] Returns nil if the
|
401
413
|
# value is not set.
|
@@ -416,10 +428,11 @@ module Rbeapi
|
|
416
428
|
#
|
417
429
|
# @api private
|
418
430
|
#
|
419
|
-
# @param [String]
|
420
|
-
#
|
431
|
+
# @param config [String] The interface config.
|
432
|
+
#
|
433
|
+
# @param vrid [String] The virtual router id.
|
421
434
|
#
|
422
|
-
# @return [Hash<'delay_reload', Integer>] Returns empty hash
|
435
|
+
# @return [Hash<'delay_reload', Integer>] Returns empty hash if the
|
423
436
|
# value is not set.
|
424
437
|
def parse_delay_reload(config, vrid)
|
425
438
|
match = config.scan(/^\s+vrrp #{vrid} delay reload (\d+)$/)
|
@@ -434,69 +447,69 @@ module Rbeapi
|
|
434
447
|
|
435
448
|
##
|
436
449
|
# create will create a new virtual router ID resource for the interface
|
437
|
-
# in the nodes current.
|
450
|
+
# in the nodes current. If the create method is called and the virtual
|
438
451
|
# router ID already exists for the interface, this method will still
|
439
|
-
# return true.
|
452
|
+
# return true. Create takes optional parameters, but at least one
|
440
453
|
# parameter needs to be set or the command will fail.
|
441
454
|
#
|
442
|
-
# @eos_version 4.13.7M
|
455
|
+
# @since eos_version 4.13.7M
|
443
456
|
#
|
444
|
-
#
|
457
|
+
# ===Commands
|
445
458
|
# interface <name>
|
446
459
|
# vrrp <vrid> ...
|
447
460
|
#
|
448
|
-
# @param [String]
|
461
|
+
# @param name [String] The layer 3 interface name.
|
449
462
|
#
|
450
|
-
# @param [String]
|
463
|
+
# @param vrid [String] The virtual router id.
|
451
464
|
#
|
452
|
-
# @param [hash]
|
465
|
+
# @param opts [hash] Optional keyword arguments.
|
453
466
|
#
|
454
|
-
# @option
|
467
|
+
# @option opts enable [Boolean] Enable the virtual router.
|
455
468
|
#
|
456
|
-
# @option
|
469
|
+
# @option opts primary_ip [String] The primary IPv4 address.
|
457
470
|
#
|
458
|
-
# @option
|
471
|
+
# @option opts priority [Integer] The priority setting for a virtual
|
459
472
|
# router.
|
460
473
|
#
|
461
|
-
# @option
|
474
|
+
# @option opts description [String] Associates a text string to a
|
462
475
|
# virtual router.
|
463
476
|
#
|
464
|
-
# @option
|
477
|
+
# @option opts secondary_ip [Array<String>] The secondary IPv4
|
465
478
|
# address to the specified virtual router.
|
466
479
|
#
|
467
|
-
# @option
|
480
|
+
# @option opts ip_version [Integer] Configures the VRRP version for
|
468
481
|
# the VRRP router.
|
469
482
|
#
|
470
|
-
# @option
|
483
|
+
# @option opts timers_advertise [Integer] The interval between
|
471
484
|
# successive advertisement messages that the switch sends to routers
|
472
485
|
# in the specified virtual router ID.
|
473
486
|
#
|
474
|
-
# @option
|
487
|
+
# @option opts mac_addr_adv_interval [Integer] Specifies interval in
|
475
488
|
# seconds between advertisement packets sent to VRRP group members.
|
476
489
|
#
|
477
|
-
# @option
|
490
|
+
# @option opts preempt [Boolean] A virtual router preempt mode
|
478
491
|
# setting. When preempt mode is enabled, if the switch has a higher
|
479
492
|
# priority it will preempt the current master virtual router. When
|
480
493
|
# preempt mode is disabled, the switch can become the master virtual
|
481
494
|
# router only when a master virtual router is not present on the
|
482
495
|
# subnet, regardless of priority settings.
|
483
496
|
#
|
484
|
-
# @option
|
497
|
+
# @option opts preempt_delay_min [Integer] Interval in seconds between
|
485
498
|
# VRRP preempt event and takeover. Minimum delays takeover when VRRP
|
486
499
|
# is fully implemented.
|
487
500
|
#
|
488
|
-
# @option
|
501
|
+
# @option opts preempt_delay_reload [Integer] Interval in seconds
|
489
502
|
# between VRRP preempt event and takeover. Reload delays takeover
|
490
503
|
# after initialization following a switch reload.
|
491
504
|
#
|
492
|
-
# @option
|
505
|
+
# @option opts delay_reload [Integer] Delay between system reboot and
|
493
506
|
# VRRP initialization.
|
494
507
|
#
|
495
|
-
# @option
|
508
|
+
# @option opts track [Array<Hash>] The track hash contains the
|
496
509
|
# name of an interface to track, the action to take on state-change
|
497
510
|
# of the tracked interface, and the amount to decrement the priority.
|
498
511
|
#
|
499
|
-
# @return [Boolean]
|
512
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
500
513
|
def create(name, vrid, opts = {})
|
501
514
|
fail ArgumentError, 'create has no options set' if opts.empty?
|
502
515
|
cmds = []
|
@@ -555,16 +568,17 @@ module Rbeapi
|
|
555
568
|
# and the virtual router id does not exist on the interface, this
|
556
569
|
# method will succeed.
|
557
570
|
#
|
558
|
-
# @eos_version 4.13.7M
|
571
|
+
# @since eos_version 4.13.7M
|
559
572
|
#
|
560
|
-
#
|
573
|
+
# ===Commands
|
561
574
|
# interface <name>
|
562
575
|
# no vrrp <vrid>
|
563
576
|
#
|
564
|
-
# @param [String]
|
565
|
-
# @param [Integer] :vrid The virtual router ID.
|
577
|
+
# @param name [String] The layer 3 interface name.
|
566
578
|
#
|
567
|
-
# @
|
579
|
+
# @param vrid [Integer] The virtual router ID.
|
580
|
+
#
|
581
|
+
# @return [Boolean] Returns true if the command completed successfully.
|
568
582
|
def delete(name, vrid)
|
569
583
|
configure_interface(name, "no vrrp #{vrid}")
|
570
584
|
end
|
@@ -577,16 +591,17 @@ module Rbeapi
|
|
577
591
|
# virtual router id does not exist on the interface, this method will
|
578
592
|
# succeed.
|
579
593
|
#
|
580
|
-
# @eos_version 4.13.7M
|
594
|
+
# @since eos_version 4.13.7M
|
581
595
|
#
|
582
|
-
#
|
596
|
+
# ===Commands
|
583
597
|
# interface <name>
|
584
598
|
# default vrrp <vrid>
|
585
599
|
#
|
586
|
-
# @param [String]
|
587
|
-
#
|
600
|
+
# @param name [String] The layer 3 interface name.
|
601
|
+
#
|
602
|
+
# @param vrid [Integer] The virtual router ID.
|
588
603
|
#
|
589
|
-
# @return [Boolean]
|
604
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
590
605
|
def default(name, vrid)
|
591
606
|
configure_interface(name, "default vrrp #{vrid}")
|
592
607
|
end
|
@@ -594,26 +609,28 @@ module Rbeapi
|
|
594
609
|
##
|
595
610
|
# set_shutdown enables and disables the virtual router.
|
596
611
|
#
|
597
|
-
#
|
612
|
+
# ===Commands
|
598
613
|
# interface <name>
|
599
614
|
# {no | default} vrrp <vrid> shutdown
|
600
615
|
#
|
601
|
-
# @param [String]
|
602
|
-
# @param [Integer] :vrid The virtual router ID.
|
603
|
-
# @param [hash] :opts Optional keyword arguments
|
616
|
+
# @param name [String] The layer 3 interface name.
|
604
617
|
#
|
605
|
-
# @
|
618
|
+
# @param vrid [Integer] The virtual router ID.
|
619
|
+
#
|
620
|
+
# @param opts [hash] Optional keyword arguments.
|
621
|
+
#
|
622
|
+
# @option opts enable [Boolean] If enable is true then the virtual
|
606
623
|
# router is administratively enabled for the interface and if enable
|
607
624
|
# is false then the virtual router is administratively disabled
|
608
625
|
# for the interface. Default is true.
|
609
626
|
#
|
610
|
-
# @option
|
627
|
+
# @option opts default [Boolean] Configure shutdown using
|
611
628
|
# the default keyword.
|
612
629
|
#
|
613
|
-
# @return [Boolean]
|
630
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
614
631
|
def set_shutdown(name, vrid, opts = {})
|
615
632
|
fail 'set_shutdown has the value option set' if opts[:value]
|
616
|
-
# Shutdown semantics are opposite of enable semantics so invert enable
|
633
|
+
# Shutdown semantics are opposite of enable semantics so invert enable.
|
617
634
|
enable = opts.fetch(:enable, true)
|
618
635
|
opts.merge!(enable: !enable)
|
619
636
|
cmd = "vrrp #{vrid} shutdown"
|
@@ -623,23 +640,25 @@ module Rbeapi
|
|
623
640
|
##
|
624
641
|
# set_primary_ip sets the primary IP address for the virtual router.
|
625
642
|
#
|
626
|
-
#
|
643
|
+
# ===Commands
|
627
644
|
# interface <name>
|
628
645
|
# {no | default} vrrp <vrid> ip <A.B.C.D>
|
629
646
|
#
|
630
|
-
# @param [String]
|
631
|
-
#
|
632
|
-
# @param [
|
647
|
+
# @param name [String] The layer 3 interface name.
|
648
|
+
#
|
649
|
+
# @param vrid [Integer] The virtual router ID.
|
650
|
+
#
|
651
|
+
# @param opts [hash] Optional keyword arguments.
|
633
652
|
#
|
634
|
-
# @option
|
653
|
+
# @option opts value [String] The primary IPv4 address.
|
635
654
|
#
|
636
|
-
# @option
|
655
|
+
# @option opts enable [Boolean] If false then the command is
|
637
656
|
# negated. Default is true.
|
638
657
|
#
|
639
|
-
# @option
|
658
|
+
# @option opts default [Boolean] Configure the primary IP address using
|
640
659
|
# the default keyword.
|
641
660
|
#
|
642
|
-
# @return [Boolean]
|
661
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
643
662
|
def set_primary_ip(name, vrid, opts = {})
|
644
663
|
cmd = "vrrp #{vrid} ip"
|
645
664
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -648,23 +667,25 @@ module Rbeapi
|
|
648
667
|
##
|
649
668
|
# set_priority sets the priority for a virtual router.
|
650
669
|
#
|
651
|
-
#
|
670
|
+
# ===Commands
|
652
671
|
# interface <name>
|
653
672
|
# {no | default} vrrp <vrid> priority <priority>
|
654
673
|
#
|
655
|
-
# @param [String]
|
656
|
-
# @param [Integer] :vrid The virtual router ID.
|
657
|
-
# @param [hash] :opts Optional keyword arguments
|
674
|
+
# @param name [String] The layer 3 interface name.
|
658
675
|
#
|
659
|
-
# @
|
676
|
+
# @param vrid [Integer] The virtual router ID.
|
660
677
|
#
|
661
|
-
# @
|
678
|
+
# @param opts [hash] Optional keyword arguments.
|
679
|
+
#
|
680
|
+
# @option opts value [String] The priority value.
|
681
|
+
#
|
682
|
+
# @option opts enable [Boolean] If false then the command is
|
662
683
|
# negated. Default is true.
|
663
684
|
#
|
664
|
-
# @option
|
685
|
+
# @option opts default [Boolean] Configure the priority using
|
665
686
|
# the default keyword.
|
666
687
|
#
|
667
|
-
# @return [Boolean]
|
688
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
668
689
|
def set_priority(name, vrid, opts = {})
|
669
690
|
cmd = "vrrp #{vrid} priority"
|
670
691
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -673,23 +694,25 @@ module Rbeapi
|
|
673
694
|
##
|
674
695
|
# set_description sets the description for a virtual router.
|
675
696
|
#
|
676
|
-
#
|
697
|
+
# ===Commands
|
677
698
|
# interface <name>
|
678
699
|
# {no | default} vrrp <vrid> description <description>
|
679
700
|
#
|
680
|
-
# @param [String]
|
681
|
-
#
|
682
|
-
# @param [
|
701
|
+
# @param name [String] The layer 3 interface name.
|
702
|
+
#
|
703
|
+
# @param vrid [Integer] The virtual router ID.
|
683
704
|
#
|
684
|
-
# @
|
705
|
+
# @param opts [hash] Optional keyword arguments.
|
685
706
|
#
|
686
|
-
# @option
|
707
|
+
# @option opts value [String] The description value.
|
708
|
+
#
|
709
|
+
# @option opts enable [Boolean] If false then the command is
|
687
710
|
# negated. Default is true.
|
688
711
|
#
|
689
|
-
# @option
|
712
|
+
# @option opts default [Boolean] Configure the description using
|
690
713
|
# the default keyword.
|
691
714
|
#
|
692
|
-
# @return [Boolean]
|
715
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
693
716
|
def set_description(name, vrid, opts = {})
|
694
717
|
cmd = "vrrp #{vrid} description"
|
695
718
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -702,11 +725,11 @@ module Rbeapi
|
|
702
725
|
#
|
703
726
|
# @api private
|
704
727
|
#
|
705
|
-
# @param [String]
|
728
|
+
# @param name [String] The layer 3 interface name.
|
706
729
|
#
|
707
|
-
# @param [Integer]
|
730
|
+
# @param vrid [Integer] The virtual router ID.
|
708
731
|
#
|
709
|
-
# @param [Array<String>]
|
732
|
+
# @param ip_addrs [Array<String>] Array of secondary IPv4 address.
|
710
733
|
# An empty array will remove all secondary IPv4 addresses set for
|
711
734
|
# the virtual router on the specified layer 3 interface.
|
712
735
|
#
|
@@ -744,27 +767,27 @@ module Rbeapi
|
|
744
767
|
private :build_secondary_ip_cmd
|
745
768
|
|
746
769
|
# set_secondary_ips configures the set of secondary IP addresses
|
747
|
-
# associated with the virtual router.
|
748
|
-
# should be an array of IP Addresses.
|
770
|
+
# associated with the virtual router. The ip_addrs value passed
|
771
|
+
# should be an array of IP Addresses. This method will remove
|
749
772
|
# secondary IP addresses that are currently set for the virtual
|
750
773
|
# router but not included in the ip_addrs array value passed in.
|
751
774
|
# The method will then add secondary IP addresses that are not
|
752
775
|
# currently set for the virtual router but are included in the
|
753
776
|
# ip_addrs array value passed in.
|
754
777
|
#
|
755
|
-
#
|
778
|
+
# ===Commands
|
756
779
|
# interface <name>
|
757
780
|
# {no} vrrp <vrid> ip <A.B.C.D> secondary
|
758
781
|
#
|
759
|
-
# @param [String]
|
782
|
+
# @param name [String] The layer 3 interface name.
|
760
783
|
#
|
761
|
-
# @param [Integer]
|
784
|
+
# @param vrid [Integer] The virtual router ID.
|
762
785
|
#
|
763
|
-
# @param [Array<String>]
|
786
|
+
# @param ip_addrs [Array<String>] Array of secondary IPv4 address.
|
764
787
|
# An empty array will remove all secondary IPv4 addresses set for
|
765
788
|
# the virtual router on the specified layer 3 interface.
|
766
789
|
#
|
767
|
-
# @return [Boolean]
|
790
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
768
791
|
def set_secondary_ip(name, vrid, ip_addrs)
|
769
792
|
cmds = build_secondary_ip_cmd(name, vrid, ip_addrs)
|
770
793
|
return true if cmds.empty?
|
@@ -774,23 +797,25 @@ module Rbeapi
|
|
774
797
|
##
|
775
798
|
# set_ip_version sets the VRRP version for a virtual router.
|
776
799
|
#
|
777
|
-
#
|
800
|
+
# ===Commands
|
778
801
|
# interface <name>
|
779
802
|
# {no | default} vrrp <vrid> ip version <version>
|
780
803
|
#
|
781
|
-
# @param [String]
|
782
|
-
#
|
783
|
-
# @param [
|
804
|
+
# @param name [String] The layer 3 interface name.
|
805
|
+
#
|
806
|
+
# @param vrid [Integer] The virtual router ID.
|
784
807
|
#
|
785
|
-
# @
|
808
|
+
# @param opts [hash] Optional keyword arguments.
|
786
809
|
#
|
787
|
-
# @option
|
810
|
+
# @option opts value [String] The VRRP version.
|
811
|
+
#
|
812
|
+
# @option opts enable [Boolean] If false then the command is
|
788
813
|
# negated. Default is true.
|
789
814
|
#
|
790
|
-
# @option
|
815
|
+
# @option opts default [Boolean] Configure the VRRP version using
|
791
816
|
# the default keyword.
|
792
817
|
#
|
793
|
-
# @return [Boolean]
|
818
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
794
819
|
def set_ip_version(name, vrid, opts = {})
|
795
820
|
cmd = "vrrp #{vrid} ip version"
|
796
821
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -801,23 +826,25 @@ module Rbeapi
|
|
801
826
|
# advertisement messages that the switch sends to routers in the
|
802
827
|
# specified virtual router ID.
|
803
828
|
#
|
804
|
-
#
|
829
|
+
# ===Commands
|
805
830
|
# interface <name>
|
806
831
|
# {no | default} vrrp <vrid> timers advertise <secs>
|
807
832
|
#
|
808
|
-
# @param [String]
|
809
|
-
#
|
810
|
-
# @param [
|
833
|
+
# @param name [String] The layer 3 interface name.
|
834
|
+
#
|
835
|
+
# @param vrid [Integer] The virtual router ID.
|
836
|
+
#
|
837
|
+
# @param opts [hash] Optional keyword arguments.
|
811
838
|
#
|
812
|
-
# @option
|
839
|
+
# @option opts value [String] The timer value in seconds.
|
813
840
|
#
|
814
|
-
# @option
|
841
|
+
# @option opts enable [Boolean] If false then the command is
|
815
842
|
# negated. Default is true.
|
816
843
|
#
|
817
|
-
# @option
|
844
|
+
# @option opts default [Boolean] Configure the timer advertise value
|
818
845
|
# using the default keyword.
|
819
846
|
#
|
820
|
-
# @return [Boolean]
|
847
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
821
848
|
def set_timers_advertise(name, vrid, opts = {})
|
822
849
|
cmd = "vrrp #{vrid} timers advertise"
|
823
850
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -828,24 +855,26 @@ module Rbeapi
|
|
828
855
|
# advertisement packets sent to VRRP group members for the
|
829
856
|
# specified virtual router ID.
|
830
857
|
#
|
831
|
-
#
|
858
|
+
# ===Commands
|
832
859
|
# interface <name>
|
833
860
|
# {no | default} vrrp <vrid> mac-address advertisement-interval <secs>
|
834
861
|
#
|
835
|
-
# @param [String]
|
836
|
-
#
|
837
|
-
# @param [
|
862
|
+
# @param name [String] The layer 3 interface name.
|
863
|
+
#
|
864
|
+
# @param vrid [Integer] The virtual router ID.
|
865
|
+
#
|
866
|
+
# @param opts [hash] Optional keyword arguments
|
838
867
|
#
|
839
|
-
# @option
|
868
|
+
# @option opts value [String] The mac address advertisement interval
|
840
869
|
# value in seconds.
|
841
870
|
#
|
842
|
-
# @option
|
871
|
+
# @option opts enable [Boolean] If false then the command is
|
843
872
|
# negated. Default is true.
|
844
873
|
#
|
845
|
-
# @option
|
874
|
+
# @option opts default [Boolean] Configure the timer advertise value
|
846
875
|
# using the default keyword.
|
847
876
|
#
|
848
|
-
# @return [Boolean]
|
877
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
849
878
|
def set_mac_addr_adv_interval(name, vrid, opts = {})
|
850
879
|
cmd = "vrrp #{vrid} mac-address advertisement-interval"
|
851
880
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -859,23 +888,25 @@ module Rbeapi
|
|
859
888
|
# when a master virtual router is not present on the subnet,
|
860
889
|
# regardless of priority settings.
|
861
890
|
#
|
862
|
-
#
|
891
|
+
# ===Commands
|
863
892
|
# interface <name>
|
864
893
|
# {no | default} vrrp <vrid> preempt
|
865
894
|
#
|
866
|
-
# @param [String]
|
867
|
-
# @param [Integer] :vrid The virtual router ID.
|
868
|
-
# @param [hash] :opts Optional keyword arguments
|
895
|
+
# @param name [String] The layer 3 interface name.
|
869
896
|
#
|
870
|
-
# @
|
897
|
+
# @param vrid [Integer] The virtual router ID.
|
898
|
+
#
|
899
|
+
# @param opts [hash] Optional keyword arguments.
|
900
|
+
#
|
901
|
+
# @option opts enable [Boolean] If enable is true then the virtual
|
871
902
|
# router preempt mode is administratively enabled for the interface
|
872
903
|
# and if enable is false then the virtual router preempt mode is
|
873
904
|
# administratively disabled for the interface. Default is true.
|
874
905
|
#
|
875
|
-
# @option
|
906
|
+
# @option opts default [Boolean] Configure the timer advertise value
|
876
907
|
# using the default keyword.
|
877
908
|
#
|
878
|
-
# @return [Boolean]
|
909
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
879
910
|
def set_preempt(name, vrid, opts = {})
|
880
911
|
fail 'set_preempt has the value option set' if opts[:value]
|
881
912
|
cmd = "vrrp #{vrid} preempt"
|
@@ -886,23 +917,25 @@ module Rbeapi
|
|
886
917
|
# set_preempt_delay_min sets the minimum time in seconds for the
|
887
918
|
# virtual router to wait before taking over the active role.
|
888
919
|
#
|
889
|
-
#
|
920
|
+
# ===Commands
|
890
921
|
# interface <name>
|
891
922
|
# {no | default} vrrp <vrid> preempt delay minimum <secs>
|
892
923
|
#
|
893
|
-
# @param [String]
|
894
|
-
#
|
895
|
-
# @param [
|
924
|
+
# @param name [String] The layer 3 interface name.
|
925
|
+
#
|
926
|
+
# @param vrid [Integer] The virtual router ID.
|
896
927
|
#
|
897
|
-
# @
|
928
|
+
# @param opts [hash] Optional keyword arguments.
|
898
929
|
#
|
899
|
-
# @option
|
930
|
+
# @option opts value [String] The preempt delay minimum value.
|
931
|
+
#
|
932
|
+
# @option opts enable [Boolean] If false then the command is
|
900
933
|
# negated. Default is true.
|
901
934
|
#
|
902
|
-
# @option
|
935
|
+
# @option opts default [Boolean] Configure the preempt delay minimum
|
903
936
|
# value using the default keyword.
|
904
937
|
#
|
905
|
-
# @return [Boolean]
|
938
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
906
939
|
def set_preempt_delay_min(name, vrid, opts = {})
|
907
940
|
cmd = "vrrp #{vrid} preempt delay minimum"
|
908
941
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -913,23 +946,25 @@ module Rbeapi
|
|
913
946
|
# only. This delay period applies only to the first interface-up
|
914
947
|
# event after the virtual router has reloaded.
|
915
948
|
#
|
916
|
-
#
|
949
|
+
# ===Commands
|
917
950
|
# interface <name>
|
918
951
|
# {no | default} vrrp <vrid> preempt delay reload <secs>
|
919
952
|
#
|
920
|
-
# @param [String]
|
921
|
-
#
|
922
|
-
# @param [
|
953
|
+
# @param name [String] The layer 3 interface name.
|
954
|
+
#
|
955
|
+
# @param vrid [Integer] The virtual router ID.
|
923
956
|
#
|
924
|
-
# @
|
957
|
+
# @param opts [hash] Optional keyword arguments.
|
925
958
|
#
|
926
|
-
# @option
|
959
|
+
# @option opts value [String] The preempt delay reload value.
|
960
|
+
#
|
961
|
+
# @option opts enable [Boolean] If false then the command is
|
927
962
|
# negated. Default is true.
|
928
963
|
#
|
929
|
-
# @option
|
930
|
-
# value using the default keyword.
|
964
|
+
# @option opts default [Boolean] :default Configure the preempt delay
|
965
|
+
# reload value using the default keyword.
|
931
966
|
#
|
932
|
-
# @return [Boolean]
|
967
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
933
968
|
def set_preempt_delay_reload(name, vrid, opts = {})
|
934
969
|
cmd = "vrrp #{vrid} preempt delay reload"
|
935
970
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -939,23 +974,25 @@ module Rbeapi
|
|
939
974
|
# set_delay_reload sets the delay between system reboot and VRRP
|
940
975
|
# initialization for the virtual router.
|
941
976
|
#
|
942
|
-
#
|
977
|
+
# ===Commands
|
943
978
|
# interface <name>
|
944
979
|
# {no | default} vrrp <vrid> delay reload <secs>
|
945
980
|
#
|
946
|
-
# @param [String]
|
947
|
-
#
|
948
|
-
# @param [
|
981
|
+
# @param name [String] The layer 3 interface name.
|
982
|
+
#
|
983
|
+
# @param vrid [Integer] The virtual router ID.
|
984
|
+
#
|
985
|
+
# @param opts [hash] Optional keyword arguments
|
949
986
|
#
|
950
|
-
# @option
|
987
|
+
# @option opts value [String] The delay reload value.
|
951
988
|
#
|
952
|
-
# @option
|
989
|
+
# @option opts enable [Boolean] If false then the command is
|
953
990
|
# negated. Default is true.
|
954
991
|
#
|
955
|
-
# @option
|
992
|
+
# @option opts default [Boolean] Configure the delay reload
|
956
993
|
# value using the default keyword.
|
957
994
|
#
|
958
|
-
# @return [Boolean]
|
995
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
959
996
|
def set_delay_reload(name, vrid, opts = {})
|
960
997
|
cmd = "vrrp #{vrid} delay reload"
|
961
998
|
configure_interface(name, command_builder(cmd, opts))
|
@@ -968,11 +1005,11 @@ module Rbeapi
|
|
968
1005
|
#
|
969
1006
|
# @api private
|
970
1007
|
#
|
971
|
-
# @param [String]
|
1008
|
+
# @param name [String] The layer 3 interface name.
|
972
1009
|
#
|
973
|
-
# @param [Integer]
|
1010
|
+
# @param vrid [Integer] The virtual router ID.
|
974
1011
|
#
|
975
|
-
# @param [Array<Hash>]
|
1012
|
+
# @param tracks [Array<Hash>] Array of a hash of track information.
|
976
1013
|
# Hash format: { name: 'Eth2', action: 'decrement', amount: 33 },
|
977
1014
|
# The name and action key are required. The amount key should only
|
978
1015
|
# be specified if the action is shutdown. The valid actions are
|
@@ -1010,7 +1047,7 @@ module Rbeapi
|
|
1010
1047
|
|
1011
1048
|
tracks = Set.new tracks
|
1012
1049
|
|
1013
|
-
# Get the current tracks set for the virtual router
|
1050
|
+
# Get the current tracks set for the virtual router.
|
1014
1051
|
# A return of nil means that nothing has been configured for
|
1015
1052
|
# the virtual router.
|
1016
1053
|
vrrp = get(name)
|
@@ -1041,27 +1078,27 @@ module Rbeapi
|
|
1041
1078
|
private :build_tracks_cmd
|
1042
1079
|
|
1043
1080
|
# set_tracks configures the set of track settings associated with
|
1044
|
-
# the virtual router.
|
1045
|
-
# hashes, each hash containing a track entry.
|
1081
|
+
# the virtual router. The tracks value passed should be an array of
|
1082
|
+
# hashes, each hash containing a track entry. This method will remove
|
1046
1083
|
# tracks that are currently set for the virtual router but not included
|
1047
|
-
# in the tracks array value passed in.
|
1084
|
+
# in the tracks array value passed in. The method will then add
|
1048
1085
|
# tracks that are not currently set for the virtual router but are
|
1049
1086
|
# included in the tracks array value passed in.
|
1050
1087
|
#
|
1051
|
-
#
|
1088
|
+
# ===Commands
|
1052
1089
|
# interface <name>
|
1053
1090
|
# {no} vrrp <vrid> track <name> <action> [<amount>]
|
1054
1091
|
#
|
1055
|
-
# @param [String]
|
1092
|
+
# @param name [String] The layer 3 interface name.
|
1056
1093
|
#
|
1057
|
-
# @param [Integer]
|
1094
|
+
# @param vrid [Integer] The virtual router ID.
|
1058
1095
|
#
|
1059
|
-
# @param [Array<Hash>]
|
1096
|
+
# @param tracks [Array<Hash>] Array of a hash of track information.
|
1060
1097
|
# Hash format: { name: 'Eth2', action: 'decrement', amount: 33 },
|
1061
1098
|
# An empty array will remove all tracks set for
|
1062
1099
|
# the virtual router on the specified layer 3 interface.
|
1063
1100
|
#
|
1064
|
-
# @return [Boolean]
|
1101
|
+
# @return [Boolean] Returns true if the command complete successfully.
|
1065
1102
|
def set_tracks(name, vrid, tracks)
|
1066
1103
|
cmds = build_tracks_cmd(name, vrid, tracks)
|
1067
1104
|
return true if cmds.empty?
|