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,590 @@
1
+ # Command Reference YAML
2
+
3
+ The [YAML](http://yaml.org) files in this directory are used with the
4
+ `Cisco::CommandReference` module as a way to abstract away differences
5
+ between client APIs as well as differences between platforms sharing
6
+ the same client API.
7
+
8
+ This document describes the structure and semantics of these files.
9
+
10
+ * [Introduction](#introduction)
11
+ * [Basic attribute definition](#basic-attribute-definition)
12
+ * [Wildcard substitution](#wildcard-substitution)
13
+ * [Printf-style wildcards](#printf-style-wildcards)
14
+ * [Key-value wildcards](#key-value-wildcards)
15
+ * [Optional tokens in key-value lists](#optional-tokens-in-key-value-lists)
16
+ * [Advanced attribute definition](#advanced-attribute-definition)
17
+ * [`_template`](#_template)
18
+ * [Data format variants](#data-format-variants)
19
+ * [Platform variants](#platform-variants)
20
+ * [Product variants](#product-variants)
21
+ * [`_exclude`](#_exclude)
22
+ * [YAML anchors and aliases](#YAML-anchors-and-aliases)
23
+ * [Combinations of these](#combinations-of-these)
24
+ * [Attribute properties](#attribute-properties)
25
+ * [`get_data_format`](#get_data_format)
26
+ * [`get_command`](#get_command)
27
+ * [`get_context`](#get_context)
28
+ * [`get_value`](#get_value)
29
+ * [`set_context`](#set_context)
30
+ * [`set_value`](#set_value)
31
+ * [`default_value`](#default_value)
32
+ * [`default_only`](#default_only)
33
+ * [`kind`](#kind)
34
+ * [`multiple`](#multiple)
35
+ * [`auto_default`](#auto_default)
36
+ * [Style Guide](#style-guide)
37
+
38
+ ## Introduction
39
+
40
+ Each file describes a single 'feature' (a closely related set of
41
+ configurable attributes). The YAML within the file defines the set of
42
+ 'attributes' belonging to this feature. When a `CommandReference` object
43
+ is instantiated, the user can look up any given attribute using the
44
+ `lookup('feature_name', 'attribute_name')` API. Usually, instead of calling
45
+ this API directly, node utility classes will call the various `Node` APIs,
46
+ for example:
47
+
48
+ ```ruby
49
+ config_set('feature_name', 'attribute_name', *args)
50
+ value = config_get('feature_name', 'attribute_name')
51
+ default = config_get_default('feature_name', 'attribute_name')
52
+ ```
53
+
54
+ ## Basic attribute definition
55
+
56
+ The simplest definition of an attribute directly sets one or more properties
57
+ of this attribute. These properties' values can generally be set to any
58
+ basic Ruby type such as string, boolean, integer, array, or regexp.
59
+ An example:
60
+
61
+ ```yaml
62
+ # vtp.yaml
63
+ domain:
64
+ get_command: "show vtp status"
65
+ get_value: "domain_name"
66
+ set_value: "vtp domain <domain>"
67
+
68
+ filename:
69
+ get_command: "show running vtp"
70
+ get_value: '/vtp file (\S+)/'
71
+ set_value: "<state> vtp file <filename>"
72
+ default_value: ""
73
+ ```
74
+
75
+ In the above example, two attributes are defined: ('vtp', 'domain') and ('vtp',
76
+ 'filename').
77
+
78
+ Note that all attribute properties are optional and may be omitted if not
79
+ needed. In the above, example 'domain' does not have a value defined for
80
+ `default_value` but 'filename' does have a default.
81
+
82
+ ### Wildcard substitution
83
+
84
+ The `(get|set)_(context|value|command)` properties all support two forms of wildcarding - printf-style and key-value. Each has advantages and disadvantages but key-value is generally preferred for a number of reasons as seen below:
85
+
86
+ <table>
87
+ <tr><th></th><th>Advantages</th><th>Disadvantages</th></tr>
88
+ <tr>
89
+ <th>Printf-style</th>
90
+ <td><ul><li>Quick to implement, concise</li></ul></td>
91
+ <td><ul><li>Can't handle differences in wildcard order between nodes</li>
92
+ <li>Can't handle differences in wildcard count between nodes</li>
93
+ <li>Can't support optional tokens (e.g., VRF context)</li>
94
+ <li>Less readable in Ruby code (not obvious which parameters mean what)</li>
95
+ </ul></td>
96
+ </tr><tr>
97
+ <th>Key-Value</th>
98
+ <td><ul><li>Can handle differences in wildcard order/count between nodes</li>
99
+ <li>Can handle differences in which wildcards are used on various nodes</li>
100
+ <li>Can flag tokens as optional (see below)</li>
101
+ <li>More readable Ruby code due to parameter labels</li>
102
+ </ul></td>
103
+ <td><ul><li>Slightly more complex to implement than printf-style</li>
104
+ <li>Slightly more verbose YAML and Ruby code</li>
105
+ </ul></td>
106
+ </tr></table>
107
+
108
+ #### Printf-style wildcards
109
+
110
+ ```yaml
111
+ # tacacs_server_host.yaml
112
+ encryption:
113
+ set_value: '%s tacacs-server host %s key %s %s'
114
+ ```
115
+
116
+ This permits parameter values to be passed as a simple sequence to generate the resulting string or regexp:
117
+
118
+ ```ruby
119
+ irb(main):009:0> ref = cr.lookup('tacacs_server_host', 'encryption')
120
+ irb(main):010:0> ref.config_set('no', 'myhost', 'md5', 'mypassword')
121
+ => ["no tacacs-server host myhost key md5 mypassword"]
122
+ ```
123
+
124
+ Printf-style wildcards are quick to implement and concise, but less flexible - in particular they cannot handle a case where different platforms (or different
125
+ client APIs!) take parameters in a different order - and less readable in
126
+ the Ruby code.
127
+
128
+ #### Key-value wildcards
129
+
130
+ ```yaml
131
+ # ospf.yaml
132
+ auto_cost:
133
+ set_context: 'router ospf <name>'
134
+ set_value: 'auto-cost reference-bandwidth <cost> <type>'
135
+ ```
136
+
137
+ This requires parameter values to be passed as a hash:
138
+
139
+ ```ruby
140
+ irb(main):015:0> ref = cr.lookup('ospf', 'auto_cost')
141
+ irb(main):016:0> ref.config_set(name: 'red', cost: '40', type: 'Gbps')
142
+ => ["router ospf red", "auto-cost reference-bandwidth 40 Gbps"]
143
+ ```
144
+
145
+ Key-value wildcards are moderately more complex to implement than Printf-style wildcards but they are more readable in the Ruby code and are flexible enough to handle significant platform differences in CLI. Key-value wildcards are therefore the recommended approach for new development.
146
+
147
+ ##### Optional tokens in key-value lists
148
+
149
+ When defining `(get|set)_context` entries with key-value wildcards, it is possible to mark some or all of the tokens in the context as optional by prepending `(?)` to them. A common example of this is to support properties that can be defined either globally or under a VRF routing context:
150
+
151
+ ```yaml
152
+ # bgp.yaml
153
+ confederation_peers:
154
+ ios_xr:
155
+ get_context:
156
+ - 'router bgp <asnum>'
157
+ - '(?)/^vrf <vrf>$/i'
158
+ - 'bgp confederation peers'
159
+ ```
160
+
161
+ An optional token will be omitted if any of the wildcards in this token do not have an assigned value. By contrast, mandatory tokens (i.e., any token not explicitly flagged as optional) will raise an ArgumentError if wildcard values are missing:
162
+
163
+ ```ruby
164
+ irb(main):003:0> ref = node.cmd_ref.lookup('bgp', 'confederation_peers')
165
+ irb(main):006:0> ref.getter(asnum: 1)[:context]
166
+ => ["router bgp 1", "bgp confederation peers"]
167
+ irb(main):007:0> ref.getter(asnum: 1, vrf: 'red')[:context]
168
+ => ["router bgp 1", "/^vrf red$/i", "bgp confederation peers"]
169
+ irb(main):008:0> ref.getter(vrf: 'red')[:context]
170
+ ArgumentError: No value specified for 'asnum' in 'router bgp <asnum>'
171
+ ```
172
+
173
+ ## Advanced attribute definition
174
+
175
+ ### `_template`
176
+
177
+ The optional `_template` section can be used to define base parameters for all
178
+ attributes of a given feature. For example, all interface attributes might be
179
+ checked with the `show running-config interface all` command, and all
180
+ attributes might be set by first entering the interface configuration submode
181
+ with the `interface <name>` configuration command. Thus, you might have:
182
+
183
+ ```yaml
184
+ # interface.yaml
185
+ _template:
186
+ get_command: 'show running-config interface all'
187
+ get_context: 'interface <name>'
188
+ set_context: 'interface <name>'
189
+
190
+ access_vlan:
191
+ get_value: 'switchport access vlan (.*)'
192
+ set_value: 'switchport access vlan <number>'
193
+
194
+ description:
195
+ get_value: '/^description (.*)$/'
196
+ set_value: 'description <desc>'
197
+
198
+ ...
199
+ ```
200
+
201
+ instead of the more repetitive (but equally valid):
202
+
203
+ ```yaml
204
+ # interface.yaml
205
+ access_vlan:
206
+ get_command: 'show running interface all'
207
+ get_context: 'interface <name>'
208
+ get_value: 'switchport access vlan (.*)'
209
+ set_context: 'interface <name>'
210
+ set_value: 'switchport access vlan <number>'
211
+
212
+ description:
213
+ get_command: 'show running-config interface all'
214
+ get_context: 'interface <name>'
215
+ get_value: '/^description (.*)$/'
216
+ set_context: 'interface <name>'
217
+ set_value: 'description <desc>'
218
+
219
+ ...
220
+ ```
221
+
222
+ ### Data format variants
223
+
224
+ Clients for different Cisco platforms may use different data formats. NXAPI (used for Cisco Nexus platforms) supports a CLI-based data format (essentially a wrapper for the Nexus CLI) as well as a NXAPI-specific structured format for some 'show' commands. Currently the gRPC client provided here (used for Cisco IOS XR platforms) supports a CLI-based format. Other platforms may have other formats such as YANG. As different formats have different requirements, the YAML must be able to accommodate this.
225
+
226
+ CLI is the lowest common denominator, so YAML entries not otherwise flagged as applicable to a specific API type will be assumed to reference CLI. Other API types can be indicated by using the API type as a key (`cli`, `nxapi_structured`, `yang`, etc.). For example, Nexus platforms support a structured form of 'show version', while other clients might use the same command but will need to parse CLI output with a regular expression:
227
+
228
+ ```yaml
229
+ # show_version.yaml
230
+ description:
231
+ get_command: 'show version'
232
+ nexus:
233
+ data_format: nxapi_structured
234
+ get_value: 'chassis_id'
235
+ else:
236
+ data_format: cli
237
+ get_value: '/Hardware\n cisco (([^(\n]+|\(\d+ Slot\))+\w+)/'
238
+ ```
239
+
240
+ ### Platform variants
241
+
242
+ Even for clients using the same data format (e.g., CLI), there may be differences between classes of Cisco platform. Any of the attribute properties can be subdivided by platform type by using the platform type as a key. For example, interface VRF membership defaults to `""` (no VRF) on both Nexus and IOS XR platforms, but the CLI is `vrf member <vrf>` for Nexus and `vrf <vrf>` for IOS XR. Thus, the YAML could be written as:
243
+
244
+ ```yaml
245
+ # interface.yaml
246
+ vrf:
247
+ default_value: ""
248
+ nexus:
249
+ get_value: 'vrf member (.*)'
250
+ set_value: "<state> vrf member <vrf>"
251
+ ios_xr:
252
+ get_value: 'vrf (.*)'
253
+ set_value: "<state> vrf <vrf>"
254
+ ```
255
+
256
+ ### Product variants
257
+
258
+ Various product categories can also be used as keys to subdivide attributes as needed. Supported categories currently
259
+ include the various Nexus switch product lines (`N3k`, `N3k-F`, `N5k`, `N6k`. `N7k`, `N9k`, `N9k-F`). When using one or more product keys in this fashion, you can also use the special key `else` to handle all other products not specifically called out:
260
+
261
+ ```yaml
262
+ # show_version.yaml
263
+ system_image:
264
+ N9k:
265
+ get_value: "kick_file_name"
266
+ else:
267
+ get_value: "isan_file_name"
268
+ ```
269
+
270
+ ### `_exclude`
271
+
272
+ Related to product variants, an `_exclude` entry can be used to mark an entire feature or a given feature attribute as not applicable to a particular set of products. For example, if feature 'fabricpath' doesn't apply to the N3K or N9K platforms, it can be excluded altogether from those platforms by a single `_exclude` entry at the top of the file:
273
+
274
+ ```yaml
275
+ # fabricpath.yaml
276
+ ---
277
+ _exclude: [N3k, N9k]
278
+
279
+ _template:
280
+ ...
281
+ ```
282
+
283
+ Individual feature attributes can also be excluded in this way:
284
+
285
+ ```yaml
286
+ attribute:
287
+ _exclude:
288
+ - N7k
289
+ default_value: true
290
+ get_command: 'show attribute'
291
+ set_value: 'attribute'
292
+ ```
293
+
294
+ When a feature or attribute is excluded in this way, attempting to call `config_get` or `config_set` on an excluded node will result in a `Cisco::UnsupportedError` being raised. Calling `config_get_default` on such a node will always return `nil`.
295
+
296
+ ### YAML anchors and aliases
297
+
298
+ To reduce repetition, YAML provides the functionality of [node anchors](http://www.yaml.org/spec/1.2/spec.html#id2785586) and [node aliases](http://www.yaml.org/spec/1.2/spec.html#id2786196). A node anchor can be defined with the syntax `&anchor_name` and other nodes can alias against this anchor with the syntax `*anchor_name`. For example, to provide the same data for N3k and N9k platforms:
299
+
300
+ ```yaml
301
+ vn_segment_vlan_based:
302
+ # MT-lite only
303
+ N3k: &vn_segment_vlan_based_mt_lite
304
+ kind: boolean
305
+ config_get: 'show running section feature'
306
+ config_get_token: '/^feature vn-segment-vlan-based$/'
307
+ config_set: 'feature vn-segment-vlan-based'
308
+ default_value: false
309
+ N9k: *vn_segment_vlan_based_mt_lite
310
+ ```
311
+
312
+ ### Combinations of these
313
+
314
+ In many cases, supporting multiple platforms and multiple products will require
315
+ using several or all of the above options.
316
+
317
+ Using `_template` in combination with platform and data format variants:
318
+
319
+ ```yaml
320
+ # inventory.yaml
321
+ _template:
322
+ ios_xr:
323
+ get_command: 'show inventory | begin "Rack 0"'
324
+ get_data_format: cli
325
+ nexus:
326
+ get_command: 'show inventory'
327
+ get_data_format: nxapi_structured
328
+
329
+ productid:
330
+ ios_xr:
331
+ get_value: '/PID: ([^ ,]+)/'
332
+ nexus:
333
+ get_context: ["TABLE_inv", "ROW_inv"]
334
+ get_value: ["name Chassis", "productid"]
335
+ ```
336
+
337
+ Using platform variants and product variants together:
338
+
339
+ ```yaml
340
+ # interface.yaml
341
+ negotiate_auto_portchannel:
342
+ kind: boolean
343
+ _exclude: [ios_xr]
344
+ nexus:
345
+ N7k:
346
+ default_only: false
347
+ else:
348
+ get_value: '(no )?negotiate auto'
349
+ set_value: "<state> negotiate auto"
350
+ default_value: true
351
+ ```
352
+
353
+ ## Attribute properties
354
+
355
+ ### `get_data_format`
356
+
357
+ The `get_data_format` key is optionally used to specify which data format a given client should use for a get operation. Supported values are `cli` and `nxapi_structured`. If not specified, this key defaults to `cli`.
358
+
359
+ ```yaml
360
+ # inventory.yaml
361
+ productid:
362
+ get_command: 'show inventory'
363
+ nexus:
364
+ get_data_format: nxapi_structured
365
+ get_context: ['TABLE_inv', 'ROW_inv']
366
+ ```
367
+
368
+ ### `get_command`
369
+
370
+ `get_command` must be a single string representing the CLI command (usually a
371
+ `show` command) to be used to display the information needed to get the
372
+ current value of this attribute.
373
+
374
+ ```yaml
375
+ # interface_ospf.yaml
376
+ area:
377
+ get_command: 'show running interface all'
378
+ ```
379
+
380
+ ### `get_context`
381
+
382
+ `get_context` is an optional sequence of tokens used to filter the output from the `get_command` down to the desired context where the `get_value` can be found. For CLI properties, these tokens are implicitly Regexps used to filter down through the hierarchical CLI output, while for `nxapi_structured` properties, the tokens are used as string keys. For `nxapi_structured` properties, both `get_context` and `get_value` can specify a sequence of tokens used to filter the output from the `get_command` down to the desired `get_value`. This feature can be used to retrieve data from `TABLE` data the contains multiple `ROWS`.
383
+
384
+
385
+ ```yaml
386
+ # inventory.yaml
387
+ productid:
388
+ get_command: 'show inventory'
389
+ nexus:
390
+ get_data_format: nxapi_structured
391
+ get_context: ['TABLE_inv', 'ROW_inv']
392
+ get_value: ["name Chassis", "productid"]
393
+ # config_get('inventory', 'productid') returns
394
+ # 'productid' for the row that contains 'name Chassis'
395
+ ```
396
+
397
+ ```yaml
398
+ # vlan.yaml
399
+ name:
400
+ get_command: "show vlan brief"
401
+ nexus:
402
+ kind: string
403
+ get_data_format: nxapi_structured
404
+ get_context: ["TABLE_vlanbriefxbrief", "ROW_vlanbriefxbrief"]
405
+ get_value: ["vlanshowbr-vlanid-utf <vlanid>", "vlanshowbr-vlanname"]
406
+ # config_get('vlan', 'name', @vlan_id) returns
407
+ # 'vlanshowbr-vlanname' for @vlan_id.
408
+ # NOTE: `<vlanid>` in the `get_value` is replaced by `@vlan_id` prior to lookup.
409
+ ```
410
+
411
+ ```yaml
412
+ # vlan.yaml
413
+ shutdown:
414
+ get_command: "show vlan brief"
415
+ nexus:
416
+ kind: boolean
417
+ get_data_format: nxapi_structured
418
+ get_context: ["TABLE_vlanbriefxbrief", "ROW_vlanbriefxbrief"]
419
+ get_value: ["vlanshowbr-vlanid-utf <vlanid>", "vlanshowbr-shutstate", '/^shutdown$/']
420
+ # config_get('vlan', 'shutdown', @vlan_id) returns
421
+ # true if data in 'vlanshowbr-shutstate' matches regex '/^shutdown$/' else false.
422
+ # NOTE: `<vlanid>` in the `get_value` is replaced by `@vlan_id` prior to lookup.
423
+ ```
424
+
425
+ ```yaml
426
+ # interface.yaml
427
+ description:
428
+ get_command: 'show running interface all'
429
+ ios_xr:
430
+ get_context: 'interface <name>'
431
+ get_value: '/^description (.*)/'
432
+ # config_get('interface', 'description', name: 'Ethernet1/1') gets the
433
+ # plaintext output, finds the subsection under /^interface Ethernet1/1$/i,
434
+ # then finds the line matching /^description (.*)$/ in that subsection
435
+ ```
436
+
437
+ If the context is defined using the recommended key-value wildcarding style, it is possible to define individual tokens as [optional](#optional-tokens-in-key-value-lists).
438
+
439
+ ### `get_value`
440
+
441
+ `get_value` is the specific token used to locate the desired value. As with `get_context`, this is implicitly a Regexp for a CLI command, and implicitly a Hash key for a `nxapi_structured` command.
442
+
443
+ When using a `_template` section, a common pattern is to place the `get_context` in the template to be shared among all attributes, then have specific `get_value` defined for each individual attribute:
444
+
445
+ ```yaml
446
+ # interface.yaml
447
+ _template:
448
+ get_command: 'show running-config interface all'
449
+ get_context: 'interface <name>'
450
+
451
+ description:
452
+ get_value: '/^description (.*)$/'
453
+
454
+ duplex:
455
+ get_value: 'duplex (.*)'
456
+ ```
457
+
458
+ ### `set_context`
459
+
460
+ The optional `set_context` parameter is a sequence of strings representing the
461
+ configuration CLI command(s) used to enter the necessary configuration submode before configuring the attribute's `set_value`.
462
+
463
+ ```yaml
464
+ # interface.yaml
465
+ description:
466
+ set_context: ['interface <name>']
467
+ set_value: 'description <desc>'
468
+ ```
469
+
470
+ If the context is defined using the recommended key-value wildcarding style, it is possible to define individual tokens as [optional](#optional-tokens-in-key-value-lists).
471
+
472
+ ### `set_value`
473
+
474
+ `set_value` is the specific command used to set the desired attribute value. As with `get_value`, a common pattern is to specify a `set_context` in the `_template` section and specify `set_value` on a per-attribute basis:
475
+
476
+ ```yaml
477
+ # interface.yaml
478
+ _template:
479
+ set_context: ['interface <name>']
480
+
481
+ access_vlan:
482
+ set_value: 'switchport access vlan <number>'
483
+
484
+ description:
485
+ set_value: '<state> description <desc>'
486
+ ```
487
+
488
+ ### `default_value`
489
+
490
+ If there is a default value for this attribute when not otherwise specified by the user, the `default_value` parameter describes it. This can be a string, boolean, integer, array, or nil.
491
+
492
+ ```yaml
493
+ description:
494
+ default_value: ''
495
+
496
+ hello_interval:
497
+ default_value: 10
498
+
499
+ auto_cost:
500
+ default_value: [40, 'Gbps']
501
+
502
+ ipv4_address:
503
+ # YAML represents nil as ~
504
+ default_value: ~
505
+ ```
506
+
507
+ By convention, a `default_value` of `''` (empty string) represents a configurable property that defaults to absent, while a default of `nil` (Ruby) or `~` (YAML) represents a property that has no meaningful default at all.
508
+
509
+ `config_get()` will return the defined `default_value` if the defined `get_value` does not match anything on the node. Normally this is desirable behavior, but you can use [`auto_default`](#auto_default) to change this behavior if needed.
510
+
511
+ ### `default_only`
512
+
513
+ Some attributes may be hard-coded in such a way that they have a meaningful default value but no relevant `get_value` or `set_value` behavior. For such attributes, the key `default_only` should be used as an alternative to `default_value`. The benefit of using this key is that it causes the `config_get()` API to always return the default value and `config_set()` to raise a `Cisco::UnsupportedError`.
514
+
515
+ ```yaml
516
+ negotiate_auto_ethernet:
517
+ kind: boolean
518
+ nexus:
519
+ /(N7|C3064)/:
520
+ # this feature is always off on these platforms and cannot be changed
521
+ default_only: false
522
+ else:
523
+ get_value: '(no )?negotiate auto'
524
+ set_value: "%s negotiate auto"
525
+ default_value: true
526
+ ```
527
+
528
+ ### `kind`
529
+
530
+ The `kind` attribute is used to specify the type of value that is returned by `config_get()`. If unspecified, no attempt will be made to guess the return type and it will typically be one of string, array, or `nil`. If `kind` is specified, type conversion will automatically be performed as follows:
531
+
532
+ * `kind: boolean` - value will be coerced to `true`/`false`, and if no `default_value` is set, a `nil` result will be returned as `false`.
533
+ * `kind: int` - value will be coerced to an integer, and if no `default_value` is set, a `nil` result will be returned as `0`.
534
+ * `kind: string` - value will be coerced to a string, leading/trailing whitespace will be stripped, and if no `default_value` is set, a `nil` result will be returned as `''`.
535
+
536
+ ```yaml
537
+ # interface.yaml
538
+ ---
539
+ access_vlan:
540
+ get_value: 'switchport access vlan (.*)'
541
+ set_value: "switchport access vlan <vlan>"
542
+ kind: int
543
+ default_value: 1
544
+
545
+ description:
546
+ kind: string
547
+ get_value: 'description (.*)'
548
+ set_value: "<state> description <desc>"
549
+ default_value: ""
550
+
551
+ feature_lacp:
552
+ kind: boolean
553
+ get_command: "show running | i ^feature"
554
+ get_value: 'feature lacp'
555
+ set_value: "<state> feature lacp"
556
+ ```
557
+
558
+ ### `multiple`
559
+
560
+ By default, `get_value` should uniquely identify a single configuration entry, and `config_get()` will raise an error if more than one match is found. For a small number of attributes, it may be desirable to permit multiple matches (in particular, '`all_*`' attributes that are used up to look up all interfaces, all VRFs, etc.). For such attributes, you must specify the key `multiple:`. When this key is present, `config_get()` will permit multiple matches and will return an array of matches (even if there is only a single match).
561
+
562
+ ```yaml
563
+ # interface.yaml
564
+ ---
565
+ all_interfaces:
566
+ multiple:
567
+ get_value: 'interface (.*)'
568
+ ```
569
+
570
+ ### `auto_default`
571
+
572
+ Normally, if `get_value` produces no match, `config_get()` will return the defined `default_value` for this attribute. For some attributes, this may not be desirable. Setting `auto_default: false` will force `config_get()` to return `nil` in the non-matching case instead.
573
+
574
+ ```yaml
575
+ # bgp_af.yaml
576
+ ---
577
+ dampen_igp_metric:
578
+ # dampen_igp_metric defaults to nil (disabled),
579
+ # but its default numeric value when enabled is 600.
580
+ # If disabled, we want config_get() to return nil, not 600.
581
+ default_value: 600
582
+ auto_default: false
583
+ kind: int
584
+ get_value: 'dampen-igp-metric (\d+)'
585
+ set_value: '<state> dampen-igp-metric <num>'
586
+ ```
587
+
588
+ ## Style Guide
589
+
590
+ Please see [YAML Best Practices](../../../docs/README-develop-best-practices.md#ydbp).
@@ -0,0 +1,25 @@
1
+ # aaa_auth_login_service
2
+ ---
3
+ _exclude: [ios_xr]
4
+
5
+ groups:
6
+ get_data_format: nxapi_structured
7
+ get_command: "show aaa authentication"
8
+ get_context: ["TABLE_AuthenMethods", "ROW_AuthenMethods"]
9
+ # this set is only used when there are groups to configure
10
+ set_value: "%s aaa authentication login %s group %s %s"
11
+ default_value: []
12
+ multiple:
13
+
14
+ method:
15
+ auto_default: false
16
+ get_command: "show aaa authentication"
17
+ get_value: '/^\s*%s:.*(local|none)\s*$/'
18
+ # this set is only used when there are no groups to configure
19
+ set_value: "%s aaa authentication login %s %s"
20
+ default_value: :local
21
+
22
+ services:
23
+ get_command: "show run aaa all"
24
+ get_value: '/^aaa authentication login (\S+) (?:none|group|local)/'
25
+ multiple:
@@ -0,0 +1,38 @@
1
+ # aaa_authentication_login
2
+ ---
3
+ _exclude: [ios_xr]
4
+
5
+ ascii_authentication:
6
+ kind: boolean
7
+ get_command: "show run aaa all"
8
+ get_value: '/^aaa authentication login ascii-authentication/'
9
+ set_value: "%s aaa authentication login ascii-authentication"
10
+ default_value: false
11
+
12
+ chap:
13
+ kind: boolean
14
+ get_command: "show run aaa all"
15
+ get_value: '/^aaa authentication login chap enable/'
16
+ set_value: "%s aaa authentication login chap enable"
17
+ default_value: false
18
+
19
+ error_display:
20
+ kind: boolean
21
+ get_command: "show run aaa all"
22
+ get_value: '/^aaa authentication login error-enable/'
23
+ set_value: "%s aaa authentication login error-enable"
24
+ default_value: false
25
+
26
+ mschap:
27
+ kind: boolean
28
+ get_command: "show run aaa all"
29
+ get_value: '/^aaa authentication login mschap enable/'
30
+ set_value: "%s aaa authentication login mschap enable"
31
+ default_value: false
32
+
33
+ mschapv2:
34
+ kind: boolean
35
+ get_command: "show run aaa all"
36
+ get_value: '/^aaa authentication login mschapv2 enable/'
37
+ set_value: "%s aaa authentication login mschapv2 enable"
38
+ default_value: false
@@ -0,0 +1,40 @@
1
+ # aaa_authorization_service
2
+ ---
3
+ _exclude: [ios_xr]
4
+
5
+ groups:
6
+ get_data_format: nxapi_structured
7
+ get_command: "show aaa authorization all"
8
+ get_context: ["TABLE_cmd_methods", "ROW_cmd_methods"]
9
+ # this set is only used when there are groups to configure
10
+ set_value: "%s aaa authorization %s %s group %s %s"
11
+ default_value: []
12
+ multiple:
13
+
14
+ method:
15
+ auto_default: false
16
+ get_command: "show aaa authorization all"
17
+ get_value: '/^\s+%s authorization for %s:.*(local) ?$/'
18
+ # this set is only used when there are no groups to configure
19
+ set_value: "%s aaa authorization %s %s local"
20
+ default_value: :local
21
+
22
+ remove_local_auth:
23
+ # Used for determining if removal of authentication method
24
+ # 'local' is permitted.
25
+ # TBD: remove local should be allowed on all platforms.
26
+ # Change once CSCva88188 is resolved
27
+ kind: boolean
28
+ N3k: &remove_local_allowed
29
+ default_only: true
30
+ N9k: *remove_local_allowed
31
+ N3k-F: *remove_local_allowed
32
+ N9k-F: *remove_local_allowed
33
+ N5k: *remove_local_allowed
34
+ N6k: *remove_local_allowed
35
+ N7k: *remove_local_allowed
36
+
37
+ services:
38
+ get_command: "show run aaa all"
39
+ get_value: '/^aaa authorization (\S+) (\S+) .*(?:local)? ?$/'
40
+ multiple: