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
data/tests/ciscotest.rb
ADDED
@@ -0,0 +1,577 @@
|
|
1
|
+
# Copyright (c) 2013-2017 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 'ipaddr'
|
16
|
+
require 'resolv'
|
17
|
+
require_relative 'basetest'
|
18
|
+
require_relative 'platform_info'
|
19
|
+
require_relative '../lib/cisco_node_utils/bridge_domain'
|
20
|
+
require_relative '../lib/cisco_node_utils/interface'
|
21
|
+
require_relative '../lib/cisco_node_utils/node'
|
22
|
+
require_relative '../lib/cisco_node_utils/platform'
|
23
|
+
require_relative '../lib/cisco_node_utils/vlan'
|
24
|
+
|
25
|
+
include Cisco
|
26
|
+
|
27
|
+
# CiscoTestCase - base class for all node utility minitests
|
28
|
+
class CiscoTestCase < TestCase
|
29
|
+
# rubocop:disable Style/ClassVars
|
30
|
+
@@node = nil
|
31
|
+
@@interfaces = nil
|
32
|
+
@@interfaces_id = nil
|
33
|
+
@@testcases = []
|
34
|
+
@@testcase_teardowns = 0
|
35
|
+
|
36
|
+
# The feature (lib/cisco_node_utils/cmd_ref/<feature>.yaml) that this
|
37
|
+
# test case is associated with, if applicable.
|
38
|
+
# If the YAML file excludes this entire feature for this platform
|
39
|
+
# (top-level _exclude statement, not individual attributes), then
|
40
|
+
# all tests in this test case will be skipped.
|
41
|
+
@skip_unless_supported = nil
|
42
|
+
|
43
|
+
class << self
|
44
|
+
attr_accessor :skip_unless_supported
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.runnable_methods
|
48
|
+
@@testcases = super
|
49
|
+
return super if skip_unless_supported.nil?
|
50
|
+
return super if node.cmd_ref.supports?(skip_unless_supported)
|
51
|
+
# If the entire feature under test is unsupported,
|
52
|
+
# undefine the setup/teardown methods (if any) and skip the whole test case
|
53
|
+
remove_method :setup if instance_methods(false).include?(:setup)
|
54
|
+
remove_method :teardown if instance_methods(false).include?(:teardown)
|
55
|
+
[:all_skipped]
|
56
|
+
end
|
57
|
+
|
58
|
+
def first_or_last_teardown
|
59
|
+
# Return true if this is the first or last teardown call.
|
60
|
+
# This hack is needed to prevent excessive post-test cleanups from
|
61
|
+
# occurring: e.g. a non-F3 N7k test class may require an expensive setup
|
62
|
+
# and teardown to enable/disable vdc settings; ideally this vdc setup
|
63
|
+
# would occur prior to the first test and vdc teardown only after the
|
64
|
+
# final test. Checks for first test case because we have to handle the
|
65
|
+
# -n option, which filters the list of runnable testcases.
|
66
|
+
# Note that Minitest.after_run is not a solution for this problem.
|
67
|
+
@@testcase_teardowns += 1
|
68
|
+
(@@testcase_teardowns == 1) || (@@testcase_teardowns == @@testcases.size)
|
69
|
+
end
|
70
|
+
# rubocop:enable Style/ClassVars
|
71
|
+
|
72
|
+
def all_skipped
|
73
|
+
skip("Skipping #{self.class}; feature " \
|
74
|
+
"'#{self.class.skip_unless_supported}' is unsupported on this node")
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.node
|
78
|
+
unless @@node
|
79
|
+
# rubocop:disable Style/ClassVars
|
80
|
+
@@node = Node.instance
|
81
|
+
# rubocop:enable Style/ClassVars
|
82
|
+
@@node.cache_enable = true
|
83
|
+
@@node.cache_auto = true
|
84
|
+
# Record the platform we're running on
|
85
|
+
puts "\nNode under test:"
|
86
|
+
puts " - name - #{@@node.host_name}"
|
87
|
+
puts " - type - #{@@node.product_id}"
|
88
|
+
puts " - image - #{@@node.system}"
|
89
|
+
puts " - version - #{@@node.os_version}\n\n"
|
90
|
+
end
|
91
|
+
@@node
|
92
|
+
rescue Cisco::AuthenticationFailed
|
93
|
+
abort "Unauthorized to connect as #{username}:#{password}@#{address}"
|
94
|
+
rescue Cisco::ClientError, TypeError, ArgumentError => e
|
95
|
+
abort "Error in establishing connection: #{e}"
|
96
|
+
end
|
97
|
+
|
98
|
+
def node
|
99
|
+
self.class.node
|
100
|
+
end
|
101
|
+
|
102
|
+
def setup
|
103
|
+
super
|
104
|
+
node
|
105
|
+
end
|
106
|
+
|
107
|
+
def cmd_ref
|
108
|
+
node.cmd_ref
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.platform
|
112
|
+
node.client.platform
|
113
|
+
end
|
114
|
+
|
115
|
+
def platform
|
116
|
+
self.class.platform
|
117
|
+
end
|
118
|
+
|
119
|
+
def config_and_warn_on_match(warn_match, *args)
|
120
|
+
if node.client.platform == :ios_xr
|
121
|
+
result = super(warn_match, *args, 'commit')
|
122
|
+
else
|
123
|
+
result = super
|
124
|
+
end
|
125
|
+
node.cache_flush
|
126
|
+
result
|
127
|
+
end
|
128
|
+
|
129
|
+
# Check exception and only fail if it does not contain message
|
130
|
+
def check_and_raise_error(exception, message)
|
131
|
+
fail exception unless exception.message.include?(message)
|
132
|
+
end
|
133
|
+
|
134
|
+
def ip_address?(ip)
|
135
|
+
return IPAddr.new(ip).ipv4?
|
136
|
+
rescue IPAddr::InvalidAddressError
|
137
|
+
false
|
138
|
+
end
|
139
|
+
|
140
|
+
def convert_dns_name(ip)
|
141
|
+
ip_address?(ip) ? ip : Resolv.getaddress(ip)
|
142
|
+
rescue Resolv::ResolvError
|
143
|
+
raise "Unable to resolve name #{ip}. Use static ip to connect instead!"
|
144
|
+
end
|
145
|
+
|
146
|
+
def address_match?(int_ip)
|
147
|
+
# Compare the interface address with the current session address.
|
148
|
+
# and return true if they match.
|
149
|
+
return false if int_ip.nil?
|
150
|
+
int_ip == convert_dns_name(address.split(':')[0])
|
151
|
+
end
|
152
|
+
|
153
|
+
# Some NXOS hardware is not capable of supporting certain features even
|
154
|
+
# though the platform family in general includes support. In these cases
|
155
|
+
# the NU feature setter will raise a RuntimeError.
|
156
|
+
# Default behavior is to skip/flunk.
|
157
|
+
def hardware_supports_feature?(message, status_only: false)
|
158
|
+
patterns = ['Hardware is not capable of supporting',
|
159
|
+
'is unsupported on this node',
|
160
|
+
'Feature NOT supported on this Platform',
|
161
|
+
]
|
162
|
+
if message[Regexp.union(patterns)]
|
163
|
+
return true if status_only
|
164
|
+
skip('Skip test: Feature is unsupported on this device')
|
165
|
+
end
|
166
|
+
flunk(message)
|
167
|
+
end
|
168
|
+
|
169
|
+
def incompatible_interface?(msg)
|
170
|
+
patterns = ['switchport_mode is not supported on this interface',
|
171
|
+
'Configuration does not match the port capability']
|
172
|
+
assert_match(Regexp.union(patterns), msg,
|
173
|
+
'Msg does not match known incompatibility messages')
|
174
|
+
end
|
175
|
+
|
176
|
+
def validate_property_excluded?(feature, property)
|
177
|
+
!node.cmd_ref.supports?(feature, property)
|
178
|
+
end
|
179
|
+
|
180
|
+
def skip_incompat_version?(feature, property)
|
181
|
+
ov = node.os_version_get(feature, property)
|
182
|
+
return if ov.nil?
|
183
|
+
im = Platform.image_version
|
184
|
+
pid = node.product_id
|
185
|
+
|
186
|
+
ver = nil
|
187
|
+
array = ov.split(';')
|
188
|
+
array.each do |e|
|
189
|
+
break if ver
|
190
|
+
key_values = e.split(':')
|
191
|
+
larr = key_values[0].split(',')
|
192
|
+
larr.each do |lkey|
|
193
|
+
if lkey.to_s == 'C3548'
|
194
|
+
# Special case N3k Platform
|
195
|
+
else
|
196
|
+
fail "Unrecognized product_id: #{lkey}" unless
|
197
|
+
lkey.downcase[/n(3|5|6|7|9)/]
|
198
|
+
end
|
199
|
+
next unless lkey.downcase.strip == product_tag
|
200
|
+
ver = key_values[1]
|
201
|
+
break if ver
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
return if ver.nil?
|
206
|
+
over = ver
|
207
|
+
lim = im.split[0].tr('(', '.').tr(')', '.').chomp('.')
|
208
|
+
# due to a bug in Gem::Version, we need to append a letter
|
209
|
+
# to the version field if only one of compared versions
|
210
|
+
# has a letter at the end
|
211
|
+
# For ex:
|
212
|
+
# 7.0.3.I2.2e < 7.0.3.I2.2 is TRUE instead of FALSE
|
213
|
+
# Once we add a letter 'a' to the end,
|
214
|
+
# 7.0.3.I2.2e < 7.0.3.I2.2a is FALSE
|
215
|
+
ver << 'a' if lim[-1, 1] =~ /[[:alpha:]]/
|
216
|
+
skip("The #{feature} #{property} property is only supported on OS version #{over} or later on #{pid}") if
|
217
|
+
Gem::Version.new(lim) < Gem::Version.new(ver)
|
218
|
+
end
|
219
|
+
|
220
|
+
def skip_if_UnsupportedCmdRef(feature_name, attribute_name) # rubocop:disable Style/MethodName
|
221
|
+
# Check if attr is excluded by the cmd_ref yaml
|
222
|
+
skip("UnsupportedCmdRef attribute: '#{attribute_name}'") if
|
223
|
+
cmd_ref.lookup(feature_name, attribute_name).is_a?(UnsupportedCmdRef)
|
224
|
+
end
|
225
|
+
|
226
|
+
def skip_nexus_i2_image?
|
227
|
+
skip("This property is not supported on Nexus 'I2' images") if
|
228
|
+
Utils.nexus_i2_image
|
229
|
+
end
|
230
|
+
|
231
|
+
def system_image
|
232
|
+
@image ||= Platform.system_image
|
233
|
+
end
|
234
|
+
|
235
|
+
def skip_legacy_defect?(pattern, msg)
|
236
|
+
if pattern.is_a?(String)
|
237
|
+
pattern = [pattern]
|
238
|
+
elsif !pattern.is_a?(Array)
|
239
|
+
fail 'Argument: pattern must be a String or Array object'
|
240
|
+
end
|
241
|
+
msg = "Defect in legacy image: [#{msg}]"
|
242
|
+
pattern.each do |pat|
|
243
|
+
skip(msg) if Utils.image_version?(Regexp.new(pat))
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def step_unless_legacy_defect(pattern, msg)
|
248
|
+
if pattern.is_a?(String)
|
249
|
+
pattern = [pattern]
|
250
|
+
elsif !pattern.is_a?(Array)
|
251
|
+
fail 'Argument: pattern must be a String or Array object'
|
252
|
+
end
|
253
|
+
pattern.each do |pat|
|
254
|
+
if Utils.image_version?(Regexp.new(pat))
|
255
|
+
puts "Skip Step: Defect in legacy image: [#{msg}]"
|
256
|
+
return false
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def step_unless_version_unsupported(pattern)
|
262
|
+
if pattern.is_a?(String)
|
263
|
+
pattern = [pattern]
|
264
|
+
elsif !pattern.is_a?(Array)
|
265
|
+
fail 'Argument: pattern must be a String or Array object'
|
266
|
+
end
|
267
|
+
pattern.each do |pat|
|
268
|
+
if Utils.image_version?(Regexp.new(pat))
|
269
|
+
puts "Skip Step: Feature not supported in this image version: [#{Platform.image_version}]"
|
270
|
+
return false
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def virtual_platform?
|
276
|
+
node.product_id[/N9K-NXOSV|N9K-9000v/] ? true : false
|
277
|
+
end
|
278
|
+
|
279
|
+
def interfaces
|
280
|
+
unless @@interfaces
|
281
|
+
# Build the platform_info, used for interface lookup
|
282
|
+
# rubocop:disable Style/ClassVars
|
283
|
+
@@interfaces = []
|
284
|
+
Interface.interfaces.each do |int, obj|
|
285
|
+
next unless int[%r{ethernet[\d/]+$}] # exclude dot1q & non-eth
|
286
|
+
next if address_match?(obj.ipv4_address)
|
287
|
+
@@interfaces << int
|
288
|
+
end
|
289
|
+
# rubocop:enable Style/ClassVars
|
290
|
+
end
|
291
|
+
skip "No suitable interfaces found on #{node} for this test" if
|
292
|
+
@@interfaces.empty?
|
293
|
+
@@interfaces
|
294
|
+
end
|
295
|
+
|
296
|
+
# Remove all router bgps.
|
297
|
+
def remove_all_bgps
|
298
|
+
require_relative '../lib/cisco_node_utils/bgp'
|
299
|
+
RouterBgp.routers.each do |_asn, vrfs|
|
300
|
+
vrfs.each do |vrf, obj|
|
301
|
+
if vrf == 'default'
|
302
|
+
obj.destroy
|
303
|
+
break
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# Remove all router ospfs.
|
310
|
+
def remove_all_ospfs
|
311
|
+
require_relative '../lib/cisco_node_utils/router_ospf'
|
312
|
+
RouterOspf.routers.each do |_, obj|
|
313
|
+
obj.destroy
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
# This testcase will remove all the bds existing in the system
|
318
|
+
# specifically in cleanup for minitests
|
319
|
+
def remove_all_bridge_domains
|
320
|
+
return unless /N7/ =~ node.product_id
|
321
|
+
BridgeDomain.bds.each do |_bd, obj|
|
322
|
+
obj.destroy
|
323
|
+
end
|
324
|
+
config 'system bridge-domain none'
|
325
|
+
end
|
326
|
+
|
327
|
+
def remove_all_svis
|
328
|
+
Interface.interfaces(:vlan).each do |svi, obj|
|
329
|
+
next if svi == 'vlan1'
|
330
|
+
obj.destroy
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# This testcase will remove all the vlans existing in the system
|
335
|
+
# specifically in cleanup for minitests
|
336
|
+
def remove_all_vlans
|
337
|
+
remove_all_bridge_domains
|
338
|
+
remove_all_svis
|
339
|
+
Vlan.vlans.each do |vlan, obj|
|
340
|
+
# skip reserved vlan
|
341
|
+
next if vlan == '1'
|
342
|
+
next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)
|
343
|
+
obj.destroy
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
# Remove all user vrfs.
|
348
|
+
def remove_all_vrfs
|
349
|
+
require_relative '../lib/cisco_node_utils/vrf'
|
350
|
+
Vrf.vrfs.each do |vrf, obj|
|
351
|
+
next if vrf[/management/]
|
352
|
+
# TBD: Remove vrf workaround below after CSCuz56697 is resolved
|
353
|
+
config 'vrf context ' + vrf if
|
354
|
+
node.product_id[/N9K.*-F/] || node.product_id[/N3K.*-F/]
|
355
|
+
obj.destroy
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
# Remove all configurations from an interface.
|
360
|
+
def interface_cleanup(intf_name)
|
361
|
+
cfg = get_interface_cleanup_config(intf_name)
|
362
|
+
config(*cfg)
|
363
|
+
end
|
364
|
+
|
365
|
+
# TBD: -- The following methods are a WIP --
|
366
|
+
#
|
367
|
+
# def find_compatible_intf(feature, opt=:raise_skip)
|
368
|
+
# # Some platforms require specific linecards before allowing a feature to
|
369
|
+
# # be enabled. This method will find a compatible interface or optionally
|
370
|
+
# # raise a skip.
|
371
|
+
# # TBD: This wants to become a common "compatible interface" checker to
|
372
|
+
# # eventually replace all of the single-use methods.
|
373
|
+
# intf = compatible_intf(feature)
|
374
|
+
# if intf.nil? && opt[/raise_skip/]
|
375
|
+
# skip("Unable to find compatible interface for 'feature #{feature}'")
|
376
|
+
# end
|
377
|
+
# intf
|
378
|
+
# end
|
379
|
+
|
380
|
+
# def compatible_intf(feature)
|
381
|
+
# # The feat hash contains module restrictions for a given feature.
|
382
|
+
# # :mods - (optional) The module ids used in the 'limit-resource' config
|
383
|
+
# # :pids - A regex pattern for the line module product IDs (ref: 'sh mod')
|
384
|
+
# feat = {}
|
385
|
+
# if node.product_id[/N7K/]
|
386
|
+
# feat = {
|
387
|
+
# # nv overlay raises error unless solely F3
|
388
|
+
# 'nv overlay' => { mods: 'f3', pids: 'N7[K7]-F3' }
|
389
|
+
# }
|
390
|
+
# end
|
391
|
+
# patterns = feat[feature]
|
392
|
+
# return interfaces[0] if patterns.nil? # No restrictions for this platform
|
393
|
+
|
394
|
+
# # Check if module is present and usable; i.e. 'ok'
|
395
|
+
# pids = patterns[:pids]
|
396
|
+
# sh_mod_string = @device.cmd("show mod | i '^[0-9]+.*#{pids}.*ok'")
|
397
|
+
# sh_mod = sh_mod_string[/^(\d+)\s.*#{pids}/]
|
398
|
+
# slot = sh_mod.nil? ? nil : Regexp.last_match[1]
|
399
|
+
# return nil if slot.nil?
|
400
|
+
# intf = "ethernet#{slot}/1"
|
401
|
+
|
402
|
+
# # Check/Set VDC config. VDC platforms restrict module usage per vdc.
|
403
|
+
# mods = patterns[:mods]
|
404
|
+
# return intf if mods.nil? || !node.product_id[/N7K/]
|
405
|
+
# vdc = Vdc.new(Vdc.default_vdc_name)
|
406
|
+
# unless mods == vdc.limit_resource_module_type
|
407
|
+
# # Update the allowed module types in this vdc
|
408
|
+
# vdc.limit_resource_module_type = mods
|
409
|
+
# end
|
410
|
+
|
411
|
+
# # Return the first interface found in 'allocate interface' config, or nil
|
412
|
+
# vdc.allocate_interface[%r{Ethernet#{slot}\/(\d+)}]
|
413
|
+
# end
|
414
|
+
|
415
|
+
def vdc_limit_f3_no_intf_needed(action=:set)
|
416
|
+
# This is a special-use method for N7Ks that don't have a physical F3.
|
417
|
+
# 1) There are some features that refuse to load unless the VDC is
|
418
|
+
# limited to F3 only, but they will actually load if the config is
|
419
|
+
# present, despite the fact that there are no physical F3s.
|
420
|
+
# 2) We have some tests that need these features but don't need interfaces.
|
421
|
+
#
|
422
|
+
# action = :set (enable limit F3 config), :clear (default limit config)
|
423
|
+
#
|
424
|
+
# The limit config should be removed after testing if the device does not
|
425
|
+
# have an actual F3.
|
426
|
+
return unless node.product_id[/N7K/]
|
427
|
+
vdc = Vdc.new(Vdc.default_vdc_name)
|
428
|
+
case action
|
429
|
+
when :set
|
430
|
+
return if vdc.limit_resource_module_type == 'f3'
|
431
|
+
vdc.limit_resource_module_type = 'f3'
|
432
|
+
|
433
|
+
when :clear
|
434
|
+
# Remove the config if there are no physical F3 cards
|
435
|
+
pids = 'N7[K7]-F3'
|
436
|
+
sh_mod_string = @device.cmd("show mod | i '^[0-9]+.*#{pids}'")
|
437
|
+
sh_mod = sh_mod_string[/^(\d+)\s.*#{pids}/]
|
438
|
+
if sh_mod.nil?
|
439
|
+
# It's safe to remove the config
|
440
|
+
vdc.limit_resource_module_type = ''
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
# setup fabricpath env if possible and populate the interfaces array
|
446
|
+
# otherwise cause a global skip
|
447
|
+
def fabricpath_testenv_setup
|
448
|
+
return unless node.product_id[/N7K/]
|
449
|
+
intf_array = Feature.compatible_interfaces('fabricpath')
|
450
|
+
vdc = Vdc.new(Vdc.default_vdc_name)
|
451
|
+
save_lr = vdc.limit_resource_module_type
|
452
|
+
fabricpath_lr = node.config_get('fabricpath', 'supported_modules')
|
453
|
+
if intf_array.empty? || save_lr != fabricpath_lr
|
454
|
+
# try getting the required modules into the default vdc
|
455
|
+
vdc.limit_resource_module_type = fabricpath_lr
|
456
|
+
intf_array = Feature.compatible_interfaces('fabricpath')
|
457
|
+
end
|
458
|
+
if intf_array.empty?
|
459
|
+
vdc.limit_resource_module_type = save_lr
|
460
|
+
skip('FabricPath compatible interfaces not found in this switch')
|
461
|
+
else
|
462
|
+
# rubocop:disable Style/ClassVars
|
463
|
+
@@interfaces = intf_array
|
464
|
+
# rubocop:enable Style/ClassVars
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
# Returns an array of commands to remove all configurations from
|
469
|
+
# an interface.
|
470
|
+
def get_interface_cleanup_config(intf_name)
|
471
|
+
if platform == :ios_xr
|
472
|
+
["no interface #{intf_name}", "interface #{intf_name} shutdown"]
|
473
|
+
else
|
474
|
+
["default interface #{intf_name}"]
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
def mt_full_interface?
|
479
|
+
# MT-full tests require a specific linecard; either because they need a
|
480
|
+
# compatible interface or simply to enable the features. Either way
|
481
|
+
# we will provide an appropriate interface name if the linecard is present.
|
482
|
+
# Example 'show mod' output to match against:
|
483
|
+
# '9 12 10/40 Gbps Ethernet Module N7K-F312FQ-25 ok'
|
484
|
+
# '9 12 10/40 Gbps Ethernet Module N77-F312FQ-25 ok'
|
485
|
+
sh_mod_string = @device.cmd("sh mod | i '^[0-9]+.*N7[7K]-F3'")
|
486
|
+
sh_mod = sh_mod_string[/^(\d+)\s.*N7[7K]-F3.*ok/]
|
487
|
+
slot = sh_mod.nil? ? nil : Regexp.last_match[1]
|
488
|
+
skip('Unable to find compatible interface in chassis') if slot.nil?
|
489
|
+
|
490
|
+
"ethernet#{slot}/1"
|
491
|
+
end
|
492
|
+
|
493
|
+
def vxlan_linecard?
|
494
|
+
# n5,6,7k tests require a specific linecard; either because they need a
|
495
|
+
# compatible interface or simply to enable vxlan.
|
496
|
+
# Example 'show mod' output to match against:
|
497
|
+
# '9 12 10/40 Gbps Ethernet Module N7K-F312FQ-25 ok'
|
498
|
+
# '9 12 10/40 Gbps Ethernet Module N77-F312FQ-25 ok'
|
499
|
+
# '2 6 Nexus 6xQSFP Ethernet Module N5K-C5672UP-M6Q ok'
|
500
|
+
# '2 6 Nexus xxQSFP Ethernet Module N6K-C6004-96Q/EF ok'
|
501
|
+
# '2 4 Nexus 4xQSFP Ethernet Module N6K-C6001-M4Q ok'
|
502
|
+
if node.product_id[/N(5|6)K/]
|
503
|
+
sh_mod_string = @device.cmd("sh mod | i '^[0-9]+.*N[56]K-C[56]'")
|
504
|
+
sh_mod = sh_mod_string[/^(\d+)\s.*N[56]K-C(56|600[14])/]
|
505
|
+
skip('Unable to find compatible interface in chassis') if sh_mod.nil?
|
506
|
+
elsif node.product_id[/N7K/]
|
507
|
+
mt_full_interface?
|
508
|
+
else
|
509
|
+
return
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
# Wrapper api that can be used to execute bash shell or guestshell
|
514
|
+
# commands.
|
515
|
+
# Returns the output of the command.
|
516
|
+
def shell_command(command, context='bash')
|
517
|
+
fail "shell_command api not supported on #{node.product_id}" unless
|
518
|
+
node.product_id[/N3K|N3K.*-F|N9K.*-F|N9K/]
|
519
|
+
unless context == 'bash' || context == 'guestshell'
|
520
|
+
fail "Context must be either 'bash' or 'guestshell'"
|
521
|
+
end
|
522
|
+
config("run #{context} #{command}")
|
523
|
+
end
|
524
|
+
|
525
|
+
def backup_resolv_file(context='bash')
|
526
|
+
# Configuration bleeding is only a problem on some platforms, so
|
527
|
+
# only backup the resolv.conf file on required plaforms.
|
528
|
+
return unless node.product_id[/N3K|N3K.*-F|N9K.*-F|N9K/]
|
529
|
+
time_stamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
|
530
|
+
backup_filename = "/tmp/resolv.conf.#{time_stamp}"
|
531
|
+
shell_command("cp /etc/resolv.conf #{backup_filename}", context)
|
532
|
+
backup_filename
|
533
|
+
end
|
534
|
+
|
535
|
+
def restore_resolv_file(filename, context='bash')
|
536
|
+
return unless node.product_id[/N3K|N3K.*-F|N9K.*-F|N9K/]
|
537
|
+
shell_command("sudo cp #{filename} /etc/resolv.conf", context)
|
538
|
+
shell_command("rm #{filename}", context)
|
539
|
+
end
|
540
|
+
|
541
|
+
# VDC helper for features that require a specific linecard.
|
542
|
+
# Allows caller to get current state or change it to a new value.
|
543
|
+
def vdc_lc_state(type=nil)
|
544
|
+
return unless node.product_id[/N7/]
|
545
|
+
vxlan_linecard? if type && type[/F3/i]
|
546
|
+
v = Vdc.new('default')
|
547
|
+
if type
|
548
|
+
# This action may be time consuming, use only if necessary.
|
549
|
+
v.limit_resource_module_type = type
|
550
|
+
else
|
551
|
+
v.limit_resource_module_type
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
# Helper method to massage node.product_id into a short but
|
556
|
+
# meaningful tag to represent the product_type.
|
557
|
+
def product_tag
|
558
|
+
@product_id ||= node.product_id
|
559
|
+
case @product_id
|
560
|
+
when /N3K-C35/
|
561
|
+
tag = 'n35'
|
562
|
+
when /N3/
|
563
|
+
tag = Utils.fretta? ? 'n3k-f' : 'n3k'
|
564
|
+
when /N5/
|
565
|
+
tag = 'n5k'
|
566
|
+
when /N6/
|
567
|
+
tag = 'n6k'
|
568
|
+
when /N7/
|
569
|
+
tag = 'n7k'
|
570
|
+
when /N9/
|
571
|
+
tag = Utils.fretta? ? 'n9k-f' : 'n9k'
|
572
|
+
else
|
573
|
+
fail "Unrecognized product_id: #{@product_id}"
|
574
|
+
end
|
575
|
+
tag
|
576
|
+
end
|
577
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# test command config yaml file
|
2
|
+
---
|
3
|
+
nexus:
|
4
|
+
feature-enable:
|
5
|
+
command: |
|
6
|
+
feature tacacs+
|
7
|
+
feature ospf
|
8
|
+
feature bgp
|
9
|
+
feature pim
|
10
|
+
feature msdp
|
11
|
+
feature interface-vlan
|
12
|
+
feature hsrp
|
13
|
+
feature lacp
|
14
|
+
feature dhcp
|
15
|
+
|
16
|
+
feature-disable:
|
17
|
+
command: |
|
18
|
+
no feature tacacs+
|
19
|
+
no feature ospf
|
20
|
+
no feature bgp
|
21
|
+
no feature pim
|
22
|
+
no feature msdp
|
23
|
+
no feature interface-vlan
|
24
|
+
no feature hsrp
|
25
|
+
no feature lacp
|
26
|
+
no feature dhcp
|
27
|
+
nvgen: false
|
28
|
+
|
29
|
+
feature-snmp-comm-acl-ro:
|
30
|
+
command: |
|
31
|
+
snmp-server community networkopercom group network-operator
|
32
|
+
snmp-server community networkopercom use-acl SNMP_RO
|
33
|
+
|
34
|
+
feature-snmp-comm-acl-rw:
|
35
|
+
command: |
|
36
|
+
snmp-server community admincom group network-admin
|
37
|
+
snmp-server community admincom use-acl SNMP_RW
|
38
|
+
|
39
|
+
feature-int-loopback:
|
40
|
+
command: |
|
41
|
+
interface loopback0
|
42
|
+
description testloopback
|
43
|
+
|
44
|
+
feature-int-portchannel:
|
45
|
+
setup: |
|
46
|
+
interface port-channel100
|
47
|
+
no switchport
|
48
|
+
command: |
|
49
|
+
feature bfd
|
50
|
+
interface port-channel100
|
51
|
+
description test-portchannel
|
52
|
+
no bfd echo
|
53
|
+
|
54
|
+
ios_xr:
|
55
|
+
name-server:
|
56
|
+
command: |
|
57
|
+
domain name-server 10.10.10.10
|
58
|
+
domain name-server 10.10.10.11
|
59
|
+
domain name-server 10.10.10.12
|
60
|
+
|
61
|
+
no-name-server:
|
62
|
+
command: |
|
63
|
+
no domain name-server 10.10.10.10
|
64
|
+
no domain name-server 10.10.10.11
|
65
|
+
no domain name-server 10.10.10.12
|
66
|
+
|
67
|
+
lo-intf:
|
68
|
+
command: |
|
69
|
+
interface Loopback0
|
70
|
+
description test description
|
71
|
+
vrf red
|
72
|
+
|
73
|
+
no-lo-intf:
|
74
|
+
command: |
|
75
|
+
no interface Loopback0
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# test command config yaml file
|
2
|
+
---
|
3
|
+
feature-global_bad_syntax:
|
4
|
+
command: |
|
5
|
+
fature ospf
|
6
|
+
|
7
|
+
|
8
|
+
feature-nested_bad_syntax:
|
9
|
+
command: >
|
10
|
+
interface loopback0
|
11
|
+
descrion testloopback
|
12
|
+
|
13
|
+
feature-input_too_long:
|
14
|
+
command: |
|
15
|
+
router ospf bluethisoutputistolongwaytoolongreallylong
|
16
|
+
|
Binary file
|