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,70 @@
|
|
1
|
+
# Evpn Multisite Unit Tests
|
2
|
+
#
|
3
|
+
# Rahul Shenoy, October, 2017
|
4
|
+
#
|
5
|
+
# Copyright (c) 2017 Cisco and/or its affiliates.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require_relative 'ciscotest'
|
20
|
+
require_relative '../lib/cisco_node_utils/evpn_multisite'
|
21
|
+
|
22
|
+
# TestEvpnMultisite - Minitest for EvpnMultisite class
|
23
|
+
class TestEvpnMultisite < CiscoTestCase
|
24
|
+
@skip_unless_supported = 'evpn_multisite'
|
25
|
+
|
26
|
+
def setup
|
27
|
+
# Disable feature nv overlay before each test to
|
28
|
+
# ensure we are starting with a clean slate for each test.
|
29
|
+
super
|
30
|
+
skip("#{node.product_id} doesn't support this feature") unless
|
31
|
+
node.product_id[/N9K.*EX/]
|
32
|
+
config('no feature nv overlay')
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_create_and_destroy
|
36
|
+
ms = EvpnMultisite.new(100)
|
37
|
+
ms_id = ms.multisite
|
38
|
+
assert_equal('100', ms_id,
|
39
|
+
'Error: failed to create multisite border-gateway 100')
|
40
|
+
ms.destroy
|
41
|
+
ms_id = ms.multisite
|
42
|
+
assert_nil(ms_id, 'Error: failed to destroy multisite border-gateway 100')
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_delay_restore
|
46
|
+
ms = EvpnMultisite.new(100)
|
47
|
+
ms.delay_restore = 31
|
48
|
+
assert_equal('31', ms.delay_restore,
|
49
|
+
'multisite border-gateway delay_restore should be 31')
|
50
|
+
ms.delay_restore = 1000
|
51
|
+
assert_equal('1000', ms.delay_restore,
|
52
|
+
'multisite border-gateway delay_restore should be 1000')
|
53
|
+
ms.destroy
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_update_multisiteid
|
57
|
+
ms = EvpnMultisite.new(100)
|
58
|
+
ms.delay_restore = 50
|
59
|
+
assert_equal('100', ms.multisite,
|
60
|
+
'Error: failed to create multisite border-gateway 100')
|
61
|
+
assert_equal('50', ms.delay_restore,
|
62
|
+
'multisite border-gateway delay_restore should be 50')
|
63
|
+
ms.multisite = 200
|
64
|
+
assert_equal('200', ms.multisite,
|
65
|
+
'Error: failed to create multisite border-gateway 200')
|
66
|
+
assert_equal('50', ms.delay_restore,
|
67
|
+
'multisite border-gateway delay_restore should be 50')
|
68
|
+
ms.destroy
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Evpn Stormcontrol Unit Tests
|
2
|
+
#
|
3
|
+
# Rahul Shenoy, October, 2017
|
4
|
+
#
|
5
|
+
# Copyright (c) 2017 Cisco and/or its affiliates.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require_relative 'ciscotest'
|
20
|
+
require_relative '../lib/cisco_node_utils/evpn_stormcontrol'
|
21
|
+
|
22
|
+
# TestEvpnStormcontrol - Minitest for EvpnStormcontrol class
|
23
|
+
class TestEvpnStormcontrol < CiscoTestCase
|
24
|
+
@skip_unless_supported = 'evpn_stormcontrol'
|
25
|
+
|
26
|
+
def setup
|
27
|
+
# Ensure we are starting with a clean slate for each test.
|
28
|
+
super
|
29
|
+
skip("#{node.product_id} doesn't support this feature") unless
|
30
|
+
node.product_id[/N9K.*EX/]
|
31
|
+
config('no evpn storm-control broadcast level 50')
|
32
|
+
config('no evpn storm-control multicast level 50')
|
33
|
+
config('no evpn storm-control unicast level 50')
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_create_and_destroy
|
37
|
+
sc = EvpnStormcontrol.new('broadcast', 50)
|
38
|
+
sc_level = sc.level
|
39
|
+
assert_equal('50', sc_level,
|
40
|
+
'Error: failed to configure evpn storm-control broadcast ' \
|
41
|
+
'level 50')
|
42
|
+
sc.destroy
|
43
|
+
sc_level = sc.level
|
44
|
+
assert_nil(sc_level, 'Error: failed to destroy storm-control config')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_update_level
|
48
|
+
sc = EvpnStormcontrol.new('multicast', 50)
|
49
|
+
assert_equal('50', sc.level,
|
50
|
+
'Error: multicast storm-control level should be 50')
|
51
|
+
sc.level = 51
|
52
|
+
assert_equal('51', sc.level,
|
53
|
+
'Error: failed to create multisite border-gateway 200')
|
54
|
+
sc.destroy
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# Evpn Vni Unit Tests
|
2
|
+
#
|
3
|
+
# Andi Shen, December, 2015
|
4
|
+
#
|
5
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require_relative 'ciscotest'
|
20
|
+
require_relative '../lib/cisco_node_utils/evpn_vni'
|
21
|
+
|
22
|
+
# TestEvpnVni - Minitest for EvpnVni class
|
23
|
+
class TestEvpnVni < CiscoTestCase
|
24
|
+
@skip_unless_supported = 'evpn_vni'
|
25
|
+
|
26
|
+
def setup
|
27
|
+
# Disable feature bgp and no overlay evpn before each test to
|
28
|
+
# ensure we are starting with a clean slate for each test.
|
29
|
+
super
|
30
|
+
config('no feature bgp')
|
31
|
+
|
32
|
+
# Some platforms complain when nv overlay is not configured
|
33
|
+
config_no_warn('no nv overlay evpn')
|
34
|
+
|
35
|
+
# Some platforms remove the 'evpn' command when 'no nv overlay evpn'
|
36
|
+
# is processed, while others must remove it explicitly.
|
37
|
+
config_no_warn('no evpn')
|
38
|
+
|
39
|
+
rescue RuntimeError => e
|
40
|
+
hardware_supports_feature?(e.message)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_create_and_destroy
|
44
|
+
vni = EvpnVni.new(4096)
|
45
|
+
vni_list = EvpnVni.vnis
|
46
|
+
assert(vni_list.key?('4096'), 'Error: failed to create evpn vni 4096')
|
47
|
+
|
48
|
+
vni.destroy
|
49
|
+
vni_list = EvpnVni.vnis
|
50
|
+
refute(vni_list.key?('4096'), 'Error: failed to destroy evpn vni 4096')
|
51
|
+
|
52
|
+
rescue RuntimeError => e
|
53
|
+
hardware_supports_feature?(e.message)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_route_distinguisher
|
57
|
+
vni = EvpnVni.new(4096)
|
58
|
+
vni.route_distinguisher = 'auto'
|
59
|
+
assert_equal('auto', vni.route_distinguisher,
|
60
|
+
"vni route_distinguisher should be set to 'auto'")
|
61
|
+
vni.route_distinguisher = '1:1'
|
62
|
+
assert_equal('1:1', vni.route_distinguisher,
|
63
|
+
"vni route_distinguisher should be set to '1:1'")
|
64
|
+
vni.route_distinguisher = vni.default_route_distinguisher
|
65
|
+
assert_empty(vni.route_distinguisher,
|
66
|
+
'vni route_distinguisher should *NOT* be configured')
|
67
|
+
vni.destroy
|
68
|
+
|
69
|
+
rescue RuntimeError => e
|
70
|
+
hardware_supports_feature?(e.message)
|
71
|
+
end
|
72
|
+
|
73
|
+
# test route_target
|
74
|
+
def test_route_target
|
75
|
+
vni = EvpnVni.new(4096)
|
76
|
+
opts = [:both, :import, :export]
|
77
|
+
|
78
|
+
# 'route_target_both' has limited support with I2.5 and later images.
|
79
|
+
# The Puppet README states:
|
80
|
+
# Caveat: The route_target_both property is discouraged due to the
|
81
|
+
# inconsistent behavior of the property across Nexus platforms and image
|
82
|
+
# versions. The 'both' keyword has a transformative behavior on some
|
83
|
+
# platforms/versions in which it creates two cli configurations: one for
|
84
|
+
# import targets, a second for export targets, while the 'both' command
|
85
|
+
# itself may not appear at all. When the 'both' keyword does not appear
|
86
|
+
# in the configuration it causes an idempotency problem for puppet. For
|
87
|
+
# this reason it is recommended to use explicit 'route_target_export' and
|
88
|
+
# 'route_target_import' properties instead of route_target_both.
|
89
|
+
opts.delete(:both)
|
90
|
+
|
91
|
+
# Master list of communities to test against
|
92
|
+
master = ['1.2.3.4:55', '2:2', '55:33', 'auto']
|
93
|
+
|
94
|
+
# Test 1: both/import/export when no commands are present. Each target
|
95
|
+
should = master.clone
|
96
|
+
route_target_tester(vni, opts, should, 'Test 1')
|
97
|
+
|
98
|
+
# Test 2: remove half of the entries
|
99
|
+
should = ['2:2', 'auto']
|
100
|
+
route_target_tester(vni, opts, should, 'Test 2')
|
101
|
+
|
102
|
+
# Test 3: restore the removed entries
|
103
|
+
should = master.clone
|
104
|
+
route_target_tester(vni, opts, should, 'Test 3')
|
105
|
+
|
106
|
+
# Test 4: 'default'
|
107
|
+
should = vni.default_route_target_import
|
108
|
+
route_target_tester(vni, opts, should, 'Test 4')
|
109
|
+
|
110
|
+
vni .destroy
|
111
|
+
|
112
|
+
rescue RuntimeError => e
|
113
|
+
hardware_supports_feature?(e.message)
|
114
|
+
end
|
115
|
+
|
116
|
+
def route_target_tester(vni, opts, should, test_id)
|
117
|
+
# First configure all four property types
|
118
|
+
opts.each do |opt|
|
119
|
+
# non-evpn
|
120
|
+
vni.send("route_target_#{opt}=", should)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Now check the results
|
124
|
+
opts.each do |opt|
|
125
|
+
# non-evpn
|
126
|
+
result = vni.send("route_target_#{opt}")
|
127
|
+
assert_equal(should, result,
|
128
|
+
"#{test_id} : route_target_#{opt}")
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# Copyright (c) 2014-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/cisco_cmn_utils'
|
17
|
+
require_relative '../lib/cisco_node_utils/fabricpath_global'
|
18
|
+
require_relative '../lib/cisco_node_utils/interface'
|
19
|
+
require_relative '../lib/cisco_node_utils/platform'
|
20
|
+
|
21
|
+
include Cisco
|
22
|
+
|
23
|
+
# TestFabricpathGlobal - Minitest for Fabricpath Global node utils
|
24
|
+
class TestFabricpathGlobal < CiscoTestCase
|
25
|
+
@skip_unless_supported = 'fabricpath'
|
26
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
27
|
+
|
28
|
+
def setup
|
29
|
+
super
|
30
|
+
vdc_limit_f3_no_intf_needed(:set)
|
31
|
+
return unless @@pre_clean_needed
|
32
|
+
config_no_warn('no nv overlay evpn ; no feature nv overlay')
|
33
|
+
remove_fabricpath_globals
|
34
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
35
|
+
end
|
36
|
+
|
37
|
+
def teardown
|
38
|
+
remove_fabricpath_globals
|
39
|
+
if first_or_last_teardown
|
40
|
+
vdc_limit_f3_no_intf_needed(:clear)
|
41
|
+
config_no_warn('no feature-set fabricpath')
|
42
|
+
end
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def remove_fabricpath_globals
|
47
|
+
fg = FabricpathGlobal.globals
|
48
|
+
fg.each { |_key, elem| elem.destroy } unless fg.empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_create_destroy
|
52
|
+
assert_empty(FabricpathGlobal.globals)
|
53
|
+
|
54
|
+
# create
|
55
|
+
fg = FabricpathGlobal.new('default')
|
56
|
+
assert_equal('default', fg.name)
|
57
|
+
assert_equal(:enabled, FabricpathGlobal.fabricpath_feature)
|
58
|
+
refute_empty(FabricpathGlobal.globals)
|
59
|
+
|
60
|
+
# destroy
|
61
|
+
fg.destroy
|
62
|
+
assert_empty(FabricpathGlobal.globals)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_aggregate_multicast_routes
|
66
|
+
fg = FabricpathGlobal.new('default')
|
67
|
+
if validate_property_excluded?('fabricpath', 'aggregate_multicast_routes')
|
68
|
+
assert_raises(Cisco::UnsupportedError) do
|
69
|
+
fg.aggregate_multicast_routes = true
|
70
|
+
end
|
71
|
+
return
|
72
|
+
end
|
73
|
+
|
74
|
+
fg = FabricpathGlobal.new('default')
|
75
|
+
fg.aggregate_multicast_routes = true
|
76
|
+
assert(fg.aggregate_multicast_routes,
|
77
|
+
'aggregate_multicast_routes: Expected: true')
|
78
|
+
|
79
|
+
fg.aggregate_multicast_routes = false
|
80
|
+
refute(fg.aggregate_multicast_routes,
|
81
|
+
'aggregate_multicast_routes: Expected: false')
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_allocate_delay
|
85
|
+
fg = FabricpathGlobal.new('default')
|
86
|
+
assert_equal(fg.default_allocate_delay, fg.allocate_delay)
|
87
|
+
|
88
|
+
fg.allocate_delay = 20
|
89
|
+
assert_equal(20, fg.allocate_delay)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_graceful_merge
|
93
|
+
fg = FabricpathGlobal.new('default')
|
94
|
+
assert_equal(fg.default_graceful_merge, fg.graceful_merge)
|
95
|
+
|
96
|
+
fg.graceful_merge = :disable
|
97
|
+
assert_equal(:disable, fg.graceful_merge)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_linkup_delay_all
|
101
|
+
fg = FabricpathGlobal.new('default')
|
102
|
+
assert_equal(fg.default_linkup_delay, fg.linkup_delay)
|
103
|
+
|
104
|
+
fg.linkup_delay = 25
|
105
|
+
assert_equal(25, fg.linkup_delay)
|
106
|
+
|
107
|
+
if validate_property_excluded?('fabricpath', 'linkup_delay_always')
|
108
|
+
assert_raises(Cisco::UnsupportedError) { fg.linkup_delay_always = true }
|
109
|
+
else
|
110
|
+
assert_equal(fg.default_linkup_delay_always, fg.linkup_delay_always)
|
111
|
+
fg.linkup_delay_always = true
|
112
|
+
assert(fg.linkup_delay_always, 'linkup_delay_always: Expected: true')
|
113
|
+
fg.linkup_delay_always = false
|
114
|
+
refute(fg.linkup_delay_always, 'linkup_delay_always: Expected: false')
|
115
|
+
end
|
116
|
+
|
117
|
+
if validate_property_excluded?('fabricpath', 'linkup_delay_enable')
|
118
|
+
assert_raises(Cisco::UnsupportedError) { fg.linkup_delay_enable = true }
|
119
|
+
return
|
120
|
+
end
|
121
|
+
|
122
|
+
assert_equal(fg.default_linkup_delay_enable, fg.linkup_delay_enable)
|
123
|
+
fg.linkup_delay_enable = true
|
124
|
+
assert(fg.linkup_delay_enable, 'linkup_delay_enable: Expected: true')
|
125
|
+
fg.linkup_delay_enable = false
|
126
|
+
refute(fg.linkup_delay_enable, 'linkup_delay_enable: Expected: false')
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_loadbalance_algorithm
|
130
|
+
fg = FabricpathGlobal.new('default')
|
131
|
+
assert_equal(fg.default_loadbalance_algorithm, fg.loadbalance_algorithm)
|
132
|
+
|
133
|
+
fg.loadbalance_algorithm = 'source'
|
134
|
+
assert_equal('source', fg.loadbalance_algorithm)
|
135
|
+
if validate_property_excluded?('fabricpath',
|
136
|
+
'loadbalance_algorithm_symmetric_support')
|
137
|
+
assert_nil(fg.loadbalance_algorithm_symmetric_support)
|
138
|
+
return
|
139
|
+
end
|
140
|
+
fg.loadbalance_algorithm = 'symmetric'
|
141
|
+
assert_equal('symmetric', fg.loadbalance_algorithm)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_loadbalance_multicast
|
145
|
+
# loadbalance_multicast= is a custom setter that takes 2 args:
|
146
|
+
# rotate, has_vlan
|
147
|
+
fg = FabricpathGlobal.new('default')
|
148
|
+
if validate_property_excluded?('fabricpath',
|
149
|
+
'loadbalance_multicast_set')
|
150
|
+
assert_raises(Cisco::UnsupportedError) do
|
151
|
+
(fg.send(:loadbalance_multicast=, 0, 0))
|
152
|
+
end
|
153
|
+
return
|
154
|
+
end
|
155
|
+
|
156
|
+
# default_loadbalance_multicast_rotate: n/a
|
157
|
+
assert(fg.loadbalance_multicast_has_vlan,
|
158
|
+
'loadbalance_multicast_has_vlan: Expected: true')
|
159
|
+
|
160
|
+
fg.send(:loadbalance_multicast=, 3, false)
|
161
|
+
assert_equal(3, fg.loadbalance_multicast_rotate)
|
162
|
+
refute(fg.loadbalance_multicast_has_vlan,
|
163
|
+
'loadbalance_multicast_has_vlan: Expected: false')
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_loadbalance_unicast
|
167
|
+
# loadbalance_unicast= is a custom setter that takes up to 3 args:
|
168
|
+
# layer, rotate, has_vlan (rotate is not supported on some plats)
|
169
|
+
|
170
|
+
fg = FabricpathGlobal.new('default')
|
171
|
+
assert_equal(fg.default_loadbalance_unicast_layer,
|
172
|
+
fg.loadbalance_unicast_layer)
|
173
|
+
|
174
|
+
# default_loadbalance_unicast_rotate: n/a
|
175
|
+
assert_equal(fg.default_loadbalance_unicast_has_vlan,
|
176
|
+
fg.loadbalance_unicast_has_vlan)
|
177
|
+
|
178
|
+
fg.send(:loadbalance_unicast=, 'layer4', 3, false)
|
179
|
+
assert_equal('layer4', fg.loadbalance_unicast_layer)
|
180
|
+
unless validate_property_excluded?('fabricpath',
|
181
|
+
'loadbalance_unicast_rotate')
|
182
|
+
assert_equal(3, fg.loadbalance_unicast_rotate)
|
183
|
+
end
|
184
|
+
refute(fg.loadbalance_unicast_has_vlan,
|
185
|
+
'loadbalance_unicast_has_vlan: Expected: false')
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_mode
|
189
|
+
fg = FabricpathGlobal.new('default')
|
190
|
+
assert_equal(fg.default_mode, fg.mode)
|
191
|
+
|
192
|
+
fg.mode = 'transit'
|
193
|
+
assert_equal('transit', fg.mode)
|
194
|
+
fg.mode = 'normal'
|
195
|
+
assert_equal('normal', fg.mode)
|
196
|
+
end
|
197
|
+
|
198
|
+
def test_switch_id
|
199
|
+
fg = FabricpathGlobal.new('default')
|
200
|
+
# auto_id = fg.switch_id
|
201
|
+
# switch_id does not have a default
|
202
|
+
fg.switch_id = 100
|
203
|
+
assert_equal(100, fg.switch_id)
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_transition_delay
|
207
|
+
fg = FabricpathGlobal.new('default')
|
208
|
+
assert_equal(fg.default_transition_delay, fg.transition_delay)
|
209
|
+
|
210
|
+
fg.transition_delay = 20
|
211
|
+
assert_equal(20, fg.transition_delay)
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_ttl_multicast
|
215
|
+
fg = FabricpathGlobal.new('default')
|
216
|
+
if validate_property_excluded?('fabricpath', 'ttl_multicast')
|
217
|
+
assert_raises(Cisco::UnsupportedError) { fg.ttl_multicast = 40 }
|
218
|
+
return
|
219
|
+
end
|
220
|
+
|
221
|
+
assert_equal(fg.default_ttl_multicast, fg.ttl_multicast)
|
222
|
+
fg.ttl_multicast = 16
|
223
|
+
assert_equal(16, fg.ttl_multicast)
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_ttl_unicast
|
227
|
+
fg = FabricpathGlobal.new('default')
|
228
|
+
if validate_property_excluded?('fabricpath', 'ttl_unicast')
|
229
|
+
assert_raises(Cisco::UnsupportedError) { fg.ttl_unicast = 40 }
|
230
|
+
return
|
231
|
+
end
|
232
|
+
assert_equal(fg.default_ttl_unicast, fg.ttl_unicast)
|
233
|
+
fg.ttl_unicast = 40
|
234
|
+
assert_equal(40, fg.ttl_unicast)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_interface_switchport_mode
|
238
|
+
i = Interface.new(interfaces[0])
|
239
|
+
i.switchport_mode = :fabricpath
|
240
|
+
assert_equal(:fabricpath, i.switchport_mode)
|
241
|
+
|
242
|
+
i.switchport_mode = :trunk
|
243
|
+
assert_equal(:trunk, i.switchport_mode)
|
244
|
+
config("default interface #{interfaces[0]}")
|
245
|
+
end
|
246
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (c) 2014-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/cisco_cmn_utils'
|
17
|
+
require_relative '../lib/cisco_node_utils/fabricpath_topology'
|
18
|
+
|
19
|
+
include Cisco
|
20
|
+
|
21
|
+
# TestFabricpathTopo - Minitest for Fabricpath Topo node utils
|
22
|
+
class TestFabricpathTopo < CiscoTestCase
|
23
|
+
@skip_unless_supported = 'fabricpath_topology'
|
24
|
+
|
25
|
+
def setup
|
26
|
+
# setup runs at the beginning of each test
|
27
|
+
super
|
28
|
+
skip("Test not supported on #{node.product_id}") if
|
29
|
+
cmd_ref.lookup('fabricpath', 'feature').default_value.nil?
|
30
|
+
no_feature_fabricpath
|
31
|
+
end
|
32
|
+
|
33
|
+
def teardown
|
34
|
+
# teardown runs at the end of each test
|
35
|
+
no_feature_fabricpath
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def no_feature_fabricpath
|
40
|
+
# Turn the feature off for a clean test.
|
41
|
+
config_no_warn('no feature-set fabricpath')
|
42
|
+
end
|
43
|
+
|
44
|
+
# TESTS
|
45
|
+
|
46
|
+
def test_topo_create
|
47
|
+
@topo = FabricpathTopo.new('1')
|
48
|
+
@topo.topo_name = 'Topo-1'
|
49
|
+
assert_equal('Topo-1', @topo.topo_name,
|
50
|
+
"Topo name not set correctly #{@topo.topo_name}")
|
51
|
+
assert_equal(:enabled, @topo.fabricpath_feature,
|
52
|
+
'Fabricpath feature should have been enabled')
|
53
|
+
topos = FabricpathTopo.topos
|
54
|
+
assert_equal(1, topos.length,
|
55
|
+
'Number of Topos should be 1')
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_topo_destroy
|
59
|
+
# create and test again
|
60
|
+
@topo = FabricpathTopo.new('2')
|
61
|
+
@topo.destroy
|
62
|
+
# now it should be wiped out
|
63
|
+
topos = FabricpathTopo.topos
|
64
|
+
assert_equal(0, topos.length,
|
65
|
+
'Number of Topos should be 0 (only default)')
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_member_vlans
|
69
|
+
@topo = FabricpathTopo.new('25')
|
70
|
+
@topo.topo_name = 'Topo-25'
|
71
|
+
@topo.member_vlans = '2-10, 100, 500'
|
72
|
+
topo25_vlans = @topo.member_vlans
|
73
|
+
# puts "Topo #{@topo.topo_name} member vlans #{topo25_vlans}"
|
74
|
+
assert_equal('2-10,100,500', topo25_vlans,
|
75
|
+
'Topo 25 not getting set with member vlans')
|
76
|
+
end
|
77
|
+
end
|