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,575 @@
|
|
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/stp_global'
|
17
|
+
|
18
|
+
# TestStpGlobal - Minitest for StpGlobal node utility class
|
19
|
+
class TestStpGlobal < CiscoTestCase
|
20
|
+
@skip_unless_supported = 'stp_global'
|
21
|
+
# TESTS
|
22
|
+
|
23
|
+
@@clean = false # rubocop:disable Style/ClassVars
|
24
|
+
def setup
|
25
|
+
super
|
26
|
+
config 'no spanning-tree mode'
|
27
|
+
remove_all_vlans
|
28
|
+
@intf = Interface.new(interfaces[0])
|
29
|
+
|
30
|
+
# Only pre-clean interface on initial setup
|
31
|
+
config("default interface #{interfaces[0]}") unless @@clean
|
32
|
+
@@clean = true # rubocop:disable Style/ClassVars
|
33
|
+
@intf.switchport_enable
|
34
|
+
end
|
35
|
+
|
36
|
+
def teardown
|
37
|
+
config 'no spanning-tree mode'
|
38
|
+
remove_all_vlans
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_bd_forward_time_change
|
43
|
+
global = StpGlobal.new('default')
|
44
|
+
bdft = [%w(2-4,6,8-12 4), %w(14 30)]
|
45
|
+
if validate_property_excluded?('stp_global', 'bd_forward_time')
|
46
|
+
assert_nil(global.bd_forward_time)
|
47
|
+
assert_raises(Cisco::UnsupportedError) do
|
48
|
+
global.bd_forward_time = bdft
|
49
|
+
end
|
50
|
+
else
|
51
|
+
config 'system bridge-domain all'
|
52
|
+
global.bd_forward_time = global.default_bd_forward_time
|
53
|
+
assert_equal(global.default_bd_forward_time,
|
54
|
+
global.bd_forward_time)
|
55
|
+
global.bd_forward_time = bdft
|
56
|
+
assert_equal(bdft, global.bd_forward_time)
|
57
|
+
global.bd_forward_time = global.default_bd_forward_time
|
58
|
+
assert_equal(global.default_bd_forward_time,
|
59
|
+
global.bd_forward_time)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_bd_hello_time_change
|
64
|
+
global = StpGlobal.new('default')
|
65
|
+
bdft = [%w(2-4,6,8-12 1), %w(14 10)]
|
66
|
+
if validate_property_excluded?('stp_global', 'bd_hello_time')
|
67
|
+
assert_nil(global.bd_hello_time)
|
68
|
+
assert_raises(Cisco::UnsupportedError) do
|
69
|
+
global.bd_hello_time = bdft
|
70
|
+
end
|
71
|
+
else
|
72
|
+
config 'system bridge-domain all'
|
73
|
+
global.bd_hello_time = global.default_bd_hello_time
|
74
|
+
assert_equal(global.default_bd_hello_time,
|
75
|
+
global.bd_hello_time)
|
76
|
+
global.bd_hello_time = bdft
|
77
|
+
assert_equal(bdft, global.bd_hello_time)
|
78
|
+
global.bd_hello_time = global.default_bd_hello_time
|
79
|
+
assert_equal(global.default_bd_hello_time,
|
80
|
+
global.bd_hello_time)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_bd_max_age_change
|
85
|
+
global = StpGlobal.new('default')
|
86
|
+
bdft = [%w(2-4,6,8-12 10), %w(14 40)]
|
87
|
+
if validate_property_excluded?('stp_global', 'bd_max_age')
|
88
|
+
assert_nil(global.bd_max_age)
|
89
|
+
assert_raises(Cisco::UnsupportedError) do
|
90
|
+
global.bd_max_age = bdft
|
91
|
+
end
|
92
|
+
else
|
93
|
+
config 'system bridge-domain all'
|
94
|
+
global.bd_max_age = global.default_bd_max_age
|
95
|
+
assert_equal(global.default_bd_max_age,
|
96
|
+
global.bd_max_age)
|
97
|
+
global.bd_max_age = bdft
|
98
|
+
assert_equal(bdft, global.bd_max_age)
|
99
|
+
global.bd_max_age = global.default_bd_max_age
|
100
|
+
assert_equal(global.default_bd_max_age,
|
101
|
+
global.bd_max_age)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_bd_priorities_change
|
106
|
+
global = StpGlobal.new('default')
|
107
|
+
bdft = [%w(2-4,6,8-12 4096), %w(14 8192)]
|
108
|
+
if validate_property_excluded?('stp_global', 'bd_priority')
|
109
|
+
assert_nil(global.bd_priority)
|
110
|
+
assert_nil(global.bd_root_priority)
|
111
|
+
assert_nil(global.bd_designated_priority)
|
112
|
+
assert_raises(Cisco::UnsupportedError) do
|
113
|
+
global.bd_priority = bdft
|
114
|
+
end
|
115
|
+
assert_raises(Cisco::UnsupportedError) do
|
116
|
+
global.bd_root_priority = bdft
|
117
|
+
end
|
118
|
+
assert_raises(Cisco::UnsupportedError) do
|
119
|
+
global.bd_designated_priority = bdft
|
120
|
+
end
|
121
|
+
else
|
122
|
+
config 'system bridge-domain all'
|
123
|
+
global.bd_priority = global.default_bd_priority
|
124
|
+
global.bd_root_priority = global.default_bd_root_priority
|
125
|
+
global.bd_designated_priority = global.default_bd_designated_priority
|
126
|
+
assert_equal(global.default_bd_priority,
|
127
|
+
global.bd_priority)
|
128
|
+
assert_equal(global.default_bd_root_priority,
|
129
|
+
global.bd_root_priority)
|
130
|
+
assert_equal(global.default_bd_designated_priority,
|
131
|
+
global.bd_designated_priority)
|
132
|
+
global.bd_priority = bdft
|
133
|
+
global.bd_root_priority = bdft
|
134
|
+
global.bd_designated_priority = bdft
|
135
|
+
assert_equal(bdft, global.bd_priority)
|
136
|
+
assert_equal(bdft, global.bd_root_priority)
|
137
|
+
assert_equal(bdft, global.bd_designated_priority)
|
138
|
+
global.bd_priority = global.default_bd_priority
|
139
|
+
global.bd_root_priority = global.default_bd_root_priority
|
140
|
+
global.bd_designated_priority = global.default_bd_designated_priority
|
141
|
+
assert_equal(global.default_bd_priority,
|
142
|
+
global.bd_priority)
|
143
|
+
assert_equal(global.default_bd_root_priority,
|
144
|
+
global.bd_root_priority)
|
145
|
+
assert_equal(global.default_bd_designated_priority,
|
146
|
+
global.bd_designated_priority)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_get_set_bpdufilter
|
151
|
+
global = StpGlobal.new('default')
|
152
|
+
global.bpdufilter = true
|
153
|
+
assert_equal(true, global.bpdufilter)
|
154
|
+
global.bpdufilter =
|
155
|
+
global.default_bpdufilter
|
156
|
+
assert_equal(global.default_bpdufilter,
|
157
|
+
global.bpdufilter)
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_get_set_bpduguard
|
161
|
+
global = StpGlobal.new('default')
|
162
|
+
global.bpduguard = true
|
163
|
+
assert_equal(true, global.bpduguard)
|
164
|
+
global.bpduguard =
|
165
|
+
global.default_bpduguard
|
166
|
+
assert_equal(global.default_bpduguard,
|
167
|
+
global.bpduguard)
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_get_set_bridge_assurance
|
171
|
+
global = StpGlobal.new('default')
|
172
|
+
global.bridge_assurance = false
|
173
|
+
assert_equal(false, global.bridge_assurance)
|
174
|
+
global.bridge_assurance =
|
175
|
+
global.default_bridge_assurance
|
176
|
+
assert_equal(global.default_bridge_assurance,
|
177
|
+
global.bridge_assurance)
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_get_set_domain
|
181
|
+
global = StpGlobal.new('default')
|
182
|
+
if validate_property_excluded?('stp_global', 'domain')
|
183
|
+
assert_nil(global.domain)
|
184
|
+
assert_raises(Cisco::UnsupportedError) do
|
185
|
+
global.domain = 200
|
186
|
+
end
|
187
|
+
else
|
188
|
+
skip_incompat_version?('stp_global', 'domain')
|
189
|
+
global.domain = 100
|
190
|
+
assert_equal(100, global.domain)
|
191
|
+
global.domain =
|
192
|
+
global.default_domain
|
193
|
+
assert_equal(global.default_domain,
|
194
|
+
global.domain)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def test_get_set_fcoe
|
199
|
+
global = StpGlobal.new('default')
|
200
|
+
if validate_property_excluded?('stp_global', 'fcoe')
|
201
|
+
assert_nil(global.fcoe)
|
202
|
+
assert_raises(Cisco::UnsupportedError) do
|
203
|
+
global.fcoe = false
|
204
|
+
end
|
205
|
+
else
|
206
|
+
global.fcoe = false
|
207
|
+
assert_equal(false, global.fcoe)
|
208
|
+
global.fcoe =
|
209
|
+
global.default_fcoe
|
210
|
+
assert_equal(global.default_fcoe,
|
211
|
+
global.fcoe)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_get_set_loopguard
|
216
|
+
global = StpGlobal.new('default')
|
217
|
+
global.loopguard = true
|
218
|
+
assert_equal(true, global.loopguard)
|
219
|
+
global.loopguard =
|
220
|
+
global.default_loopguard
|
221
|
+
assert_equal(global.default_loopguard,
|
222
|
+
global.loopguard)
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_get_set_mode
|
226
|
+
global = StpGlobal.new('default')
|
227
|
+
global.mode = 'mst'
|
228
|
+
assert_equal('mst', global.mode)
|
229
|
+
global.mode =
|
230
|
+
global.default_mode
|
231
|
+
assert_equal(global.default_mode,
|
232
|
+
global.mode)
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_get_set_mst_priorities
|
236
|
+
# TBD: Add N9k-EX to allowed platforms list and use proper _exclude tags
|
237
|
+
skip('TBD: Limited support for N9k-EX') if node.product_id[/N9K.*EX/]
|
238
|
+
global = StpGlobal.new('default')
|
239
|
+
global.mode = 'mst'
|
240
|
+
global.mst_priority = global.default_mst_priority
|
241
|
+
global.mst_root_priority = global.default_mst_root_priority
|
242
|
+
global.mst_designated_priority = global.default_mst_designated_priority
|
243
|
+
assert_equal(global.default_mst_priority,
|
244
|
+
global.mst_priority)
|
245
|
+
assert_equal(global.default_mst_root_priority,
|
246
|
+
global.mst_root_priority)
|
247
|
+
assert_equal(global.default_mst_designated_priority,
|
248
|
+
global.mst_designated_priority)
|
249
|
+
bddp = [%w(0-4,6,8-12 4096), %w(14 8192)]
|
250
|
+
global.mst_priority = bddp
|
251
|
+
global.mst_root_priority = bddp
|
252
|
+
global.mst_designated_priority = bddp
|
253
|
+
assert_equal(bddp, global.mst_priority)
|
254
|
+
assert_equal(bddp, global.mst_root_priority)
|
255
|
+
assert_equal(bddp, global.mst_designated_priority)
|
256
|
+
global.mst_priority = global.default_mst_priority
|
257
|
+
global.mst_root_priority = global.default_mst_root_priority
|
258
|
+
global.mst_designated_priority = global.default_mst_designated_priority
|
259
|
+
assert_equal(global.default_mst_priority,
|
260
|
+
global.mst_priority)
|
261
|
+
assert_equal(global.default_mst_root_priority,
|
262
|
+
global.mst_root_priority)
|
263
|
+
assert_equal(global.default_mst_designated_priority,
|
264
|
+
global.mst_designated_priority)
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_get_set_mst_forward_time
|
268
|
+
global = StpGlobal.new('default')
|
269
|
+
global.mode = 'mst'
|
270
|
+
global.mst_forward_time = 25
|
271
|
+
assert_equal(25, global.mst_forward_time)
|
272
|
+
global.mst_forward_time =
|
273
|
+
global.default_mst_forward_time
|
274
|
+
assert_equal(global.default_mst_forward_time,
|
275
|
+
global.mst_forward_time)
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_get_set_mst_hello_time
|
279
|
+
global = StpGlobal.new('default')
|
280
|
+
global.mode = 'mst'
|
281
|
+
global.mst_hello_time = 5
|
282
|
+
assert_equal(5, global.mst_hello_time)
|
283
|
+
global.mst_hello_time =
|
284
|
+
global.default_mst_hello_time
|
285
|
+
assert_equal(global.default_mst_hello_time,
|
286
|
+
global.mst_hello_time)
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_get_set_mst_inst_vlan_map
|
290
|
+
global = StpGlobal.new('default')
|
291
|
+
global.mode = 'mst'
|
292
|
+
global.mst_inst_vlan_map = global.default_mst_inst_vlan_map
|
293
|
+
assert_equal(global.default_mst_inst_vlan_map,
|
294
|
+
global.mst_inst_vlan_map)
|
295
|
+
bddp = [%w(8 2-65), %w(14 200-300)]
|
296
|
+
global.mst_inst_vlan_map = bddp
|
297
|
+
assert_equal(bddp, global.mst_inst_vlan_map)
|
298
|
+
global.mst_inst_vlan_map = global.default_mst_inst_vlan_map
|
299
|
+
assert_equal(global.default_mst_inst_vlan_map,
|
300
|
+
global.mst_inst_vlan_map)
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_get_set_mst_max_age
|
304
|
+
global = StpGlobal.new('default')
|
305
|
+
global.mode = 'mst'
|
306
|
+
global.mst_max_age = 35
|
307
|
+
assert_equal(35, global.mst_max_age)
|
308
|
+
global.mst_max_age =
|
309
|
+
global.default_mst_max_age
|
310
|
+
assert_equal(global.default_mst_max_age,
|
311
|
+
global.mst_max_age)
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_get_set_mst_max_hops
|
315
|
+
global = StpGlobal.new('default')
|
316
|
+
global.mode = 'mst'
|
317
|
+
global.mst_max_hops = 200
|
318
|
+
assert_equal(200, global.mst_max_hops)
|
319
|
+
global.mst_max_hops =
|
320
|
+
global.default_mst_max_hops
|
321
|
+
assert_equal(global.default_mst_max_hops,
|
322
|
+
global.mst_max_hops)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_get_set_mst_name
|
326
|
+
global = StpGlobal.new('default')
|
327
|
+
global.mode = 'mst'
|
328
|
+
global.mst_name = 'nexus'
|
329
|
+
assert_equal('nexus', global.mst_name)
|
330
|
+
global.mst_name =
|
331
|
+
global.default_mst_name
|
332
|
+
assert_equal(global.default_mst_name,
|
333
|
+
global.mst_name)
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_get_set_mst_revision
|
337
|
+
global = StpGlobal.new('default')
|
338
|
+
global.mode = 'mst'
|
339
|
+
global.mst_revision = 34
|
340
|
+
assert_equal(34, global.mst_revision)
|
341
|
+
global.mst_revision =
|
342
|
+
global.default_mst_revision
|
343
|
+
assert_equal(global.default_mst_revision,
|
344
|
+
global.mst_revision)
|
345
|
+
end
|
346
|
+
|
347
|
+
def test_get_set_pathcost
|
348
|
+
global = StpGlobal.new('default')
|
349
|
+
global.pathcost = 'long'
|
350
|
+
assert_equal('long', global.pathcost)
|
351
|
+
global.pathcost =
|
352
|
+
global.default_pathcost
|
353
|
+
assert_equal(global.default_pathcost,
|
354
|
+
global.pathcost)
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_get_set_vlan_forward_time
|
358
|
+
global = StpGlobal.new('default')
|
359
|
+
global.vlan_forward_time = global.default_vlan_forward_time
|
360
|
+
assert_equal(global.default_vlan_forward_time,
|
361
|
+
global.vlan_forward_time)
|
362
|
+
bddp = [%w(1-4,6,8-12 10), %w(14 8)]
|
363
|
+
global.vlan_forward_time = bddp
|
364
|
+
assert_equal(bddp, global.vlan_forward_time)
|
365
|
+
global.vlan_forward_time = global.default_vlan_forward_time
|
366
|
+
assert_equal(global.default_vlan_forward_time,
|
367
|
+
global.vlan_forward_time)
|
368
|
+
end
|
369
|
+
|
370
|
+
def test_get_set_vlan_hello_time
|
371
|
+
global = StpGlobal.new('default')
|
372
|
+
global.vlan_hello_time = global.default_vlan_hello_time
|
373
|
+
assert_equal(global.default_vlan_hello_time,
|
374
|
+
global.vlan_hello_time)
|
375
|
+
bddp = [%w(1-4,6,8-12 5), %w(14 8)]
|
376
|
+
global.vlan_hello_time = bddp
|
377
|
+
assert_equal(bddp, global.vlan_hello_time)
|
378
|
+
global.vlan_hello_time = global.default_vlan_hello_time
|
379
|
+
assert_equal(global.default_vlan_hello_time,
|
380
|
+
global.vlan_hello_time)
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_get_set_vlan_max_age
|
384
|
+
global = StpGlobal.new('default')
|
385
|
+
global.vlan_max_age = global.default_vlan_max_age
|
386
|
+
assert_equal(global.default_vlan_max_age,
|
387
|
+
global.vlan_max_age)
|
388
|
+
bddp = [%w(1-4,6,8-12 40), %w(14 35)]
|
389
|
+
global.vlan_max_age = bddp
|
390
|
+
assert_equal(bddp, global.vlan_max_age)
|
391
|
+
global.vlan_max_age = global.default_vlan_max_age
|
392
|
+
assert_equal(global.default_vlan_max_age,
|
393
|
+
global.vlan_max_age)
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_get_set_vlan_priorities
|
397
|
+
# TBD: Add N9k-EX to allowed platforms list and use proper _exclude tags
|
398
|
+
skip('TBD: Limited support for N9k-EX') if node.product_id[/N9K.*EX/]
|
399
|
+
global = StpGlobal.new('default')
|
400
|
+
global.vlan_priority = global.default_vlan_priority
|
401
|
+
global.vlan_root_priority = global.default_vlan_root_priority
|
402
|
+
global.vlan_designated_priority = global.default_vlan_designated_priority
|
403
|
+
assert_equal(global.default_vlan_priority,
|
404
|
+
global.vlan_priority)
|
405
|
+
assert_equal(global.default_vlan_root_priority,
|
406
|
+
global.vlan_root_priority)
|
407
|
+
assert_equal(global.default_vlan_designated_priority,
|
408
|
+
global.vlan_designated_priority)
|
409
|
+
bddp = [%w(1-4,6,8-12 4096), %w(14 8192)]
|
410
|
+
global.vlan_priority = bddp
|
411
|
+
global.vlan_root_priority = bddp
|
412
|
+
global.vlan_designated_priority = bddp
|
413
|
+
assert_equal(bddp, global.vlan_priority)
|
414
|
+
assert_equal(bddp, global.vlan_root_priority)
|
415
|
+
assert_equal(bddp, global.vlan_designated_priority)
|
416
|
+
global.vlan_priority = global.default_vlan_priority
|
417
|
+
global.vlan_root_priority = global.default_vlan_root_priority
|
418
|
+
global.vlan_designated_priority = global.default_vlan_designated_priority
|
419
|
+
assert_equal(global.default_vlan_priority,
|
420
|
+
global.vlan_priority)
|
421
|
+
assert_equal(global.default_vlan_root_priority,
|
422
|
+
global.vlan_root_priority)
|
423
|
+
assert_equal(global.default_vlan_designated_priority,
|
424
|
+
global.vlan_designated_priority)
|
425
|
+
end
|
426
|
+
|
427
|
+
def test_intf_stp_bpdufilter_change
|
428
|
+
@intf.stp_bpdufilter = 'enable'
|
429
|
+
assert_equal('enable', @intf.stp_bpdufilter)
|
430
|
+
@intf.stp_bpdufilter = 'disable'
|
431
|
+
assert_equal('disable', @intf.stp_bpdufilter)
|
432
|
+
@intf.stp_bpdufilter = @intf.default_stp_bpdufilter
|
433
|
+
assert_equal(@intf.default_stp_bpdufilter,
|
434
|
+
@intf.stp_bpdufilter)
|
435
|
+
end
|
436
|
+
|
437
|
+
def test_intf_stp_bpduguard_change
|
438
|
+
@intf.stp_bpduguard = 'enable'
|
439
|
+
assert_equal('enable', @intf.stp_bpduguard)
|
440
|
+
@intf.stp_bpduguard = 'disable'
|
441
|
+
assert_equal('disable', @intf.stp_bpduguard)
|
442
|
+
@intf.stp_bpduguard = @intf.default_stp_bpduguard
|
443
|
+
assert_equal(@intf.default_stp_bpduguard,
|
444
|
+
@intf.stp_bpduguard)
|
445
|
+
end
|
446
|
+
|
447
|
+
def test_intf_stp_cost_change
|
448
|
+
@intf.stp_cost = 2000
|
449
|
+
assert_equal(2000, @intf.stp_cost)
|
450
|
+
@intf.stp_cost = @intf.default_stp_cost
|
451
|
+
assert_equal(@intf.default_stp_cost,
|
452
|
+
@intf.stp_cost)
|
453
|
+
end
|
454
|
+
|
455
|
+
def test_intf_stp_guard_change
|
456
|
+
@intf.stp_guard = 'loop'
|
457
|
+
assert_equal('loop', @intf.stp_guard)
|
458
|
+
@intf.stp_guard = 'none'
|
459
|
+
assert_equal('none', @intf.stp_guard)
|
460
|
+
@intf.stp_guard = 'root'
|
461
|
+
assert_equal('root', @intf.stp_guard)
|
462
|
+
@intf.stp_guard = @intf.default_stp_guard
|
463
|
+
assert_equal(@intf.default_stp_guard,
|
464
|
+
@intf.stp_guard)
|
465
|
+
end
|
466
|
+
|
467
|
+
def test_intf_stp_link_type_change
|
468
|
+
@intf.stp_link_type = 'shared'
|
469
|
+
assert_equal('shared', @intf.stp_link_type)
|
470
|
+
@intf.stp_link_type = 'point-to-point'
|
471
|
+
assert_equal('point-to-point', @intf.stp_link_type)
|
472
|
+
@intf.stp_link_type = @intf.default_stp_link_type
|
473
|
+
assert_equal(@intf.default_stp_link_type,
|
474
|
+
@intf.stp_link_type)
|
475
|
+
end
|
476
|
+
|
477
|
+
def test_intf_stp_port_priority_change
|
478
|
+
@intf.stp_port_priority = 32
|
479
|
+
assert_equal(32, @intf.stp_port_priority)
|
480
|
+
@intf.stp_port_priority = @intf.default_stp_port_priority
|
481
|
+
assert_equal(@intf.default_stp_port_priority,
|
482
|
+
@intf.stp_port_priority)
|
483
|
+
end
|
484
|
+
|
485
|
+
def test_intf_stp_port_type_change
|
486
|
+
@intf.switchport_mode = :disabled
|
487
|
+
@intf.switchport_mode = :trunk
|
488
|
+
@intf.stp_port_type = 'edge'
|
489
|
+
assert_equal('edge', @intf.stp_port_type)
|
490
|
+
@intf.stp_port_type = 'edge trunk'
|
491
|
+
assert_equal('edge trunk', @intf.stp_port_type)
|
492
|
+
@intf.stp_port_type = 'network'
|
493
|
+
assert_equal('network', @intf.stp_port_type)
|
494
|
+
@intf.stp_port_type = 'normal'
|
495
|
+
assert_equal('normal', @intf.stp_port_type)
|
496
|
+
@intf.stp_port_type = @intf.default_stp_port_type
|
497
|
+
assert_equal(@intf.default_stp_port_type,
|
498
|
+
@intf.stp_port_type)
|
499
|
+
# Set default again and check. This is needed since
|
500
|
+
# we query the stp_port_type to use with the 'no'
|
501
|
+
# form of the command and false is not a valid
|
502
|
+
# stp_port_type
|
503
|
+
@intf.stp_port_type = @intf.default_stp_port_type
|
504
|
+
assert_equal(@intf.default_stp_port_type,
|
505
|
+
@intf.stp_port_type)
|
506
|
+
end
|
507
|
+
|
508
|
+
def test_intf_stp_mst_cost_change
|
509
|
+
@intf.stp_mst_cost = @intf.default_stp_mst_cost
|
510
|
+
assert_equal(@intf.default_stp_mst_cost,
|
511
|
+
@intf.stp_mst_cost)
|
512
|
+
mc = [%w(0,2-4,6,8-12 4500), %w(1 20000)]
|
513
|
+
@intf.stp_mst_cost = mc
|
514
|
+
assert_equal(mc, @intf.stp_mst_cost)
|
515
|
+
@intf.stp_mst_cost = @intf.default_stp_mst_cost
|
516
|
+
assert_equal(@intf.default_stp_mst_cost,
|
517
|
+
@intf.stp_mst_cost)
|
518
|
+
end
|
519
|
+
|
520
|
+
def test_intf_stp_mst_port_priority_change
|
521
|
+
@intf.stp_mst_port_priority = @intf.default_stp_mst_port_priority
|
522
|
+
assert_equal(@intf.default_stp_mst_port_priority,
|
523
|
+
@intf.stp_mst_port_priority)
|
524
|
+
mpp = [%w(0,2-4,6,8-12 224), %w(1 32)]
|
525
|
+
@intf.stp_mst_port_priority = mpp
|
526
|
+
assert_equal(mpp, @intf.stp_mst_port_priority)
|
527
|
+
@intf.stp_mst_port_priority = @intf.default_stp_mst_port_priority
|
528
|
+
assert_equal(@intf.default_stp_mst_port_priority,
|
529
|
+
@intf.stp_mst_port_priority)
|
530
|
+
end
|
531
|
+
|
532
|
+
def test_intf_stp_vlan_cost_change
|
533
|
+
@intf.stp_vlan_cost = @intf.default_stp_vlan_cost
|
534
|
+
assert_equal(@intf.default_stp_vlan_cost,
|
535
|
+
@intf.stp_vlan_cost)
|
536
|
+
vc = [%w(2-4,6,8-12 4500), %w(14 20000)]
|
537
|
+
@intf.stp_vlan_cost = vc
|
538
|
+
assert_equal(vc, @intf.stp_vlan_cost)
|
539
|
+
@intf.stp_vlan_cost = @intf.default_stp_vlan_cost
|
540
|
+
assert_equal(@intf.default_stp_vlan_cost,
|
541
|
+
@intf.stp_vlan_cost)
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_intf_stp_vlan_port_priority_change
|
545
|
+
@intf.stp_vlan_port_priority = @intf.default_stp_vlan_port_priority
|
546
|
+
assert_equal(@intf.default_stp_vlan_port_priority,
|
547
|
+
@intf.stp_vlan_port_priority)
|
548
|
+
vpp = [%w(2-4,6,8-12 224), %w(14 32)]
|
549
|
+
@intf.stp_vlan_port_priority = vpp
|
550
|
+
assert_equal(vpp, @intf.stp_vlan_port_priority)
|
551
|
+
@intf.stp_vlan_port_priority = @intf.default_stp_vlan_port_priority
|
552
|
+
assert_equal(@intf.default_stp_vlan_port_priority,
|
553
|
+
@intf.stp_vlan_port_priority)
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_intf_stp_props_switchport_disabled
|
557
|
+
@intf.switchport_enable(false)
|
558
|
+
proplist = {
|
559
|
+
'bpdufilter' => 'enable',
|
560
|
+
'cost' => 2000,
|
561
|
+
'guard' => 'loop',
|
562
|
+
'link_type' => 'shared',
|
563
|
+
'mst_cost' => [%w(0,2-4,6,8-12 4500), %w(1 20000)],
|
564
|
+
'mst_port_priority' => [%w(0,2-4,6,8-12 224), %w(1 32)],
|
565
|
+
'port_priority' => 32,
|
566
|
+
'vlan_cost' => [%w(2-4,6,8-12 4500), %w(14 20000)],
|
567
|
+
'vlan_port_priority' => [%w(2-4,6,8-12 224), %w(14 32)],
|
568
|
+
}
|
569
|
+
proplist.each do |k, v|
|
570
|
+
assert_raises(RuntimeError, "#{@intf}: #{k} => #{v}") do
|
571
|
+
@intf.send("stp_#{k}=", v)
|
572
|
+
end
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
# Minitest for SyslogFacility class
|
3
|
+
#
|
4
|
+
# Copyright (c) 2014-2018 Cisco and/or its affiliates.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require_relative 'ciscotest'
|
19
|
+
require_relative '../lib/cisco_node_utils/syslog_facility'
|
20
|
+
|
21
|
+
# TestSyslogFacility - Minitest for SyslogFacility node utility.
|
22
|
+
class TestSyslogFacility < CiscoTestCase
|
23
|
+
def setup
|
24
|
+
# setup runs at the beginning of each test
|
25
|
+
super
|
26
|
+
no_syslogfacility
|
27
|
+
end
|
28
|
+
|
29
|
+
def teardown
|
30
|
+
# teardown runs at the end of each test
|
31
|
+
no_syslogfacility
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def no_syslogfacility
|
36
|
+
# Turn the feature off for a clean test.
|
37
|
+
config('no logging level aaa 6',
|
38
|
+
'no logging level ip igmp 6',
|
39
|
+
'no logging level routing ipv4 multicast 7')
|
40
|
+
end
|
41
|
+
|
42
|
+
# TESTS
|
43
|
+
|
44
|
+
def test_create_destroy
|
45
|
+
id = 'aaa'
|
46
|
+
refute_includes(Cisco::SyslogFacility.facilities, id)
|
47
|
+
|
48
|
+
facility = Cisco::SyslogFacility.new({ 'facility' => id, 'level' => 6 }, true)
|
49
|
+
assert_includes(Cisco::SyslogFacility.facilities, id)
|
50
|
+
assert_equal(Cisco::SyslogFacility.facilities[id], facility)
|
51
|
+
assert_equal(id, Cisco::SyslogFacility.facilities[id].facility)
|
52
|
+
assert_equal(6, Cisco::SyslogFacility.facilities[id].level)
|
53
|
+
|
54
|
+
facility.destroy
|
55
|
+
refute_includes(Cisco::SyslogFacility.facilities, id)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_create_destroy_extended
|
59
|
+
id = 'ip igmp'
|
60
|
+
id2 = 'routing ipv4 multicast'
|
61
|
+
refute_includes(Cisco::SyslogFacility.facilities, id)
|
62
|
+
refute_includes(Cisco::SyslogFacility.facilities, id2)
|
63
|
+
|
64
|
+
facility = Cisco::SyslogFacility.new({ 'facility' => id, 'level' => 6 }, true)
|
65
|
+
facility2 = Cisco::SyslogFacility.new({ 'facility' => id2, 'level' => 7 }, true)
|
66
|
+
assert_includes(Cisco::SyslogFacility.facilities, id)
|
67
|
+
assert_equal(Cisco::SyslogFacility.facilities[id], facility)
|
68
|
+
assert_equal(id, Cisco::SyslogFacility.facilities[id].facility)
|
69
|
+
assert_equal(6, Cisco::SyslogFacility.facilities[id].level)
|
70
|
+
assert_includes(Cisco::SyslogFacility.facilities, id2)
|
71
|
+
assert_equal(Cisco::SyslogFacility.facilities[id2], facility2)
|
72
|
+
assert_equal(id2, Cisco::SyslogFacility.facilities[id2].facility)
|
73
|
+
assert_equal(7, Cisco::SyslogFacility.facilities[id2].level)
|
74
|
+
|
75
|
+
facility.destroy
|
76
|
+
facility2.destroy
|
77
|
+
refute_includes(Cisco::SyslogFacility.facilities, id)
|
78
|
+
refute_includes(Cisco::SyslogFacility.facilities, id2)
|
79
|
+
end
|
80
|
+
end
|