cisco_node_utils_mgx 2.1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +96 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +676 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +10 -0
- data/LICENSE +201 -0
- data/README.md +246 -0
- data/Rakefile +44 -0
- data/SUPPORT.md +3 -0
- data/bin/.rubocop.yml +18 -0
- data/bin/check_metric_limits.rb +109 -0
- data/bin/git/hooks/commit-msg/enforce_style +89 -0
- data/bin/git/hooks/hook_lib +115 -0
- data/bin/git/hooks/hooks-wrapper +38 -0
- data/bin/git/hooks/post-flow-hotfix-start/update-version +24 -0
- data/bin/git/hooks/post-flow-release-finish/update-version +29 -0
- data/bin/git/hooks/post-flow-release-start/update-version +19 -0
- data/bin/git/hooks/post-merge/update-hooks +6 -0
- data/bin/git/hooks/post-rewrite/update-hooks +6 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +25 -0
- data/bin/git/hooks/pre-commit/validate-diffs +45 -0
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/hooks/pre-push/check-changelog +24 -0
- data/bin/git/hooks/pre-push/rubocop +7 -0
- data/bin/git/update-hooks +123 -0
- data/bin/show_running_yang.rb +233 -0
- data/cisco_node_utils.gemspec +41 -0
- data/docs/README-develop-best-practices.md +521 -0
- data/docs/README-develop-node-utils-APIs.md +570 -0
- data/docs/README-maintainers.md +77 -0
- data/docs/README-test-execution.md +57 -0
- data/docs/README-utilities.md +14 -0
- data/docs/agent_files.png +0 -0
- data/docs/cisco_node_utils.yaml.example +36 -0
- data/docs/template-router.rb +123 -0
- data/docs/template-test_router.rb +104 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +18 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +95 -0
- data/lib/cisco_node_utils/aaa_authentication_login_service.rb +138 -0
- data/lib/cisco_node_utils/aaa_authorization_service.rb +156 -0
- data/lib/cisco_node_utils/ace.rb +467 -0
- data/lib/cisco_node_utils/acl.rb +101 -0
- data/lib/cisco_node_utils/banner.rb +63 -0
- data/lib/cisco_node_utils/bfd_global.rb +305 -0
- data/lib/cisco_node_utils/bgp.rb +988 -0
- data/lib/cisco_node_utils/bgp_af.rb +545 -0
- data/lib/cisco_node_utils/bgp_af_aggr_addr.rb +207 -0
- data/lib/cisco_node_utils/bgp_neighbor.rb +527 -0
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +780 -0
- data/lib/cisco_node_utils/bridge_domain.rb +178 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +444 -0
- data/lib/cisco_node_utils/client/client.rb +238 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +395 -0
- data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
- data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
- data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +368 -0
- data/lib/cisco_node_utils/client/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/utils.rb +180 -0
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +590 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +48 -0
- data/lib/cisco_node_utils/cmd_ref/banner.yaml +11 -0
- data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +117 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +383 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +223 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af_aa.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +174 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +236 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +49 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +128 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +55 -0
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_multicast.yaml +12 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_multisite.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_stormcontrol.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +48 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +183 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +126 -0
- data/lib/cisco_node_utils/cmd_ref/hostname.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/hsrp_global.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/images.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +781 -0
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/interface_evpn_multisite.yaml +17 -0
- data/lib/cisco_node_utils/cmd_ref/interface_hsrp_group.yaml +120 -0
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +112 -0
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +87 -0
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/ip_multicast.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
- data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +24 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_auth_key.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +27 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/object_group.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area_vlink.yaml +88 -0
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +43 -0
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +86 -0
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +100 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +19 -0
- data/lib/cisco_node_utils/cmd_ref/route_map.yaml +601 -0
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +84 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +81 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +74 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +57 -0
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +23 -0
- data/lib/cisco_node_utils/cmd_ref/span_session.yaml +65 -0
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +235 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_facility.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/system.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +63 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +64 -0
- data/lib/cisco_node_utils/cmd_ref/upgrade.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +52 -0
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +106 -0
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +233 -0
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +86 -0
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +139 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +114 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/yang.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +68 -0
- data/lib/cisco_node_utils/command_reference.rb +724 -0
- data/lib/cisco_node_utils/configparser_lib.rb +195 -0
- data/lib/cisco_node_utils/constants.rb +40 -0
- data/lib/cisco_node_utils/dhcp_relay_global.rb +302 -0
- data/lib/cisco_node_utils/dns_domain.rb +93 -0
- data/lib/cisco_node_utils/domain_name.rb +82 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +110 -0
- data/lib/cisco_node_utils/evpn_multicast.rb +66 -0
- data/lib/cisco_node_utils/evpn_multisite.rb +96 -0
- data/lib/cisco_node_utils/evpn_stormcontrol.rb +84 -0
- data/lib/cisco_node_utils/evpn_vni.rb +159 -0
- data/lib/cisco_node_utils/exceptions.rb +140 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +405 -0
- data/lib/cisco_node_utils/fabricpath_topology.rb +137 -0
- data/lib/cisco_node_utils/feature.rb +377 -0
- data/lib/cisco_node_utils/hostname.rb +62 -0
- data/lib/cisco_node_utils/hsrp_global.rb +97 -0
- data/lib/cisco_node_utils/interface.rb +2128 -0
- data/lib/cisco_node_utils/interface_channel_group.rb +142 -0
- data/lib/cisco_node_utils/interface_evpn_multisite.rb +72 -0
- data/lib/cisco_node_utils/interface_hsrp_group.rb +557 -0
- data/lib/cisco_node_utils/interface_ospf.rb +378 -0
- data/lib/cisco_node_utils/interface_portchannel.rb +180 -0
- data/lib/cisco_node_utils/interface_service_vni.rb +132 -0
- data/lib/cisco_node_utils/ip_multicast.rb +90 -0
- data/lib/cisco_node_utils/itd_device_group.rb +228 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +511 -0
- data/lib/cisco_node_utils/logger.rb +78 -0
- data/lib/cisco_node_utils/name_server.rb +64 -0
- data/lib/cisco_node_utils/node.rb +443 -0
- data/lib/cisco_node_utils/node_util.rb +111 -0
- data/lib/cisco_node_utils/ntp_auth_key.rb +67 -0
- data/lib/cisco_node_utils/ntp_config.rb +83 -0
- data/lib/cisco_node_utils/ntp_server.rb +86 -0
- data/lib/cisco_node_utils/object_group.rb +75 -0
- data/lib/cisco_node_utils/object_group_entry.rb +143 -0
- data/lib/cisco_node_utils/overlay_global.rb +142 -0
- data/lib/cisco_node_utils/pim.rb +131 -0
- data/lib/cisco_node_utils/pim_group_list.rb +109 -0
- data/lib/cisco_node_utils/pim_rp_address.rb +103 -0
- data/lib/cisco_node_utils/platform.rb +217 -0
- data/lib/cisco_node_utils/portchannel_global.rb +347 -0
- data/lib/cisco_node_utils/radius_global.rb +165 -0
- data/lib/cisco_node_utils/radius_server.rb +421 -0
- data/lib/cisco_node_utils/radius_server_group.rb +117 -0
- data/lib/cisco_node_utils/route_map.rb +2540 -0
- data/lib/cisco_node_utils/router_ospf.rb +77 -0
- data/lib/cisco_node_utils/router_ospf_area.rb +416 -0
- data/lib/cisco_node_utils/router_ospf_area_vlink.rb +313 -0
- data/lib/cisco_node_utils/router_ospf_vrf.rb +342 -0
- data/lib/cisco_node_utils/snmp_notification_receiver.rb +176 -0
- data/lib/cisco_node_utils/snmpcommunity.rb +109 -0
- data/lib/cisco_node_utils/snmpgroup.rb +54 -0
- data/lib/cisco_node_utils/snmpnotification.rb +57 -0
- data/lib/cisco_node_utils/snmpserver.rb +132 -0
- data/lib/cisco_node_utils/snmpuser.rb +403 -0
- data/lib/cisco_node_utils/span_session.rb +149 -0
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_facility.rb +64 -0
- data/lib/cisco_node_utils/syslog_server.rb +146 -0
- data/lib/cisco_node_utils/syslog_settings.rb +174 -0
- data/lib/cisco_node_utils/tacacs_global.rb +137 -0
- data/lib/cisco_node_utils/tacacs_server.rb +173 -0
- data/lib/cisco_node_utils/tacacs_server_group.rb +149 -0
- data/lib/cisco_node_utils/tacacs_server_host.rb +216 -0
- data/lib/cisco_node_utils/upgrade.rb +122 -0
- data/lib/cisco_node_utils/vdc.rb +118 -0
- data/lib/cisco_node_utils/version.rb +21 -0
- data/lib/cisco_node_utils/vlan.rb +301 -0
- data/lib/cisco_node_utils/vpc.rb +466 -0
- data/lib/cisco_node_utils/vrf.rb +192 -0
- data/lib/cisco_node_utils/vrf_af.rb +327 -0
- data/lib/cisco_node_utils/vtp.rb +125 -0
- data/lib/cisco_node_utils/vxlan_vtep.rb +286 -0
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +331 -0
- data/lib/cisco_node_utils/yang.rb +160 -0
- data/lib/cisco_node_utils/yum.rb +213 -0
- data/lib/cisco_node_utils.rb +21 -0
- data/lib/minitest/environment_plugin.rb +31 -0
- data/lib/minitest/log_level_plugin.rb +41 -0
- data/spec/client_spec.rb +7 -0
- data/spec/environment_spec.rb +384 -0
- data/spec/grpc_client_spec.rb +23 -0
- data/spec/isolate/all_clients_spec.rb +9 -0
- data/spec/isolate/grpc_only_spec.rb +16 -0
- data/spec/isolate/no_clients_spec.rb +26 -0
- data/spec/isolate/nxapi_only_spec.rb +16 -0
- data/spec/nxapi_client_spec.rb +42 -0
- data/spec/schema.yaml +82 -0
- data/spec/shared_examples_for_clients.rb +14 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/whitespace_spec.rb +10 -0
- data/spec/yaml_spec.rb +42 -0
- data/tests/.rubocop.yml +18 -0
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +243 -0
- data/tests/ciscotest.rb +577 -0
- data/tests/cmd_config.yaml +75 -0
- data/tests/cmd_config_invalid.yaml +16 -0
- data/tests/n9000_sample-1.0.0-7.0.3.x86_64.rpm +0 -0
- data/tests/noop.rb +7 -0
- data/tests/platform_info.rb +63 -0
- data/tests/tacacs_server.yaml.example +6 -0
- data/tests/test_aaa_authentication_login.rb +243 -0
- data/tests/test_aaa_authentication_login_service.rb +761 -0
- data/tests/test_aaa_authorization_service.rb +874 -0
- data/tests/test_ace.rb +304 -0
- data/tests/test_acl.rb +185 -0
- data/tests/test_banner.rb +85 -0
- data/tests/test_bfd_global.rb +272 -0
- data/tests/test_bgp_af.rb +875 -0
- data/tests/test_bgp_af_aa.rb +108 -0
- data/tests/test_bgp_neighbor.rb +596 -0
- data/tests/test_bgp_neighbor_af.rb +781 -0
- data/tests/test_bridge_domain.rb +198 -0
- data/tests/test_bridge_domain_vni.rb +109 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_cmn_utils.rb +76 -0
- data/tests/test_command_config.rb +206 -0
- data/tests/test_command_reference.rb +669 -0
- data/tests/test_dhcp_relay_global.rb +286 -0
- data/tests/test_dns_domain.rb +123 -0
- data/tests/test_domain_name.rb +96 -0
- data/tests/test_encapsulation.rb +75 -0
- data/tests/test_evpn_multicast.rb +65 -0
- data/tests/test_evpn_multisite.rb +70 -0
- data/tests/test_evpn_stormcontrol.rb +56 -0
- data/tests/test_evpn_vni.rb +131 -0
- data/tests/test_fabricpath_global.rb +246 -0
- data/tests/test_fabricpath_topology.rb +77 -0
- data/tests/test_feature.rb +272 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_hostname.rb +64 -0
- data/tests/test_hsrp_global.rb +79 -0
- data/tests/test_interface.rb +1958 -0
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +131 -0
- data/tests/test_interface_evpn_multisite.rb +94 -0
- data/tests/test_interface_hsrp.rb +134 -0
- data/tests/test_interface_hsrp_group.rb +570 -0
- data/tests/test_interface_ospf.rb +820 -0
- data/tests/test_interface_portchannel.rb +135 -0
- data/tests/test_interface_private_vlan.rb +365 -0
- data/tests/test_interface_service_vni.rb +203 -0
- data/tests/test_interface_svi.rb +210 -0
- data/tests/test_interface_switchport.rb +468 -0
- data/tests/test_ip_multicast.rb +80 -0
- data/tests/test_itd_device_group.rb +145 -0
- data/tests/test_itd_device_group_node.rb +199 -0
- data/tests/test_itd_service.rb +314 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +94 -0
- data/tests/test_node.rb +50 -0
- data/tests/test_node_ext.rb +406 -0
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_auth_key.rb +77 -0
- data/tests/test_ntp_config.rb +100 -0
- data/tests/test_ntp_server.rb +146 -0
- data/tests/test_nxapi.rb +236 -0
- data/tests/test_object_group.rb +122 -0
- data/tests/test_overlay_global.rb +108 -0
- data/tests/test_pim.rb +203 -0
- data/tests/test_pim_group_list.rb +147 -0
- data/tests/test_pim_rp_address.rb +155 -0
- data/tests/test_platform.rb +254 -0
- data/tests/test_portchannel_global.rb +322 -0
- data/tests/test_radius_global.rb +108 -0
- data/tests/test_radius_server.rb +377 -0
- data/tests/test_radius_server_group.rb +151 -0
- data/tests/test_route_map.rb +1479 -0
- data/tests/test_router_bgp.rb +1325 -0
- data/tests/test_router_ospf.rb +56 -0
- data/tests/test_router_ospf_area.rb +433 -0
- data/tests/test_router_ospf_area_vlink.rb +298 -0
- data/tests/test_router_ospf_vrf.rb +690 -0
- data/tests/test_snmp_notification_receiver.rb +169 -0
- data/tests/test_snmpcommunity.rb +422 -0
- data/tests/test_snmpgroup.rb +71 -0
- data/tests/test_snmpnotification.rb +91 -0
- data/tests/test_snmpserver.rb +251 -0
- data/tests/test_snmpuser.rb +666 -0
- data/tests/test_span_session.rb +155 -0
- data/tests/test_stp_global.rb +575 -0
- data/tests/test_syslog_facility.rb +80 -0
- data/tests/test_syslog_server.rb +119 -0
- data/tests/test_syslog_settings.rb +123 -0
- data/tests/test_tacacs_global.rb +109 -0
- data/tests/test_tacacs_server.rb +436 -0
- data/tests/test_tacacs_server_group.rb +434 -0
- data/tests/test_tacacs_server_host.rb +427 -0
- data/tests/test_upgrade.rb +105 -0
- data/tests/test_vdc.rb +64 -0
- data/tests/test_vlan.rb +386 -0
- data/tests/test_vlan_private.rb +656 -0
- data/tests/test_vpc.rb +548 -0
- data/tests/test_vrf.rb +248 -0
- data/tests/test_vrf_af.rb +288 -0
- data/tests/test_vtp.rb +278 -0
- data/tests/test_vxlan_vtep.rb +327 -0
- data/tests/test_vxlan_vtep_vni.rb +326 -0
- data/tests/test_yang.rb +369 -0
- data/tests/test_yum.rb +109 -0
- data/tests/upgrade_info.yaml.example +3 -0
- data/tests/yum_package.yaml +94 -0
- metadata +534 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NXAPI implementation of Router OSPF Area Virtual-link class
|
|
3
|
+
#
|
|
4
|
+
# June 2016, Sai Chintalapudi
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require_relative 'node_util'
|
|
21
|
+
require_relative 'router_ospf_vrf'
|
|
22
|
+
|
|
23
|
+
module Cisco
|
|
24
|
+
# node_utils class for ospf_area_vlink
|
|
25
|
+
class RouterOspfAreaVirtualLink < NodeUtil
|
|
26
|
+
attr_reader :router, :vrf, :area_id, :vl
|
|
27
|
+
|
|
28
|
+
def initialize(ospf_router, vrf_name, area_id, virtual_link,
|
|
29
|
+
instantiate=true)
|
|
30
|
+
fail TypeError unless ospf_router.is_a?(String)
|
|
31
|
+
fail TypeError unless vrf_name.is_a?(String)
|
|
32
|
+
fail ArgumentError unless ospf_router.length > 0
|
|
33
|
+
fail ArgumentError unless vrf_name.length > 0
|
|
34
|
+
@area_id = area_id.to_s
|
|
35
|
+
fail ArgumentError if @area_id.empty?
|
|
36
|
+
fail ArgumentError unless virtual_link.length > 0
|
|
37
|
+
|
|
38
|
+
# Convert to dot-notation
|
|
39
|
+
@router = ospf_router
|
|
40
|
+
@vrf = vrf_name
|
|
41
|
+
@area_id = IPAddr.new(area_id.to_i, Socket::AF_INET) unless @area_id[/\./]
|
|
42
|
+
@vl = virtual_link
|
|
43
|
+
|
|
44
|
+
set_args_keys_default
|
|
45
|
+
create if instantiate
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.virtual_links
|
|
49
|
+
hash = {}
|
|
50
|
+
RouterOspf.routers.each do |name, _obj|
|
|
51
|
+
# get all virtual_links under default vrf
|
|
52
|
+
links = config_get('ospf_area_vlink', 'virtual_links', name: name)
|
|
53
|
+
unless links.nil?
|
|
54
|
+
hash[name] = {}
|
|
55
|
+
hash[name]['default'] = {}
|
|
56
|
+
links.each do |area, vl|
|
|
57
|
+
hash[name]['default'][area] ||= {}
|
|
58
|
+
hash[name]['default'][area][vl] =
|
|
59
|
+
RouterOspfAreaVirtualLink.new(name, 'default', area, vl, false)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
vrf_ids = config_get('ospf', 'vrf', name: name)
|
|
63
|
+
next if vrf_ids.nil?
|
|
64
|
+
vrf_ids.each do |vrf|
|
|
65
|
+
# get all virtual_links under each vrf
|
|
66
|
+
links = config_get('ospf_area_vlink', 'virtual_links',
|
|
67
|
+
name: name, vrf: vrf)
|
|
68
|
+
next if links.nil?
|
|
69
|
+
hash[name] ||= {}
|
|
70
|
+
hash[name][vrf] = {}
|
|
71
|
+
links.each do |area, vl|
|
|
72
|
+
hash[name][vrf][area] ||= {}
|
|
73
|
+
hash[name][vrf][area][vl] =
|
|
74
|
+
RouterOspfAreaVirtualLink.new(name, vrf, area, vl, false)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
hash
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Helper method to delete @set_args hash keys
|
|
82
|
+
def set_args_keys_default
|
|
83
|
+
@set_args = { name: @router, area: @area_id, vl: @vl }
|
|
84
|
+
@set_args[:vrf] = @vrf unless @vrf == 'default'
|
|
85
|
+
@get_args = @set_args
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# rubocop:disable Style/AccessorMethodName
|
|
89
|
+
def set_args_keys(hash={})
|
|
90
|
+
set_args_keys_default
|
|
91
|
+
@set_args = @get_args.merge!(hash) unless hash.empty?
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Create one router ospf area virtual-link instance
|
|
95
|
+
def create
|
|
96
|
+
RouterOspfVrf.new(@router, @vrf)
|
|
97
|
+
set_args_keys(state: '')
|
|
98
|
+
config_set('ospf_area_vlink', 'virtual_links', @set_args)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def destroy
|
|
102
|
+
return unless Feature.ospf_enabled?
|
|
103
|
+
set_args_keys(state: 'no')
|
|
104
|
+
config_set('ospf_area_vlink', 'virtual_links', @set_args)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def ==(other)
|
|
108
|
+
(ospf_router == other.ospf_router) &&
|
|
109
|
+
(vrf_name == other.vrf_name) && (area_id == other.area_id) &&
|
|
110
|
+
(vl == other.vl)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
########################################################
|
|
114
|
+
# PROPERTIES #
|
|
115
|
+
########################################################
|
|
116
|
+
|
|
117
|
+
# CLI can be either of the following or none
|
|
118
|
+
# authentication
|
|
119
|
+
# authentication message-digest
|
|
120
|
+
# authentication null
|
|
121
|
+
def authentication
|
|
122
|
+
auth = config_get('ospf_area_vlink', 'authentication', @get_args)
|
|
123
|
+
return default_authentication unless auth
|
|
124
|
+
if auth.include?('message-digest')
|
|
125
|
+
return 'md5'
|
|
126
|
+
elsif auth.include?('null')
|
|
127
|
+
return 'null'
|
|
128
|
+
else
|
|
129
|
+
return 'cleartext'
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def authentication=(val)
|
|
134
|
+
state = val ? '' : 'no'
|
|
135
|
+
if val.to_s == 'md5'
|
|
136
|
+
auth = 'message-digest'
|
|
137
|
+
elsif val.to_s == 'null'
|
|
138
|
+
auth = 'null'
|
|
139
|
+
else
|
|
140
|
+
auth = ''
|
|
141
|
+
end
|
|
142
|
+
set_args_keys(state: state, auth: auth)
|
|
143
|
+
config_set('ospf_area_vlink', 'authentication', @set_args)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def default_authentication
|
|
147
|
+
config_get_default('ospf_area_vlink', 'authentication')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def auth_key_chain
|
|
151
|
+
config_get('ospf_area_vlink', 'auth_key_chain', @get_args)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def auth_key_chain=(val)
|
|
155
|
+
state = val ? '' : 'no'
|
|
156
|
+
id = val ? val : ''
|
|
157
|
+
set_args_keys(state: state, key_id: id)
|
|
158
|
+
config_set('ospf_area_vlink', 'auth_key_chain', @set_args)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def default_auth_key_chain
|
|
162
|
+
config_get_default('ospf_area_vlink', 'auth_key_chain')
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def authentication_key_encryption_type
|
|
166
|
+
Encryption.cli_to_symbol(
|
|
167
|
+
config_get('ospf_area_vlink', 'authentication_key_enc_type', @get_args))
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def default_authentication_key_encryption_type
|
|
171
|
+
Encryption.cli_to_symbol(
|
|
172
|
+
config_get_default('ospf_area_vlink', 'authentication_key_enc_type'))
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def authentication_key_password
|
|
176
|
+
config_get('ospf_area_vlink', 'authentication_key_password', @get_args)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def default_authentication_key_password
|
|
180
|
+
config_get_default('ospf_area_vlink', 'authentication_key_password')
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# example CLI:
|
|
184
|
+
# authentication-key 3 3109a60f51374a0d
|
|
185
|
+
# To remove the authentication-key altogether,
|
|
186
|
+
# set the password to empty string
|
|
187
|
+
def authentication_key_set(enctype, pw)
|
|
188
|
+
state = pw.empty? ? 'no' : ''
|
|
189
|
+
enctype = pw.empty? ? '' : Encryption.symbol_to_cli(enctype)
|
|
190
|
+
set_args_keys(state: state, enctype: enctype, password: pw)
|
|
191
|
+
config_set('ospf_area_vlink', 'authentication_key_set', @set_args)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def message_digest_algorithm_type
|
|
195
|
+
config_get('ospf_area_vlink', 'message_digest_key_alg_type',
|
|
196
|
+
@get_args).to_sym
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def default_message_digest_algorithm_type
|
|
200
|
+
config_get_default('ospf_area_vlink',
|
|
201
|
+
'message_digest_key_alg_type').to_sym
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def message_digest_encryption_type
|
|
205
|
+
Encryption.cli_to_symbol(
|
|
206
|
+
config_get('ospf_area_vlink', 'message_digest_key_enc_type', @get_args))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def default_message_digest_encryption_type
|
|
210
|
+
Encryption.cli_to_symbol(
|
|
211
|
+
config_get_default('ospf_area_vlink', 'message_digest_key_enc_type'))
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def message_digest_key_id
|
|
215
|
+
config_get('ospf_area_vlink', 'message_digest_key_id', @get_args)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def default_message_digest_key_id
|
|
219
|
+
config_get_default('ospf_area_vlink', 'message_digest_key_id')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def message_digest_password
|
|
223
|
+
config_get('ospf_area_vlink', 'message_digest_key_password', @get_args)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def default_message_digest_password
|
|
227
|
+
config_get_default('ospf_area_vlink', 'message_digest_key_password')
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# example CLI:
|
|
231
|
+
# message-digest-key 39 md5 7 046E1803362E595C260E0B240619050A2D
|
|
232
|
+
# To remove the message-digest-key altogether,
|
|
233
|
+
# set the password to empty string
|
|
234
|
+
def message_digest_key_set(keyid, algtype, enctype, pw)
|
|
235
|
+
return if pw.empty? && message_digest_password.empty?
|
|
236
|
+
# To remove the configuration, the entire previous
|
|
237
|
+
# configuration must be given with 'no' cmd
|
|
238
|
+
state = pw.empty? ? 'no' : ''
|
|
239
|
+
algtype = pw.empty? ? message_digest_algorithm_type : algtype.to_s
|
|
240
|
+
if pw.empty?
|
|
241
|
+
enctype = Encryption.symbol_to_cli(
|
|
242
|
+
message_digest_encryption_type.to_sym)
|
|
243
|
+
else
|
|
244
|
+
enctype = Encryption.symbol_to_cli(enctype)
|
|
245
|
+
end
|
|
246
|
+
keyid = pw.empty? ? message_digest_key_id : keyid
|
|
247
|
+
pw = pw.empty? ? message_digest_password : pw
|
|
248
|
+
set_args_keys(state: state, keyid: keyid, algtype: algtype,
|
|
249
|
+
enctype: enctype, password: pw)
|
|
250
|
+
config_set('ospf_area_vlink', 'message_digest_key_set', @set_args)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def dead_interval
|
|
254
|
+
config_get('ospf_area_vlink', 'dead_interval', @get_args)
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def dead_interval=(val)
|
|
258
|
+
state = val == default_dead_interval ? 'no' : ''
|
|
259
|
+
interval = val == default_dead_interval ? '' : val
|
|
260
|
+
set_args_keys(state: state, interval: interval)
|
|
261
|
+
config_set('ospf_area_vlink', 'dead_interval', @set_args)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def default_dead_interval
|
|
265
|
+
config_get_default('ospf_area_vlink', 'dead_interval')
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def hello_interval
|
|
269
|
+
config_get('ospf_area_vlink', 'hello_interval', @get_args)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def hello_interval=(val)
|
|
273
|
+
state = val == default_hello_interval ? 'no' : ''
|
|
274
|
+
interval = val == default_hello_interval ? '' : val
|
|
275
|
+
set_args_keys(state: state, interval: interval)
|
|
276
|
+
config_set('ospf_area_vlink', 'hello_interval', @set_args)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def default_hello_interval
|
|
280
|
+
config_get_default('ospf_area_vlink', 'hello_interval')
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def retransmit_interval
|
|
284
|
+
config_get('ospf_area_vlink', 'retransmit_interval', @get_args)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def retransmit_interval=(val)
|
|
288
|
+
state = val == default_retransmit_interval ? 'no' : ''
|
|
289
|
+
interval = val == default_retransmit_interval ? '' : val
|
|
290
|
+
set_args_keys(state: state, interval: interval)
|
|
291
|
+
config_set('ospf_area_vlink', 'retransmit_interval', @set_args)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def default_retransmit_interval
|
|
295
|
+
config_get_default('ospf_area_vlink', 'retransmit_interval')
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def transmit_delay
|
|
299
|
+
config_get('ospf_area_vlink', 'transmit_delay', @get_args)
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
def transmit_delay=(val)
|
|
303
|
+
state = val == default_transmit_delay ? 'no' : ''
|
|
304
|
+
delay = val == default_transmit_delay ? '' : val
|
|
305
|
+
set_args_keys(state: state, delay: delay)
|
|
306
|
+
config_set('ospf_area_vlink', 'transmit_delay', @set_args)
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def default_transmit_delay
|
|
310
|
+
config_get_default('ospf_area_vlink', 'transmit_delay')
|
|
311
|
+
end
|
|
312
|
+
end # class
|
|
313
|
+
end # module
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# Mike Wiebe, March 2015
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require_relative 'node_util'
|
|
18
|
+
require_relative 'router_ospf'
|
|
19
|
+
|
|
20
|
+
module Cisco
|
|
21
|
+
# RouterOspfVrf - node utility class for per-VRF OSPF config management
|
|
22
|
+
class RouterOspfVrf < NodeUtil
|
|
23
|
+
attr_reader :name, :parent
|
|
24
|
+
|
|
25
|
+
OSPF_AUTO_COST = {
|
|
26
|
+
mbps: 'Mbps',
|
|
27
|
+
gbps: 'Gbps',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
OSPF_LOG_ADJACENCY = {
|
|
31
|
+
none: 'none',
|
|
32
|
+
log: '',
|
|
33
|
+
detail: 'detail',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def initialize(router, name, instantiate=true)
|
|
37
|
+
fail TypeError if router.nil?
|
|
38
|
+
fail TypeError if name.nil?
|
|
39
|
+
fail ArgumentError unless router.length > 0
|
|
40
|
+
fail ArgumentError unless name.length > 0
|
|
41
|
+
@router = router
|
|
42
|
+
@name = name
|
|
43
|
+
@parent = {}
|
|
44
|
+
set_args_keys_default
|
|
45
|
+
|
|
46
|
+
create if instantiate
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Create a hash of all router ospf vrf instances
|
|
50
|
+
def self.vrfs
|
|
51
|
+
hash_final = {}
|
|
52
|
+
RouterOspf.routers.each do |instance|
|
|
53
|
+
name = instance[0]
|
|
54
|
+
vrf_ids = config_get('ospf', 'vrf', name: name)
|
|
55
|
+
hash_tmp = {
|
|
56
|
+
name => { 'default' => RouterOspfVrf.new(name, 'default', false) }
|
|
57
|
+
}
|
|
58
|
+
unless vrf_ids.nil?
|
|
59
|
+
vrf_ids.each do |vrf|
|
|
60
|
+
hash_tmp[name][vrf] = RouterOspfVrf.new(name, vrf, false)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
hash_final.merge!(hash_tmp)
|
|
64
|
+
end
|
|
65
|
+
hash_final
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Create one router ospf vrf instance
|
|
69
|
+
def create
|
|
70
|
+
@parent = RouterOspf.new(@router)
|
|
71
|
+
config_set('ospf', 'vrf',
|
|
72
|
+
name: @router, state: '', vrf: @name) if @name != 'default'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Destroy one router ospf vrf instance
|
|
76
|
+
def destroy
|
|
77
|
+
fail RuntimeError if @name == 'default'
|
|
78
|
+
config_set('ospf', 'vrf', name: @router, state: 'no', vrf: @name)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Helper method to delete @set_args hash keys
|
|
82
|
+
def delete_set_args_keys(list)
|
|
83
|
+
list.each { |key| @set_args.delete(key) }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Helper methods to delete @set_args hash keys
|
|
88
|
+
#
|
|
89
|
+
def set_args_keys_default
|
|
90
|
+
keys = { name: @router }
|
|
91
|
+
keys[:vrf] = @name unless @name == 'default'
|
|
92
|
+
@get_args = @set_args = keys
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_args_keys(hash={}) # rubocop:disable Style/AccessorMethodName
|
|
96
|
+
set_args_keys_default
|
|
97
|
+
@set_args = @get_args.merge!(hash) unless hash.empty?
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
########################################################
|
|
101
|
+
# PROPERTIES #
|
|
102
|
+
########################################################
|
|
103
|
+
|
|
104
|
+
def auto_cost
|
|
105
|
+
match = config_get('ospf', 'auto_cost', @get_args)
|
|
106
|
+
return default_auto_cost if match.nil?
|
|
107
|
+
if match.last.nil?
|
|
108
|
+
[match.first.to_i, OSPF_AUTO_COST[:mbps]]
|
|
109
|
+
else
|
|
110
|
+
[match.first.to_i, match.last]
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def auto_cost_set(cost, type)
|
|
115
|
+
@set_args[:cost] = cost
|
|
116
|
+
@set_args[:type] = OSPF_AUTO_COST[type]
|
|
117
|
+
config_set('ospf', 'auto_cost', @set_args)
|
|
118
|
+
delete_set_args_keys([:cost, :type])
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def default_auto_cost
|
|
122
|
+
config_get_default('ospf', 'auto_cost')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def bfd
|
|
126
|
+
config_get('ospf', 'bfd', @get_args)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def bfd=(state)
|
|
130
|
+
return if state == bfd
|
|
131
|
+
no_cmd = (state ? '' : 'no')
|
|
132
|
+
@set_args[:state] = no_cmd
|
|
133
|
+
Feature.bfd_enable
|
|
134
|
+
config_set('ospf', 'bfd', @set_args)
|
|
135
|
+
delete_set_args_keys([:state])
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def default_bfd
|
|
139
|
+
config_get_default('ospf', 'bfd')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def default_metric
|
|
143
|
+
config_get('ospf', 'default_metric', @get_args)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def default_metric=(metric)
|
|
147
|
+
if metric == default_default_metric
|
|
148
|
+
@set_args[:state] = 'no'
|
|
149
|
+
@set_args[:metric] = ''
|
|
150
|
+
else
|
|
151
|
+
@set_args[:state] = ''
|
|
152
|
+
@set_args[:metric] = metric
|
|
153
|
+
end
|
|
154
|
+
config_set('ospf', 'default_metric', @set_args)
|
|
155
|
+
delete_set_args_keys([:state, :metric])
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def default_default_metric
|
|
159
|
+
config_get_default('ospf', 'default_metric')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def log_adjacency
|
|
163
|
+
match = config_get('ospf', 'log_adjacency', @get_args)
|
|
164
|
+
return default_log_adjacency if match.nil?
|
|
165
|
+
match.flatten.last.nil? ? :log : :detail
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def log_adjacency=(type)
|
|
169
|
+
case type
|
|
170
|
+
when :none
|
|
171
|
+
@set_args[:state] = 'no'
|
|
172
|
+
@set_args[:type] = ''
|
|
173
|
+
when :log, :detail
|
|
174
|
+
@set_args[:state] = ''
|
|
175
|
+
@set_args[:type] = OSPF_LOG_ADJACENCY[type]
|
|
176
|
+
end
|
|
177
|
+
config_set('ospf', 'log_adjacency', @set_args)
|
|
178
|
+
delete_set_args_keys([:state, :type])
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def default_log_adjacency
|
|
182
|
+
config_get_default('ospf', 'log_adjacency')
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
#
|
|
186
|
+
# Redistribute
|
|
187
|
+
#
|
|
188
|
+
|
|
189
|
+
# Build an array of all redistribute commands currently on the device
|
|
190
|
+
def redistribute
|
|
191
|
+
c = config_get('ospf', 'redistribute', @get_args)
|
|
192
|
+
c.nil? ? nil : c.each(&:compact!).sort
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# redistribute setter.
|
|
196
|
+
# Process a hash of redistribute commands from delta_add_remove().
|
|
197
|
+
def redistribute=(should)
|
|
198
|
+
delta_hash = Utils.delta_add_remove(should, redistribute)
|
|
199
|
+
return if delta_hash.values.flatten.empty?
|
|
200
|
+
[:add, :remove].each do |action|
|
|
201
|
+
Cisco::Logger.debug("redistribute delta #{@get_args}\n #{action}: " \
|
|
202
|
+
"#{delta_hash[action]}")
|
|
203
|
+
delta_hash[action].each do |protocol, route_map|
|
|
204
|
+
state = (action == :add) ? '' : 'no'
|
|
205
|
+
set_args_keys(state: state, protocol: protocol, route_map: route_map)
|
|
206
|
+
config_set('ospf', 'redistribute', @set_args)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def default_redistribute
|
|
212
|
+
config_get_default('ospf', 'redistribute')
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def router_id
|
|
216
|
+
config_get('ospf', 'router_id', @get_args)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def router_id=(rid)
|
|
220
|
+
if rid == default_router_id
|
|
221
|
+
@set_args[:state] = 'no'
|
|
222
|
+
@set_args[:router_id] = router_id
|
|
223
|
+
else
|
|
224
|
+
@set_args[:state] = ''
|
|
225
|
+
@set_args[:router_id] = rid
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
config_set('ospf', 'router_id', @set_args)
|
|
229
|
+
delete_set_args_keys([:state, :router_id])
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def default_router_id
|
|
233
|
+
config_get_default('ospf', 'router_id')
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def timer_throttle_lsa
|
|
237
|
+
match = config_get('ospf', 'timer_throttle_lsa', @get_args)
|
|
238
|
+
if match.nil?
|
|
239
|
+
default_timer_throttle_lsa
|
|
240
|
+
else
|
|
241
|
+
match.collect(&:to_i)
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def timer_throttle_lsa_start
|
|
246
|
+
start, _hold, _max = timer_throttle_lsa
|
|
247
|
+
return default_timer_throttle_lsa_start if start.nil?
|
|
248
|
+
start
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def timer_throttle_lsa_hold
|
|
252
|
+
_start, hold, _max = timer_throttle_lsa
|
|
253
|
+
return default_timer_throttle_lsa_hold if hold.nil?
|
|
254
|
+
hold
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def timer_throttle_lsa_max
|
|
258
|
+
_start, _hold, max = timer_throttle_lsa
|
|
259
|
+
return default_timer_throttle_lsa_max if max.nil?
|
|
260
|
+
max
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def timer_throttle_lsa_set(start, hold, max)
|
|
264
|
+
@set_args[:start] = start
|
|
265
|
+
@set_args[:hold] = hold
|
|
266
|
+
@set_args[:max] = max
|
|
267
|
+
config_set('ospf', 'timer_throttle_lsa', @set_args)
|
|
268
|
+
delete_set_args_keys([:start, :hold, :max])
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def default_timer_throttle_lsa
|
|
272
|
+
[default_timer_throttle_lsa_start,
|
|
273
|
+
default_timer_throttle_lsa_hold,
|
|
274
|
+
default_timer_throttle_lsa_max]
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def default_timer_throttle_lsa_start
|
|
278
|
+
config_get_default('ospf', 'timer_throttle_lsa_start')
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def default_timer_throttle_lsa_hold
|
|
282
|
+
config_get_default('ospf', 'timer_throttle_lsa_hold')
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def default_timer_throttle_lsa_max
|
|
286
|
+
config_get_default('ospf', 'timer_throttle_lsa_max')
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def timer_throttle_spf
|
|
290
|
+
match = config_get('ospf', 'timer_throttle_spf', @get_args)
|
|
291
|
+
if match.nil?
|
|
292
|
+
default_timer_throttle_spf
|
|
293
|
+
else
|
|
294
|
+
match.collect(&:to_i)
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def timer_throttle_spf_start
|
|
299
|
+
start, _hold, _max = timer_throttle_spf
|
|
300
|
+
return default_timer_throttle_spf_start if start.nil?
|
|
301
|
+
start
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
def timer_throttle_spf_hold
|
|
305
|
+
_start, hold, _max = timer_throttle_spf
|
|
306
|
+
return default_timer_throttle_spf_hold if hold.nil?
|
|
307
|
+
hold
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
def timer_throttle_spf_max
|
|
311
|
+
_start, _hold, max = timer_throttle_spf
|
|
312
|
+
return default_timer_throttle_spf_max if max.nil?
|
|
313
|
+
max
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def timer_throttle_spf_set(start, hold, max)
|
|
317
|
+
@set_args[:start] = start
|
|
318
|
+
@set_args[:hold] = hold
|
|
319
|
+
@set_args[:max] = max
|
|
320
|
+
config_set('ospf', 'timer_throttle_spf', @set_args)
|
|
321
|
+
delete_set_args_keys([:start, :hold, :max])
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
def default_timer_throttle_spf
|
|
325
|
+
[default_timer_throttle_spf_start,
|
|
326
|
+
default_timer_throttle_spf_hold,
|
|
327
|
+
default_timer_throttle_spf_max]
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def default_timer_throttle_spf_start
|
|
331
|
+
config_get_default('ospf', 'timer_throttle_spf_start')
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def default_timer_throttle_spf_hold
|
|
335
|
+
config_get_default('ospf', 'timer_throttle_spf_hold')
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def default_timer_throttle_spf_max
|
|
339
|
+
config_get_default('ospf', 'timer_throttle_spf_max')
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
end
|