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.
Files changed (255) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +13 -0
  5. data/.travis.yml +4 -1
  6. data/CHANGELOG.md +81 -2
  7. data/CONTRIBUTING.md +2 -17
  8. data/Gemfile +5 -0
  9. data/README.md +92 -47
  10. data/Rakefile +23 -1
  11. data/bin/git/hooks/hook_lib +7 -0
  12. data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
  13. data/bin/git/hooks/pre-commit/rubocop +7 -2
  14. data/bin/git/hooks/pre-commit/validate-diffs +18 -4
  15. data/bin/git/hooks/pre-commit/validate-yaml +18 -0
  16. data/bin/git/update-hooks +64 -6
  17. data/cisco_node_utils.gemspec +9 -6
  18. data/docs/README-develop-best-practices.md +149 -50
  19. data/docs/README-develop-node-utils-APIs.md +92 -42
  20. data/docs/README-maintainers.md +7 -4
  21. data/docs/README-test-execution.md +57 -0
  22. data/docs/cisco_node_utils.yaml.example +30 -0
  23. data/docs/template-router.rb +4 -0
  24. data/ext/mkrf_conf.rb +63 -0
  25. data/lib/.rubocop.yml +2 -2
  26. data/lib/cisco_node_utils.rb +5 -0
  27. data/lib/cisco_node_utils/aaa_authentication_login.rb +5 -6
  28. data/lib/cisco_node_utils/aaa_authorization_service.rb +1 -1
  29. data/lib/cisco_node_utils/ace.rb +165 -12
  30. data/lib/cisco_node_utils/acl.rb +2 -1
  31. data/lib/cisco_node_utils/bgp.rb +184 -21
  32. data/lib/cisco_node_utils/bgp_af.rb +94 -249
  33. data/lib/cisco_node_utils/bgp_neighbor.rb +94 -14
  34. data/lib/cisco_node_utils/bgp_neighbor_af.rb +75 -8
  35. data/lib/cisco_node_utils/bridge_domain.rb +183 -0
  36. data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
  37. data/lib/cisco_node_utils/cisco_cmn_utils.rb +85 -2
  38. data/lib/cisco_node_utils/client.rb +35 -0
  39. data/lib/cisco_node_utils/client/client.rb +234 -0
  40. data/lib/cisco_node_utils/client/grpc.rb +33 -0
  41. data/lib/cisco_node_utils/client/grpc/client.rb +311 -0
  42. data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
  43. data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
  44. data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
  45. data/lib/cisco_node_utils/client/nxapi.rb +31 -0
  46. data/lib/cisco_node_utils/client/nxapi/client.rb +305 -0
  47. data/lib/cisco_node_utils/client/utils.rb +164 -0
  48. data/lib/cisco_node_utils/cmd_ref/README_YAML.md +222 -254
  49. data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +11 -8
  50. data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +22 -15
  51. data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +11 -8
  52. data/lib/cisco_node_utils/cmd_ref/acl.yaml +21 -16
  53. data/lib/cisco_node_utils/cmd_ref/bgp.yaml +239 -109
  54. data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +114 -55
  55. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +76 -52
  56. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +106 -62
  57. data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +71 -0
  58. data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
  59. data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +35 -14
  60. data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
  61. data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +23 -17
  62. data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +94 -83
  63. data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +22 -17
  64. data/lib/cisco_node_utils/cmd_ref/feature.yaml +76 -26
  65. data/lib/cisco_node_utils/cmd_ref/images.yaml +3 -2
  66. data/lib/cisco_node_utils/cmd_ref/interface.yaml +381 -153
  67. data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +21 -11
  68. data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +21 -21
  69. data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +30 -21
  70. data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +18 -13
  71. data/lib/cisco_node_utils/cmd_ref/inventory.yaml +26 -31
  72. data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
  73. data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
  74. data/lib/cisco_node_utils/cmd_ref/memory.yaml +17 -6
  75. data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +10 -3
  76. data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +17 -5
  77. data/lib/cisco_node_utils/cmd_ref/ospf.yaml +33 -29
  78. data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +12 -10
  79. data/lib/cisco_node_utils/cmd_ref/pim.yaml +16 -19
  80. data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +40 -25
  81. data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +17 -12
  82. data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +71 -35
  83. data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +10 -5
  84. data/lib/cisco_node_utils/cmd_ref/show_system.yaml +6 -2
  85. data/lib/cisco_node_utils/cmd_ref/show_version.yaml +47 -43
  86. data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +13 -11
  87. data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +4 -2
  88. data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +23 -21
  89. data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +26 -22
  90. data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +19 -17
  91. data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +18 -6
  92. data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +234 -0
  93. data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +24 -9
  94. data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +5 -3
  95. data/lib/cisco_node_utils/cmd_ref/system.yaml +4 -3
  96. data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +22 -20
  97. data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +27 -15
  98. data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +45 -16
  99. data/lib/cisco_node_utils/cmd_ref/vdc.yaml +21 -11
  100. data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +3 -2
  101. data/lib/cisco_node_utils/cmd_ref/vlan.yaml +60 -32
  102. data/lib/cisco_node_utils/cmd_ref/vpc.yaml +118 -101
  103. data/lib/cisco_node_utils/cmd_ref/vrf.yaml +54 -58
  104. data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +118 -0
  105. data/lib/cisco_node_utils/cmd_ref/vtp.yaml +19 -25
  106. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +28 -18
  107. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +34 -17
  108. data/lib/cisco_node_utils/cmd_ref/yum.yaml +6 -4
  109. data/lib/cisco_node_utils/command_reference.rb +261 -142
  110. data/lib/cisco_node_utils/constants.rb +33 -0
  111. data/lib/cisco_node_utils/encapsulation.rb +112 -0
  112. data/lib/cisco_node_utils/environment.rb +102 -0
  113. data/lib/cisco_node_utils/evpn_vni.rb +5 -3
  114. data/lib/cisco_node_utils/exceptions.rb +111 -0
  115. data/lib/cisco_node_utils/fabricpath_global.rb +52 -35
  116. data/lib/cisco_node_utils/fabricpath_topology.rb +44 -57
  117. data/lib/cisco_node_utils/feature.rb +165 -3
  118. data/lib/cisco_node_utils/interface.rb +1051 -260
  119. data/lib/cisco_node_utils/interface_channel_group.rb +11 -10
  120. data/lib/cisco_node_utils/interface_ospf.rb +1 -2
  121. data/lib/cisco_node_utils/interface_portchannel.rb +4 -12
  122. data/lib/cisco_node_utils/interface_service_vni.rb +7 -7
  123. data/lib/cisco_node_utils/itd_device_group.rb +248 -0
  124. data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
  125. data/lib/cisco_node_utils/itd_service.rb +523 -0
  126. data/lib/cisco_node_utils/logger.rb +75 -0
  127. data/lib/cisco_node_utils/node.rb +62 -192
  128. data/lib/cisco_node_utils/node_util.rb +56 -10
  129. data/lib/cisco_node_utils/overlay_global.rb +2 -2
  130. data/lib/cisco_node_utils/pim.rb +2 -13
  131. data/lib/cisco_node_utils/pim_group_list.rb +1 -1
  132. data/lib/cisco_node_utils/pim_rp_address.rb +1 -1
  133. data/lib/cisco_node_utils/platform.rb +52 -21
  134. data/lib/cisco_node_utils/portchannel_global.rb +89 -19
  135. data/lib/cisco_node_utils/radius_server.rb +168 -37
  136. data/lib/cisco_node_utils/router_ospf.rb +20 -35
  137. data/lib/cisco_node_utils/router_ospf_vrf.rb +4 -4
  138. data/lib/cisco_node_utils/snmpserver.rb +1 -6
  139. data/lib/cisco_node_utils/snmpuser.rb +6 -4
  140. data/lib/cisco_node_utils/stp_global.rb +676 -0
  141. data/lib/cisco_node_utils/syslog_server.rb +77 -18
  142. data/lib/cisco_node_utils/syslog_settings.rb +1 -1
  143. data/lib/cisco_node_utils/tacacs_server_group.rb +8 -4
  144. data/lib/cisco_node_utils/tacacs_server_host.rb +115 -25
  145. data/lib/cisco_node_utils/vdc.rb +12 -0
  146. data/lib/cisco_node_utils/version.rb +1 -1
  147. data/lib/cisco_node_utils/vlan.rb +147 -29
  148. data/lib/cisco_node_utils/vpc.rb +55 -3
  149. data/lib/cisco_node_utils/vrf.rb +72 -11
  150. data/lib/cisco_node_utils/vrf_af.rb +114 -29
  151. data/lib/cisco_node_utils/vtp.rb +34 -52
  152. data/lib/cisco_node_utils/vxlan_vtep.rb +34 -8
  153. data/lib/cisco_node_utils/vxlan_vtep_vni.rb +36 -4
  154. data/lib/minitest/environment_plugin.rb +31 -0
  155. data/lib/minitest/log_level_plugin.rb +41 -0
  156. data/spec/client_spec.rb +7 -0
  157. data/spec/environment_spec.rb +263 -0
  158. data/spec/grpc_client_spec.rb +23 -0
  159. data/spec/isolate/all_clients_spec.rb +9 -0
  160. data/spec/isolate/grpc_only_spec.rb +16 -0
  161. data/spec/isolate/no_clients_spec.rb +26 -0
  162. data/spec/isolate/nxapi_only_spec.rb +16 -0
  163. data/spec/nxapi_client_spec.rb +42 -0
  164. data/spec/schema.yaml +75 -0
  165. data/spec/shared_examples_for_clients.rb +14 -0
  166. data/spec/spec_helper.rb +91 -0
  167. data/spec/whitespace_spec.rb +10 -0
  168. data/spec/yaml_spec.rb +42 -0
  169. data/tests/.rubocop.yml +2 -2
  170. data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
  171. data/tests/basetest.rb +96 -36
  172. data/tests/ciscotest.rb +220 -12
  173. data/tests/cmd_config.yaml +71 -49
  174. data/tests/cmd_config_invalid.yaml +1 -1
  175. data/tests/test_aaa_authentication_login.rb +1 -0
  176. data/tests/test_aaa_authentication_login_service.rb +9 -0
  177. data/tests/test_aaa_authorization_service.rb +173 -367
  178. data/tests/test_ace.rb +171 -100
  179. data/tests/test_acl.rb +10 -1
  180. data/tests/test_bgp_af.rb +395 -728
  181. data/tests/test_bgp_neighbor.rb +274 -115
  182. data/tests/test_bgp_neighbor_af.rb +178 -77
  183. data/tests/test_bridge_domain.rb +191 -0
  184. data/tests/test_bridge_domain_vni.rb +116 -0
  185. data/tests/test_client_utils.rb +111 -0
  186. data/tests/test_command_config.rb +9 -5
  187. data/tests/test_command_reference.rb +380 -102
  188. data/tests/test_dns_domain.rb +13 -3
  189. data/tests/test_domain_name.rb +13 -3
  190. data/tests/test_encapsulation.rb +77 -0
  191. data/tests/test_evpn_vni.rb +25 -7
  192. data/tests/test_fabricpath_global.rb +167 -163
  193. data/tests/test_fabricpath_topology.rb +12 -33
  194. data/tests/test_feature.rb +215 -0
  195. data/tests/test_grpc.rb +166 -0
  196. data/tests/test_interface.rb +585 -344
  197. data/tests/test_interface_bdi.rb +80 -0
  198. data/tests/test_interface_channel_group.rb +6 -3
  199. data/tests/test_interface_ospf.rb +26 -24
  200. data/tests/test_interface_portchannel.rb +1 -0
  201. data/tests/test_interface_private_vlan.rb +724 -0
  202. data/tests/test_interface_service_vni.rb +37 -66
  203. data/tests/test_interface_svi.rb +98 -101
  204. data/tests/test_interface_switchport.rb +419 -549
  205. data/tests/test_itd_device_group.rb +145 -0
  206. data/tests/test_itd_device_group_node.rb +199 -0
  207. data/tests/test_itd_service.rb +298 -0
  208. data/tests/test_logger.rb +43 -0
  209. data/tests/test_name_server.rb +11 -2
  210. data/tests/test_node.rb +16 -75
  211. data/tests/test_node_ext.rb +174 -163
  212. data/tests/test_node_util.rb +119 -0
  213. data/tests/test_ntp_config.rb +5 -1
  214. data/tests/test_ntp_server.rb +2 -2
  215. data/tests/test_nxapi.rb +221 -0
  216. data/tests/test_overlay_global.rb +47 -38
  217. data/tests/test_pim.rb +2 -0
  218. data/tests/test_pim_group_list.rb +2 -0
  219. data/tests/test_pim_rp_address.rb +2 -0
  220. data/tests/test_platform.rb +86 -39
  221. data/tests/test_portchannel_global.rb +211 -135
  222. data/tests/test_radius_global.rb +13 -5
  223. data/tests/test_radius_server.rb +256 -104
  224. data/tests/test_radius_server_group.rb +2 -0
  225. data/tests/test_router_bgp.rb +781 -485
  226. data/tests/test_router_ospf.rb +26 -103
  227. data/tests/test_router_ospf_vrf.rb +52 -57
  228. data/tests/test_snmp_notification_receiver.rb +2 -0
  229. data/tests/test_snmpcommunity.rb +2 -0
  230. data/tests/test_snmpgroup.rb +2 -0
  231. data/tests/test_snmpnotification.rb +40 -21
  232. data/tests/test_snmpserver.rb +2 -0
  233. data/tests/test_snmpuser.rb +2 -0
  234. data/tests/test_stp_global.rb +563 -0
  235. data/tests/test_syslog_server.rb +32 -8
  236. data/tests/test_syslog_settings.rb +22 -9
  237. data/tests/test_tacacs_server.rb +32 -27
  238. data/tests/test_tacacs_server_group.rb +100 -45
  239. data/tests/test_tacacs_server_host.rb +135 -43
  240. data/tests/test_vdc.rb +2 -16
  241. data/tests/test_vlan.rb +106 -54
  242. data/tests/test_vlan_mt_full.rb +11 -21
  243. data/tests/test_vlan_private.rb +669 -0
  244. data/tests/test_vpc.rb +312 -159
  245. data/tests/test_vrf.rb +122 -113
  246. data/tests/test_vrf_af.rb +238 -0
  247. data/tests/test_vtp.rb +58 -102
  248. data/tests/test_vxlan_vtep.rb +38 -17
  249. data/tests/test_vxlan_vtep_vni.rb +61 -9
  250. data/tests/test_yum.rb +49 -25
  251. metadata +122 -36
  252. data/lib/cisco_node_utils/cmd_ref/fex.yaml +0 -9
  253. data/lib/cisco_node_utils/cmd_ref/vni.yaml +0 -76
  254. data/lib/cisco_node_utils/vni.rb +0 -227
  255. data/tests/test_vni.rb +0 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5972809d82dc9ad3991f11217e174556220418c6
