cisco_node_utils_mgx 2.1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +96 -0
  5. data/.travis.yml +17 -0
  6. data/CHANGELOG.md +676 -0
  7. data/CONTRIBUTING.md +43 -0
  8. data/Gemfile +10 -0
  9. data/LICENSE +201 -0
  10. data/README.md +246 -0
  11. data/Rakefile +44 -0
  12. data/SUPPORT.md +3 -0
  13. data/bin/.rubocop.yml +18 -0
  14. data/bin/check_metric_limits.rb +109 -0
  15. data/bin/git/hooks/commit-msg/enforce_style +89 -0
  16. data/bin/git/hooks/hook_lib +115 -0
  17. data/bin/git/hooks/hooks-wrapper +38 -0
  18. data/bin/git/hooks/post-flow-hotfix-start/update-version +24 -0
  19. data/bin/git/hooks/post-flow-release-finish/update-version +29 -0
  20. data/bin/git/hooks/post-flow-release-start/update-version +19 -0
  21. data/bin/git/hooks/post-merge/update-hooks +6 -0
  22. data/bin/git/hooks/post-rewrite/update-hooks +6 -0
  23. data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
  24. data/bin/git/hooks/pre-commit/rubocop +25 -0
  25. data/bin/git/hooks/pre-commit/validate-diffs +45 -0
  26. data/bin/git/hooks/pre-commit/validate-yaml +18 -0
  27. data/bin/git/hooks/pre-push/check-changelog +24 -0
  28. data/bin/git/hooks/pre-push/rubocop +7 -0
  29. data/bin/git/update-hooks +123 -0
  30. data/bin/show_running_yang.rb +233 -0
  31. data/cisco_node_utils.gemspec +41 -0
  32. data/docs/README-develop-best-practices.md +521 -0
  33. data/docs/README-develop-node-utils-APIs.md +570 -0
  34. data/docs/README-maintainers.md +77 -0
  35. data/docs/README-test-execution.md +57 -0
  36. data/docs/README-utilities.md +14 -0
  37. data/docs/agent_files.png +0 -0
  38. data/docs/cisco_node_utils.yaml.example +36 -0
  39. data/docs/template-router.rb +123 -0
  40. data/docs/template-test_router.rb +104 -0
  41. data/ext/mkrf_conf.rb +63 -0
  42. data/lib/.rubocop.yml +18 -0
  43. data/lib/cisco_node_utils/aaa_authentication_login.rb +95 -0
  44. data/lib/cisco_node_utils/aaa_authentication_login_service.rb +138 -0
  45. data/lib/cisco_node_utils/aaa_authorization_service.rb +156 -0
  46. data/lib/cisco_node_utils/ace.rb +467 -0
  47. data/lib/cisco_node_utils/acl.rb +101 -0
  48. data/lib/cisco_node_utils/banner.rb +63 -0
  49. data/lib/cisco_node_utils/bfd_global.rb +305 -0
  50. data/lib/cisco_node_utils/bgp.rb +988 -0
  51. data/lib/cisco_node_utils/bgp_af.rb +545 -0
  52. data/lib/cisco_node_utils/bgp_af_aggr_addr.rb +207 -0
  53. data/lib/cisco_node_utils/bgp_neighbor.rb +527 -0
  54. data/lib/cisco_node_utils/bgp_neighbor_af.rb +780 -0
  55. data/lib/cisco_node_utils/bridge_domain.rb +178 -0
  56. data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
  57. data/lib/cisco_node_utils/cisco_cmn_utils.rb +444 -0
  58. data/lib/cisco_node_utils/client/client.rb +238 -0
  59. data/lib/cisco_node_utils/client/grpc/client.rb +395 -0
  60. data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
  61. data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
  62. data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
  63. data/lib/cisco_node_utils/client/grpc.rb +33 -0
  64. data/lib/cisco_node_utils/client/nxapi/client.rb +368 -0
  65. data/lib/cisco_node_utils/client/nxapi.rb +31 -0
  66. data/lib/cisco_node_utils/client/utils.rb +180 -0
  67. data/lib/cisco_node_utils/client.rb +35 -0
  68. data/lib/cisco_node_utils/cmd_ref/README_YAML.md +590 -0
  69. data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +25 -0
  70. data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +38 -0
  71. data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +40 -0
  72. data/lib/cisco_node_utils/cmd_ref/acl.yaml +48 -0
  73. data/lib/cisco_node_utils/cmd_ref/banner.yaml +11 -0
  74. data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +117 -0
  75. data/lib/cisco_node_utils/cmd_ref/bgp.yaml +383 -0
  76. data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +223 -0
  77. data/lib/cisco_node_utils/cmd_ref/bgp_af_aa.yaml +38 -0
  78. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +174 -0
  79. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +236 -0
  80. data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +49 -0
  81. data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
  82. data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +128 -0
  83. data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +55 -0
  84. data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
  85. data/lib/cisco_node_utils/cmd_ref/evpn_multicast.yaml +12 -0
  86. data/lib/cisco_node_utils/cmd_ref/evpn_multisite.yaml +18 -0
  87. data/lib/cisco_node_utils/cmd_ref/evpn_stormcontrol.yaml +18 -0
  88. data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +48 -0
  89. data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +183 -0
  90. data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +40 -0
  91. data/lib/cisco_node_utils/cmd_ref/feature.yaml +126 -0
  92. data/lib/cisco_node_utils/cmd_ref/hostname.yaml +8 -0
  93. data/lib/cisco_node_utils/cmd_ref/hsrp_global.yaml +25 -0
  94. data/lib/cisco_node_utils/cmd_ref/images.yaml +8 -0
  95. data/lib/cisco_node_utils/cmd_ref/interface.yaml +781 -0
  96. data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +45 -0
  97. data/lib/cisco_node_utils/cmd_ref/interface_evpn_multisite.yaml +17 -0
  98. data/lib/cisco_node_utils/cmd_ref/interface_hsrp_group.yaml +120 -0
  99. data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +112 -0
  100. data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +87 -0
  101. data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +42 -0
  102. data/lib/cisco_node_utils/cmd_ref/inventory.yaml +45 -0
  103. data/lib/cisco_node_utils/cmd_ref/ip_multicast.yaml +22 -0
  104. data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
  105. data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
  106. data/lib/cisco_node_utils/cmd_ref/memory.yaml +24 -0
  107. data/lib/cisco_node_utils/cmd_ref/ntp_auth_key.yaml +10 -0
  108. data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +27 -0
  109. data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +34 -0
  110. data/lib/cisco_node_utils/cmd_ref/object_group.yaml +32 -0
  111. data/lib/cisco_node_utils/cmd_ref/ospf.yaml +91 -0
  112. data/lib/cisco_node_utils/cmd_ref/ospf_area.yaml +91 -0
  113. data/lib/cisco_node_utils/cmd_ref/ospf_area_vlink.yaml +88 -0
  114. data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +37 -0
  115. data/lib/cisco_node_utils/cmd_ref/pim.yaml +43 -0
  116. data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +86 -0
  117. data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +37 -0
  118. data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +100 -0
  119. data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +19 -0
  120. data/lib/cisco_node_utils/cmd_ref/route_map.yaml +601 -0
  121. data/lib/cisco_node_utils/cmd_ref/show_system.yaml +9 -0
  122. data/lib/cisco_node_utils/cmd_ref/show_version.yaml +84 -0
  123. data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +81 -0
  124. data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +9 -0
  125. data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +74 -0
  126. data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +91 -0
  127. data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +57 -0
  128. data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +23 -0
  129. data/lib/cisco_node_utils/cmd_ref/span_session.yaml +65 -0
  130. data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +235 -0
  131. data/lib/cisco_node_utils/cmd_ref/syslog_facility.yaml +10 -0
  132. data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +34 -0
  133. data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +45 -0
  134. data/lib/cisco_node_utils/cmd_ref/system.yaml +7 -0
  135. data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +37 -0
  136. data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +63 -0
  137. data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +45 -0
  138. data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +64 -0
  139. data/lib/cisco_node_utils/cmd_ref/upgrade.yaml +38 -0
  140. data/lib/cisco_node_utils/cmd_ref/vdc.yaml +52 -0
  141. data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +8 -0
  142. data/lib/cisco_node_utils/cmd_ref/vlan.yaml +106 -0
  143. data/lib/cisco_node_utils/cmd_ref/vpc.yaml +233 -0
  144. data/lib/cisco_node_utils/cmd_ref/vrf.yaml +86 -0
  145. data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +139 -0
  146. data/lib/cisco_node_utils/cmd_ref/vtp.yaml +32 -0
  147. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +114 -0
  148. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +71 -0
  149. data/lib/cisco_node_utils/cmd_ref/yang.yaml +7 -0
  150. data/lib/cisco_node_utils/cmd_ref/yum.yaml +68 -0
  151. data/lib/cisco_node_utils/command_reference.rb +724 -0
  152. data/lib/cisco_node_utils/configparser_lib.rb +195 -0
  153. data/lib/cisco_node_utils/constants.rb +40 -0
  154. data/lib/cisco_node_utils/dhcp_relay_global.rb +302 -0
  155. data/lib/cisco_node_utils/dns_domain.rb +93 -0
  156. data/lib/cisco_node_utils/domain_name.rb +82 -0
  157. data/lib/cisco_node_utils/encapsulation.rb +112 -0
  158. data/lib/cisco_node_utils/environment.rb +110 -0
  159. data/lib/cisco_node_utils/evpn_multicast.rb +66 -0
  160. data/lib/cisco_node_utils/evpn_multisite.rb +96 -0
  161. data/lib/cisco_node_utils/evpn_stormcontrol.rb +84 -0
  162. data/lib/cisco_node_utils/evpn_vni.rb +159 -0
  163. data/lib/cisco_node_utils/exceptions.rb +140 -0
  164. data/lib/cisco_node_utils/fabricpath_global.rb +405 -0
  165. data/lib/cisco_node_utils/fabricpath_topology.rb +137 -0
  166. data/lib/cisco_node_utils/feature.rb +377 -0
  167. data/lib/cisco_node_utils/hostname.rb +62 -0
  168. data/lib/cisco_node_utils/hsrp_global.rb +97 -0
  169. data/lib/cisco_node_utils/interface.rb +2128 -0
  170. data/lib/cisco_node_utils/interface_channel_group.rb +142 -0
  171. data/lib/cisco_node_utils/interface_evpn_multisite.rb +72 -0
  172. data/lib/cisco_node_utils/interface_hsrp_group.rb +557 -0
  173. data/lib/cisco_node_utils/interface_ospf.rb +378 -0
  174. data/lib/cisco_node_utils/interface_portchannel.rb +180 -0
  175. data/lib/cisco_node_utils/interface_service_vni.rb +132 -0
  176. data/lib/cisco_node_utils/ip_multicast.rb +90 -0
  177. data/lib/cisco_node_utils/itd_device_group.rb +228 -0
  178. data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
  179. data/lib/cisco_node_utils/itd_service.rb +511 -0
  180. data/lib/cisco_node_utils/logger.rb +78 -0
  181. data/lib/cisco_node_utils/name_server.rb +64 -0
  182. data/lib/cisco_node_utils/node.rb +443 -0
  183. data/lib/cisco_node_utils/node_util.rb +111 -0
  184. data/lib/cisco_node_utils/ntp_auth_key.rb +67 -0
  185. data/lib/cisco_node_utils/ntp_config.rb +83 -0
  186. data/lib/cisco_node_utils/ntp_server.rb +86 -0
  187. data/lib/cisco_node_utils/object_group.rb +75 -0
  188. data/lib/cisco_node_utils/object_group_entry.rb +143 -0
  189. data/lib/cisco_node_utils/overlay_global.rb +142 -0
  190. data/lib/cisco_node_utils/pim.rb +131 -0
  191. data/lib/cisco_node_utils/pim_group_list.rb +109 -0
  192. data/lib/cisco_node_utils/pim_rp_address.rb +103 -0
  193. data/lib/cisco_node_utils/platform.rb +217 -0
  194. data/lib/cisco_node_utils/portchannel_global.rb +347 -0
  195. data/lib/cisco_node_utils/radius_global.rb +165 -0
  196. data/lib/cisco_node_utils/radius_server.rb +421 -0
  197. data/lib/cisco_node_utils/radius_server_group.rb +117 -0
  198. data/lib/cisco_node_utils/route_map.rb +2540 -0
  199. data/lib/cisco_node_utils/router_ospf.rb +77 -0
  200. data/lib/cisco_node_utils/router_ospf_area.rb +416 -0
  201. data/lib/cisco_node_utils/router_ospf_area_vlink.rb +313 -0
  202. data/lib/cisco_node_utils/router_ospf_vrf.rb +342 -0
  203. data/lib/cisco_node_utils/snmp_notification_receiver.rb +176 -0
  204. data/lib/cisco_node_utils/snmpcommunity.rb +109 -0
  205. data/lib/cisco_node_utils/snmpgroup.rb +54 -0
  206. data/lib/cisco_node_utils/snmpnotification.rb +57 -0
  207. data/lib/cisco_node_utils/snmpserver.rb +132 -0
  208. data/lib/cisco_node_utils/snmpuser.rb +403 -0
  209. data/lib/cisco_node_utils/span_session.rb +149 -0
  210. data/lib/cisco_node_utils/stp_global.rb +676 -0
  211. data/lib/cisco_node_utils/syslog_facility.rb +64 -0
  212. data/lib/cisco_node_utils/syslog_server.rb +146 -0
  213. data/lib/cisco_node_utils/syslog_settings.rb +174 -0
  214. data/lib/cisco_node_utils/tacacs_global.rb +137 -0
  215. data/lib/cisco_node_utils/tacacs_server.rb +173 -0
  216. data/lib/cisco_node_utils/tacacs_server_group.rb +149 -0
  217. data/lib/cisco_node_utils/tacacs_server_host.rb +216 -0
  218. data/lib/cisco_node_utils/upgrade.rb +122 -0
  219. data/lib/cisco_node_utils/vdc.rb +118 -0
  220. data/lib/cisco_node_utils/version.rb +21 -0
  221. data/lib/cisco_node_utils/vlan.rb +301 -0
  222. data/lib/cisco_node_utils/vpc.rb +466 -0
  223. data/lib/cisco_node_utils/vrf.rb +192 -0
  224. data/lib/cisco_node_utils/vrf_af.rb +327 -0
  225. data/lib/cisco_node_utils/vtp.rb +125 -0
  226. data/lib/cisco_node_utils/vxlan_vtep.rb +286 -0
  227. data/lib/cisco_node_utils/vxlan_vtep_vni.rb +331 -0
  228. data/lib/cisco_node_utils/yang.rb +160 -0
  229. data/lib/cisco_node_utils/yum.rb +213 -0
  230. data/lib/cisco_node_utils.rb +21 -0
  231. data/lib/minitest/environment_plugin.rb +31 -0
  232. data/lib/minitest/log_level_plugin.rb +41 -0
  233. data/spec/client_spec.rb +7 -0
  234. data/spec/environment_spec.rb +384 -0
  235. data/spec/grpc_client_spec.rb +23 -0
  236. data/spec/isolate/all_clients_spec.rb +9 -0
  237. data/spec/isolate/grpc_only_spec.rb +16 -0
  238. data/spec/isolate/no_clients_spec.rb +26 -0
  239. data/spec/isolate/nxapi_only_spec.rb +16 -0
  240. data/spec/nxapi_client_spec.rb +42 -0
  241. data/spec/schema.yaml +82 -0
  242. data/spec/shared_examples_for_clients.rb +14 -0
  243. data/spec/spec_helper.rb +91 -0
  244. data/spec/whitespace_spec.rb +10 -0
  245. data/spec/yaml_spec.rb +42 -0
  246. data/tests/.rubocop.yml +18 -0
  247. data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
  248. data/tests/basetest.rb +243 -0
  249. data/tests/ciscotest.rb +577 -0
  250. data/tests/cmd_config.yaml +75 -0
  251. data/tests/cmd_config_invalid.yaml +16 -0
  252. data/tests/n9000_sample-1.0.0-7.0.3.x86_64.rpm +0 -0
  253. data/tests/noop.rb +7 -0
  254. data/tests/platform_info.rb +63 -0
  255. data/tests/tacacs_server.yaml.example +6 -0
  256. data/tests/test_aaa_authentication_login.rb +243 -0
  257. data/tests/test_aaa_authentication_login_service.rb +761 -0
  258. data/tests/test_aaa_authorization_service.rb +874 -0
  259. data/tests/test_ace.rb +304 -0
  260. data/tests/test_acl.rb +185 -0
  261. data/tests/test_banner.rb +85 -0
  262. data/tests/test_bfd_global.rb +272 -0
  263. data/tests/test_bgp_af.rb +875 -0
  264. data/tests/test_bgp_af_aa.rb +108 -0
  265. data/tests/test_bgp_neighbor.rb +596 -0
  266. data/tests/test_bgp_neighbor_af.rb +781 -0
  267. data/tests/test_bridge_domain.rb +198 -0
  268. data/tests/test_bridge_domain_vni.rb +109 -0
  269. data/tests/test_client_utils.rb +111 -0
  270. data/tests/test_cmn_utils.rb +76 -0
  271. data/tests/test_command_config.rb +206 -0
  272. data/tests/test_command_reference.rb +669 -0
  273. data/tests/test_dhcp_relay_global.rb +286 -0
  274. data/tests/test_dns_domain.rb +123 -0
  275. data/tests/test_domain_name.rb +96 -0
  276. data/tests/test_encapsulation.rb +75 -0
  277. data/tests/test_evpn_multicast.rb +65 -0
  278. data/tests/test_evpn_multisite.rb +70 -0
  279. data/tests/test_evpn_stormcontrol.rb +56 -0
  280. data/tests/test_evpn_vni.rb +131 -0
  281. data/tests/test_fabricpath_global.rb +246 -0
  282. data/tests/test_fabricpath_topology.rb +77 -0
  283. data/tests/test_feature.rb +272 -0
  284. data/tests/test_grpc.rb +166 -0
  285. data/tests/test_hostname.rb +64 -0
  286. data/tests/test_hsrp_global.rb +79 -0
  287. data/tests/test_interface.rb +1958 -0
  288. data/tests/test_interface_bdi.rb +80 -0
  289. data/tests/test_interface_channel_group.rb +131 -0
  290. data/tests/test_interface_evpn_multisite.rb +94 -0
  291. data/tests/test_interface_hsrp.rb +134 -0
  292. data/tests/test_interface_hsrp_group.rb +570 -0
  293. data/tests/test_interface_ospf.rb +820 -0
  294. data/tests/test_interface_portchannel.rb +135 -0
  295. data/tests/test_interface_private_vlan.rb +365 -0
  296. data/tests/test_interface_service_vni.rb +203 -0
  297. data/tests/test_interface_svi.rb +210 -0
  298. data/tests/test_interface_switchport.rb +468 -0
  299. data/tests/test_ip_multicast.rb +80 -0
  300. data/tests/test_itd_device_group.rb +145 -0
  301. data/tests/test_itd_device_group_node.rb +199 -0
  302. data/tests/test_itd_service.rb +314 -0
  303. data/tests/test_logger.rb +43 -0
  304. data/tests/test_name_server.rb +94 -0
  305. data/tests/test_node.rb +50 -0
  306. data/tests/test_node_ext.rb +406 -0
  307. data/tests/test_node_util.rb +119 -0
  308. data/tests/test_ntp_auth_key.rb +77 -0
  309. data/tests/test_ntp_config.rb +100 -0
  310. data/tests/test_ntp_server.rb +146 -0
  311. data/tests/test_nxapi.rb +236 -0
  312. data/tests/test_object_group.rb +122 -0
  313. data/tests/test_overlay_global.rb +108 -0
  314. data/tests/test_pim.rb +203 -0
  315. data/tests/test_pim_group_list.rb +147 -0
  316. data/tests/test_pim_rp_address.rb +155 -0
  317. data/tests/test_platform.rb +254 -0
  318. data/tests/test_portchannel_global.rb +322 -0
  319. data/tests/test_radius_global.rb +108 -0
  320. data/tests/test_radius_server.rb +377 -0
  321. data/tests/test_radius_server_group.rb +151 -0
  322. data/tests/test_route_map.rb +1479 -0
  323. data/tests/test_router_bgp.rb +1325 -0
  324. data/tests/test_router_ospf.rb +56 -0
  325. data/tests/test_router_ospf_area.rb +433 -0
  326. data/tests/test_router_ospf_area_vlink.rb +298 -0
  327. data/tests/test_router_ospf_vrf.rb +690 -0
  328. data/tests/test_snmp_notification_receiver.rb +169 -0
  329. data/tests/test_snmpcommunity.rb +422 -0
  330. data/tests/test_snmpgroup.rb +71 -0
  331. data/tests/test_snmpnotification.rb +91 -0
  332. data/tests/test_snmpserver.rb +251 -0
  333. data/tests/test_snmpuser.rb +666 -0
  334. data/tests/test_span_session.rb +155 -0
  335. data/tests/test_stp_global.rb +575 -0
  336. data/tests/test_syslog_facility.rb +80 -0
  337. data/tests/test_syslog_server.rb +119 -0
  338. data/tests/test_syslog_settings.rb +123 -0
  339. data/tests/test_tacacs_global.rb +109 -0
  340. data/tests/test_tacacs_server.rb +436 -0
  341. data/tests/test_tacacs_server_group.rb +434 -0
  342. data/tests/test_tacacs_server_host.rb +427 -0
  343. data/tests/test_upgrade.rb +105 -0
  344. data/tests/test_vdc.rb +64 -0
  345. data/tests/test_vlan.rb +386 -0
  346. data/tests/test_vlan_private.rb +656 -0
  347. data/tests/test_vpc.rb +548 -0
  348. data/tests/test_vrf.rb +248 -0
  349. data/tests/test_vrf_af.rb +288 -0
  350. data/tests/test_vtp.rb +278 -0
  351. data/tests/test_vxlan_vtep.rb +327 -0
  352. data/tests/test_vxlan_vtep_vni.rb +326 -0
  353. data/tests/test_yang.rb +369 -0
  354. data/tests/test_yum.rb +109 -0
  355. data/tests/upgrade_info.yaml.example +3 -0
  356. data/tests/yum_package.yaml +94 -0
  357. metadata +534 -0
