cisco_node_utils_mgx 2.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,570 @@
|
|
1
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require_relative 'ciscotest'
|
16
|
+
require_relative '../lib/cisco_node_utils/interface'
|
17
|
+
require_relative '../lib/cisco_node_utils/interface_hsrp_group'
|
18
|
+
|
19
|
+
# TestInterfaceHsrpGroup - Minitest for InterfaceHsrpGroup
|
20
|
+
# node utility class
|
21
|
+
class TestInterfaceHsrpGroup < CiscoTestCase
|
22
|
+
@skip_unless_supported = 'interface_hsrp_group'
|
23
|
+
|
24
|
+
def setup
|
25
|
+
super
|
26
|
+
config_no_warn('no feature hsrp')
|
27
|
+
config_no_warn('no interface Po100')
|
28
|
+
end
|
29
|
+
|
30
|
+
def teardown
|
31
|
+
if first_or_last_teardown
|
32
|
+
config_no_warn('no interface Po100')
|
33
|
+
config_no_warn('no feature hsrp')
|
34
|
+
end
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_interface_hsrp_group_ipv4(name='port-channel100',
|
39
|
+
group=1,
|
40
|
+
iptype='ipv4')
|
41
|
+
intf = Interface.new(name)
|
42
|
+
intf.switchport_mode = :disabled
|
43
|
+
InterfaceHsrpGroup.new(name, group, iptype)
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_interface_hsrp_group_ipv6(name='port-channel100',
|
47
|
+
group=3,
|
48
|
+
iptype='ipv6')
|
49
|
+
intf = Interface.new(name)
|
50
|
+
intf.switchport_mode = :disabled
|
51
|
+
intf.hsrp_version = 2
|
52
|
+
InterfaceHsrpGroup.new(name, group, iptype)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_collection_size
|
56
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
57
|
+
ihg1 = create_interface_hsrp_group_ipv4
|
58
|
+
ihg2 = create_interface_hsrp_group_ipv4('port-channel100', 2, 'ipv4')
|
59
|
+
ihg3 = create_interface_hsrp_group_ipv4('port-channel100', 3, 'ipv4')
|
60
|
+
ihg4 = create_interface_hsrp_group_ipv6
|
61
|
+
ihg5 = create_interface_hsrp_group_ipv6('port-channel10', 3, 'ipv6')
|
62
|
+
ihg6 = create_interface_hsrp_group_ipv4('port-channel10', 100, 'ipv4')
|
63
|
+
assert_equal(1, InterfaceHsrpGroup.groups['port-channel100']['1'].size)
|
64
|
+
assert_equal(1, InterfaceHsrpGroup.groups['port-channel100']['2'].size)
|
65
|
+
assert_equal(2, InterfaceHsrpGroup.groups['port-channel100']['3'].size)
|
66
|
+
assert_equal(1, InterfaceHsrpGroup.groups['port-channel10']['3'].size)
|
67
|
+
assert_equal(1, InterfaceHsrpGroup.groups['port-channel10']['100'].size)
|
68
|
+
ihg1.destroy
|
69
|
+
ihg2.destroy
|
70
|
+
ihg3.destroy
|
71
|
+
ihg4.destroy
|
72
|
+
ihg5.destroy
|
73
|
+
ihg6.destroy
|
74
|
+
assert_empty(InterfaceHsrpGroup.groups)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_group_name
|
78
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
79
|
+
ihg = create_interface_hsrp_group_ipv4
|
80
|
+
assert_equal(ihg.default_group_name, ihg.group_name)
|
81
|
+
ihg.group_name = 'hsrp_group_name'
|
82
|
+
assert_equal('hsrp_group_name', ihg.group_name)
|
83
|
+
ihg.group_name = ihg.default_group_name
|
84
|
+
assert_equal(ihg.default_group_name, ihg.group_name)
|
85
|
+
ihg = create_interface_hsrp_group_ipv6
|
86
|
+
assert_equal(ihg.default_group_name, ihg.group_name)
|
87
|
+
ihg.group_name = 'hsrp_group_name'
|
88
|
+
assert_equal('hsrp_group_name', ihg.group_name)
|
89
|
+
ihg.group_name = ihg.default_group_name
|
90
|
+
assert_equal(ihg.default_group_name, ihg.group_name)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_mac_addr
|
94
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
95
|
+
ihg = create_interface_hsrp_group_ipv4
|
96
|
+
assert_equal(ihg.default_mac_addr, ihg.mac_addr)
|
97
|
+
ihg.mac_addr = '00:00:11:11:22:22'
|
98
|
+
assert_equal('00:00:11:11:22:22', ihg.mac_addr)
|
99
|
+
ihg.mac_addr = ihg.default_mac_addr
|
100
|
+
assert_equal(ihg.default_mac_addr, ihg.mac_addr)
|
101
|
+
ihg = create_interface_hsrp_group_ipv6
|
102
|
+
assert_equal(ihg.default_mac_addr, ihg.mac_addr)
|
103
|
+
ihg.mac_addr = '00:22:33:44:55:66'
|
104
|
+
assert_equal('00:22:33:44:55:66', ihg.mac_addr)
|
105
|
+
ihg.mac_addr = ihg.default_mac_addr
|
106
|
+
assert_equal(ihg.default_mac_addr, ihg.mac_addr)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_auth_type_clear
|
110
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
111
|
+
ihg = create_interface_hsrp_group_ipv4
|
112
|
+
assert_nil(ihg.authentication_string)
|
113
|
+
attrs = {}
|
114
|
+
attrs[:authentication_auth_type] = 'cleartext'
|
115
|
+
attrs[:authentication_string] = 'Test'
|
116
|
+
ihg.authentication_set(attrs)
|
117
|
+
assert_equal('cleartext', ihg.authentication_auth_type)
|
118
|
+
assert_equal('Test', ihg.authentication_string)
|
119
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
120
|
+
ihg.authentication_set(attrs)
|
121
|
+
assert_nil(ihg.authentication_string)
|
122
|
+
|
123
|
+
ihg = create_interface_hsrp_group_ipv6
|
124
|
+
attrs[:authentication_auth_type] = 'cleartext'
|
125
|
+
attrs[:authentication_string] = 'Test'
|
126
|
+
ihg.authentication_set(attrs)
|
127
|
+
assert_equal('cleartext', ihg.authentication_auth_type)
|
128
|
+
assert_equal('Test', ihg.authentication_string)
|
129
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
130
|
+
ihg.authentication_set(attrs)
|
131
|
+
assert_nil(ihg.authentication_string)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_auth_type_md5
|
135
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
136
|
+
attrs = {}
|
137
|
+
ihg = create_interface_hsrp_group_ipv4
|
138
|
+
attrs[:authentication_auth_type] = 'md5'
|
139
|
+
attrs[:authentication_key_type] = 'key-chain'
|
140
|
+
attrs[:authentication_string] = 'MyMD5Password'
|
141
|
+
ihg.authentication_set(attrs)
|
142
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
143
|
+
assert_equal('key-chain', ihg.authentication_key_type)
|
144
|
+
assert_equal('MyMD5Password', ihg.authentication_string)
|
145
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
146
|
+
ihg.authentication_set(attrs)
|
147
|
+
assert_nil(ihg.authentication_string)
|
148
|
+
ihg = create_interface_hsrp_group_ipv6
|
149
|
+
attrs[:authentication_string] = 'MyMD5Password'
|
150
|
+
ihg.authentication_set(attrs)
|
151
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
152
|
+
assert_equal('key-chain', ihg.authentication_key_type)
|
153
|
+
assert_equal('MyMD5Password', ihg.authentication_string)
|
154
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
155
|
+
ihg.authentication_set(attrs)
|
156
|
+
assert_nil(ihg.authentication_string)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_auth_key_string_enc_0
|
160
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
161
|
+
attrs = {}
|
162
|
+
ihg = create_interface_hsrp_group_ipv4
|
163
|
+
attrs[:authentication_auth_type] = 'md5'
|
164
|
+
attrs[:authentication_key_type] = 'key-string'
|
165
|
+
attrs[:authentication_enc_type] = '0'
|
166
|
+
attrs[:authentication_string] = '7'
|
167
|
+
attrs[:authentication_compatibility] = ihg.default_authentication_compatibility
|
168
|
+
attrs[:authentication_timeout] = ihg.default_authentication_timeout
|
169
|
+
ihg.authentication_set(attrs)
|
170
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
171
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
172
|
+
assert_equal('0', ihg.authentication_enc_type)
|
173
|
+
assert_equal('7', ihg.authentication_string)
|
174
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
175
|
+
ihg.authentication_set(attrs)
|
176
|
+
assert_nil(ihg.authentication_string)
|
177
|
+
ihg = create_interface_hsrp_group_ipv6
|
178
|
+
attrs[:authentication_string] = '7'
|
179
|
+
ihg.authentication_set(attrs)
|
180
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
181
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
182
|
+
assert_equal('0', ihg.authentication_enc_type)
|
183
|
+
assert_equal('7', ihg.authentication_string)
|
184
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
185
|
+
ihg.authentication_set(attrs)
|
186
|
+
assert_nil(ihg.authentication_string)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_auth_key_string_enc_7
|
190
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
191
|
+
attrs = {}
|
192
|
+
ihg = create_interface_hsrp_group_ipv4
|
193
|
+
attrs[:authentication_auth_type] = 'md5'
|
194
|
+
attrs[:authentication_key_type] = 'key-string'
|
195
|
+
attrs[:authentication_enc_type] = '7'
|
196
|
+
attrs[:authentication_string] = '12345678901234567890'
|
197
|
+
attrs[:authentication_compatibility] = ihg.default_authentication_compatibility
|
198
|
+
attrs[:authentication_timeout] = ihg.default_authentication_timeout
|
199
|
+
ihg.authentication_set(attrs)
|
200
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
201
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
202
|
+
assert_equal('7', ihg.authentication_enc_type)
|
203
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
204
|
+
ihg = create_interface_hsrp_group_ipv6
|
205
|
+
attrs[:authentication_string] = '12345678901234567890'
|
206
|
+
ihg.authentication_set(attrs)
|
207
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
208
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
209
|
+
assert_equal('7', ihg.authentication_enc_type)
|
210
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
211
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
212
|
+
ihg.authentication_set(attrs)
|
213
|
+
assert_nil(ihg.authentication_string)
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_auth_key_string_enc_7_compat_timeout_ipv4
|
217
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
218
|
+
attrs = {}
|
219
|
+
ihg = create_interface_hsrp_group_ipv4
|
220
|
+
attrs[:authentication_auth_type] = 'md5'
|
221
|
+
attrs[:authentication_key_type] = 'key-string'
|
222
|
+
attrs[:authentication_enc_type] = '7'
|
223
|
+
attrs[:authentication_string] = '12345678901234567890'
|
224
|
+
attrs[:authentication_compatibility] = ihg.default_authentication_compatibility
|
225
|
+
attrs[:authentication_timeout] = ihg.default_authentication_timeout
|
226
|
+
ihg.authentication_set(attrs)
|
227
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
228
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
229
|
+
assert_equal('7', ihg.authentication_enc_type)
|
230
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
231
|
+
attrs[:authentication_compatibility] = true
|
232
|
+
attrs[:authentication_timeout] = 6666
|
233
|
+
ihg.authentication_set(attrs)
|
234
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
235
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
236
|
+
assert_equal('7', ihg.authentication_enc_type)
|
237
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
238
|
+
assert_equal(true, ihg.authentication_compatibility)
|
239
|
+
assert_equal(6666, ihg.authentication_timeout)
|
240
|
+
attrs[:authentication_compatibility] = false
|
241
|
+
ihg.authentication_set(attrs)
|
242
|
+
assert_equal(false, ihg.authentication_compatibility)
|
243
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
244
|
+
ihg.authentication_set(attrs)
|
245
|
+
assert_nil(ihg.authentication_string)
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_auth_key_string_enc_7_compat_timeout_ipv6
|
249
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
250
|
+
attrs = {}
|
251
|
+
ihg = create_interface_hsrp_group_ipv6
|
252
|
+
attrs[:authentication_auth_type] = 'md5'
|
253
|
+
attrs[:authentication_key_type] = 'key-string'
|
254
|
+
attrs[:authentication_enc_type] = '7'
|
255
|
+
attrs[:authentication_string] = '12345678901234567890'
|
256
|
+
attrs[:authentication_compatibility] = ihg.default_authentication_compatibility
|
257
|
+
attrs[:authentication_timeout] = ihg.default_authentication_timeout
|
258
|
+
ihg.authentication_set(attrs)
|
259
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
260
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
261
|
+
assert_equal('7', ihg.authentication_enc_type)
|
262
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
263
|
+
attrs[:authentication_compatibility] = true
|
264
|
+
attrs[:authentication_timeout] = 6666
|
265
|
+
ihg.authentication_set(attrs)
|
266
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
267
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
268
|
+
assert_equal('7', ihg.authentication_enc_type)
|
269
|
+
assert_equal('12345678901234567890', ihg.authentication_string)
|
270
|
+
assert_equal(true, ihg.authentication_compatibility)
|
271
|
+
assert_equal(6666, ihg.authentication_timeout)
|
272
|
+
attrs[:authentication_compatibility] = false
|
273
|
+
ihg.authentication_set(attrs)
|
274
|
+
assert_equal(false, ihg.authentication_compatibility)
|
275
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
276
|
+
ihg.authentication_set(attrs)
|
277
|
+
assert_nil(ihg.authentication_string)
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_auth_key_string_enc_0_compat_timeout_ipv4
|
281
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
282
|
+
attrs = {}
|
283
|
+
ihg = create_interface_hsrp_group_ipv4
|
284
|
+
attrs[:authentication_auth_type] = 'md5'
|
285
|
+
attrs[:authentication_key_type] = 'key-string'
|
286
|
+
attrs[:authentication_enc_type] = '0'
|
287
|
+
attrs[:authentication_string] = 'MyUnEncr'
|
288
|
+
attrs[:authentication_compatibility] = true
|
289
|
+
attrs[:authentication_timeout] = 6666
|
290
|
+
ihg.authentication_set(attrs)
|
291
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
292
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
293
|
+
assert_equal('0', ihg.authentication_enc_type)
|
294
|
+
assert_equal('MyUnEncr', ihg.authentication_string)
|
295
|
+
assert_equal(true, ihg.authentication_compatibility)
|
296
|
+
assert_equal(6666, ihg.authentication_timeout)
|
297
|
+
attrs[:authentication_compatibility] = false
|
298
|
+
attrs[:authentication_timeout] = 3333
|
299
|
+
ihg.authentication_set(attrs)
|
300
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
301
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
302
|
+
assert_equal('0', ihg.authentication_enc_type)
|
303
|
+
assert_equal('MyUnEncr', ihg.authentication_string)
|
304
|
+
assert_equal(false, ihg.authentication_compatibility)
|
305
|
+
assert_equal(3333, ihg.authentication_timeout)
|
306
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
307
|
+
ihg.authentication_set(attrs)
|
308
|
+
assert_nil(ihg.authentication_string)
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_auth_key_string_enc_0_compat_timeout_ipv6
|
312
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
313
|
+
attrs = {}
|
314
|
+
ihg = create_interface_hsrp_group_ipv6
|
315
|
+
attrs[:authentication_auth_type] = 'md5'
|
316
|
+
attrs[:authentication_key_type] = 'key-string'
|
317
|
+
attrs[:authentication_enc_type] = '0'
|
318
|
+
attrs[:authentication_string] = 'MyUnEncr'
|
319
|
+
attrs[:authentication_compatibility] = true
|
320
|
+
attrs[:authentication_timeout] = 6666
|
321
|
+
ihg.authentication_set(attrs)
|
322
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
323
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
324
|
+
assert_equal('0', ihg.authentication_enc_type)
|
325
|
+
assert_equal('MyUnEncr', ihg.authentication_string)
|
326
|
+
assert_equal(true, ihg.authentication_compatibility)
|
327
|
+
assert_equal(6666, ihg.authentication_timeout)
|
328
|
+
attrs[:authentication_compatibility] = false
|
329
|
+
attrs[:authentication_timeout] = 3333
|
330
|
+
ihg.authentication_set(attrs)
|
331
|
+
assert_equal('md5', ihg.authentication_auth_type)
|
332
|
+
assert_equal('key-string', ihg.authentication_key_type)
|
333
|
+
assert_equal('0', ihg.authentication_enc_type)
|
334
|
+
assert_equal('MyUnEncr', ihg.authentication_string)
|
335
|
+
assert_equal(false, ihg.authentication_compatibility)
|
336
|
+
assert_equal(3333, ihg.authentication_timeout)
|
337
|
+
attrs[:authentication_string] = ihg.default_authentication_string
|
338
|
+
ihg.authentication_set(attrs)
|
339
|
+
assert_nil(ihg.authentication_string)
|
340
|
+
end
|
341
|
+
|
342
|
+
def test_preempt_ipv4
|
343
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
344
|
+
ihg = create_interface_hsrp_group_ipv4
|
345
|
+
assert_equal(ihg.default_preempt, ihg.preempt)
|
346
|
+
assert_equal(ihg.default_preempt_delay_minimum, ihg.preempt_delay_minimum)
|
347
|
+
assert_equal(ihg.default_preempt_delay_reload, ihg.preempt_delay_reload)
|
348
|
+
assert_equal(ihg.default_preempt_delay_sync, ihg.preempt_delay_sync)
|
349
|
+
delay = 100
|
350
|
+
reload = 200
|
351
|
+
sync = 300
|
352
|
+
ihg.preempt_set(true, delay, reload, sync)
|
353
|
+
assert_equal(true, ihg.preempt)
|
354
|
+
assert_equal(100, ihg.preempt_delay_minimum)
|
355
|
+
assert_equal(200, ihg.preempt_delay_reload)
|
356
|
+
assert_equal(300, ihg.preempt_delay_sync)
|
357
|
+
delay = 0
|
358
|
+
reload = 0
|
359
|
+
sync = 0
|
360
|
+
ihg.preempt_set(true, delay, reload, sync)
|
361
|
+
assert_equal(0, ihg.preempt_delay_minimum)
|
362
|
+
assert_equal(0, ihg.preempt_delay_reload)
|
363
|
+
assert_equal(0, ihg.preempt_delay_sync)
|
364
|
+
ihg.preempt_set(ihg.default_preempt,
|
365
|
+
ihg.default_preempt_delay_minimum,
|
366
|
+
ihg.default_preempt_delay_reload,
|
367
|
+
ihg.default_preempt_delay_sync)
|
368
|
+
assert_equal(ihg.default_preempt, ihg.preempt)
|
369
|
+
assert_equal(ihg.default_preempt_delay_minimum, ihg.preempt_delay_minimum)
|
370
|
+
assert_equal(ihg.default_preempt_delay_reload, ihg.preempt_delay_reload)
|
371
|
+
assert_equal(ihg.default_preempt_delay_sync, ihg.preempt_delay_sync)
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_preempt_ipv6
|
375
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
376
|
+
ihg = create_interface_hsrp_group_ipv6
|
377
|
+
assert_equal(ihg.default_preempt, ihg.preempt)
|
378
|
+
assert_equal(ihg.default_preempt_delay_minimum, ihg.preempt_delay_minimum)
|
379
|
+
assert_equal(ihg.default_preempt_delay_reload, ihg.preempt_delay_reload)
|
380
|
+
assert_equal(ihg.default_preempt_delay_sync, ihg.preempt_delay_sync)
|
381
|
+
delay = 222
|
382
|
+
reload = 444
|
383
|
+
sync = 666
|
384
|
+
ihg.preempt_set(true, delay, reload, sync)
|
385
|
+
assert_equal(true, ihg.preempt)
|
386
|
+
assert_equal(222, ihg.preempt_delay_minimum)
|
387
|
+
assert_equal(444, ihg.preempt_delay_reload)
|
388
|
+
assert_equal(666, ihg.preempt_delay_sync)
|
389
|
+
delay = 0
|
390
|
+
reload = 0
|
391
|
+
sync = 0
|
392
|
+
ihg.preempt_set(true, delay, reload, sync)
|
393
|
+
assert_equal(0, ihg.preempt_delay_minimum)
|
394
|
+
assert_equal(0, ihg.preempt_delay_reload)
|
395
|
+
assert_equal(0, ihg.preempt_delay_sync)
|
396
|
+
ihg.preempt_set(ihg.default_preempt,
|
397
|
+
ihg.default_preempt_delay_minimum,
|
398
|
+
ihg.default_preempt_delay_reload,
|
399
|
+
ihg.default_preempt_delay_sync)
|
400
|
+
assert_equal(ihg.default_preempt, ihg.preempt)
|
401
|
+
assert_equal(ihg.default_preempt_delay_minimum, ihg.preempt_delay_minimum)
|
402
|
+
assert_equal(ihg.default_preempt_delay_reload, ihg.preempt_delay_reload)
|
403
|
+
assert_equal(ihg.default_preempt_delay_sync, ihg.preempt_delay_sync)
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_priority_ipv4
|
407
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
408
|
+
ihg = create_interface_hsrp_group_ipv4
|
409
|
+
assert_equal(ihg.default_priority, ihg.priority)
|
410
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
411
|
+
ihg.priority_forward_thresh_lower)
|
412
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
413
|
+
ihg.priority_forward_thresh_upper)
|
414
|
+
ihg.priority_level_set(50, 10, 20)
|
415
|
+
assert_equal(50, ihg.priority)
|
416
|
+
assert_equal(10, ihg.priority_forward_thresh_lower)
|
417
|
+
assert_equal(20, ihg.priority_forward_thresh_upper)
|
418
|
+
ihg.priority_level_set(99,
|
419
|
+
ihg.default_priority_forward_thresh_lower,
|
420
|
+
ihg.default_priority_forward_thresh_upper)
|
421
|
+
assert_equal(99, ihg.priority)
|
422
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
423
|
+
ihg.priority_forward_thresh_lower)
|
424
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
425
|
+
ihg.priority_forward_thresh_upper)
|
426
|
+
ihg.priority_level_set(ihg.default_priority,
|
427
|
+
ihg.default_priority_forward_thresh_lower,
|
428
|
+
ihg.default_priority_forward_thresh_upper)
|
429
|
+
assert_equal(ihg.default_priority, ihg.priority)
|
430
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
431
|
+
ihg.priority_forward_thresh_lower)
|
432
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
433
|
+
ihg.priority_forward_thresh_upper)
|
434
|
+
end
|
435
|
+
|
436
|
+
def test_priority_ipv6
|
437
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
438
|
+
ihg = create_interface_hsrp_group_ipv6
|
439
|
+
assert_equal(ihg.default_priority, ihg.priority)
|
440
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
441
|
+
ihg.priority_forward_thresh_lower)
|
442
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
443
|
+
ihg.priority_forward_thresh_upper)
|
444
|
+
ihg.priority_level_set(44, 22, 33)
|
445
|
+
assert_equal(44, ihg.priority)
|
446
|
+
assert_equal(22, ihg.priority_forward_thresh_lower)
|
447
|
+
assert_equal(33, ihg.priority_forward_thresh_upper)
|
448
|
+
ihg.priority_level_set(155,
|
449
|
+
ihg.default_priority_forward_thresh_lower,
|
450
|
+
ihg.default_priority_forward_thresh_upper)
|
451
|
+
assert_equal(155, ihg.priority)
|
452
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
453
|
+
ihg.priority_forward_thresh_lower)
|
454
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
455
|
+
ihg.priority_forward_thresh_upper)
|
456
|
+
ihg.priority_level_set(ihg.default_priority,
|
457
|
+
ihg.default_priority_forward_thresh_lower,
|
458
|
+
ihg.default_priority_forward_thresh_upper)
|
459
|
+
assert_equal(ihg.default_priority, ihg.priority)
|
460
|
+
assert_equal(ihg.default_priority_forward_thresh_lower,
|
461
|
+
ihg.priority_forward_thresh_lower)
|
462
|
+
assert_equal(ihg.default_priority_forward_thresh_upper,
|
463
|
+
ihg.priority_forward_thresh_upper)
|
464
|
+
end
|
465
|
+
|
466
|
+
def test_timers_ipv4
|
467
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
468
|
+
ihg = create_interface_hsrp_group_ipv4
|
469
|
+
assert_equal(ihg.default_timers_hello, ihg.timers_hello)
|
470
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
471
|
+
assert_equal(ihg.default_timers_hold, ihg.timers_hold)
|
472
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
473
|
+
ihg.timers_set(ihg.default_timers_hello_msec,
|
474
|
+
10, ihg.default_timers_hold_msec, 50)
|
475
|
+
assert_equal(10, ihg.timers_hello)
|
476
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
477
|
+
assert_equal(50, ihg.timers_hold)
|
478
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
479
|
+
ihg.timers_set(true, 500, true, 1500)
|
480
|
+
assert_equal(500, ihg.timers_hello)
|
481
|
+
assert_equal(true, ihg.timers_hello_msec)
|
482
|
+
assert_equal(1500, ihg.timers_hold)
|
483
|
+
assert_equal(true, ihg.timers_hold_msec)
|
484
|
+
ihg.timers_set(true, 500, false, 5)
|
485
|
+
assert_equal(500, ihg.timers_hello)
|
486
|
+
assert_equal(true, ihg.timers_hello_msec)
|
487
|
+
assert_equal(5, ihg.timers_hold)
|
488
|
+
assert_equal(false, ihg.timers_hold_msec)
|
489
|
+
ihg.timers_set(ihg.default_timers_hello_msec,
|
490
|
+
ihg.default_timers_hello,
|
491
|
+
ihg.default_timers_hold_msec,
|
492
|
+
ihg.default_timers_hold)
|
493
|
+
assert_equal(ihg.default_timers_hello, ihg.timers_hello)
|
494
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
495
|
+
assert_equal(ihg.default_timers_hold, ihg.timers_hold)
|
496
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
497
|
+
end
|
498
|
+
|
499
|
+
def test_timers_ipv6
|
500
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
501
|
+
ihg = create_interface_hsrp_group_ipv6
|
502
|
+
assert_equal(ihg.default_timers_hello, ihg.timers_hello)
|
503
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
504
|
+
assert_equal(ihg.default_timers_hold, ihg.timers_hold)
|
505
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
506
|
+
ihg.timers_set(ihg.default_timers_hello_msec,
|
507
|
+
20, ihg.default_timers_hold_msec, 100)
|
508
|
+
assert_equal(20, ihg.timers_hello)
|
509
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
510
|
+
assert_equal(100, ihg.timers_hold)
|
511
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
512
|
+
ihg.timers_set(true, 300, true, 2000)
|
513
|
+
assert_equal(300, ihg.timers_hello)
|
514
|
+
assert_equal(true, ihg.timers_hello_msec)
|
515
|
+
assert_equal(2000, ihg.timers_hold)
|
516
|
+
assert_equal(true, ihg.timers_hold_msec)
|
517
|
+
ihg.timers_set(true, 300, false, 10)
|
518
|
+
assert_equal(300, ihg.timers_hello)
|
519
|
+
assert_equal(true, ihg.timers_hello_msec)
|
520
|
+
assert_equal(10, ihg.timers_hold)
|
521
|
+
assert_equal(false, ihg.timers_hold_msec)
|
522
|
+
ihg.timers_set(ihg.default_timers_hello_msec,
|
523
|
+
ihg.default_timers_hello,
|
524
|
+
ihg.default_timers_hold_msec,
|
525
|
+
ihg.default_timers_hold)
|
526
|
+
assert_equal(ihg.default_timers_hello, ihg.timers_hello)
|
527
|
+
assert_equal(ihg.default_timers_hello_msec, ihg.timers_hello_msec)
|
528
|
+
assert_equal(ihg.default_timers_hold, ihg.timers_hold)
|
529
|
+
assert_equal(ihg.default_timers_hold_msec, ihg.timers_hold_msec)
|
530
|
+
end
|
531
|
+
|
532
|
+
def test_ipv4_vip
|
533
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
534
|
+
ihg = create_interface_hsrp_group_ipv4
|
535
|
+
assert_equal(ihg.default_ipv4_enable, ihg.ipv4_enable)
|
536
|
+
assert_equal(ihg.default_ipv4_vip, ihg.ipv4_vip)
|
537
|
+
ihg.ipv4_vip_set(true, ihg.default_ipv4_vip)
|
538
|
+
assert_equal(true, ihg.ipv4_enable)
|
539
|
+
assert_equal(ihg.default_ipv4_vip, ihg.ipv4_vip)
|
540
|
+
ihg.ipv4_vip_set(true, '1.1.1.1')
|
541
|
+
assert_equal(true, ihg.ipv4_enable)
|
542
|
+
assert_equal('1.1.1.1', ihg.ipv4_vip)
|
543
|
+
ihg.ipv4_vip_set(true, ihg.default_ipv4_vip)
|
544
|
+
assert_equal(true, ihg.ipv4_enable)
|
545
|
+
assert_equal(ihg.default_ipv4_vip, ihg.ipv4_vip)
|
546
|
+
ihg.ipv4_vip_set(ihg.default_ipv4_enable, ihg.default_ipv4_vip)
|
547
|
+
assert_equal(ihg.default_ipv4_enable, ihg.ipv4_enable)
|
548
|
+
assert_equal(ihg.default_ipv4_vip, ihg.ipv4_vip)
|
549
|
+
ihg.ipv4_vip_set(true, '1.1.1.1')
|
550
|
+
ihg.ipv4_vip_set(ihg.default_ipv4_enable, ihg.default_ipv4_vip)
|
551
|
+
assert_equal(ihg.default_ipv4_enable, ihg.ipv4_enable)
|
552
|
+
assert_equal(ihg.default_ipv4_vip, ihg.ipv4_vip)
|
553
|
+
end
|
554
|
+
|
555
|
+
def test_ipv6_vip
|
556
|
+
skip_legacy_defect?('7.3.0.D1.1', 'CSCuh90262: hsrp indentation')
|
557
|
+
config_no_warn('interface Po100 ; ipv6 address 2000::01/64')
|
558
|
+
ihg = create_interface_hsrp_group_ipv6
|
559
|
+
assert_equal(ihg.default_ipv6_vip, ihg.ipv6_vip)
|
560
|
+
ihg.ipv6_vip = ['2000::11', '2000::55']
|
561
|
+
assert_equal(['2000::11', '2000::55'], ihg.ipv6_vip)
|
562
|
+
ihg.ipv6_vip = ihg.default_ipv6_vip
|
563
|
+
assert_equal(ihg.default_ipv6_vip, ihg.ipv6_vip)
|
564
|
+
assert_equal(ihg.default_ipv6_autoconfig, ihg.ipv6_autoconfig)
|
565
|
+
ihg.ipv6_autoconfig = true
|
566
|
+
assert_equal(true, ihg.ipv6_autoconfig)
|
567
|
+
ihg.ipv6_autoconfig = ihg.default_ipv6_autoconfig
|
568
|
+
assert_equal(ihg.default_ipv6_autoconfig, ihg.ipv6_autoconfig)
|
569
|
+
end
|
570
|
+
end
|