Skip to content

Commit 0976d7f

Browse files
authored
Merge pull request #570 from cisco/release_1.8.0
Release 1.8.0
2 parents e388a13 + 7344cf4 commit 0976d7f

File tree

90 files changed

+1211
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1211
-605
lines changed

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
Changelog
22
=========
33

4+
## [v1.8.0]
5+
6+
#### Cisco Resources
7+
* ObjectGroup
8+
* object_group (@saichint)
9+
* object_group_entry (@saichint)
10+
11+
### Added
12+
* Extend syslog_server with attributes:
13+
* `port`
14+
* Extend syslog_settings with attributes:
15+
* `console`
16+
* `monitor`
17+
* `source_interface`
18+
* Extend radius_global with attributes:
19+
* `source_interface`
20+
* Extend tacacs_global with attributes:
21+
* `source_interface`
22+
23+
### Changed
24+
* syslog_server initialize now uses options hash
25+
* Prior to this release syslog_server accepted positional arguments for name,
26+
level, and vrf. New behavior is to pass attributes as a hash.
27+
28+
Example:
29+
```
30+
options = { 'name' => '1.1.1.1', 'level' => '4', 'port' => '2154',
31+
'vrf' => 'red' }
32+
Cisco::SyslogServer.new(options, true)
33+
```
34+
* tacacs_global key removal fixed
35+
* Prior to this release key removal was done by passing in a value of 8. A
36+
nil value is now used. Added intelligence to determine key format
37+
automatically for removal.
38+
439
## [v1.7.0]
540

641
### New feature support
@@ -478,6 +513,7 @@ Changelog
478513
[git-flow]: https://github.com/petervanderdoes/gitflow-avh
479514
[SimpleCov]: https://github.com/colszowka/simplecov
480515

