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_vpc.rb ADDED
@@ -0,0 +1,548 @@
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
+ require_relative 'ciscotest'
15
+ require_relative '../lib/cisco_node_utils/vpc'
16
+ require_relative '../lib/cisco_node_utils/interface'
17
+ require_relative '../lib/cisco_node_utils/interface_channel_group'
18
+ require_relative '../lib/cisco_node_utils/platform'
19
+
20
+ include Cisco
21
+
22
+ # TestVpc - Minitest for Vpc node utility class
23
+ class TestVpc < CiscoTestCase
24
+ @skip_unless_supported = 'vpc'
25
+
26
+ def setup
27
+ super
28
+ no_feature_vpc
29
+ end
30
+
31
+ def teardown
32
+ super
33
+ end
34
+
35
+ def no_feature_vpc
36
+ domains = Vpc.domains
37
+ domains.each { |_key, elem| elem.destroy } unless domains.empty?
38
+ end
39
+
40
+ # TESTS
41
+
42
+ def test_vpc_create
43
+ vpc = Vpc.new(100)
44
+ assert(vpc.domain == 100,
45
+ "VPC domain not set correctly #{vpc.domain}")
46
+ assert(Vpc.enabled,
47
+ 'VPC feature should have been enabled')
48
+ refute(Vpc.domains.empty?,
49
+ 'Domain collection should not be empty after create')
50
+ end
51
+
52
+ def test_vpc_destroy
53
+ # create and test again
54
+ vpc = Vpc.new(100)
55
+ vpc.destroy
56
+ refute(Vpc.enabled, 'VPC feature should have been disabled')
57
+ end
58
+
59
+ def test_auto_recovery
60
+ vpc = Vpc.new(100)
61
+ if validate_property_excluded?('vpc', 'auto_recovery')
62
+ assert_raises(Cisco::UnsupportedError) { vpc.auto_recovery = true }
63
+ return
64
+ end
65
+
66
+ default_val = vpc.auto_recovery
67
+ assert_equal(default_val, vpc.auto_recovery,
68
+ "Auto recovery should be #{default_val} by default")
69
+ vpc.auto_recovery = false
70
+ refute(vpc.auto_recovery, 'Auto recovery not getting disabled')
71
+ vpc.auto_recovery = true
72
+ assert(vpc.auto_recovery, 'Auto recovery not getting set')
73
+ end
74
+
75
+ def test_auto_recovery_reload_delay
76
+ vpc = Vpc.new(100)
77
+ default_value = vpc.default_auto_recovery_reload_delay
78
+ assert_equal(default_value, vpc.auto_recovery_reload_delay,
79
+ "Auto recovery delay should be #{default_value}")
80
+ vpc.auto_recovery_reload_delay = 300
81
+ assert_equal(300, vpc.auto_recovery_reload_delay,
82
+ 'Auto recovery delay should be 300')
83
+ end
84
+
85
+ def test_delay_restore
86
+ vpc = Vpc.new(100)
87
+ default_value = vpc.default_delay_restore
88
+ assert_equal(default_value, vpc.delay_restore,
89
+ "delay_restore should be #{default_value}")
90
+ vpc.delay_restore = 1000
91
+ assert_equal(1000, vpc.delay_restore,
92
+ 'delay restore should be 1000')
93
+ end
94
+
95
+ def test_delay_restore_interface_vlan
96
+ vpc = Vpc.new(100)
97
+ default_value = vpc.default_delay_restore_interface_vlan
98
+ assert_equal(default_value, vpc.delay_restore_interface_vlan,
99
+ "delay_restore should be #{default_value}")
100
+ vpc.delay_restore_interface_vlan = 2000
101
+ assert_equal(2000, vpc.delay_restore_interface_vlan,
102
+ 'delay restore should be 2000')
103
+ end
104
+
105
+ def test_dual_active_exclude_interface_vlan_bridge_domain
106
+ vpc = Vpc.new(100)
107
+ default_value =
108
+ vpc.default_dual_active_exclude_interface_vlan_bridge_domain
109
+ assert_equal(default_value,
110
+ vpc.dual_active_exclude_interface_vlan_bridge_domain,
111
+ "delay_restore should be #{default_value}")
112
+ vpc.dual_active_exclude_interface_vlan_bridge_domain = '2-20,900'
113
+ assert_equal('2-20,900',
114
+ vpc.dual_active_exclude_interface_vlan_bridge_domain,
115
+ 'exclude vlan/bd should be 2-20,900')
116
+ end
117
+
118
+ def test_graceful_consistency_check
119
+ vpc = Vpc.new(100)
120
+ default_val = vpc.default_graceful_consistency_check
121
+ assert_equal(default_val, vpc.graceful_consistency_check,
122
+ "graceful_consistency_check must be #{default_val} by default")
123
+ vpc.graceful_consistency_check = false
124
+ refute(vpc.graceful_consistency_check,
125
+ 'graceful_consistency_check not getting disabled')
126
+ vpc.graceful_consistency_check = true
127
+ assert(vpc.graceful_consistency_check,
128
+ 'graceful_consistency_check not getting set')
129
+ end
130
+
131
+ def test_layer3_peer_routing
132
+ vpc = Vpc.new(100)
133
+ skip_incompat_version?('vpc', 'layer3_peer_routing')
134
+ default_val = vpc.default_layer3_peer_routing
135
+ assert_equal(default_val, vpc.layer3_peer_routing,
136
+ "layer3_peer_routing should be #{default_val} by default")
137
+ vpc.layer3_peer_routing = true
138
+ assert(vpc.layer3_peer_routing, 'layer3_peer_routing not getting set')
139
+ vpc.layer3_peer_routing = false
140
+ refute(vpc.layer3_peer_routing, 'layer3_peer_routing not getting disabled')
141
+ # reset peer gateway
142
+ vpc.peer_gateway = false
143
+ assert_equal(vpc.default_peer_gateway, vpc.peer_gateway)
144
+ end
145
+
146
+ def test_peer_keepalive
147
+ vpc = Vpc.new(100)
148
+
149
+ # Check default values
150
+ dest = vpc.default_peer_keepalive_dest
151
+ assert_equal('', dest, 'destination should be 1.1.1.2')
152
+ source = vpc.default_peer_keepalive_src
153
+ assert_equal('', source, 'source should be 1.1.1.1')
154
+ udp_port = vpc.default_peer_keepalive_udp_port
155
+ assert_equal(3200, udp_port, 'udp port should be 3200')
156
+ vrf = vpc.default_peer_keepalive_vrf
157
+ assert_equal('management', vrf, 'vrf should be management')
158
+ interval = vpc.default_peer_keepalive_interval
159
+ assert_equal(1000, interval, 'interval should be 1000')
160
+ timeout = vpc.default_peer_keepalive_interval_timeout
161
+ assert_equal(5, timeout, 'interval timeout should be 5')
162
+ precedence = vpc.default_peer_keepalive_precedence
163
+ assert_equal(6, precedence, 'precedence should be 6')
164
+ hold_timeout = vpc.default_peer_keepalive_hold_timeout
165
+ assert_equal(3, hold_timeout, 'hold timeout should be 3')
166
+
167
+ vpc.peer_keepalive_set('1.1.1.2', '1.1.1.1', 3800, 'management', 400, 3,
168
+ 6, 3)
169
+ dest = vpc.peer_keepalive_dest
170
+ assert_equal('1.1.1.2', dest, 'destination should be 1.1.1.2')
171
+ source = vpc.peer_keepalive_src
172
+ assert_equal('1.1.1.1', source, 'source should be 1.1.1.1')
173
+ udp_port = vpc.peer_keepalive_udp_port
174
+ assert_equal(3800, udp_port, 'udp port should be 3800')
175
+ vrf = vpc.peer_keepalive_vrf
176
+ assert_equal('management', vrf, 'vrf should be management')
177
+ interval = vpc.peer_keepalive_interval
178
+ assert_equal(400, interval, 'interval should be 400')
179
+ timeout = vpc.peer_keepalive_interval_timeout
180
+ assert_equal(3, timeout, 'interval timeout should be 3')
181
+ precedence = vpc.peer_keepalive_precedence
182
+ assert_equal(6, precedence, 'precedence should be 6')
183
+ hold_timeout = vpc.peer_keepalive_hold_timeout
184
+ assert_equal(3, hold_timeout, 'hold timeout should be 3')
185
+ end
186
+
187
+ def test_peer_gateway
188
+ vpc = Vpc.new(100)
189
+ default_val = vpc.default_peer_gateway
190
+ assert_equal(default_val, vpc.peer_gateway,
191
+ "peer_gateway should be #{default_val} by default")
192
+ vpc.peer_gateway = true
193
+ assert(vpc.peer_gateway, 'peer_gateway not getting set')
194
+ vpc.peer_gateway = false
195
+ refute(vpc.peer_gateway, 'peer_gateway not getting disabled')
196
+ end
197
+
198
+ def test_peer_switch
199
+ vpc = Vpc.new(100)
200
+ default_val = vpc.default_peer_switch
201
+ assert_equal(default_val, vpc.peer_switch,
202
+ "peer_switch should be #{default_val} by default")
203
+ vpc.peer_switch = true
204
+ assert(vpc.peer_switch, 'peer_switch not getting set')
205
+ vpc.peer_switch = false
206
+ refute(vpc.peer_switch, 'peer_switch not getting disabled')
207
+ end
208
+
209
+ def test_arp_synchronize
210
+ vpc = Vpc.new(100)
211
+ default_val = vpc.default_arp_synchronize
212
+ assert_equal(default_val, vpc.arp_synchronize,
213
+ "arp_synchronize should be #{default_val} by default")
214
+ vpc.arp_synchronize = true
215
+ assert(vpc.arp_synchronize, 'arp_synchronize not getting set')
216
+ vpc.arp_synchronize = false
217
+ refute(vpc.arp_synchronize, 'arp_synchronize not getting disabled')
218
+ end
219
+
220
+ def test_nd_synchronize
221
+ vpc = Vpc.new(100)
222
+ default_val = vpc.default_nd_synchronize
223
+ assert_equal(default_val, vpc.nd_synchronize,
224
+ "nd_synchronize should be #{default_val} by default")
225
+ vpc.nd_synchronize = true
226
+ assert(vpc.nd_synchronize, 'nd_synchronize not getting set')
227
+ vpc.nd_synchronize = false
228
+ refute(vpc.nd_synchronize, 'nd_synchronize not getting disabled')
229
+ end
230
+
231
+ def test_peer_gateway_exclude_bridge_domain
232
+ vpc = Vpc.new(100)
233
+ if validate_property_excluded?('vpc', 'peer_gateway_exclude_bridge_domain')
234
+ assert_raises(Cisco::UnsupportedError) do
235
+ vpc.peer_gateway_exclude_bridge_domain = '10'
236
+ end
237
+ return
238
+ end
239
+
240
+ default_val = vpc.default_peer_gateway_exclude_bridge_domain
241
+ assert_equal(default_val, vpc.peer_gateway_exclude_bridge_domain,
242
+ "peer_gateway exclude BD should be #{default_val} default")
243
+ vpc.peer_gateway_exclude_bridge_domain = '10-20,400'
244
+ assert_equal('10-20,400', vpc.peer_gateway_exclude_bridge_domain,
245
+ 'peer_gateway exclude list not getting set')
246
+ end
247
+
248
+ def test_peer_gateway_exclude_vlan
249
+ vpc = Vpc.new(100)
250
+ if validate_property_excluded?('vpc', 'peer_gateway_exclude_vlan')
251
+ assert_raises(Cisco::UnsupportedError) do
252
+ vpc.peer_gateway_exclude_vlan = '10'
253
+ end
254
+ return
255
+ end
256
+
257
+ default_val = vpc.default_peer_gateway_exclude_vlan
258
+ assert_equal(default_val, vpc.peer_gateway_exclude_vlan,
259
+ "peer_gateway exclude vlan should be #{default_val} default")
260
+ vpc.peer_gateway_exclude_vlan = '10-20,400'
261
+ assert_equal('10-20,400', vpc.peer_gateway_exclude_vlan,
262
+ 'peer_gateway exclude list not getting set')
263
+ end
264
+
265
+ def test_role_priority
266
+ vpc = Vpc.new(100)
267
+ default_value = vpc.default_role_priority
268
+ assert_equal(default_value, vpc.role_priority,
269
+ "Role priority should be #{default_value}")
270
+ vpc.role_priority = 200
271
+ assert_equal(200, vpc.role_priority,
272
+ 'Role priority should be 200')
273
+ end
274
+
275
+ def test_self_isolation
276
+ vpc = Vpc.new(100)
277
+ if validate_property_excluded?('vpc', 'self_isolation')
278
+ assert_raises(Cisco::UnsupportedError) { vpc.self_isolation = true }
279
+ return
280
+ end
281
+
282
+ vpc.self_isolation = true
283
+ assert_equal(true, vpc.self_isolation,
284
+ 'Self isolation should have been configured')
285
+ end
286
+
287
+ def test_shutdown
288
+ vpc = Vpc.new(100)
289
+ skip_incompat_version?('vpc', 'shutdown')
290
+ vpc.shutdown = vpc.default_shutdown
291
+ refute(vpc.shutdown, 'Vpc domain should not be shutdown')
292
+
293
+ vpc.shutdown = true
294
+ assert(vpc.shutdown, 'Vpc domain should be shutdown')
295
+
296
+ vpc.shutdown = false
297
+ refute(vpc.shutdown, 'Vpc domain should not be shutdown')
298
+ end
299
+
300
+ def test_system_mac
301
+ vpc = Vpc.new(100)
302
+ default_value = vpc.default_system_mac
303
+ assert_equal(default_value, vpc.system_mac,
304
+ "Default system_mac should be #{default_value}")
305
+
306
+ vpc.system_mac = '1.1.1'
307
+ assert_equal('00:01:00:01:00:01', vpc.system_mac,
308
+ 'Error: system_mac mismatch')
309
+ end
310
+
311
+ def test_system_priority
312
+ vpc = Vpc.new(100)
313
+ default_value = vpc.default_system_priority
314
+ assert_equal(default_value, vpc.system_priority,
315
+ "System priority should be #{default_value}")
316
+ vpc.system_priority = 200
317
+ assert_equal(200, vpc.system_priority,
318
+ 'System priority should be 200')
319
+ end
320
+
321
+ def test_track
322
+ vpc = Vpc.new(100)
323
+ if validate_property_excluded?('vpc', 'track')
324
+ assert_raises(Cisco::UnsupportedError) { vpc.track = 44 }
325
+ return
326
+ end
327
+
328
+ default_value = vpc.default_track
329
+ assert_equal(default_value, vpc.track,
330
+ 'default track should be 0')
331
+
332
+ vpc.track = 44
333
+ assert_equal(44, vpc.track, 'track should be 44')
334
+ end
335
+
336
+ ##############################################################################
337
+ # Test interface properties for vPC
338
+ #
339
+ def test_interface_vpc_id
340
+ vpc = Vpc.new(100)
341
+ # Make sure PKA is set
342
+ vpc.peer_keepalive_set('1.1.1.2', '1.1.1.1', 3800, 'management', 400, 3,
343
+ 6, 3)
344
+ # init channel group as none first, to test phy-port vPC link
345
+ interface = InterfaceChannelGroup.new(interfaces[0])
346
+ interface.channel_group_mode_set(false) if interface.channel_group
347
+ # Phy port vPC is supported only on N7K
348
+ if /N7/ =~ node.product_id
349
+ phy_port_iflist =
350
+ Feature.compatible_interfaces('vpc', 'phy_port_vpc_module_pids')
351
+ unless phy_port_iflist.empty?
352
+ phy_interface = Interface.new(phy_port_iflist[0])
353
+ assert_equal(phy_interface.vpc_id, phy_interface.default_vpc_id,
354
+ 'default vpc_id should be null')
355
+ phy_interface.switchport_mode = :trunk
356
+ phy_interface.vpc_id = 10
357
+ assert_equal(10, phy_interface.vpc_id, 'vpc_id should be 10')
358
+
359
+ # negative - cannot config peer link on this
360
+ e = assert_raises(CliError) do
361
+ phy_interface.vpc_peer_link = true
362
+ end
363
+ assert_match(/Invalid number/i, e.message)
364
+
365
+ # turn off vpc id
366
+ phy_interface.vpc_id = false
367
+ refute(phy_interface.vpc_id, 'vpc_id should be unset')
368
+ end
369
+ end
370
+ # test port-channel vpc
371
+ interface.channel_group_mode_set(10)
372
+ interface_pc = Interface.new('port-channel10')
373
+ interface_pc.switchport_mode = :trunk
374
+ interface_pc.vpc_id = 20
375
+ assert_equal(20, interface_pc.vpc_id, 'vpc_id should be 20')
376
+ # test limits
377
+ interface_pc.vpc_id = false
378
+ refute(interface_pc.vpc_id, 'vpc_id should be empty')
379
+ interface_pc.vpc_id = 4095
380
+ assert_equal(4095, interface_pc.vpc_id, 'vpc_id should be empty')
381
+ # clean-up
382
+ interface_pc.vpc_id = false
383
+ # remove PC
384
+ interface.channel_group_mode_set(false)
385
+ refute(interface.channel_group, 'Port channel not cleaned up')
386
+ end
387
+
388
+ def test_interface_vpc_peer_link
389
+ vpc = Vpc.new(100)
390
+ # Make sure PKA is set
391
+ vpc.peer_keepalive_set('1.1.1.2', '1.1.1.1', 3800, 'management', 400, 3,
392
+ 6, 3)
393
+ interface = InterfaceChannelGroup.new(interfaces[1])
394
+ interface.channel_group_mode_set(100)
395
+ interface_pc = Interface.new('port-channel100')
396
+ interface_pc.switchport_mode = :trunk
397
+ refute(interface_pc.vpc_peer_link,
398
+ 'vpc_peer_link should not be set by default')
399
+ begin
400
+ # vpc peer-link has linecard limitations
401
+ interface_pc.vpc_peer_link = true
402
+ assert(interface_pc.vpc_peer_link, 'vpc_peer_link should be set')
403
+ interface_pc.vpc_peer_link = false
404
+ refute(interface_pc.vpc_peer_link, 'vpc_peer_link should not be set')
405
+ rescue RuntimeError => e
406
+ raise unless e.message[/Interface needs to be 10G to act as a peer-link/]
407
+ end
408
+
409
+ # clean up
410
+ interface.channel_group_mode_set(false)
411
+ refute(interface.channel_group, 'channel group should be unset')
412
+ # try with a phy port
413
+ interface = Interface.new(interfaces[1])
414
+ # negative - cannot config peer link on this
415
+ e = assert_raises(CliError) do
416
+ interface.vpc_peer_link = true
417
+ end
418
+ assert_match(/Invalid/i, e.message)
419
+ end
420
+
421
+ ##############################################################################
422
+ # Test vPC+ properties
423
+ #
424
+
425
+ # Some properties require 'feature-set fabricpath', which will process before
426
+ # the property itself; therefore check for unsupported against the feature
427
+ # before attempting the property itself. Returns true if excluded.
428
+ def feature_set_fabricpath_excluded?
429
+ if validate_property_excluded?('fabricpath', 'feature_install')
430
+ assert_raises(Cisco::UnsupportedError) do
431
+ FabricpathGlobal.fabricpath_feature_set(:enabled)
432
+ end
433
+ return true
434
+ end
435
+ false
436
+ end
437
+
438
+ def test_fabricpath_emulated_switch_id
439
+ return if feature_set_fabricpath_excluded?
440
+ vpc = Vpc.new(100)
441
+ if validate_property_excluded?('vpc', 'fabricpath_emulated_switch_id')
442
+ assert_raises(Cisco::UnsupportedError) do
443
+ vpc.fabricpath_emulated_switch_id = false
444
+ end
445
+ return
446
+ end
447
+
448
+ refute(vpc.fabricpath_emulated_switch_id,
449
+ 'vPC+ (fabricpath switch-id) should not be enabled by default')
450
+ vpc.fabricpath_emulated_switch_id = 1000
451
+ assert_equal(1000, vpc.fabricpath_emulated_switch_id,
452
+ 'fabricpath emulated switch-id/ESWID should be 1000')
453
+ vpc.fabricpath_emulated_switch_id = false
454
+ refute(vpc.fabricpath_emulated_switch_id,
455
+ 'vPC+ (fabricpath switch-id) not getting disabled')
456
+ end
457
+
458
+ def test_fabricpath_multicast_load_balance
459
+ vpc = Vpc.new(100)
460
+ return if feature_set_fabricpath_excluded?
461
+ if validate_property_excluded?('vpc', 'fabricpath_multicast_load_balance')
462
+ assert_raises(Cisco::UnsupportedError) do
463
+ vpc.fabricpath_multicast_load_balance = false
464
+ end
465
+ return
466
+ end
467
+
468
+ refute(vpc.fabricpath_multicast_load_balance,
469
+ 'fabricpath multicast loadbalance should not be enabled by default')
470
+
471
+ vpc.fabricpath_multicast_load_balance = true
472
+ assert(vpc.fabricpath_multicast_load_balance,
473
+ 'fabricpath multicast load-balance is not enabled')
474
+
475
+ vpc.fabricpath_multicast_load_balance = false
476
+ refute(vpc.fabricpath_multicast_load_balance,
477
+ 'fabricpath multicast load-balance is not disabled')
478
+
479
+ default = vpc.default_fabricpath_multicast_load_balance
480
+ vpc.fabricpath_multicast_load_balance = default
481
+ assert_equal(default, vpc.fabricpath_multicast_load_balance,
482
+ 'fabricpath multicast load-balance is not default')
483
+ end
484
+
485
+ def test_port_channel_limit
486
+ vpc = Vpc.new(100)
487
+ if validate_property_excluded?('vpc', 'port_channel_limit')
488
+ assert_raises(Cisco::UnsupportedError) { vpc.port_channel_limit = true }
489
+ return
490
+ end
491
+
492
+ assert(vpc.port_channel_limit,
493
+ 'port_channel_limit should be enabled by default')
494
+ e = assert_raises(RuntimeError) do
495
+ vpc.port_channel_limit = false
496
+ end
497
+ assert_match(/fabricpath_switch_id configuration is required/, e.message)
498
+ vpc.fabricpath_emulated_switch_id = 1000
499
+ vpc.fabricpath_multicast_load_balance = true
500
+ vpc.port_channel_limit = false
501
+ refute(vpc.port_channel_limit,
502
+ 'port_channel_limit not getting disabled')
503
+ e = assert_raises(CliError) do
504
+ vpc.fabricpath_multicast_load_balance = false
505
+ end
506
+ assert_match(/ERROR: Configure port-channel limit first/, e.message)
507
+ vpc.port_channel_limit = true
508
+ assert(vpc.port_channel_limit,
509
+ 'port_channel_limit not getting re-enabled')
510
+ end
511
+
512
+ def test_interface_vpc_plus_peer_link
513
+ vpc = Vpc.new(100)
514
+ fabricpath_testenv_setup
515
+ if validate_property_excluded?('vpc', 'fabricpath_emulated_switch_id')
516
+ assert_raises(Cisco::UnsupportedError) do
517
+ vpc.fabricpath_emulated_switch_id = true
518
+ end
519
+ return
520
+ end
521
+
522
+ # make it vpc plus by setting a fabricpath switch-id
523
+ vpc.fabricpath_emulated_switch_id = 1000
524
+ # Make sure PKA is set
525
+ vpc.peer_keepalive_set('1.1.1.2', '1.1.1.1', 3800, 'management', 400, 3,
526
+ 6, 3)
527
+ interface = InterfaceChannelGroup.new(interfaces[1])
528
+ interface.channel_group_mode_set(100)
529
+ interface_pc = Interface.new('port-channel100')
530
+ interface_pc.switchport_mode = :fabricpath
531
+ refute(interface_pc.vpc_peer_link,
532
+ 'vpc_peer_link should not be set by default')
533
+ interface_pc.vpc_peer_link = true
534
+ assert(interface_pc.vpc_peer_link, 'vpc_peer_link should be set')
535
+ interface_pc.vpc_peer_link = false
536
+ refute(interface_pc.vpc_peer_link, 'vpc_peer_link should not be set')
537
+ # clean up
538
+ interface.channel_group_mode_set(false)
539
+ refute(interface.channel_group, 'channel group should be unset')
540
+ # try with a phy port
541
+ interface = Interface.new(interfaces[1])
542
+ # negative - cannot config peer link on this
543
+ e = assert_raises(CliError) do
544
+ interface.vpc_peer_link = true
545
+ end
546
+ assert_match(/Invalid/i, e.message)
547
+ end
548
+ end