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,988 @@
|
|
|
1
|
+
# June 2015, Michael G Wiebe
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2015-2017 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 'cisco_cmn_utils'
|
|
18
|
+
require_relative 'node_util'
|
|
19
|
+
require_relative 'feature'
|
|
20
|
+
require_relative 'logger'
|
|
21
|
+
|
|
22
|
+
module Cisco
|
|
23
|
+
# RouterBgp - node utility class for BGP general config management
|
|
24
|
+
class RouterBgp < NodeUtil
|
|
25
|
+
attr_reader :asnum, :vrf
|
|
26
|
+
|
|
27
|
+
def initialize(asnum, vrf='default', instantiate=true)
|
|
28
|
+
fail ArgumentError unless vrf.is_a? String
|
|
29
|
+
fail ArgumentError unless vrf.length > 0
|
|
30
|
+
@asnum = RouterBgp.validate_asnum(asnum)
|
|
31
|
+
@vrf = vrf
|
|
32
|
+
set_args_keys_default
|
|
33
|
+
create if instantiate
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_s
|
|
37
|
+
"BGP #{asnum} VRF '#{vrf}'"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Create a hash of all router bgp default and non-default
|
|
41
|
+
# vrf instances
|
|
42
|
+
def self.routers
|
|
43
|
+
asnum = config_get('bgp', 'router')
|
|
44
|
+
return {} if asnum.nil?
|
|
45
|
+
|
|
46
|
+
hash_final = {}
|
|
47
|
+
asnum = asnum.to_i unless /\d+.\d+/.match(asnum)
|
|
48
|
+
hash_tmp = {
|
|
49
|
+
asnum => { 'default' => RouterBgp.new(asnum, 'default', false) }
|
|
50
|
+
}
|
|
51
|
+
vrf_ids = config_get('bgp', 'vrf', asnum: asnum)
|
|
52
|
+
unless vrf_ids.nil?
|
|
53
|
+
vrf_ids.each do |vrf|
|
|
54
|
+
hash_tmp[asnum][vrf] = RouterBgp.new(asnum, vrf, false)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
hash_final.merge!(hash_tmp)
|
|
58
|
+
return hash_final
|
|
59
|
+
rescue Cisco::CliError
|
|
60
|
+
# cmd will error when feature 'bgp' is not enabled
|
|
61
|
+
raise if Feature.bgp_enabled?
|
|
62
|
+
return {}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.validate_asnum(asnum)
|
|
66
|
+
err_msg = 'BGP asnum must be type String or Integer'
|
|
67
|
+
fail ArgumentError, err_msg unless asnum.is_a?(Integer) ||
|
|
68
|
+
asnum.is_a?(String)
|
|
69
|
+
if asnum.is_a? String
|
|
70
|
+
# Match ASDOT '1.5' or ASPLAIN '55' strings
|
|
71
|
+
fail ArgumentError unless /^(\d+|\d+\.\d+)$/.match(asnum)
|
|
72
|
+
end
|
|
73
|
+
asnum.to_s
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def router_bgp(state='')
|
|
77
|
+
@set_args[:state] = state
|
|
78
|
+
if vrf == 'default'
|
|
79
|
+
config_set('bgp', 'router', @set_args)
|
|
80
|
+
else
|
|
81
|
+
config_set('bgp', 'vrf', @set_args)
|
|
82
|
+
end
|
|
83
|
+
set_args_keys_default
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Create one router bgp instance
|
|
87
|
+
def create
|
|
88
|
+
Feature.bgp_enable if platform == :nexus
|
|
89
|
+
router_bgp
|
|
90
|
+
wait_for_process_initialized
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Destroy router bgp instance
|
|
94
|
+
def destroy
|
|
95
|
+
router_bgp('no')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def process_initialized?
|
|
99
|
+
config_get('bgp', 'process_initialized')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def wait_for_process_initialized
|
|
103
|
+
return unless node.product_id[/N(5|6|8)/]
|
|
104
|
+
|
|
105
|
+
# Hack for slow-start platforms which will have setter failures if the
|
|
106
|
+
# bgp instance is still initializing. To see this problem in a sandbox
|
|
107
|
+
# do 'router bgp 1 ; router bgp 1 ; shutdown'.
|
|
108
|
+
4.times do
|
|
109
|
+
return if process_initialized?
|
|
110
|
+
sleep 1
|
|
111
|
+
node.cache_flush
|
|
112
|
+
end
|
|
113
|
+
fail 'BGP process is not initialized yet'
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Helper method to delete @set_args hash keys
|
|
117
|
+
def set_args_keys_default
|
|
118
|
+
@set_args = { asnum: @asnum }
|
|
119
|
+
@set_args[:vrf] = @vrf unless @vrf == 'default'
|
|
120
|
+
@get_args = @set_args
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Attributes:
|
|
124
|
+
|
|
125
|
+
# nsr Getter
|
|
126
|
+
def nsr
|
|
127
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
128
|
+
config_get('bgp', 'nsr', @get_args)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Bestpath Getters
|
|
132
|
+
def bestpath_always_compare_med
|
|
133
|
+
config_get('bgp', 'bestpath_always_compare_med', @get_args)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def bestpath_aspath_multipath_relax
|
|
137
|
+
config_get('bgp', 'bestpath_aspath_multipath_relax', @get_args)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def bestpath_compare_routerid
|
|
141
|
+
config_get('bgp', 'bestpath_compare_routerid', @get_args)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def bestpath_cost_community_ignore
|
|
145
|
+
config_get('bgp', 'bestpath_cost_community_ignore', @get_args)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def bestpath_med_confed
|
|
149
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
150
|
+
config_get('bgp', 'bestpath_med_confed', @get_args)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def bestpath_med_missing_as_worst
|
|
154
|
+
config_get('bgp', 'bestpath_med_missing_as_worst', @get_args)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def bestpath_med_non_deterministic
|
|
158
|
+
config_get('bgp', 'bestpath_med_non_deterministic', @get_args)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# nsr Setter
|
|
162
|
+
def nsr=(enable)
|
|
163
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
164
|
+
fail Cisco::UnsupportedError.new('bgp', 'nsr', 'set', 'nsr is not ' \
|
|
165
|
+
'configurable on a per-VRF basis on ios_xr')
|
|
166
|
+
end
|
|
167
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
168
|
+
config_set('bgp', 'nsr', @set_args)
|
|
169
|
+
set_args_keys_default
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Bestpath Setters
|
|
173
|
+
def bestpath_always_compare_med=(enable)
|
|
174
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
175
|
+
config_set('bgp', 'bestpath_always_compare_med', @set_args)
|
|
176
|
+
set_args_keys_default
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def bestpath_aspath_multipath_relax=(enable)
|
|
180
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
181
|
+
config_set('bgp', 'bestpath_aspath_multipath_relax', @set_args)
|
|
182
|
+
set_args_keys_default
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def bestpath_compare_routerid=(enable)
|
|
186
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
187
|
+
config_set('bgp', 'bestpath_compare_routerid', @set_args)
|
|
188
|
+
set_args_keys_default
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def bestpath_cost_community_ignore=(enable)
|
|
192
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
193
|
+
config_set('bgp', 'bestpath_cost_community_ignore', @set_args)
|
|
194
|
+
set_args_keys_default
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def bestpath_med_confed=(enable)
|
|
198
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
199
|
+
fail Cisco::UnsupportedError.new('bgp', 'bestpath_med_confed', 'set',
|
|
200
|
+
'bestpath_med_confed is not ' \
|
|
201
|
+
'configurable on a per-VRF basis ' \
|
|
202
|
+
'on IOS XR')
|
|
203
|
+
end
|
|
204
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
205
|
+
config_set('bgp', 'bestpath_med_confed', @set_args)
|
|
206
|
+
set_args_keys_default
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def bestpath_med_missing_as_worst=(enable)
|
|
210
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
211
|
+
config_set('bgp', 'bestpath_med_missing_as_worst', @set_args)
|
|
212
|
+
set_args_keys_default
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def bestpath_med_non_deterministic=(enable)
|
|
216
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
217
|
+
config_set('bgp', 'bestpath_med_non_deterministic', @set_args)
|
|
218
|
+
set_args_keys_default
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# nsr Default
|
|
222
|
+
def default_nsr
|
|
223
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
224
|
+
config_get_default('bgp', 'nsr')
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Bestpath Defaults
|
|
228
|
+
def default_bestpath_always_compare_med
|
|
229
|
+
config_get_default('bgp', 'bestpath_always_compare_med')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def default_bestpath_aspath_multipath_relax
|
|
233
|
+
config_get_default('bgp', 'bestpath_aspath_multipath_relax')
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def default_bestpath_compare_routerid
|
|
237
|
+
config_get_default('bgp', 'bestpath_compare_routerid')
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def default_bestpath_cost_community_ignore
|
|
241
|
+
config_get_default('bgp', 'bestpath_cost_community_ignore')
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def default_bestpath_med_confed
|
|
245
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
246
|
+
config_get_default('bgp', 'bestpath_med_confed')
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def default_bestpath_med_missing_as_worst
|
|
250
|
+
config_get_default('bgp', 'bestpath_med_missing_as_worst')
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def default_bestpath_med_non_deterministic
|
|
254
|
+
config_get_default('bgp', 'bestpath_med_non_deterministic')
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Cluster Id (Getter/Setter/Default)
|
|
258
|
+
def cluster_id
|
|
259
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
260
|
+
config_get('bgp', 'cluster_id', @get_args)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def cluster_id=(id)
|
|
264
|
+
# In order to remove a bgp cluster_id you cannot simply issue
|
|
265
|
+
# 'no bgp cluster-id'. IMO this should be possible because you
|
|
266
|
+
# can only configure a single bgp cluster-id.
|
|
267
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
268
|
+
fail Cisco::UnsupportedError.new('bgp', 'cluster_id', 'set',
|
|
269
|
+
'cluster-id is not configurable ' \
|
|
270
|
+
'on a per-VRF basis on IOS XR')
|
|
271
|
+
end
|
|
272
|
+
# HACK: specify a dummy id when removing the property.
|
|
273
|
+
dummy_id = 1
|
|
274
|
+
if id == default_cluster_id
|
|
275
|
+
@set_args[:state] = 'no'
|
|
276
|
+
@set_args[:id] = dummy_id
|
|
277
|
+
else
|
|
278
|
+
@set_args[:state] = ''
|
|
279
|
+
@set_args[:id] = id
|
|
280
|
+
end
|
|
281
|
+
config_set('bgp', 'cluster_id', @set_args)
|
|
282
|
+
set_args_keys_default
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def default_cluster_id
|
|
286
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
287
|
+
config_get_default('bgp', 'cluster_id')
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Confederation Id (Getter/Setter/Default)
|
|
291
|
+
def confederation_id
|
|
292
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
293
|
+
config_get('bgp', 'confederation_id', @get_args)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def confederation_id=(id)
|
|
297
|
+
# In order to remove a bgp confed id you cannot simply issue
|
|
298
|
+
# 'no bgp confederation id'. IMO this should be possible
|
|
299
|
+
# because you can only configure a single bgp confed id.
|
|
300
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
301
|
+
fail Cisco::UnsupportedError.new('bgp', 'confederation_id', 'set',
|
|
302
|
+
'confederation-id is not ' \
|
|
303
|
+
'configurable ' \
|
|
304
|
+
'on a per-VRF basis on IOS XR')
|
|
305
|
+
end
|
|
306
|
+
# HACK: specify a dummy id when removing the property.
|
|
307
|
+
dummy_id = 1
|
|
308
|
+
if id == default_confederation_id
|
|
309
|
+
@set_args[:state] = 'no'
|
|
310
|
+
@set_args[:id] = dummy_id
|
|
311
|
+
else
|
|
312
|
+
@set_args[:state] = ''
|
|
313
|
+
@set_args[:id] = id
|
|
314
|
+
end
|
|
315
|
+
config_set('bgp', 'confederation_id', @set_args)
|
|
316
|
+
set_args_keys_default
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def default_confederation_id
|
|
320
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
321
|
+
config_get_default('bgp', 'confederation_id')
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
#
|
|
325
|
+
# disable-policy-batching (Getter/Setter/Default)
|
|
326
|
+
#
|
|
327
|
+
def disable_policy_batching
|
|
328
|
+
config_get('bgp', 'disable_policy_batching', @get_args)
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def disable_policy_batching=(enable)
|
|
332
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
333
|
+
config_set('bgp', 'disable_policy_batching', @set_args)
|
|
334
|
+
set_args_keys_default
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
def default_disable_policy_batching
|
|
338
|
+
config_get_default('bgp', 'disable_policy_batching')
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
#
|
|
342
|
+
# disable-policy-batching ipv4 prefix-list <prefix_list>
|
|
343
|
+
#
|
|
344
|
+
def disable_policy_batching_ipv4
|
|
345
|
+
config_get('bgp', 'disable_policy_batching_ipv4', @get_args)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def disable_policy_batching_ipv4=(prefix_list)
|
|
349
|
+
dummy_prefixlist = 'x'
|
|
350
|
+
if prefix_list == default_disable_policy_batching_ipv4
|
|
351
|
+
@set_args[:state] = 'no'
|
|
352
|
+
@set_args[:prefix_list] = dummy_prefixlist
|
|
353
|
+
else
|
|
354
|
+
@set_args[:state] = ''
|
|
355
|
+
@set_args[:prefix_list] = prefix_list
|
|
356
|
+
end
|
|
357
|
+
config_set('bgp', 'disable_policy_batching_ipv4', @set_args)
|
|
358
|
+
set_args_keys_default
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def default_disable_policy_batching_ipv4
|
|
362
|
+
config_get_default('bgp', 'disable_policy_batching_ipv4')
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
#
|
|
366
|
+
# disable-policy-batching ipv6 prefix-list <prefix_list>
|
|
367
|
+
#
|
|
368
|
+
def disable_policy_batching_ipv6
|
|
369
|
+
config_get('bgp', 'disable_policy_batching_ipv6', @get_args)
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def disable_policy_batching_ipv6=(prefix_list)
|
|
373
|
+
dummy_prefixlist = 'x'
|
|
374
|
+
if prefix_list == default_disable_policy_batching_ipv6
|
|
375
|
+
@set_args[:state] = 'no'
|
|
376
|
+
@set_args[:prefix_list] = dummy_prefixlist
|
|
377
|
+
else
|
|
378
|
+
@set_args[:state] = ''
|
|
379
|
+
@set_args[:prefix_list] = prefix_list
|
|
380
|
+
end
|
|
381
|
+
config_set('bgp', 'disable_policy_batching_ipv6', @set_args)
|
|
382
|
+
set_args_keys_default
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
def default_disable_policy_batching_ipv6
|
|
386
|
+
config_get_default('bgp', 'disable_policy_batching_ipv6')
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# Enforce First As (Getter/Setter/Default)
|
|
390
|
+
def enforce_first_as
|
|
391
|
+
config_get('bgp', 'enforce_first_as', @get_args)
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
def enforce_first_as=(enable)
|
|
395
|
+
# TODO: write a helper method for this repeated logic
|
|
396
|
+
# enforce_first_as is on by default (=>true)
|
|
397
|
+
# XR=>true = enable enforce_first_as = 'no bgp enforce-first-as disable'
|
|
398
|
+
# XR=>false = disable enforce_first_as = 'bgp enforce-first-as disable'
|
|
399
|
+
# Nexus nvgens the 'no' command.
|
|
400
|
+
# Nexus=>true = enable enforce_first_as = 'enforce-first-as'
|
|
401
|
+
# Nexus=>false = disable enforce_first_as = 'no enforce-first-as'
|
|
402
|
+
enable = !enable if platform == :ios_xr
|
|
403
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
404
|
+
config_set('bgp', 'enforce_first_as', @set_args)
|
|
405
|
+
set_args_keys_default
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
def default_enforce_first_as
|
|
409
|
+
config_get_default('bgp', 'enforce_first_as')
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# event-history
|
|
413
|
+
# event-history cli [ size <size> ]
|
|
414
|
+
# Nvgen as True With optional 'size <size>
|
|
415
|
+
def event_history_cli
|
|
416
|
+
match = config_get('bgp', 'event_history_cli', @get_args)
|
|
417
|
+
return unless match.is_a?(Array)
|
|
418
|
+
return 'false' if match[0] == 'no '
|
|
419
|
+
return unless match[1]
|
|
420
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
421
|
+
'size_' + match[1]
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
def event_history_cli=(val)
|
|
425
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
|
426
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
427
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
428
|
+
config_set('bgp', 'event_history_cli', @set_args)
|
|
429
|
+
set_args_keys_default
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
# event-history detail [ size <size> ]
|
|
433
|
+
# Nvgen as True With optional 'size <size>
|
|
434
|
+
def event_history_detail
|
|
435
|
+
match = config_get('bgp', 'event_history_detail', @get_args)
|
|
436
|
+
return unless match.is_a?(Array)
|
|
437
|
+
return 'false' if match[0] == 'no '
|
|
438
|
+
return 'true' unless match[1]
|
|
439
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
440
|
+
'size_' + match[1]
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
def event_history_detail=(val)
|
|
444
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
|
445
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
446
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
447
|
+
config_set('bgp', 'event_history_detail', @set_args)
|
|
448
|
+
set_args_keys_default
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# event-history errors [ size <size> ]
|
|
452
|
+
# Nvgen as True With optional 'size <size>
|
|
453
|
+
def event_history_errors
|
|
454
|
+
match = config_get('bgp', 'event_history_errors', @get_args)
|
|
455
|
+
return unless match.is_a?(Array)
|
|
456
|
+
return 'false' if match[0] == 'no '
|
|
457
|
+
return unless match[1]
|
|
458
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
459
|
+
'size_' + match[1]
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
def event_history_errors=(val)
|
|
463
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
|
464
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
465
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
466
|
+
config_set('bgp', 'event_history_errors', @set_args)
|
|
467
|
+
set_args_keys_default
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
# event-history events [ size <size> ]
|
|
471
|
+
# Nvgen as True With optional 'size <size>
|
|
472
|
+
def event_history_events
|
|
473
|
+
match = config_get('bgp', 'event_history_events', @get_args)
|
|
474
|
+
return unless match.is_a?(Array)
|
|
475
|
+
return 'false' if match[0] == 'no '
|
|
476
|
+
return unless match[1]
|
|
477
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
478
|
+
'size_' + match[1]
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
def event_history_events=(val)
|
|
482
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
|
483
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
484
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
485
|
+
config_set('bgp', 'event_history_events', @set_args)
|
|
486
|
+
set_args_keys_default
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
# event-history objstore [ size <size> ]
|
|
490
|
+
# Nvgen as True With optional 'size <size>
|
|
491
|
+
def event_history_objstore
|
|
492
|
+
match = config_get('bgp', 'event_history_objstore', @get_args)
|
|
493
|
+
return unless match.is_a?(Array)
|
|
494
|
+
return 'false' if match[0] == 'no '
|
|
495
|
+
return 'true' unless match[1]
|
|
496
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
497
|
+
'size_' + match[1]
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
def event_history_objstore=(val)
|
|
501
|
+
size = val[/small|medium|large|disable|\A\d+\z/]
|
|
502
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
503
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
504
|
+
config_set('bgp', 'event_history_objstore', @set_args)
|
|
505
|
+
set_args_keys_default
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
# event-history periodic [ size <size> ]
|
|
509
|
+
# Nvgen as True With optional 'size <size>
|
|
510
|
+
def event_history_periodic
|
|
511
|
+
match = config_get('bgp', 'event_history_periodic', @get_args)
|
|
512
|
+
return unless match.is_a?(Array)
|
|
513
|
+
return 'false' if match[0] == 'no '
|
|
514
|
+
return unless match[1]
|
|
515
|
+
return match[1] if match[1][/\A\d+\z/]
|
|
516
|
+
'size_' + match[1]
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
def event_history_periodic=(val)
|
|
520
|
+
size = val[/small|medium|large|disable|\A\d+\z/] unless val[/false|true/]
|
|
521
|
+
@set_args[:size] = size.nil? ? '' : "size #{size}"
|
|
522
|
+
@set_args[:state] = val[/false/] ? 'no' : ''
|
|
523
|
+
config_set('bgp', 'event_history_periodic', @set_args)
|
|
524
|
+
set_args_keys_default
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
# Fast External fallover (Getter/Setter/Default)
|
|
528
|
+
def fast_external_fallover
|
|
529
|
+
config_get('bgp', 'fast_external_fallover', @get_args)
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
def fast_external_fallover=(enable)
|
|
533
|
+
# TODO: write a helper method for this repeated logic
|
|
534
|
+
# fast_external_fallover is on by default (=>true)
|
|
535
|
+
# XR=>true = 'no bgp fast-external-fallover disable'
|
|
536
|
+
# XR=>false = 'bgp fast-external-fallover disable'
|
|
537
|
+
# Nexus nvgens the 'no' command.
|
|
538
|
+
# Nexus=>true = 'fast-external-fallover'
|
|
539
|
+
# Nexus=>false = 'no fast-external-fallover'
|
|
540
|
+
enable = !enable if platform == :ios_xr
|
|
541
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
542
|
+
config_set('bgp', 'fast_external_fallover', @set_args)
|
|
543
|
+
set_args_keys_default
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
def default_fast_external_fallover
|
|
547
|
+
config_get_default('bgp', 'fast_external_fallover')
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
# Flush Routes (Getter/Setter/Default)
|
|
551
|
+
def flush_routes
|
|
552
|
+
config_get('bgp', 'flush_routes', @get_args)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
def flush_routes=(enable)
|
|
556
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
557
|
+
config_set('bgp', 'flush_routes', @set_args)
|
|
558
|
+
set_args_keys_default
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
def default_flush_routes
|
|
562
|
+
config_get_default('bgp', 'flush_routes')
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
# Confederation Peers (Getter/Setter/Default)
|
|
566
|
+
def confederation_peers
|
|
567
|
+
# NX: confederation peers is retrieved as a string '1 2 3'
|
|
568
|
+
# XR: retrieved as an array.
|
|
569
|
+
# So make it an array in the NX case.
|
|
570
|
+
# Sort the end results to make it consistent across both platforms.
|
|
571
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
572
|
+
peers = config_get('bgp', 'confederation_peers', @get_args)
|
|
573
|
+
peers = peers.split(' ') if peers.is_a?(String)
|
|
574
|
+
peers.sort
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
def confederation_peers=(should)
|
|
578
|
+
# confederation peers are additive. So create a delta hash of entries
|
|
579
|
+
# and only apply the changes
|
|
580
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
581
|
+
fail Cisco::UnsupportedError.new('bgp', 'confederation_peers', 'set',
|
|
582
|
+
'confederation-peers is not ' \
|
|
583
|
+
'configurable ' \
|
|
584
|
+
'on a per-VRF basis on IOS XR')
|
|
585
|
+
end
|
|
586
|
+
should = should.flatten
|
|
587
|
+
is = confederation_peers
|
|
588
|
+
|
|
589
|
+
delta_hash = Utils.delta_add_remove(should, is)
|
|
590
|
+
return if delta_hash.values.flatten.empty?
|
|
591
|
+
[:add, :remove].each do |action|
|
|
592
|
+
Cisco::Logger.debug('confederation_peers delta ' \
|
|
593
|
+
"#{@get_args}\n #{action}: " \
|
|
594
|
+
"#{delta_hash[action]}")
|
|
595
|
+
delta_hash[action].each do |peer|
|
|
596
|
+
state = (action == :add) ? '' : 'no'
|
|
597
|
+
@set_args[:state] = state
|
|
598
|
+
@set_args[:peer] = peer
|
|
599
|
+
|
|
600
|
+
config_set('bgp', 'confederation_peers', @set_args)
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
def default_confederation_peers
|
|
606
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
607
|
+
config_get_default('bgp', 'confederation_peers')
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
# Graceful Restart Getters
|
|
611
|
+
def graceful_restart
|
|
612
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
613
|
+
config_get('bgp', 'graceful_restart', @get_args)
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
def graceful_restart_timers_restart
|
|
617
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
618
|
+
config_get('bgp', 'graceful_restart_timers_restart', @get_args)
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
def graceful_restart_timers_stalepath_time
|
|
622
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
623
|
+
config_get('bgp', 'graceful_restart_timers_stalepath_time', @get_args)
|
|
624
|
+
end
|
|
625
|
+
|
|
626
|
+
def graceful_restart_helper
|
|
627
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
628
|
+
config_get('bgp', 'graceful_restart_helper', @get_args)
|
|
629
|
+
end
|
|
630
|
+
|
|
631
|
+
# Graceful Restart Setters
|
|
632
|
+
def graceful_restart=(enable)
|
|
633
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
634
|
+
fail Cisco::UnsupportedError.new('bgp', 'graceful_restart', 'set',
|
|
635
|
+
'graceful_restart is not ' \
|
|
636
|
+
'configurable ' \
|
|
637
|
+
'on a per-VRF basis on IOS XR')
|
|
638
|
+
end
|
|
639
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
640
|
+
config_set('bgp', 'graceful_restart', @set_args)
|
|
641
|
+
set_args_keys_default
|
|
642
|
+
end
|
|
643
|
+
|
|
644
|
+
def graceful_restart_timers_restart=(seconds)
|
|
645
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
646
|
+
fail Cisco::UnsupportedError.new('bgp',
|
|
647
|
+
'graceful_restart_timers_restart',
|
|
648
|
+
'set',
|
|
649
|
+
'graceful_restart_timers_restart is ' \
|
|
650
|
+
'not configurable ' \
|
|
651
|
+
'on a per-VRF basis on IOS XR')
|
|
652
|
+
end
|
|
653
|
+
if seconds == default_graceful_restart_timers_restart
|
|
654
|
+
@set_args[:state] = 'no'
|
|
655
|
+
@set_args[:seconds] = ''
|
|
656
|
+
else
|
|
657
|
+
@set_args[:state] = ''
|
|
658
|
+
@set_args[:seconds] = seconds
|
|
659
|
+
end
|
|
660
|
+
config_set('bgp', 'graceful_restart_timers_restart', @set_args)
|
|
661
|
+
set_args_keys_default
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
def graceful_restart_timers_stalepath_time=(seconds)
|
|
665
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
666
|
+
fail Cisco::UnsupportedError.new('bgp',
|
|
667
|
+
'graceful_restart_timers_' \
|
|
668
|
+
'stalepath_time', 'set',
|
|
669
|
+
'graceful_restart_timers_' \
|
|
670
|
+
'stalepath_time is not configurable ' \
|
|
671
|
+
'on a per-VRF basis on IOS XR')
|
|
672
|
+
end
|
|
673
|
+
if seconds == default_graceful_restart_timers_stalepath_time
|
|
674
|
+
@set_args[:state] = 'no'
|
|
675
|
+
@set_args[:seconds] = ''
|
|
676
|
+
else
|
|
677
|
+
@set_args[:state] = ''
|
|
678
|
+
@set_args[:seconds] = seconds
|
|
679
|
+
end
|
|
680
|
+
config_set('bgp', 'graceful_restart_timers_stalepath_time', @set_args)
|
|
681
|
+
set_args_keys_default
|
|
682
|
+
end
|
|
683
|
+
|
|
684
|
+
def graceful_restart_helper=(enable)
|
|
685
|
+
if platform == :ios_xr && @vrf != 'default'
|
|
686
|
+
fail Cisco::UnsupportedError.new('bgp',
|
|
687
|
+
'graceful_restart_helper', 'set',
|
|
688
|
+
'graceful_restart_helper ' \
|
|
689
|
+
'is not configurable ' \
|
|
690
|
+
'on a per-VRF basis on IOS XR')
|
|
691
|
+
end
|
|
692
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
693
|
+
config_set('bgp', 'graceful_restart_helper', @set_args)
|
|
694
|
+
set_args_keys_default
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
# Graceful Restart Defaults
|
|
698
|
+
def default_graceful_restart
|
|
699
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
700
|
+
config_get_default('bgp', 'graceful_restart')
|
|
701
|
+
end
|
|
702
|
+
|
|
703
|
+
def default_graceful_restart_timers_restart
|
|
704
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
705
|
+
config_get_default('bgp', 'graceful_restart_timers_restart')
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
def default_graceful_restart_timers_stalepath_time
|
|
709
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
710
|
+
config_get_default('bgp', 'graceful_restart_timers_stalepath_time')
|
|
711
|
+
end
|
|
712
|
+
|
|
713
|
+
def default_graceful_restart_helper
|
|
714
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
715
|
+
config_get_default('bgp', 'graceful_restart_helper')
|
|
716
|
+
end
|
|
717
|
+
|
|
718
|
+
# Isolate (Getter/Setter/Default)
|
|
719
|
+
def isolate
|
|
720
|
+
config_get('bgp', 'isolate', @get_args)
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
def isolate=(enable)
|
|
724
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
725
|
+
config_set('bgp', 'isolate', @set_args)
|
|
726
|
+
set_args_keys_default
|
|
727
|
+
end
|
|
728
|
+
|
|
729
|
+
def default_isolate
|
|
730
|
+
config_get_default('bgp', 'isolate')
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# MaxAs Limit (Getter/Setter/Default)
|
|
734
|
+
def maxas_limit
|
|
735
|
+
config_get('bgp', 'maxas_limit', @get_args)
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
def maxas_limit=(limit)
|
|
739
|
+
if limit == default_maxas_limit
|
|
740
|
+
@set_args[:state] = 'no'
|
|
741
|
+
@set_args[:limit] = ''
|
|
742
|
+
else
|
|
743
|
+
@set_args[:state] = ''
|
|
744
|
+
@set_args[:limit] = limit
|
|
745
|
+
end
|
|
746
|
+
config_set('bgp', 'maxas_limit', @set_args)
|
|
747
|
+
set_args_keys_default
|
|
748
|
+
end
|
|
749
|
+
|
|
750
|
+
def default_maxas_limit
|
|
751
|
+
config_get_default('bgp', 'maxas_limit')
|
|
752
|
+
end
|
|
753
|
+
|
|
754
|
+
# Log Neighbor Changes (Getter/Setter/Default)
|
|
755
|
+
def log_neighbor_changes
|
|
756
|
+
config_get('bgp', 'log_neighbor_changes', @get_args)
|
|
757
|
+
end
|
|
758
|
+
|
|
759
|
+
def log_neighbor_changes=(enable)
|
|
760
|
+
# XR logging is on by default (=>true)
|
|
761
|
+
# XR=>true = enable logging = 'no bgp log neighbor changes disable'
|
|
762
|
+
# XR=>false = disable logging = 'bgp log neighbor changes disable'
|
|
763
|
+
# Nexus logging is off by default (=>false)
|
|
764
|
+
# Nexus=>true = enable logging = 'log-neighbor-changes'
|
|
765
|
+
# Nexus=>false = disable logging = 'no log-neighbor-changes'
|
|
766
|
+
enable = !enable if platform == :ios_xr
|
|
767
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
768
|
+
config_set('bgp', 'log_neighbor_changes', @set_args)
|
|
769
|
+
set_args_keys_default
|
|
770
|
+
end
|
|
771
|
+
|
|
772
|
+
def default_log_neighbor_changes
|
|
773
|
+
config_get_default('bgp', 'log_neighbor_changes')
|
|
774
|
+
end
|
|
775
|
+
|
|
776
|
+
# Neighbor down fib accelerate (Getter/Setter/Default)
|
|
777
|
+
def neighbor_down_fib_accelerate
|
|
778
|
+
config_get('bgp', 'neighbor_down_fib_accelerate', @get_args)
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
def neighbor_down_fib_accelerate=(enable)
|
|
782
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
783
|
+
config_set('bgp', 'neighbor_down_fib_accelerate', @set_args)
|
|
784
|
+
set_args_keys_default
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
def default_neighbor_down_fib_accelerate
|
|
788
|
+
config_get_default('bgp', 'neighbor_down_fib_accelerate')
|
|
789
|
+
end
|
|
790
|
+
|
|
791
|
+
# Reconnect Interval (Getter/Setter/Default)
|
|
792
|
+
def reconnect_interval
|
|
793
|
+
config_get('bgp', 'reconnect_interval', @get_args)
|
|
794
|
+
end
|
|
795
|
+
|
|
796
|
+
def reconnect_interval=(seconds)
|
|
797
|
+
if seconds == default_reconnect_interval
|
|
798
|
+
@set_args[:state] = 'no'
|
|
799
|
+
@set_args[:seconds] = ''
|
|
800
|
+
else
|
|
801
|
+
@set_args[:state] = ''
|
|
802
|
+
@set_args[:seconds] = seconds
|
|
803
|
+
end
|
|
804
|
+
config_set('bgp', 'reconnect_interval', @set_args)
|
|
805
|
+
set_args_keys_default
|
|
806
|
+
end
|
|
807
|
+
|
|
808
|
+
def default_reconnect_interval
|
|
809
|
+
config_get_default('bgp', 'reconnect_interval')
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
# route_distinguisher
|
|
813
|
+
# Note that this property is supported by both bgp and vrf providers.
|
|
814
|
+
def route_distinguisher
|
|
815
|
+
return nil if @vrf.nil? || @vrf == 'default'
|
|
816
|
+
config_get('bgp', 'route_distinguisher', @get_args)
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
def route_distinguisher=(rd)
|
|
820
|
+
if @vrf.nil? || @vrf == 'default'
|
|
821
|
+
fail Cisco::UnsupportedError.new('bgp', 'route_distinguisher', 'set',
|
|
822
|
+
'route_distinguisher is not ' \
|
|
823
|
+
'configurable on a default VRF')
|
|
824
|
+
end
|
|
825
|
+
|
|
826
|
+
# N3k I2 images require 'nv overlay evpn' for rd and also require
|
|
827
|
+
# explicit values when removing the rd command. These restrictions are
|
|
828
|
+
# not not needed in I3 and newer images.
|
|
829
|
+
Feature.nv_overlay_evpn_enable if
|
|
830
|
+
Utils.nexus_i2_image || node.product_id[/N[567]/]
|
|
831
|
+
|
|
832
|
+
if rd == default_route_distinguisher
|
|
833
|
+
return if route_distinguisher.empty?
|
|
834
|
+
@set_args[:state] = 'no'
|
|
835
|
+
@set_args[:rd] = route_distinguisher
|
|
836
|
+
else
|
|
837
|
+
@set_args[:state] = ''
|
|
838
|
+
@set_args[:rd] = rd
|
|
839
|
+
end
|
|
840
|
+
config_set('bgp', 'route_distinguisher', @set_args)
|
|
841
|
+
set_args_keys_default
|
|
842
|
+
end
|
|
843
|
+
|
|
844
|
+
def default_route_distinguisher
|
|
845
|
+
return nil if @vrf.nil? || @vrf == 'default'
|
|
846
|
+
config_get_default('bgp', 'route_distinguisher')
|
|
847
|
+
end
|
|
848
|
+
|
|
849
|
+
# Router ID (Getter/Setter/Default)
|
|
850
|
+
def router_id
|
|
851
|
+
config_get('bgp', 'router_id', @get_args)
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
def router_id=(id)
|
|
855
|
+
# In order to remove a bgp router-id you cannot simply issue
|
|
856
|
+
# 'no bgp router-id'. On some platforms you can specify a dummy
|
|
857
|
+
# value, but on N7K at least you need the current router_id.
|
|
858
|
+
if id == default_router_id
|
|
859
|
+
# Nothing to do if router_id is already set to default.
|
|
860
|
+
return if router_id == default_router_id
|
|
861
|
+
@set_args[:state] = 'no'
|
|
862
|
+
@set_args[:id] = router_id
|
|
863
|
+
else
|
|
864
|
+
@set_args[:state] = ''
|
|
865
|
+
@set_args[:id] = id
|
|
866
|
+
end
|
|
867
|
+
config_set('bgp', 'router_id', @set_args)
|
|
868
|
+
set_args_keys_default
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
def default_router_id
|
|
872
|
+
config_get_default('bgp', 'router_id')
|
|
873
|
+
end
|
|
874
|
+
|
|
875
|
+
# Shutdown (Getter/Setter/Default)
|
|
876
|
+
def shutdown
|
|
877
|
+
config_get('bgp', 'shutdown', @asnum)
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
def shutdown=(enable)
|
|
881
|
+
@set_args[:state] = (enable ? '' : 'no')
|
|
882
|
+
config_set('bgp', 'shutdown', @set_args)
|
|
883
|
+
set_args_keys_default
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
def default_shutdown
|
|
887
|
+
config_get_default('bgp', 'shutdown')
|
|
888
|
+
end
|
|
889
|
+
|
|
890
|
+
# Supress Fib Pending (Getter/Setter/Default)
|
|
891
|
+
def suppress_fib_pending
|
|
892
|
+
val = config_get('bgp', 'suppress_fib_pending', @get_args)
|
|
893
|
+
val.nil? ? false : val
|
|
894
|
+
end
|
|
895
|
+
|
|
896
|
+
def suppress_fib_pending=(enable)
|
|
897
|
+
enable == true ? @set_args[:state] = '' : @set_args[:state] = 'no'
|
|
898
|
+
config_set('bgp', 'suppress_fib_pending', @set_args)
|
|
899
|
+
set_args_keys_default
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
def default_suppress_fib_pending
|
|
903
|
+
config_get_default('bgp', 'suppress_fib_pending')
|
|
904
|
+
end
|
|
905
|
+
|
|
906
|
+
# BGP Timers Getters
|
|
907
|
+
def timer_bgp_keepalive_hold
|
|
908
|
+
match = config_get('bgp', 'timer_bgp_keepalive_hold', @get_args)
|
|
909
|
+
match.nil? ? default_timer_bgp_keepalive_hold : match
|
|
910
|
+
end
|
|
911
|
+
|
|
912
|
+
def timer_bgp_keepalive
|
|
913
|
+
keepalive, _hold = timer_bgp_keepalive_hold
|
|
914
|
+
return default_timer_bgp_keepalive if keepalive.nil?
|
|
915
|
+
keepalive.to_i
|
|
916
|
+
end
|
|
917
|
+
|
|
918
|
+
def timer_bgp_holdtime
|
|
919
|
+
_keepalive, hold = timer_bgp_keepalive_hold
|
|
920
|
+
return default_timer_bgp_holdtime if hold.nil?
|
|
921
|
+
hold.to_i
|
|
922
|
+
end
|
|
923
|
+
|
|
924
|
+
def timer_bestpath_limit
|
|
925
|
+
config_get('bgp', 'timer_bestpath_limit', @get_args)
|
|
926
|
+
end
|
|
927
|
+
|
|
928
|
+
def timer_bestpath_limit_always
|
|
929
|
+
config_get('bgp', 'timer_bestpath_limit_always', @get_args)
|
|
930
|
+
end
|
|
931
|
+
|
|
932
|
+
# BGP Timers Setters
|
|
933
|
+
def timer_bgp_keepalive_hold_set(keepalive, hold)
|
|
934
|
+
if keepalive == default_timer_bgp_keepalive &&
|
|
935
|
+
hold == default_timer_bgp_holdtime
|
|
936
|
+
@set_args[:state] = 'no'
|
|
937
|
+
@set_args[:keepalive] = keepalive
|
|
938
|
+
@set_args[:hold] = hold
|
|
939
|
+
else
|
|
940
|
+
@set_args[:state] = ''
|
|
941
|
+
@set_args[:keepalive] = keepalive
|
|
942
|
+
@set_args[:hold] = hold
|
|
943
|
+
end
|
|
944
|
+
config_set('bgp', 'timer_bgp_keepalive_hold', @set_args)
|
|
945
|
+
set_args_keys_default
|
|
946
|
+
end
|
|
947
|
+
|
|
948
|
+
def timer_bestpath_limit_set(seconds, always=false)
|
|
949
|
+
if always
|
|
950
|
+
opt = 'timer_bestpath_limit_always'
|
|
951
|
+
else
|
|
952
|
+
opt = 'timer_bestpath_limit'
|
|
953
|
+
end
|
|
954
|
+
if seconds == default_timer_bestpath_limit
|
|
955
|
+
@set_args[:state] = 'no'
|
|
956
|
+
@set_args[:seconds] = ''
|
|
957
|
+
else
|
|
958
|
+
@set_args[:state] = ''
|
|
959
|
+
@set_args[:seconds] = seconds
|
|
960
|
+
end
|
|
961
|
+
config_set('bgp', opt, @set_args)
|
|
962
|
+
set_args_keys_default
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
# BGP Timers Defaults
|
|
966
|
+
def default_timer_bgp_keepalive_hold
|
|
967
|
+
["#{default_timer_bgp_keepalive}", "#{default_timer_bgp_holdtime}"]
|
|
968
|
+
end
|
|
969
|
+
|
|
970
|
+
def default_timer_bgp_keepalive
|
|
971
|
+
config_get_default('bgp', 'timer_bgp_keepalive')
|
|
972
|
+
end
|
|
973
|
+
|
|
974
|
+
def default_timer_bgp_holdtime
|
|
975
|
+
config_get_default('bgp', 'timer_bgp_hold')
|
|
976
|
+
end
|
|
977
|
+
|
|
978
|
+
def default_timer_bestpath_limit
|
|
979
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
980
|
+
config_get_default('bgp', 'timer_bestpath_limit')
|
|
981
|
+
end
|
|
982
|
+
|
|
983
|
+
def default_timer_bestpath_limit_always
|
|
984
|
+
return nil if platform == :ios_xr && @vrf != 'default'
|
|
985
|
+
config_get_default('bgp', 'timer_bestpath_limit_always')
|
|
986
|
+
end
|
|
987
|
+
end
|
|
988
|
+
end
|