data/tests/test_vrf.rb ADDED
@@ -0,0 +1,248 @@
1
+ # Copyright (c) 2015-2016 Cisco and/or its affiliates.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative 'ciscotest'
16
+ require_relative '../lib/cisco_node_utils/vrf'
17
+
18
+ include Cisco
19
+
20
+ # TestVrf - Minitest for Vrf node utility class
21
+ class TestVrf < CiscoTestCase
22
+ VRF_NAME_SIZE = 33
23
+ @@pre_clean_needed = true # rubocop:disable Style/ClassVars
24
+
25
+ def setup
26
+ super
27
+ remove_all_vrfs if @@pre_clean_needed
28
+ @@pre_clean_needed = false # rubocop:disable Style/ClassVars
29
+ end
30
+
31
+ def teardown
32
+ remove_all_vrfs
33
+ super
34
+ end
35
+
36
+ def test_collection_default
37
+ vrfs = Vrf.vrfs
38
+ if platform == :nexus
39
+ refute_empty(vrfs, 'VRF collection is empty')
40
+ assert(vrfs.key?('management'), 'VRF management does not exist')
41
+ else
42
+ assert_empty(vrfs, 'VRF collection is not empty')
43
+ end
44
+ end
45
+
46
+ def test_create_and_destroy
47
+ v = Vrf.new('test_vrf')
48
+ vrfs = Vrf.vrfs
49
+ assert(vrfs.key?('test_vrf'), 'Error: failed to create vrf test_vrf')
50
+
51
+ v.destroy
52
+ vrfs = Vrf.vrfs
53
+ refute(vrfs.key?('test_vrf'), 'Error: failed to destroy vrf test_vrf')
54
+ end
55
+
56
+ def test_name_type_invalid
57
+ assert_raises(TypeError, 'Wrong vrf name type did not raise type error') do
58
+ Vrf.new(1000)
59
+ end
60
+ end
61
+
62
+ def test_name_zero_length
63
+ assert_raises(Cisco::CliError, "Zero length name didn't raise CliError") do
64
+ Vrf.new('')
65
+ end
66
+ end
67
+
68
+ def test_name_too_long
69
+ name = 'a' * VRF_NAME_SIZE
70
+ assert_raises(Cisco::CliError,
71
+ 'vrf name misconfig did not raise CliError') do
72
+ Vrf.new(name)
73
+ end
74
+ end
75
+
76
+ # This helper is needed on some platforms to allow enough time for the
77
+ # 'shutdown' process to complete before 'no shutdown' can be successful.
78
+ def shutdown_with_sleep(obj, val)
79
+ obj.shutdown = val
80
+ rescue CliError => e
81
+ raise unless e.message[/ERROR: Shutdown of VRF .* in progress/]
82
+ sleep 1
83
+ tries ||= 1
84
+ retry unless (tries += 1) > 20
85
+ end
86
+
87
+ def test_shutdown
88
+ v = Vrf.new('test_shutdown')
89
+ if validate_property_excluded?('vrf', 'shutdown')
90
+ assert_nil(v.shutdown)
91
+ assert_nil(v.default_shutdown)
92
+ assert_raises(Cisco::UnsupportedError) { v.shutdown = true }
93
+ v.destroy
94
+ return
95
+ end
96
+ v.shutdown = true
97
+ assert(v.shutdown)
98
+
99
+ shutdown_with_sleep(v, false)
100
+ refute(v.shutdown)
101
+
102
+ v.shutdown = true
103
+ assert(v.shutdown)
104
+
105
+ shutdown_with_sleep(v, v.default_shutdown)
106
+ refute(v.shutdown)
107
+ v.destroy
108
+ end
109
+
110
+ def test_description
111
+ skip_legacy_defect?('7.3.0.(N1|D1).1.bin',
112
+ 'CSCuy36637: Cannot remove description')
113
+ v = Vrf.new('test_description')
114
+ desc = 'tested by minitest'
115
+ v.description = desc
116
+ assert_equal(desc, v.description)
117
+
118
+ desc = v.default_description
119
+ v.description = desc
120
+ assert_equal(desc, v.description)
121
+ v.destroy
122
+ end
123
+
124
+ def test_mhost
125
+ v = Vrf.new('test_mhost')
126
+ t_intf = 'Loopback100'
127
+ if validate_property_excluded?('vrf', 'mhost_default_interface')
128
+ assert_nil(v.mhost_ipv4_default_interface)
129
+ assert_nil(v.mhost_ipv6_default_interface)
130
+ assert_raises(Cisco::UnsupportedError) do
131
+ v.mhost_ipv4_default_interface = t_intf
132
+ end
133
+ assert_raises(Cisco::UnsupportedError) do
134
+ v.mhost_ipv6_default_interface = t_intf
135
+ end
136
+ v.destroy
137
+ return
138
+ end
139
+ config("interface #{t_intf}")
140
+ %w(mhost_ipv4_default_interface mhost_ipv6_default_interface).each do |mh|
141
+ df = v.send("default_#{mh}")
142
+ result = v.send("#{mh}")
143
+ assert_equal(df, result, "Test1.1 : #{mh} should be default value")
144
+
145
+ v.send("#{mh}=", t_intf)
146
+ result = v.send("#{mh}")
147
+ assert_equal(t_intf, result,
148
+ "Test2.1 :vrf #{mh} should be set to #{t_intf}")
149
+
150
+ df = v.send("default_#{mh}")
151
+ v.send("#{mh}=", "#{df}")
152
+ result = v.send("#{mh}")
153
+ assert_equal(df, result,
154
+ "Test3.1 :vrf #{mh} should be set to default value")
155
+ end
156
+ config("no interface #{t_intf}")
157
+ v.destroy
158
+ end
159
+
160
+ def test_remote_route_filtering
161
+ v = Vrf.new('test_remote_route_filtering')
162
+ if validate_property_excluded?('vrf', 'remote_route_filtering')
163
+ refute(v.remote_route_filtering)
164
+ assert_raises(Cisco::UnsupportedError) do
165
+ v.remote_route_filtering = false
166
+ end
167
+ v.destroy
168
+ return
169
+ end
170
+ assert(v.remote_route_filtering,
171
+ 'Test1.1, remote_route_filtering should be default value')
172
+ v.remote_route_filtering = false
173
+ refute(v.remote_route_filtering,
174
+ 'Test2.1, remote_route_filtering should be set to false')
175
+ v.remote_route_filtering = v.default_remote_route_filtering
176
+ assert(v.remote_route_filtering,
177
+ 'Test3.1, remote_route_filtering should be set to default value')
178
+ v.destroy
179
+ end
180
+
181
+ def test_vni
182
+ vrf = Vrf.new('test_vni')
183
+ assert_equal(vrf.default_vni, vrf.vni,
184
+ 'vrf vni should be set to default value')
185
+
186
+ vrf.vni = 4096
187
+ assert_equal(4096, vrf.vni,
188
+ "vrf vni should be set to '4096'")
189
+ vrf.vni = vrf.default_vni
190
+ assert_equal(vrf.default_vni, vrf.vni,
191
+ 'vrf vni should be set to default value')
192
+ vrf.destroy
193
+ rescue RuntimeError => e
194
+ hardware_supports_feature?(e.message)
195
+ end
196
+
197
+ def test_route_distinguisher
198
+ skip_nexus_i2_image?
199
+ # Check for compatible linecard (if platform requires it) and set it up
200
+ vxlan_linecard?
201
+ vdc_lc_state('f3')
202
+
203
+ v = Vrf.new('green')
204
+ if validate_property_excluded?('vrf', 'route_distinguisher')
205
+ # Must be configured under BGP in IOS XR
206
+ assert_nil(v.route_distinguisher)
207
+ assert_nil(v.default_route_distinguisher)
208
+ assert_raises(Cisco::UnsupportedError) { v.route_distinguisher = 'auto' }
209
+ v.destroy
210
+ return
211
+ end
212
+ v.route_distinguisher = 'auto'
213
+ assert_equal('auto', v.route_distinguisher)
214
+
215
+ v.route_distinguisher = '1:1'
216
+ assert_equal('1:1', v.route_distinguisher)
217
+
218
+ v.route_distinguisher = '2:3'
219
+ assert_equal('2:3', v.route_distinguisher)
220
+
221
+ v.route_distinguisher = v.default_route_distinguisher
222
+ assert_empty(v.route_distinguisher,
223
+ 'v route_distinguisher should *NOT* be configured')
224
+ v.destroy
225
+ rescue RuntimeError => e
226
+ hardware_supports_feature?(e.message)
227
+ end
228
+
229
+ def test_vpn_id
230
+ v = Vrf.new('test_vpn_id')
231
+ if validate_property_excluded?('vrf', 'vpn_id')
232
+ assert_nil(v.vpn_id)
233
+ assert_raises(Cisco::UnsupportedError) { v.vpn_id = '1:1' }
234
+ v.destroy
235
+ return
236
+ end
237
+ assert_equal(v.default_vpn_id, v.vpn_id,
238
+ 'Test1.1, vpn_id should be default value')
239
+ %w(1:1 abcdef:12345678).each do |id|
240
+ v.vpn_id = id
241
+ assert_equal(id, v.vpn_id, "Test2.1, vpn_id should be set to #{id}")
242
+ end
243
+ v.vpn_id = v.default_vpn_id
244
+ assert_equal(v.default_vpn_id, v.vpn_id,
245
+ 'Test3.1, vpn_id should be set to default value')
246
+ v.destroy
247
+ end
248
+ end
@@ -0,0 +1,288 @@
1
+ # Copyright (c) 2015-2016 Cisco and/or its affiliates.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative 'ciscotest'
16
+ require_relative '../lib/cisco_node_utils/vrf_af'
17
+
18
+ include Cisco
19
+
20
+ # TestVrfAf - Minitest for Vrf node utility class
21
+ class TestVrfAf < CiscoTestCase
22
+ @@pre_clean_needed = true # rubocop:disable Style/ClassVars
23
+
24
+ def setup
25
+ super
26
+ return unless @@pre_clean_needed
27
+ nexus_feature_disable
28
+ remove_all_vrfs
29
+ @@pre_clean_needed = false # rubocop:disable Style/ClassVars
30
+ end
31
+
32
+ def teardown
33
+ nexus_feature_disable
34
+ remove_all_vrfs
35
+ super
36
+ end
37
+
38
+ def nexus_feature_disable
39
+ config('no feature bgp')
40
+
41
+ # Some platforms complain when nv overlay is not configured
42
+ config_no_warn('no nv overlay evpn')
43
+
44
+ # Some platforms remove the 'evpn' command when 'no nv overlay evpn'
45
+ # is processed, while others must remove it explicitly.
46
+ config_no_warn('no evpn')
47
+ end
48
+
49
+ def test_create_destroy
50
+ v1 = VrfAF.new('cyan', %w(ipv4 unicast))
51
+ v2 = VrfAF.new('cyan', %w(ipv6 unicast))
52
+ v3 = VrfAF.new('red', %w(ipv4 unicast))
53
+ v4 = VrfAF.new('blue', %w(ipv4 unicast))
54
+ v5 = VrfAF.new('red', %w(ipv6 unicast))
55
+ assert_equal(2, VrfAF.afs['cyan'].keys.count)
56
+ assert_equal(2, VrfAF.afs['red'].keys.count)
57
+ assert_equal(1, VrfAF.afs['blue'].keys.count)
58
+
59
+ v1.destroy
60
+ v5.destroy
61
+ assert_equal(1, VrfAF.afs['cyan'].keys.count)
62
+ assert_equal(1, VrfAF.afs['red'].keys.count)
63
+ assert_equal(1, VrfAF.afs['blue'].keys.count)
64
+
65
+ v2.destroy
66
+ v3.destroy
67
+ v4.destroy
68
+ assert_equal(0, VrfAF.afs['cyan'].keys.count)
69
+ assert_equal(0, VrfAF.afs['red'].keys.count)
70
+ assert_equal(0, VrfAF.afs['blue'].keys.count)
71
+ end
72
+
73
+ #-----------------------------------------
74
+ # test_route_policy
75
+ def test_route_policy
76
+ config('route-policy abc', 'end-policy') if platform == :ios_xr
77
+ [%w(ipv4 unicast), %w(ipv6 unicast)].each { |af| route_policy(af) }
78
+ config('route-policy abc', 'end-policy') if platform == :ios_xr
79
+ end
80
+
81
+ def route_policy(af)
82
+ v = VrfAF.new('black', af)
83
+
84
+ assert_nil(v.default_route_policy_import,
85
+ "Test1.1 : #{af} : route_policy_import")
86
+ assert_nil(v.default_route_policy_export,
87
+ "Test1.2 : #{af} : route_policy_export")
88
+ opts = [:import, :export]
89
+ # test route_target_import
90
+ # test route_target_export
91
+ opts.each do |opt|
92
+ # test route_policy set, from nil to name
93
+ policy_name = 'abc'
94
+ v.send("route_policy_#{opt}=", policy_name)
95
+ result = v.send("route_policy_#{opt}")
96
+ assert_equal(policy_name, result,
97
+ "Test2.1 : #{af} : route_policy_#{opt}")
98
+
99
+ # test route_policy remove, from name to nil
100
+ policy_name = nil
101
+ v.send("route_policy_#{opt}=", policy_name)
102
+ result = v.send("route_policy_#{opt}")
103
+ assert_nil(result, "Test2.2 : #{af} : route_policy_#{opt}")
104
+
105
+ # test route_policy remove, from nil to nil
106
+ v.send("route_policy_#{opt}=", policy_name)
107
+ result = v.send("route_policy_#{opt}")
108
+ assert_nil(result, "Test2.3 : #{af} : route_policy_#{opt}")
109
+ end
110
+ v.destroy
111
+ end
112
+
113
+ def test_route_target
114
+ vdc_limit_f3_no_intf_needed(:set)
115
+ [%w(ipv4 unicast), %w(ipv6 unicast)].each { |af| route_target(af) }
116
+ vdc_limit_f3_no_intf_needed(:clear)
117
+ end
118
+
119
+ def route_target(af, _test_mvpn=false)
120
+ # Common tester for route-target properties. Tests evpn and non-evpn.
121
+ # route_target_both_auto
122
+ # route_target_both_auto_evpn
123
+ # route_target_both_auto_mvpn
124
+ # route_target_export
125
+ # route_target_export_evpn
126
+ # route_target_export_mvpn
127
+ # route_target_import
128
+ # route_target_import_evpn
129
+ # route_target_import_mvpn
130
+
131
+ # mvpn tests are only supported on 7.0.3.I7.1 and later
132
+ mvpn_skip_versions = ['7.0.3.(I2|I3|I4|I5|I6)']
133
+
134
+ vrf = 'orange'
135
+ v = VrfAF.new(vrf, af)
136
+
137
+ # test route target both auto and route target both auto evpn
138
+ refute(v.default_route_target_both_auto,
139
+ 'default value for route target both auto should be false')
140
+
141
+ refute(v.default_route_target_both_auto_evpn,
142
+ 'default value for route target both auto evpn should be false')
143
+
144
+ if step_unless_version_unsupported(mvpn_skip_versions)
145
+ refute(v.default_route_target_both_auto_mvpn,
146
+ 'default value for route target both auto mvpn should be false')
147
+ end
148
+
149
+ if validate_property_excluded?('vrf_af', 'route_target_both_auto')
150
+ assert_raises(Cisco::UnsupportedError) { v.route_target_both_auto = true }
151
+ else
152
+ v.route_target_both_auto = true
153
+ assert(v.route_target_both_auto, "vrf context #{vrf} af #{af}: "\
154
+ 'v route-target both auto should be enabled')
155
+
156
+ v.route_target_both_auto = false
157
+ refute(v.route_target_both_auto, "vrf context #{vrf} af #{af}: "\
158
+ 'v route-target both auto should be disabled')
159
+ end
160
+
161
+ if validate_property_excluded?('vrf_af', 'route_target_both_auto_evpn')
162
+ assert_raises(Cisco::UnsupportedError) do
163
+ v.route_target_both_auto_evpn = true
164
+ end
165
+ else
166
+ v.route_target_both_auto_evpn = true
167
+ assert(v.route_target_both_auto_evpn, "vrf context #{vrf} af #{af}: "\
168
+ 'v route-target both auto evpn should be enabled')
169
+
170
+ v.route_target_both_auto_evpn = false
171
+ refute(v.route_target_both_auto_evpn, "vrf context #{vrf} af #{af}: "\
172
+ 'v route-target both auto evpn should be disabled')
173
+ end
174
+
175
+ if step_unless_version_unsupported(mvpn_skip_versions)
176
+ if validate_property_excluded?('vrf_af', 'route_target_both_auto_mvpn')
177
+ assert_raises(Cisco::UnsupportedError) do
178
+ v.route_target_both_auto_mvpn = true
179
+ end
180
+ else
181
+ v.route_target_both_auto_mvpn = true
182
+ assert(v.route_target_both_auto_mvpn, "vrf context #{vrf} af #{af}: "\
183
+ 'v route-target both auto mvpn should be enabled')
184
+
185
+ v.route_target_both_auto_mvpn = false
186
+ refute(v.route_target_both_auto_mvpn, "vrf context #{vrf} af #{af}: "\
187
+ 'v route-target both auto mvpn should be disabled')
188
+ end
189
+ end
190
+
191
+ opts = [:import, :export]
192
+
193
+ # Master list of communities to test against
194
+ master = ['1:1', '2:2', '3:3', '4:5']
195
+
196
+ # Test 1: both/import/export when no commands are present. Each target
197
+ # option will be tested with and without evpn (6 separate types)
198
+ should = master.clone
199
+ route_target_tester(v, af, opts, should, 'Test 1')
200
+
201
+ # Test 2: remove half of the entries
202
+ should = ['1:1', '4:4']
203
+ route_target_tester(v, af, opts, should, 'Test 2')
204
+
205
+ # Test 3: restore the removed entries
206
+ should = master.clone
207
+ route_target_tester(v, af, opts, should, 'Test 3')
208
+
209
+ # Test 4: 'default'
210
+ should = v.default_route_target_import
211
+ route_target_tester(v, af, opts, should, 'Test 4')
212
+ v.destroy
213
+ rescue RuntimeError => e
214
+ hardware_supports_feature?(e.message)
215
+ end
216
+
217
+ def route_target_tester(v, af, opts, should, test_id)
218
+ # mvpn tests are only supported on 7.0.3.I7.1 and later
219
+ mvpn_skip_versions = ['7.0.3.(I2|I3|I4|I5|I6)']
220
+
221
+ # First configure all four property types
222
+ opts.each do |opt|
223
+ # non-evpn
224
+ v.send("route_target_#{opt}=", should)
225
+ # evpn
226
+ if validate_property_excluded?('vrf_af', "route_target_#{opt}_evpn")
227
+ assert_raises(Cisco::UnsupportedError, "route_target_#{opt}_evpn=") do
228
+ v.send("route_target_#{opt}_evpn=", should)
229
+ end
230
+ else
231
+ v.send("route_target_#{opt}_evpn=", should)
232
+ end
233
+ # mvpn
234
+ if step_unless_version_unsupported(mvpn_skip_versions)
235
+ if validate_property_excluded?('vrf_af', "route_target_#{opt}_mvpn")
236
+ assert_raises(Cisco::UnsupportedError, "route_target_#{opt}_mvpn=") do
237
+ v.send("route_target_#{opt}_mvpn=", should)
238
+ end
239
+ else
240
+ v.send("route_target_#{opt}_mvpn=", should)
241
+ end
242
+ end
243
+ # stitching
244
+ if platform == :nexus
245
+ assert_raises(Cisco::UnsupportedError,
246
+ "route_target_#{opt}_stitching=") do
247
+ v.send("route_target_#{opt}_stitching=", should)
248
+ end
249
+ else
250
+ v.send("route_target_#{opt}_stitching=", should)
251
+ end
252
+ end
253
+
254
+ # Now check the results
255
+ opts.each do |opt|
256
+ # non-evpn
257
+ result = v.send("route_target_#{opt}")
258
+ assert_equal(should, result,
259
+ "#{test_id} : #{af} : route_target_#{opt}")
260
+ # evpn
261
+ result = v.send("route_target_#{opt}_evpn")
262
+ if validate_property_excluded?('vrf_af', "route_target_#{opt}_evpn")
263
+ assert_nil(result)
264
+ else
265
+ assert_equal(should, result,
266
+ "#{test_id} : #{af} : route_target_#{opt}_evpn")
267
+ end
268
+ # mvpn
269
+ if step_unless_version_unsupported(mvpn_skip_versions)
270
+ result = v.send("route_target_#{opt}_mvpn")
271
+ if validate_property_excluded?('vrf_af', "route_target_#{opt}_mvpn")
272
+ assert_nil(result)
273
+ else
274
+ assert_equal(should, result,
275
+ "#{test_id} : #{af} : route_target_#{opt}_mvpn")
276
+ end
277
+ end
278
+ # stitching
279
+ result = v.send("route_target_#{opt}_stitching")
280
+ if platform == :nexus
281
+ assert_nil(result)
282
+ else
283
+ assert_equal(should, result,
284
+ "#{test_id} : #{af} : route_target_#{opt}_stitching")
285
+ end
286
+ end
287
+ end
288
+ end