cisco_node_utils 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +81 -2
- data/CONTRIBUTING.md +2 -17
- data/Gemfile +5 -0
- data/README.md +92 -47
- data/Rakefile +23 -1
- data/bin/git/hooks/hook_lib +7 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +7 -2
- data/bin/git/hooks/pre-commit/validate-diffs +18 -4
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/update-hooks +64 -6
- data/cisco_node_utils.gemspec +9 -6
- data/docs/README-develop-best-practices.md +149 -50
- data/docs/README-develop-node-utils-APIs.md +92 -42
- data/docs/README-maintainers.md +7 -4
- data/docs/README-test-execution.md +57 -0
- data/docs/cisco_node_utils.yaml.example +30 -0
- data/docs/template-router.rb +4 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +2 -2
- data/lib/cisco_node_utils.rb +5 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +5 -6
- data/lib/cisco_node_utils/aaa_authorization_service.rb +1 -1
- data/lib/cisco_node_utils/ace.rb +165 -12
- data/lib/cisco_node_utils/acl.rb +2 -1
- data/lib/cisco_node_utils/bgp.rb +184 -21
- data/lib/cisco_node_utils/bgp_af.rb +94 -249
- data/lib/cisco_node_utils/bgp_neighbor.rb +94 -14
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +75 -8
- data/lib/cisco_node_utils/bridge_domain.rb +183 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +85 -2
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/client/client.rb +234 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +311 -0
- data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
- data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
- data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
- data/lib/cisco_node_utils/client/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +305 -0
- data/lib/cisco_node_utils/client/utils.rb +164 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +222 -254
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +22 -15
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +21 -16
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +239 -109
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +114 -55
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +76 -52
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +106 -62
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +35 -14
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +23 -17
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +94 -83
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +22 -17
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +76 -26
- data/lib/cisco_node_utils/cmd_ref/images.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +381 -153
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +21 -21
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +30 -21
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +18 -13
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +26 -31
- data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
- data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +17 -6
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +10 -3
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +17 -5
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +33 -29
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +12 -10
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +16 -19
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +40 -25
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +17 -12
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +71 -35
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +10 -5
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +6 -2
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +47 -43
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +13 -11
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +4 -2
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +23 -21
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +26 -22
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +19 -17
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +18 -6
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +234 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +24 -9
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +5 -3
- data/lib/cisco_node_utils/cmd_ref/system.yaml +4 -3
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +22 -20
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +27 -15
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +45 -16
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +60 -32
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +118 -101
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +54 -58
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +118 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +19 -25
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +28 -18
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +34 -17
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +6 -4
- data/lib/cisco_node_utils/command_reference.rb +261 -142
- data/lib/cisco_node_utils/constants.rb +33 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +102 -0
- data/lib/cisco_node_utils/evpn_vni.rb +5 -3
- data/lib/cisco_node_utils/exceptions.rb +111 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +52 -35
- data/lib/cisco_node_utils/fabricpath_topology.rb +44 -57
- data/lib/cisco_node_utils/feature.rb +165 -3
- data/lib/cisco_node_utils/interface.rb +1051 -260
- data/lib/cisco_node_utils/interface_channel_group.rb +11 -10
- data/lib/cisco_node_utils/interface_ospf.rb +1 -2
- data/lib/cisco_node_utils/interface_portchannel.rb +4 -12
- data/lib/cisco_node_utils/interface_service_vni.rb +7 -7
- data/lib/cisco_node_utils/itd_device_group.rb +248 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +523 -0
- data/lib/cisco_node_utils/logger.rb +75 -0
- data/lib/cisco_node_utils/node.rb +62 -192
- data/lib/cisco_node_utils/node_util.rb +56 -10
- data/lib/cisco_node_utils/overlay_global.rb +2 -2
- data/lib/cisco_node_utils/pim.rb +2 -13
- data/lib/cisco_node_utils/pim_group_list.rb +1 -1
- data/lib/cisco_node_utils/pim_rp_address.rb +1 -1
- data/lib/cisco_node_utils/platform.rb +52 -21
- data/lib/cisco_node_utils/portchannel_global.rb +89 -19
- data/lib/cisco_node_utils/radius_server.rb +168 -37
- data/lib/cisco_node_utils/router_ospf.rb +20 -35
- data/lib/cisco_node_utils/router_ospf_vrf.rb +4 -4
- data/lib/cisco_node_utils/snmpserver.rb +1 -6
- data/lib/cisco_node_utils/snmpuser.rb +6 -4
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_server.rb +77 -18
- data/lib/cisco_node_utils/syslog_settings.rb +1 -1
- data/lib/cisco_node_utils/tacacs_server_group.rb +8 -4
- data/lib/cisco_node_utils/tacacs_server_host.rb +115 -25
- data/lib/cisco_node_utils/vdc.rb +12 -0
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +147 -29
- data/lib/cisco_node_utils/vpc.rb +55 -3
- data/lib/cisco_node_utils/vrf.rb +72 -11
- data/lib/cisco_node_utils/vrf_af.rb +114 -29
- data/lib/cisco_node_utils/vtp.rb +34 -52
- data/lib/cisco_node_utils/vxlan_vtep.rb +34 -8
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +36 -4
- data/lib/minitest/environment_plugin.rb +31 -0
- data/lib/minitest/log_level_plugin.rb +41 -0
- data/spec/client_spec.rb +7 -0
- data/spec/environment_spec.rb +263 -0
- data/spec/grpc_client_spec.rb +23 -0
- data/spec/isolate/all_clients_spec.rb +9 -0
- data/spec/isolate/grpc_only_spec.rb +16 -0
- data/spec/isolate/no_clients_spec.rb +26 -0
- data/spec/isolate/nxapi_only_spec.rb +16 -0
- data/spec/nxapi_client_spec.rb +42 -0
- data/spec/schema.yaml +75 -0
- data/spec/shared_examples_for_clients.rb +14 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/whitespace_spec.rb +10 -0
- data/spec/yaml_spec.rb +42 -0
- data/tests/.rubocop.yml +2 -2
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +96 -36
- data/tests/ciscotest.rb +220 -12
- data/tests/cmd_config.yaml +71 -49
- data/tests/cmd_config_invalid.yaml +1 -1
- data/tests/test_aaa_authentication_login.rb +1 -0
- data/tests/test_aaa_authentication_login_service.rb +9 -0
- data/tests/test_aaa_authorization_service.rb +173 -367
- data/tests/test_ace.rb +171 -100
- data/tests/test_acl.rb +10 -1
- data/tests/test_bgp_af.rb +395 -728
- data/tests/test_bgp_neighbor.rb +274 -115
- data/tests/test_bgp_neighbor_af.rb +178 -77
- data/tests/test_bridge_domain.rb +191 -0
- data/tests/test_bridge_domain_vni.rb +116 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_command_config.rb +9 -5
- data/tests/test_command_reference.rb +380 -102
- data/tests/test_dns_domain.rb +13 -3
- data/tests/test_domain_name.rb +13 -3
- data/tests/test_encapsulation.rb +77 -0
- data/tests/test_evpn_vni.rb +25 -7
- data/tests/test_fabricpath_global.rb +167 -163
- data/tests/test_fabricpath_topology.rb +12 -33
- data/tests/test_feature.rb +215 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_interface.rb +585 -344
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +6 -3
- data/tests/test_interface_ospf.rb +26 -24
- data/tests/test_interface_portchannel.rb +1 -0
- data/tests/test_interface_private_vlan.rb +724 -0
- data/tests/test_interface_service_vni.rb +37 -66
- data/tests/test_interface_svi.rb +98 -101
- data/tests/test_interface_switchport.rb +419 -549
- data/tests/test_itd_device_group.rb +145 -0
- data/tests/test_itd_device_group_node.rb +199 -0
- data/tests/test_itd_service.rb +298 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +11 -2
- data/tests/test_node.rb +16 -75
- data/tests/test_node_ext.rb +174 -163
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_config.rb +5 -1
- data/tests/test_ntp_server.rb +2 -2
- data/tests/test_nxapi.rb +221 -0
- data/tests/test_overlay_global.rb +47 -38
- data/tests/test_pim.rb +2 -0
- data/tests/test_pim_group_list.rb +2 -0
- data/tests/test_pim_rp_address.rb +2 -0
- data/tests/test_platform.rb +86 -39
- data/tests/test_portchannel_global.rb +211 -135
- data/tests/test_radius_global.rb +13 -5
- data/tests/test_radius_server.rb +256 -104
- data/tests/test_radius_server_group.rb +2 -0
- data/tests/test_router_bgp.rb +781 -485
- data/tests/test_router_ospf.rb +26 -103
- data/tests/test_router_ospf_vrf.rb +52 -57
- data/tests/test_snmp_notification_receiver.rb +2 -0
- data/tests/test_snmpcommunity.rb +2 -0
- data/tests/test_snmpgroup.rb +2 -0
- data/tests/test_snmpnotification.rb +40 -21
- data/tests/test_snmpserver.rb +2 -0
- data/tests/test_snmpuser.rb +2 -0
- data/tests/test_stp_global.rb +563 -0
- data/tests/test_syslog_server.rb +32 -8
- data/tests/test_syslog_settings.rb +22 -9
- data/tests/test_tacacs_server.rb +32 -27
- data/tests/test_tacacs_server_group.rb +100 -45
- data/tests/test_tacacs_server_host.rb +135 -43
- data/tests/test_vdc.rb +2 -16
- data/tests/test_vlan.rb +106 -54
- data/tests/test_vlan_mt_full.rb +11 -21
- data/tests/test_vlan_private.rb +669 -0
- data/tests/test_vpc.rb +312 -159
- data/tests/test_vrf.rb +122 -113
- data/tests/test_vrf_af.rb +238 -0
- data/tests/test_vtp.rb +58 -102
- data/tests/test_vxlan_vtep.rb +38 -17
- data/tests/test_vxlan_vtep_vni.rb +61 -9
- data/tests/test_yum.rb +49 -25
- metadata +122 -36
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +0 -9
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +0 -76
- data/lib/cisco_node_utils/vni.rb +0 -227
- data/tests/test_vni.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e705a28917168a277c351451f63491ff3c1177
|
4
|
+
data.tar.gz: 4e2be35191668158a0b757b831cd1ee135ae7525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 734d65543eeedb4f766a74c8d56f397e638f5fe446846bc4196ec3facfd1f5378f1eefe11364a67089f67a6851f2101438b87526536ab44477df6181281fb39b
|
7
|
+
data.tar.gz: a0d7aaebf7dd5d00a432f4a6c4067860750dd61df4e1fa73da11e6c8440f859f32d1155a412a5a00791a15a1ed024d5e3a08129b6ce74abed9a326ef55cdddfc
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
# Rubocop configuration
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
# Auto-generated files
|
5
|
+
- lib/cisco_node_utils/client/grpc/ems.rb
|
6
|
+
- lib/cisco_node_utils/client/grpc/ems_services.rb
|
7
|
+
# Files we don't own
|
8
|
+
- vendor/**/*
|
2
9
|
|
3
10
|
# Code complexity metrics are tracked separately for lib/ vs. tests/
|
4
11
|
# See lib/.rubocop.yml and tests/.rubocop.yml
|
@@ -40,6 +47,9 @@ Style/AlignHash:
|
|
40
47
|
EnforcedHashRocketStyle: table
|
41
48
|
EnforcedColonStyle: table
|
42
49
|
|
50
|
+
Style/ClassAndModuleChildren:
|
51
|
+
Enabled: false
|
52
|
+
|
43
53
|
# Template files have wildcard strings in class names
|
44
54
|
Style/ClassAndModuleCamelCase:
|
45
55
|
Exclude:
|
@@ -75,6 +85,9 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
75
85
|
Style/TrailingComma:
|
76
86
|
EnforcedStyleForMultiline: comma
|
77
87
|
|
88
|
+
Style/TrivialAccessors:
|
89
|
+
AllowPredicates: true
|
90
|
+
|
78
91
|
# Because an SnmpServer cannot be destroyed, we end most of the SnmpServer
|
79
92
|
# test cases by explicitly returning the configuration to default.
|
80
93
|
# Rubocop thinks this is a no-op but it isn't.
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,80 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## [v1.3.0]
|
5
|
+
|
6
|
+
### New feature support
|
7
|
+
|
8
|
+
#### Cisco Resources
|
9
|
+
* Itd
|
10
|
+
* itd_device_group (@saichint)
|
11
|
+
* itd_device_group_node (@saichint)
|
12
|
+
* itd_service (@saichint)
|
13
|
+
* Spanning Tree
|
14
|
+
* stp_global (@saichint)
|
15
|
+
* Bridge Domain
|
16
|
+
* bridge_domain (@rkorlepa)
|
17
|
+
* bridge_domain_vni (@rkorlepa)
|
18
|
+
* Encapsulation Profile
|
19
|
+
* vni_encapsulation_profile (@rkorlepa)
|
20
|
+
|
21
|
+
#### NetDev Resources
|
22
|
+
*
|
23
|
+
|
24
|
+
### Added
|
25
|
+
|
26
|
+
* Added a new property fabric-control for vlan MT-FULL fabricpath
|
27
|
+
* Added support for bdi interfaces to interface provider.
|
28
|
+
* Added a new node util to handle bridge domain range cli for member vni
|
29
|
+
* Added Bridge Domain, VNI and encapsulation profile node utils for MT-FULL on Nexus 7k.
|
30
|
+
* Minitests can declare the YAML feature they are exercising, and if the feature is `_exclude`d on the node under test, the test case will automatically be skipped in full.
|
31
|
+
* CliErrors raised by any `NodeUtil` subclass or instance will automatically prepend the `to_s` method output to make troubleshooting easier.
|
32
|
+
* `test_feature` minitest
|
33
|
+
* Extend interface with attributes:
|
34
|
+
* `ipv4_forwarding`
|
35
|
+
* `stp_bpdufilter`, `stp_bpduguard`, `stp_cost`, `stp_guard`, `stp_link_type`, `stp_mst_cost`
|
36
|
+
* `stp_mst_port_priority`, `stp_port_priority`, `stp_port_type`, `stp_vlan_cost`, `stp_vlan_port_priority`
|
37
|
+
* `switchport_private_vlan_trunk_allowed_vlan`, `switchport_private_vlan_trunk_native_vlan`
|
38
|
+
* `switchport_mode_private_vlan_host`, `switchport_mode_private_vlan_host_association`
|
39
|
+
* `switchport_mode_private_vlan_host_promiscous`, `switchport_mode_private_vlan_trunk_promiscous`, `switchport_mode_private_vlan_trunk_secondary`
|
40
|
+
* `switchport_private_vlan_association_trunk`, `switchport_private_vlan_mapping_trunk`
|
41
|
+
* `private_vlan_mapping`
|
42
|
+
* Extend Feature class with a class method to list feature compatible interfaces
|
43
|
+
* Extend vdc with interface_membership methods
|
44
|
+
* Extend vpc with vpc+ attributes on Nexus 5k/6k/7k:
|
45
|
+
* `fabricpath_emulated_switch_id`
|
46
|
+
* `fabricpath_multicast_load_balance` (only on Nexus 7k)
|
47
|
+
* `port_channel_limit` (only on Nexus 7k)
|
48
|
+
* Extend vlan with attributes:
|
49
|
+
* `private_vlan_association`, `private_vlan_type`
|
50
|
+
* Added N3k native support for portchannel_global
|
51
|
+
|
52
|
+
### Changed
|
53
|
+
|
54
|
+
* Major refactor and enhancement of `CommandReference` YAML files:
|
55
|
+
- Filtering by platform is now by platform name only.
|
56
|
+
- Replaced `config_get(_token)?(_append)?` with `get_command`, `get_context`, and `get_value`
|
57
|
+
- Replaced `config_set(_append)?` with `set_context`, and `set_value`
|
58
|
+
- Individual token values can be explicitly marked as optional (e.g., VRF context); tokens not marked as optional are mandatory.
|
59
|
+
- Data format (CLI, NXAPI structured) is now assumed to be CLI unless explicitly specified otherwise using the new `(get_|set_)?data_format` YAML key. No more guessing based on whether a key looks like a hash key or a Regexp.
|
60
|
+
* `cisco_nxapi` Gem is no longer a dependency as the NXAPI client code has been merged into this Gem under the `Cisco::Client` namespace.
|
61
|
+
* Improved minitest logging CLI.
|
62
|
+
- `ruby test_foo.rb -l debug` instead of `ruby test_foo.rb -- <host> <user> <pass> debug`
|
63
|
+
- `rake test TESTOPTS='--log-level=debug'`
|
64
|
+
* Client connectivity is now specified in `/etc/cisco_node_utils.yaml` or `~/cisco_node_utils.yaml` instead of environment variables or command-line arguments to minitest.
|
65
|
+
- `ruby test_foo.rb -e <node name defined in YAML>`
|
66
|
+
- `rake test TESTOPTS='--environment=default'`
|
67
|
+
|
68
|
+
### Fixed
|
69
|
+
|
70
|
+
* Interface:
|
71
|
+
- Correctly restore IP address when changing VRF membership
|
72
|
+
- MTU is not supported on loopback interfaces
|
73
|
+
|
74
|
+
### Removed
|
75
|
+
* Removed `Node.lazy_connect` internal API.
|
76
|
+
* Removed `vni` node util class
|
77
|
+
|
4
78
|
## [v1.2.0]
|
5
79
|
|
6
80
|
### New feature support
|
@@ -40,7 +114,7 @@ Changelog
|
|
40
114
|
* vxlan_vtep (@dcheriancisco)
|
41
115
|
* vxlan_vtep_vni (@mikewiebe)
|
42
116
|
|
43
|
-
|
117
|
+
|
44
118
|
### Additional platform support added to existing classes
|
45
119
|
#### Cisco Nexus 56xx, 60xx and 7xxx
|
46
120
|
* AAA
|
@@ -110,7 +184,11 @@ Changelog
|
|
110
184
|
* `vpc_id`, `vpc_peer_link`
|
111
185
|
* switchport mode `fabricpath`
|
112
186
|
* Extend vrf with attributes:
|
187
|
+
* `mhost_ipv4`
|
188
|
+
* `mhost_ipv6`
|
189
|
+
* `remote_route_filtering`
|
113
190
|
* `vni`
|
191
|
+
* `vpn_id`
|
114
192
|
* Extend vlan with attribute:
|
115
193
|
* `mode`
|
116
194
|
|
@@ -119,7 +197,7 @@ Changelog
|
|
119
197
|
* Major refactor and enhancement of `CommandReference` YAML files:
|
120
198
|
- Added support for `auto_default`, `default_only`, `kind`, and `multiple`
|
121
199
|
- Added filtering by product ID (`/N7K/`) and by client type (`cli_nexus`)
|
122
|
-
- `CommandReference` methods that do key-value style wildcard substitution now raise an `ArgumentError` if the result is empty (because not enough parameters were supplied).
|
200
|
+
- `CommandReference` methods that do key-value style wildcard substitution now raise an `ArgumentError` if the result is empty (because not enough parameters were supplied).
|
123
201
|
|
124
202
|
## [v1.1.0]
|
125
203
|
|
@@ -216,6 +294,7 @@ Changelog
|
|
216
294
|
[git-flow]: https://github.com/petervanderdoes/gitflow-avh
|
217
295
|
[SimpleCov]: https://github.com/colszowka/simplecov
|
218
296
|
|
297
|
+
[v1.3.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.2.0...v1.3.0
|
219
298
|
[v1.2.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.1.0...v1.2.0
|
220
299
|
[v1.1.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.0.1...v1.1.0
|
221
300
|
[v1.0.1]: https://github.com/cisco/cisco-network-node-utils/compare/v1.0.0...v1.0.1
|
data/CONTRIBUTING.md
CHANGED
@@ -9,28 +9,13 @@ Cisco Network Elements support a rich set of features to make networks robust, e
|
|
9
9
|
## Making Changes
|
10
10
|
|
11
11
|
* Fork and clone the repository
|
12
|
-
* Run the `bin/git/update-hooks` script to install our recommended Git hooks into your local repository.
|
12
|
+
* Run the `bin/git/update-hooks` script to install our recommended Git hooks into your local repository. (Note: some of the hooks require additional tools, such as the `rubocop` ruby gem, be installed and available in your `$PATH`. See [Ruby Prerequisites](docs/README-develop-node-utils-APIs.md#prereq_ruby) for a list of recommended ruby gems.)
|
13
13
|
* Pull a branch under the "develop" branch for your changes.
|
14
14
|
* Follow all guidelines documented in [README-develop-node_utils-APIs](docs/README-develop-node-utils-APIs.md)
|
15
15
|
* Make changes in your branch.
|
16
16
|
* Testing
|
17
17
|
* Create a minitest script for any new APIs or new functionality
|
18
|
-
* Run all the tests to ensure there was no collateral damage to existing code.
|
19
|
-
1. Use the NODE environment variable to specify the address, username, and password:
|
20
|
-
|
21
|
-
```bash
|
22
|
-
export NODE="192.168.100.1 user password"
|
23
|
-
rake test
|
24
|
-
```
|
25
|
-
|
26
|
-
2. Enter the connection information at runtime:
|
27
|
-
|
28
|
-
```
|
29
|
-
rake test
|
30
|
-
Enter address or hostname of node under test: 192.168.100.1
|
31
|
-
Enter username for node under test: user
|
32
|
-
Enter password for node under test: password
|
33
|
-
```
|
18
|
+
* Run all the tests to ensure there was no collateral damage to existing code. See [README-test-execution](docs/README-test-execution.md) for details.
|
34
19
|
|
35
20
|
* Committing
|
36
21
|
* Check for unnecessary whitespace with `git diff --check` before committing.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -23,12 +23,13 @@ Please see [Learning Resources](#resources) for additional references.
|
|
23
23
|
#### Table of Contents
|
24
24
|
|
25
25
|
1. [Overview](#overview)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
1. [Installation](#installation)
|
27
|
+
1. [Configuration](#configuration)
|
28
|
+
1. [Documentation](#documentation)
|
29
|
+
1. [Examples](#examples)
|
30
|
+
1. [Changelog](#changelog)
|
31
|
+
1. [Learning Resources](#resources)
|
32
|
+
1. [License Information](#license_info)
|
32
33
|
|
33
34
|
|
34
35
|
## <a name="overview">Overview</a>
|
@@ -39,17 +40,13 @@ open source management tools.
|
|
39
40
|
|
40
41
|
This CiscoNodeUtils gem release supports the following:
|
41
42
|
|
42
|
-
Platform | OS
|
43
|
-
|
44
|
-
Cisco Nexus
|
45
|
-
Cisco Nexus
|
46
|
-
Cisco Nexus
|
47
|
-
Cisco Nexus
|
48
|
-
Cisco
|
49
|
-
Cisco Nexus 56xx | NX-OS | 7.3(0)N1(1) and later
|
50
|
-
Cisco Nexus 60xx | NX-OS | 7.3(0)N1(1) and later
|
51
|
-
Cisco Nexus 7xxx | NX-OS | 7.3(0)D1(1) and later
|
52
|
-
|
43
|
+
Platform | OS | OS Version |
|
44
|
+
-----------------|--------|----------------------|
|
45
|
+
Cisco Nexus N9k | NX-OS | 7.0(3)I2(1) and later
|
46
|
+
Cisco Nexus N3k | NX-OS | 7.0(3)I2(1) and later
|
47
|
+
Cisco Nexus N5k | NX-OS | 7.3(0)N1(1) and later
|
48
|
+
Cisco Nexus N6k | NX-OS | 7.3(0)N1(1) and later
|
49
|
+
Cisco Nexus N7k | NX-OS | 7.3(0)D1(1) and later
|
53
50
|
|
54
51
|
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)
|
55
52
|
|
@@ -64,53 +61,41 @@ To install the CiscoNodeUtils, use the following command:
|
|
64
61
|
Alternatively, if you've checked the source out directly, you can call
|
65
62
|
`rake install` from the root project directory.
|
66
63
|
|
67
|
-
##
|
64
|
+
## Configuration
|
68
65
|
|
66
|
+
This gem may require configuration in order to be used. Two configuration file locations are supported:
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
by the included minitest suite).
|
68
|
+
* `/etc/cisco_node_utils.yaml` (system and/or root user configuration)
|
69
|
+
* `~/cisco_node_utils.yaml` (per-user configuration)
|
73
70
|
|
74
|
-
|
71
|
+
If both files exist and are readable, configuration in the user-specific file will take precedence over the system configuration.
|
75
72
|
|
76
|
-
|
77
|
-
require 'cisco_node_utils'
|
73
|
+
This file specifies the host, port, username, and/or password to be used to connect to one or more nodes.
|
78
74
|
|
79
|
-
|
80
|
-
node
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
node.config_set("vtp", "domain", "mycompany.com")
|
85
|
-
```
|
86
|
-
|
87
|
-
### Remote usage
|
88
|
-
|
89
|
-
```ruby
|
90
|
-
require 'cisco_node_utils'
|
75
|
+
* 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`.
|
91
79
|
|
92
|
-
|
80
|
+
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).
|
93
81
|
|
94
|
-
|
95
|
-
node.connect("n3k.mycompany.com", "username", "password")
|
82
|
+
## <a name="documentation">Documentation</a>
|
96
83
|
|
97
|
-
|
84
|
+
### Client
|
98
85
|
|
99
|
-
node.
|
100
|
-
```
|
86
|
+
The `Client` class provides a low-level interface for communicating with the Cisco network node. It provides the base APIs `create`, `get`, and `set`.
|
101
87
|
|
102
|
-
|
88
|
+
* `Cisco::Client::NXAPI` - client for communicating with NX-OS 7.0(3)I2(1) and later, using NX-API.
|
103
89
|
|
90
|
+
For a greater level of abstraction, the `Node` class is generally used, but the `Client` classes can be invoked directly if desired.
|
104
91
|
|
105
92
|
### Node
|
106
93
|
|
107
|
-
The `Node` class is a singleton which
|
108
|
-
network node. It provides the base APIs `config_set`, `config_get`, and
|
109
|
-
`config_get_default`.
|
94
|
+
The `Node` class is a singleton which wraps around the `Client` class to provide for management of a given Cisco network node. It provides the base APIs `config_set`, `config_get`, and `config_get_default`.
|
110
95
|
|
111
96
|
### CommandReference
|
112
97
|
|
113
|
-
The `CommandReference` class abstracts away the differences between various supported `Node` types, be that API differences (CLI vs. YANG)
|
98
|
+
The `CommandReference` class abstracts away the differences between various supported `Node` types, be that API differences (CLI vs. YANG) or hardware differences (Nexus N9k vs. Nexus N3k). A series of YAML files describe various `feature` groupings. Each file describes a set of `attributes` of the given feature and the specifics of how to inspect and manage these attributes for any supported `Node` types. When a `Node` is connected, the platform identification of the Node is used to construct a `CommandReference` instance containing a set of `CmdRef` objects specific to this `Node`. The `Node` APIs `config_set`, `config_get`, and `config_get_default` all rely on the `CmdRef`.
|
114
99
|
|
115
100
|
See also [README_YAML](lib/cisco_node_utils/cmd_ref/README_YAML.md).
|
116
101
|
|
@@ -132,6 +117,66 @@ code duplication between the Cisco Puppet modules and the Cisco Chef cookbooks.
|
|
132
117
|
Generally speaking, Puppet and Chef should only interact with the feature
|
133
118
|
provider classes, and not directly call into `CommandReference` or `Node`.
|
134
119
|
|
120
|
+
## <a name="examples">Examples</a>
|
121
|
+
|
122
|
+
|
123
|
+
These utilities can be used directly on a Cisco device (as used by Puppet
|
124
|
+
and Chef) or can run on a workstation and point to a Cisco device (as used
|
125
|
+
by the included minitest suite).
|
126
|
+
|
127
|
+
### Usage on a Cisco device
|
128
|
+
|
129
|
+
#### Low-level Client API
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
require 'cisco_node_utils'
|
133
|
+
|
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
|
155
|
+
|
156
|
+
#### Low-level Client API
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
require 'cisco_node_utils'
|
160
|
+
|
161
|
+
client = Cisco::Client.create('n3k.mycompany.com', 'username', 'password')
|
162
|
+
|
163
|
+
client.get(command: 'show version')
|
164
|
+
client.set(values: 'vtp domain mycompany.com')
|
165
|
+
```
|
166
|
+
|
167
|
+
#### High-level Node API
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
require 'cisco_node_utils'
|
171
|
+
|
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")
|
177
|
+
```
|
178
|
+
|
179
|
+
|
135
180
|
## <a name="changelog">Changelog</a>
|
136
181
|
|
137
182
|
|
data/Rakefile
CHANGED
@@ -1,13 +1,35 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rubocop/rake_task'
|
3
3
|
require 'rake/testtask'
|
4
|
+
require 'rspec/core/rake_task'
|
4
5
|
|
5
6
|
# test task is not part of default task list,
|
6
7
|
# because it requires a node to test against
|
7
|
-
task default: %w(rubocop build)
|
8
|
+
task default: %w(rubocop spec build)
|
8
9
|
|
9
10
|
RuboCop::RakeTask.new
|
10
11
|
|
12
|
+
RSpec::Core::RakeTask.new(:spec_common) do |t|
|
13
|
+
t.pattern = 'spec/*_spec.rb'
|
14
|
+
t.rspec_opts = '--format documentation'
|
15
|
+
t.verbose = false
|
16
|
+
end
|
17
|
+
spec_tasks = [:spec_common]
|
18
|
+
|
19
|
+
# Because each of the below specs requires a clean Ruby environment,
|
20
|
+
# they need to be run individually instead of as a single RSpec task.
|
21
|
+
Dir.glob('spec/isolate/*_spec.rb').each do |f|
|
22
|
+
task = File.basename(f, '.rb').to_sym
|
23
|
+
RSpec::Core::RakeTask.new(task) do |t|
|
24
|
+
t.pattern = f
|
25
|
+
t.rspec_opts = '--format documentation'
|
26
|
+
t.verbose = false
|
27
|
+
end
|
28
|
+
spec_tasks << task
|
29
|
+
end
|
30
|
+
|
31
|
+
task spec: spec_tasks
|
32
|
+
|
11
33
|
task :build do
|
12
34
|
system 'gem build cisco_node_utils.gemspec'
|
13
35
|
end
|