4
- data.tar.gz: abec7a2fbd8757cdf73bb5eb84c7e154e777ffbc
3
+ metadata.gz: 04e705a28917168a277c351451f63491ff3c1177
4
+ data.tar.gz: 4e2be35191668158a0b757b831cd1ee135ae7525
5
5
  SHA512:
6
- metadata.gz: f8d80e3c768ebbd436ce9d2d0f6e795941932c517834e5c644aa12bce22fddee6ee82efb545857900de5a0127bdfa58911d4e411bbf6dfc5dd887fbb52a1567c
7
- data.tar.gz: 9a0ac0b2beb5cad046e28ba570f5afdf3c98543b1d11e76dadd1ca33fa3c57757d6e136e2fe55f984d3c6ed6e448f0f2e0cd07ba72088f024ab90a5ecd7033c3
6
+ metadata.gz: 734d65543eeedb4f766a74c8d56f397e638f5fe446846bc4196ec3facfd1f5378f1eefe11364a67089f67a6851f2101438b87526536ab44477df6181281fb39b
7
+ data.tar.gz: a0d7aaebf7dd5d00a432f4a6c4067860750dd61df4e1fa73da11e6c8440f859f32d1155a412a5a00791a15a1ed024d5e3a08129b6ce74abed9a326ef55cdddfc
data/.gitignore CHANGED
@@ -2,6 +2,8 @@
2
2
  pkg/*
3
3
  vendor/*
4
4
  coverage
5
+ ext/Rakefile
5
6
  Gemfile.lock
6
7
  *.gem
7
8
  *.swp
9
+ TAGS
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
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
@@ -6,4 +6,7 @@ cache: bundler
6
6
  rvm:
7
7
  - 2.2.2
8
8
  - 2.1.6
9
- - 2.0.0
9
+ - 2.0.0-p648 # specify non-clang version of ruby
10
+
11
+ script:
12
+ - bundle exec rake
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. There are two ways you can specify the Nexus switch (virtual or physical) to test against when running the full test suite:
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
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cisco_node_utils.gemspec
4
4
  gemspec
5
+
6
+ # These are optional dependencies in the Gem itself,
7
+ # but we need them for Bundler to use.
8
+ gem 'net_http_unix'
9
+ gem 'grpc'
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
- 2. [Installation](#installation)
27
- 3. [Examples](#examples)
28
- 4. [Documentation](#documentation)
29
- 5. [Changelog](#changelog)
30
- 6. [Learning Resources](#resources)
31
- 7. [License Information](#license_info)
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 | OS Version |
43
- -----------------|-------|----------------------|
44
- Cisco Nexus 30xx | NX-OS | 7.0(3)I2(1) and later
45
- Cisco Nexus 31xx | NX-OS | 7.0(3)I2(1) and later
46
- Cisco Nexus 93xx | NX-OS | 7.0(3)I2(1) and later
47
- Cisco Nexus 95xx | NX-OS | 7.0(3)I2(1) and later
48
- Cisco N9kv | NX-OS | 7.0(3)I2(1) and later
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
- ## <a name="examples">Examples</a>
64
+ ## Configuration
68
65
 
66
+ This gem may require configuration in order to be used. Two configuration file locations are supported:
69
67
 
70
- These utilities can be used directly on a Cisco device (as used by Puppet
71
- and Chef) or can run on a workstation and point to a Cisco device (as used
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
- ### Usage on a Cisco device
71
+ If both files exist and are readable, configuration in the user-specific file will take precedence over the system configuration.
75
72
 
76
- ```ruby
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
- # get a connection to the local device
80
- node = Cisco::Node.instance()
81
-
82
- version = node.config_get("show_version", "system_image")
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
- Cisco::Node.lazy_connect = true
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
- node = Cisco::Node.instance()
95
- node.connect("n3k.mycompany.com", "username", "password")
82
+ ## <a name="documentation">Documentation</a>
96
83
 
97
- version = node.config_get("show_version", "system_image")
84
+ ### Client
98
85
 
99
- node.config_set("vtp", "domain", "mycompany.com")
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
- ## <a name="documentation">Documentation</a>
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 provides for management of a given Cisco
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), platform differences (NX-OS vs. IOS XR), or hardware differences (Nexus 9xxx vs. Nexus 3xxx). 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`.
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