Skip to content

Commit 81a01ee

Browse files
authored
Release 1.4.0 (#485)
Merge Release 1.4.0 --> Master
1 parent f1523df commit 81a01ee

File tree

148 files changed

+9031
-3185
lines changed

Some content is hidden

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

148 files changed

+9031
-3185
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pkg/*
33
vendor/*
44
coverage
55
ext/Rakefile
6+
tests/tacacs_server.yaml
67
Gemfile.lock
78
*.gem
89
*.swp

CHANGELOG.md

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

4+
## [v1.4.0]
5+
6+
### New feature support
7+
8+
#### Cisco Resources
9+
* Bidirectional Forwarding Detection
10+
* bfd (@saichint)
11+
* Dynamic Host Configuration Protocol
12+
* dhcp_relay_global (@saichint)
13+
* OSPF
14+
* ospf_area (@saichint)
15+
* ospf_area_vlink (@saichint)
16+
17+
### Added
18+
19+
* Extend interface with attributes:
20+
* `bfd_echo`
21+
* `ipv4_dhcp_relay_addr`
22+
* `ipv4_dhcp_relay_info_trust`
23+
* `ipv4_dhcp_relay_src_addr_hsrp`
24+
* `ipv4_dhcp_relay_src_intf`
25+
* `ipv4_dhcp_relay_subnet_broadcast`
26+
* `ipv4_dhcp_smart_relay`
27+
* `ipv6_dhcp_relay_addr`
28+
* `ipv6_dhcp_relay_src_intf`
29+
* `storm_control_broadcast`
30+
* `storm_control_multicast`
31+
* `storm_control_unicast`
32+
* Extend interface_ospf with attributes:
33+
* `bfd`
34+
* `mtu_ignore`
35+
* `network_type`
36+
* `priority`
37+
* `shutdown`
38+
* `transmit_delay`
39+
* Extend interface_portchannel with attributes:
40+
* `bfd_per_link`
41+
* Extend router_ospf_vrf with attributes:
42+
* `bfd`
43+
* Extend bgp_neighbor with attributes:
44+
* `bfd`
45+
46+
### Changed
47+
* Deprecated `vlan` private-vlan properties and replaced with new methods. New file `vlan_DEPRECATED.rb` has been created to store the deprecated methods. The old -> new properties are:
48+
49+
| Old Name | New Name(s) |
50+
|:---|:---:|
51+
| `private_vlan_association` | `pvlan_association`
52+
| `private_vlan_type` | `pvlan_type`
53+
54+
* Deprecated `interface` private-vlan properties and replaced with new methods. New files `interface_DEPRECATED.rb` and `DEPRECATED.yaml` have been created to store the deprecated methods. The old -> new properties are:
55+
56+
| Old Name | New Name(s) |
57+
|:---|:---:|
58+
| `private_vlan_mapping` | `pvlan_mapping`
59+
| `switchport_mode_private_vlan_host` | `switchport_pvlan_host`, `switchport_pvlan_promiscuous`,
60+
| `switchport_mode_private_vlan_host_association` | `switchport_pvlan_host_association`
61+
| `switchport_mode_private_vlan_host_promiscous` | `switchport_pvlan_mapping`
62+
| `switchport_mode_private_vlan_trunk_promiscuous`| `switchport_pvlan_trunk_promiscuous`
63+
| `switchport_mode_private_vlan_trunk_secondary` | `switchport_pvlan_trunk_secondary`
64+
| `switchport_private_vlan_association_trunk` | `switchport_pvlan_trunk_association`
65+
| `switchport_private_vlan_mapping_trunk` | `switchport_pvlan_mapping_trunk`
66+
| `switchport_private_vlan_trunk_allowed_vlan` | `switchport_pvlan_trunk_allowed_vlan`
67+
| `switchport_private_vlan_trunk_native_vlan` | `switchport_pvlan_trunk_native_vlan`
68+
469
## [v1.3.0]
570

671
### New feature support
@@ -294,6 +359,7 @@ Changelog
294359
[git-flow]: https://github.com/petervanderdoes/gitflow-avh
295360
[SimpleCov]: https://github.com/colszowka/simplecov
296361

362+
[v1.4.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.3.0...v1.4.0
297363
[v1.3.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.2.0...v1.3.0
298364
[v1.2.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.1.0...v1.2.0
299365
[v1.1.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.0.1...v1.1.0

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ gemspec
77
# but we need them for Bundler to use.
88
gem 'net_http_unix'
99
gem 'grpc'
10+
gem 'pry'

README.md

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ To install the CiscoNodeUtils, use the following command:
6161
Alternatively, if you've checked the source out directly, you can call
6262
`rake install` from the root project directory.
6363

64-
## Configuration
64+
## <a name="configuration">Configuration</a>
6565

66-
This gem may require configuration in order to be used. Two configuration file locations are supported:
66+
Depending on the installation environment (Linux, NX-OS), this gem may require configuration in order to be used. Two configuration file locations are supported:
6767

6868
* `/etc/cisco_node_utils.yaml` (system and/or root user configuration)
6969
* `~/cisco_node_utils.yaml` (per-user configuration)
@@ -72,13 +72,16 @@ If both files exist and are readable, configuration in the user-specific file wi
7272

7373
This file specifies the host, port, username, and/or password to be used to connect to one or more nodes.
7474

75+
* When installing this gem on NX-OS nodes, this file is generally not needed, as the default client behavior is sufficient.
7576
* When developing for or testing this gem, this file can specify one or more NX-OS nodes to run tests against. In this case:
76-
- A node labeled as `default` will be the default node to test against.
77-
- Nodes with other names can be selected at test execution time.
78-
- NX-OS nodes must be defined with a `host` (hostname or IP address), `username`, and `password`.
77+
- A node labeled as `default` will be the default node to test against.
78+
- Nodes with other names can be selected at test execution time.
79+
- NX-OS nodes must be defined with a `host` (hostname or IP address), `username`, and `password`.
7980

8081
An example configuration file (illustrating each of the above scenarios) is provided with this gem at [`docs/cisco_node_utils.yaml.example`](docs/cisco_node_utils.yaml.example).
8182

83+
*For security purposes, it is highly recommended that access to this file be restricted to only the owning user (`chmod 0600`).*
84+
8285
## <a name="documentation">Documentation</a>
8386

8487
### Client
@@ -119,64 +122,62 @@ provider classes, and not directly call into `CommandReference` or `Node`.
119122

120123
## <a name="examples">Examples</a>
121124

122-
123125
These utilities can be used directly on a Cisco device (as used by Puppet
124126
and Chef) or can run on a workstation and point to a Cisco device (as used
125-
by the included minitest suite).
127+
by the included minitest suite). The Client and Node APIs will read
128+
connection information (host, username, etc.) from a
129+
[configuration file](#configuration). When creating a Client
130+
you can choose which device in the config file to connect to by specifying a label
131+
(if no label is specified, "default" is assumed). If a configuration file cannot be
132+
found, the Client or Node will attempt to connect to the local device.
126133

127-
### Usage on a Cisco device
128-
129-
#### Low-level Client API
130-
131-
```ruby
132-
require 'cisco_node_utils'
134+
*Note: Entries in the configuration file can specify local or remote devices.*
133135

134-
# get a connection to the local device
135-
client = Cisco::Client.create()
136-
137-
client.get(command: 'show version')
138-
client.set(values: 'vtp domain mycompany.com')
139-
```
140-
141-
#### High-level Node API
142-
143-
```ruby
144-
require 'cisco_node_utils'
145-
146-
# get a connection to the local device
147-
node = Cisco::Node.instance()
148-
149-
version = node.config_get("show_version", "system_image")
150-
151-
node.config_set("vtp", "domain", "mycompany.com")
152-
```
153-
154-
### Remote usage
136+
### Cisco Nexus Device (supports CLI configuration)
155137

156138
#### Low-level Client API
157139

158140
```ruby
159141
require 'cisco_node_utils'
160142

161-
client = Cisco::Client.create('n3k.mycompany.com', 'username', 'password')
143+
# Create a connection to the following nodes:
144+
# - 'default' device defined in the cisco_node_utils.yaml file
145+
# - 'n9k' device defined in the cisco_node_utils.yaml file
146+
client1 = Cisco::Client.create()
147+
client2 = Cisco::Client.create('n9k')
148+
# Warning: Make sure to exclude devices using the 'no_proxy' environment variable
149+
# to ensure successful remote connections.
150+
151+
# Use connections to get and set device state.
152+
client1.set(values: 'feature vtp')
153+
client1.set(values: 'vtp domain mycompany.com')
154+
puts client1.get(command: 'show vtp status | inc Domain')
162155

163-
client.get(command: 'show version')
164-
client.set(values: 'vtp domain mycompany.com')
156+
puts client2.get(command: 'show version')
165157
```
166158

167159
#### High-level Node API
168160

169161
```ruby
170162
require 'cisco_node_utils'
171163

172-
node = Cisco::Node.new("n3k.mycompany.com", "username", "password")
173-
174-
version = node.config_get("show_version", "system_image")
175-
176-
node.config_set("vtp", "domain", "mycompany.com")
164+
# Create a connection to the following:
165+
# - 'default' device defined in the cisco_node_utils.yaml
166+
node = Cisco::Node.instance()
167+
# OR:
168+
# - 'n9k' device defined in the cisco_node_utils.yaml file
169+
# Cisco::Environment.default_environment_name = 'n9k'
170+
# node = Cisco::Node.instance()
171+
172+
# Warning: Make sure to exclude devices using the 'no_proxy' environment variable
173+
# to ensure successful remote connections.
174+
175+
# Use connection to get and set device state.
176+
node.config_set('feature', 'vtp', state: '')
177+
node.config_set('vtp', 'domain', domain: 'mycompany.com')
178+
puts node.config_get('vtp', 'domain')
177179
```
178180

179-
180181
## <a name="changelog">Changelog</a>
181182

182183

bin/.rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
inherit_from: ../.rubocop.yml
2+
3+
# Baseline code complexity metrics for the bin/ subdirectory:
4+
5+
Metrics/AbcSize:
6+
Max: 49
7+
8+
Metrics/CyclomaticComplexity:
9+
Max: 23
10+
11+
Metrics/MethodLength:
12+
Max: 50
13+
14+
Metrics/ParameterLists:
15+
Max: 9
16+
17+
Metrics/PerceivedComplexity:
18+
Max: 24

0 commit comments

Comments
 (0)