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,1479 @@
|
|
1
|
+
# Copyright (c) 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_relative 'ciscotest'
|
16
|
+
require_relative '../lib/cisco_node_utils/route_map'
|
17
|
+
|
18
|
+
def evergreen_or_later?
|
19
|
+
return false if Utils.image_version?(/7.0.3.I2|I3|I4/)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def dplus_n9k?
|
24
|
+
return true if Utils.image_version?(/7.0.3.I4/) &&
|
25
|
+
product_tag[/n9k/]
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
# TestRouteMap - Minitest for RouteMap
|
30
|
+
# node utility class
|
31
|
+
class TestRouteMap < CiscoTestCase
|
32
|
+
@skip_unless_supported = 'route_map'
|
33
|
+
|
34
|
+
def setup
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def teardown
|
39
|
+
RouteMap.maps.each do |_rmname, sequences|
|
40
|
+
sequences.each do |_sequence, actions|
|
41
|
+
actions.each do |_action, obj|
|
42
|
+
obj.destroy
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_route_map(name='MyRouteMap', seq='100', action='permit')
|
50
|
+
RouteMap.new(name, seq, action)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_description
|
54
|
+
rm = create_route_map
|
55
|
+
assert_equal(rm.default_description, rm.description)
|
56
|
+
rm.description = 'TestRouteMap'
|
57
|
+
assert_equal('TestRouteMap', rm.description)
|
58
|
+
rm.description = rm.default_description
|
59
|
+
assert_equal(rm.default_description, rm.description)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_collection_size
|
63
|
+
create_route_map('my1', '100', 'permit')
|
64
|
+
create_route_map('my1', '101', 'permit')
|
65
|
+
create_route_map('my1', '102', 'deny')
|
66
|
+
create_route_map('my2', '102', 'permit')
|
67
|
+
create_route_map('my2', '104', 'deny')
|
68
|
+
create_route_map('my3', '105', 'deny')
|
69
|
+
assert_equal(1, RouteMap.maps['my1']['100'].size)
|
70
|
+
assert_equal(1, RouteMap.maps['my1']['101'].size)
|
71
|
+
assert_equal(1, RouteMap.maps['my1']['102'].size)
|
72
|
+
assert_equal(3, RouteMap.maps['my1'].size)
|
73
|
+
assert_equal(1, RouteMap.maps['my2']['102'].size)
|
74
|
+
assert_equal(1, RouteMap.maps['my2']['104'].size)
|
75
|
+
assert_equal(2, RouteMap.maps['my2'].size)
|
76
|
+
assert_equal(1, RouteMap.maps['my3']['105'].size)
|
77
|
+
assert_equal(1, RouteMap.maps['my3'].size)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_match_as_number
|
81
|
+
rm = create_route_map
|
82
|
+
assert_equal(rm.default_match_as_number, rm.match_as_number)
|
83
|
+
array = ['3', '22-34', '35', '100', '101-220']
|
84
|
+
rm.match_as_number = array
|
85
|
+
assert_equal(array, rm.match_as_number)
|
86
|
+
rm.match_as_number = rm.default_match_as_number
|
87
|
+
assert_equal(rm.default_match_as_number, rm.match_as_number)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_match_as_number_as_path_list
|
91
|
+
rm = create_route_map
|
92
|
+
assert_equal(rm.default_match_as_number_as_path_list, rm.match_as_number_as_path_list)
|
93
|
+
array = %w(cbc xyz pwd)
|
94
|
+
rm.match_as_number_as_path_list = array
|
95
|
+
assert_equal(array, rm.match_as_number_as_path_list)
|
96
|
+
rm.match_as_number_as_path_list = rm.default_match_as_number_as_path_list
|
97
|
+
assert_equal(rm.default_match_as_number_as_path_list, rm.match_as_number_as_path_list)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_community
|
101
|
+
rm = create_route_map
|
102
|
+
assert_equal(rm.default_match_community, rm.match_community)
|
103
|
+
assert_equal(rm.default_match_community_exact_match, rm.match_community_exact_match)
|
104
|
+
array = %w(public private)
|
105
|
+
rm.match_community_set(array, false)
|
106
|
+
assert_equal(array, rm.match_community)
|
107
|
+
refute(rm.match_community_exact_match)
|
108
|
+
rm.match_community_set(array, true)
|
109
|
+
assert_equal(array, rm.match_community)
|
110
|
+
assert(rm.match_community_exact_match)
|
111
|
+
rm.match_community_set(rm.default_match_community, rm.default_match_community_exact_match)
|
112
|
+
assert_equal(rm.default_match_community, rm.match_community)
|
113
|
+
assert_equal(rm.default_match_community_exact_match, rm.match_community_exact_match)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_match_ext_community
|
117
|
+
rm = create_route_map
|
118
|
+
assert_equal(rm.default_match_ext_community, rm.match_ext_community)
|
119
|
+
assert_equal(rm.default_match_ext_community_exact_match, rm.match_ext_community_exact_match)
|
120
|
+
array = %w(public private)
|
121
|
+
rm.match_ext_community_set(array, false)
|
122
|
+
assert_equal(array, rm.match_ext_community)
|
123
|
+
refute(rm.match_ext_community_exact_match)
|
124
|
+
rm.match_ext_community_set(array, true)
|
125
|
+
assert_equal(array, rm.match_ext_community)
|
126
|
+
assert(rm.match_ext_community_exact_match)
|
127
|
+
rm.match_ext_community_set(rm.default_match_ext_community, rm.default_match_ext_community_exact_match)
|
128
|
+
assert_equal(rm.default_match_ext_community, rm.match_ext_community)
|
129
|
+
assert_equal(rm.default_match_ext_community_exact_match, rm.match_ext_community_exact_match)
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_match_interface
|
133
|
+
rm = create_route_map
|
134
|
+
assert_equal(rm.default_match_interface, rm.match_interface)
|
135
|
+
array = %w(ethernet1/1 loopback2 mgmt0 null0 port-channel10)
|
136
|
+
rm.match_interface = array
|
137
|
+
assert_equal(array, rm.match_interface)
|
138
|
+
rm.match_interface = rm.default_match_interface
|
139
|
+
assert_equal(rm.default_match_interface, rm.match_interface)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_match_tag
|
143
|
+
rm = create_route_map
|
144
|
+
assert_equal(rm.default_match_tag, rm.match_tag)
|
145
|
+
array = %w(5 342 28 3221)
|
146
|
+
rm.match_tag = array
|
147
|
+
assert_equal(array, rm.match_tag)
|
148
|
+
rm.match_tag = rm.default_match_tag
|
149
|
+
assert_equal(rm.default_match_tag, rm.match_tag)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_match_src_proto
|
153
|
+
rm = create_route_map
|
154
|
+
assert_equal(rm.default_match_src_proto, rm.match_src_proto)
|
155
|
+
array = %w(tcp udp igmp).sort
|
156
|
+
rm.match_src_proto = array
|
157
|
+
assert_equal(array, rm.match_src_proto)
|
158
|
+
rm.match_src_proto = rm.default_match_src_proto
|
159
|
+
assert_equal(rm.default_match_src_proto, rm.match_src_proto)
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_match_ip_addr_access_list
|
163
|
+
rm = create_route_map
|
164
|
+
assert_equal(rm.default_match_ipv4_addr_access_list, rm.match_ipv4_addr_access_list)
|
165
|
+
assert_equal(rm.default_match_ipv6_addr_access_list, rm.match_ipv6_addr_access_list)
|
166
|
+
rm.match_ip_addr_access_list('MyAccessList',
|
167
|
+
rm.default_match_ipv6_addr_access_list)
|
168
|
+
assert_equal('MyAccessList', rm.match_ipv4_addr_access_list)
|
169
|
+
assert_equal(rm.default_match_ipv6_addr_access_list, rm.match_ipv6_addr_access_list)
|
170
|
+
rm.match_ip_addr_access_list(rm.default_match_ipv4_addr_access_list,
|
171
|
+
'MyV6AccessList')
|
172
|
+
assert_equal(rm.default_match_ipv4_addr_access_list, rm.match_ipv4_addr_access_list)
|
173
|
+
assert_equal('MyV6AccessList', rm.match_ipv6_addr_access_list)
|
174
|
+
rm.match_ip_addr_access_list(rm.default_match_ipv4_addr_access_list,
|
175
|
+
rm.default_match_ipv6_addr_access_list)
|
176
|
+
assert_equal(rm.default_match_ipv4_addr_access_list, rm.match_ipv4_addr_access_list)
|
177
|
+
assert_equal(rm.default_match_ipv6_addr_access_list, rm.match_ipv6_addr_access_list)
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_match_ip_addr_prefix_list
|
181
|
+
rm = create_route_map
|
182
|
+
assert_equal(rm.default_match_ipv4_addr_prefix_list, rm.match_ipv4_addr_prefix_list)
|
183
|
+
assert_equal(rm.default_match_ipv6_addr_prefix_list, rm.match_ipv6_addr_prefix_list)
|
184
|
+
array1 = %w(pre1 pre7 pre5)
|
185
|
+
array2 = rm.default_match_ipv6_addr_prefix_list
|
186
|
+
rm.match_ip_addr_prefix_list(array1, array2)
|
187
|
+
assert_equal(array1, rm.match_ipv4_addr_prefix_list)
|
188
|
+
assert_equal(rm.default_match_ipv6_addr_prefix_list, rm.match_ipv6_addr_prefix_list)
|
189
|
+
array1 = rm.default_match_ipv4_addr_prefix_list
|
190
|
+
array2 = %w(pre1 pre7 pre5)
|
191
|
+
rm.match_ip_addr_prefix_list(array1, array2)
|
192
|
+
assert_equal(rm.default_match_ipv4_addr_prefix_list, rm.match_ipv4_addr_prefix_list)
|
193
|
+
assert_equal(array2, rm.match_ipv6_addr_prefix_list)
|
194
|
+
array2 = rm.default_match_ipv6_addr_prefix_list
|
195
|
+
rm.match_ip_addr_prefix_list(array1, array2)
|
196
|
+
assert_equal(rm.default_match_ipv4_addr_prefix_list, rm.match_ipv4_addr_prefix_list)
|
197
|
+
assert_equal(rm.default_match_ipv6_addr_prefix_list, rm.match_ipv6_addr_prefix_list)
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_match_ipv4_next_hop_prefix_list
|
201
|
+
rm = create_route_map
|
202
|
+
assert_equal(rm.default_match_ipv4_next_hop_prefix_list, rm.match_ipv4_next_hop_prefix_list)
|
203
|
+
array = %w(nh5 nh1 nh42)
|
204
|
+
rm.match_ipv4_next_hop_prefix_list = array
|
205
|
+
assert_equal(array, rm.match_ipv4_next_hop_prefix_list)
|
206
|
+
rm.match_ipv4_next_hop_prefix_list = rm.default_match_ipv4_next_hop_prefix_list
|
207
|
+
assert_equal(rm.default_match_ipv4_next_hop_prefix_list, rm.match_ipv4_next_hop_prefix_list)
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_match_ipv4_route_src_prefix_list
|
211
|
+
rm = create_route_map
|
212
|
+
assert_equal(rm.default_match_ipv4_route_src_prefix_list, rm.match_ipv4_route_src_prefix_list)
|
213
|
+
array = %w(rs1 rs22 pre15)
|
214
|
+
rm.match_ipv4_route_src_prefix_list = array
|
215
|
+
assert_equal(array, rm.match_ipv4_route_src_prefix_list)
|
216
|
+
rm.match_ipv4_route_src_prefix_list = rm.default_match_ipv4_route_src_prefix_list
|
217
|
+
assert_equal(rm.default_match_ipv4_route_src_prefix_list, rm.match_ipv4_route_src_prefix_list)
|
218
|
+
end
|
219
|
+
|
220
|
+
def match_ipv4_multicast_helper(props)
|
221
|
+
rm = create_route_map
|
222
|
+
test_hash = {
|
223
|
+
match_ipv4_multicast_enable: true,
|
224
|
+
match_ipv4_multicast_src_addr: rm.default_match_ipv4_multicast_src_addr,
|
225
|
+
match_ipv4_multicast_group_addr: rm.default_match_ipv4_multicast_group_addr,
|
226
|
+
match_ipv4_multicast_group_range_begin_addr: rm.default_match_ipv4_multicast_group_range_begin_addr,
|
227
|
+
match_ipv4_multicast_group_range_end_addr: rm.default_match_ipv4_multicast_group_range_end_addr,
|
228
|
+
match_ipv4_multicast_rp_addr: rm.default_match_ipv4_multicast_rp_addr,
|
229
|
+
match_ipv4_multicast_rp_type: rm.default_match_ipv4_multicast_rp_type,
|
230
|
+
}.merge!(props)
|
231
|
+
rm.match_ipv4_multicast_set(test_hash)
|
232
|
+
rm
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_match_ipv4_multicast
|
236
|
+
rm = match_ipv4_multicast_helper(match_ipv4_multicast_src_addr: '242.1.1.1/32',
|
237
|
+
match_ipv4_multicast_group_addr: '239.2.2.2/32',
|
238
|
+
match_ipv4_multicast_rp_addr: '242.1.1.1/32',
|
239
|
+
match_ipv4_multicast_rp_type: 'ASM')
|
240
|
+
assert(rm.match_ipv4_multicast_enable)
|
241
|
+
assert_equal('242.1.1.1/32', rm.match_ipv4_multicast_src_addr)
|
242
|
+
assert_equal('239.2.2.2/32', rm.match_ipv4_multicast_group_addr)
|
243
|
+
assert_equal('242.1.1.1/32', rm.match_ipv4_multicast_rp_addr)
|
244
|
+
assert_equal('ASM', rm.match_ipv4_multicast_rp_type)
|
245
|
+
|
246
|
+
rm = match_ipv4_multicast_helper(match_ipv4_multicast_src_addr: '242.1.1.1/32',
|
247
|
+
match_ipv4_multicast_group_range_begin_addr: '239.1.1.1',
|
248
|
+
match_ipv4_multicast_group_range_end_addr: '239.2.2.2',
|
249
|
+
match_ipv4_multicast_rp_addr: '242.1.1.1/32',
|
250
|
+
match_ipv4_multicast_rp_type: 'Bidir')
|
251
|
+
assert(rm.match_ipv4_multicast_enable)
|
252
|
+
assert_equal('242.1.1.1/32', rm.match_ipv4_multicast_src_addr)
|
253
|
+
assert_equal('239.1.1.1', rm.match_ipv4_multicast_group_range_begin_addr)
|
254
|
+
assert_equal('239.2.2.2', rm.match_ipv4_multicast_group_range_end_addr)
|
255
|
+
assert_equal('242.1.1.1/32', rm.match_ipv4_multicast_rp_addr)
|
256
|
+
assert_equal('Bidir', rm.match_ipv4_multicast_rp_type)
|
257
|
+
|
258
|
+
rm = match_ipv4_multicast_helper(match_ipv4_multicast_enable: false)
|
259
|
+
assert_equal(rm.default_match_ipv4_multicast_enable, rm.match_ipv4_multicast_enable)
|
260
|
+
assert_equal(rm.default_match_ipv4_multicast_src_addr, rm.match_ipv4_multicast_src_addr)
|
261
|
+
assert_equal(rm.default_match_ipv4_multicast_group_addr, rm.match_ipv4_multicast_group_addr)
|
262
|
+
assert_equal(rm.default_match_ipv4_multicast_group_range_begin_addr, rm.match_ipv4_multicast_group_range_begin_addr)
|
263
|
+
assert_equal(rm.default_match_ipv4_multicast_group_range_end_addr, rm.match_ipv4_multicast_group_range_end_addr)
|
264
|
+
assert_equal(rm.default_match_ipv4_multicast_rp_addr, rm.match_ipv4_multicast_rp_addr)
|
265
|
+
assert_equal(rm.default_match_ipv4_multicast_rp_type, rm.match_ipv4_multicast_rp_type)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_match_ipv6_next_hop_prefix_list
|
269
|
+
rm = create_route_map
|
270
|
+
assert_equal(rm.default_match_ipv6_next_hop_prefix_list, rm.match_ipv6_next_hop_prefix_list)
|
271
|
+
array = %w(nh5 nh1 nh42)
|
272
|
+
rm.match_ipv6_next_hop_prefix_list = array
|
273
|
+
assert_equal(array, rm.match_ipv6_next_hop_prefix_list)
|
274
|
+
rm.match_ipv6_next_hop_prefix_list = rm.default_match_ipv6_next_hop_prefix_list
|
275
|
+
assert_equal(rm.default_match_ipv6_next_hop_prefix_list, rm.match_ipv6_next_hop_prefix_list)
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_match_ipv6_route_src_prefix_list
|
279
|
+
rm = create_route_map
|
280
|
+
assert_equal(rm.default_match_ipv6_route_src_prefix_list, rm.match_ipv6_route_src_prefix_list)
|
281
|
+
array = %w(rs1 rs22 pre15)
|
282
|
+
rm.match_ipv6_route_src_prefix_list = array
|
283
|
+
assert_equal(array, rm.match_ipv6_route_src_prefix_list)
|
284
|
+
rm.match_ipv6_route_src_prefix_list = rm.default_match_ipv6_route_src_prefix_list
|
285
|
+
assert_equal(rm.default_match_ipv6_route_src_prefix_list, rm.match_ipv6_route_src_prefix_list)
|
286
|
+
end
|
287
|
+
|
288
|
+
def match_ipv6_multicast_helper(props)
|
289
|
+
rm = create_route_map
|
290
|
+
test_hash = {
|
291
|
+
match_ipv6_multicast_enable: true,
|
292
|
+
match_ipv6_multicast_src_addr: rm.default_match_ipv6_multicast_src_addr,
|
293
|
+
match_ipv6_multicast_group_addr: rm.default_match_ipv6_multicast_group_addr,
|
294
|
+
match_ipv6_multicast_group_range_begin_addr: rm.default_match_ipv6_multicast_group_range_begin_addr,
|
295
|
+
match_ipv6_multicast_group_range_end_addr: rm.default_match_ipv6_multicast_group_range_end_addr,
|
296
|
+
match_ipv6_multicast_rp_addr: rm.default_match_ipv6_multicast_rp_addr,
|
297
|
+
match_ipv6_multicast_rp_type: rm.default_match_ipv6_multicast_rp_type,
|
298
|
+
}.merge!(props)
|
299
|
+
rm.match_ipv6_multicast_set(test_hash)
|
300
|
+
rm
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_match_ipv6_multicast
|
304
|
+
rm = match_ipv6_multicast_helper(match_ipv6_multicast_src_addr: '2001::348:0:0/96',
|
305
|
+
match_ipv6_multicast_group_addr: 'ff0e::2:101:0:0/96',
|
306
|
+
match_ipv6_multicast_rp_addr: '2001::348:0:0/96',
|
307
|
+
match_ipv6_multicast_rp_type: 'ASM')
|
308
|
+
assert(rm.match_ipv6_multicast_enable)
|
309
|
+
assert_equal('2001::348:0:0/96', rm.match_ipv6_multicast_src_addr)
|
310
|
+
assert_equal('ff0e::2:101:0:0/96', rm.match_ipv6_multicast_group_addr)
|
311
|
+
assert_equal('2001::348:0:0/96', rm.match_ipv6_multicast_rp_addr)
|
312
|
+
assert_equal('ASM', rm.match_ipv6_multicast_rp_type)
|
313
|
+
|
314
|
+
rm = match_ipv6_multicast_helper(match_ipv6_multicast_src_addr: '2001::348:0:0/96',
|
315
|
+
match_ipv6_multicast_group_range_begin_addr: 'ff01::',
|
316
|
+
match_ipv6_multicast_group_range_end_addr: 'ff02::',
|
317
|
+
match_ipv6_multicast_rp_addr: '2001::348:0:0/96',
|
318
|
+
match_ipv6_multicast_rp_type: 'Bidir')
|
319
|
+
assert(rm.match_ipv6_multicast_enable)
|
320
|
+
assert_equal('2001::348:0:0/96', rm.match_ipv6_multicast_src_addr)
|
321
|
+
assert_equal('ff01::', rm.match_ipv6_multicast_group_range_begin_addr)
|
322
|
+
assert_equal('ff02::', rm.match_ipv6_multicast_group_range_end_addr)
|
323
|
+
assert_equal('2001::348:0:0/96', rm.match_ipv6_multicast_rp_addr)
|
324
|
+
assert_equal('Bidir', rm.match_ipv6_multicast_rp_type)
|
325
|
+
|
326
|
+
rm = match_ipv6_multicast_helper(match_ipv6_multicast_enable: false)
|
327
|
+
assert_equal(rm.default_match_ipv6_multicast_enable, rm.match_ipv6_multicast_enable)
|
328
|
+
assert_equal(rm.default_match_ipv6_multicast_src_addr, rm.match_ipv6_multicast_src_addr)
|
329
|
+
assert_equal(rm.default_match_ipv6_multicast_group_addr, rm.match_ipv6_multicast_group_addr)
|
330
|
+
assert_equal(rm.default_match_ipv6_multicast_group_range_begin_addr, rm.match_ipv6_multicast_group_range_begin_addr)
|
331
|
+
assert_equal(rm.default_match_ipv6_multicast_group_range_end_addr, rm.match_ipv6_multicast_group_range_end_addr)
|
332
|
+
assert_equal(rm.default_match_ipv6_multicast_rp_addr, rm.match_ipv6_multicast_rp_addr)
|
333
|
+
assert_equal(rm.default_match_ipv6_multicast_rp_type, rm.match_ipv6_multicast_rp_type)
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_match_metric
|
337
|
+
# bug CSCvc82934 on n9k running dplus
|
338
|
+
skip('platform not supported for this test') if dplus_n9k?
|
339
|
+
skip_incompat_version?('route_map', 'match_metric')
|
340
|
+
rm = create_route_map
|
341
|
+
assert_equal(rm.default_match_metric, rm.match_metric)
|
342
|
+
metric = [%w(1 0), %w(8 0), %w(224 9), %w(23 0), %w(5 8), %w(6 0)]
|
343
|
+
rm.match_metric = metric
|
344
|
+
assert_equal(metric, rm.match_metric)
|
345
|
+
metric = [%w(22 5), %w(5 0), %w(24 9), %w(238 255)]
|
346
|
+
rm.match_metric = metric
|
347
|
+
assert_equal(metric, rm.match_metric)
|
348
|
+
rm.match_metric = rm.default_match_metric
|
349
|
+
assert_equal(rm.default_match_metric, rm.match_metric)
|
350
|
+
end
|
351
|
+
|
352
|
+
def match_route_type_helper(props)
|
353
|
+
rm = create_route_map
|
354
|
+
test_hash = {
|
355
|
+
match_route_type_external: rm.default_match_route_type_external,
|
356
|
+
match_route_type_inter_area: rm.default_match_route_type_inter_area,
|
357
|
+
match_route_type_internal: rm.default_match_route_type_internal,
|
358
|
+
match_route_type_intra_area: rm.default_match_route_type_intra_area,
|
359
|
+
match_route_type_level_1: rm.default_match_route_type_level_1,
|
360
|
+
match_route_type_level_2: rm.default_match_route_type_level_2,
|
361
|
+
match_route_type_local: rm.default_match_route_type_local,
|
362
|
+
match_route_type_nssa_external: rm.default_match_route_type_nssa_external,
|
363
|
+
match_route_type_type_1: rm.default_match_route_type_type_1,
|
364
|
+
match_route_type_type_2: rm.default_match_route_type_type_2,
|
365
|
+
}.merge!(props)
|
366
|
+
rm.match_route_type_set(test_hash)
|
367
|
+
rm
|
368
|
+
end
|
369
|
+
|
370
|
+
def test_match_route_type
|
371
|
+
rm = match_route_type_helper(
|
372
|
+
match_route_type_external: true,
|
373
|
+
match_route_type_internal: true,
|
374
|
+
match_route_type_level_1: true,
|
375
|
+
match_route_type_local: true,
|
376
|
+
match_route_type_type_2: true)
|
377
|
+
assert(rm.match_route_type_external)
|
378
|
+
assert(rm.match_route_type_internal)
|
379
|
+
assert(rm.match_route_type_level_1)
|
380
|
+
assert(rm.match_route_type_local)
|
381
|
+
assert(rm.match_route_type_type_2)
|
382
|
+
refute(rm.match_route_type_type_1)
|
383
|
+
refute(rm.match_route_type_inter_area)
|
384
|
+
refute(rm.match_route_type_level_2)
|
385
|
+
refute(rm.match_route_type_nssa_external)
|
386
|
+
refute(rm.match_route_type_type_1)
|
387
|
+
|
388
|
+
rm = match_route_type_helper(
|
389
|
+
match_route_type_external: true,
|
390
|
+
match_route_type_inter_area: true,
|
391
|
+
match_route_type_internal: true,
|
392
|
+
match_route_type_intra_area: true,
|
393
|
+
match_route_type_level_1: true,
|
394
|
+
match_route_type_level_2: true,
|
395
|
+
match_route_type_local: true,
|
396
|
+
match_route_type_nssa_external: true,
|
397
|
+
match_route_type_type_1: true,
|
398
|
+
match_route_type_type_2: true)
|
399
|
+
|
400
|
+
assert(rm.match_route_type_external)
|
401
|
+
assert(rm.match_route_type_internal)
|
402
|
+
assert(rm.match_route_type_level_1)
|
403
|
+
assert(rm.match_route_type_local)
|
404
|
+
assert(rm.match_route_type_type_2)
|
405
|
+
assert(rm.match_route_type_type_1)
|
406
|
+
assert(rm.match_route_type_inter_area)
|
407
|
+
assert(rm.match_route_type_level_2)
|
408
|
+
assert(rm.match_route_type_nssa_external)
|
409
|
+
assert(rm.match_route_type_type_1)
|
410
|
+
rm = match_route_type_helper(
|
411
|
+
match_route_type_level_1: true)
|
412
|
+
assert(rm.match_route_type_level_1)
|
413
|
+
rm = match_route_type_helper({})
|
414
|
+
refute(rm.match_route_type_external)
|
415
|
+
refute(rm.match_route_type_internal)
|
416
|
+
refute(rm.match_route_type_level_1)
|
417
|
+
refute(rm.match_route_type_local)
|
418
|
+
refute(rm.match_route_type_type_2)
|
419
|
+
refute(rm.match_route_type_type_1)
|
420
|
+
refute(rm.match_route_type_inter_area)
|
421
|
+
refute(rm.match_route_type_level_2)
|
422
|
+
refute(rm.match_route_type_nssa_external)
|
423
|
+
refute(rm.match_route_type_type_1)
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_match_ospf_area
|
427
|
+
rm = create_route_map
|
428
|
+
if validate_property_excluded?('route_map', 'match_ospf_area')
|
429
|
+
assert_nil(rm.match_ospf_area)
|
430
|
+
assert_raises(Cisco::UnsupportedError) do
|
431
|
+
rm.match_ospf_area = %w(10 7 222)
|
432
|
+
end
|
433
|
+
return
|
434
|
+
end
|
435
|
+
skip_incompat_version?('route_map', 'match_ospf_area')
|
436
|
+
assert_equal(rm.default_match_ospf_area, rm.match_ospf_area)
|
437
|
+
array = %w(10 7 222)
|
438
|
+
rm.match_ospf_area = array
|
439
|
+
assert_equal(array, rm.match_ospf_area)
|
440
|
+
rm.match_ospf_area = rm.default_match_ospf_area
|
441
|
+
assert_equal(rm.default_match_ospf_area, rm.match_ospf_area)
|
442
|
+
end
|
443
|
+
|
444
|
+
def test_match_mac_list
|
445
|
+
rm = create_route_map
|
446
|
+
if validate_property_excluded?('route_map', 'match_mac_list')
|
447
|
+
assert_nil(rm.match_mac_list)
|
448
|
+
assert_raises(Cisco::UnsupportedError) do
|
449
|
+
rm.match_mac_list = %w(mac1 listmac some)
|
450
|
+
end
|
451
|
+
return
|
452
|
+
end
|
453
|
+
assert_equal(rm.default_match_mac_list, rm.match_mac_list)
|
454
|
+
array = %w(mac1 listmac some)
|
455
|
+
rm.match_mac_list = array
|
456
|
+
assert_equal(array, rm.match_mac_list)
|
457
|
+
rm.match_mac_list = rm.default_match_mac_list
|
458
|
+
assert_equal(rm.default_match_mac_list, rm.match_mac_list)
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_match_length
|
462
|
+
rm = create_route_map
|
463
|
+
if validate_property_excluded?('route_map', 'match_length')
|
464
|
+
assert_nil(rm.match_length)
|
465
|
+
assert_raises(Cisco::UnsupportedError) do
|
466
|
+
rm.match_length = %w(45 500)
|
467
|
+
end
|
468
|
+
return
|
469
|
+
end
|
470
|
+
assert_equal(rm.default_match_length, rm.match_length)
|
471
|
+
array = %w(45 500)
|
472
|
+
rm.match_length = array
|
473
|
+
assert_equal(array, rm.match_length)
|
474
|
+
rm.match_length = rm.default_match_length
|
475
|
+
assert_equal(rm.default_match_length, rm.match_length)
|
476
|
+
end
|
477
|
+
|
478
|
+
def test_match_vlan
|
479
|
+
rm = create_route_map
|
480
|
+
if validate_property_excluded?('route_map', 'match_vlan')
|
481
|
+
assert_nil(rm.match_vlan)
|
482
|
+
assert_raises(Cisco::UnsupportedError) do
|
483
|
+
rm.match_vlan = '32, 45-200, 300-399, 402'
|
484
|
+
end
|
485
|
+
return
|
486
|
+
end
|
487
|
+
assert_equal(rm.default_match_vlan, rm.match_vlan)
|
488
|
+
rm.match_vlan = '32, 45-200, 300-399, 402'
|
489
|
+
assert_equal('32, 45-200, 300-399, 402', rm.match_vlan)
|
490
|
+
rm.match_vlan = rm.default_match_vlan
|
491
|
+
assert_equal(rm.default_match_vlan, rm.match_vlan)
|
492
|
+
end
|
493
|
+
|
494
|
+
def test_match_evpn_route_type1
|
495
|
+
rm = create_route_map
|
496
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_1')
|
497
|
+
assert_nil(rm.match_evpn_route_type_1)
|
498
|
+
assert_raises(Cisco::UnsupportedError) do
|
499
|
+
rm.match_evpn_route_type_1 = true
|
500
|
+
end
|
501
|
+
return
|
502
|
+
end
|
503
|
+
assert_equal(rm.default_match_evpn_route_type_1, rm.match_evpn_route_type_1)
|
504
|
+
rm.match_evpn_route_type_1 = true
|
505
|
+
assert(rm.match_evpn_route_type_1)
|
506
|
+
rm.match_evpn_route_type_1 = rm.default_match_evpn_route_type_1
|
507
|
+
assert_equal(rm.default_match_evpn_route_type_1, rm.match_evpn_route_type_1)
|
508
|
+
end
|
509
|
+
|
510
|
+
def test_match_evpn_route_type3
|
511
|
+
rm = create_route_map
|
512
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_3')
|
513
|
+
assert_nil(rm.match_evpn_route_type_3)
|
514
|
+
assert_raises(Cisco::UnsupportedError) do
|
515
|
+
rm.match_evpn_route_type_3 = true
|
516
|
+
end
|
517
|
+
return
|
518
|
+
end
|
519
|
+
assert_equal(rm.default_match_evpn_route_type_3, rm.match_evpn_route_type_3)
|
520
|
+
rm.match_evpn_route_type_3 = true
|
521
|
+
assert(rm.match_evpn_route_type_3)
|
522
|
+
rm.match_evpn_route_type_3 = rm.default_match_evpn_route_type_3
|
523
|
+
assert_equal(rm.default_match_evpn_route_type_3, rm.match_evpn_route_type_3)
|
524
|
+
end
|
525
|
+
|
526
|
+
def test_match_evpn_route_type4
|
527
|
+
rm = create_route_map
|
528
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_4')
|
529
|
+
assert_nil(rm.match_evpn_route_type_4)
|
530
|
+
assert_raises(Cisco::UnsupportedError) do
|
531
|
+
rm.match_evpn_route_type_4 = true
|
532
|
+
end
|
533
|
+
return
|
534
|
+
end
|
535
|
+
assert_equal(rm.default_match_evpn_route_type_4, rm.match_evpn_route_type_4)
|
536
|
+
rm.match_evpn_route_type_4 = true
|
537
|
+
assert(rm.match_evpn_route_type_4)
|
538
|
+
rm.match_evpn_route_type_4 = rm.default_match_evpn_route_type_4
|
539
|
+
assert_equal(rm.default_match_evpn_route_type_4, rm.match_evpn_route_type_4)
|
540
|
+
end
|
541
|
+
|
542
|
+
def test_match_evpn_route_type5
|
543
|
+
rm = create_route_map
|
544
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_5')
|
545
|
+
assert_nil(rm.match_evpn_route_type_5)
|
546
|
+
assert_raises(Cisco::UnsupportedError) do
|
547
|
+
rm.match_evpn_route_type_5 = true
|
548
|
+
end
|
549
|
+
return
|
550
|
+
end
|
551
|
+
assert_equal(rm.default_match_evpn_route_type_5, rm.match_evpn_route_type_5)
|
552
|
+
rm.match_evpn_route_type_5 = true
|
553
|
+
assert(rm.match_evpn_route_type_5)
|
554
|
+
rm.match_evpn_route_type_5 = rm.default_match_evpn_route_type_5
|
555
|
+
assert_equal(rm.default_match_evpn_route_type_5, rm.match_evpn_route_type_5)
|
556
|
+
end
|
557
|
+
|
558
|
+
def test_match_evpn_route_type6
|
559
|
+
rm = create_route_map
|
560
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_6')
|
561
|
+
assert_nil(rm.match_evpn_route_type_6)
|
562
|
+
assert_raises(Cisco::UnsupportedError) do
|
563
|
+
rm.match_evpn_route_type_6 = true
|
564
|
+
end
|
565
|
+
return
|
566
|
+
end
|
567
|
+
assert_equal(rm.default_match_evpn_route_type_6, rm.match_evpn_route_type_6)
|
568
|
+
rm.match_evpn_route_type_6 = true
|
569
|
+
assert(rm.match_evpn_route_type_6)
|
570
|
+
rm.match_evpn_route_type_6 = rm.default_match_evpn_route_type_6
|
571
|
+
assert_equal(rm.default_match_evpn_route_type_6, rm.match_evpn_route_type_6)
|
572
|
+
end
|
573
|
+
|
574
|
+
def test_match_evpn_route_type_all
|
575
|
+
rm = create_route_map
|
576
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_all')
|
577
|
+
assert_nil(rm.match_evpn_route_type_all)
|
578
|
+
assert_raises(Cisco::UnsupportedError) do
|
579
|
+
rm.match_evpn_route_type_all = true
|
580
|
+
end
|
581
|
+
return
|
582
|
+
end
|
583
|
+
assert_equal(rm.default_match_evpn_route_type_all, rm.match_evpn_route_type_all)
|
584
|
+
rm.match_evpn_route_type_all = true
|
585
|
+
assert(rm.match_evpn_route_type_all)
|
586
|
+
rm.match_evpn_route_type_all = rm.default_match_evpn_route_type_all
|
587
|
+
assert_equal(rm.default_match_evpn_route_type_all, rm.match_evpn_route_type_all)
|
588
|
+
end
|
589
|
+
|
590
|
+
def test_match_evpn_route_type_2_all
|
591
|
+
rm = create_route_map
|
592
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_2_all')
|
593
|
+
assert_nil(rm.match_evpn_route_type_2_all)
|
594
|
+
assert_raises(Cisco::UnsupportedError) do
|
595
|
+
rm.match_evpn_route_type_2_all = true
|
596
|
+
end
|
597
|
+
return
|
598
|
+
end
|
599
|
+
assert_equal(rm.default_match_evpn_route_type_2_all, rm.match_evpn_route_type_2_all)
|
600
|
+
rm.match_evpn_route_type_2_all = true
|
601
|
+
assert(rm.match_evpn_route_type_2_all)
|
602
|
+
rm.match_evpn_route_type_2_all = rm.default_match_evpn_route_type_2_all
|
603
|
+
assert_equal(rm.default_match_evpn_route_type_2_all, rm.match_evpn_route_type_2_all)
|
604
|
+
end
|
605
|
+
|
606
|
+
def test_match_evpn_route_type_2_mac_ip
|
607
|
+
rm = create_route_map
|
608
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_2_mac_ip')
|
609
|
+
assert_nil(rm.match_evpn_route_type_2_mac_ip)
|
610
|
+
assert_raises(Cisco::UnsupportedError) do
|
611
|
+
rm.match_evpn_route_type_2_mac_ip = true
|
612
|
+
end
|
613
|
+
return
|
614
|
+
end
|
615
|
+
assert_equal(rm.default_match_evpn_route_type_2_mac_ip, rm.match_evpn_route_type_2_mac_ip)
|
616
|
+
rm.match_evpn_route_type_2_mac_ip = true
|
617
|
+
assert(rm.match_evpn_route_type_2_mac_ip)
|
618
|
+
rm.match_evpn_route_type_2_mac_ip = rm.default_match_evpn_route_type_2_mac_ip
|
619
|
+
assert_equal(rm.default_match_evpn_route_type_2_mac_ip, rm.match_evpn_route_type_2_mac_ip)
|
620
|
+
end
|
621
|
+
|
622
|
+
def test_match_evpn_route_type_2_mac_only
|
623
|
+
rm = create_route_map
|
624
|
+
if validate_property_excluded?('route_map', 'match_evpn_route_type_2_mac_only')
|
625
|
+
assert_nil(rm.match_evpn_route_type_2_mac_only)
|
626
|
+
assert_raises(Cisco::UnsupportedError) do
|
627
|
+
rm.match_evpn_route_type_2_mac_only = true
|
628
|
+
end
|
629
|
+
return
|
630
|
+
end
|
631
|
+
assert_equal(rm.default_match_evpn_route_type_2_mac_only, rm.match_evpn_route_type_2_mac_only)
|
632
|
+
rm.match_evpn_route_type_2_mac_only = true
|
633
|
+
assert(rm.match_evpn_route_type_2_mac_only)
|
634
|
+
rm.match_evpn_route_type_2_mac_only = rm.default_match_evpn_route_type_2_mac_only
|
635
|
+
assert_equal(rm.default_match_evpn_route_type_2_mac_only, rm.match_evpn_route_type_2_mac_only)
|
636
|
+
end
|
637
|
+
|
638
|
+
def test_set_comm_list
|
639
|
+
rm = create_route_map
|
640
|
+
assert_equal(rm.default_set_comm_list, rm.set_comm_list)
|
641
|
+
rm.set_comm_list = 'abc'
|
642
|
+
assert_equal('abc', rm.set_comm_list)
|
643
|
+
rm.set_comm_list = rm.default_set_comm_list
|
644
|
+
assert_equal(rm.default_set_comm_list, rm.set_comm_list)
|
645
|
+
end
|
646
|
+
|
647
|
+
def test_set_extcomm_list
|
648
|
+
rm = create_route_map
|
649
|
+
assert_equal(rm.default_set_extcomm_list, rm.set_extcomm_list)
|
650
|
+
rm.set_extcomm_list = 'xyz'
|
651
|
+
assert_equal('xyz', rm.set_extcomm_list)
|
652
|
+
rm.set_extcomm_list = rm.default_set_extcomm_list
|
653
|
+
assert_equal(rm.default_set_extcomm_list, rm.set_extcomm_list)
|
654
|
+
end
|
655
|
+
|
656
|
+
def test_set_forwarding_addr
|
657
|
+
rm = create_route_map
|
658
|
+
assert_equal(rm.default_set_forwarding_addr, rm.set_forwarding_addr)
|
659
|
+
rm.set_forwarding_addr = true
|
660
|
+
assert(rm.set_forwarding_addr)
|
661
|
+
rm.set_forwarding_addr = rm.default_set_forwarding_addr
|
662
|
+
assert_equal(rm.default_set_forwarding_addr, rm.set_forwarding_addr)
|
663
|
+
end
|
664
|
+
|
665
|
+
def test_set_ipv4_next_hop_peer_addr
|
666
|
+
rm = lset_ip_next_hop_helper(v4peer: true)
|
667
|
+
assert(rm.set_ipv4_next_hop_peer_addr)
|
668
|
+
hash = {}
|
669
|
+
rm = lset_ip_next_hop_helper(hash)
|
670
|
+
assert_equal(rm.default_set_ipv4_next_hop_peer_addr,
|
671
|
+
rm.set_ipv4_next_hop_peer_addr)
|
672
|
+
end
|
673
|
+
|
674
|
+
def test_set_ipv4_next_hop_redist
|
675
|
+
skip_incompat_version?('route_map', 'set_ipv4_next_hop_redist')
|
676
|
+
rm = lset_ip_next_hop_helper(v4red: true)
|
677
|
+
assert(rm.set_ipv4_next_hop_redist)
|
678
|
+
hash = {}
|
679
|
+
rm = lset_ip_next_hop_helper(hash)
|
680
|
+
assert_equal(rm.default_set_ipv4_next_hop_redist,
|
681
|
+
rm.set_ipv4_next_hop_redist)
|
682
|
+
end
|
683
|
+
|
684
|
+
def test_set_ipv4_next_hop_unchanged
|
685
|
+
rm = lset_ip_next_hop_helper(v4unc: true)
|
686
|
+
assert(rm.set_ipv4_next_hop_unchanged)
|
687
|
+
hash = {}
|
688
|
+
rm = lset_ip_next_hop_helper(hash)
|
689
|
+
assert_equal(rm.default_set_ipv4_next_hop_unchanged,
|
690
|
+
rm.set_ipv4_next_hop_unchanged)
|
691
|
+
end
|
692
|
+
|
693
|
+
def test_set_level
|
694
|
+
rm = create_route_map
|
695
|
+
assert_equal(rm.default_set_level, rm.set_level)
|
696
|
+
rm.set_level = 'level-1'
|
697
|
+
assert_equal('level-1', rm.set_level)
|
698
|
+
rm.set_level = 'level-1-2'
|
699
|
+
assert_equal('level-1-2', rm.set_level)
|
700
|
+
rm.set_level = 'level-2'
|
701
|
+
assert_equal('level-2', rm.set_level)
|
702
|
+
rm.set_level = rm.default_set_level
|
703
|
+
assert_equal(rm.default_set_level, rm.set_level)
|
704
|
+
end
|
705
|
+
|
706
|
+
def test_set_local_preference
|
707
|
+
rm = create_route_map
|
708
|
+
assert_equal(rm.default_set_local_preference, rm.set_local_preference)
|
709
|
+
rm.set_local_preference = 100
|
710
|
+
assert_equal(100, rm.set_local_preference)
|
711
|
+
rm.set_local_preference = rm.default_set_local_preference
|
712
|
+
assert_equal(rm.default_set_local_preference, rm.set_local_preference)
|
713
|
+
end
|
714
|
+
|
715
|
+
def test_set_metric_type
|
716
|
+
rm = create_route_map
|
717
|
+
assert_equal(rm.default_set_metric_type, rm.set_metric_type)
|
718
|
+
rm.set_metric_type = 'external'
|
719
|
+
assert_equal('external', rm.set_metric_type)
|
720
|
+
rm.set_metric_type = 'internal'
|
721
|
+
assert_equal('internal', rm.set_metric_type)
|
722
|
+
rm.set_metric_type = 'type-1'
|
723
|
+
assert_equal('type-1', rm.set_metric_type)
|
724
|
+
rm.set_metric_type = 'type-2'
|
725
|
+
assert_equal('type-2', rm.set_metric_type)
|
726
|
+
rm.set_metric_type = rm.default_set_metric_type
|
727
|
+
assert_equal(rm.default_set_metric_type, rm.set_metric_type)
|
728
|
+
end
|
729
|
+
|
730
|
+
def test_set_nssa_only
|
731
|
+
rm = create_route_map
|
732
|
+
assert_equal(rm.default_set_nssa_only, rm.set_nssa_only)
|
733
|
+
rm.set_nssa_only = true
|
734
|
+
assert(rm.set_nssa_only)
|
735
|
+
rm.set_nssa_only = rm.default_set_nssa_only
|
736
|
+
assert_equal(rm.default_set_nssa_only, rm.set_nssa_only)
|
737
|
+
end
|
738
|
+
|
739
|
+
def test_set_origin
|
740
|
+
rm = create_route_map
|
741
|
+
assert_equal(rm.default_set_origin, rm.set_origin)
|
742
|
+
rm.set_origin = 'egp'
|
743
|
+
assert_equal('egp', rm.set_origin)
|
744
|
+
rm.set_origin = 'incomplete'
|
745
|
+
assert_equal('incomplete', rm.set_origin)
|
746
|
+
rm.set_origin = 'igp'
|
747
|
+
assert_equal('igp', rm.set_origin)
|
748
|
+
rm.set_origin = rm.default_set_origin
|
749
|
+
assert_equal(rm.default_set_origin, rm.set_origin)
|
750
|
+
end
|
751
|
+
|
752
|
+
def test_set_path_selection
|
753
|
+
rm = create_route_map
|
754
|
+
assert_equal(rm.default_set_path_selection, rm.set_path_selection)
|
755
|
+
rm.set_path_selection = true
|
756
|
+
assert(rm.set_path_selection)
|
757
|
+
rm.set_path_selection = rm.default_set_path_selection
|
758
|
+
assert_equal(rm.default_set_path_selection, rm.set_path_selection)
|
759
|
+
end
|
760
|
+
|
761
|
+
def test_set_tag
|
762
|
+
rm = create_route_map
|
763
|
+
assert_equal(rm.default_set_tag, rm.set_tag)
|
764
|
+
rm.set_tag = 100
|
765
|
+
assert_equal(100, rm.set_tag)
|
766
|
+
rm.set_tag = rm.default_set_tag
|
767
|
+
assert_equal(rm.default_set_tag, rm.set_tag)
|
768
|
+
end
|
769
|
+
|
770
|
+
def test_set_vrf
|
771
|
+
rm = create_route_map
|
772
|
+
if validate_property_excluded?('route_map', 'set_vrf')
|
773
|
+
assert_nil(rm.set_vrf)
|
774
|
+
assert_raises(Cisco::UnsupportedError) do
|
775
|
+
rm.set_vrf = 'default'
|
776
|
+
end
|
777
|
+
return
|
778
|
+
end
|
779
|
+
assert_equal(rm.default_set_vrf, rm.set_vrf)
|
780
|
+
rm.set_vrf = 'default_vrf'
|
781
|
+
assert_equal('default_vrf', rm.set_vrf)
|
782
|
+
rm.set_vrf = 'management'
|
783
|
+
assert_equal('management', rm.set_vrf)
|
784
|
+
rm.set_vrf = 'igp'
|
785
|
+
assert_equal('igp', rm.set_vrf)
|
786
|
+
rm.set_vrf = rm.default_set_vrf
|
787
|
+
assert_equal(rm.default_set_vrf, rm.set_vrf)
|
788
|
+
end
|
789
|
+
|
790
|
+
def test_set_weight
|
791
|
+
rm = create_route_map
|
792
|
+
assert_equal(rm.default_set_weight, rm.set_weight)
|
793
|
+
rm.set_weight = 333
|
794
|
+
assert_equal(333, rm.set_weight)
|
795
|
+
rm.set_weight = rm.default_set_weight
|
796
|
+
assert_equal(rm.default_set_weight, rm.set_weight)
|
797
|
+
end
|
798
|
+
|
799
|
+
def test_set_metric
|
800
|
+
rm = create_route_map
|
801
|
+
assert_equal(rm.default_set_metric_additive, rm.set_metric_additive)
|
802
|
+
assert_equal(rm.default_set_metric_bandwidth, rm.set_metric_bandwidth)
|
803
|
+
assert_equal(rm.default_set_metric_delay, rm.set_metric_delay)
|
804
|
+
assert_equal(rm.default_set_metric_reliability,
|
805
|
+
rm.set_metric_reliability)
|
806
|
+
assert_equal(rm.default_set_metric_effective_bandwidth,
|
807
|
+
rm.set_metric_effective_bandwidth)
|
808
|
+
assert_equal(rm.default_set_metric_mtu, rm.set_metric_mtu)
|
809
|
+
rm.set_metric_set(false, 44, 55, 66, 77, 88)
|
810
|
+
refute(rm.set_metric_additive)
|
811
|
+
assert_equal(44, rm.set_metric_bandwidth)
|
812
|
+
assert_equal(55, rm.set_metric_delay)
|
813
|
+
assert_equal(66, rm.set_metric_reliability)
|
814
|
+
assert_equal(77, rm.set_metric_effective_bandwidth)
|
815
|
+
assert_equal(88, rm.set_metric_mtu)
|
816
|
+
rm.set_metric_set(true, 33, false, false, false, false)
|
817
|
+
assert(rm.set_metric_additive)
|
818
|
+
assert_equal(33, rm.set_metric_bandwidth)
|
819
|
+
refute(rm.set_metric_delay)
|
820
|
+
refute(rm.set_metric_reliability)
|
821
|
+
refute(rm.set_metric_effective_bandwidth)
|
822
|
+
refute(rm.set_metric_mtu)
|
823
|
+
rm.set_metric_set(false, false, false, false, false, false)
|
824
|
+
assert_equal(rm.default_set_metric_additive, rm.set_metric_additive)
|
825
|
+
assert_equal(rm.default_set_metric_bandwidth, rm.set_metric_bandwidth)
|
826
|
+
assert_equal(rm.default_set_metric_delay, rm.set_metric_delay)
|
827
|
+
assert_equal(rm.default_set_metric_reliability,
|
828
|
+
rm.set_metric_reliability)
|
829
|
+
assert_equal(rm.default_set_metric_effective_bandwidth,
|
830
|
+
rm.set_metric_effective_bandwidth)
|
831
|
+
assert_equal(rm.default_set_metric_mtu, rm.set_metric_mtu)
|
832
|
+
end
|
833
|
+
|
834
|
+
def test_set_dampening
|
835
|
+
rm = create_route_map
|
836
|
+
assert_equal(rm.default_set_dampening_half_life,
|
837
|
+
rm.set_dampening_half_life)
|
838
|
+
assert_equal(rm.default_set_dampening_reuse,
|
839
|
+
rm.set_dampening_reuse)
|
840
|
+
assert_equal(rm.default_set_dampening_suppress,
|
841
|
+
rm.set_dampening_suppress)
|
842
|
+
assert_equal(rm.default_set_dampening_max_duation,
|
843
|
+
rm.set_dampening_max_duation)
|
844
|
+
rm.set_dampening_set(6, 22, 44, 55)
|
845
|
+
assert_equal(6, rm.set_dampening_half_life)
|
846
|
+
assert_equal(22, rm.set_dampening_reuse)
|
847
|
+
assert_equal(44, rm.set_dampening_suppress)
|
848
|
+
assert_equal(55, rm.set_dampening_max_duation)
|
849
|
+
rm.set_dampening_set(false, false, false, false)
|
850
|
+
assert_equal(rm.default_set_dampening_half_life,
|
851
|
+
rm.set_dampening_half_life)
|
852
|
+
assert_equal(rm.default_set_dampening_reuse,
|
853
|
+
rm.set_dampening_reuse)
|
854
|
+
assert_equal(rm.default_set_dampening_suppress,
|
855
|
+
rm.set_dampening_suppress)
|
856
|
+
assert_equal(rm.default_set_dampening_max_duation,
|
857
|
+
rm.set_dampening_max_duation)
|
858
|
+
end
|
859
|
+
|
860
|
+
def test_set_distance
|
861
|
+
rm = create_route_map
|
862
|
+
assert_equal(rm.default_set_distance_igp_ebgp,
|
863
|
+
rm.set_distance_igp_ebgp)
|
864
|
+
assert_equal(rm.default_set_distance_internal,
|
865
|
+
rm.set_distance_internal)
|
866
|
+
assert_equal(rm.default_set_distance_local,
|
867
|
+
rm.set_distance_local)
|
868
|
+
rm.set_distance_set(1, 2, 3)
|
869
|
+
assert_equal(1, rm.set_distance_igp_ebgp)
|
870
|
+
assert_equal(2, rm.set_distance_internal)
|
871
|
+
assert_equal(3, rm.set_distance_local)
|
872
|
+
rm.set_distance_set(1, false, false)
|
873
|
+
assert_equal(1, rm.set_distance_igp_ebgp)
|
874
|
+
refute(rm.set_distance_internal)
|
875
|
+
refute(rm.set_distance_local)
|
876
|
+
rm.set_distance_set(1, 2, false)
|
877
|
+
assert_equal(1, rm.set_distance_igp_ebgp)
|
878
|
+
assert_equal(2, rm.set_distance_internal)
|
879
|
+
refute(rm.set_distance_local)
|
880
|
+
rm.set_distance_set(false, false, false)
|
881
|
+
assert_equal(rm.default_set_distance_igp_ebgp,
|
882
|
+
rm.set_distance_igp_ebgp)
|
883
|
+
assert_equal(rm.default_set_distance_internal,
|
884
|
+
rm.set_distance_internal)
|
885
|
+
assert_equal(rm.default_set_distance_local,
|
886
|
+
rm.set_distance_local)
|
887
|
+
end
|
888
|
+
|
889
|
+
def test_set_as_path_prepend_last_as
|
890
|
+
rm = create_route_map
|
891
|
+
assert_equal(rm.default_set_as_path_prepend_last_as,
|
892
|
+
rm.set_as_path_prepend_last_as)
|
893
|
+
rm.set_as_path_prepend_last_as = 1
|
894
|
+
assert_equal(1, rm.set_as_path_prepend_last_as)
|
895
|
+
rm.set_as_path_prepend_last_as = rm.default_set_as_path_prepend_last_as
|
896
|
+
assert_equal(rm.default_set_as_path_prepend_last_as,
|
897
|
+
rm.set_as_path_prepend_last_as)
|
898
|
+
end
|
899
|
+
|
900
|
+
def test_set_as_path_tag
|
901
|
+
rm = create_route_map
|
902
|
+
assert_equal(rm.default_set_as_path_tag,
|
903
|
+
rm.set_as_path_tag)
|
904
|
+
rm.set_as_path_tag = true
|
905
|
+
assert(rm.set_as_path_tag)
|
906
|
+
rm.set_as_path_tag = rm.default_set_as_path_tag
|
907
|
+
assert_equal(rm.default_set_as_path_tag,
|
908
|
+
rm.set_as_path_tag)
|
909
|
+
end
|
910
|
+
|
911
|
+
def test_set_as_path_prepend
|
912
|
+
rm = create_route_map
|
913
|
+
assert_equal(rm.default_set_as_path_prepend,
|
914
|
+
rm.set_as_path_prepend)
|
915
|
+
arr = ['55.77', '12', '45.3', '4.77', '5']
|
916
|
+
rm.set_as_path_prepend = arr
|
917
|
+
assert_equal(arr, rm.set_as_path_prepend)
|
918
|
+
rm.set_as_path_prepend = rm.default_set_as_path_prepend
|
919
|
+
assert_equal(rm.default_set_as_path_prepend,
|
920
|
+
rm.set_as_path_prepend)
|
921
|
+
end
|
922
|
+
|
923
|
+
def test_set_interface
|
924
|
+
rm = lset_ip_next_hop_helper(intf: 'Null0')
|
925
|
+
assert_equal('Null0', rm.set_interface)
|
926
|
+
hash = {}
|
927
|
+
rm = lset_ip_next_hop_helper(hash)
|
928
|
+
assert_equal(rm.default_set_interface,
|
929
|
+
rm.set_interface)
|
930
|
+
end
|
931
|
+
|
932
|
+
def test_set_ipv4_prefix
|
933
|
+
rm = create_route_map
|
934
|
+
if validate_property_excluded?('route_map', 'set_ipv4_prefix')
|
935
|
+
assert_nil(rm.set_ipv4_prefix)
|
936
|
+
assert_raises(Cisco::UnsupportedError) do
|
937
|
+
rm.set_ipv4_prefix = 'abcdef'
|
938
|
+
end
|
939
|
+
return
|
940
|
+
end
|
941
|
+
assert_equal(rm.default_set_ipv4_prefix, rm.set_ipv4_prefix)
|
942
|
+
rm.set_ipv4_prefix = 'abcdef'
|
943
|
+
assert_equal('abcdef', rm.set_ipv4_prefix)
|
944
|
+
rm.set_ipv4_prefix = rm.default_set_ipv4_prefix
|
945
|
+
assert_equal(rm.default_set_ipv4_prefix, rm.set_ipv4_prefix)
|
946
|
+
end
|
947
|
+
|
948
|
+
def test_set_ip_precedence
|
949
|
+
rm = create_route_map
|
950
|
+
assert_equal(rm.default_set_ipv4_precedence, rm.set_ipv4_precedence)
|
951
|
+
assert_equal(rm.default_set_ipv6_precedence, rm.set_ipv6_precedence)
|
952
|
+
rm.set_ip_precedence('critical', rm.default_set_ipv6_precedence)
|
953
|
+
assert_equal('critical', rm.set_ipv4_precedence)
|
954
|
+
assert_equal(rm.default_set_ipv6_precedence, rm.set_ipv6_precedence)
|
955
|
+
rm.set_ip_precedence(rm.default_set_ipv6_precedence, 'network')
|
956
|
+
assert_equal(rm.default_set_ipv4_precedence, rm.set_ipv4_precedence)
|
957
|
+
assert_equal('network', rm.set_ipv6_precedence)
|
958
|
+
rm.set_ip_precedence(rm.default_set_ipv4_precedence,
|
959
|
+
rm.default_set_ipv6_precedence)
|
960
|
+
assert_equal(rm.default_set_ipv4_precedence, rm.set_ipv4_precedence)
|
961
|
+
assert_equal(rm.default_set_ipv6_precedence, rm.set_ipv6_precedence)
|
962
|
+
end
|
963
|
+
|
964
|
+
def test_set_ipv4_default_next_hop
|
965
|
+
skip('platform not supported for this test') if product_tag[/(n35|n5k|n6k|n9k|n9k-f|n3k-f)/]
|
966
|
+
arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
|
967
|
+
rm = lset_ip_next_hop_helper(v4dnh: arr)
|
968
|
+
assert_equal(arr, rm.set_ipv4_default_next_hop)
|
969
|
+
assert_equal(rm.default_set_ipv4_default_next_hop_load_share,
|
970
|
+
rm.set_ipv4_default_next_hop_load_share)
|
971
|
+
rm = lset_ip_next_hop_helper(v4dnh: arr, v4dls: true)
|
972
|
+
assert_equal(arr, rm.set_ipv4_default_next_hop)
|
973
|
+
assert(rm.set_ipv4_default_next_hop_load_share)
|
974
|
+
rm = lset_ip_next_hop_helper(v4dls: true)
|
975
|
+
assert_equal(rm.default_set_ipv4_default_next_hop,
|
976
|
+
rm.set_ipv4_default_next_hop)
|
977
|
+
assert(rm.set_ipv4_default_next_hop_load_share)
|
978
|
+
hash = {}
|
979
|
+
rm = lset_ip_next_hop_helper(hash)
|
980
|
+
assert_equal(rm.default_set_ipv4_default_next_hop,
|
981
|
+
rm.set_ipv4_default_next_hop)
|
982
|
+
assert_equal(rm.default_set_ipv4_default_next_hop_load_share,
|
983
|
+
rm.set_ipv4_default_next_hop_load_share)
|
984
|
+
end
|
985
|
+
|
986
|
+
def test_set_ipv4_next_hop
|
987
|
+
arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
|
988
|
+
rm = lset_ip_next_hop_helper(v4nh: arr)
|
989
|
+
assert_equal(arr, rm.set_ipv4_next_hop)
|
990
|
+
hash = {}
|
991
|
+
rm = lset_ip_next_hop_helper(hash)
|
992
|
+
assert_equal(rm.default_set_ipv4_next_hop,
|
993
|
+
rm.set_ipv4_next_hop)
|
994
|
+
end
|
995
|
+
|
996
|
+
def test_set_ipv4_next_hop_load_share
|
997
|
+
# bug on fretta
|
998
|
+
skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
|
999
|
+
skip_incompat_version?('route_map', 'set_ipv4_next_hop_load_share')
|
1000
|
+
arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
|
1001
|
+
rm = lset_ip_next_hop_helper(v4nh: arr)
|
1002
|
+
assert_equal(arr, rm.set_ipv4_next_hop)
|
1003
|
+
assert_equal(rm.default_set_ipv4_next_hop_load_share,
|
1004
|
+
rm.set_ipv4_next_hop_load_share)
|
1005
|
+
rm = lset_ip_next_hop_helper(v4nh: arr, v4ls: true)
|
1006
|
+
assert_equal(arr, rm.set_ipv4_next_hop)
|
1007
|
+
assert(rm.set_ipv4_next_hop_load_share)
|
1008
|
+
rm = lset_ip_next_hop_helper(v4ls: true)
|
1009
|
+
assert_equal(rm.default_set_ipv4_next_hop,
|
1010
|
+
rm.set_ipv4_next_hop)
|
1011
|
+
assert(rm.set_ipv4_next_hop_load_share)
|
1012
|
+
hash = {}
|
1013
|
+
rm = lset_ip_next_hop_helper(hash)
|
1014
|
+
assert_equal(rm.default_set_ipv4_next_hop,
|
1015
|
+
rm.set_ipv4_next_hop)
|
1016
|
+
assert_equal(rm.default_set_ipv4_next_hop_load_share,
|
1017
|
+
rm.set_ipv4_next_hop_load_share)
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
def test_set_ipv6_next_hop_peer_addr
|
1021
|
+
rm = lset_ip_next_hop_helper(v6peer: true)
|
1022
|
+
assert(rm.set_ipv6_next_hop_peer_addr)
|
1023
|
+
hash = {}
|
1024
|
+
rm = lset_ip_next_hop_helper(hash)
|
1025
|
+
assert_equal(rm.default_set_ipv6_next_hop_peer_addr,
|
1026
|
+
rm.set_ipv6_next_hop_peer_addr)
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
def test_set_ipv6_next_hop_redist
|
1030
|
+
skip_incompat_version?('route_map', 'set_ipv6_next_hop_redist')
|
1031
|
+
rm = lset_ip_next_hop_helper(v6red: true)
|
1032
|
+
assert(rm.set_ipv6_next_hop_redist)
|
1033
|
+
hash = {}
|
1034
|
+
rm = lset_ip_next_hop_helper(hash)
|
1035
|
+
assert_equal(rm.default_set_ipv6_next_hop_redist,
|
1036
|
+
rm.set_ipv6_next_hop_redist)
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def test_set_ipv6_next_hop_unchanged
|
1040
|
+
rm = lset_ip_next_hop_helper(v6unc: true)
|
1041
|
+
assert(rm.set_ipv6_next_hop_unchanged)
|
1042
|
+
hash = {}
|
1043
|
+
rm = lset_ip_next_hop_helper(hash)
|
1044
|
+
assert_equal(rm.default_set_ipv6_next_hop_unchanged,
|
1045
|
+
rm.set_ipv6_next_hop_unchanged)
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
def test_set_ipv6_prefix
|
1049
|
+
rm = create_route_map
|
1050
|
+
if validate_property_excluded?('route_map', 'set_ipv6_prefix')
|
1051
|
+
assert_nil(rm.set_ipv6_prefix)
|
1052
|
+
assert_raises(Cisco::UnsupportedError) do
|
1053
|
+
rm.set_ipv6_prefix = 'abcdef'
|
1054
|
+
end
|
1055
|
+
return
|
1056
|
+
end
|
1057
|
+
assert_equal(rm.default_set_ipv6_prefix, rm.set_ipv6_prefix)
|
1058
|
+
rm.set_ipv6_prefix = 'abcdef'
|
1059
|
+
assert_equal('abcdef', rm.set_ipv6_prefix)
|
1060
|
+
rm.set_ipv6_prefix = rm.default_set_ipv6_prefix
|
1061
|
+
assert_equal(rm.default_set_ipv6_prefix, rm.set_ipv6_prefix)
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
def test_set_ipv6_default_next_hop
|
1065
|
+
skip('platform not supported for this test') if product_tag[/(n35|n5k|n6k|n9k|n9k-f|n3k-f)/]
|
1066
|
+
arr = %w(2000::1 2000::11 2000::22)
|
1067
|
+
rm = lset_ip_next_hop_helper(v6dnh: arr)
|
1068
|
+
assert_equal(arr, rm.set_ipv6_default_next_hop)
|
1069
|
+
assert_equal(rm.default_set_ipv6_default_next_hop_load_share,
|
1070
|
+
rm.set_ipv6_default_next_hop_load_share)
|
1071
|
+
rm = lset_ip_next_hop_helper(v6dnh: arr, v6dls: true)
|
1072
|
+
assert_equal(arr, rm.set_ipv6_default_next_hop)
|
1073
|
+
assert(rm.set_ipv6_default_next_hop_load_share)
|
1074
|
+
rm = lset_ip_next_hop_helper(v6dls: true)
|
1075
|
+
assert_equal(rm.default_set_ipv6_default_next_hop,
|
1076
|
+
rm.set_ipv6_default_next_hop)
|
1077
|
+
assert(rm.set_ipv6_default_next_hop_load_share)
|
1078
|
+
hash = {}
|
1079
|
+
rm = lset_ip_next_hop_helper(hash)
|
1080
|
+
assert_equal(rm.default_set_ipv6_default_next_hop,
|
1081
|
+
rm.set_ipv6_default_next_hop)
|
1082
|
+
assert_equal(rm.default_set_ipv6_default_next_hop_load_share,
|
1083
|
+
rm.set_ipv6_default_next_hop_load_share)
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
def test_set_ipv6_next_hop
|
1087
|
+
arr = %w(2000::1 2000::11 2000::22)
|
1088
|
+
rm = lset_ip_next_hop_helper(v6nh: arr)
|
1089
|
+
assert_equal(arr, rm.set_ipv6_next_hop)
|
1090
|
+
hash = {}
|
1091
|
+
rm = lset_ip_next_hop_helper(hash)
|
1092
|
+
assert_equal(rm.default_set_ipv6_next_hop,
|
1093
|
+
rm.set_ipv6_next_hop)
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
def test_set_ipv6_next_hop_load_share
|
1097
|
+
# bug on fretta
|
1098
|
+
skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
|
1099
|
+
skip_incompat_version?('route_map', 'set_ipv6_next_hop_load_share')
|
1100
|
+
arr = %w(2000::1 2000::11 2000::22)
|
1101
|
+
rm = lset_ip_next_hop_helper(v6nh: arr)
|
1102
|
+
assert_equal(arr, rm.set_ipv6_next_hop)
|
1103
|
+
assert_equal(rm.default_set_ipv6_next_hop_load_share,
|
1104
|
+
rm.set_ipv6_next_hop_load_share)
|
1105
|
+
rm = lset_ip_next_hop_helper(v6nh: arr, v6ls: true)
|
1106
|
+
assert_equal(arr, rm.set_ipv6_next_hop)
|
1107
|
+
assert(rm.set_ipv6_next_hop_load_share)
|
1108
|
+
rm = lset_ip_next_hop_helper(v6ls: true)
|
1109
|
+
assert_equal(rm.default_set_ipv6_next_hop,
|
1110
|
+
rm.set_ipv6_next_hop)
|
1111
|
+
assert(rm.set_ipv6_next_hop_load_share)
|
1112
|
+
hash = {}
|
1113
|
+
rm = lset_ip_next_hop_helper(hash)
|
1114
|
+
assert_equal(rm.default_set_ipv6_next_hop,
|
1115
|
+
rm.set_ipv6_next_hop)
|
1116
|
+
assert_equal(rm.default_set_ipv6_next_hop_load_share,
|
1117
|
+
rm.set_ipv6_next_hop_load_share)
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
def test_set_community_no_asn
|
1121
|
+
# bug on n5/6k
|
1122
|
+
skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
|
1123
|
+
skip_incompat_version?('route_map', 'set_community')
|
1124
|
+
rm = create_route_map
|
1125
|
+
assert_equal(rm.default_set_community_additive,
|
1126
|
+
rm.set_community_additive)
|
1127
|
+
assert_equal(rm.default_set_community_asn,
|
1128
|
+
rm.set_community_asn)
|
1129
|
+
assert_equal(rm.default_set_community_internet,
|
1130
|
+
rm.set_community_internet)
|
1131
|
+
assert_equal(rm.default_set_community_local_as,
|
1132
|
+
rm.set_community_local_as)
|
1133
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1134
|
+
rm.set_community_no_advtertise)
|
1135
|
+
assert_equal(rm.default_set_community_no_export,
|
1136
|
+
rm.set_community_no_export)
|
1137
|
+
assert_equal(rm.default_set_community_none,
|
1138
|
+
rm.set_community_none)
|
1139
|
+
asn = rm.default_set_community_asn
|
1140
|
+
none = true
|
1141
|
+
noadv = false
|
1142
|
+
noexp = false
|
1143
|
+
add = false
|
1144
|
+
local = false
|
1145
|
+
inter = false
|
1146
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1147
|
+
assert_equal(rm.default_set_community_additive,
|
1148
|
+
rm.set_community_additive)
|
1149
|
+
assert_equal(rm.default_set_community_asn,
|
1150
|
+
rm.set_community_asn)
|
1151
|
+
assert_equal(rm.default_set_community_internet,
|
1152
|
+
rm.set_community_internet)
|
1153
|
+
assert_equal(rm.default_set_community_local_as,
|
1154
|
+
rm.set_community_local_as)
|
1155
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1156
|
+
rm.set_community_no_advtertise)
|
1157
|
+
assert_equal(rm.default_set_community_no_export,
|
1158
|
+
rm.set_community_no_export)
|
1159
|
+
assert_equal(none, rm.set_community_none)
|
1160
|
+
none = false
|
1161
|
+
add = true
|
1162
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1163
|
+
assert(rm.set_community_additive)
|
1164
|
+
assert_equal(rm.default_set_community_asn,
|
1165
|
+
rm.set_community_asn)
|
1166
|
+
assert_equal(rm.default_set_community_internet,
|
1167
|
+
rm.set_community_internet)
|
1168
|
+
assert_equal(rm.default_set_community_local_as,
|
1169
|
+
rm.set_community_local_as)
|
1170
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1171
|
+
rm.set_community_no_advtertise)
|
1172
|
+
assert_equal(rm.default_set_community_no_export,
|
1173
|
+
rm.set_community_no_export)
|
1174
|
+
assert_equal(rm.default_set_community_none,
|
1175
|
+
rm.set_community_none)
|
1176
|
+
noadv = true
|
1177
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1178
|
+
assert(rm.set_community_additive)
|
1179
|
+
assert_equal(rm.default_set_community_asn,
|
1180
|
+
rm.set_community_asn)
|
1181
|
+
assert_equal(rm.default_set_community_internet,
|
1182
|
+
rm.set_community_internet)
|
1183
|
+
assert_equal(rm.default_set_community_local_as,
|
1184
|
+
rm.set_community_local_as)
|
1185
|
+
assert(rm.set_community_no_advtertise)
|
1186
|
+
assert_equal(rm.default_set_community_no_export,
|
1187
|
+
rm.set_community_no_export)
|
1188
|
+
assert_equal(rm.default_set_community_none,
|
1189
|
+
rm.set_community_none)
|
1190
|
+
noadv = true
|
1191
|
+
noexp = true
|
1192
|
+
add = true
|
1193
|
+
local = true
|
1194
|
+
inter = true
|
1195
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1196
|
+
assert(rm.set_community_additive)
|
1197
|
+
assert_equal(rm.default_set_community_asn,
|
1198
|
+
rm.set_community_asn)
|
1199
|
+
assert(rm.set_community_internet)
|
1200
|
+
assert(rm.set_community_local_as)
|
1201
|
+
assert(rm.set_community_no_advtertise)
|
1202
|
+
assert(rm.set_community_no_export)
|
1203
|
+
assert_equal(rm.default_set_community_none,
|
1204
|
+
rm.set_community_none)
|
1205
|
+
rm.set_community_set(false, false, false, false, false, false, asn)
|
1206
|
+
assert_equal(rm.default_set_community_additive,
|
1207
|
+
rm.set_community_additive)
|
1208
|
+
assert_equal(rm.default_set_community_asn, rm.set_community_asn)
|
1209
|
+
assert_equal(rm.default_set_community_internet,
|
1210
|
+
rm.set_community_internet)
|
1211
|
+
assert_equal(rm.default_set_community_local_as,
|
1212
|
+
rm.set_community_local_as)
|
1213
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1214
|
+
rm.set_community_no_advtertise)
|
1215
|
+
assert_equal(rm.default_set_community_no_export,
|
1216
|
+
rm.set_community_no_export)
|
1217
|
+
assert_equal(rm.default_set_community_none,
|
1218
|
+
rm.set_community_none)
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
def test_set_community_asn
|
1222
|
+
skip_incompat_version?('route_map', 'set_community')
|
1223
|
+
rm = create_route_map
|
1224
|
+
none = false
|
1225
|
+
noadv = true
|
1226
|
+
noexp = true
|
1227
|
+
add = true
|
1228
|
+
local = true
|
1229
|
+
inter = true
|
1230
|
+
asn = ['11:22', '33:44', '123:11']
|
1231
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1232
|
+
assert(rm.set_community_additive)
|
1233
|
+
assert_equal(asn, rm.set_community_asn)
|
1234
|
+
assert(rm.set_community_internet)
|
1235
|
+
assert(rm.set_community_local_as)
|
1236
|
+
assert(rm.set_community_no_advtertise)
|
1237
|
+
assert(rm.set_community_no_export)
|
1238
|
+
assert_equal(rm.default_set_community_none,
|
1239
|
+
rm.set_community_none)
|
1240
|
+
none = false
|
1241
|
+
noadv = false
|
1242
|
+
noexp = false
|
1243
|
+
add = false
|
1244
|
+
local = false
|
1245
|
+
inter = false
|
1246
|
+
rm.set_community_set(none, noadv, noexp, add, local, inter, asn)
|
1247
|
+
assert_equal(rm.default_set_community_additive,
|
1248
|
+
rm.set_community_additive)
|
1249
|
+
assert_equal(asn, rm.set_community_asn)
|
1250
|
+
assert_equal(rm.default_set_community_internet,
|
1251
|
+
rm.set_community_internet)
|
1252
|
+
assert_equal(rm.default_set_community_local_as,
|
1253
|
+
rm.set_community_local_as)
|
1254
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1255
|
+
rm.set_community_no_advtertise)
|
1256
|
+
assert_equal(rm.default_set_community_no_export,
|
1257
|
+
rm.set_community_no_export)
|
1258
|
+
assert_equal(rm.default_set_community_none,
|
1259
|
+
rm.set_community_none)
|
1260
|
+
asn = rm.default_set_community_asn
|
1261
|
+
rm.set_community_set(false, false, false, false, false, false, asn)
|
1262
|
+
assert_equal(rm.default_set_community_additive,
|
1263
|
+
rm.set_community_additive)
|
1264
|
+
assert_equal(rm.default_set_community_asn, rm.set_community_asn)
|
1265
|
+
assert_equal(rm.default_set_community_internet,
|
1266
|
+
rm.set_community_internet)
|
1267
|
+
assert_equal(rm.default_set_community_local_as,
|
1268
|
+
rm.set_community_local_as)
|
1269
|
+
assert_equal(rm.default_set_community_no_advtertise,
|
1270
|
+
rm.set_community_no_advtertise)
|
1271
|
+
assert_equal(rm.default_set_community_no_export,
|
1272
|
+
rm.set_community_no_export)
|
1273
|
+
assert_equal(rm.default_set_community_none,
|
1274
|
+
rm.set_community_none)
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
def test_extcommunity_4bytes
|
1278
|
+
skip_incompat_version?('route_map', 'set_extcommunity_4bytes')
|
1279
|
+
rm = create_route_map
|
1280
|
+
assert_equal(rm.default_set_extcommunity_4bytes_transitive,
|
1281
|
+
rm.set_extcommunity_4bytes_transitive)
|
1282
|
+
assert_equal(rm.default_set_extcommunity_4bytes_non_transitive,
|
1283
|
+
rm.set_extcommunity_4bytes_non_transitive)
|
1284
|
+
assert_equal(rm.default_set_extcommunity_4bytes_none,
|
1285
|
+
rm.set_extcommunity_4bytes_none)
|
1286
|
+
assert_equal(rm.default_set_extcommunity_4bytes_additive,
|
1287
|
+
rm.set_extcommunity_4bytes_additive)
|
1288
|
+
none = true
|
1289
|
+
tr = ntr = []
|
1290
|
+
add = false
|
1291
|
+
rm.set_extcommunity_4bytes_set(none, tr, ntr, add)
|
1292
|
+
assert(rm.set_extcommunity_4bytes_none)
|
1293
|
+
assert_equal(rm.default_set_extcommunity_4bytes_transitive,
|
1294
|
+
rm.set_extcommunity_4bytes_transitive)
|
1295
|
+
assert_equal(rm.default_set_extcommunity_4bytes_non_transitive,
|
1296
|
+
rm.set_extcommunity_4bytes_non_transitive)
|
1297
|
+
assert_equal(rm.default_set_extcommunity_4bytes_additive,
|
1298
|
+
rm.set_extcommunity_4bytes_additive)
|
1299
|
+
none = false
|
1300
|
+
add = true
|
1301
|
+
rm.set_extcommunity_4bytes_set(none, tr, ntr, add)
|
1302
|
+
assert(rm.set_extcommunity_4bytes_additive)
|
1303
|
+
assert_equal(rm.default_set_extcommunity_4bytes_transitive,
|
1304
|
+
rm.set_extcommunity_4bytes_transitive)
|
1305
|
+
assert_equal(rm.default_set_extcommunity_4bytes_non_transitive,
|
1306
|
+
rm.set_extcommunity_4bytes_non_transitive)
|
1307
|
+
assert_equal(rm.default_set_extcommunity_4bytes_none,
|
1308
|
+
rm.set_extcommunity_4bytes_none)
|
1309
|
+
tr = ['11:22', '33:44', '66:77']
|
1310
|
+
rm.set_extcommunity_4bytes_set(none, tr, ntr, add)
|
1311
|
+
assert(rm.set_extcommunity_4bytes_additive)
|
1312
|
+
assert_equal(tr, rm.set_extcommunity_4bytes_transitive)
|
1313
|
+
assert_equal(rm.default_set_extcommunity_4bytes_non_transitive,
|
1314
|
+
rm.set_extcommunity_4bytes_non_transitive)
|
1315
|
+
assert_equal(rm.default_set_extcommunity_4bytes_none,
|
1316
|
+
rm.set_extcommunity_4bytes_none)
|
1317
|
+
ntr = ['21:42', '43:22', '59:17']
|
1318
|
+
rm.set_extcommunity_4bytes_set(none, tr, ntr, add)
|
1319
|
+
assert(rm.set_extcommunity_4bytes_additive)
|
1320
|
+
assert_equal(tr, rm.set_extcommunity_4bytes_transitive)
|
1321
|
+
assert_equal(ntr, rm.set_extcommunity_4bytes_non_transitive)
|
1322
|
+
assert_equal(rm.default_set_extcommunity_4bytes_none,
|
1323
|
+
rm.set_extcommunity_4bytes_none)
|
1324
|
+
add = false
|
1325
|
+
tr = ntr = []
|
1326
|
+
rm.set_extcommunity_4bytes_set(none, tr, ntr, add)
|
1327
|
+
assert_equal(rm.default_set_extcommunity_4bytes_transitive,
|
1328
|
+
rm.set_extcommunity_4bytes_transitive)
|
1329
|
+
assert_equal(rm.default_set_extcommunity_4bytes_non_transitive,
|
1330
|
+
rm.set_extcommunity_4bytes_non_transitive)
|
1331
|
+
assert_equal(rm.default_set_extcommunity_4bytes_none,
|
1332
|
+
rm.set_extcommunity_4bytes_none)
|
1333
|
+
assert_equal(rm.default_set_extcommunity_4bytes_additive,
|
1334
|
+
rm.set_extcommunity_4bytes_additive)
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
def test_extcommunity_rt
|
1338
|
+
# bug CSCvc92395 on fretta and n9k
|
1339
|
+
skip('platform not supported for this test') if
|
1340
|
+
product_tag[/n9k/] || product_tag[/n3k-f/]
|
1341
|
+
rm = create_route_map
|
1342
|
+
assert_equal(rm.default_set_extcommunity_rt_additive,
|
1343
|
+
rm.set_extcommunity_rt_additive)
|
1344
|
+
assert_equal(rm.default_set_extcommunity_rt_asn,
|
1345
|
+
rm.set_extcommunity_rt_asn)
|
1346
|
+
asn = []
|
1347
|
+
add = true
|
1348
|
+
rm.set_extcommunity_rt_set(asn, add)
|
1349
|
+
assert(rm.set_extcommunity_rt_additive)
|
1350
|
+
assert_equal(rm.default_set_extcommunity_rt_asn,
|
1351
|
+
rm.set_extcommunity_rt_asn)
|
1352
|
+
asn = ['11:22', '33:44', '12.22.22.22:12', '123.256:543']
|
1353
|
+
rm.set_extcommunity_rt_set(asn, add)
|
1354
|
+
assert(rm.set_extcommunity_rt_additive)
|
1355
|
+
assert_equal(asn, rm.set_extcommunity_rt_asn)
|
1356
|
+
add = false
|
1357
|
+
rm.set_extcommunity_rt_set(asn, add)
|
1358
|
+
assert_equal(rm.default_set_extcommunity_rt_additive,
|
1359
|
+
rm.set_extcommunity_rt_additive)
|
1360
|
+
assert_equal(asn, rm.set_extcommunity_rt_asn)
|
1361
|
+
asn = []
|
1362
|
+
rm.set_extcommunity_rt_set(asn, add)
|
1363
|
+
assert_equal(rm.default_set_extcommunity_rt_additive,
|
1364
|
+
rm.set_extcommunity_rt_additive)
|
1365
|
+
assert_equal(rm.default_set_extcommunity_rt_asn,
|
1366
|
+
rm.set_extcommunity_rt_asn)
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
def test_extcommunity_cost
|
1370
|
+
rm = create_route_map
|
1371
|
+
assert_equal(rm.default_set_extcommunity_cost_igp,
|
1372
|
+
rm.set_extcommunity_cost_igp)
|
1373
|
+
assert_equal(rm.default_set_extcommunity_cost_pre_bestpath,
|
1374
|
+
rm.set_extcommunity_cost_pre_bestpath)
|
1375
|
+
igp = [%w(0 23), %w(3 33), %w(100 10954)]
|
1376
|
+
pre = []
|
1377
|
+
rm.set_extcommunity_cost_set(igp, pre)
|
1378
|
+
assert_equal(igp, rm.set_extcommunity_cost_igp)
|
1379
|
+
assert_equal(rm.default_set_extcommunity_cost_pre_bestpath,
|
1380
|
+
rm.set_extcommunity_cost_pre_bestpath)
|
1381
|
+
pre = [%w(23 999), %w(88 482), %w(120 2323)]
|
1382
|
+
rm.set_extcommunity_cost_set(igp, pre)
|
1383
|
+
assert_equal(igp, rm.set_extcommunity_cost_igp)
|
1384
|
+
assert_equal(pre, rm.set_extcommunity_cost_pre_bestpath)
|
1385
|
+
igp = []
|
1386
|
+
rm.set_extcommunity_cost_set(igp, pre)
|
1387
|
+
assert_equal(rm.default_set_extcommunity_cost_igp,
|
1388
|
+
rm.set_extcommunity_cost_igp)
|
1389
|
+
assert_equal(pre, rm.set_extcommunity_cost_pre_bestpath)
|
1390
|
+
pre = []
|
1391
|
+
rm.set_extcommunity_cost_set(igp, pre)
|
1392
|
+
assert_equal(rm.default_set_extcommunity_cost_igp,
|
1393
|
+
rm.set_extcommunity_cost_igp)
|
1394
|
+
assert_equal(rm.default_set_extcommunity_cost_pre_bestpath,
|
1395
|
+
rm.set_extcommunity_cost_pre_bestpath)
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
def test_set_ip_next_hop_defaults
|
1399
|
+
rm = create_route_map
|
1400
|
+
assert_equal(rm.default_set_interface, rm.set_interface)
|
1401
|
+
assert_equal(rm.default_set_ipv4_default_next_hop,
|
1402
|
+
rm.set_ipv4_default_next_hop) unless
|
1403
|
+
rm.default_set_ipv4_default_next_hop.nil?
|
1404
|
+
assert_equal(rm.default_set_ipv4_default_next_hop_load_share,
|
1405
|
+
rm.set_ipv4_default_next_hop_load_share) unless
|
1406
|
+
rm.default_set_ipv4_default_next_hop_load_share.nil?
|
1407
|
+
assert_equal(rm.default_set_ipv4_next_hop,
|
1408
|
+
rm.set_ipv4_next_hop) unless
|
1409
|
+
rm.default_set_ipv4_next_hop.nil?
|
1410
|
+
assert_equal(rm.default_set_ipv4_next_hop_load_share,
|
1411
|
+
rm.set_ipv4_next_hop_load_share) unless
|
1412
|
+
rm.default_set_ipv4_next_hop_load_share.nil?
|
1413
|
+
assert_equal(rm.default_set_ipv4_next_hop_peer_addr,
|
1414
|
+
rm.set_ipv4_next_hop_peer_addr)
|
1415
|
+
assert_equal(rm.default_set_ipv4_next_hop_redist,
|
1416
|
+
rm.set_ipv4_next_hop_redist)
|
1417
|
+
assert_equal(rm.default_set_ipv4_next_hop_unchanged,
|
1418
|
+
rm.set_ipv4_next_hop_unchanged)
|
1419
|
+
assert_equal(rm.default_set_ipv6_default_next_hop,
|
1420
|
+
rm.set_ipv6_default_next_hop) unless
|
1421
|
+
rm.default_set_ipv6_default_next_hop.nil?
|
1422
|
+
assert_equal(rm.default_set_ipv6_default_next_hop_load_share,
|
1423
|
+
rm.set_ipv6_default_next_hop_load_share) unless
|
1424
|
+
rm.default_set_ipv6_default_next_hop_load_share.nil?
|
1425
|
+
assert_equal(rm.default_set_ipv6_next_hop,
|
1426
|
+
rm.set_ipv6_next_hop) unless
|
1427
|
+
rm.default_set_ipv6_next_hop.nil?
|
1428
|
+
assert_equal(rm.default_set_ipv6_next_hop_load_share,
|
1429
|
+
rm.set_ipv6_next_hop_load_share) unless
|
1430
|
+
rm.default_set_ipv6_next_hop_load_share.nil?
|
1431
|
+
assert_equal(rm.default_set_ipv6_next_hop_peer_addr,
|
1432
|
+
rm.set_ipv6_next_hop_peer_addr)
|
1433
|
+
assert_equal(rm.default_set_ipv6_next_hop_redist,
|
1434
|
+
rm.set_ipv6_next_hop_redist)
|
1435
|
+
assert_equal(rm.default_set_ipv6_next_hop_unchanged,
|
1436
|
+
rm.set_ipv6_next_hop_unchanged)
|
1437
|
+
end
|
1438
|
+
|
1439
|
+
def lset_ip_next_hop_helper(props)
|
1440
|
+
rm = create_route_map
|
1441
|
+
if evergreen_or_later?
|
1442
|
+
attrs = {
|
1443
|
+
intf: rm.default_set_interface,
|
1444
|
+
v4nh: rm.default_set_ipv4_next_hop,
|
1445
|
+
v4ls: rm.default_set_ipv4_next_hop_load_share,
|
1446
|
+
v4dnh: rm.default_set_ipv4_default_next_hop,
|
1447
|
+
v4dls: rm.default_set_ipv4_default_next_hop_load_share,
|
1448
|
+
v4peer: rm.default_set_ipv4_next_hop_peer_addr,
|
1449
|
+
v4red: rm.default_set_ipv4_next_hop_redist,
|
1450
|
+
v4unc: rm.default_set_ipv4_next_hop_unchanged,
|
1451
|
+
v6nh: rm.default_set_ipv6_next_hop,
|
1452
|
+
v6ls: rm.default_set_ipv6_next_hop_load_share,
|
1453
|
+
v6dnh: rm.default_set_ipv6_default_next_hop,
|
1454
|
+
v6dls: rm.default_set_ipv6_default_next_hop_load_share,
|
1455
|
+
v6peer: rm.default_set_ipv6_next_hop_peer_addr,
|
1456
|
+
v6red: rm.default_set_ipv6_next_hop_redist,
|
1457
|
+
v6unc: rm.default_set_ipv6_next_hop_unchanged,
|
1458
|
+
}.merge!(props)
|
1459
|
+
else
|
1460
|
+
attrs = {
|
1461
|
+
intf: rm.default_set_interface,
|
1462
|
+
v4nh: rm.default_set_ipv4_next_hop,
|
1463
|
+
v4ls: rm.default_set_ipv4_next_hop_load_share,
|
1464
|
+
v4dnh: rm.default_set_ipv4_default_next_hop,
|
1465
|
+
v4dls: rm.default_set_ipv4_default_next_hop_load_share,
|
1466
|
+
v4peer: rm.default_set_ipv4_next_hop_peer_addr,
|
1467
|
+
v4unc: rm.default_set_ipv4_next_hop_unchanged,
|
1468
|
+
v6nh: rm.default_set_ipv6_next_hop,
|
1469
|
+
v6ls: rm.default_set_ipv6_next_hop_load_share,
|
1470
|
+
v6dnh: rm.default_set_ipv6_default_next_hop,
|
1471
|
+
v6dls: rm.default_set_ipv6_default_next_hop_load_share,
|
1472
|
+
v6peer: rm.default_set_ipv6_next_hop_peer_addr,
|
1473
|
+
v6unc: rm.default_set_ipv6_next_hop_unchanged,
|
1474
|
+
}.merge!(props)
|
1475
|
+
end
|
1476
|
+
rm.set_ip_next_hop_set(attrs)
|
1477
|
+
rm
|
1478
|
+
end
|
1479
|
+
end
|