cisco_node_utils_mgx 2.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,146 @@
1
+ #
2
+ # Minitest for NtpServer class
3
+ #
4
+ # Copyright (c) 2014-2017 Cisco and/or its affiliates.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative 'ciscotest'
19
+ require_relative '../lib/cisco_node_utils/ntp_server'
20
+
21
+ # TestNtpServer - Minitest for NtpServer node utility.
22
+ class TestNtpServer < CiscoTestCase
23
+ def setup
24
+ # setup runs at the beginning of each test
25
+ super
26
+ no_ntpserver
27
+ end
28
+
29
+ def teardown
30
+ # teardown runs at the end of each test
31
+ no_ntpserver
32
+ super
33
+ end
34
+
35
+ def no_ntpserver
36
+ # Turn the feature off for a clean test.
37
+ config('no ntp server 130.88.203.12',
38
+ 'no ntp server 2003::5',
39
+ 'no ntp server 0.us.pool.ntp.org',
40
+ 'no ntp authentication-key 999 md5 test 7',
41
+ 'no vrf context red')
42
+ end
43
+
44
+ # TESTS
45
+
46
+ def test_create_name_invalid
47
+ assert_raises(ArgumentError) do
48
+ Cisco::NtpServer.new({ 'name' => '1_com' }, true)
49
+ end
50
+ end
51
+
52
+ def test_ipv4
53
+ id = '130.88.203.12'
54
+ refute_includes(Cisco::NtpServer.ntpservers, id)
55
+
56
+ ntp = Cisco::NtpServer.new({ 'name' => id }, true)
57
+ assert_includes(Cisco::NtpServer.ntpservers, id)
58
+ assert_equal(ntp, Cisco::NtpServer.ntpservers[id])
59
+
60
+ ntp.destroy
61
+ refute_includes(Cisco::NtpServer.ntpservers, id)
62
+ end
63
+
64
+ def test_ipv6
65
+ id = '2003::5'
66
+ refute_includes(Cisco::NtpServer.ntpservers, id)
67
+
68
+ ntp = Cisco::NtpServer.new({ 'name' => id }, true)
69
+ assert_includes(Cisco::NtpServer.ntpservers, id)
70
+ assert_equal(ntp, Cisco::NtpServer.ntpservers[id])
71
+
72
+ ntp.destroy
73
+ refute_includes(Cisco::NtpServer.ntpservers, id)
74
+ end
75
+
76
+ def test_multiple
77
+ id1 = '130.88.203.12'
78
+ id2 = '2003::5'
79
+ refute_includes(Cisco::NtpServer.ntpservers, id1)
80
+ refute_includes(Cisco::NtpServer.ntpservers, id2)
81
+
82
+ ntp1 = Cisco::NtpServer.new({ 'name' => id1 }, true)
83
+ ntp2 = Cisco::NtpServer.new({ 'name' => id2 }, true)
84
+ refute_equal(ntp1, ntp2)
85
+ assert_includes(Cisco::NtpServer.ntpservers, id1)
86
+ assert_includes(Cisco::NtpServer.ntpservers, id2)
87
+ assert_equal(ntp1, Cisco::NtpServer.ntpservers[id1])
88
+ assert_equal(ntp2, Cisco::NtpServer.ntpservers[id2])
89
+
90
+ ntp1.destroy
91
+ ntp2.destroy
92
+ refute_includes(Cisco::NtpServer.ntpservers, id1)
93
+ refute_includes(Cisco::NtpServer.ntpservers, id2)
94
+ end
95
+
96
+ # This test requires DNS resolution be avaabile - leaving for reference
97
+ # def test_domain_name
98
+ # id = '0.us.pool.ntp.org'
99
+ # refute_includes(Cisco::NtpServer.ntpservers, id)
100
+ #
101
+ # ntp = Cisco::NtpServer.new({ 'name' => id }, true)
102
+ # assert_includes(Cisco::NtpServer.ntpservers, id)
103
+ # assert_equal(ntp, Cisco::NtpServer.ntpservers[id])
104
+ #
105
+ # ntp.destroy
106
+ # refute_includes(Cisco::NtpServer.ntpservers, id)
107
+ # end
108
+
109
+ def test_defaults
110
+ id = '130.88.203.12'
111
+ refute_includes(Cisco::NtpServer.ntpservers, id)
112
+
113
+ ntp = Cisco::NtpServer.new({ 'name' => id }, true)
114
+ assert_includes(Cisco::NtpServer.ntpservers, id)
115
+ assert_equal('default', Cisco::NtpServer.ntpservers[id].vrf)
116
+ assert_nil(Cisco::NtpServer.ntpservers[id].key)
117
+ assert_nil(Cisco::NtpServer.ntpservers[id].maxpoll)
118
+ assert_nil(Cisco::NtpServer.ntpservers[id].minpoll)
119
+ refute(Cisco::NtpServer.ntpservers[id].prefer)
120
+
121
+ ntp.destroy
122
+ refute_includes(Cisco::NtpServer.ntpservers, id)
123
+ end
124
+
125
+ def test_create_options
126
+ id = '130.88.203.12'
127
+ refute_includes(Cisco::NtpServer.ntpservers, id)
128
+
129
+ options = { 'name' => id, 'key' => '999', 'prefer' => 'true',
130
+ 'minpoll' => '5', 'maxpoll' => '8', 'vrf' => 'red' }
131
+
132
+ config('vrf context red')
133
+ config('ntp authentication-key 999 md5 test 7')
134
+
135
+ ntp = Cisco::NtpServer.new(options, true)
136
+ assert_includes(Cisco::NtpServer.ntpservers, id)
137
+ assert_equal('red', Cisco::NtpServer.ntpservers[id].vrf)
138
+ assert_equal('999', Cisco::NtpServer.ntpservers[id].key)
139
+ assert_equal('5', Cisco::NtpServer.ntpservers[id].minpoll)
140
+ assert_equal('8', Cisco::NtpServer.ntpservers[id].maxpoll)
141
+ assert(Cisco::NtpServer.ntpservers[id].prefer)
142
+
143
+ ntp.destroy
144
+ refute_includes(Cisco::NtpServer.ntpservers, id)
145
+ end
146
+ end
@@ -0,0 +1,236 @@
1
+ # November 2014, Glenn F. Matthews
2
+ #
3
+ # Copyright (c) 2014-2016 Cisco and/or its affiliates.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require_relative 'ciscotest'
18
+ require_relative '../lib/cisco_node_utils/node'
19
+
20
+ # TestNxapi - NXAPI client unit tests
21
+ class TestNxapi < CiscoTestCase
22
+ @@client = nil # rubocop:disable Style/ClassVars
23
+
24
+ def self.runnable_methods
25
+ # If we're pointed to a gRPC node (as evidenced by presence of a port num)
26
+ # then these tests don't apply
27
+ return [:all_skipped] if Cisco::Environment.environment[:port]
28
+ super
29
+ end
30
+
31
+ def all_skipped
32
+ skip 'Node under test does not appear to use the NXAPI client'
33
+ end
34
+
35
+ def setup
36
+ super
37
+ @device.cmd('configure terminal')
38
+ @device.cmd('feature nxapi')
39
+ @device.cmd('nxapi http port 80')
40
+ @device.cmd('end')
41
+ @product_id = Cisco::Node.new.product_id if @product_id.nil?
42
+ cleanup
43
+ end
44
+
45
+ def teardown
46
+ @device.cmd('configure terminal')
47
+ @device.cmd('feature nxapi')
48
+ @device.cmd('nxapi http port 80')
49
+ @device.cmd('end')
50
+ cleanup
51
+ super
52
+ end
53
+
54
+ def cleanup
55
+ return if Cisco::Environment.environment[:port]
56
+ config_no_warn('no interface loopback41', 'no interface loopback42')
57
+ end
58
+
59
+ def client
60
+ unless @@client
61
+ client = Cisco::Client::NXAPI.new(Cisco::Environment.environment)
62
+ client.cache_enable = true
63
+ client.cache_auto = true
64
+ @@client = client # rubocop:disable Style/ClassVars
65
+ end
66
+ @@client
67
+ end
68
+
69
+ # Test cases for new NXAPI client APIs
70
+
71
+ def test_cli_set_string
72
+ client.set(context: 'interface loopback41', values: 'descr panda')
73
+ run = client.get(command: 'show run int loopback41')
74
+ desc = run.match(/description (.*)/)[1]
75
+ assert_equal(desc, 'panda')
76
+ end
77
+
78
+ def test_cli_set_array
79
+ client.set(context: ['int loopback41'], values: ['descr elephant'])
80
+ run = client.get(command: 'show run int loopback41')
81
+ desc = run.match(/description (.*)/)[1]
82
+ assert_equal(desc, 'elephant')
83
+ end
84
+
85
+ def test_cli_set_invalid
86
+ input = ['int loopback41', 'exit', 'int loopback42', 'plover']
87
+ successful = ['int loopback41', 'exit', 'int loopback42']
88
+ rejected = 'plover'
89
+
90
+ msg = case @product_id
91
+ when /N(5|6|7)/
92
+ 'Input CLI command error'
93
+ when /N(3|8|9)/
94
+ 'CLI execution error'
95
+ end
96
+
97
+ e = assert_raises Cisco::CliError do
98
+ client.set(values: input)
99
+ end
100
+
101
+ cli_rcs = "
102
+ cli return codes:
103
+ successful : #{e.successful_input}
104
+ rejected : #{e.rejected_input}
105
+ msg : #{e.msg}
106
+ code : #{e.code}
107
+ clierror : #{e.clierror}
108
+ "
109
+ assert_equal(successful, e.successful_input, cli_rcs)
110
+ assert_equal(rejected, e.rejected_input, cli_rcs)
111
+
112
+ assert_match(msg, e.msg, cli_rcs)
113
+ assert_equal('400', e.code, cli_rcs)
114
+ assert_match('% Invalid command', e.clierror, cli_rcs)
115
+ end
116
+
117
+ def test_get_cli_default
118
+ result = client.get(command: 'show hostname')
119
+ s = @device.cmd('show hostname')
120
+ assert_equal(result.strip, s.split("\n")[1].strip)
121
+ end
122
+
123
+ def test_get_cli_invalid
124
+ assert_raises Cisco::CliError do
125
+ client.get(command: 'show plugh')
126
+ end
127
+ end
128
+
129
+ def test_element_get_cli_incomplete
130
+ assert_raises Cisco::CliError do
131
+ client.get(command: 'show ')
132
+ end
133
+ end
134
+
135
+ def test_get_cli_explicit
136
+ result = client.get(command: 'show hostname', data_format: :cli)
137
+ s = @device.cmd('show hostname')
138
+ assert_equal(result.strip, s.split("\n")[1].strip)
139
+ end
140
+
141
+ def test_get_cli_empty
142
+ result = client.get(command: 'show hostname | incl foo | excl foo',
143
+ data_format: :cli)
144
+ assert_nil(result)
145
+ end
146
+
147
+ def test_get_nxapi_structured
148
+ result = client.get(command: 'show hostname',
149
+ data_format: :nxapi_structured)
150
+ s = @device.cmd('show hostname')
151
+ assert_equal(result['hostname'], s.split("\n")[1].strip)
152
+ end
153
+
154
+ def test_get_nxapi_structured_invalid
155
+ assert_raises Cisco::CliError do
156
+ client.get(command: 'show frobozz', data_format: :nxapi_structured)
157
+ end
158
+ end
159
+
160
+ def test_get_nxapi_structured_unsupported
161
+ cmd = { command: 'show snmp internal globals',
162
+ data_format: :nxapi_structured }
163
+ if @product_id[/N(5|6)/]
164
+ assert_empty(client.get(cmd).to_s)
165
+ else
166
+ assert_raises(Cisco::RequestNotSupported) { client.get(cmd) }
167
+ end
168
+ end
169
+
170
+ def test_connection_refused
171
+ @device.cmd('configure terminal')
172
+ @device.cmd('no feature nxapi')
173
+ @device.cmd('end')
174
+ assert_raises Cisco::ConnectionRefused do
175
+ client.cache_flush
176
+ client.get(command: 'show version')
177
+ end
178
+ assert_raises Cisco::ConnectionRefused do
179
+ client.set(values: 'interface loopback41')
180
+ end
181
+ # On the off chance that things behave differently when NXAPI is
182
+ # disabled while we're connected, versus trying to connect afresh...
183
+ @@client = nil # rubocop:disable Style/ClassVars
184
+ assert_raises Cisco::ConnectionRefused do
185
+ client.get(command: 'show version')
186
+ end
187
+ assert_raises Cisco::ConnectionRefused do
188
+ client.set(values: 'interface loopback41')
189
+ end
190
+ end
191
+
192
+ def test_unauthorized
193
+ def client.password=(new) # rubocop:disable Style/TrivialAccessors
194
+ @password = new
195
+ end
196
+ client.password = 'wrong_password'
197
+ client.cache_flush
198
+ assert_raises Cisco::AuthenticationFailed do
199
+ client.get(command: 'show version')
200
+ end
201
+ assert_raises Cisco::AuthenticationFailed do
202
+ client.set(values: 'interface loopback41')
203
+ end
204
+ ensure
205
+ client.password = password
206
+ end
207
+
208
+ def test_unsupported
209
+ # Add a method to the NXAPI that sends a request of invalid type
210
+ if !product_tag[/n(3|9)k-f/]
211
+ def client.hello
212
+ req('hello', 'world')
213
+ end
214
+
215
+ assert_raises Cisco::RequestNotSupported do
216
+ client.hello
217
+ end
218
+ else
219
+ def client.hello
220
+ req('hello', 'world')
221
+ end
222
+
223
+ assert_raises Cisco::ClientError do
224
+ client.hello
225
+ end
226
+ end
227
+ end
228
+
229
+ def test_smart_create
230
+ autoclient = Cisco::Client.create
231
+ assert_equal(Cisco::Client::NXAPI, autoclient.class)
232
+ assert(autoclient.supports?(:cli))
233
+ assert(autoclient.supports?(:nxapi_structured))
234
+ assert_equal(:nexus, autoclient.platform)
235
+ end
236
+ end
@@ -0,0 +1,122 @@
1
+ # Copyright (c) 2017 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/object_group'
17
+ require_relative '../lib/cisco_node_utils/object_group_entry'
18
+
19
+ # TestObject_group - Minitest for Object_group
20
+ # node utility class
21
+ class TestObjectGroup < CiscoTestCase
22
+ @skip_unless_supported = 'object_group'
23
+ @@pre_clean_needed = true # rubocop:disable Style/ClassVars
24
+
25
+ def setup
26
+ super
27
+ @og_name_v4 = 'test-my-v4'
28
+ @og_name_v6 = 'test-my-v6'
29
+ @og_name_port = 'test-my-port'
30
+ remove_all_object_groups if @@pre_clean_needed
31
+ @@pre_clean_needed = false # rubocop:disable Style/ClassVars
32
+ end
33
+
34
+ def teardown
35
+ remove_all_object_groups
36
+ super
37
+ end
38
+
39
+ def remove_all_object_groups
40
+ ObjectGroup.object_groups.each do |_afis, types|
41
+ types.each do |_type, grps|
42
+ grps.values.each(&:destroy)
43
+ end
44
+ end
45
+ end
46
+
47
+ def test_create_object_group
48
+ %w(ipv4 ipv6).each do |afi|
49
+ og_name = afi[/ipv6/] ? @og_name_v6 : @og_name_v4
50
+ og = ObjectGroup.new(afi, 'address', og_name)
51
+ assert(ObjectGroup.object_groups[afi]['address'].key?(og_name))
52
+ og.destroy
53
+ assert_nil(ObjectGroup.object_groups[afi])
54
+ end
55
+ og_name = @og_name_port
56
+ og = ObjectGroup.new('ipv4', 'port', og_name)
57
+ assert(ObjectGroup.object_groups['ipv4']['port'].key?(og_name))
58
+ og.destroy
59
+ assert_nil(ObjectGroup.object_groups['ipv4'])
60
+ end
61
+
62
+ def entry_helper(afi, type, name, props=nil)
63
+ test_hash = {
64
+ address: 'host 1.1.1.1',
65
+ port: 'eq 200',
66
+ }
67
+ test_hash.merge!(props) unless props.nil?
68
+
69
+ ObjectGroup.new(afi, type, name)
70
+ e = ObjectGroupEntry.new(afi, type, name, 10)
71
+ e.entry_set(test_hash)
72
+ e
73
+ end
74
+
75
+ def test_ipv4_address_host
76
+ e = entry_helper('ipv4', 'address', @og_name_v4, port: nil)
77
+ assert_equal('host 1.1.1.1', e.address)
78
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: 'host 2.2.2.2', port: nil)
79
+ assert_equal('host 2.2.2.2', e.address)
80
+ end
81
+
82
+ def test_ipv4_address_prefix
83
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '2.2.2.2/17', port: nil)
84
+ assert_equal('2.2.2.2/17', e.address)
85
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '3.3.3.3/31', port: nil)
86
+ assert_equal('3.3.3.3/31', e.address)
87
+ end
88
+
89
+ def test_ipv4_address_netmask
90
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '2.2.2.2 255.255.255.0', port: nil)
91
+ assert_equal('2.2.2.2 255.255.255.0', e.address)
92
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '3.3.3.3 10.11.12.13', port: nil)
93
+ assert_equal('3.3.3.3 10.11.12.13', e.address)
94
+ end
95
+
96
+ def test_ipv6_address_host
97
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: 'host 2000::1', port: nil)
98
+ assert_equal('host 2000::1', e.address)
99
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: 'host 2001::2', port: nil)
100
+ assert_equal('host 2001::2', e.address)
101
+ end
102
+
103
+ def test_ipv6_address_prefix
104
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: '2000::1/127', port: nil)
105
+ assert_equal('2000::1/127', e.address)
106
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: '2001::10/64', port: nil)
107
+ assert_equal('2001::10/64', e.address)
108
+ end
109
+
110
+ def test_ipv4_port
111
+ e = entry_helper('ipv4', 'port', @og_name_port, address: nil)
112
+ assert_equal('eq 200', e.port)
113
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'lt 100', address: nil)
114
+ assert_equal('lt 100', e.port)
115
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'neq 150', address: nil)
116
+ assert_equal('neq 150', e.port)
117
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'gt 350', address: nil)
118
+ assert_equal('gt 350', e.port)
119
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'range 400 1000', address: nil)
120
+ assert_equal('range 400 1000', e.port)
121
+ end
122
+ end
@@ -0,0 +1,108 @@
1
+ # Copyright (c) 2013-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/cisco_cmn_utils'
17
+ require_relative '../lib/cisco_node_utils/feature'
18
+ require_relative '../lib/cisco_node_utils/overlay_global'
19
+
20
+ include Cisco
21
+
22
+ # TestOverlayGlobal - Minitest for OverlayGlobal node utility
23
+ class TestOverlayGlobal < CiscoTestCase
24
+ @skip_unless_supported = 'overlay_global'
25
+
26
+ def setup
27
+ super
28
+ vdc_limit_f3_no_intf_needed(:set)
29
+ config_no_warn('no feature fabric forwarding')
30
+ config_no_warn('no nv overlay evpn')
31
+ end
32
+
33
+ def teardown
34
+ config_no_warn('no feature fabric forwarding')
35
+ config_no_warn('no nv overlay evpn')
36
+ vdc_limit_f3_no_intf_needed(:clear) if first_or_last_teardown
37
+ end
38
+
39
+ def test_dup_host_ip_addr_detection
40
+ o = OverlayGlobal.new
41
+ if validate_property_excluded?('overlay_global',
42
+ 'dup_host_ip_addr_detection')
43
+ assert_raises(Cisco::UnsupportedError) do
44
+ o.dup_host_ip_addr_detection_set(200, 20)
45
+ end
46
+ return
47
+ end
48
+
49
+ assert_equal(o.default_dup_host_ip_addr_detection_host_moves,
50
+ o.dup_host_ip_addr_detection_host_moves)
51
+ assert_equal(o.default_dup_host_ip_addr_detection_timeout,
52
+ o.dup_host_ip_addr_detection_timeout)
53
+
54
+ # Set them to the default value and they should now be present
55
+ default = [o.default_dup_host_ip_addr_detection_host_moves,
56
+ o.default_dup_host_ip_addr_detection_timeout]
57
+ o.dup_host_ip_addr_detection_set(*default)
58
+ assert_equal(default[0], o.dup_host_ip_addr_detection_host_moves)
59
+ assert_equal(default[1], o.dup_host_ip_addr_detection_timeout)
60
+ assert(Feature.nv_overlay_evpn_enabled?)
61
+
62
+ # Set them to non-default values
63
+ val = [200, 20]
64
+ o.dup_host_ip_addr_detection_set(*val)
65
+ assert_equal(val, o.dup_host_ip_addr_detection)
66
+ assert_equal(val[0], o.dup_host_ip_addr_detection_host_moves)
67
+ assert_equal(val[1], o.dup_host_ip_addr_detection_timeout)
68
+ end
69
+
70
+ def test_dup_host_mac_detection
71
+ o = OverlayGlobal.new
72
+
73
+ skip_incompat_version?('overlay_global', 'dup_host_mac_detection')
74
+ # Set to a non-default value
75
+ val = [160, 16]
76
+ o.dup_host_mac_detection_set(*val)
77
+ assert_equal(val, o.dup_host_mac_detection)
78
+ refute(Feature.nv_overlay_evpn_enabled?)
79
+
80
+ # These properties always exist, even without 'nv overlay evpn'
81
+ default = [o.default_dup_host_mac_detection_host_moves,
82
+ o.default_dup_host_mac_detection_timeout]
83
+ o.dup_host_mac_detection_set(*default)
84
+ assert_equal(default, o.dup_host_mac_detection)
85
+ refute(Feature.nv_overlay_evpn_enabled?)
86
+ end
87
+
88
+ def test_anycast_gateway_mac
89
+ o = OverlayGlobal.new
90
+ if validate_property_excluded?('overlay_global', 'anycast_gateway_mac')
91
+ assert_raises(Cisco::UnsupportedError) { o.anycast_gateway_mac = '1.1.1' }
92
+ return
93
+ end
94
+
95
+ assert_equal(o.default_anycast_gateway_mac, o.anycast_gateway_mac)
96
+
97
+ # Explicitly set to default and it should be enabled
98
+ o.anycast_gateway_mac = o.default_anycast_gateway_mac
99
+ assert_equal(o.default_anycast_gateway_mac, o.anycast_gateway_mac)
100
+ assert(Feature.nv_overlay_evpn_enabled?)
101
+
102
+ # Set to various non-default values
103
+ %w(1.1.1 55.a10.ffff 1223.3445.5668).each do |mac|
104
+ o.anycast_gateway_mac = mac
105
+ assert_equal(Utils.zero_pad_macaddr(mac), o.anycast_gateway_mac)
106
+ end
107
+ end
108
+ end