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,2540 @@
1
+ #
2
+ # January 2017, Sai Chintalapudi
3
+ #
4
+ # Copyright (c) 2017 Cisco and/or its affiliates.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require_relative 'node_util'
19
+
20
+ module Cisco
21
+ # node_utils class for route_map
22
+ class RouteMap < NodeUtil
23
+ attr_reader :name, :action, :seq
24
+
25
+ def initialize(map_name, sequence, action, instantiate=true)
26
+ fail TypeError unless map_name.is_a?(String)
27
+ fail ArgumentError unless action[/permit|deny/]
28
+ @name = map_name
29
+ @seq = sequence
30
+ @action = action
31
+
32
+ set_args_keys_default
33
+ create if instantiate
34
+ end
35
+
36
+ def self.maps
37
+ hash = {}
38
+ maps = config_get('route_map', 'all_route_maps')
39
+ return hash if maps.nil?
40
+ maps.each do |name, action, seq|
41
+ hash[name] ||= {}
42
+ hash[name][seq] ||= {}
43
+ hash[name][seq][action] = RouteMap.new(name, seq, action, false)
44
+ end
45
+ hash
46
+ end
47
+
48
+ # Helper method to delete @set_args hash keys
49
+ def set_args_keys_default
50
+ @set_args = { name: @name, action: @action, seq: @seq }
51
+ @get_args = @set_args
52
+ end
53
+
54
+ # rubocop:disable Style/AccessorMethodName
55
+ def set_args_keys(hash={})
56
+ set_args_keys_default
57
+ @set_args = @get_args.merge!(hash) unless hash.empty?
58
+ end
59
+
60
+ # Create one route map instance
61
+ def create
62
+ config_set('route_map', 'create', @set_args)
63
+ end
64
+
65
+ def destroy
66
+ config_set('route_map', 'destroy', @set_args)
67
+ end
68
+
69
+ ########################################################
70
+ # PROPERTIES #
71
+ ########################################################
72
+
73
+ # match as-number 12, 13-23, 45
74
+ def match_as_number
75
+ arr = []
76
+ match_array = config_get('route_map', 'match_as_number', @get_args)
77
+ match_array.each do |line|
78
+ next if line.include?('as-path-list')
79
+ arr = line.strip.split(', ')
80
+ end
81
+ arr
82
+ end
83
+
84
+ def match_as_number=(list)
85
+ carr = match_as_number
86
+ cstr = ''
87
+ carr.each do |elem|
88
+ cstr = cstr.concat(elem + ', ')
89
+ end
90
+ unless cstr.empty?
91
+ cstr.chomp!(', ')
92
+ set_args_keys(state: 'no', num: cstr)
93
+ # reset the current config
94
+ config_set('route_map', 'match_as_number', @set_args)
95
+ end
96
+ nstr = ''
97
+ list.each do |elem|
98
+ nstr = nstr.concat(elem + ', ')
99
+ end
100
+ return if nstr.empty?
101
+ nstr.chomp!(', ')
102
+ set_args_keys(state: '', num: nstr)
103
+ config_set('route_map', 'match_as_number', @set_args)
104
+ end
105
+
106
+ def default_match_as_number
107
+ config_get_default('route_map', 'match_as_number')
108
+ end
109
+
110
+ # match as-number as-path-list abc xyz
111
+ def match_as_number_as_path_list
112
+ str = config_get('route_map', 'match_as_number_as_path_list', @get_args)
113
+ str.empty? ? default_match_as_number_as_path_list : str.split
114
+ end
115
+
116
+ def match_as_number_as_path_list=(list)
117
+ carr = match_as_number_as_path_list
118
+ cstr = ''
119
+ carr.each do |elem|
120
+ cstr = cstr.concat(elem + ' ')
121
+ end
122
+ unless cstr.empty?
123
+ set_args_keys(state: 'no', list: cstr)
124
+ # reset the current config
125
+ config_set('route_map', 'match_as_number_as_path_list', @set_args)
126
+ end
127
+ nstr = ''
128
+ list.each do |elem|
129
+ nstr = nstr.concat(elem + ' ')
130
+ end
131
+ return if nstr.empty?
132
+ set_args_keys(state: '', list: nstr)
133
+ config_set('route_map', 'match_as_number_as_path_list', @set_args)
134
+ end
135
+
136
+ def default_match_as_number_as_path_list
137
+ config_get_default('route_map', 'match_as_number_as_path_list')
138
+ end
139
+
140
+ def description
141
+ config_get('route_map', 'description', @get_args)
142
+ end
143
+
144
+ def description=(val)
145
+ state = val ? '' : 'no'
146
+ desc = val ? val : ''
147
+ set_args_keys(state: state, desc: desc)
148
+ config_set('route_map', 'description', @set_args)
149
+ end
150
+
151
+ def default_description
152
+ config_get_default('route_map', 'description')
153
+ end
154
+
155
+ # match community public private exact-match
156
+ def match_community
157
+ str = config_get('route_map', 'match_community', @get_args)
158
+ if str.empty?
159
+ val = default_match_community
160
+ else
161
+ val = str.split
162
+ val.delete('exact-match')
163
+ end
164
+ val
165
+ end
166
+
167
+ def match_community_set(list, exact)
168
+ carr = match_community
169
+ cstr = ''
170
+ carr.each do |elem|
171
+ cstr = cstr.concat(elem + ' ')
172
+ end
173
+ unless cstr.empty?
174
+ set_args_keys(state: 'no', comm: cstr)
175
+ # reset the current config
176
+ config_set('route_map', 'match_community', @set_args)
177
+ end
178
+ nstr = ''
179
+ list.each do |elem|
180
+ nstr = nstr.concat(elem + ' ')
181
+ end
182
+ return if nstr.empty?
183
+ nstr.concat('exact-match') if exact
184
+ set_args_keys(state: '', comm: nstr)
185
+ config_set('route_map', 'match_community', @set_args)
186
+ end
187
+
188
+ def default_match_community
189
+ config_get_default('route_map', 'match_community')
190
+ end
191
+
192
+ # match extcommunity public private exact-match
193
+ def match_community_exact_match
194
+ config_get('route_map', 'match_community',
195
+ @get_args).include?('exact-match')
196
+ end
197
+
198
+ def default_match_community_exact_match
199
+ config_get_default('route_map', 'match_community_exact_match')
200
+ end
201
+
202
+ def match_ext_community
203
+ str = config_get('route_map', 'match_ext_community', @get_args)
204
+ if str.empty?
205
+ val = default_match_ext_community
206
+ else
207
+ val = str.split
208
+ val.delete('exact-match')
209
+ end
210
+ val
211
+ end
212
+
213
+ def match_ext_community_set(list, exact)
214
+ carr = match_ext_community
215
+ cstr = ''
216
+ carr.each do |elem|
217
+ cstr = cstr.concat(elem + ' ')
218
+ end
219
+ unless cstr.empty?
220
+ set_args_keys(state: 'no', comm: cstr)
221
+ # reset the current config
222
+ config_set('route_map', 'match_ext_community', @set_args)
223
+ end
224
+ nstr = ''
225
+ list.each do |elem|
226
+ nstr = nstr.concat(elem + ' ')
227
+ end
228
+ return if nstr.empty?
229
+ nstr.concat('exact-match') if exact
230
+ set_args_keys(state: '', comm: nstr)
231
+ config_set('route_map', 'match_ext_community', @set_args)
232
+ end
233
+
234
+ def default_match_ext_community
235
+ config_get_default('route_map', 'match_ext_community')
236
+ end
237
+
238
+ def match_ext_community_exact_match
239
+ config_get('route_map', 'match_ext_community',
240
+ @get_args).include?('exact-match')
241
+ end
242
+
243
+ def default_match_ext_community_exact_match
244
+ config_get_default('route_map', 'match_ext_community_exact_match')
245
+ end
246
+
247
+ # match interface port-channel1 Null0 (and so on)
248
+ def match_interface
249
+ str = config_get('route_map', 'match_interface', @get_args)
250
+ intf = str.empty? ? default_match_interface : str.split
251
+ # Normalize by downcasing
252
+ intf.map!(&:downcase)
253
+ end
254
+
255
+ def match_interface=(list)
256
+ carr = match_interface
257
+ cstr = ''
258
+ carr.each do |elem|
259
+ cstr = cstr.concat(elem + ' ')
260
+ end
261
+ unless cstr.empty?
262
+ set_args_keys(state: 'no', int: cstr)
263
+ # reset the current config
264
+ config_set('route_map', 'match_interface', @set_args)
265
+ end
266
+ nstr = ''
267
+ list.each do |elem|
268
+ nstr = nstr.concat(elem + ' ')
269
+ end
270
+ return if nstr.empty?
271
+ set_args_keys(state: '', int: nstr)
272
+ config_set('route_map', 'match_interface', @set_args)
273
+ end
274
+
275
+ def default_match_interface
276
+ config_get_default('route_map', 'match_interface')
277
+ end
278
+
279
+ # match tag 11 5 28
280
+ def match_tag
281
+ str = config_get('route_map', 'match_tag', @get_args)
282
+ str.empty? ? default_match_tag : str.split
283
+ end
284
+
285
+ def match_tag=(list)
286
+ carr = match_tag
287
+ cstr = ''
288
+ carr.each do |elem|
289
+ cstr = cstr.concat(elem + ' ')
290
+ end
291
+ unless cstr.empty?
292
+ set_args_keys(state: 'no', tag: cstr)
293
+ # reset the current config
294
+ config_set('route_map', 'match_tag', @set_args)
295
+ end
296
+ nstr = ''
297
+ list.each do |elem|
298
+ nstr = nstr.concat(elem + ' ')
299
+ end
300
+ return if nstr.empty?
301
+ set_args_keys(state: '', tag: nstr)
302
+ config_set('route_map', 'match_tag', @set_args)
303
+ end
304
+
305
+ def default_match_tag
306
+ config_get_default('route_map', 'match_tag')
307
+ end
308
+
309
+ # match source-protocol tcp udp
310
+ def match_src_proto
311
+ str = config_get('route_map', 'match_src_proto', @get_args)
312
+ str.empty? ? default_match_src_proto : str.split.sort
313
+ end
314
+
315
+ def match_src_proto=(list)
316
+ carr = match_src_proto
317
+ cstr = ''
318
+ carr.each do |elem|
319
+ cstr = cstr.concat(elem + ' ')
320
+ end
321
+ unless cstr.empty?
322
+ set_args_keys(state: 'no', proto: cstr)
323
+ # reset the current config
324
+ config_set('route_map', 'match_src_proto', @set_args)
325
+ end
326
+ nstr = ''
327
+ list.each do |elem|
328
+ nstr = nstr.concat(elem + ' ')
329
+ end
330
+ return if nstr.empty?
331
+ set_args_keys(state: '', proto: nstr)
332
+ config_set('route_map', 'match_src_proto', @set_args)
333
+ end
334
+
335
+ def default_match_src_proto
336
+ config_get_default('route_map', 'match_src_proto')
337
+ end
338
+
339
+ def match_ipv4_addr_access_list
340
+ val = default_match_ipv4_addr_access_list
341
+ arr = config_get('route_map', 'match_ipv4_addr_access_list', @get_args)
342
+ if arr
343
+ arr.each do |line|
344
+ next if line.include?('prefix-list')
345
+ val = line.strip
346
+ end
347
+ end
348
+ val
349
+ end
350
+
351
+ def match_ipv4_addr_access_list_set(val)
352
+ cval = match_ipv4_addr_access_list
353
+ return if val == cval
354
+ state = val ? '' : 'no'
355
+ al = val ? val : cval
356
+ set_args_keys(state: state, access: al)
357
+ config_set('route_map', 'match_ipv4_addr_access_list', @set_args)
358
+ end
359
+
360
+ def default_match_ipv4_addr_access_list
361
+ config_get_default('route_map', 'match_ipv4_addr_access_list')
362
+ end
363
+
364
+ # match ip address prefix-list pre1 pre2
365
+ def match_ipv4_addr_prefix_list
366
+ str = config_get('route_map', 'match_ipv4_addr_prefix_list', @get_args)
367
+ str.empty? ? default_match_ipv4_addr_prefix_list : str.split
368
+ end
369
+
370
+ def match_ipv4_addr_prefix_list_set(list)
371
+ carr = match_ipv4_addr_prefix_list
372
+ cstr = ''
373
+ carr.each do |elem|
374
+ cstr = cstr.concat(elem + ' ')
375
+ end
376
+ unless cstr.empty?
377
+ set_args_keys(state: 'no', prefix: cstr)
378
+ # reset the current config
379
+ config_set('route_map', 'match_ipv4_addr_prefix_list', @set_args)
380
+ end
381
+ nstr = ''
382
+ list.each do |elem|
383
+ nstr = nstr.concat(elem + ' ')
384
+ end
385
+ return if nstr.empty?
386
+ set_args_keys(state: '', prefix: nstr)
387
+ config_set('route_map', 'match_ipv4_addr_prefix_list', @set_args)
388
+ end
389
+
390
+ def default_match_ipv4_addr_prefix_list
391
+ config_get_default('route_map', 'match_ipv4_addr_prefix_list')
392
+ end
393
+
394
+ # match ip next-hop prefix-list nhop1 nhop2
395
+ def match_ipv4_next_hop_prefix_list
396
+ str = config_get('route_map', 'match_ipv4_next_hop_prefix_list',
397
+ @get_args)
398
+ str.empty? ? default_match_ipv4_next_hop_prefix_list : str.split
399
+ end
400
+
401
+ def match_ipv4_next_hop_prefix_list=(list)
402
+ carr = match_ipv4_next_hop_prefix_list
403
+ cstr = ''
404
+ carr.each do |elem|
405
+ cstr = cstr.concat(elem + ' ')
406
+ end
407
+ unless cstr.empty?
408
+ set_args_keys(state: 'no', prefix: cstr)
409
+ # reset the current config
410
+ config_set('route_map', 'match_ipv4_next_hop_prefix_list', @set_args)
411
+ end
412
+ nstr = ''
413
+ list.each do |elem|
414
+ nstr = nstr.concat(elem + ' ')
415
+ end
416
+ return if nstr.empty?
417
+ set_args_keys(state: '', prefix: nstr)
418
+ config_set('route_map', 'match_ipv4_next_hop_prefix_list', @set_args)
419
+ end
420
+
421
+ def default_match_ipv4_next_hop_prefix_list
422
+ config_get_default('route_map', 'match_ipv4_next_hop_prefix_list')
423
+ end
424
+
425
+ # match ip route-source prefix-list rs1 rs2
426
+ def match_ipv4_route_src_prefix_list
427
+ str = config_get('route_map', 'match_ipv4_route_src_prefix_list',
428
+ @get_args)
429
+ str.empty? ? default_match_ipv4_route_src_prefix_list : str.split
430
+ end
431
+
432
+ def match_ipv4_route_src_prefix_list=(list)
433
+ carr = match_ipv4_route_src_prefix_list
434
+ cstr = ''
435
+ carr.each do |elem|
436
+ cstr = cstr.concat(elem + ' ')
437
+ end
438
+ unless cstr.empty?
439
+ set_args_keys(state: 'no', prefix: cstr)
440
+ # reset the current config
441
+ config_set('route_map', 'match_ipv4_route_src_prefix_list', @set_args)
442
+ end
443
+ nstr = ''
444
+ list.each do |elem|
445
+ nstr = nstr.concat(elem + ' ')
446
+ end
447
+ return if nstr.empty?
448
+ set_args_keys(state: '', prefix: nstr)
449
+ config_set('route_map', 'match_ipv4_route_src_prefix_list', @set_args)
450
+ end
451
+
452
+ def default_match_ipv4_route_src_prefix_list
453
+ config_get_default('route_map', 'match_ipv4_route_src_prefix_list')
454
+ end
455
+
456
+ # match ip multicast source 242.1.1.1/32 group 239.2.2.2/32 rp 242.1.1.1/32
457
+ # rp-type ASM
458
+ # match ip multicast source 242.1.1.1/32 group-range
459
+ # 239.1.1.1 to 239.2.2.2 rp 242.1.1.1/32 rp-type Bidir
460
+ def match_ipv4_multicast_get
461
+ str = config_get('route_map', 'match_ipv4_multicast', @get_args)
462
+ return nil if str.nil?
463
+ regexp = Regexp.new('match ip multicast *(?<src>source \S+)?'\
464
+ ' *(?<grp>group \S+)?'\
465
+ ' *(?<grp_range_start>group-range \S+)?'\
466
+ ' *(?<grp_range_end>to \S+)?'\
467
+ ' *(?<rp>rp \S+)?'\
468
+ ' *(?<rp_type>rp-type \S+)?')
469
+ regexp.match(str)
470
+ end
471
+
472
+ def match_ipv4_multicast_src_addr
473
+ val = Utils.extract_value(match_ipv4_multicast_get, 'src', 'source')
474
+ return default_match_ipv4_multicast_src_addr if val.nil?
475
+ val
476
+ end
477
+
478
+ def match_ipv4_multicast_src_addr=(src_addr)
479
+ @set_args[:source] = Utils.attach_prefix(src_addr, :source)
480
+ end
481
+
482
+ def default_match_ipv4_multicast_src_addr
483
+ config_get_default('route_map', 'match_ipv4_multicast_src_addr')
484
+ end
485
+
486
+ def match_ipv4_multicast_group_addr
487
+ val = Utils.extract_value(match_ipv4_multicast_get, 'grp', 'group')
488
+ return default_match_ipv4_multicast_group_addr if val.nil?
489
+ val
490
+ end
491
+
492
+ def match_ipv4_multicast_group_addr=(grp_addr)
493
+ @set_args[:group] = Utils.attach_prefix(grp_addr, :group)
494
+ end
495
+
496
+ def default_match_ipv4_multicast_group_addr
497
+ config_get_default('route_map', 'match_ipv4_multicast_group_addr')
498
+ end
499
+
500
+ def match_ipv4_multicast_group_range_begin_addr
501
+ val = Utils.extract_value(match_ipv4_multicast_get,
502
+ 'grp_range_start', 'group-range')
503
+ return default_match_ipv4_multicast_group_range_begin_addr if val.nil?
504
+ val
505
+ end
506
+
507
+ def match_ipv4_multicast_group_range_begin_addr=(begin_addr)
508
+ @set_args[:group_range] =
509
+ Utils.attach_prefix(begin_addr, :group_range, :'group-range')
510
+ end
511
+
512
+ def default_match_ipv4_multicast_group_range_begin_addr
513
+ config_get_default('route_map',
514
+ 'match_ipv4_multicast_group_range_begin_addr')
515
+ end
516
+
517
+ def match_ipv4_multicast_group_range_end_addr
518
+ val = Utils.extract_value(match_ipv4_multicast_get, 'grp_range_end', 'to')
519
+ return default_match_ipv4_multicast_group_range_end_addr if val.nil?
520
+ val
521
+ end
522
+
523
+ def match_ipv4_multicast_group_range_end_addr=(end_addr)
524
+ @set_args[:to] = Utils.attach_prefix(end_addr, :to)
525
+ end
526
+
527
+ def default_match_ipv4_multicast_group_range_end_addr
528
+ config_get_default('route_map',
529
+ 'match_ipv4_multicast_group_range_end_addr')
530
+ end
531
+
532
+ def match_ipv4_multicast_rp_addr
533
+ val = Utils.extract_value(match_ipv4_multicast_get, 'rp')
534
+ return default_match_ipv4_multicast_rp_addr if val.nil?
535
+ val
536
+ end
537
+
538
+ def match_ipv4_multicast_rp_addr=(rp_addr)
539
+ @set_args[:rp] = Utils.attach_prefix(rp_addr, :rp)
540
+ end
541
+
542
+ def default_match_ipv4_multicast_rp_addr
543
+ config_get_default('route_map', 'match_ipv4_multicast_rp_addr')
544
+ end
545
+
546
+ def match_ipv4_multicast_rp_type
547
+ val = Utils.extract_value(match_ipv4_multicast_get, 'rp_type', 'rp-type')
548
+ return default_match_ipv4_multicast_rp_type if val.nil?
549
+ val
550
+ end
551
+
552
+ def match_ipv4_multicast_rp_type=(type)
553
+ @set_args[:rp_type] = Utils.attach_prefix(type, :rp_type, :'rp-type')
554
+ end
555
+
556
+ def default_match_ipv4_multicast_rp_type
557
+ config_get_default('route_map', 'match_ipv4_multicast_rp_type')
558
+ end
559
+
560
+ def match_ipv4_multicast_enable
561
+ match_ipv4_multicast_get.nil? ? default_match_ipv4_multicast_enable : true
562
+ end
563
+
564
+ def match_ipv4_multicast_enable=(enable)
565
+ @set_args[:state] = enable ? '' : 'no'
566
+ end
567
+
568
+ def default_match_ipv4_multicast_enable
569
+ config_get_default('route_map', 'match_ipv4_multicast_enable')
570
+ end
571
+
572
+ def match_ipv4_multicast_set(attrs)
573
+ set_args_keys(attrs)
574
+ [:match_ipv4_multicast_src_addr,
575
+ :match_ipv4_multicast_group_addr,
576
+ :match_ipv4_multicast_group_range_begin_addr,
577
+ :match_ipv4_multicast_group_range_end_addr,
578
+ :match_ipv4_multicast_rp_addr,
579
+ :match_ipv4_multicast_rp_type,
580
+ :match_ipv4_multicast_enable,
581
+ ].each do |p|
582
+ attrs[p] = '' if attrs[p].nil?
583
+ send(p.to_s + '=', attrs[p])
584
+ end
585
+ @get_args = @set_args
586
+ config_set('route_map', 'match_ipv4_multicast', @set_args)
587
+ end
588
+
589
+ def match_ipv6_addr_access_list
590
+ val = default_match_ipv6_addr_access_list
591
+ arr = config_get('route_map', 'match_ipv6_addr_access_list', @get_args)
592
+ if arr
593
+ arr.each do |line|
594
+ next if line.include?('prefix-list')
595
+ val = line.strip
596
+ end
597
+ end
598
+ val
599
+ end
600
+
601
+ def match_ipv6_addr_access_list_set(val)
602
+ cval = match_ipv6_addr_access_list
603
+ return if val == cval
604
+ state = val ? '' : 'no'
605
+ al = val ? val : cval
606
+ set_args_keys(state: state, access: al)
607
+ config_set('route_map', 'match_ipv6_addr_access_list', @set_args)
608
+ end
609
+
610
+ def default_match_ipv6_addr_access_list
611
+ config_get_default('route_map', 'match_ipv6_addr_access_list')
612
+ end
613
+
614
+ def match_ip_addr_access_list(v4, v6)
615
+ match_ipv4_addr_access_list_set(default_match_ipv4_addr_access_list)
616
+ match_ipv6_addr_access_list_set(default_match_ipv6_addr_access_list)
617
+ match_ipv4_addr_access_list_set(v4)
618
+ match_ipv6_addr_access_list_set(v6)
619
+ end
620
+
621
+ def match_ipv6_addr_prefix_list
622
+ str = config_get('route_map', 'match_ipv6_addr_prefix_list', @get_args)
623
+ str.empty? ? default_match_ipv6_addr_prefix_list : str.split
624
+ end
625
+
626
+ def match_ipv6_addr_prefix_list_set(list)
627
+ carr = match_ipv6_addr_prefix_list
628
+ cstr = ''
629
+ carr.each do |elem|
630
+ cstr = cstr.concat(elem + ' ')
631
+ end
632
+ unless cstr.empty?
633
+ set_args_keys(state: 'no', prefix: cstr)
634
+ # reset the current config
635
+ config_set('route_map', 'match_ipv6_addr_prefix_list', @set_args)
636
+ end
637
+ nstr = ''
638
+ list.each do |elem|
639
+ nstr = nstr.concat(elem + ' ')
640
+ end
641
+ return if nstr.empty?
642
+ set_args_keys(state: '', prefix: nstr)
643
+ config_set('route_map', 'match_ipv6_addr_prefix_list', @set_args)
644
+ end
645
+
646
+ def default_match_ipv6_addr_prefix_list
647
+ config_get_default('route_map', 'match_ipv6_addr_prefix_list')
648
+ end
649
+
650
+ def match_ip_addr_prefix_list(v4, v6)
651
+ match_ipv4_addr_prefix_list_set(default_match_ipv4_addr_prefix_list)
652
+ match_ipv6_addr_prefix_list_set(default_match_ipv6_addr_prefix_list)
653
+ match_ipv4_addr_prefix_list_set(v4)
654
+ match_ipv6_addr_prefix_list_set(v6)
655
+ end
656
+
657
+ def match_ipv6_next_hop_prefix_list
658
+ str = config_get('route_map', 'match_ipv6_next_hop_prefix_list',
659
+ @get_args)
660
+ str.empty? ? default_match_ipv6_next_hop_prefix_list : str.split
661
+ end
662
+
663
+ def match_ipv6_next_hop_prefix_list=(list)
664
+ carr = match_ipv6_next_hop_prefix_list
665
+ cstr = ''
666
+ carr.each do |elem|
667
+ cstr = cstr.concat(elem + ' ')
668
+ end
669
+ unless cstr.empty?
670
+ set_args_keys(state: 'no', prefix: cstr)
671
+ # reset the current config
672
+ config_set('route_map', 'match_ipv6_next_hop_prefix_list', @set_args)
673
+ end
674
+ nstr = ''
675
+ list.each do |elem|
676
+ nstr = nstr.concat(elem + ' ')
677
+ end
678
+ return if nstr.empty?
679
+ set_args_keys(state: '', prefix: nstr)
680
+ config_set('route_map', 'match_ipv6_next_hop_prefix_list', @set_args)
681
+ end
682
+
683
+ def default_match_ipv6_next_hop_prefix_list
684
+ config_get_default('route_map', 'match_ipv6_next_hop_prefix_list')
685
+ end
686
+
687
+ def match_ipv6_route_src_prefix_list
688
+ str = config_get('route_map', 'match_ipv6_route_src_prefix_list',
689
+ @get_args)
690
+ str.empty? ? default_match_ipv6_route_src_prefix_list : str.split
691
+ end
692
+
693
+ def match_ipv6_route_src_prefix_list=(list)
694
+ carr = match_ipv6_route_src_prefix_list
695
+ cstr = ''
696
+ carr.each do |elem|
697
+ cstr = cstr.concat(elem + ' ')
698
+ end
699
+ unless cstr.empty?
700
+ set_args_keys(state: 'no', prefix: cstr)
701
+ # reset the current config
702
+ config_set('route_map', 'match_ipv6_route_src_prefix_list', @set_args)
703
+ end
704
+ nstr = ''
705
+ list.each do |elem|
706
+ nstr = nstr.concat(elem + ' ')
707
+ end
708
+ return if nstr.empty?
709
+ set_args_keys(state: '', prefix: nstr)
710
+ config_set('route_map', 'match_ipv6_route_src_prefix_list', @set_args)
711
+ end
712
+
713
+ def default_match_ipv6_route_src_prefix_list
714
+ config_get_default('route_map', 'match_ipv6_route_src_prefix_list')
715
+ end
716
+
717
+ def match_ipv6_multicast_get
718
+ str = config_get('route_map', 'match_ipv6_multicast', @get_args)
719
+ return nil if str.nil?
720
+ regexp = Regexp.new('match ipv6 multicast *(?<src>source \S+)?'\
721
+ ' *(?<grp>group \S+)?'\
722
+ ' *(?<grp_range_start>group-range \S+)?'\
723
+ ' *(?<grp_range_end>to \S+)?'\
724
+ ' *(?<rp>rp \S+)?'\
725
+ ' *(?<rp_type>rp-type \S+)?')
726
+ regexp.match(str)
727
+ end
728
+
729
+ def match_ipv6_multicast_src_addr
730
+ val = Utils.extract_value(match_ipv6_multicast_get, 'src', 'source')
731
+ return default_match_ipv6_multicast_src_addr if val.nil?
732
+ val
733
+ end
734
+
735
+ def match_ipv6_multicast_src_addr=(src_addr)
736
+ @set_args[:source] = Utils.attach_prefix(src_addr, :source)
737
+ end
738
+
739
+ def default_match_ipv6_multicast_src_addr
740
+ config_get_default('route_map', 'match_ipv6_multicast_src_addr')
741
+ end
742
+
743
+ def match_ipv6_multicast_group_addr
744
+ val = Utils.extract_value(match_ipv6_multicast_get, 'grp', 'group')
745
+ return default_match_ipv6_multicast_group_addr if val.nil?
746
+ val
747
+ end
748
+
749
+ def match_ipv6_multicast_group_addr=(grp_addr)
750
+ @set_args[:group] = Utils.attach_prefix(grp_addr, :group)
751
+ end
752
+
753
+ def default_match_ipv6_multicast_group_addr
754
+ config_get_default('route_map', 'match_ipv6_multicast_group_addr')
755
+ end
756
+
757
+ def match_ipv6_multicast_group_range_begin_addr
758
+ val = Utils.extract_value(match_ipv6_multicast_get,
759
+ 'grp_range_start', 'group-range')
760
+ return default_match_ipv6_multicast_group_range_begin_addr if val.nil?
761
+ val
762
+ end
763
+
764
+ def match_ipv6_multicast_group_range_begin_addr=(begin_addr)
765
+ @set_args[:group_range] =
766
+ Utils.attach_prefix(begin_addr, :group_range, :'group-range')
767
+ end
768
+
769
+ def default_match_ipv6_multicast_group_range_begin_addr
770
+ config_get_default('route_map',
771
+ 'match_ipv6_multicast_group_range_begin_addr')
772
+ end
773
+
774
+ def match_ipv6_multicast_group_range_end_addr
775
+ val = Utils.extract_value(match_ipv6_multicast_get, 'grp_range_end', 'to')
776
+ return default_match_ipv6_multicast_group_range_end_addr if val.nil?
777
+ val
778
+ end
779
+
780
+ def match_ipv6_multicast_group_range_end_addr=(end_addr)
781
+ @set_args[:to] = Utils.attach_prefix(end_addr, :to)
782
+ end
783
+
784
+ def default_match_ipv6_multicast_group_range_end_addr
785
+ config_get_default('route_map',
786
+ 'match_ipv6_multicast_group_range_end_addr')
787
+ end
788
+
789
+ def match_ipv6_multicast_rp_addr
790
+ val = Utils.extract_value(match_ipv6_multicast_get, 'rp')
791
+ return default_match_ipv6_multicast_rp_addr if val.nil?
792
+ val
793
+ end
794
+
795
+ def match_ipv6_multicast_rp_addr=(rp_addr)
796
+ @set_args[:rp] = Utils.attach_prefix(rp_addr, :rp)
797
+ end
798
+
799
+ def default_match_ipv6_multicast_rp_addr
800
+ config_get_default('route_map', 'match_ipv6_multicast_rp_addr')
801
+ end
802
+
803
+ def match_ipv6_multicast_rp_type
804
+ val = Utils.extract_value(match_ipv6_multicast_get, 'rp_type', 'rp-type')
805
+ return default_match_ipv6_multicast_rp_type if val.nil?
806
+ val
807
+ end
808
+
809
+ def match_ipv6_multicast_rp_type=(type)
810
+ @set_args[:rp_type] = Utils.attach_prefix(type, :rp_type, :'rp-type')
811
+ end
812
+
813
+ def default_match_ipv6_multicast_rp_type
814
+ config_get_default('route_map', 'match_ipv6_multicast_rp_type')
815
+ end
816
+
817
+ def match_ipv6_multicast_enable
818
+ match_ipv6_multicast_get.nil? ? default_match_ipv6_multicast_enable : true
819
+ end
820
+
821
+ def match_ipv6_multicast_enable=(enable)
822
+ @set_args[:state] = enable ? '' : 'no'
823
+ end
824
+
825
+ def default_match_ipv6_multicast_enable
826
+ config_get_default('route_map', 'match_ipv6_multicast_enable')
827
+ end
828
+
829
+ def match_ipv6_multicast_set(attrs)
830
+ set_args_keys(attrs)
831
+ [:match_ipv6_multicast_src_addr,
832
+ :match_ipv6_multicast_group_addr,
833
+ :match_ipv6_multicast_group_range_begin_addr,
834
+ :match_ipv6_multicast_group_range_end_addr,
835
+ :match_ipv6_multicast_rp_addr,
836
+ :match_ipv6_multicast_rp_type,
837
+ :match_ipv6_multicast_enable,
838
+ ].each do |p|
839
+ attrs[p] = '' if attrs[p].nil?
840
+ send(p.to_s + '=', attrs[p])
841
+ end
842
+ @get_args = @set_args
843
+ config_set('route_map', 'match_ipv6_multicast', @set_args)
844
+ end
845
+
846
+ # match metric 1 8 224 +- 9 23 5 +- 8 6
847
+ def match_metric
848
+ str = config_get('route_map', 'match_metric', @get_args)
849
+ return default_match_metric if str.empty?
850
+ rarr = []
851
+ larr = []
852
+ metrics = str.split
853
+ deviation = false
854
+ metrics.each do |metric|
855
+ deviation = true if metric == '+-'
856
+ if !larr.empty? && !deviation
857
+ larr << '0'
858
+ rarr << larr
859
+ larr = []
860
+ end
861
+ next if metric == '+-'
862
+ if !larr.empty? && deviation
863
+ larr << metric
864
+ rarr << larr
865
+ larr = []
866
+ deviation = false
867
+ next
868
+ end
869
+ larr << metric if larr.empty?
870
+ end
871
+ unless larr.empty?
872
+ larr << '0'
873
+ rarr << larr
874
+ end
875
+ rarr
876
+ end
877
+
878
+ def match_metric=(list)
879
+ clist = match_metric
880
+ # reset first
881
+ unless clist.empty?
882
+ str = ''
883
+ clist.each do |metric, deviation|
884
+ str.concat(metric + ' ')
885
+ str.concat('+ ' + deviation + ' ') unless deviation == '0'
886
+ end
887
+ set_args_keys(state: 'no', metric: str)
888
+ config_set('route_map', 'match_metric', @set_args)
889
+ end
890
+ return if list.empty?
891
+ str = ''
892
+ list.each do |metric, deviation|
893
+ str.concat(metric + ' ')
894
+ str.concat('+ ' + deviation + ' ') unless deviation == '0'
895
+ end
896
+ set_args_keys(state: '', metric: str)
897
+ config_set('route_map', 'match_metric', @set_args)
898
+ end
899
+
900
+ def default_match_metric
901
+ config_get_default('route_map', 'match_metric')
902
+ end
903
+
904
+ # match route-type external internal (and so on)
905
+ # or in some platforms
906
+ # match route-type external
907
+ # match route-type internal
908
+ # etc.
909
+ def match_route_type_get
910
+ hash = {}
911
+ hash[:external] = false
912
+ hash[:inter_area] = false
913
+ hash[:internal] = false
914
+ hash[:intra_area] = false
915
+ hash[:level_1] = false
916
+ hash[:level_2] = false
917
+ hash[:local] = false
918
+ hash[:nssa_external] = false
919
+ hash[:type_1] = false
920
+ hash[:type_2] = false
921
+ str = config_get('route_map', 'match_route_type', @get_args)
922
+ return hash if str.nil?
923
+ str = str[0] if str.length == 1
924
+ hash[:external] = true if str.include?('external')
925
+ hash[:inter_area] = true if str.include?('inter-area')
926
+ hash[:internal] = true if str.include?('internal')
927
+ hash[:intra_area] = true if str.include?('intra-area')
928
+ hash[:level_1] = true if str.include?('level-1')
929
+ hash[:level_2] = true if str.include?('level-2')
930
+ hash[:local] = true if str.include?('local')
931
+ hash[:nssa_external] = true if str.include?('nssa-external')
932
+ hash[:type_1] = true if str.include?('type-1')
933
+ hash[:type_2] = true if str.include?('type-2')
934
+ hash
935
+ end
936
+
937
+ def match_route_type_set(attrs)
938
+ # reset first
939
+ set_args_keys(
940
+ state: 'no',
941
+ external: 'external',
942
+ inter_area: 'inter-area',
943
+ internal: 'internal',
944
+ intra_area: 'intra-area',
945
+ level_1: 'level-1',
946
+ level_2: 'level-2',
947
+ local: 'local',
948
+ nssa_external: 'nssa-external',
949
+ type_1: 'type-1',
950
+ type_2: 'type-2')
951
+ config_set('route_map', 'match_route_type', @set_args)
952
+
953
+ to_set = false
954
+ set_args_keys(attrs)
955
+ [:match_route_type_external,
956
+ :match_route_type_inter_area,
957
+ :match_route_type_internal,
958
+ :match_route_type_intra_area,
959
+ :match_route_type_level_1,
960
+ :match_route_type_level_2,
961
+ :match_route_type_local,
962
+ :match_route_type_nssa_external,
963
+ :match_route_type_type_1,
964
+ :match_route_type_type_2,
965
+ ].each do |p|
966
+ attrs[p] = false if attrs[p].nil?
967
+ send(p.to_s + '=', attrs[p])
968
+ to_set = true if attrs[p] && !to_set
969
+ end
970
+ return unless to_set
971
+ @set_args[:state] = ''
972
+ @get_args = @set_args
973
+ config_set('route_map', 'match_route_type', @set_args)
974
+ end
975
+
976
+ def match_route_type_external
977
+ hash = match_route_type_get
978
+ hash[:external]
979
+ end
980
+
981
+ def match_route_type_external=(val)
982
+ @set_args[:external] = val ? 'external' : ''
983
+ end
984
+
985
+ def default_match_route_type_external
986
+ config_get_default('route_map', 'match_route_type_external')
987
+ end
988
+
989
+ def match_route_type_inter_area
990
+ hash = match_route_type_get
991
+ hash[:inter_area]
992
+ end
993
+
994
+ def match_route_type_inter_area=(val)
995
+ @set_args[:inter_area] = val ? 'inter-area' : ''
996
+ end
997
+
998
+ def default_match_route_type_inter_area
999
+ config_get_default('route_map', 'match_route_type_inter_area')
1000
+ end
1001
+
1002
+ def match_route_type_internal
1003
+ hash = match_route_type_get
1004
+ hash[:internal]
1005
+ end
1006
+
1007
+ def match_route_type_internal=(val)
1008
+ @set_args[:internal] = val ? 'internal' : ''
1009
+ end
1010
+
1011
+ def default_match_route_type_internal
1012
+ config_get_default('route_map', 'match_route_type_internal')
1013
+ end
1014
+
1015
+ def match_route_type_intra_area
1016
+ hash = match_route_type_get
1017
+ hash[:intra_area]
1018
+ end
1019
+
1020
+ def match_route_type_intra_area=(val)
1021
+ @set_args[:intra_area] = val ? 'intra-area' : ''
1022
+ end
1023
+
1024
+ def default_match_route_type_intra_area
1025
+ config_get_default('route_map', 'match_route_type_intra_area')
1026
+ end
1027
+
1028
+ def match_route_type_level_1
1029
+ hash = match_route_type_get
1030
+ hash[:level_1]
1031
+ end
1032
+
1033
+ def match_route_type_level_1=(val)
1034
+ @set_args[:level_1] = val ? 'level-1' : ''
1035
+ end
1036
+
1037
+ def default_match_route_type_level_1
1038
+ config_get_default('route_map', 'match_route_type_level_1')
1039
+ end
1040
+
1041
+ def match_route_type_level_2
1042
+ hash = match_route_type_get
1043
+ hash[:level_2]
1044
+ end
1045
+
1046
+ def match_route_type_level_2=(val)
1047
+ @set_args[:level_2] = val ? 'level-2' : ''
1048
+ end
1049
+
1050
+ def default_match_route_type_level_2
1051
+ config_get_default('route_map', 'match_route_type_level_2')
1052
+ end
1053
+
1054
+ def match_route_type_local
1055
+ hash = match_route_type_get
1056
+ hash[:local]
1057
+ end
1058
+
1059
+ def match_route_type_local=(val)
1060
+ @set_args[:local] = val ? 'local' : ''
1061
+ end
1062
+
1063
+ def default_match_route_type_local
1064
+ config_get_default('route_map', 'match_route_type_local')
1065
+ end
1066
+
1067
+ def match_route_type_nssa_external
1068
+ hash = match_route_type_get
1069
+ hash[:nssa_external]
1070
+ end
1071
+
1072
+ def match_route_type_nssa_external=(val)
1073
+ @set_args[:nssa_external] = val ? 'nssa-external' : ''
1074
+ end
1075
+
1076
+ def default_match_route_type_nssa_external
1077
+ config_get_default('route_map', 'match_route_type_nssa_external')
1078
+ end
1079
+
1080
+ def match_route_type_type_1
1081
+ hash = match_route_type_get
1082
+ hash[:type_1]
1083
+ end
1084
+
1085
+ def match_route_type_type_1=(val)
1086
+ @set_args[:type_1] = val ? 'type-1' : ''
1087
+ end
1088
+
1089
+ def default_match_route_type_type_1
1090
+ config_get_default('route_map', 'match_route_type_type_1')
1091
+ end
1092
+
1093
+ def match_route_type_type_2
1094
+ hash = match_route_type_get
1095
+ hash[:type_2]
1096
+ end
1097
+
1098
+ def match_route_type_type_2=(val)
1099
+ @set_args[:type_2] = val ? 'type-2' : ''
1100
+ end
1101
+
1102
+ def default_match_route_type_type_2
1103
+ config_get_default('route_map', 'match_route_type_type_2')
1104
+ end
1105
+
1106
+ # match ospf-area 10 7
1107
+ def match_ospf_area
1108
+ str = config_get('route_map', 'match_ospf_area', @get_args)
1109
+ return if str.nil?
1110
+ str.empty? ? default_match_ospf_area : str.split
1111
+ end
1112
+
1113
+ def match_ospf_area=(list)
1114
+ carr = match_ospf_area
1115
+ config_set('route_map', 'match_ospf_area', @set_args) if carr.nil?
1116
+ cstr = ''
1117
+ carr.each do |elem|
1118
+ cstr = cstr.concat(elem + ' ')
1119
+ end
1120
+ unless cstr.empty?
1121
+ set_args_keys(state: 'no', area: cstr)
1122
+ # reset the current config
1123
+ config_set('route_map', 'match_ospf_area', @set_args)
1124
+ end
1125
+ nstr = ''
1126
+ list.each do |elem|
1127
+ nstr = nstr.concat(elem + ' ')
1128
+ end
1129
+ return if nstr.empty?
1130
+ set_args_keys(state: '', area: nstr)
1131
+ config_set('route_map', 'match_ospf_area', @set_args)
1132
+ end
1133
+
1134
+ def default_match_ospf_area
1135
+ config_get_default('route_map', 'match_ospf_area')
1136
+ end
1137
+
1138
+ # match mac-list m1 m2
1139
+ def match_mac_list
1140
+ str = config_get('route_map', 'match_mac_list', @get_args)
1141
+ return if str.nil?
1142
+ str.empty? ? default_match_mac_list : str.split
1143
+ end
1144
+
1145
+ def match_mac_list=(list)
1146
+ carr = match_mac_list
1147
+ config_set('route_map', 'match_mac_list', @set_args) if carr.nil?
1148
+ cstr = ''
1149
+ carr.each do |elem|
1150
+ cstr = cstr.concat(elem + ' ')
1151
+ end
1152
+ unless cstr.empty?
1153
+ set_args_keys(state: 'no', mac: cstr)
1154
+ # reset the current config
1155
+ config_set('route_map', 'match_mac_list', @set_args)
1156
+ end
1157
+ nstr = ''
1158
+ list.each do |elem|
1159
+ nstr = nstr.concat(elem + ' ')
1160
+ end
1161
+ return if nstr.empty?
1162
+ set_args_keys(state: '', mac: nstr)
1163
+ config_set('route_map', 'match_mac_list', @set_args)
1164
+ end
1165
+
1166
+ def default_match_mac_list
1167
+ config_get_default('route_map', 'match_mac_list')
1168
+ end
1169
+
1170
+ # match length 45 300
1171
+ def match_length
1172
+ config_get('route_map', 'match_length', @get_args)
1173
+ end
1174
+
1175
+ def match_length=(array)
1176
+ if array.empty?
1177
+ set_args_keys(state: 'no', min: '', max: '')
1178
+ else
1179
+ set_args_keys(state: '', min: array[0], max: array[1])
1180
+ end
1181
+ config_set('route_map', 'match_length', @set_args)
1182
+ end
1183
+
1184
+ def default_match_length
1185
+ config_get_default('route_map', 'match_length')
1186
+ end
1187
+
1188
+ def match_vlan
1189
+ ret = config_get('route_map', 'match_vlan', @get_args)
1190
+ ret.strip if ret
1191
+ end
1192
+
1193
+ def match_vlan=(val)
1194
+ cval = match_vlan
1195
+ # reset first
1196
+ unless cval.nil? || cval.empty?
1197
+ set_args_keys(state: 'no', range: cval)
1198
+ config_set('route_map', 'match_vlan', @set_args)
1199
+ end
1200
+ return if val.empty?
1201
+ set_args_keys(state: '', range: val)
1202
+ config_set('route_map', 'match_vlan', @set_args)
1203
+ end
1204
+
1205
+ def default_match_vlan
1206
+ config_get_default('route_map', 'match_vlan')
1207
+ end
1208
+
1209
+ # match evpn route-type 1
1210
+ # match evpn route-type 2 all
1211
+ # match evpn route-type 2 mac-ip
1212
+ # match evpn route-type 2 mac-only
1213
+ # match evpn route-type 3 etc.
1214
+ def match_evpn_route_type_get
1215
+ arr = config_get('route_map', 'match_evpn_route_type', @get_args)
1216
+ return nil if arr.nil?
1217
+ hash = {}
1218
+ hash[:type1] = false
1219
+ hash[:type3] = false
1220
+ hash[:type4] = false
1221
+ hash[:type5] = false
1222
+ hash[:type6] = false
1223
+ hash[:type_all] = false
1224
+ hash[:type2_all] = false
1225
+ hash[:type2_mac_ip] = false
1226
+ hash[:type2_mac_only] = false
1227
+ return hash if arr.empty?
1228
+ hash[:type1] = true if arr.include?('1')
1229
+ hash[:type3] = true if arr.include?('3')
1230
+ hash[:type4] = true if arr.include?('4')
1231
+ hash[:type5] = true if arr.include?('5')
1232
+ hash[:type6] = true if arr.include?('6')
1233
+ hash[:type_all] = true if arr.include?('all')
1234
+ hash[:type2_all] = true if arr.include?('2 all')
1235
+ hash[:type2_mac_ip] = true if arr.include?('2 mac-ip')
1236
+ hash[:type2_mac_only] = true if arr.include?('2 mac-only')
1237
+ hash
1238
+ end
1239
+
1240
+ def match_evpn_route_type_1
1241
+ hash = match_evpn_route_type_get
1242
+ hash.nil? ? nil : hash[:type1]
1243
+ end
1244
+
1245
+ def match_evpn_route_type_1=(val)
1246
+ state = val ? '' : 'no'
1247
+ set_args_keys(state: state, type: '1')
1248
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1249
+ end
1250
+
1251
+ def default_match_evpn_route_type_1
1252
+ config_get_default('route_map', 'match_evpn_route_type_1')
1253
+ end
1254
+
1255
+ def match_evpn_route_type_3
1256
+ hash = match_evpn_route_type_get
1257
+ hash.nil? ? nil : hash[:type3]
1258
+ end
1259
+
1260
+ def match_evpn_route_type_3=(val)
1261
+ state = val ? '' : 'no'
1262
+ set_args_keys(state: state, type: '3')
1263
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1264
+ end
1265
+
1266
+ def default_match_evpn_route_type_3
1267
+ config_get_default('route_map', 'match_evpn_route_type_3')
1268
+ end
1269
+
1270
+ def match_evpn_route_type_4
1271
+ hash = match_evpn_route_type_get
1272
+ hash.nil? ? nil : hash[:type4]
1273
+ end
1274
+
1275
+ def match_evpn_route_type_4=(val)
1276
+ state = val ? '' : 'no'
1277
+ set_args_keys(state: state, type: '4')
1278
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1279
+ end
1280
+
1281
+ def default_match_evpn_route_type_4
1282
+ config_get_default('route_map', 'match_evpn_route_type_4')
1283
+ end
1284
+
1285
+ def match_evpn_route_type_5
1286
+ hash = match_evpn_route_type_get
1287
+ hash.nil? ? nil : hash[:type5]
1288
+ end
1289
+
1290
+ def match_evpn_route_type_5=(val)
1291
+ state = val ? '' : 'no'
1292
+ set_args_keys(state: state, type: '5')
1293
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1294
+ end
1295
+
1296
+ def default_match_evpn_route_type_5
1297
+ config_get_default('route_map', 'match_evpn_route_type_5')
1298
+ end
1299
+
1300
+ def match_evpn_route_type_6
1301
+ hash = match_evpn_route_type_get
1302
+ hash.nil? ? nil : hash[:type6]
1303
+ end
1304
+
1305
+ def match_evpn_route_type_6=(val)
1306
+ state = val ? '' : 'no'
1307
+ set_args_keys(state: state, type: '6')
1308
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1309
+ end
1310
+
1311
+ def default_match_evpn_route_type_6
1312
+ config_get_default('route_map', 'match_evpn_route_type_6')
1313
+ end
1314
+
1315
+ def match_evpn_route_type_all
1316
+ hash = match_evpn_route_type_get
1317
+ hash.nil? ? nil : hash[:type_all]
1318
+ end
1319
+
1320
+ def match_evpn_route_type_all=(val)
1321
+ state = val ? '' : 'no'
1322
+ set_args_keys(state: state, type: 'all')
1323
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1324
+ end
1325
+
1326
+ def default_match_evpn_route_type_all
1327
+ config_get_default('route_map', 'match_evpn_route_type_all')
1328
+ end
1329
+
1330
+ def match_evpn_route_type_2_all
1331
+ hash = match_evpn_route_type_get
1332
+ hash.nil? ? nil : hash[:type2_all]
1333
+ end
1334
+
1335
+ def match_evpn_route_type_2_all=(val)
1336
+ state = val ? '' : 'no'
1337
+ set_args_keys(state: state, type: '2 all')
1338
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1339
+ end
1340
+
1341
+ def default_match_evpn_route_type_2_all
1342
+ config_get_default('route_map', 'match_evpn_route_type_2_all')
1343
+ end
1344
+
1345
+ def match_evpn_route_type_2_mac_ip
1346
+ hash = match_evpn_route_type_get
1347
+ hash.nil? ? nil : hash[:type2_mac_ip]
1348
+ end
1349
+
1350
+ def match_evpn_route_type_2_mac_ip=(val)
1351
+ state = val ? '' : 'no'
1352
+ set_args_keys(state: state, type: '2 mac-ip')
1353
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1354
+ end
1355
+
1356
+ def default_match_evpn_route_type_2_mac_ip
1357
+ config_get_default('route_map', 'match_evpn_route_type_2_mac_ip')
1358
+ end
1359
+
1360
+ def match_evpn_route_type_2_mac_only
1361
+ hash = match_evpn_route_type_get
1362
+ hash.nil? ? nil : hash[:type2_mac_only]
1363
+ end
1364
+
1365
+ def match_evpn_route_type_2_mac_only=(val)
1366
+ state = val ? '' : 'no'
1367
+ set_args_keys(state: state, type: '2 mac-only')
1368
+ config_set('route_map', 'match_evpn_route_type', @set_args)
1369
+ end
1370
+
1371
+ def default_match_evpn_route_type_2_mac_only
1372
+ config_get_default('route_map', 'match_evpn_route_type_2_mac_only')
1373
+ end
1374
+
1375
+ def set_comm_list
1376
+ config_get('route_map', 'set_comm_list', @get_args)
1377
+ end
1378
+
1379
+ def set_comm_list=(val)
1380
+ state = val ? '' : 'no'
1381
+ list = val ? val : set_comm_list
1382
+ set_args_keys(state: state, list: list)
1383
+ config_set('route_map', 'set_comm_list', @set_args)
1384
+ end
1385
+
1386
+ def default_set_comm_list
1387
+ config_get_default('route_map', 'set_comm_list')
1388
+ end
1389
+
1390
+ def set_extcomm_list
1391
+ config_get('route_map', 'set_extcomm_list', @get_args)
1392
+ end
1393
+
1394
+ def set_extcomm_list=(val)
1395
+ state = val ? '' : 'no'
1396
+ list = val ? val : set_extcomm_list
1397
+ set_args_keys(state: state, list: list)
1398
+ config_set('route_map', 'set_extcomm_list', @set_args)
1399
+ end
1400
+
1401
+ def default_set_extcomm_list
1402
+ config_get_default('route_map', 'set_extcomm_list')
1403
+ end
1404
+
1405
+ def set_forwarding_addr
1406
+ config_get('route_map', 'set_forwarding_addr', @get_args)
1407
+ end
1408
+
1409
+ def set_forwarding_addr=(val)
1410
+ state = val ? '' : 'no'
1411
+ set_args_keys(state: state)
1412
+ config_set('route_map', 'set_forwarding_addr', @set_args)
1413
+ end
1414
+
1415
+ def default_set_forwarding_addr
1416
+ config_get_default('route_map', 'set_forwarding_addr')
1417
+ end
1418
+
1419
+ def set_level
1420
+ config_get('route_map', 'set_level', @get_args)
1421
+ end
1422
+
1423
+ def set_level=(val)
1424
+ state = val ? '' : 'no'
1425
+ level = val ? val : ''
1426
+ set_args_keys(state: state, level: level)
1427
+ config_set('route_map', 'set_level', @set_args)
1428
+ end
1429
+
1430
+ def default_set_level
1431
+ config_get_default('route_map', 'set_level')
1432
+ end
1433
+
1434
+ def set_local_preference
1435
+ config_get('route_map', 'set_local_preference', @get_args)
1436
+ end
1437
+
1438
+ def set_local_preference=(val)
1439
+ state = val ? '' : 'no'
1440
+ pref = val ? val : ''
1441
+ set_args_keys(state: state, pref: pref)
1442
+ config_set('route_map', 'set_local_preference', @set_args)
1443
+ end
1444
+
1445
+ def default_set_local_preference
1446
+ config_get_default('route_map', 'set_local_preference')
1447
+ end
1448
+
1449
+ def set_metric_type
1450
+ config_get('route_map', 'set_metric_type', @get_args)
1451
+ end
1452
+
1453
+ def set_metric_type=(val)
1454
+ state = val ? '' : 'no'
1455
+ type = val ? val : ''
1456
+ set_args_keys(state: state, type: type)
1457
+ config_set('route_map', 'set_metric_type', @set_args)
1458
+ end
1459
+
1460
+ def default_set_metric_type
1461
+ config_get_default('route_map', 'set_metric_type')
1462
+ end
1463
+
1464
+ def set_nssa_only
1465
+ config_get('route_map', 'set_nssa_only', @get_args)
1466
+ end
1467
+
1468
+ def set_nssa_only=(val)
1469
+ state = val ? '' : 'no'
1470
+ set_args_keys(state: state)
1471
+ config_set('route_map', 'set_nssa_only', @set_args)
1472
+ end
1473
+
1474
+ def default_set_nssa_only
1475
+ config_get_default('route_map', 'set_nssa_only')
1476
+ end
1477
+
1478
+ def set_origin
1479
+ config_get('route_map', 'set_origin', @get_args)
1480
+ end
1481
+
1482
+ def set_origin=(val)
1483
+ state = val ? '' : 'no'
1484
+ origin = val ? val : ''
1485
+ set_args_keys(state: state, origin: origin)
1486
+ config_set('route_map', 'set_origin', @set_args)
1487
+ end
1488
+
1489
+ def default_set_origin
1490
+ config_get_default('route_map', 'set_origin')
1491
+ end
1492
+
1493
+ def set_path_selection
1494
+ config_get('route_map', 'set_path_selection', @get_args)
1495
+ end
1496
+
1497
+ def set_path_selection=(val)
1498
+ state = val ? '' : 'no'
1499
+ set_args_keys(state: state)
1500
+ config_set('route_map', 'set_path_selection', @set_args)
1501
+ end
1502
+
1503
+ def default_set_path_selection
1504
+ config_get_default('route_map', 'set_path_selection')
1505
+ end
1506
+
1507
+ def set_tag
1508
+ config_get('route_map', 'set_tag', @get_args)
1509
+ end
1510
+
1511
+ def set_tag=(val)
1512
+ state = val ? '' : 'no'
1513
+ tag = val ? val : ''
1514
+ set_args_keys(state: state, tag: tag)
1515
+ config_set('route_map', 'set_tag', @set_args)
1516
+ end
1517
+
1518
+ def default_set_tag
1519
+ config_get_default('route_map', 'set_tag')
1520
+ end
1521
+
1522
+ def set_vrf
1523
+ vrf = config_get('route_map', 'set_vrf', @get_args)
1524
+ vrf == 'default' ? 'default_vrf' : vrf
1525
+ end
1526
+
1527
+ def set_vrf=(val)
1528
+ state = val ? '' : 'no'
1529
+ vrf = val ? val : ''
1530
+ vrf = vrf == 'default_vrf' ? 'default' : vrf
1531
+ set_args_keys(state: state, vrf: vrf)
1532
+ config_set('route_map', 'set_vrf', @set_args)
1533
+ end
1534
+
1535
+ def default_set_vrf
1536
+ config_get_default('route_map', 'set_vrf')
1537
+ end
1538
+
1539
+ def set_weight
1540
+ config_get('route_map', 'set_weight', @get_args)
1541
+ end
1542
+
1543
+ def set_weight=(val)
1544
+ state = val ? '' : 'no'
1545
+ weight = val ? val : ''
1546
+ set_args_keys(state: state, weight: weight)
1547
+ config_set('route_map', 'set_weight', @set_args)
1548
+ end
1549
+
1550
+ def default_set_weight
1551
+ config_get_default('route_map', 'set_weight')
1552
+ end
1553
+
1554
+ # set metric 44 55 66 77 88
1555
+ # set metric +33
1556
+ def set_metric_get
1557
+ hash = {}
1558
+ hash[:additive] = false
1559
+ hash[:bandwidth] = false
1560
+ hash[:delay] = false
1561
+ hash[:reliability] = false
1562
+ hash[:effective_bandwidth] = false
1563
+ hash[:mtu] = false
1564
+ str = config_get('route_map', 'set_metric', @get_args)
1565
+ return hash if str.nil?
1566
+ arr = str.split
1567
+ hash[:additive] = true if arr[0].include?('+')
1568
+ hash[:bandwidth] = arr[0].delete('+').to_i
1569
+ return hash if arr.size == 1
1570
+ hash[:delay] = arr[1].to_i
1571
+ hash[:reliability] = arr[2].to_i
1572
+ hash[:effective_bandwidth] = arr[3].to_i
1573
+ hash[:mtu] = arr[4].to_i
1574
+ hash
1575
+ end
1576
+
1577
+ def set_metric_set(plus, bndw, del, reliability, eff_bw, mtu)
1578
+ set_args_keys(state: 'no', additive: '', bw: '', delay: '',
1579
+ rel: '', eff: '', mtu: '')
1580
+ config_set('route_map', 'set_metric', @set_args)
1581
+ return unless bndw
1582
+ additive = plus ? '+' : ''
1583
+ bw = bndw ? bndw : ''
1584
+ delay = del ? del : ''
1585
+ rel = reliability ? reliability : ''
1586
+ eff = eff_bw ? eff_bw : ''
1587
+ lmtu = mtu ? mtu : ''
1588
+ set_args_keys(state: '', additive: additive, bw: bw, delay: delay,
1589
+ rel: rel, eff: eff, mtu: lmtu)
1590
+ config_set('route_map', 'set_metric', @set_args)
1591
+ end
1592
+
1593
+ def set_metric_additive
1594
+ hash = set_metric_get
1595
+ hash[:additive]
1596
+ end
1597
+
1598
+ def default_set_metric_additive
1599
+ config_get_default('route_map', 'set_metric_additive')
1600
+ end
1601
+
1602
+ def set_metric_bandwidth
1603
+ hash = set_metric_get
1604
+ hash[:bandwidth]
1605
+ end
1606
+
1607
+ def default_set_metric_bandwidth
1608
+ config_get_default('route_map', 'set_metric_bandwidth')
1609
+ end
1610
+
1611
+ def set_metric_delay
1612
+ hash = set_metric_get
1613
+ hash[:delay]
1614
+ end
1615
+
1616
+ def default_set_metric_delay
1617
+ config_get_default('route_map', 'set_metric_delay')
1618
+ end
1619
+
1620
+ def set_metric_reliability
1621
+ hash = set_metric_get
1622
+ hash[:reliability]
1623
+ end
1624
+
1625
+ def default_set_metric_reliability
1626
+ config_get_default('route_map', 'set_metric_reliability')
1627
+ end
1628
+
1629
+ def set_metric_effective_bandwidth
1630
+ hash = set_metric_get
1631
+ hash[:effective_bandwidth]
1632
+ end
1633
+
1634
+ def default_set_metric_effective_bandwidth
1635
+ config_get_default('route_map', 'set_metric_effective_bandwidth')
1636
+ end
1637
+
1638
+ def set_metric_mtu
1639
+ hash = set_metric_get
1640
+ hash[:mtu]
1641
+ end
1642
+
1643
+ def default_set_metric_mtu
1644
+ config_get_default('route_map', 'set_metric_mtu')
1645
+ end
1646
+
1647
+ # set dampening 6 22 44 55
1648
+ def set_dampening_get
1649
+ hash = {}
1650
+ hash[:half_life] = false
1651
+ hash[:reuse] = false
1652
+ hash[:suppress] = false
1653
+ hash[:max] = false
1654
+ str = config_get('route_map', 'set_dampening', @get_args)
1655
+ return hash if str.nil?
1656
+ arr = str.split
1657
+ hash[:half_life] = arr[0].to_i
1658
+ hash[:reuse] = arr[1].to_i
1659
+ hash[:suppress] = arr[2].to_i
1660
+ hash[:max] = arr[3].to_i
1661
+ hash
1662
+ end
1663
+
1664
+ def set_dampening_set(half_life, reuse, supp, md)
1665
+ if half_life
1666
+ set_args_keys(state: '', hl: half_life, reuse: reuse, supp: supp,
1667
+ max: md)
1668
+ else
1669
+ set_args_keys(state: 'no', hl: '', reuse: '', supp: '', max: '')
1670
+ end
1671
+ config_set('route_map', 'set_dampening', @set_args)
1672
+ end
1673
+
1674
+ def set_dampening_half_life
1675
+ hash = set_dampening_get
1676
+ hash[:half_life]
1677
+ end
1678
+
1679
+ def default_set_dampening_half_life
1680
+ config_get_default('route_map', 'set_dampening_half_life')
1681
+ end
1682
+
1683
+ def set_dampening_reuse
1684
+ hash = set_dampening_get
1685
+ hash[:reuse]
1686
+ end
1687
+
1688
+ def default_set_dampening_reuse
1689
+ config_get_default('route_map', 'set_dampening_reuse')
1690
+ end
1691
+
1692
+ def set_dampening_suppress
1693
+ hash = set_dampening_get
1694
+ hash[:suppress]
1695
+ end
1696
+
1697
+ def default_set_dampening_suppress
1698
+ config_get_default('route_map', 'set_dampening_suppress')
1699
+ end
1700
+
1701
+ def set_dampening_max_duation
1702
+ hash = set_dampening_get
1703
+ hash[:max]
1704
+ end
1705
+
1706
+ def default_set_dampening_max_duation
1707
+ config_get_default('route_map', 'set_dampening_max_duation')
1708
+ end
1709
+
1710
+ # set distance 1 2 3
1711
+ # set distance 1 2
1712
+ # set distance 1
1713
+ def set_distance_get
1714
+ hash = {}
1715
+ hash[:igp] = false
1716
+ hash[:internal] = false
1717
+ hash[:local] = false
1718
+ str = config_get('route_map', 'set_distance', @get_args)
1719
+ return hash if str.nil?
1720
+ arr = str.split
1721
+ hash[:igp] = arr[0].to_i
1722
+ hash[:internal] = arr[1].to_i if arr[1]
1723
+ hash[:local] = arr[2].to_i if arr[2]
1724
+ hash
1725
+ end
1726
+
1727
+ def set_distance_set(igp, internal, local)
1728
+ state = igp ? '' : 'no'
1729
+ igp_ebgp = igp ? igp : ''
1730
+ int = internal ? internal : ''
1731
+ loc = local ? local : ''
1732
+ set_args_keys(state: state, igp: igp_ebgp, internal: int, local: loc)
1733
+ config_set('route_map', 'set_distance', @set_args)
1734
+ end
1735
+
1736
+ def set_distance_igp_ebgp
1737
+ hash = set_distance_get
1738
+ hash[:igp]
1739
+ end
1740
+
1741
+ def default_set_distance_igp_ebgp
1742
+ config_get_default('route_map', 'set_distance_igp_ebgp')
1743
+ end
1744
+
1745
+ def set_distance_local
1746
+ hash = set_distance_get
1747
+ hash[:local]
1748
+ end
1749
+
1750
+ def default_set_distance_local
1751
+ config_get_default('route_map', 'set_distance_local')
1752
+ end
1753
+
1754
+ def set_distance_internal
1755
+ hash = set_distance_get
1756
+ hash[:internal]
1757
+ end
1758
+
1759
+ def default_set_distance_internal
1760
+ config_get_default('route_map', 'set_distance_internal')
1761
+ end
1762
+
1763
+ def set_as_path_prepend_last_as
1764
+ config_get('route_map', 'set_as_path_prepend_last_as', @get_args)
1765
+ end
1766
+
1767
+ def set_as_path_prepend_last_as=(val)
1768
+ state = val ? '' : 'no'
1769
+ as = val ? val : ''
1770
+ set_args_keys(state: state, as: as)
1771
+ config_set('route_map', 'set_as_path_prepend_last_as', @set_args)
1772
+ end
1773
+
1774
+ def default_set_as_path_prepend_last_as
1775
+ config_get_default('route_map', 'set_as_path_prepend_last_as')
1776
+ end
1777
+
1778
+ def set_as_path_tag
1779
+ config_get('route_map', 'set_as_path_tag', @get_args)
1780
+ end
1781
+
1782
+ def set_as_path_tag=(val)
1783
+ state = val ? '' : 'no'
1784
+ set_args_keys(state: state)
1785
+ config_set('route_map', 'set_as_path_tag', @set_args)
1786
+ end
1787
+
1788
+ def default_set_as_path_tag
1789
+ config_get_default('route_map', 'set_as_path_tag')
1790
+ end
1791
+
1792
+ # set as-path prepend 55.77 44 33.5
1793
+ # set as-path prepend last-as 1
1794
+ def set_as_path_prepend
1795
+ arr = []
1796
+ match = config_get('route_map', 'set_as_path_prepend', @get_args)
1797
+ if arr
1798
+ match.each do |line|
1799
+ next if line.include?('last-as')
1800
+ arr = line.strip.split
1801
+ end
1802
+ end
1803
+ arr
1804
+ end
1805
+
1806
+ def set_as_path_prepend=(list)
1807
+ nstr = ''
1808
+ list.each do |elem|
1809
+ nstr = nstr.concat(elem + ' ')
1810
+ end
1811
+ state = nstr.empty? ? 'no' : ''
1812
+ set_args_keys(state: state, asnum: nstr)
1813
+ config_set('route_map', 'set_as_path_prepend', @set_args)
1814
+ end
1815
+
1816
+ def default_set_as_path_prepend
1817
+ config_get_default('route_map', 'set_as_path_prepend')
1818
+ end
1819
+
1820
+ # set interface Null0
1821
+ def set_interface
1822
+ str = config_get('route_map', 'set_interface', @get_args)
1823
+ str ? str.strip : default_set_interface
1824
+ end
1825
+
1826
+ def set_interface_set(val)
1827
+ cint = set_interface
1828
+ return if cint == val
1829
+ state = val ? '' : 'no'
1830
+ int = val ? val : cint
1831
+ set_args_keys(state: state, int: int)
1832
+ config_set('route_map', 'set_interface', @set_args)
1833
+ end
1834
+
1835
+ def default_set_interface
1836
+ config_get_default('route_map', 'set_interface')
1837
+ end
1838
+
1839
+ def set_ipv4_prefix
1840
+ config_get('route_map', 'set_ipv4_prefix', @get_args)
1841
+ end
1842
+
1843
+ def set_ipv4_prefix=(val)
1844
+ state = val ? '' : 'no'
1845
+ pf = val ? val : set_ipv4_prefix
1846
+ set_args_keys(state: state, pf: pf)
1847
+ config_set('route_map', 'set_ipv4_prefix', @set_args)
1848
+ end
1849
+
1850
+ def default_set_ipv4_prefix
1851
+ config_get_default('route_map', 'set_ipv4_prefix')
1852
+ end
1853
+
1854
+ def set_ipv4_precedence
1855
+ config_get('route_map', 'set_ipv4_precedence', @get_args)
1856
+ end
1857
+
1858
+ def set_ipv4_precedence_set(val)
1859
+ state = val ? '' : 'no'
1860
+ pre = val ? val : ''
1861
+ set_args_keys(state: state, pre: pre)
1862
+ config_set('route_map', 'set_ipv4_precedence', @set_args)
1863
+ end
1864
+
1865
+ def default_set_ipv4_precedence
1866
+ config_get_default('route_map', 'set_ipv4_precedence')
1867
+ end
1868
+
1869
+ # set ip default next-hop 1.1.1.1 2.2.2.2 3.3.3.3
1870
+ def set_ipv4_default_next_hop
1871
+ str = config_get('route_map', 'set_ipv4_default_next_hop', @get_args)
1872
+ return if str.nil?
1873
+ if str.empty?
1874
+ val = default_set_ipv4_default_next_hop
1875
+ else
1876
+ val = str.split
1877
+ val.delete('load-share')
1878
+ end
1879
+ val
1880
+ end
1881
+
1882
+ def set_ipv4_def_next_hop_set(list, share)
1883
+ carr = set_ipv4_default_next_hop
1884
+ fail Cisco::UnsupportedError.new(
1885
+ 'route_map',
1886
+ 'set_ipv4_default_next_hop') if carr.nil?
1887
+ cstr = ''
1888
+ carr.each do |elem|
1889
+ cstr = cstr.concat(elem + ' ')
1890
+ end
1891
+ cstr.concat('load-share')
1892
+ set_args_keys(state: 'no', nh: cstr)
1893
+ # reset the current config
1894
+ config_set('route_map', 'set_ipv4_default_next_hop', @set_args)
1895
+ nstr = ''
1896
+ list.each do |elem|
1897
+ nstr = nstr.concat(elem + ' ')
1898
+ end
1899
+ nstr.concat('load-share') if share
1900
+ return if nstr.empty?
1901
+ set_args_keys(state: '', nh: nstr)
1902
+ config_set('route_map', 'set_ipv4_default_next_hop', @set_args)
1903
+ end
1904
+
1905
+ def default_set_ipv4_default_next_hop
1906
+ config_get_default('route_map', 'set_ipv4_default_next_hop')
1907
+ end
1908
+
1909
+ # set ip default next-hop 1.1.1.1 2.2.2.2 3.3.3.3 load-share
1910
+ # set ip default next-hop load-share
1911
+ def set_ipv4_default_next_hop_load_share
1912
+ match = config_get('route_map', 'set_ipv4_default_next_hop', @get_args)
1913
+ return if match.nil?
1914
+ match.include?('load-share')
1915
+ end
1916
+
1917
+ def default_set_ipv4_default_next_hop_load_share
1918
+ config_get_default('route_map', 'set_ipv4_default_next_hop_load_share')
1919
+ end
1920
+
1921
+ # set ip next-hop 1.1.1.1 2.2.2.2 3.3.3.3
1922
+ def set_ipv4_next_hop
1923
+ arr = config_get('route_map', 'set_ipv4_next_hop', @get_args)
1924
+ val = default_set_ipv4_next_hop
1925
+ arr.each do |str|
1926
+ next if str.empty?
1927
+ next if str.include?('peer-address')
1928
+ next if str.include?('unchanged')
1929
+ next if str.include?('redist-unchanged')
1930
+ val = str.split
1931
+ val.delete('load-share')
1932
+ end
1933
+ val
1934
+ end
1935
+
1936
+ def set_ipv4_next_hop_set(list, share=false)
1937
+ carr = set_ipv4_next_hop
1938
+ cstr = ''
1939
+ carr.each do |elem|
1940
+ cstr = cstr.concat(elem + ' ')
1941
+ end
1942
+ cstr.concat('load-share') unless default_set_ipv4_next_hop_load_share.nil?
1943
+ set_args_keys(state: 'no', nh: cstr)
1944
+ # reset the current config
1945
+ config_set('route_map', 'set_ipv4_next_hop', @set_args) unless
1946
+ cstr.empty?
1947
+ nstr = ''
1948
+ list.each do |elem|
1949
+ nstr = nstr.concat(elem + ' ')
1950
+ end
1951
+ nstr.concat('load-share') if share
1952
+ return if nstr.empty?
1953
+ set_args_keys(state: '', nh: nstr)
1954
+ config_set('route_map', 'set_ipv4_next_hop', @set_args)
1955
+ end
1956
+
1957
+ def default_set_ipv4_next_hop
1958
+ config_get_default('route_map', 'set_ipv4_next_hop')
1959
+ end
1960
+
1961
+ # set ip next-hop 1.1.1.1 2.2.2.2 3.3.3.3 load-share
1962
+ # set ip next-hop load-share
1963
+ def set_ipv4_next_hop_load_share
1964
+ arr = config_get('route_map', 'set_ipv4_next_hop', @get_args)
1965
+ val = default_set_ipv4_next_hop_load_share
1966
+ arr.each do |str|
1967
+ next if str.empty?
1968
+ return true if str.include?('load-share')
1969
+ end
1970
+ val
1971
+ end
1972
+
1973
+ def default_set_ipv4_next_hop_load_share
1974
+ config_get_default('route_map', 'set_ipv4_next_hop_load_share')
1975
+ end
1976
+
1977
+ def set_ipv4_next_hop_peer_addr
1978
+ config_get('route_map', 'set_ipv4_next_hop_peer_addr', @get_args)
1979
+ end
1980
+
1981
+ def set_ipv4_next_hop_peer_addr_set(val)
1982
+ state = val ? '' : 'no'
1983
+ set_args_keys(state: state)
1984
+ config_set('route_map', 'set_ipv4_next_hop_peer_addr', @set_args)
1985
+ end
1986
+
1987
+ def default_set_ipv4_next_hop_peer_addr
1988
+ config_get_default('route_map', 'set_ipv4_next_hop_peer_addr')
1989
+ end
1990
+
1991
+ def set_ipv4_next_hop_redist
1992
+ config_get('route_map', 'set_ipv4_next_hop_redist', @get_args)
1993
+ end
1994
+
1995
+ def set_ipv4_next_hop_redist_set(val)
1996
+ state = val ? '' : 'no'
1997
+ set_args_keys(state: state)
1998
+ config_set('route_map', 'set_ipv4_next_hop_redist', @set_args)
1999
+ end
2000
+
2001
+ def default_set_ipv4_next_hop_redist
2002
+ config_get_default('route_map', 'set_ipv4_next_hop_redist')
2003
+ end
2004
+
2005
+ def set_ipv4_next_hop_unchanged
2006
+ config_get('route_map', 'set_ipv4_next_hop_unchanged', @get_args)
2007
+ end
2008
+
2009
+ def set_ipv4_next_hop_unchanged_set(val)
2010
+ state = val ? '' : 'no'
2011
+ set_args_keys(state: state)
2012
+ config_set('route_map', 'set_ipv4_next_hop_unchanged', @set_args)
2013
+ end
2014
+
2015
+ def default_set_ipv4_next_hop_unchanged
2016
+ config_get_default('route_map', 'set_ipv4_next_hop_unchanged')
2017
+ end
2018
+
2019
+ def set_ipv6_prefix
2020
+ config_get('route_map', 'set_ipv6_prefix', @get_args)
2021
+ end
2022
+
2023
+ def set_ipv6_prefix=(val)
2024
+ state = val ? '' : 'no'
2025
+ pf = val ? val : set_ipv6_prefix
2026
+ set_args_keys(state: state, pf: pf)
2027
+ config_set('route_map', 'set_ipv6_prefix', @set_args)
2028
+ end
2029
+
2030
+ def default_set_ipv6_prefix
2031
+ config_get_default('route_map', 'set_ipv6_prefix')
2032
+ end
2033
+
2034
+ def set_ipv6_precedence
2035
+ config_get('route_map', 'set_ipv6_precedence', @get_args)
2036
+ end
2037
+
2038
+ def set_ipv6_precedence_set(val)
2039
+ state = val ? '' : 'no'
2040
+ pre = val ? val : ''
2041
+ set_args_keys(state: state, pre: pre)
2042
+ config_set('route_map', 'set_ipv6_precedence', @set_args)
2043
+ end
2044
+
2045
+ def default_set_ipv6_precedence
2046
+ config_get_default('route_map', 'set_ipv6_precedence')
2047
+ end
2048
+
2049
+ def set_ip_precedence(v4, v6)
2050
+ set_ipv4_precedence_set(default_set_ipv4_precedence)
2051
+ set_ipv6_precedence_set(default_set_ipv6_precedence)
2052
+ set_ipv4_precedence_set(v4)
2053
+ set_ipv6_precedence_set(v6)
2054
+ end
2055
+
2056
+ # set ipv6 default next-hop 1.1.1.1 2.2.2.2 3.3.3.3
2057
+ def set_ipv6_default_next_hop
2058
+ str = config_get('route_map', 'set_ipv6_default_next_hop', @get_args)
2059
+ return if str.nil?
2060
+ if str.empty?
2061
+ val = default_set_ipv6_default_next_hop
2062
+ else
2063
+ val = str.split
2064
+ val.delete('load-share')
2065
+ end
2066
+ val
2067
+ end
2068
+
2069
+ def set_ipv6_def_next_hop_set(list, share)
2070
+ carr = set_ipv6_default_next_hop
2071
+ fail Cisco::UnsupportedError.new(
2072
+ 'route_map',
2073
+ 'set_ipv6_default_next_hop') if carr.nil?
2074
+ cstr = ''
2075
+ carr.each do |elem|
2076
+ cstr = cstr.concat(elem + ' ')
2077
+ end
2078
+ cstr.concat('load-share')
2079
+ set_args_keys(state: 'no', nh: cstr)
2080
+ # reset the current config
2081
+ config_set('route_map', 'set_ipv6_default_next_hop', @set_args)
2082
+ nstr = ''
2083
+ list.each do |elem|
2084
+ nstr = nstr.concat(elem + ' ')
2085
+ end
2086
+ nstr.concat('load-share') if share
2087
+ return if nstr.empty?
2088
+ set_args_keys(state: '', nh: nstr)
2089
+ config_set('route_map', 'set_ipv6_default_next_hop', @set_args)
2090
+ end
2091
+
2092
+ def default_set_ipv6_default_next_hop
2093
+ config_get_default('route_map', 'set_ipv6_default_next_hop')
2094
+ end
2095
+
2096
+ # set ipv6 default next-hop 1.1.1.1 2.2.2.2 3.3.3.3 load-share
2097
+ # set ipv6 default next-hop load-share
2098
+ def set_ipv6_default_next_hop_load_share
2099
+ match = config_get('route_map', 'set_ipv6_default_next_hop', @get_args)
2100
+ return if match.nil?
2101
+ match.include?('load-share')
2102
+ end
2103
+
2104
+ def default_set_ipv6_default_next_hop_load_share
2105
+ config_get_default('route_map', 'set_ipv6_default_next_hop_load_share')
2106
+ end
2107
+
2108
+ # set ipv6 next-hop 1.1.1.1 2.2.2.2 3.3.3.3
2109
+ def set_ipv6_next_hop
2110
+ arr = config_get('route_map', 'set_ipv6_next_hop', @get_args)
2111
+ val = default_set_ipv6_next_hop
2112
+ arr.each do |str|
2113
+ next if str.empty?
2114
+ next if str.include?('peer-address')
2115
+ next if str.include?('unchanged')
2116
+ next if str.include?('redist-unchanged')
2117
+ val = str.split
2118
+ val.delete('load-share')
2119
+ end
2120
+ val
2121
+ end
2122
+
2123
+ def set_ipv6_next_hop_set(list, share=false)
2124
+ carr = set_ipv6_next_hop
2125
+ cstr = ''
2126
+ carr.each do |elem|
2127
+ cstr = cstr.concat(elem + ' ')
2128
+ end
2129
+ cstr.concat('load-share') unless default_set_ipv6_next_hop_load_share.nil?
2130
+ set_args_keys(state: 'no', nh: cstr)
2131
+ # reset the current config
2132
+ config_set('route_map', 'set_ipv6_next_hop', @set_args) unless
2133
+ cstr.empty?
2134
+ nstr = ''
2135
+ list.each do |elem|
2136
+ nstr = nstr.concat(elem + ' ')
2137
+ end
2138
+ nstr.concat('load-share') if share
2139
+ return if nstr.empty?
2140
+ set_args_keys(state: '', nh: nstr)
2141
+ config_set('route_map', 'set_ipv6_next_hop', @set_args)
2142
+ end
2143
+
2144
+ def default_set_ipv6_next_hop
2145
+ config_get_default('route_map', 'set_ipv6_next_hop')
2146
+ end
2147
+
2148
+ # set ipv6 default next-hop 1.1.1.1 2.2.2.2 3.3.3.3 load-share
2149
+ # set ipv6 default next-hop load-share
2150
+ def set_ipv6_next_hop_load_share
2151
+ arr = config_get('route_map', 'set_ipv6_next_hop', @get_args)
2152
+ val = default_set_ipv6_next_hop_load_share
2153
+ arr.each do |str|
2154
+ next if str.empty?
2155
+ return true if str.include?('load-share')
2156
+ end
2157
+ val
2158
+ end
2159
+
2160
+ def default_set_ipv6_next_hop_load_share
2161
+ config_get_default('route_map', 'set_ipv6_next_hop_load_share')
2162
+ end
2163
+
2164
+ def set_ipv6_next_hop_peer_addr
2165
+ config_get('route_map', 'set_ipv6_next_hop_peer_addr', @get_args)
2166
+ end
2167
+
2168
+ def set_ipv6_next_hop_peer_addr_set(val)
2169
+ state = val ? '' : 'no'
2170
+ set_args_keys(state: state)
2171
+ config_set('route_map', 'set_ipv6_next_hop_peer_addr', @set_args)
2172
+ end
2173
+
2174
+ def default_set_ipv6_next_hop_peer_addr
2175
+ config_get_default('route_map', 'set_ipv6_next_hop_peer_addr')
2176
+ end
2177
+
2178
+ def set_ipv6_next_hop_redist
2179
+ config_get('route_map', 'set_ipv6_next_hop_redist', @get_args)
2180
+ end
2181
+
2182
+ def set_ipv6_next_hop_redist_set(val)
2183
+ state = val ? '' : 'no'
2184
+ set_args_keys(state: state)
2185
+ config_set('route_map', 'set_ipv6_next_hop_redist', @set_args)
2186
+ end
2187
+
2188
+ def default_set_ipv6_next_hop_redist
2189
+ config_get_default('route_map', 'set_ipv6_next_hop_redist')
2190
+ end
2191
+
2192
+ def set_ipv6_next_hop_unchanged
2193
+ config_get('route_map', 'set_ipv6_next_hop_unchanged', @get_args)
2194
+ end
2195
+
2196
+ def set_ipv6_next_hop_unchanged_set(val)
2197
+ state = val ? '' : 'no'
2198
+ set_args_keys(state: state)
2199
+ config_set('route_map', 'set_ipv6_next_hop_unchanged', @set_args)
2200
+ end
2201
+
2202
+ def default_set_ipv6_next_hop_unchanged
2203
+ config_get_default('route_map', 'set_ipv6_next_hop_unchanged')
2204
+ end
2205
+
2206
+ def set_community_additive
2207
+ str = config_get('route_map', 'set_community', @get_args)
2208
+ add = false
2209
+ return add if str.nil?
2210
+ add = true if str.include?('additive') || str == 'set community '
2211
+ add
2212
+ end
2213
+
2214
+ def default_set_community_additive
2215
+ config_get_default('route_map', 'set_community_additive')
2216
+ end
2217
+
2218
+ def set_community_internet
2219
+ str = config_get('route_map', 'set_community', @get_args)
2220
+ str.nil? ? false : str.include?('internet')
2221
+ end
2222
+
2223
+ def default_set_community_internet
2224
+ config_get_default('route_map', 'set_community_internet')
2225
+ end
2226
+
2227
+ def set_community_local_as
2228
+ str = config_get('route_map', 'set_community', @get_args)
2229
+ str.nil? ? false : str.include?('local-AS')
2230
+ end
2231
+
2232
+ def default_set_community_local_as
2233
+ config_get_default('route_map', 'set_community_local_as')
2234
+ end
2235
+
2236
+ def set_community_no_advtertise
2237
+ str = config_get('route_map', 'set_community', @get_args)
2238
+ str.nil? ? false : str.include?('no-advertise')
2239
+ end
2240
+
2241
+ def default_set_community_no_advtertise
2242
+ config_get_default('route_map', 'set_community_no_advtertise')
2243
+ end
2244
+
2245
+ def set_community_no_export
2246
+ str = config_get('route_map', 'set_community', @get_args)
2247
+ str.nil? ? false : str.include?('no-export')
2248
+ end
2249
+
2250
+ def default_set_community_no_export
2251
+ config_get_default('route_map', 'set_community_no_export')
2252
+ end
2253
+
2254
+ def set_community_none
2255
+ str = config_get('route_map', 'set_community', @get_args)
2256
+ str.nil? ? false : str.include?('none')
2257
+ end
2258
+
2259
+ def default_set_community_none
2260
+ config_get_default('route_map', 'set_community_none')
2261
+ end
2262
+
2263
+ def set_community_asn
2264
+ str = config_get('route_map', 'set_community', @get_args)
2265
+ return default_set_community_asn if str.nil? || !str.include?(':')
2266
+ str.sub!('set community', '')
2267
+ str.sub!('internet', '')
2268
+ str.sub!('additive', '')
2269
+ str.sub!('local-AS', '')
2270
+ str.sub!('no-export', '')
2271
+ str.sub!('no-advertise', '')
2272
+ str.split
2273
+ end
2274
+
2275
+ def default_set_community_asn
2276
+ config_get_default('route_map', 'set_community_asn')
2277
+ end
2278
+
2279
+ # set community none
2280
+ # set community (if only additive is configured)
2281
+ # set internet 11:22 22:33 local-AS no-advertise no-export additive
2282
+ # and combinations of the above
2283
+ def set_community_set(none, noadv, noexp, add, local, inter, asn)
2284
+ str = ''
2285
+ # reset first
2286
+ set_args_keys(state: 'no', string: str)
2287
+ config_set('route_map', 'set_community', @set_args)
2288
+ return unless none || noadv || noexp || add ||
2289
+ local || inter || !asn.empty?
2290
+ str.concat('internet ') if inter
2291
+ asn.each do |elem|
2292
+ str.concat(elem + ' ')
2293
+ end
2294
+ str.concat('no-export ') if noexp
2295
+ str.concat('no-advertise ') if noadv
2296
+ str.concat('local-AS ') if local
2297
+ str.concat('additive ') if add
2298
+ str.concat('none') if none
2299
+ set_args_keys(state: '', string: str)
2300
+ config_set('route_map', 'set_community', @set_args)
2301
+ end
2302
+
2303
+ def set_extcommunity_4bytes_additive
2304
+ str = config_get('route_map', 'set_extcommunity_4bytes', @get_args)
2305
+ str.nil? ? false : str.include?('additive')
2306
+ end
2307
+
2308
+ def default_set_extcommunity_4bytes_additive
2309
+ config_get_default('route_map', 'set_extcommunity_4bytes_additive')
2310
+ end
2311
+
2312
+ def set_extcommunity_4bytes_none
2313
+ str = config_get('route_map', 'set_extcommunity_4bytes', @get_args)
2314
+ str.nil? ? false : str.include?('none')
2315
+ end
2316
+
2317
+ def default_set_extcommunity_4bytes_none
2318
+ config_get_default('route_map', 'set_extcommunity_4bytes_none')
2319
+ end
2320
+
2321
+ def set_extcommunity_4bytes_non_transitive
2322
+ str = config_get('route_map', 'set_extcommunity_4bytes', @get_args)
2323
+ return default_set_extcommunity_4bytes_non_transitive if
2324
+ str.nil? || !str.include?('non-transitive')
2325
+ arr = str.split
2326
+ ret_arr = []
2327
+ index = arr.index('non-transitive')
2328
+ while index
2329
+ ret_arr << arr[index + 1]
2330
+ arr.delete_at(index)
2331
+ arr.delete_at(index)
2332
+ index = arr.index('non-transitive')
2333
+ end
2334
+ ret_arr
2335
+ end
2336
+
2337
+ def default_set_extcommunity_4bytes_non_transitive
2338
+ config_get_default('route_map', 'set_extcommunity_4bytes_non_transitive')
2339
+ end
2340
+
2341
+ def set_extcommunity_4bytes_transitive
2342
+ str = config_get('route_map', 'set_extcommunity_4bytes', @get_args)
2343
+ return default_set_extcommunity_4bytes_transitive if str.nil?
2344
+ arr = str.split
2345
+ ret_arr = []
2346
+ index = arr.index('transitive')
2347
+ while index
2348
+ ret_arr << arr[index + 1]
2349
+ arr.delete_at(index)
2350
+ arr.delete_at(index)
2351
+ index = arr.index('transitive')
2352
+ end
2353
+ ret_arr
2354
+ end
2355
+
2356
+ def default_set_extcommunity_4bytes_transitive
2357
+ config_get_default('route_map', 'set_extcommunity_4bytes_transitive')
2358
+ end
2359
+
2360
+ # set extcommunity 4byteas-generic none
2361
+ # set extcommunity 4byteas-generic additive
2362
+ # set extcommunity 4byteas-generic transitive 11:22 transitive 22:33
2363
+ # set extcommunity 4byteas-generic non-transitive 11:22
2364
+ # set extcommunity 4byteas-generic transitive 22:33 non-transitive 11:22
2365
+ def set_extcommunity_4bytes_set(none, transit, non_transit, add)
2366
+ str = ''
2367
+ # reset first
2368
+ set_args_keys(state: 'no', string: str)
2369
+ config_set('route_map', 'set_extcommunity_4bytes', @set_args)
2370
+ return unless none || add || !transit.empty? || !non_transit.empty?
2371
+ str.concat('none') if none
2372
+ transit.each do |elem|
2373
+ str.concat('transitive ' + elem + ' ')
2374
+ end
2375
+ non_transit.each do |elem|
2376
+ str.concat('non-transitive ' + elem + ' ')
2377
+ end
2378
+ str.concat('additive') if add
2379
+ set_args_keys(state: '', string: str)
2380
+ config_set('route_map', 'set_extcommunity_4bytes', @set_args)
2381
+ end
2382
+
2383
+ def set_extcommunity_rt_additive
2384
+ str = config_get('route_map', 'set_extcommunity_rt', @get_args)
2385
+ str.nil? ? false : str.include?('additive')
2386
+ end
2387
+
2388
+ def default_set_extcommunity_rt_additive
2389
+ config_get_default('route_map', 'set_extcommunity_rt_additive')
2390
+ end
2391
+
2392
+ def set_extcommunity_rt_asn
2393
+ str = config_get('route_map', 'set_extcommunity_rt', @get_args)
2394
+ return default_set_extcommunity_rt_asn if str.nil?
2395
+ str.delete!('additive')
2396
+ str.split
2397
+ end
2398
+
2399
+ def default_set_extcommunity_rt_asn
2400
+ config_get_default('route_map', 'set_extcommunity_rt_asn')
2401
+ end
2402
+
2403
+ # set extcommunity rt additive
2404
+ # set extcommunity rt 11:22 12.22.22.22:12 123.256:543
2405
+ # set extcommunity rt 11:22 12.22.22.22:12 123.256:543 additive
2406
+ def set_extcommunity_rt_set(asn, add)
2407
+ str = ''
2408
+ # reset first
2409
+ set_args_keys(state: 'no', string: str)
2410
+ config_set('route_map', 'set_extcommunity_rt', @set_args)
2411
+ return unless add || !asn.empty?
2412
+ asn.each do |elem|
2413
+ str.concat(elem + ' ')
2414
+ end
2415
+ str.concat('additive') if add
2416
+ set_args_keys(state: '', string: str)
2417
+ config_set('route_map', 'set_extcommunity_rt', @set_args)
2418
+ end
2419
+
2420
+ def set_extcommunity_cost_igp
2421
+ str = config_get('route_map', 'set_extcommunity_cost', @get_args)
2422
+ return default_set_extcommunity_cost_igp if
2423
+ str.nil? || !str.include?('igp')
2424
+ arr = str.split
2425
+ ret_arr = []
2426
+ index = arr.index('igp')
2427
+ while index
2428
+ larr = []
2429
+ larr << arr[index + 1]
2430
+ larr << arr[index + 2]
2431
+ ret_arr << larr
2432
+ arr.delete_at(index)
2433
+ arr.delete_at(index)
2434
+ arr.delete_at(index)
2435
+ index = arr.index('igp')
2436
+ end
2437
+ ret_arr
2438
+ end
2439
+
2440
+ def default_set_extcommunity_cost_igp
2441
+ config_get_default('route_map', 'set_extcommunity_cost_igp')
2442
+ end
2443
+
2444
+ def set_extcommunity_cost_pre_bestpath
2445
+ str = config_get('route_map', 'set_extcommunity_cost', @get_args)
2446
+ return default_set_extcommunity_cost_pre_bestpath if
2447
+ str.nil? || !str.include?('pre-bestpath')
2448
+ arr = str.split
2449
+ ret_arr = []
2450
+ index = arr.index('pre-bestpath')
2451
+ while index
2452
+ larr = []
2453
+ larr << arr[index + 1]
2454
+ larr << arr[index + 2]
2455
+ ret_arr << larr
2456
+ arr.delete_at(index)
2457
+ arr.delete_at(index)
2458
+ arr.delete_at(index)
2459
+ index = arr.index('pre-bestpath')
2460
+ end
2461
+ ret_arr
2462
+ end
2463
+
2464
+ def default_set_extcommunity_cost_pre_bestpath
2465
+ config_get_default('route_map', 'set_extcommunity_cost_pre_bestpath')
2466
+ end
2467
+
2468
+ def set_extcommunity_cost_device
2469
+ config_get('route_map', 'set_extcommunity_cost_device', @get_args)
2470
+ end
2471
+
2472
+ # set extcommunity cost igp 0 22 igp 3 23
2473
+ # set extcommunity cost pre-bestpath 1 222 pre-bestpath 2 54
2474
+ # set extcommunity cost pre-bestpath 1 222 pre-bestpath 2 54 igp 0 22
2475
+ def set_extcommunity_cost_set(igp, pre)
2476
+ str = ''
2477
+ # reset first
2478
+ if set_extcommunity_cost_device
2479
+ cpre = set_extcommunity_cost_pre_bestpath
2480
+ cigp = set_extcommunity_cost_igp
2481
+ cpre.each do |id, val|
2482
+ str.concat('pre-bestpath ' + id.to_s + ' ' + val.to_s + ' ')
2483
+ end
2484
+ cigp.each do |id, val|
2485
+ str.concat('igp ' + id.to_s + ' ' + val.to_s + ' ')
2486
+ end
2487
+ end
2488
+ set_args_keys(state: 'no', string: str)
2489
+ config_set('route_map', 'set_extcommunity_cost', @set_args)
2490
+ return if igp.empty? && pre.empty?
2491
+ str = ''
2492
+ pre.each do |id, val|
2493
+ str.concat('pre-bestpath ' + id.to_s + ' ' + val.to_s + ' ')
2494
+ end
2495
+ igp.each do |id, val|
2496
+ str.concat('igp ' + id.to_s + ' ' + val.to_s + ' ')
2497
+ end
2498
+ set_args_keys(state: '', string: str)
2499
+ config_set('route_map', 'set_extcommunity_cost', @set_args)
2500
+ end
2501
+
2502
+ def set_ip_next_hop_reset(attrs)
2503
+ set_interface_set(default_set_interface)
2504
+ v4ls = default_set_ipv4_default_next_hop_load_share
2505
+ set_ipv4_def_next_hop_set(default_set_ipv4_default_next_hop, v4ls) unless
2506
+ default_set_ipv4_default_next_hop.nil?
2507
+ default_set_ipv4_default_next_hop.nil?
2508
+ set_ipv4_next_hop_set(default_set_ipv4_next_hop)
2509
+ set_ipv4_next_hop_peer_addr_set(default_set_ipv4_next_hop_peer_addr)
2510
+ set_ipv4_next_hop_redist_set(default_set_ipv4_next_hop_redist) unless
2511
+ attrs[:v4red].nil?
2512
+ set_ipv4_next_hop_unchanged_set(default_set_ipv4_next_hop_unchanged)
2513
+ v6ls = default_set_ipv4_default_next_hop_load_share
2514
+ set_ipv6_def_next_hop_set(default_set_ipv6_default_next_hop, v6ls) unless
2515
+ default_set_ipv6_default_next_hop.nil?
2516
+ set_ipv6_next_hop_set(default_set_ipv6_next_hop)
2517
+ set_ipv6_next_hop_peer_addr_set(default_set_ipv6_next_hop_peer_addr)
2518
+ set_ipv6_next_hop_redist_set(default_set_ipv6_next_hop_redist) unless
2519
+ attrs[:v6red].nil?
2520
+ set_ipv6_next_hop_unchanged_set(default_set_ipv6_next_hop_unchanged)
2521
+ end
2522
+
2523
+ def set_ip_next_hop_set(attrs)
2524
+ set_ip_next_hop_reset(attrs)
2525
+ set_interface_set(attrs[:intf])
2526
+ set_ipv4_def_next_hop_set(attrs[:v4dnh], attrs[:v4dls]) unless
2527
+ default_set_ipv4_default_next_hop.nil?
2528
+ set_ipv4_next_hop_set(attrs[:v4nh], attrs[:v4ls])
2529
+ set_ipv4_next_hop_peer_addr_set(attrs[:v4peer])
2530
+ set_ipv4_next_hop_redist_set(attrs[:v4red]) unless attrs[:v4red].nil?
2531
+ set_ipv4_next_hop_unchanged_set(attrs[:v4unc])
2532
+ set_ipv6_def_next_hop_set(attrs[:v6dnh], attrs[:v6dls]) unless
2533
+ default_set_ipv6_default_next_hop.nil?
2534
+ set_ipv6_next_hop_set(attrs[:v6nh], attrs[:v6ls])
2535
+ set_ipv6_next_hop_peer_addr_set(attrs[:v6peer])
2536
+ set_ipv6_next_hop_redist_set(attrs[:v6red]) unless attrs[:v6red].nil?
2537
+ set_ipv6_next_hop_unchanged_set(attrs[:v6unc])
2538
+ end
2539
+ end # class
2540
+ end # module