516+
[v1.8.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.7.0...v1.8.0
481517
[v1.7.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.6.0...v1.7.0
482518
[v1.6.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.5.0...v1.6.0
483519
[v1.5.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.4.1...v1.5.0

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Cisco Network Elements support a rich set of features to make networks robust, e
44
## Getting Started
55

66
* Create a [GitHub account](https://github.com/signup/free)
7-
* A virtual Nexus N9000/N3000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can obtain a copy of a virtual Nexus N9000/N3000 by sending their [cisco.com](http://cisco.com) user ID in an email to <get-n9kv@cisco.com>. If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
7+
* Please note: For Cisco Nexus 9k platforms, a virtual Nexus N9000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can [download the software on CCO.](https://software.cisco.com/download/release.html?mdfid=286312239&softwareid=282088129&release=7.0(3)I5(2)&relind=AVAILABLE&rellifecycle=&reltype=latest) If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
88

99
## Making Changes
1010

@@ -40,4 +40,4 @@ git config --global user.email johndoe@example.com
4040
# Additional Resources
4141

4242
* [General GitHub documentation](http://help.github.com/)
43-
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
43+
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ Platform | OS | OS Version |
4444
------------------|--------|----------------------|
4545
Cisco Nexus N9k | NX-OS | 7.0(3)I2(1) and later
4646
Cisco Nexus N3k | NX-OS | 7.0(3)I2(1) and later
47+
Cisco Nexus N3K-F | NX-OS | 7.0(3)F3(2) and later
4748
Cisco Nexus N5k | NX-OS | 7.3(0)N1(1) and later
4849
Cisco Nexus N6k | NX-OS | 7.3(0)N1(1) and later
4950
Cisco Nexus N7k | NX-OS | 7.3(0)D1(1) and later
5051
Cisco Nexus N9K-F | NX-OS | 7.0(3)F1(1) and later
5152

52-
Please note: For Cisco Nexus 3k and 9k platforms, a virtual Nexus N9000/N3000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can obtain a copy of a virtual Nexus N9000/N3000 by sending their [cisco.com](http://cisco.com) user ID in an email to <get-n9kv@cisco.com>. If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
53+
Please note: For Cisco Nexus 9k platforms, a virtual Nexus N9000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can [download the software on CCO.](https://software.cisco.com/download/release.html?mdfid=286312239&softwareid=282088129&release=7.0(3)I5(2)&relind=AVAILABLE&rellifecycle=&reltype=latest) If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
5354

5455
## <a name="installation">Installation</a>
5556

cisco_node_utils.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Currently supports NX-OS nodes.
3131
spec.add_development_dependency 'bundler', '~> 1.7'
3232
spec.add_development_dependency 'kwalify', '~> 0.7.2'
3333
spec.add_development_dependency 'minitest', '~> 5.0'
34+
spec.add_development_dependency 'net-telnet', '~> 0.1.1'
3435
spec.add_development_dependency 'rake', '~> 10.0'
3536
spec.add_development_dependency 'rspec', '~> 3.0'
3637
spec.add_development_dependency 'rubocop', '= 0.35.1'

docs/README-develop-node-utils-APIs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ fi
7070

7171
### <a name="prereq_vm">Nexus VM (optional)</a>
7272

73-
A virtual Nexus N9000/N3000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can obtain a copy of a virtual Nexus N9000/N3000 by sending their [cisco.com](http://cisco.com) user ID in an email to <get-n9kv@cisco.com>. If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
73+
A virtual Nexus N9000 may be helpful for development and testing. Users with a valid [cisco.com](http://cisco.com) user ID can [download the software on CCO.](https://software.cisco.com/download/release.html?mdfid=286312239&softwareid=282088129&release=7.0(3)I5(2)&relind=AVAILABLE&rellifecycle=&reltype=latest) If you do not have a [cisco.com](http://cisco.com) user ID please register for one at [https://tools.cisco.com/IDREG/guestRegistration](https://tools.cisco.com/IDREG/guestRegistration)
74+
7475

7576

7677
## <a name="clone">Start here: Fork and Clone the Repo</a>

lib/cisco_node_utils/aaa_authentication_login_service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def destroy
5858
if g_str.empty?
5959
# cannot remove default local, so do nothing in this case
6060
unless m == :local
61-
unless node.product_id[/N9K-F/]
62-
# TBD: These 'no' commands currently error on N9K-F
61+
unless node.product_id[/N(3|9)K-F/]
62+
# TBD: These 'no' commands currently error on N(3|9)K-F
6363
# no aaa authentication login console local
6464
# no aaa authentication login console none
6565
config_set('aaa_auth_login_service', 'method',

lib/cisco_node_utils/ace.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def tcp_flags=(tcp_flags)
235235

236236
def established
237237
match = ace_get
238+
return nil unless remark.nil?
238239
return false if match.nil?
239240
return false unless match.names.include?('established')
240241
match[:established] == 'established' ? true : false
@@ -318,6 +319,7 @@ def redirect=(redirect)
318319

319320
def log
320321
match = ace_get
322+
return nil unless remark.nil?
321323
return false if match.nil?
322324
return false unless match.names.include?('log')
323325
match[:log] == 'log' ? true : false

lib/cisco_node_utils/bgp.rb

Lines changed: 34 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# June 2015, Michael G Wiebe
22
#
3-
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
3+
# Copyright (c) 2015-2017 Cisco and/or its affiliates.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -56,9 +56,9 @@ def self.routers
5656
end
5757
hash_final.merge!(hash_tmp)
5858
return hash_final
59-
rescue Cisco::CliError => e
60-
# cmd will syntax reject when feature is not enabled
61-
raise unless e.clierror =~ /Syntax error/
59+
rescue Cisco::CliError
60+
# cmd will error when feature 'bgp' is not enabled
61+
raise if Feature.bgp_enabled?
6262
return {}
6363
end
6464

@@ -414,14 +414,11 @@ def default_enforce_first_as
414414
# Nvgen as True With optional 'size <size>
415415
def event_history_cli
416416
match = config_get('bgp', 'event_history_cli', @get_args)
417-
if match.is_a?(Array)
418-
return 'false' if match[0] == 'no '
419-
if match[1]
420-
return match[1] if match[1][/\A\d+\z/]
421-
return 'size_' + match[1]
422-
end
423-
end
424-
default_event_history_cli
417+
return unless match.is_a?(Array)
418+
return 'false' if match[0] == 'no '
419+
return unless match[1]
420+
return match[1] if match[1][/\A\d+\z/]
421+
'size_' + match[1]
425422
end
426423

427424
def event_history_cli=(val)
@@ -432,23 +429,15 @@ def event_history_cli=(val)
432429
set_args_keys_default
433430
end
434431

435-
def default_event_history_cli
436-
config_get_default('bgp', 'event_history_cli')
437-
end
438-
439432
# event-history detail [ size <size> ]
440433
# Nvgen as True With optional 'size <size>
441434
def event_history_detail
442435
match = config_get('bgp', 'event_history_detail', @get_args)
443-
if match.is_a?(Array)
444-
return 'false' if match[0] == 'no '
445-
if match[1]
446-
return match[1] if match[1][/\A\d+\z/]
447-
return 'size_' + match[1]
448-
end
449-
return 'true'
450-
end
451-
default_event_history_detail
436+
return unless match.is_a?(Array)
437+
return 'false' if match[0] == 'no '
438+
return 'true' unless match[1]
439+
return match[1] if match[1][/\A\d+\z/]
440+
'size_' + match[1]
452441
end
453442

454443
def event_history_detail=(val)
@@ -459,22 +448,15 @@ def event_history_detail=(val)
459448
set_args_keys_default
460449
end
461450

462-
def default_event_history_detail
463-
config_get_default('bgp', 'event_history_detail')
464-
end
465-
466451
# event-history errors [ size <size> ]
467452
# Nvgen as True With optional 'size <size>
468453
def event_history_errors
469454
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
455+
return unless match.is_a?(Array)
456+
return 'false' if match[0] == 'no '
457+
return unless match[1]
458+
return match[1] if match[1][/\A\d+\z/]
459+
'size_' + match[1]
478460
end
479461

480462
def event_history_errors=(val)
@@ -485,22 +467,15 @@ def event_history_errors=(val)
485467
set_args_keys_default
486468
end
487469

488-
def default_event_history_errors
489-
config_get_default('bgp', 'event_history_errors')
490-
end
491-
492470
# event-history events [ size <size> ]
493471
# Nvgen as True With optional 'size <size>
494472
def event_history_events
495473
match = config_get('bgp', 'event_history_events', @get_args)
496-
if match.is_a?(Array)
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
502-
end
503-
default_event_history_events
474+
return unless match.is_a?(Array)
475+
return 'false' if match[0] == 'no '
476+
return unless match[1]
477+
return match[1] if match[1][/\A\d+\z/]
478+
'size_' + match[1]
504479
end
505480

506481
def event_history_events=(val)
@@ -511,28 +486,15 @@ def event_history_events=(val)
511486
set_args_keys_default
512487
end
513488

514-
def default_event_history_events
515-
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
516-
node.product_id[/(N5|N6|N7|N9.*-F)/]
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-
523489
# event-history objstore [ size <size> ]
524490
# Nvgen as True With optional 'size <size>
525491
def event_history_objstore
526492
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
493+
return unless match.is_a?(Array)
494+
return 'false' if match[0] == 'no '
495+
return 'true' unless match[1]
496+
return match[1] if match[1][/\A\d+\z/]
497+
'size_' + match[1]
536498
end
537499

538500
def event_history_objstore=(val)
@@ -543,25 +505,15 @@ def event_history_objstore=(val)
543505
set_args_keys_default
544506
end
545507

546-
def default_event_history_objstore
547-
config_get_default('bgp', 'event_history_objstore')
548-
end
549-
550508
# event-history periodic [ size <size> ]
551509
# Nvgen as True With optional 'size <size>
552510
def event_history_periodic
553511
match = config_get('bgp', 'event_history_periodic', @get_args)
554-
if match.is_a?(Array)
555-
return 'false' if match[0] == 'no '
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
562-
end
563-
return 'true' unless default_event_history_periodic[/size/]
564-
default_event_history_periodic
512+
return unless match.is_a?(Array)
513+
return 'false' if match[0] == 'no '
514+
return unless match[1]
515+
return match[1] if match[1][/\A\d+\z/]
516+
'size_' + match[1]
565517
end
566518

567519
def event_history_periodic=(val)
@@ -572,15 +524,6 @@ def event_history_periodic=(val)
572524
set_args_keys_default
573525
end
574526

575-
def default_event_history_periodic
576-
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
577-
node.product_id[/(N5|N6|N7|N9.*-F)/]
578-
config_get_default('bgp', 'event_history_periodic')
579-
else
580-
config_get('bgp', 'event_history_periodic_bytes', @get_args)
581-
end
582-
end
583-
584527
# Fast External fallover (Getter/Setter/Default)
585528
def fast_external_fallover
586529
config_get('bgp', 'fast_external_fallover', @get_args)

lib/cisco_node_utils/bridge_domain.rb

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,27 @@ def destroy
124124
# PROPERTIES #
125125
########################################################
126126

127-
# Bridge-Domain name assigning case
128-
# bridge-domain 100
129-
# name bd100
130127
def bd_name
131128
config_get('bridge_domain', 'bd_name', bd: @bd_ids)
132129
end
133130

134131
def bd_name=(str)
135-
str = str.to_s
136132
state = str.empty? ? 'no' : ''
137133
config_set('bridge_domain', 'bd_name', bd: @bd_ids, state: state,
138134
name: str)
139135
end
140136

137+
# This default getter is a bit different them most. When a brige-domain
138+
# gets created it gets a default name assigned that follows the pattern
139+
# 'Bridge-DomainX' where X is the bridge domain id (@bd_ids).
141140
def default_bd_name
142-
config_get_default('bridge_domain', 'bd_name')
141+
'Bridge-Domain' + @bd_ids
143142
end
144143

145-
# Bridge-Domain type change to fabric-control
146-
# bridge-domain 100
147-
# fabric-control
148144
# This type property can be defined only for one bd
149145
def fabric_control
150-
config_get('bridge_domain', 'fabric_control', bd: @bd_ids)
146+
match = config_get('bridge_domain', 'fabric_control', bd: @bd_ids)
147+
match == @bd_ids ? true : false
151148
end
152149

153150
def fabric_control=(val)
@@ -159,11 +156,9 @@ def default_fabric_control
159156
config_get_default('bridge_domain', 'fabric_control')
160157
end
161158

162-
# Bridge-Domain Shutdown case
163-
# bridge-domain 100
164-
# shutdown
165159
def shutdown
166-
config_get('bridge_domain', 'shutdown', bd: @bd_ids)
160+
match = config_get('bridge_domain', 'shutdown', bd: @bd_ids)
161+
match == 'Noshutdown' ? false : true
167162
end
168163

169164
def shutdown=(val)

0 commit comments

Comments
 (0)