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,103 @@
1
+ # NXAPI implementation of the PimRpAddress class
2
+ #
3
+ # Smitha Gopalan, November 2015
4
+ #
5
+ # Copyright (c) 2015-2016 Cisco and/or its affiliates.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require_relative 'node_util'
20
+ require_relative 'pim'
21
+
22
+ module Cisco
23
+ # node_utils class for pim_rp_address
24
+ class PimRpAddress < NodeUtil
25
+ attr_reader :afi, :rp_addr, :vrf
26
+
27
+ # Constructor with afi, rp_address and vrf
28
+ # -----------------------------------------
29
+ def initialize(afi, vrf, rp_addr, instantiate=true)
30
+ fail ArgumentError unless vrf.is_a?(String) || vrf.length > 0
31
+ @afi = Pim.afi_cli(afi)
32
+ @rp_addr = rp_addr
33
+ @vrf = vrf
34
+ create if instantiate
35
+ end
36
+
37
+ # Create a hash of [afi][vrf][rp_address]
38
+ # ------------------------------------------------
39
+ def self.rp_addresses
40
+ afis = %w(ipv4) # TBD ipv6
41
+ hash = {}
42
+ return hash unless Feature.pim_enabled?
43
+ afis.each do |afi|
44
+ hash[afi] = {}
45
+ default_vrf = 'default'
46
+ get_args = { afi: Pim.afi_cli(afi) }
47
+ rp_addrs = config_get('pim', 'all_rp_addresses', get_args)
48
+ unless rp_addrs.nil?
49
+ rp_addrs.each do |addr|
50
+ hash[afi][default_vrf] ||= {}
51
+ hash[afi][default_vrf][addr] =
52
+ PimRpAddress.new(afi, default_vrf, addr, false)
53
+ end
54
+ end
55
+ vrf_ids = config_get('vrf', 'all_vrfs')
56
+ vrf_ids.each do |vrf|
57
+ get_args = { afi: Pim.afi_cli(afi), vrf: vrf }
58
+ rp_addrs = config_get('pim', 'all_rp_addresses', get_args)
59
+ next if rp_addrs.nil?
60
+ rp_addrs.each do |addr|
61
+ hash[afi][vrf] ||= {}
62
+ hash[afi][vrf][addr] = PimRpAddress.new(afi, vrf, addr, false)
63
+ end
64
+ end
65
+ end
66
+ hash
67
+ rescue Cisco::CliError => e
68
+ # cmd will syntax reject when feature is not enabled
69
+ raise unless e.clierror =~ /Syntax error/
70
+ return {}
71
+ end
72
+
73
+ # set_args_keys_default
74
+ # ----------------------
75
+ def set_args_keys_default
76
+ keys = { afi: @afi, addr: @rp_addr }
77
+ keys[:vrf] = @vrf unless @vrf == 'default'
78
+ @get_args = @set_args = keys
79
+ end
80
+
81
+ # set_args_key
82
+ # -------------
83
+ def set_args_keys(hash={}) # rubocop:disable Style/AccessorMethodName
84
+ set_args_keys_default
85
+ @set_args = @get_args.merge!(hash) unless hash.empty?
86
+ end
87
+
88
+ # Create pim rp_addr instance
89
+ # ------------------------------
90
+ def create
91
+ Feature.pim_enable
92
+ set_args_keys(state: '')
93
+ config_set('pim', 'rp_address', @set_args)
94
+ end
95
+
96
+ # Destroy pim rp_addr instance
97
+ # ------------------------------
98
+ def destroy
99
+ set_args_keys(state: 'no')
100
+ config_set('pim', 'rp_address', @set_args)
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,217 @@
1
+ # Alex Hunsberger, Mar 2015
2
+ #
3
+ # Copyright (c) 2015-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 'node_util'
18
+
19
+ module Cisco
20
+ # Platform - class for gathering platform hardware and software information
21
+ class Platform < NodeUtil
22
+ #
23
+ # NX: 7.0(3)I2(3) [build 7.0(3)I2(2.118)]
24
+ # XR: 6.1.1.04I
25
+ def self.image_version
26
+ config_get('show_version', 'version')
27
+ end
28
+
29
+ # ex: 'n3500-uk9.6.0.2.A3.0.40.bin'
30
+ def self.system_image
31
+ config_get('show_version', 'system_image')
32
+ end
33
+
34
+ # Returns package hash with state values
35
+ # Ex: { 'n3000-uk9.6.0.2.U1.1.CSCaa12345.bin' => 'inactive committed',
36
+ # 'n3000-uk9.6.0.2.U1.1.CSCaa12346.bin' => 'active', }
37
+ def self.packages
38
+ pkgs = []
39
+ pkg_hsh = {}
40
+ begin
41
+ pkgs = config_get('images', 'packages')
42
+ rescue RuntimeError => e
43
+ raise unless e.message[/Invalid command/]
44
+ end
45
+ return {} if pkgs.nil?
46
+ pkgs.each { |p| pkg_hsh[p[0]] = p[1].downcase }
47
+ pkg_hsh
48
+ end
49
+
50
+ # Ex: 'Cisco Nexus3064 Chassis ("48x10GE + 16x10G/4x40G Supervisor")'
51
+ def self.hardware_type
52
+ config_get('show_version', 'description')
53
+ end
54
+
55
+ # Ex: 'Intel(R) Celeron(R) CPU P450'
56
+ def self.cpu
57
+ config_get('show_version', 'cpu')
58
+ end
59
+
60
+ # Return hash with keys "total", "used", "free"
61
+ # Ex: { 'total' => '16402252K',
62
+ # 'used' => '5909004K',
63
+ # 'free' => '10493248K' }
64
+ def self.memory
65
+ {
66
+ 'total' => config_get('memory', 'total'),
67
+ 'used' => config_get('memory', 'used'),
68
+ 'free' => config_get('memory', 'free'),
69
+ }
70
+ end
71
+
72
+ # Ex: 'Processor Board ID FOC15430TEY'
73
+ def self.board
74
+ config_get('show_version', 'board')
75
+ rescue RuntimeError => e
76
+ # Some Nexus platforms may fail to report this value.
77
+ return nil if /No key/ =~ e.message
78
+ raise
79
+ end
80
+
81
+ # Ex: '1 day(s), 21 hour(s), 46 minute(s), 54 second(s)'
82
+ def self.uptime
83
+ u = config_get('show_version', 'uptime')
84
+ fail 'failed to retrieve platform uptime' if u.nil?
85
+ u
86
+ end
87
+
88
+ # Ex: '23113 usecs after Mon Jul 1 15:24:29 2013'
89
+ def self.last_reset
90
+ config_get('show_version', 'last_reset_time')
91
+ rescue RuntimeError => e
92
+ # Some Nexus platforms may fail to report this value.
93
+ return nil if /No key/ =~ e.message
94
+ raise
95
+ end
96
+
97
+ # Ex: 'Reset Requested by CLI command reload'
98
+ def self.reset_reason
99
+ config_get('show_version', 'last_reset_reason')
100
+ end
101
+
102
+ # Returns chassis hash with keys "descr", "pid", "vid", "sn"
103
+ # Ex: { 'descr' => 'Nexus9000 C9396PX Chassis',
104
+ # 'pid' => 'N9K-C9396PX',
105
+ # 'vid' => 'V02',
106
+ # 'sn' => 'SAL1812NTBP' }
107
+ def self.chassis
108
+ # node.cache_flush # TODO: investigate why this is needed
109
+ all = config_get('inventory', 'chassis')
110
+ return nil if all.nil?
111
+
112
+ # item['name'] value is "\"Chassis\"" on most platforms,
113
+ # but n5k/n6k use "Chassis" so make the quotes optional.
114
+ chas = all.find { |item| item['name'][/^"?Chassis"?$/] }
115
+ return nil if chas.nil?
116
+ {
117
+ 'descr' => chas['desc'].tr('"', ''),
118
+ 'pid' => chas['productid'],
119
+ 'vid' => chas['vendorid'],
120
+ 'sn' => chas['serialnum'],
121
+ }
122
+ end
123
+
124
+ # Returns hash of hashes with inner keys "name", "descr", "pid", "vid", "sn"
125
+ # Ex: { 'Slot 1' => { 'descr' => '1/10G SFP+ Ethernet Module',
126
+ # 'pid' => 'N9K-C9396PX',
127
+ # 'vid' => 'V02',
128
+ # 'sn' => 'SAL1812NTBP' },
129
+ # 'Slot 2' => { ... }}
130
+ def self.inventory_of(type)
131
+ inv = config_get('inventory', 'all')
132
+ inv_hsh = {}
133
+ return inv_hsh if inv.nil?
134
+ # Nexus gets structured output
135
+ inv_copy = inv.select { |x| x['name'].include? type }
136
+ return inv_hsh if inv_copy.empty?
137
+ # match desired output format
138
+ inv_copy.each do |s|
139
+ inv_hsh[s['name'].tr('"', '')] = { 'descr' => s['desc'].tr('"', ''),
140
+ 'pid' => s['productid'],
141
+ 'vid' => s['vendorid'],
142
+ 'sn' => s['serialnum'] }
143
+ end
144
+ inv_hsh
145
+ end
146
+
147
+ # Returns array of hashes with keys "name", "descr", "pid", "vid", "sn"
148
+ def self.slots
149
+ Platform.inventory_of('Slot')
150
+ end
151
+
152
+ # Returns array of hashes with keys "name", "descr", "pid", "vid", "sn"
153
+ def self.power_supplies
154
+ Platform.inventory_of('Power Supply')
155
+ end
156
+
157
+ # Returns array of hashes with keys "name", "descr", "pid", "vid", "sn"
158
+ def self.fans
159
+ Platform.inventory_of('Fan')
160
+ end
161
+
162
+ # Returns hash of hashes with inner keys "state", "application", ...
163
+ # Ex: { 'chef' => {
164
+ # 'package_info' => { 'name' => 'n3k_chef.ova',
165
+ # 'path' => 'bootflash:/n3k_chef.ova' },
166
+ # 'application' => { 'name' => 'ChefAgent',
167
+ # 'version' => '0.1',
168
+ # 'descr' => 'Cisco Chef Agent' },
169
+ # 'signing' => { 'key_type' => 'Cisco development key',
170
+ # 'method' => 'SHA-1' }
171
+ # 'licensing' => { 'name' => 'none',
172
+ # 'version' => 'none' }
173
+ # 'reservation' => { 'disk' => '111 MB',
174
+ # 'memory' => '0 MB',
175
+ # 'cpu' => '0% system CPU' }},
176
+ # { ... }}
177
+ def self.virtual_services
178
+ # If no virtual-services are installed, this will result
179
+ # in a RuntimeError. We need to rescue this specific case.
180
+ begin
181
+ virts = config_get('virtual_service', 'services')
182
+ rescue RuntimeError => e
183
+ return {} if e.message[/No key \"TABLE_detail\"/]
184
+ raise
185
+ end
186
+ return {} if virts.nil?
187
+ # NXAPI returns hash instead of array if there's only 1
188
+ virts = [virts] if virts.is_a? Hash
189
+ # convert to expected format
190
+ virts_hsh = {}
191
+ virts.each do |serv|
192
+ # rubocop:disable Style/AlignHash
193
+ virts_hsh[serv['name']] = {
194
+ 'package_info' => { 'name' => serv['package_name'],
195
+ 'path' => serv['ova_path'],
196
+ },
197
+ 'application' => { 'name' => serv['application_name'],
198
+ 'version' => serv['application_version'],
199
+ 'descr' => serv['application_description'],
200
+ },
201
+ 'signing' => { 'key_type' => serv['key_type'],
202
+ 'method' => serv['signing_method'],
203
+ },
204
+ 'licensing' => { 'name' => serv['licensing_name'],
205
+ 'version' => serv['licensing_version'],
206
+ },
207
+ 'reservation' => { 'disk' => serv['disk_reservation'],
208
+ 'memory' => serv['memory_reservation'],
209
+ 'cpu' => serv['cpu_reservation'],
210
+ },
211
+ }
212
+ # rubocop:enable Style/AlignHash
213
+ end
214
+ virts_hsh
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,347 @@
1
+ # December 2015, Sai Chintalapudi
2
+ #
3
+ # Copyright (c) 2015-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 'node_util'
18
+
19
+ module Cisco
20
+ # node_utils class for portchannel_global
21
+ class PortChannelGlobal < NodeUtil
22
+ attr_reader :name
23
+
24
+ def initialize(name)
25
+ fail TypeError unless name.is_a?(String)
26
+ fail ArgumentError unless name == 'default'
27
+ @name = name.downcase
28
+ end
29
+
30
+ def to_s
31
+ "portchannel_global #{name}"
32
+ end
33
+
34
+ def self.globals
35
+ { 'default' => PortChannelGlobal.new('default') }
36
+ end
37
+
38
+ ########################################################
39
+ # PROPERTIES #
40
+ ########################################################
41
+
42
+ def load_balance_type
43
+ config_get('portchannel_global', 'load_balance_type')
44
+ end
45
+
46
+ def hash_distribution
47
+ config_get('portchannel_global', 'hash_distribution')
48
+ end
49
+
50
+ def hash_distribution=(val)
51
+ config_set('portchannel_global',
52
+ 'hash_distribution', val)
53
+ end
54
+
55
+ def default_hash_distribution
56
+ config_get_default('portchannel_global', 'hash_distribution')
57
+ end
58
+
59
+ def load_defer
60
+ config_get('portchannel_global', 'load_defer')
61
+ end
62
+
63
+ def load_defer=(val)
64
+ config_set('portchannel_global', 'load_defer', val)
65
+ end
66
+
67
+ def default_load_defer
68
+ config_get_default('portchannel_global', 'load_defer')
69
+ end
70
+
71
+ def resilient
72
+ config_get('portchannel_global', 'resilient')
73
+ end
74
+
75
+ def resilient=(state)
76
+ fail TypeError unless state == true || state == false
77
+ no_cmd = (state ? '' : 'no')
78
+ config_set('portchannel_global', 'resilient', no_cmd)
79
+ end
80
+
81
+ def default_resilient
82
+ config_get_default('portchannel_global', 'resilient')
83
+ end
84
+
85
+ # port-channel load-balance is a complicated command
86
+ # and this has so many forms in the same device and in
87
+ # different devices.
88
+ # For ex:
89
+ # port-channel load-balance src-dst ip rotate 4 concatenation symmetric
90
+ # port-channel load-balance resilient
91
+ # port-channel load-balance ethernet destination-mac CRC10c
92
+ # port-channel load-balance ethernet source-ip
93
+ # port-channel load-balance dst ip-l4port rotate 4 asymmetric
94
+ # port-channel load-balance dst ip-l4port-vlan module 9
95
+ # port-channel load-balance hash-modulo
96
+ # we need to eliminate all the clutter and get the correct
97
+ # line of config first and after that get index of each property
98
+ # and get the property value because some properties may or
99
+ # may not be present always.
100
+ # This method returns a hash
101
+ def port_channel_load_balance
102
+ lb = config_get('portchannel_global',
103
+ 'port_channel_load_balance')
104
+ hash = {}
105
+ lb.each do |line|
106
+ next if line[/(internal|resilient|module|fex|hash)/]
107
+ params = line.split
108
+ lb_type = config_get('portchannel_global', 'load_balance_type')
109
+ case lb_type.to_sym
110
+ when :no_rotate # n3k
111
+ _parse_no_rotate_params(hash, params, line)
112
+ when :ethernet # n6k
113
+ _parse_ethernet_params(hash, params)
114
+ when :asymmetric # n7k
115
+ _parse_asymmetric_params(hash, params, line)
116
+ when :no_hash # n9k-f or n3k-f
117
+ _parse_no_hash_params(hash, params)
118
+ when :symmetry # n9k
119
+ _parse_symmetry_params(hash, params, line)
120
+ end
121
+ end
122
+ hash
123
+ end
124
+
125
+ def asymmetric
126
+ port_channel_load_balance[:asymmetric]
127
+ end
128
+
129
+ def default_asymmetric
130
+ config_get_default('portchannel_global',
131
+ 'asymmetric')
132
+ end
133
+
134
+ def bundle_hash
135
+ port_channel_load_balance[:bundle_hash]
136
+ end
137
+
138
+ def default_bundle_hash
139
+ config_get_default('portchannel_global',
140
+ 'bundle_hash')
141
+ end
142
+
143
+ def bundle_select
144
+ port_channel_load_balance[:bundle_select]
145
+ end
146
+
147
+ def default_bundle_select
148
+ config_get_default('portchannel_global',
149
+ 'bundle_select')
150
+ end
151
+
152
+ def concatenation
153
+ port_channel_load_balance[:concatenation]
154
+ end
155
+
156
+ def default_concatenation
157
+ config_get_default('portchannel_global',
158
+ 'concatenation')
159
+ end
160
+
161
+ def hash_poly
162
+ port_channel_load_balance[:hash_poly]
163
+ end
164
+
165
+ def rotate
166
+ port_channel_load_balance[:rotate]
167
+ end
168
+
169
+ def default_rotate
170
+ config_get_default('portchannel_global',
171
+ 'rotate')
172
+ end
173
+
174
+ def symmetry
175
+ port_channel_load_balance[:symmetry]
176
+ end
177
+
178
+ def default_symmetry
179
+ config_get_default('portchannel_global',
180
+ 'symmetry')
181
+ end
182
+
183
+ def port_channel_load_balance=(bselect, bhash, hpoly, asy, sy, conc, rot)
184
+ lb_type = config_get('portchannel_global', 'load_balance_type')
185
+ case lb_type.to_sym
186
+ when :no_rotate # n3k
187
+ sym = sy ? 'symmetric' : ''
188
+ if bselect == 'src'
189
+ sel = 'source'
190
+ elsif bselect == 'dst'
191
+ sel = 'destination'
192
+ else
193
+ sel = 'source-dest'
194
+ end
195
+ sel_hash = sel + '-' + bhash
196
+ # port-channel load-balance ethernet source-dest-ip symmetric
197
+ config_set('portchannel_global', 'port_channel_load_balance',
198
+ 'ethernet', sel_hash, sym, '', '', '')
199
+ when :ethernet # n6k
200
+ if bselect == 'src'
201
+ sel = 'source'
202
+ elsif bselect == 'dst'
203
+ sel = 'destination'
204
+ else
205
+ sel = 'source-dest'
206
+ end
207
+ sel_hash = sel + '-' + bhash
208
+ # port-channel load-balance ethernet destination-mac CRC10c
209
+ config_set('portchannel_global', 'port_channel_load_balance',
210
+ 'ethernet', sel_hash, hpoly, '', '', '')
211
+ when :asymmetric # n7k
212
+ asym = (asy == true) ? 'asymmetric' : ''
213
+ # port-channel load-balance dst ip-l4port rotate 4 asymmetric
214
+ config_set('portchannel_global', 'port_channel_load_balance',
215
+ bselect, bhash, 'rotate', rot.to_s, asym, '')
216
+ when :no_hash # n9k-f or n3k-f
217
+ # port-channel load-balance dst ip-l4port rotate 4
218
+ rot_str = rot.zero? ? '' : 'rotate'
219
+ rot_val = rot.zero? ? '' : rot.to_s
220
+ config_set('portchannel_global', 'port_channel_load_balance',
221
+ bselect, bhash, rot_str, rot_val, '', '')
222
+ when :symmetry # n9k
223
+ sym = sy ? 'symmetric' : ''
224
+ concat = conc ? 'concatenation' : ''
225
+ rot_str = rot.zero? ? '' : 'rotate'
226
+ rot_val = rot.zero? ? '' : rot.to_s
227
+ # port-channel load-balance src-dst ip rotate 4 concatenation symmetric
228
+ config_set('portchannel_global', 'port_channel_load_balance',
229
+ bselect, bhash, rot_str, rot_val, concat, sym)
230
+ end
231
+ end
232
+
233
+ # N3k: The bundle hash and bundle select are merged into one output;
234
+ # also note that the field names are source & destination instead of
235
+ # src & dst as in other devices.
236
+ def _parse_no_rotate_params(hash, params, line)
237
+ sym = (line.include? 'symmetric') ? true : false
238
+
239
+ select_hash = params[1]
240
+ lparams = select_hash.split('-')
241
+ if lparams[0].downcase == 'destination'
242
+ bselect = 'dst'
243
+ bhash = lparams[1]
244
+ # there are bundles hashes like ip-gre which
245
+ # need extra processing
246
+ bhash += '-gre' if select_hash.include? 'gre'
247
+ else
248
+ if select_hash.include? '-dest-'
249
+ bselect = 'src-dst'
250
+ bhash = lparams[2]
251
+ bhash += '-gre' if select_hash.include? 'gre'
252
+ # there are bundles hashes like ip-only and
253
+ # port-only specific to src-dst
254
+ bhash += '-only' if select_hash.include? 'only'
255
+ else
256
+ bselect = 'src'
257
+ bhash = lparams[1]
258
+ # there are bundles hashes like ip-gre which
259
+ # need extra processing
260
+ bhash += '-gre' if select_hash.include? 'gre'
261
+ end
262
+ end
263
+ hash[:bundle_select] = bselect
264
+ hash[:bundle_hash] = bhash
265
+ hash[:symmetry] = sym
266
+ hash
267
+ end
268
+
269
+ # N5k/N6k: The bundle hash and bundle select are merged into one output;
270
+ # also note that the field names are source & destination instead of
271
+ # src & dst as in other devices.
272
+ def _parse_ethernet_params(hash, params)
273
+ hash_poly = params[2]
274
+
275
+ # Depending on the chipset, hash_poly may have have a different
276
+ # default value within the same platform family (this is done to
277
+ # avoid polarization) but there is currently no command available
278
+ # to dynamically determine the default state. As a result the
279
+ # getter simply hard-codes a default value which means it may
280
+ # encounter occasional idempotence issues.
281
+ hash_poly = hash_poly.nil? ? 'CRC10b' : hash_poly
282
+
283
+ select_hash = params[1]
284
+ lparams = select_hash.split('-')
285
+ if lparams[0].downcase == 'destination'
286
+ bselect = 'dst'
287
+ bhash = lparams[1]
288
+ else
289
+ if select_hash.include? '-dest-'
290
+ bselect = 'src-dst'
291
+ bhash = lparams[2]
292
+ # there are bundles hashes like ip-only and
293
+ # port-only specific to src-dst
294
+ bhash += '-only' if select_hash.include? 'only'
295
+ else
296
+ bselect = 'src'
297
+ bhash = lparams[1]
298
+ end
299
+ end
300
+ hash[:bundle_select] = bselect
301
+ hash[:bundle_hash] = bhash
302
+ hash[:hash_poly] = hash_poly
303
+ hash
304
+ end
305
+
306
+ def _parse_asymmetric_params(hash, params, line)
307
+ bselect = params[0]
308
+ bhash = params[1]
309
+ # asymmetric keyword does not show up if it is false
310
+ asym = (line.include? 'asymmetric') ? true : false
311
+ ri = params.index('rotate')
312
+ rotate = params[ri + 1].to_i
313
+ hash[:bundle_select] = bselect
314
+ hash[:bundle_hash] = bhash
315
+ hash[:asymmetric] = asym
316
+ hash[:rotate] = rotate
317
+ hash
318
+ end
319
+
320
+ def _parse_no_hash_params(hash, params)
321
+ bselect = params[0]
322
+ bhash = params[1]
323
+ ri = params.index('rotate')
324
+ rotate = params[ri + 1].to_i
325
+ hash[:bundle_select] = bselect
326
+ hash[:bundle_hash] = bhash
327
+ hash[:rotate] = rotate
328
+ hash
329
+ end
330
+
331
+ def _parse_symmetry_params(hash, params, line)
332
+ bselect = params[0]
333
+ bhash = params[1]
334
+ ri = params.index('rotate')
335
+ rotate = params[ri + 1].to_i
336
+ # concatenation and symmetry keywords do not show up if false
337
+ concat = (line.include? 'concatenation') ? true : false
338
+ sym = (line.include? 'symmetric') ? true : false
339
+ hash[:bundle_select] = bselect
340
+ hash[:bundle_hash] = bhash
341
+ hash[:symmetry] = sym
342
+ hash[:rotate] = rotate
343
+ hash[:concatenation] = concat
344
+ hash
345
+ end
346
+ end # class
347
+ end # module