cisco_node_utils 1.4.0 → 1.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/cisco_node_utils/bgp.rb +90 -12
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +4 -2
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +10 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +19 -2
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +1 -1
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +14 -2
- data/lib/cisco_node_utils/configparser_lib.rb +0 -6
- data/lib/cisco_node_utils/interface_portchannel.rb +15 -0
- data/lib/cisco_node_utils/version.rb +1 -1
- data/tests/cmd_config.yaml +8 -2
- data/tests/test_ace.rb +15 -7
- data/tests/test_command_config.rb +14 -7
- data/tests/test_interface.rb +1 -0
- data/tests/test_interface_portchannel.rb +26 -6
- data/tests/test_router_bgp.rb +194 -44
- data/tests/test_snmpuser.rb +0 -1
- data/tests/test_yum.rb +1 -1
- data/tests/yum_package.yaml +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 564e7f738b94277341aac0cd79f9969311c1e7cd
|
4
|
+
data.tar.gz: 93ae60e8ff3348f14d1f7ad98125ad06bd535a1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cde277306e924d1f0edce1549b6f3e835fb389098005770258ab3e4dd7c2b0301b22291516b174d44f270dd9d0041fd81356f8aed8c9ed91e88287eb5b89328
|
7
|
+
data.tar.gz: dcc9931ea33f770f3864a07c3b9e1859df09a7aa52e5003f97a0bd956fa0379e29d8970949732a8ece42eb92b82eb1f1e599cf6e2878e7339b15e502e91ebb6e
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## [v1.4.1]
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
* Extend bgp with attributes:
|
9
|
+
* `event_history_errors`
|
10
|
+
* `event_history_objstore`
|
11
|
+
* Added support for Cisco NX-OS software release `7.3(0)I5(1)`
|
12
|
+
|
4
13
|
## [v1.4.0]
|
5
14
|
|
6
15
|
### New feature support
|
@@ -359,6 +368,7 @@ Changelog
|
|
359
368
|
[git-flow]: https://github.com/petervanderdoes/gitflow-avh
|
360
369
|
[SimpleCov]: https://github.com/colszowka/simplecov
|
361
370
|
|
371
|
+
[v1.4.1]: https://github.com/cisco/cisco-network-node-utils/compare/v1.4.0...v1.4.1
|
362
372
|
[v1.4.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.3.0...v1.4.0
|
363
373
|
[v1.3.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.2.0...v1.3.0
|
364
374
|
[v1.2.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.1.0...v1.2.0
|
data/lib/cisco_node_utils/bgp.rb
CHANGED
@@ -416,13 +416,16 @@ module Cisco
|
|
416
416
|
match = config_get('bgp', 'event_history_cli', @get_args)
|
417
417
|
if match.is_a?(Array)
|
418
418
|
return 'false' if match[0] == 'no '
|
419
|
-
|
419
|
+
if match[1]
|
420
|
+
return match[1] if match[1][/\A\d+\z/]
|
421
|
+
return 'size_' + match[1]
|
422
|
+
end
|
420
423
|
end
|
421
424
|
default_event_history_cli
|
422
425
|
end
|
423
426
|
|
424
427
|
def event_history_cli=(val)
|
425
|
-
size = val[/small|medium|large|disable/]
|
428
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
426
429
|
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
427
430
|
@set_args[:state] = val[/false/] ? 'no' : ''
|
428
431
|
config_set('bgp', 'event_history_cli', @set_args)
|
@@ -437,16 +440,19 @@ module Cisco
|
|
437
440
|
# Nvgen as True With optional 'size <size>
|
438
441
|
def event_history_detail
|
439
442
|
match = config_get('bgp', 'event_history_detail', @get_args)
|
440
|
-
# This property requires auto_default=false
|
441
443
|
if match.is_a?(Array)
|
442
444
|
return 'false' if match[0] == 'no '
|
443
|
-
|
445
|
+
if match[1]
|
446
|
+
return match[1] if match[1][/\A\d+\z/]
|
447
|
+
return 'size_' + match[1]
|
448
|
+
end
|
449
|
+
return 'true'
|
444
450
|
end
|
445
451
|
default_event_history_detail
|
446
452
|
end
|
447
453
|
|
448
454
|
def event_history_detail=(val)
|
449
|
-
size = val[/small|medium|large|disable/]
|
455
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
450
456
|
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
451
457
|
@set_args[:state] = val[/false/] ? 'no' : ''
|
452
458
|
config_set('bgp', 'event_history_detail', @set_args)
|
@@ -457,19 +463,48 @@ module Cisco
|
|
457
463
|
config_get_default('bgp', 'event_history_detail')
|
458
464
|
end
|
459
465
|
|
466
|
+
# event-history errors [ size <size> ]
|
467
|
+
# Nvgen as True With optional 'size <size>
|
468
|
+
def event_history_errors
|
469
|
+
match = config_get('bgp', 'event_history_errors', @get_args)
|
470
|
+
if match.is_a?(Array)
|
471
|
+
return 'false' if match[0] == 'no '
|
472
|
+
if match[1]
|
473
|
+
return match[1] if match[1][/\A\d+\z/]
|
474
|
+
return 'size_' + match[1]
|
475
|
+
end
|
476
|
+
end
|
477
|
+
default_event_history_errors
|
478
|
+
end
|
479
|
+
|
480
|
+
def event_history_errors=(val)
|
481
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
482
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
483
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
484
|
+
config_set('bgp', 'event_history_errors', @set_args)
|
485
|
+
set_args_keys_default
|
486
|
+
end
|
487
|
+
|
488
|
+
def default_event_history_errors
|
489
|
+
config_get_default('bgp', 'event_history_errors')
|
490
|
+
end
|
491
|
+
|
460
492
|
# event-history events [ size <size> ]
|
461
493
|
# Nvgen as True With optional 'size <size>
|
462
494
|
def event_history_events
|
463
495
|
match = config_get('bgp', 'event_history_events', @get_args)
|
464
496
|
if match.is_a?(Array)
|
465
|
-
return '
|
466
|
-
|
497
|
+
return 'false' if match[0] == 'no '
|
498
|
+
if match[1]
|
499
|
+
return match[1] if match[1][/\A\d+\z/]
|
500
|
+
return 'size_' + match[1]
|
501
|
+
end
|
467
502
|
end
|
468
503
|
default_event_history_events
|
469
504
|
end
|
470
505
|
|
471
506
|
def event_history_events=(val)
|
472
|
-
size = val[/small|medium|large|disable/]
|
507
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
473
508
|
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
474
509
|
@set_args[:state] = val[/false/] ? 'no' : ''
|
475
510
|
config_set('bgp', 'event_history_events', @set_args)
|
@@ -477,7 +512,39 @@ module Cisco
|
|
477
512
|
end
|
478
513
|
|
479
514
|
def default_event_history_events
|
480
|
-
|
515
|
+
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
|
516
|
+
Utils.chassis_pid?(/N(5|6|7|8)/)
|
517
|
+
config_get_default('bgp', 'event_history_events')
|
518
|
+
else
|
519
|
+
config_get('bgp', 'event_history_events_bytes', @get_args)
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
523
|
+
# event-history objstore [ size <size> ]
|
524
|
+
# Nvgen as True With optional 'size <size>
|
525
|
+
def event_history_objstore
|
526
|
+
match = config_get('bgp', 'event_history_objstore', @get_args)
|
527
|
+
if match.is_a?(Array)
|
528
|
+
return 'false' if match[0] == 'no '
|
529
|
+
if match[1]
|
530
|
+
return match[1] if match[1][/\A\d+\z/]
|
531
|
+
return 'size_' + match[1]
|
532
|
+
end
|
533
|
+
return 'true'
|
534
|
+
end
|
535
|
+
default_event_history_objstore
|
536
|
+
end
|
537
|
+
|
538
|
+
def event_history_objstore=(val)
|
539
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
540
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
541
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
542
|
+
config_set('bgp', 'event_history_objstore', @set_args)
|
543
|
+
set_args_keys_default
|
544
|
+
end
|
545
|
+
|
546
|
+
def default_event_history_objstore
|
547
|
+
config_get_default('bgp', 'event_history_objstore')
|
481
548
|
end
|
482
549
|
|
483
550
|
# event-history periodic [ size <size> ]
|
@@ -486,13 +553,19 @@ module Cisco
|
|
486
553
|
match = config_get('bgp', 'event_history_periodic', @get_args)
|
487
554
|
if match.is_a?(Array)
|
488
555
|
return 'false' if match[0] == 'no '
|
489
|
-
|
556
|
+
if match[1]
|
557
|
+
return match[1] if match[1][/\A\d+\z/]
|
558
|
+
return 'size_' + match[1]
|
559
|
+
end
|
560
|
+
else
|
561
|
+
return default_event_history_periodic
|
490
562
|
end
|
563
|
+
return 'true' unless default_event_history_periodic[/size/]
|
491
564
|
default_event_history_periodic
|
492
565
|
end
|
493
566
|
|
494
567
|
def event_history_periodic=(val)
|
495
|
-
size = val[/small|medium|large|disable/]
|
568
|
+
size = val[/small|medium|large|disable|\A\d+\z/] unless val[/false|true/]
|
496
569
|
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
497
570
|
@set_args[:state] = val[/false/] ? 'no' : ''
|
498
571
|
config_set('bgp', 'event_history_periodic', @set_args)
|
@@ -500,7 +573,12 @@ module Cisco
|
|
500
573
|
end
|
501
574
|
|
502
575
|
def default_event_history_periodic
|
503
|
-
|
576
|
+
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
|
577
|
+
Utils.chassis_pid?(/N(5|6|7|8)/)
|
578
|
+
config_get_default('bgp', 'event_history_periodic')
|
579
|
+
else
|
580
|
+
config_get('bgp', 'event_history_periodic_bytes', @get_args)
|
581
|
+
end
|
504
582
|
end
|
505
583
|
|
506
584
|
# Fast External fallover (Getter/Setter/Default)
|
@@ -565,7 +565,7 @@ module Cisco
|
|
565
565
|
# sense to split up the individual methods to support them
|
566
566
|
def send_community
|
567
567
|
val = config_get('bgp_neighbor_af', 'send_community', @get_args)
|
568
|
-
return default_send_community if val.nil?
|
568
|
+
return default_send_community if val.nil? || val.empty?
|
569
569
|
platform == :nexus ? send_community_nexus(val) : send_community_xr(val)
|
570
570
|
end
|
571
571
|
|
@@ -573,7 +573,9 @@ module Cisco
|
|
573
573
|
# NOTE: 'standard' is default but does not nvgen on some platforms
|
574
574
|
# Returns: none, both, extended, or standard
|
575
575
|
def send_community_nexus(val)
|
576
|
-
|
576
|
+
reg = 'send-community extended|send-community standard|send-community'
|
577
|
+
return 'both' if val.grep(/#{reg}/).size == 2
|
578
|
+
val = val[0].split.last
|
577
579
|
return 'standard' if val[/send-community/] # Workaround
|
578
580
|
val
|
579
581
|
end
|
@@ -103,6 +103,16 @@ module Cisco
|
|
103
103
|
true if Platform.image_version[/7.0.3.I2/]
|
104
104
|
end
|
105
105
|
|
106
|
+
def self.image_version?(ver_regexp)
|
107
|
+
require_relative 'platform'
|
108
|
+
return true if Platform.image_version[ver_regexp]
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.chassis_pid?(ver_regexp)
|
112
|
+
require_relative 'platform'
|
113
|
+
return true if Platform.chassis['pid'][ver_regexp]
|
114
|
+
end
|
115
|
+
|
106
116
|
# Helper utility method for ip/prefix format networks.
|
107
117
|
# For ip/prefix format '1.1.1.1/24' or '2000:123:38::34/64',
|
108
118
|
# we need to mask the address using the prefix length so that they
|
@@ -156,8 +156,13 @@ event_history_detail:
|
|
156
156
|
_exclude: [ios_xr]
|
157
157
|
get_value: '/^(no )?event-history detail(?: size (\S+))?$/'
|
158
158
|
set_value: '<state> event-history detail <size>'
|
159
|
-
|
160
|
-
|
159
|
+
default_value: 'false'
|
160
|
+
|
161
|
+
event_history_errors:
|
162
|
+
_exclude: [ios_xr]
|
163
|
+
get_value: '/^(no )?event-history errors(?: size (\S+))?$/'
|
164
|
+
set_value: '<state> event-history errors <size>'
|
165
|
+
default_value: 'size_medium'
|
161
166
|
|
162
167
|
event_history_events:
|
163
168
|
_exclude: [ios_xr]
|
@@ -165,12 +170,24 @@ event_history_events:
|
|
165
170
|
set_value: '<state> event-history events <size>'
|
166
171
|
default_value: 'size_small'
|
167
172
|
|
173
|
+
event_history_events_bytes:
|
174
|
+
default_only: 'size_large'
|
175
|
+
|
176
|
+
event_history_objstore:
|
177
|
+
_exclude: [ios_xr]
|
178
|
+
get_value: '/^(no )?event-history objstore(?: size (\S+))?$/'
|
179
|
+
set_value: '<state> event-history objstore <size>'
|
180
|
+
default_value: 'false'
|
181
|
+
|
168
182
|
event_history_periodic:
|
169
183
|
_exclude: [ios_xr]
|
170
184
|
get_value: '/^(no )?event-history periodic(?: size (\S+))?$/'
|
171
185
|
set_value: '<state> event-history periodic <size>'
|
172
186
|
default_value: 'size_small'
|
173
187
|
|
188
|
+
event_history_periodic_bytes:
|
189
|
+
default_only: 'false'
|
190
|
+
|
174
191
|
fast_external_fallover:
|
175
192
|
kind: boolean
|
176
193
|
default_value: true
|
@@ -168,13 +168,13 @@ route_reflector_client:
|
|
168
168
|
default_value: false
|
169
169
|
|
170
170
|
send_community:
|
171
|
+
multiple:
|
171
172
|
auto_default: false
|
172
173
|
default_value: 'none'
|
173
174
|
nexus:
|
174
175
|
get_value: '/^send-community(?: .*)?/'
|
175
176
|
set_value: '<state> send-community <attr>'
|
176
177
|
ios_xr:
|
177
|
-
multiple:
|
178
178
|
# XR three seperate commands: send-community-ebgp send-community-gshut-ebgp
|
179
179
|
# and send-extended-community-ebgp
|
180
180
|
# send-community-ebgp' and 'send-extended-community-ebgp' are the equivalents
|
@@ -49,10 +49,22 @@ lacp_min_links:
|
|
49
49
|
|
50
50
|
lacp_suspend_individual:
|
51
51
|
kind: boolean
|
52
|
-
auto_default: false
|
53
52
|
get_value: '/^lacp suspend.individual$/'
|
54
53
|
set_value: "%s lacp suspend-individual"
|
55
|
-
|
54
|
+
N3k:
|
55
|
+
default_value: false
|
56
|
+
else:
|
57
|
+
auto_default: false
|
58
|
+
default_value: true
|
59
|
+
|
60
|
+
lacp_suspend_shut_needed:
|
61
|
+
# This is used to determine if the port-channel interface
|
62
|
+
# must be shutdown before setting lacp_suspend_individual
|
63
|
+
kind: boolean
|
64
|
+
N9k:
|
65
|
+
default_only: true
|
66
|
+
else:
|
67
|
+
default_only: false
|
56
68
|
|
57
69
|
port_hash_distribution:
|
58
70
|
_exclude: [N6k, N5k]
|
@@ -125,12 +125,6 @@ module Cisco
|
|
125
125
|
existing << submode.compare_with(config_submode)
|
126
126
|
next
|
127
127
|
end # if
|
128
|
-
|
129
|
-
prefix, base = base_commands(command)
|
130
|
-
if prefix != '' && !config.include_command?(base)
|
131
|
-
existing << config_line
|
132
|
-
next
|
133
|
-
end
|
134
128
|
end
|
135
129
|
existing
|
136
130
|
end # compare_with
|
@@ -115,14 +115,29 @@ module Cisco
|
|
115
115
|
config_get_default('interface_portchannel', 'lacp_min_links')
|
116
116
|
end
|
117
117
|
|
118
|
+
def lacp_suspend_shut_needed?
|
119
|
+
config_get('interface_portchannel', 'lacp_suspend_shut_needed')
|
120
|
+
end
|
121
|
+
|
118
122
|
def lacp_suspend_individual
|
119
123
|
config_get('interface_portchannel', 'lacp_suspend_individual', @name)
|
120
124
|
end
|
121
125
|
|
122
126
|
def lacp_suspend_individual=(state)
|
123
127
|
no_cmd = (state ? '' : 'no')
|
128
|
+
# This property can only be set if the port-channel is shutdown on
|
129
|
+
# some platforms.
|
130
|
+
# This setter will:
|
131
|
+
# 1) Query the current state of the port-channel interface.
|
132
|
+
# 2) Shutdown the port-channel interface if needed.
|
133
|
+
# 3) Set the lacp_suspend_individual property.
|
134
|
+
# 4) Restore the original state of the port-channel interface if needed.
|
135
|
+
int = Interface.new(@name, false)
|
136
|
+
current_state = int.shutdown
|
137
|
+
int.shutdown = true if lacp_suspend_shut_needed? && !current_state
|
124
138
|
config_set('interface_portchannel',
|
125
139
|
'lacp_suspend_individual', @name, no_cmd)
|
140
|
+
int.shutdown = current_state unless current_state == int.shutdown
|
126
141
|
end
|
127
142
|
|
128
143
|
def default_lacp_suspend_individual
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
# Container module for version number only.
|
16
16
|
module CiscoNodeUtils
|
17
|
-
VERSION = '1.4.
|
17
|
+
VERSION = '1.4.1'
|
18
18
|
gem_version = Gem::Version.new(Gem::VERSION)
|
19
19
|
min_gem_version = Gem::Version.new('2.1.0')
|
20
20
|
fail 'Required rubygems version >= 2.1.0' if gem_version < min_gem_version
|
data/tests/cmd_config.yaml
CHANGED
@@ -28,6 +28,7 @@ nexus:
|
|
28
28
|
no feature lacp
|
29
29
|
no feature dhcp
|
30
30
|
no feature vtp
|
31
|
+
nvgen: false
|
31
32
|
|
32
33
|
feature-snmp-comm-acl-ro:
|
33
34
|
command: |
|
@@ -40,14 +41,19 @@ nexus:
|
|
40
41
|
snmp-server community admincom use-acl SNMP_RW
|
41
42
|
|
42
43
|
feature-int-loopback:
|
43
|
-
command:
|
44
|
+
command: |
|
44
45
|
interface loopback0
|
45
46
|
description testloopback
|
46
47
|
|
47
48
|
feature-int-portchannel:
|
48
|
-
|
49
|
+
setup: |
|
50
|
+
interface port-channel100
|
51
|
+
no switchport
|
52
|
+
command: |
|
53
|
+
feature bfd
|
49
54
|
interface port-channel100
|
50
55
|
description test-portchannel
|
56
|
+
no bfd echo
|
51
57
|
|
52
58
|
ios_xr:
|
53
59
|
name-server:
|
data/tests/test_ace.rb
CHANGED
@@ -219,13 +219,21 @@ class TestAce < CiscoTestCase
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
-
def
|
222
|
+
def test_ttl_ipv4
|
223
223
|
val = '3'
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
224
|
+
afi = 'ipv4'
|
225
|
+
a = ace_helper(afi, ttl: val)
|
226
|
+
skip("This property has a known defect on the platform itself -\n"\
|
227
|
+
'CSCuy47463: access-list ttl does not nvgen') if a.ttl.nil?
|
228
|
+
assert_equal(val, a.ttl)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_ttl_ipv6
|
232
|
+
val = '3'
|
233
|
+
afi = 'ipv6'
|
234
|
+
a = ace_helper(afi, ttl: val)
|
235
|
+
skip("This property has a known defect on the platform itself -\n"\
|
236
|
+
'CSCuy47463: access-list ttl does not nvgen') if a.ttl.nil?
|
237
|
+
assert_equal(val, a.ttl)
|
230
238
|
end
|
231
239
|
end
|
@@ -44,7 +44,7 @@ class TestCommandConfig < CiscoTestCase
|
|
44
44
|
commands.gsub(/^\s*$\n/, '')
|
45
45
|
end # remove_whitespace
|
46
46
|
|
47
|
-
def compare_with_results(desired_config_str,
|
47
|
+
def compare_with_results(desired_config_str, _current_key, nvgen)
|
48
48
|
retrieve_command = 'show running all'
|
49
49
|
running_config_str = node.get(command: retrieve_command)
|
50
50
|
|
@@ -58,14 +58,20 @@ class TestCommandConfig < CiscoTestCase
|
|
58
58
|
puts e.what
|
59
59
|
end
|
60
60
|
# puts "Existing command block:\n#{existing}"
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
if nvgen == false
|
62
|
+
msg = "The following configuration should be removed: #{desired_config_str}"
|
63
|
+
assert_equal(existing.empty?, true, msg)
|
64
|
+
else
|
65
|
+
msg = "The following configuration should exist but doesn't: #{desired_config_str}"
|
66
|
+
assert_equal(existing.empty?, false, msg)
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
def send_device_config(config_cmd_hash)
|
67
71
|
config_cmd_hash.each do |k, v|
|
68
|
-
v.
|
72
|
+
v.each do |k1, v1|
|
73
|
+
next if k1 == 'nvgen'
|
74
|
+
config(v1) if k1 == 'setup'
|
69
75
|
# Send commands
|
70
76
|
cfg_cmd_str = "#{v1.gsub(/^/, ' ')}"
|
71
77
|
cfg_string = remove_whitespace(cfg_cmd_str)
|
@@ -73,7 +79,7 @@ class TestCommandConfig < CiscoTestCase
|
|
73
79
|
begin
|
74
80
|
node.set(values: cfg_string)
|
75
81
|
# make sure config is present in success case
|
76
|
-
compare_with_results(v1, k)
|
82
|
+
compare_with_results(v1, k, config_cmd_hash[k]['nvgen'])
|
77
83
|
rescue CliError => e
|
78
84
|
known_failure = e.message[/ERROR:.*port channel not present/]
|
79
85
|
refute(known_failure, 'ERROR: port channel not present')
|
@@ -113,10 +119,10 @@ class TestCommandConfig < CiscoTestCase
|
|
113
119
|
def test_valid_scale
|
114
120
|
show_int_count = "show int brief | i '^\S+\s+--' | count"
|
115
121
|
pre = @device.cmd(show_int_count)[/^(\d+)$/]
|
116
|
-
|
117
122
|
# Add 1024 loopback interfaces
|
118
123
|
cfg_hash_add = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
|
119
124
|
cfg_hash_add ['loopback-int-add']['command'] = "#{build_int_scale_config}"
|
125
|
+
cfg_hash_add ['loopback-int-add']['nvgen'] = true
|
120
126
|
begin
|
121
127
|
send_device_config(cfg_hash_add)
|
122
128
|
rescue Timeout::Error
|
@@ -131,6 +137,7 @@ class TestCommandConfig < CiscoTestCase
|
|
131
137
|
cfg_hash_remove = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
|
132
138
|
cfg_hash_remove['loopback-int-add']['command'] = \
|
133
139
|
"#{build_int_scale_config(false)}"
|
140
|
+
cfg_hash_remove ['loopback-int-add']['nvgen'] = false
|
134
141
|
begin
|
135
142
|
send_device_config(cfg_hash_remove)
|
136
143
|
rescue Timeout::Error
|
data/tests/test_interface.rb
CHANGED
@@ -566,6 +566,7 @@ class TestInterface < CiscoTestCase
|
|
566
566
|
assert_raises(Cisco::UnsupportedError) { interface.bfd_echo = false }
|
567
567
|
return
|
568
568
|
end
|
569
|
+
interface.switchport_mode = :disabled
|
569
570
|
assert_equal(interface.default_bfd_echo,
|
570
571
|
interface.bfd_echo)
|
571
572
|
interface.bfd_echo = false
|
@@ -94,12 +94,32 @@ class TestInterfacePortChannel < CiscoTestCase
|
|
94
94
|
|
95
95
|
def test_lacp_suspend_individual
|
96
96
|
interface = create_port_channel
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
|
98
|
+
# Run this test with the portchannel in both a 'shutdown'
|
99
|
+
# and 'no shutdown' state.
|
100
|
+
int_obj = Interface.new(interface.name)
|
101
|
+
[true, false].each do |state|
|
102
|
+
int_obj.shutdown = state
|
103
|
+
|
104
|
+
# Test initial default case
|
105
|
+
assert_equal(interface.default_lacp_suspend_individual,
|
106
|
+
interface.lacp_suspend_individual)
|
107
|
+
|
108
|
+
# Test non-default value
|
109
|
+
val = !interface.default_lacp_suspend_individual
|
110
|
+
interface.lacp_suspend_individual = val
|
111
|
+
assert_equal(val, interface.lacp_suspend_individual)
|
112
|
+
|
113
|
+
# Set back to default
|
114
|
+
interface.lacp_suspend_individual =
|
115
|
+
interface.default_lacp_suspend_individual
|
116
|
+
assert_equal(interface.default_lacp_suspend_individual,
|
117
|
+
interface.lacp_suspend_individual)
|
118
|
+
|
119
|
+
# Make sure interface ends up in the same state.
|
120
|
+
assert_equal(state, int_obj.shutdown,
|
121
|
+
"Interface #{int_obj.name} incorrect state after setting property")
|
122
|
+
end
|
103
123
|
end
|
104
124
|
|
105
125
|
def test_port_load_defer
|
data/tests/test_router_bgp.rb
CHANGED
@@ -60,6 +60,12 @@ def setup_vrf
|
|
60
60
|
create_bgp_vrf(@asnum, @vrf)
|
61
61
|
end
|
62
62
|
|
63
|
+
def newer_image_version?
|
64
|
+
return false if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
|
65
|
+
Utils.chassis_pid?(/N(5|6|7|8)/)
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
63
69
|
# TestRouterBgp - Minitest for RouterBgp class
|
64
70
|
class TestRouterBgp < CiscoTestCase
|
65
71
|
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
@@ -580,54 +586,198 @@ class TestRouterBgp < CiscoTestCase
|
|
580
586
|
bgp.destroy
|
581
587
|
end
|
582
588
|
|
583
|
-
def
|
589
|
+
def test_event_history_cli
|
584
590
|
bgp = setup_default
|
591
|
+
if validate_property_excluded?('bgp', 'event_history_cli')
|
592
|
+
assert_nil(bgp.event_history_cli)
|
593
|
+
assert_raises(Cisco::UnsupportedError) do
|
594
|
+
bgp.event_history_cli = 'true'
|
595
|
+
end
|
596
|
+
return
|
597
|
+
end
|
598
|
+
assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
|
599
|
+
bgp.event_history_cli = 'true'
|
600
|
+
assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
|
601
|
+
bgp.event_history_cli = 'false'
|
602
|
+
assert_equal('false', bgp.event_history_cli)
|
603
|
+
bgp.event_history_cli = 'size_small'
|
604
|
+
assert_equal('size_small', bgp.event_history_cli)
|
605
|
+
bgp.event_history_cli = 'size_large'
|
606
|
+
assert_equal('size_large', bgp.event_history_cli)
|
607
|
+
bgp.event_history_cli = 'size_medium'
|
608
|
+
assert_equal('size_medium', bgp.event_history_cli)
|
609
|
+
bgp.event_history_cli = 'size_disable'
|
610
|
+
if newer_image_version?
|
611
|
+
assert_equal('false', bgp.event_history_cli)
|
612
|
+
else
|
613
|
+
assert_equal('size_disable', bgp.event_history_cli)
|
614
|
+
end
|
615
|
+
bgp.event_history_cli = '100000'
|
616
|
+
assert_equal('100000', bgp.event_history_cli)
|
617
|
+
bgp.event_history_cli = bgp.default_event_history_cli
|
618
|
+
assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
|
619
|
+
end
|
585
620
|
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
621
|
+
def test_event_history_detail
|
622
|
+
bgp = setup_default
|
623
|
+
if validate_property_excluded?('bgp', 'event_history_detail')
|
624
|
+
assert_nil(bgp.event_history_detail)
|
625
|
+
assert_raises(Cisco::UnsupportedError) do
|
626
|
+
bgp.event_history_detail = 'true'
|
627
|
+
end
|
628
|
+
return
|
629
|
+
end
|
630
|
+
assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
|
631
|
+
bgp.event_history_detail = 'true'
|
632
|
+
assert_equal('true', bgp.event_history_detail)
|
633
|
+
bgp.event_history_detail = 'false'
|
634
|
+
assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
|
635
|
+
bgp.event_history_detail = 'size_small'
|
636
|
+
assert_equal('size_small', bgp.event_history_detail)
|
637
|
+
bgp.event_history_detail = 'size_large'
|
638
|
+
assert_equal('size_large', bgp.event_history_detail)
|
639
|
+
bgp.event_history_detail = 'size_medium'
|
640
|
+
assert_equal('size_medium', bgp.event_history_detail)
|
641
|
+
bgp.event_history_detail = 'size_disable'
|
642
|
+
if newer_image_version?
|
643
|
+
assert_equal('false', bgp.event_history_detail)
|
644
|
+
else
|
645
|
+
assert_equal('size_disable', bgp.event_history_detail)
|
646
|
+
end
|
647
|
+
bgp.event_history_detail = '100000'
|
648
|
+
assert_equal('100000', bgp.event_history_detail)
|
649
|
+
bgp.event_history_detail = bgp.default_event_history_detail
|
650
|
+
assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
|
651
|
+
end
|
652
|
+
|
653
|
+
def test_event_history_errors
|
654
|
+
bgp = setup_default
|
655
|
+
if validate_property_excluded?('bgp', 'event_history_errors')
|
656
|
+
assert_nil(bgp.event_history_errors)
|
657
|
+
assert_raises(Cisco::UnsupportedError) do
|
658
|
+
bgp.event_history_errors = 'true'
|
659
|
+
end
|
660
|
+
return
|
661
|
+
end
|
662
|
+
skip('platform not supported for this test') unless newer_image_version?
|
663
|
+
assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
|
664
|
+
bgp.event_history_errors = 'true'
|
665
|
+
assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
|
666
|
+
bgp.event_history_errors = 'false'
|
667
|
+
assert_equal('false', bgp.event_history_errors)
|
668
|
+
bgp.event_history_errors = 'size_small'
|
669
|
+
assert_equal('size_small', bgp.event_history_errors)
|
670
|
+
bgp.event_history_errors = 'size_large'
|
671
|
+
assert_equal('size_large', bgp.event_history_errors)
|
672
|
+
bgp.event_history_errors = 'size_medium'
|
673
|
+
assert_equal('size_medium', bgp.event_history_errors)
|
674
|
+
bgp.event_history_errors = 'size_disable'
|
675
|
+
assert_equal('false', bgp.event_history_errors)
|
676
|
+
bgp.event_history_errors = '100000'
|
677
|
+
assert_equal('100000', bgp.event_history_errors)
|
678
|
+
bgp.event_history_errors = bgp.default_event_history_errors
|
679
|
+
assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
|
680
|
+
end
|
681
|
+
|
682
|
+
def test_event_history_events
|
683
|
+
bgp = setup_default
|
684
|
+
if validate_property_excluded?('bgp', 'event_history_events')
|
685
|
+
assert_nil(bgp.event_history_events)
|
686
|
+
assert_raises(Cisco::UnsupportedError) do
|
687
|
+
bgp.event_history_events = 'true'
|
595
688
|
end
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
689
|
+
return
|
690
|
+
end
|
691
|
+
assert_equal(bgp.default_event_history_events, bgp.event_history_events)
|
692
|
+
bgp.event_history_events = 'true'
|
693
|
+
assert_equal(bgp.default_event_history_events, bgp.event_history_events)
|
694
|
+
bgp.event_history_events = 'false'
|
695
|
+
assert_equal('false', bgp.event_history_events)
|
696
|
+
bgp.event_history_events = 'size_small'
|
697
|
+
assert_equal('size_small', bgp.event_history_events)
|
698
|
+
bgp.event_history_events = 'size_large'
|
699
|
+
assert_equal('size_large', bgp.event_history_events)
|
700
|
+
bgp.event_history_events = 'size_medium'
|
701
|
+
assert_equal('size_medium', bgp.event_history_events)
|
702
|
+
bgp.event_history_events = 'size_disable'
|
703
|
+
if newer_image_version?
|
704
|
+
assert_equal('false', bgp.event_history_events)
|
705
|
+
else
|
706
|
+
assert_equal('size_disable', bgp.event_history_events)
|
707
|
+
end
|
708
|
+
bgp.event_history_events = '100000'
|
709
|
+
assert_equal('100000', bgp.event_history_events)
|
710
|
+
bgp.event_history_events = bgp.default_event_history_events
|
711
|
+
assert_equal(bgp.default_event_history_events, bgp.event_history_events)
|
712
|
+
end
|
713
|
+
|
714
|
+
def test_event_history_objstore
|
715
|
+
bgp = setup_default
|
716
|
+
if validate_property_excluded?('bgp', 'event_history_objstore')
|
717
|
+
assert_nil(bgp.event_history_objstore)
|
718
|
+
assert_raises(Cisco::UnsupportedError) do
|
719
|
+
bgp.event_history_objstore = 'true'
|
720
|
+
end
|
721
|
+
return
|
722
|
+
end
|
723
|
+
skip('platform not supported for this test') unless newer_image_version?
|
724
|
+
assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
|
725
|
+
bgp.event_history_objstore = 'true'
|
726
|
+
assert_equal('true', bgp.event_history_objstore)
|
727
|
+
bgp.event_history_objstore = 'false'
|
728
|
+
assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
|
729
|
+
bgp.event_history_objstore = 'size_small'
|
730
|
+
assert_equal('size_small', bgp.event_history_objstore)
|
731
|
+
bgp.event_history_objstore = 'size_large'
|
732
|
+
assert_equal('size_large', bgp.event_history_objstore)
|
733
|
+
bgp.event_history_objstore = 'size_medium'
|
734
|
+
assert_equal('size_medium', bgp.event_history_objstore)
|
735
|
+
bgp.event_history_objstore = 'size_disable'
|
736
|
+
assert_equal('false', bgp.event_history_objstore)
|
737
|
+
bgp.event_history_objstore = '100000'
|
738
|
+
assert_equal('100000', bgp.event_history_objstore)
|
739
|
+
bgp.event_history_objstore = bgp.default_event_history_objstore
|
740
|
+
assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
|
741
|
+
end
|
742
|
+
|
743
|
+
def test_event_history_periodic
|
744
|
+
bgp = setup_default
|
745
|
+
if validate_property_excluded?('bgp', 'event_history_periodic')
|
746
|
+
assert_nil(bgp.event_history_periodic)
|
747
|
+
assert_raises(Cisco::UnsupportedError) do
|
748
|
+
bgp.event_history_periodic = 'true'
|
749
|
+
end
|
750
|
+
return
|
751
|
+
end
|
752
|
+
assert_equal(bgp.default_event_history_periodic,
|
753
|
+
bgp.event_history_periodic)
|
754
|
+
bgp.event_history_periodic = 'false'
|
755
|
+
assert_equal('false', bgp.event_history_periodic)
|
756
|
+
bgp.event_history_periodic = 'size_small'
|
757
|
+
assert_equal('size_small', bgp.event_history_periodic)
|
758
|
+
bgp.event_history_periodic = 'size_large'
|
759
|
+
assert_equal('size_large', bgp.event_history_periodic)
|
760
|
+
bgp.event_history_periodic = 'size_medium'
|
761
|
+
assert_equal('size_medium', bgp.event_history_periodic)
|
762
|
+
bgp.event_history_periodic = '100000'
|
763
|
+
assert_equal('100000', bgp.event_history_periodic)
|
764
|
+
bgp.event_history_periodic = 'size_disable'
|
765
|
+
if newer_image_version?
|
766
|
+
assert_equal(bgp.default_event_history_periodic,
|
767
|
+
bgp.event_history_periodic)
|
768
|
+
else
|
769
|
+
assert_equal('size_disable', bgp.event_history_periodic)
|
770
|
+
end
|
771
|
+
bgp.event_history_periodic = 'true'
|
772
|
+
if newer_image_version?
|
773
|
+
assert_equal('true', bgp.event_history_periodic)
|
774
|
+
else
|
775
|
+
assert_equal(bgp.default_event_history_periodic,
|
776
|
+
bgp.event_history_periodic)
|
630
777
|
end
|
778
|
+
bgp.event_history_periodic = bgp.default_event_history_periodic
|
779
|
+
assert_equal(bgp.default_event_history_periodic,
|
780
|
+
bgp.event_history_periodic)
|
631
781
|
end
|
632
782
|
|
633
783
|
def test_fast_external_fallover
|
data/tests/test_snmpuser.rb
CHANGED
data/tests/test_yum.rb
CHANGED
@@ -122,7 +122,7 @@ class TestYum < CiscoTestCase
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def test_package_does_not_exist_error
|
125
|
-
assert_raises(
|
125
|
+
assert_raises(RuntimeError) do
|
126
126
|
Yum.install('bootflash:this_is_not_real.rpm', 'management')
|
127
127
|
end
|
128
128
|
assert_raises(RuntimeError) do
|
data/tests/yum_package.yaml
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
version: '1.0.0-7.0.3.I4.2'
|
30
30
|
|
31
31
|
7_0_3_I5_1_:
|
32
|
-
filename: 'nxos.sample-
|
33
|
-
name: 'nxos.sample-
|
32
|
+
filename: 'nxos.sample-n9k_ALL-1.0.0-7.0.3.I5.1.lib32_n9000.rpm'
|
33
|
+
name: 'nxos.sample-n9k_ALL'
|
34
34
|
version: '1.0.0-7.0.3.I5.1'
|
35
35
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cisco_node_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Gries
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2016-
|
17
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: bundler
|