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,1325 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# RouterBgp Unit Tests
|
3
|
+
#
|
4
|
+
# Mike Wiebe, June, 2015
|
5
|
+
#
|
6
|
+
# Copyright (c) 2015-2017 Cisco and/or its affiliates.
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
|
20
|
+
require_relative 'ciscotest'
|
21
|
+
require_relative '../lib/cisco_node_utils/bgp'
|
22
|
+
|
23
|
+
# Temporary debug helper. Not for production and not to replace Cisco debugging.
|
24
|
+
def debug_bgp
|
25
|
+
s = @device.cmd('show running-config router bgp')
|
26
|
+
caller_locations(1, 1).first.tap do |loc|
|
27
|
+
puts "\nDEBUG BGP: #{__FILE__}:#{loc.path}:#{loc.lineno}:\n#{s}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_bgp_vrf(asnum, vrf)
|
32
|
+
if platform == :nexus
|
33
|
+
bgp = RouterBgp.new(asnum, vrf)
|
34
|
+
else
|
35
|
+
# IOS XR requires 'rd <id>' for any created VRF.
|
36
|
+
# But 'rd' requires a global router id. From a puppet p.o.v
|
37
|
+
# this is fine; the user is required to add a router-id to
|
38
|
+
# their manifest. For the minitest fudge this by calling
|
39
|
+
# RouterBgp.new twice. Once to create the BGP process,
|
40
|
+
# add a router-id, then call it again to create the VRF,
|
41
|
+
# and add a VRF level router-id (which is needed to make SYSDB
|
42
|
+
# behave).
|
43
|
+
bgp = RouterBgp.new(asnum)
|
44
|
+
bgp.router_id = '1.2.3.4'
|
45
|
+
bgp = RouterBgp.new(asnum, vrf)
|
46
|
+
bgp.router_id = '4.5.6.7'
|
47
|
+
end
|
48
|
+
bgp
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup_default
|
52
|
+
@asnum = 55
|
53
|
+
@vrf = 'default'
|
54
|
+
RouterBgp.new(@asnum)
|
55
|
+
end
|
56
|
+
|
57
|
+
def setup_vrf
|
58
|
+
# nexus does not support multiple BGP instances; VRF AS must be same as default AS
|
59
|
+
@asnum = platform == :nexus ? 55 : 99
|
60
|
+
@vrf = 'yamllll'
|
61
|
+
create_bgp_vrf(@asnum, @vrf)
|
62
|
+
end
|
63
|
+
|
64
|
+
# TestRouterBgp - Minitest for RouterBgp class
|
65
|
+
class TestRouterBgp < CiscoTestCase
|
66
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
67
|
+
|
68
|
+
def setup
|
69
|
+
super
|
70
|
+
remove_all_bgps if @@pre_clean_needed
|
71
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
72
|
+
end
|
73
|
+
|
74
|
+
def teardown
|
75
|
+
remove_all_bgps
|
76
|
+
super
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_routerbgp_match_line(as_number, vrf='default')
|
80
|
+
if platform == :ios_xr
|
81
|
+
s = @device.cmd('show running-config router bgp')
|
82
|
+
else
|
83
|
+
s = @device.cmd("show run | section '^router bgp .*'")
|
84
|
+
end
|
85
|
+
if vrf == 'default'
|
86
|
+
line = /router bgp\s#{as_number}/.match(s)
|
87
|
+
else
|
88
|
+
line = /vrf #{vrf}/.match(s)
|
89
|
+
end
|
90
|
+
line
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_collection_empty
|
94
|
+
if platform == :ios_xr
|
95
|
+
config('no router bgp')
|
96
|
+
else
|
97
|
+
config('no feature bgp')
|
98
|
+
end
|
99
|
+
node.cache_flush
|
100
|
+
routers = RouterBgp.routers
|
101
|
+
assert_empty(routers, 'RouterBgp collection is not empty')
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_collection_not_empty
|
105
|
+
if platform == :nexus
|
106
|
+
config('feature bgp',
|
107
|
+
'router bgp 55',
|
108
|
+
'vrf blue',
|
109
|
+
'vrf red',
|
110
|
+
'vrf white')
|
111
|
+
else
|
112
|
+
config('router bgp 55',
|
113
|
+
'bgp router-id 1.2.3.4',
|
114
|
+
'vrf blue',
|
115
|
+
'bgp router-id 4.5.6.7',
|
116
|
+
'rd auto',
|
117
|
+
'vrf red',
|
118
|
+
'bgp router-id 4.5.6.7',
|
119
|
+
'rd auto',
|
120
|
+
'vrf white',
|
121
|
+
'bgp router-id 4.5.6.7',
|
122
|
+
'rd auto')
|
123
|
+
end
|
124
|
+
routers = RouterBgp.routers
|
125
|
+
refute_empty(routers, 'RouterBgp collection is empty')
|
126
|
+
# validate the collection
|
127
|
+
routers.each do |asnum, vrfs|
|
128
|
+
line = get_routerbgp_match_line(asnum)
|
129
|
+
refute_nil(line)
|
130
|
+
vrfs.each_key do |name|
|
131
|
+
unless name == 'default'
|
132
|
+
line = get_routerbgp_match_line(asnum, name)
|
133
|
+
refute_nil(line)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_asnum_invalid
|
140
|
+
['', 'Fifty_Five'].each do |test|
|
141
|
+
assert_raises(ArgumentError, "#{test} not a valid asn") do
|
142
|
+
RouterBgp.new(test)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_vrf_invalid
|
148
|
+
['', 55].each do |test|
|
149
|
+
assert_raises(ArgumentError, "#{test} not a valid vrf name") do
|
150
|
+
RouterBgp.new(88, test)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_create_vrfname_zero_length
|
156
|
+
asnum = 55
|
157
|
+
assert_raises(ArgumentError) do
|
158
|
+
RouterBgp.new(asnum, '')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_create_valid
|
163
|
+
bgp = setup_default
|
164
|
+
line = get_routerbgp_match_line(@asnum)
|
165
|
+
refute_nil(line, "Error: 'router bgp #{@asnum}' not configured")
|
166
|
+
bgp.destroy
|
167
|
+
|
168
|
+
vrf = 'wolfpack'
|
169
|
+
bgp = create_bgp_vrf(55, vrf)
|
170
|
+
line = get_routerbgp_match_line(@asnum, vrf)
|
171
|
+
refute_nil(line,
|
172
|
+
"Error: 'router bgp #{@asnum}' vrf '#{vrf}' not configured")
|
173
|
+
bgp.destroy
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_process_initialized
|
177
|
+
return if validate_property_excluded?('bgp', 'process_initialized')
|
178
|
+
|
179
|
+
# Cleanup may be slow on some platforms; make sure it's really dead
|
180
|
+
bgp = RouterBgp.new('55', 'default', false)
|
181
|
+
if bgp.process_initialized?
|
182
|
+
sleep 4
|
183
|
+
node.cache_flush
|
184
|
+
end
|
185
|
+
refute(bgp.process_initialized?, 'bgp should not be initialized')
|
186
|
+
|
187
|
+
bgp = RouterBgp.new('55', 'default')
|
188
|
+
bgp.wait_for_process_initialized unless bgp.process_initialized?
|
189
|
+
assert(bgp.process_initialized?, 'bgp should be initialized')
|
190
|
+
end
|
191
|
+
|
192
|
+
def wait_for_process_kill(bgp)
|
193
|
+
return unless node.product_id[/N(5|6)/]
|
194
|
+
# Hack for slow-start platforms which can also be slow-to-die.
|
195
|
+
# Tests that involve many quick process-start / process-stop cycles
|
196
|
+
# are prone to failure without this delay.
|
197
|
+
4.times do
|
198
|
+
return unless bgp.process_initialized?
|
199
|
+
sleep 1
|
200
|
+
node.cache_flush
|
201
|
+
end
|
202
|
+
fail "#{bgp} :: process is still running"
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_valid_asn
|
206
|
+
[1, 4_294_967_295, '55', '1.0', '1.65535', '65535.0', '65535.65535'
|
207
|
+
].each do |asn|
|
208
|
+
b = RouterBgp.new(asn)
|
209
|
+
assert_equal(asn.to_s, RouterBgp.routers.keys[0].to_s)
|
210
|
+
b.destroy
|
211
|
+
wait_for_process_kill(b)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_destroy
|
216
|
+
bgp = setup_default
|
217
|
+
line = get_routerbgp_match_line(@asnum)
|
218
|
+
refute_nil(line, "Error: 'router bgp #{@asnum}' not configured")
|
219
|
+
bgp.destroy
|
220
|
+
|
221
|
+
if platform == :ios_xr
|
222
|
+
command = 'show run router bgp'
|
223
|
+
pattern = /"router bgp"/
|
224
|
+
else
|
225
|
+
command = 'show run all | no-more'
|
226
|
+
pattern = /"feature bgp"/
|
227
|
+
end
|
228
|
+
|
229
|
+
refute_show_match(
|
230
|
+
command: command, pattern: pattern,
|
231
|
+
msg: "Error: 'router bgp' still configured")
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_create_invalid_multiple
|
235
|
+
asnum = 55
|
236
|
+
bgp1 = RouterBgp.new(asnum)
|
237
|
+
line = get_routerbgp_match_line(asnum)
|
238
|
+
refute_nil(line, "Error: 'router bgp #{asnum}' not configured")
|
239
|
+
|
240
|
+
# Only one bgp instance supported so try to create another.
|
241
|
+
assert_raises(CliError) do
|
242
|
+
bgp2 = RouterBgp.new(88)
|
243
|
+
bgp2.destroy unless bgp2.nil?
|
244
|
+
end
|
245
|
+
bgp1.destroy
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_asnum_dot
|
249
|
+
asnum = 65_540
|
250
|
+
bgp = RouterBgp.new(asnum)
|
251
|
+
assert_equal(asnum.to_s, bgp.asnum, 'Error: router asnum incorrect')
|
252
|
+
|
253
|
+
# Create a new object with the same ASN value but using AS_DOT notation
|
254
|
+
assert_raises(CliError) do
|
255
|
+
RouterBgp.new('1.4')
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_nsr
|
260
|
+
skip_if_UnsupportedCmdRef('bgp', 'nsr')
|
261
|
+
nsr(setup_default)
|
262
|
+
nsr(setup_vrf)
|
263
|
+
end
|
264
|
+
|
265
|
+
def nsr(bgp)
|
266
|
+
if platform == :ios_xr && !@vrf[/default/]
|
267
|
+
assert_nil(bgp.default_nsr,
|
268
|
+
'default bgp nsr should return nil on XR with non-default' \
|
269
|
+
' vrf')
|
270
|
+
assert_nil(bgp.nsr,
|
271
|
+
'bgp nsr should return nil on XR with non-default vrf')
|
272
|
+
assert_raises(Cisco::UnsupportedError) do
|
273
|
+
bgp.nsr = true
|
274
|
+
end
|
275
|
+
else
|
276
|
+
assert_equal(bgp.nsr, bgp.default_nsr)
|
277
|
+
bgp.nsr = true
|
278
|
+
assert(bgp.nsr,
|
279
|
+
'bgp nsr should be enabled')
|
280
|
+
bgp.nsr = false
|
281
|
+
refute(bgp.nsr,
|
282
|
+
'bgp nsr should be disabled')
|
283
|
+
end
|
284
|
+
bgp.destroy
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_bestpath_default
|
288
|
+
bestpath(setup_default)
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_bestpath_vrf
|
292
|
+
bestpath(setup_vrf)
|
293
|
+
end
|
294
|
+
|
295
|
+
def bestpath(bgp)
|
296
|
+
bgp.bestpath_always_compare_med = true
|
297
|
+
assert(bgp.bestpath_always_compare_med,
|
298
|
+
'bgp bestpath_always_compare_med should be enabled')
|
299
|
+
bgp.bestpath_aspath_multipath_relax = true
|
300
|
+
assert(bgp.bestpath_aspath_multipath_relax,
|
301
|
+
'bgp bestpath_aspath_multipath_relax should be enabled')
|
302
|
+
bgp.bestpath_compare_routerid = true
|
303
|
+
assert(bgp.bestpath_compare_routerid,
|
304
|
+
'bgp bestpath_compare_routerid should be enabled')
|
305
|
+
bgp.bestpath_cost_community_ignore = true
|
306
|
+
assert(bgp.bestpath_cost_community_ignore,
|
307
|
+
'bgp bestpath_cost_community_ignore should be enabled')
|
308
|
+
if platform == :ios_xr && !@vrf[/default/]
|
309
|
+
assert_raises(Cisco::UnsupportedError) do
|
310
|
+
bgp.bestpath_med_confed = true
|
311
|
+
end
|
312
|
+
else
|
313
|
+
bgp.bestpath_med_confed = true
|
314
|
+
assert(bgp.bestpath_med_confed,
|
315
|
+
'bgp bestpath_med_confed should be enabled')
|
316
|
+
end
|
317
|
+
bgp.bestpath_med_missing_as_worst = true
|
318
|
+
assert(bgp.bestpath_med_missing_as_worst,
|
319
|
+
'bgp bestpath_med_missing_as_worst should be enabled')
|
320
|
+
if platform == :nexus
|
321
|
+
bgp.bestpath_med_non_deterministic = true
|
322
|
+
assert(bgp.bestpath_med_non_deterministic,
|
323
|
+
'bgp bestpath_med_non_deterministic should be enabled')
|
324
|
+
else
|
325
|
+
assert_raises(Cisco::UnsupportedError) do
|
326
|
+
bgp.bestpath_med_non_deterministic = true
|
327
|
+
end
|
328
|
+
end
|
329
|
+
bgp.bestpath_always_compare_med = false
|
330
|
+
refute(bgp.bestpath_always_compare_med,
|
331
|
+
'bgp bestpath_always_compare_med should be disabled')
|
332
|
+
bgp.bestpath_aspath_multipath_relax = false
|
333
|
+
refute(bgp.bestpath_aspath_multipath_relax,
|
334
|
+
'bgp bestpath_aspath_multipath_relax should be disabled')
|
335
|
+
bgp.bestpath_compare_routerid = false
|
336
|
+
refute(bgp.bestpath_compare_routerid,
|
337
|
+
'bgp bestpath_compare_routerid should be disabled')
|
338
|
+
bgp.bestpath_cost_community_ignore = false
|
339
|
+
refute(bgp.bestpath_cost_community_ignore,
|
340
|
+
'bgp bestpath_cost_community_ignore should be disabled')
|
341
|
+
unless platform == :ios_xr && !@vrf[/default/]
|
342
|
+
bgp.bestpath_med_confed = false
|
343
|
+
refute(bgp.bestpath_med_confed,
|
344
|
+
'bgp bestpath_med_confed should be disabled')
|
345
|
+
end
|
346
|
+
bgp.bestpath_med_missing_as_worst = false
|
347
|
+
refute(bgp.bestpath_med_missing_as_worst,
|
348
|
+
'bgp bestpath_med_missing_as_worst should be disabled')
|
349
|
+
if platform == :nexus
|
350
|
+
bgp.bestpath_med_non_deterministic = false
|
351
|
+
refute(bgp.bestpath_med_non_deterministic,
|
352
|
+
'bgp bestpath_med_non_deterministic should be disabled')
|
353
|
+
else
|
354
|
+
assert_raises(Cisco::UnsupportedError) do
|
355
|
+
bgp.bestpath_med_non_deterministic = false
|
356
|
+
end
|
357
|
+
end
|
358
|
+
bgp.destroy
|
359
|
+
end
|
360
|
+
|
361
|
+
def test_bestpath_not_configured_default
|
362
|
+
bestpath_not_configured(setup_default)
|
363
|
+
end
|
364
|
+
|
365
|
+
def test_bestpath_not_configured_vrf
|
366
|
+
bestpath_not_configured(setup_vrf)
|
367
|
+
end
|
368
|
+
|
369
|
+
def bestpath_not_configured(bgp)
|
370
|
+
refute(bgp.bestpath_always_compare_med,
|
371
|
+
'bgp bestpath_always_compare_med should *NOT* be enabled')
|
372
|
+
refute(bgp.bestpath_aspath_multipath_relax,
|
373
|
+
'bgp bestpath_aspath_multipath_relax should *NOT* be enabled')
|
374
|
+
refute(bgp.bestpath_compare_routerid,
|
375
|
+
'bgp bestpath_compare_routerid should be *NOT* enabled')
|
376
|
+
refute(bgp.bestpath_cost_community_ignore,
|
377
|
+
'bgp bestpath_cost_community_ignore should *NOT* be enabled')
|
378
|
+
refute(bgp.bestpath_med_confed,
|
379
|
+
'bgp bestpath_med_confed should *NOT* be enabled')
|
380
|
+
refute(bgp.bestpath_med_missing_as_worst,
|
381
|
+
'bgp bestpath_med_missing_as_worst should *NOT* be enabled')
|
382
|
+
if platform == :nexus
|
383
|
+
refute(bgp.bestpath_med_non_deterministic,
|
384
|
+
'bgp bestpath_med_non_deterministic should *NOT* be enabled')
|
385
|
+
else
|
386
|
+
assert_nil(bgp.bestpath_med_non_deterministic,
|
387
|
+
'bgp bestpath_med_non_deterministic should *NOT* be supported')
|
388
|
+
end
|
389
|
+
bgp.destroy
|
390
|
+
end
|
391
|
+
|
392
|
+
def test_default_bestpath
|
393
|
+
bgp = setup_default
|
394
|
+
refute(bgp.default_bestpath_always_compare_med,
|
395
|
+
'default value for bestpath_always_compare_med should be false')
|
396
|
+
refute(bgp.default_bestpath_aspath_multipath_relax,
|
397
|
+
'default value for bestpath_aspath_multipath_relax should be false')
|
398
|
+
refute(bgp.default_bestpath_compare_routerid,
|
399
|
+
'default value for bestpath_compare_routerid should be false')
|
400
|
+
refute(bgp.default_bestpath_cost_community_ignore,
|
401
|
+
'default value for bestpath_cost_community_ignore should be false')
|
402
|
+
refute(bgp.default_bestpath_med_confed,
|
403
|
+
'default value for bestpath_med_confed should be false')
|
404
|
+
refute(bgp.default_bestpath_med_missing_as_worst,
|
405
|
+
'default value for bestpath_med_missing_as_worst should be false')
|
406
|
+
if platform == :nexus
|
407
|
+
refute(bgp.default_bestpath_med_non_deterministic,
|
408
|
+
'default value for bestpath_med_non_deterministic should be false')
|
409
|
+
else
|
410
|
+
assert_nil(bgp.default_bestpath_med_non_deterministic,
|
411
|
+
'bgp default_bestpath_med_non_deterministic should ' \
|
412
|
+
'*NOT* be supported')
|
413
|
+
end
|
414
|
+
bgp.destroy
|
415
|
+
end
|
416
|
+
|
417
|
+
def test_cluster_id_default
|
418
|
+
cluster_id(setup_default)
|
419
|
+
end
|
420
|
+
|
421
|
+
def test_cluster_id_vrf
|
422
|
+
cluster_id(setup_vrf)
|
423
|
+
end
|
424
|
+
|
425
|
+
def cluster_id(bgp)
|
426
|
+
if platform == :ios_xr && @vrf != 'default'
|
427
|
+
# XR does not support this under a VRF, so test the getter and setter
|
428
|
+
assert_nil(bgp.cluster_id,
|
429
|
+
'cluster_id should return nil on XR with non-default vrf')
|
430
|
+
assert_raises(Cisco::UnsupportedError) do
|
431
|
+
bgp.cluster_id = 34
|
432
|
+
end
|
433
|
+
bgp.destroy
|
434
|
+
return
|
435
|
+
end
|
436
|
+
bgp.cluster_id = 34
|
437
|
+
assert_equal('34', bgp.cluster_id,
|
438
|
+
"bgp cluster_id should be set to '34'")
|
439
|
+
bgp.cluster_id = '1.2.3.4'
|
440
|
+
assert_equal('1.2.3.4', bgp.cluster_id,
|
441
|
+
"bgp cluster_id should be set to '1.2.3.4'")
|
442
|
+
bgp.cluster_id = ''
|
443
|
+
assert_empty(bgp.cluster_id,
|
444
|
+
'bgp cluster_id should *NOT* be configured')
|
445
|
+
bgp.destroy
|
446
|
+
end
|
447
|
+
|
448
|
+
def test_cluster_id_not_configured
|
449
|
+
bgp = setup_default
|
450
|
+
assert_empty(bgp.cluster_id,
|
451
|
+
'bgp cluster_id should *NOT* be configured')
|
452
|
+
bgp.destroy
|
453
|
+
end
|
454
|
+
|
455
|
+
def test_default_cluster_id
|
456
|
+
bgp = setup_default
|
457
|
+
assert_empty(bgp.default_cluster_id,
|
458
|
+
'bgp cluster_id default value should be empty')
|
459
|
+
bgp.destroy
|
460
|
+
end
|
461
|
+
|
462
|
+
def test_disable_policy_batching
|
463
|
+
bgp = setup_default
|
464
|
+
if platform == :ios_xr
|
465
|
+
assert_nil(bgp.disable_policy_batching)
|
466
|
+
assert_raises(Cisco::UnsupportedError) do
|
467
|
+
bgp.disable_policy_batching = true
|
468
|
+
end
|
469
|
+
else
|
470
|
+
bgp.disable_policy_batching = true
|
471
|
+
assert(bgp.disable_policy_batching,
|
472
|
+
'bgp disable-policy-batching should be enabled')
|
473
|
+
bgp.disable_policy_batching = false
|
474
|
+
refute(bgp.disable_policy_batching,
|
475
|
+
'bgp disable-policy-batching should be disabled')
|
476
|
+
end
|
477
|
+
bgp.destroy
|
478
|
+
end
|
479
|
+
|
480
|
+
def test_default_disable_policy_batching
|
481
|
+
bgp = setup_default
|
482
|
+
if platform == :ios_xr
|
483
|
+
assert_nil(bgp.disable_policy_batching)
|
484
|
+
assert_nil(bgp.default_disable_policy_batching)
|
485
|
+
else
|
486
|
+
refute(bgp.disable_policy_batching,
|
487
|
+
'bgp disable-policy-batching value should be false')
|
488
|
+
end
|
489
|
+
bgp.destroy
|
490
|
+
end
|
491
|
+
|
492
|
+
def test_disable_policy_batching_ipv4
|
493
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
494
|
+
b = RouterBgp.new(1)
|
495
|
+
assert_nil(b.disable_policy_batching_ipv4)
|
496
|
+
assert_nil(b.default_disable_policy_batching_ipv4)
|
497
|
+
assert_raises(Cisco::UnsupportedError) do
|
498
|
+
b.disable_policy_batching_ipv4 = 'xx'
|
499
|
+
end
|
500
|
+
return
|
501
|
+
end
|
502
|
+
skip_incompat_version?('bgp', 'disable_policy_batching_ipv4')
|
503
|
+
bgp = setup_default
|
504
|
+
default = bgp.default_disable_policy_batching_ipv4
|
505
|
+
assert_equal(default, bgp.disable_policy_batching_ipv4,
|
506
|
+
'bgp disable_policy_batching_ipv4 not set to default')
|
507
|
+
|
508
|
+
bgp.disable_policy_batching_ipv4 = 'xx'
|
509
|
+
assert_equal('xx', bgp.disable_policy_batching_ipv4,
|
510
|
+
"bgp disable_policy_batching_ipv4 should be set to 'xx'")
|
511
|
+
bgp.disable_policy_batching_ipv4 = \
|
512
|
+
bgp.default_disable_policy_batching_ipv4
|
513
|
+
assert_empty(bgp.disable_policy_batching_ipv4,
|
514
|
+
'bgp disable_policy_batching_ipv4 should be empty')
|
515
|
+
|
516
|
+
bgp.disable_policy_batching_ipv4 = default
|
517
|
+
assert_equal(default, bgp.disable_policy_batching_ipv4,
|
518
|
+
'bgp disable_policy_batching_ipv4 not set to default')
|
519
|
+
bgp.destroy
|
520
|
+
end
|
521
|
+
|
522
|
+
def test_disable_policy_batching_ipv6
|
523
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
524
|
+
b = RouterBgp.new(1)
|
525
|
+
assert_nil(b.disable_policy_batching_ipv6)
|
526
|
+
assert_nil(b.default_disable_policy_batching_ipv6)
|
527
|
+
assert_raises(Cisco::UnsupportedError) do
|
528
|
+
b.disable_policy_batching_ipv6 = 'xx'
|
529
|
+
end
|
530
|
+
return
|
531
|
+
end
|
532
|
+
skip_incompat_version?('bgp', 'disable_policy_batching_ipv6')
|
533
|
+
bgp = setup_default
|
534
|
+
default = bgp.default_disable_policy_batching_ipv6
|
535
|
+
assert_equal(default, bgp.disable_policy_batching_ipv6,
|
536
|
+
'bgp disable_policy_batching_ipv6 not set to default')
|
537
|
+
|
538
|
+
bgp.disable_policy_batching_ipv6 = 'xx'
|
539
|
+
assert_equal('xx', bgp.disable_policy_batching_ipv6,
|
540
|
+
"bgp disable_policy_batching_ipv6 should be set to 'xx'")
|
541
|
+
bgp.disable_policy_batching_ipv6 = \
|
542
|
+
bgp.default_disable_policy_batching_ipv6
|
543
|
+
assert_empty(bgp.disable_policy_batching_ipv6,
|
544
|
+
'bgp disable_policy_batching_ipv6 should be empty')
|
545
|
+
|
546
|
+
bgp.disable_policy_batching_ipv6 = default
|
547
|
+
assert_equal(default, bgp.disable_policy_batching_ipv6,
|
548
|
+
'bgp disable_policy_batching_ipv6 not set to default')
|
549
|
+
bgp.destroy
|
550
|
+
end
|
551
|
+
|
552
|
+
def test_enforce_first_as
|
553
|
+
bgp = setup_default
|
554
|
+
if platform == :ios_xr
|
555
|
+
@default_show_command = 'show running-config router bgp 55'
|
556
|
+
@default_output_pattern = /bgp enforce-first-as disable/
|
557
|
+
else
|
558
|
+
@default_show_command = 'show run bgp all'
|
559
|
+
@default_output_pattern = /no enforce-first-as/
|
560
|
+
end
|
561
|
+
bgp.enforce_first_as = false
|
562
|
+
refute(bgp.enforce_first_as)
|
563
|
+
assert_show_match(msg: 'enforce-first-as should be disabled')
|
564
|
+
|
565
|
+
bgp.enforce_first_as = true
|
566
|
+
assert(bgp.enforce_first_as)
|
567
|
+
refute_show_match(msg: 'enforce-first-as should be enabled')
|
568
|
+
|
569
|
+
bgp.destroy
|
570
|
+
end
|
571
|
+
|
572
|
+
def test_default_enforce_first_as
|
573
|
+
bgp = setup_default
|
574
|
+
assert_equal(bgp.default_enforce_first_as,
|
575
|
+
bgp.enforce_first_as,
|
576
|
+
'bgp enforce-first-as default value is incorrect')
|
577
|
+
bgp.destroy
|
578
|
+
end
|
579
|
+
|
580
|
+
def test_event_history_cli
|
581
|
+
bgp = setup_default
|
582
|
+
if validate_property_excluded?('bgp', 'event_history_cli')
|
583
|
+
assert_nil(bgp.event_history_cli)
|
584
|
+
assert_raises(Cisco::UnsupportedError) do
|
585
|
+
bgp.event_history_cli = 'size_large'
|
586
|
+
end
|
587
|
+
return
|
588
|
+
end
|
589
|
+
bgp.event_history_cli = 'size_large'
|
590
|
+
assert_equal('size_large', bgp.event_history_cli)
|
591
|
+
end
|
592
|
+
|
593
|
+
def test_event_history_detail
|
594
|
+
bgp = setup_default
|
595
|
+
if validate_property_excluded?('bgp', 'event_history_detail')
|
596
|
+
assert_nil(bgp.event_history_detail)
|
597
|
+
assert_raises(Cisco::UnsupportedError) do
|
598
|
+
bgp.event_history_detail = 'size_large'
|
599
|
+
end
|
600
|
+
return
|
601
|
+
end
|
602
|
+
bgp.event_history_detail = 'size_large'
|
603
|
+
assert_equal('size_large', bgp.event_history_detail)
|
604
|
+
end
|
605
|
+
|
606
|
+
def test_event_history_errors
|
607
|
+
bgp = setup_default
|
608
|
+
if validate_property_excluded?('bgp', 'event_history_errors')
|
609
|
+
assert_nil(bgp.event_history_errors)
|
610
|
+
assert_raises(Cisco::UnsupportedError) do
|
611
|
+
bgp.event_history_errors = 'true'
|
612
|
+
end
|
613
|
+
return
|
614
|
+
end
|
615
|
+
skip_incompat_version?('bgp', 'event_history_errors')
|
616
|
+
bgp.event_history_errors = 'size_large'
|
617
|
+
assert_equal('size_large', bgp.event_history_errors)
|
618
|
+
end
|
619
|
+
|
620
|
+
def test_event_history_events
|
621
|
+
bgp = setup_default
|
622
|
+
if validate_property_excluded?('bgp', 'event_history_events')
|
623
|
+
assert_nil(bgp.event_history_events)
|
624
|
+
assert_raises(Cisco::UnsupportedError) do
|
625
|
+
bgp.event_history_events = 'size_medium'
|
626
|
+
end
|
627
|
+
return
|
628
|
+
end
|
629
|
+
bgp.event_history_events = 'size_medium'
|
630
|
+
assert_equal('size_medium', bgp.event_history_events)
|
631
|
+
end
|
632
|
+
|
633
|
+
def test_event_history_objstore
|
634
|
+
bgp = setup_default
|
635
|
+
if validate_property_excluded?('bgp', 'event_history_objstore')
|
636
|
+
assert_nil(bgp.event_history_objstore)
|
637
|
+
assert_raises(Cisco::UnsupportedError) do
|
638
|
+
bgp.event_history_objstore = 'true'
|
639
|
+
end
|
640
|
+
return
|
641
|
+
end
|
642
|
+
skip_incompat_version?('bgp', 'event_history_objstore')
|
643
|
+
bgp.event_history_objstore = 'size_medium'
|
644
|
+
assert_equal('size_medium', bgp.event_history_objstore)
|
645
|
+
end
|
646
|
+
|
647
|
+
def test_event_history_periodic
|
648
|
+
bgp = setup_default
|
649
|
+
if validate_property_excluded?('bgp', 'event_history_periodic')
|
650
|
+
assert_nil(bgp.event_history_periodic)
|
651
|
+
assert_raises(Cisco::UnsupportedError) do
|
652
|
+
bgp.event_history_periodic = 'size_large'
|
653
|
+
end
|
654
|
+
return
|
655
|
+
end
|
656
|
+
bgp.event_history_periodic = 'size_large'
|
657
|
+
assert_equal('size_large', bgp.event_history_periodic)
|
658
|
+
end
|
659
|
+
|
660
|
+
def test_fast_external_fallover
|
661
|
+
bgp = setup_default
|
662
|
+
bgp.fast_external_fallover = true
|
663
|
+
assert(bgp.fast_external_fallover,
|
664
|
+
'bgp fast-external-fallover should be enabled')
|
665
|
+
bgp.fast_external_fallover = false
|
666
|
+
refute(bgp.fast_external_fallover,
|
667
|
+
'bgp fast-external-fallover should be disabled')
|
668
|
+
bgp.destroy
|
669
|
+
end
|
670
|
+
|
671
|
+
def test_default_fast_external_fallover
|
672
|
+
bgp = setup_default
|
673
|
+
assert(bgp.fast_external_fallover,
|
674
|
+
'bgp fast-external-fallover default value should be true')
|
675
|
+
bgp.destroy
|
676
|
+
end
|
677
|
+
|
678
|
+
def test_flush_routes
|
679
|
+
bgp = setup_default
|
680
|
+
if platform == :ios_xr
|
681
|
+
assert_nil(bgp.flush_routes)
|
682
|
+
assert_raises(UnsupportedError) { bgp.flush_routes = true }
|
683
|
+
else
|
684
|
+
bgp.flush_routes = true
|
685
|
+
assert(bgp.flush_routes,
|
686
|
+
'bgp flush-routes should be enabled')
|
687
|
+
bgp.flush_routes = false
|
688
|
+
refute(bgp.flush_routes,
|
689
|
+
'bgp flush-routes should be disabled')
|
690
|
+
end
|
691
|
+
bgp.destroy
|
692
|
+
end
|
693
|
+
|
694
|
+
def test_default_flush_routes
|
695
|
+
bgp = setup_default
|
696
|
+
refute(bgp.flush_routes,
|
697
|
+
'bgp flush-routes value default value should be false')
|
698
|
+
bgp.destroy
|
699
|
+
end
|
700
|
+
|
701
|
+
def test_graceful_restart_default
|
702
|
+
graceful_restart(setup_default)
|
703
|
+
end
|
704
|
+
|
705
|
+
def test_graceful_restart_vrf
|
706
|
+
graceful_restart(setup_vrf)
|
707
|
+
end
|
708
|
+
|
709
|
+
def graceful_restart(bgp)
|
710
|
+
if platform == :ios_xr && @vrf != 'default'
|
711
|
+
# XR does not support this under a VRF, so test the getter and setter
|
712
|
+
assert_nil(bgp.graceful_restart,
|
713
|
+
'graceful_restart should return nil on XR with ' \
|
714
|
+
'non-default vrf')
|
715
|
+
assert_raises(Cisco::UnsupportedError) do
|
716
|
+
bgp.graceful_restart = true
|
717
|
+
end
|
718
|
+
|
719
|
+
assert_nil(bgp.graceful_restart_timers_restart,
|
720
|
+
'graceful_restart_timers_restart should return nil on XR ' \
|
721
|
+
'with non-default vrf')
|
722
|
+
assert_raises(Cisco::UnsupportedError) do
|
723
|
+
bgp.graceful_restart_timers_restart = 55
|
724
|
+
end
|
725
|
+
|
726
|
+
assert_nil(bgp.graceful_restart_timers_stalepath_time,
|
727
|
+
'graceful_restart_timers_stalepath_time should return nil ' \
|
728
|
+
'on XR with non-default vrf')
|
729
|
+
assert_raises(Cisco::UnsupportedError) do
|
730
|
+
bgp.graceful_restart_timers_stalepath_time = 77
|
731
|
+
end
|
732
|
+
bgp.destroy
|
733
|
+
return
|
734
|
+
end
|
735
|
+
bgp.graceful_restart = true
|
736
|
+
assert(bgp.graceful_restart,
|
737
|
+
'bgp graceful restart should be enabled')
|
738
|
+
bgp.graceful_restart_timers_restart = 55
|
739
|
+
assert_equal(55, bgp.graceful_restart_timers_restart,
|
740
|
+
'bgp graceful restart timers restart' \
|
741
|
+
"should be set to '55'")
|
742
|
+
bgp.graceful_restart_timers_stalepath_time = 77
|
743
|
+
assert_equal(77, bgp.graceful_restart_timers_stalepath_time,
|
744
|
+
'bgp graceful restart timers stalepath time' \
|
745
|
+
"should be set to '77'")
|
746
|
+
if platform == :nexus
|
747
|
+
bgp.graceful_restart_helper = true
|
748
|
+
assert(bgp.graceful_restart_helper,
|
749
|
+
'bgp graceful restart helper should be enabled')
|
750
|
+
else
|
751
|
+
assert_raises(Cisco::UnsupportedError) do
|
752
|
+
bgp.graceful_restart_helper = true
|
753
|
+
end
|
754
|
+
end
|
755
|
+
bgp.graceful_restart = false
|
756
|
+
refute(bgp.graceful_restart,
|
757
|
+
'bgp graceful_restart should be disabled')
|
758
|
+
bgp.graceful_restart_timers_restart = 120
|
759
|
+
assert_equal(120, bgp.graceful_restart_timers_restart,
|
760
|
+
'bgp graceful restart timers restart' \
|
761
|
+
"should be set to default value of '120'")
|
762
|
+
bgp.graceful_restart_timers_stalepath_time = 300
|
763
|
+
assert_equal(300, bgp.graceful_restart_timers_stalepath_time,
|
764
|
+
'bgp graceful restart timers stalepath time' \
|
765
|
+
"should be set to default value of '300'")
|
766
|
+
if platform == :nexus
|
767
|
+
bgp.graceful_restart_helper = false
|
768
|
+
refute(bgp.graceful_restart_helper,
|
769
|
+
'bgp graceful restart helper should be disabled')
|
770
|
+
else
|
771
|
+
assert_raises(Cisco::UnsupportedError) do
|
772
|
+
bgp.graceful_restart_helper = false
|
773
|
+
end
|
774
|
+
end
|
775
|
+
bgp.destroy
|
776
|
+
end
|
777
|
+
|
778
|
+
def test_default_graceful_restart
|
779
|
+
bgp = setup_default
|
780
|
+
assert(bgp.default_graceful_restart,
|
781
|
+
'bgp graceful restart default value should be enabled = true')
|
782
|
+
assert_equal(120, bgp.default_graceful_restart_timers_restart,
|
783
|
+
"bgp graceful restart default timer value should be '120'")
|
784
|
+
assert_equal(300, bgp.default_graceful_restart_timers_stalepath_time,
|
785
|
+
"bgp graceful restart default timer value should be '300'")
|
786
|
+
if platform == :nexus
|
787
|
+
refute(bgp.default_graceful_restart_helper,
|
788
|
+
'graceful restart helper default value ' \
|
789
|
+
'should be enabled = false')
|
790
|
+
else
|
791
|
+
assert_nil(bgp.default_graceful_restart_helper,
|
792
|
+
'bgp default_graceful_restart_helper should ' \
|
793
|
+
'*NOT* be supported')
|
794
|
+
end
|
795
|
+
bgp.destroy
|
796
|
+
end
|
797
|
+
|
798
|
+
def test_confederation_id_default
|
799
|
+
confederation_id(setup_default)
|
800
|
+
end
|
801
|
+
|
802
|
+
def test_confederation_id_vrf
|
803
|
+
confederation_id(setup_vrf)
|
804
|
+
end
|
805
|
+
|
806
|
+
def confederation_id(bgp)
|
807
|
+
if platform == :ios_xr && @vrf != 'default'
|
808
|
+
# XR does not support this under a VRF, so test the getter and setter
|
809
|
+
assert_nil(bgp.confederation_id,
|
810
|
+
'confederation_id should return nil on XR with ' \
|
811
|
+
'non-default vrf')
|
812
|
+
assert_raises(Cisco::UnsupportedError) do
|
813
|
+
bgp.confederation_id = 77
|
814
|
+
end
|
815
|
+
bgp.destroy
|
816
|
+
return
|
817
|
+
end
|
818
|
+
bgp.confederation_id = 77
|
819
|
+
assert_equal('77', bgp.confederation_id,
|
820
|
+
"bgp confederation_id should be set to '77'")
|
821
|
+
bgp.confederation_id = ''
|
822
|
+
assert_empty(bgp.confederation_id, '' \
|
823
|
+
'bgp confederation_id should *NOT* be configured')
|
824
|
+
bgp.destroy
|
825
|
+
end
|
826
|
+
|
827
|
+
def test_confed_id_uu76828
|
828
|
+
bgp = setup_default
|
829
|
+
bgp.confederation_id = 55.77
|
830
|
+
assert_equal('55.77', bgp.confederation_id,
|
831
|
+
"bgp confederation_id should be set to '55.77'")
|
832
|
+
bgp.destroy
|
833
|
+
end
|
834
|
+
|
835
|
+
def test_confederation_id_not_configured
|
836
|
+
bgp = setup_default
|
837
|
+
assert_empty(bgp.confederation_id,
|
838
|
+
'bgp confederation_id should *NOT* be configured')
|
839
|
+
bgp.destroy
|
840
|
+
end
|
841
|
+
|
842
|
+
def test_default_confederation_id
|
843
|
+
bgp = setup_default
|
844
|
+
assert_empty(bgp.default_confederation_id,
|
845
|
+
'bgp confederation_id default value should be empty')
|
846
|
+
bgp.destroy
|
847
|
+
end
|
848
|
+
|
849
|
+
def test_confederation_peers_default
|
850
|
+
confed_peers_test(setup_default)
|
851
|
+
end
|
852
|
+
|
853
|
+
def test_confederation_peers_vrf
|
854
|
+
confed_peers_test(setup_vrf)
|
855
|
+
end
|
856
|
+
|
857
|
+
def confed_peers_test(bgp)
|
858
|
+
# Confederation peer configuration requires that a
|
859
|
+
# confederation id be configured first so the expectation
|
860
|
+
# in the next test is an empty peer list
|
861
|
+
if platform == :ios_xr && @vrf != 'default'
|
862
|
+
# XR does not support this under a VRF, so test the getter and setter
|
863
|
+
assert_nil(bgp.confederation_peers,
|
864
|
+
'confederation_peers should return nil on XR ' \
|
865
|
+
'with non-default vrf')
|
866
|
+
assert_raises(Cisco::UnsupportedError) do
|
867
|
+
bgp.confederation_peers = ['15', '55.77', '16', '18', '555', '299']
|
868
|
+
end
|
869
|
+
bgp.destroy
|
870
|
+
return
|
871
|
+
end
|
872
|
+
bgp.confederation_id = 55
|
873
|
+
|
874
|
+
assert_empty(bgp.confederation_peers,
|
875
|
+
'bgp confederation_peers list should be empty')
|
876
|
+
bgp.confederation_peers = [15]
|
877
|
+
assert_equal(['15'], bgp.confederation_peers,
|
878
|
+
"bgp confederation_peers list should be ['15']")
|
879
|
+
bgp.confederation_peers = [16]
|
880
|
+
assert_equal(['16'], bgp.confederation_peers,
|
881
|
+
"bgp confederation_peers list should be ['16']")
|
882
|
+
bgp.confederation_peers = [55.77]
|
883
|
+
assert_equal(['55.77'], bgp.confederation_peers,
|
884
|
+
'bgp confederation_peers list should be ' \
|
885
|
+
"['55.77']")
|
886
|
+
bgp.confederation_peers = ['15', '55.77', '16', '18', '555', '299']
|
887
|
+
assert_equal(['15', '16', '18', '299', '55.77', '555'],
|
888
|
+
bgp.confederation_peers,
|
889
|
+
'bgp confederation_peers list should be ' \
|
890
|
+
"'['15', '16', '18', '299', '55.77', '555']'")
|
891
|
+
bgp.confederation_peers = []
|
892
|
+
assert_empty(bgp.confederation_peers,
|
893
|
+
'bgp confederation_peers list should be empty')
|
894
|
+
bgp.destroy
|
895
|
+
end
|
896
|
+
|
897
|
+
def test_confederation_peers_not_configured
|
898
|
+
bgp = setup_default
|
899
|
+
assert_empty(bgp.confederation_peers,
|
900
|
+
'bgp confederation_peers list should *NOT* be configured')
|
901
|
+
bgp.destroy
|
902
|
+
end
|
903
|
+
|
904
|
+
def test_default_confederation_peers
|
905
|
+
bgp = setup_default
|
906
|
+
assert_empty(bgp.default_confederation_peers,
|
907
|
+
'bgp confederation_peers default value should be empty')
|
908
|
+
bgp.destroy
|
909
|
+
end
|
910
|
+
|
911
|
+
def test_isolate
|
912
|
+
bgp = setup_default
|
913
|
+
if platform == :ios_xr
|
914
|
+
assert_nil(bgp.isolate)
|
915
|
+
assert_nil(bgp.default_isolate)
|
916
|
+
assert_raises(UnsupportedError) { bgp.isolate = true }
|
917
|
+
else
|
918
|
+
bgp.isolate = true
|
919
|
+
assert(bgp.isolate,
|
920
|
+
'bgp isolate should be enabled')
|
921
|
+
bgp.isolate = false
|
922
|
+
refute(bgp.isolate,
|
923
|
+
'bgp isolate should be disabled')
|
924
|
+
end
|
925
|
+
bgp.destroy
|
926
|
+
end
|
927
|
+
|
928
|
+
def test_default_isolate
|
929
|
+
bgp = setup_default
|
930
|
+
refute(bgp.isolate,
|
931
|
+
'bgp isolate default value should be false')
|
932
|
+
bgp.destroy
|
933
|
+
end
|
934
|
+
|
935
|
+
def test_log_neighbor_changes_default
|
936
|
+
log_neighbor_changes(setup_default)
|
937
|
+
end
|
938
|
+
|
939
|
+
def test_log_neighbor_changes_vrf
|
940
|
+
log_neighbor_changes(setup_vrf)
|
941
|
+
end
|
942
|
+
|
943
|
+
def log_neighbor_changes(bgp)
|
944
|
+
if platform == :ios_xr
|
945
|
+
vrf_str = @vrf == 'default' ? '' : "vrf #{@vrf}"
|
946
|
+
@default_show_command =
|
947
|
+
"show running-config router bgp #{@asnum} #{vrf_str}"
|
948
|
+
@default_output_pattern = /bgp log neighbor changes disable/
|
949
|
+
else
|
950
|
+
@default_show_command = 'show run bgp all'
|
951
|
+
@default_output_pattern = /log-neighbor-changes/
|
952
|
+
end
|
953
|
+
bgp.log_neighbor_changes = false
|
954
|
+
refute(bgp.log_neighbor_changes)
|
955
|
+
|
956
|
+
msg_disable = 'log neighbor changes should be disabled'
|
957
|
+
msg_enable = 'log neighbor changes should be enabled'
|
958
|
+
|
959
|
+
if platform == :ios_xr
|
960
|
+
# XR the disable keyword added
|
961
|
+
assert_show_match(msg: msg_disable)
|
962
|
+
else
|
963
|
+
# Nexus the command is removed
|
964
|
+
refute_show_match(msg: msg_disable)
|
965
|
+
end
|
966
|
+
bgp.log_neighbor_changes = true
|
967
|
+
assert(bgp.log_neighbor_changes)
|
968
|
+
if platform == :ios_xr
|
969
|
+
# XR removes the whole command including disable keyword
|
970
|
+
refute_show_match(msg: msg_enable)
|
971
|
+
else
|
972
|
+
# Nexus adds the log-neighbor-changes command
|
973
|
+
assert_show_match(msg: msg_enable)
|
974
|
+
end
|
975
|
+
bgp.destroy
|
976
|
+
end
|
977
|
+
|
978
|
+
def test_default_log_neighbor_changes
|
979
|
+
bgp = setup_default
|
980
|
+
if bgp.default_log_neighbor_changes
|
981
|
+
# XR logging is on by default
|
982
|
+
assert(bgp.log_neighbor_changes,
|
983
|
+
'bgp log_neighbor_changes should be enabled')
|
984
|
+
else
|
985
|
+
refute(bgp.log_neighbor_changes,
|
986
|
+
'bgp log_neighbor_changes should be disabled')
|
987
|
+
end
|
988
|
+
bgp.destroy
|
989
|
+
end
|
990
|
+
|
991
|
+
def test_maxas_limit_default
|
992
|
+
maxas_limit(setup_default)
|
993
|
+
end
|
994
|
+
|
995
|
+
def test_maxas_limit_vrf
|
996
|
+
maxas_limit(setup_vrf)
|
997
|
+
end
|
998
|
+
|
999
|
+
def maxas_limit(bgp)
|
1000
|
+
if platform == :ios_xr
|
1001
|
+
assert_raises(Cisco::UnsupportedError) do
|
1002
|
+
bgp.maxas_limit = 50
|
1003
|
+
end
|
1004
|
+
else
|
1005
|
+
bgp.maxas_limit = 50
|
1006
|
+
assert_equal(50, bgp.maxas_limit,
|
1007
|
+
"bgp maxas-limit should be set to '50'")
|
1008
|
+
bgp.maxas_limit = bgp.default_maxas_limit
|
1009
|
+
assert_equal(bgp.default_maxas_limit, bgp.maxas_limit,
|
1010
|
+
'bgp maxas-limit should be set to default value')
|
1011
|
+
end
|
1012
|
+
bgp.destroy
|
1013
|
+
end
|
1014
|
+
|
1015
|
+
def test_default_maxas_limit
|
1016
|
+
bgp = setup_default
|
1017
|
+
assert_equal(bgp.default_maxas_limit, bgp.maxas_limit,
|
1018
|
+
'bgp maxas-limit should be default value')
|
1019
|
+
bgp.destroy
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
def test_neighbor_down_fib_accelerate
|
1023
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
1024
|
+
b = RouterBgp.new(1)
|
1025
|
+
assert_nil(b.neighbor_down_fib_accelerate)
|
1026
|
+
assert_nil(b.default_neighbor_down_fib_accelerate)
|
1027
|
+
assert_raises(Cisco::UnsupportedError) do
|
1028
|
+
b.neighbor_down_fib_accelerate = true
|
1029
|
+
end
|
1030
|
+
return
|
1031
|
+
end
|
1032
|
+
skip_incompat_version?('bgp', 'neighbor_down_fib_accelerate')
|
1033
|
+
%w(test_default test_vrf).each do |t|
|
1034
|
+
if t == 'test_default'
|
1035
|
+
bgp = setup_default
|
1036
|
+
else
|
1037
|
+
bgp = setup_vrf
|
1038
|
+
end
|
1039
|
+
default = bgp.default_neighbor_down_fib_accelerate
|
1040
|
+
assert_equal(default, bgp.neighbor_down_fib_accelerate,
|
1041
|
+
'bgp neighbor_fib_down_accelerate not set to default value')
|
1042
|
+
|
1043
|
+
bgp.neighbor_down_fib_accelerate = true
|
1044
|
+
assert(bgp.neighbor_down_fib_accelerate,
|
1045
|
+
"vrf #{@vrf}: bgp neighbor_down_fib_accelerate "\
|
1046
|
+
'should be enabled')
|
1047
|
+
bgp.neighbor_down_fib_accelerate = false
|
1048
|
+
refute(bgp.neighbor_down_fib_accelerate,
|
1049
|
+
"vrf #{@vrf}: bgp neighbor_down_fib_accelerate "\
|
1050
|
+
'should be disabled')
|
1051
|
+
|
1052
|
+
bgp.neighbor_down_fib_accelerate = default
|
1053
|
+
assert_equal(default, bgp.neighbor_down_fib_accelerate,
|
1054
|
+
'bgp neighbor_fib_down_accelerate not set to default value')
|
1055
|
+
bgp.destroy
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
def test_reconnect_interval
|
1060
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
1061
|
+
b = RouterBgp.new(1)
|
1062
|
+
assert_nil(b.reconnect_interval)
|
1063
|
+
assert_nil(b.default_reconnect_interval)
|
1064
|
+
assert_raises(Cisco::UnsupportedError) do
|
1065
|
+
b.reconnect_interval = 34
|
1066
|
+
end
|
1067
|
+
return
|
1068
|
+
end
|
1069
|
+
skip_incompat_version?('bgp', 'reconnect_interval')
|
1070
|
+
%w(test_default test_vrf).each do |t|
|
1071
|
+
if t == 'test_default'
|
1072
|
+
bgp = setup_default
|
1073
|
+
else
|
1074
|
+
bgp = setup_vrf
|
1075
|
+
end
|
1076
|
+
if platform == :ios_xr
|
1077
|
+
assert_raises(Cisco::UnsupportedError) do
|
1078
|
+
bgp.reconnect_interval = 34
|
1079
|
+
end
|
1080
|
+
else
|
1081
|
+
bgp.reconnect_interval = 34
|
1082
|
+
assert_equal(34, bgp.reconnect_interval,
|
1083
|
+
"vrf #{@vrf}: bgp reconnect_interval should be set to 34")
|
1084
|
+
bgp.reconnect_interval = 60
|
1085
|
+
assert_equal(60, bgp.reconnect_interval,
|
1086
|
+
"vrf #{@vrf}: bgp reconnect_interval should be set to 60")
|
1087
|
+
end
|
1088
|
+
bgp.destroy
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
def test_reconnect_interval_default
|
1093
|
+
bgp = setup_default
|
1094
|
+
if platform == :ios_xr
|
1095
|
+
assert_nil(bgp.reconnect_interval,
|
1096
|
+
'reconnect_interval should return nil on XR')
|
1097
|
+
else
|
1098
|
+
skip_if_UnsupportedCmdRef('bgp', 'reconnect_interval')
|
1099
|
+
skip_incompat_version?('bgp', 'reconnect_interval')
|
1100
|
+
assert_equal(bgp.default_reconnect_interval, bgp.reconnect_interval,
|
1101
|
+
"reconnect_interval should be set to default value of '60'")
|
1102
|
+
bgp.destroy
|
1103
|
+
end
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
def test_route_distinguisher
|
1107
|
+
skip_nexus_i2_image?
|
1108
|
+
remove_all_vrfs
|
1109
|
+
vdc_limit_f3_no_intf_needed(:set)
|
1110
|
+
|
1111
|
+
bgp = setup_vrf
|
1112
|
+
assert_empty(bgp.route_distinguisher,
|
1113
|
+
'bgp route_distinguisher should *NOT* be configured')
|
1114
|
+
|
1115
|
+
bgp.route_distinguisher = 'auto'
|
1116
|
+
assert_equal('auto', bgp.route_distinguisher)
|
1117
|
+
|
1118
|
+
bgp.route_distinguisher = '1:1'
|
1119
|
+
assert_equal('1:1', bgp.route_distinguisher)
|
1120
|
+
|
1121
|
+
bgp.route_distinguisher = '2:3'
|
1122
|
+
assert_equal('2:3', bgp.route_distinguisher)
|
1123
|
+
|
1124
|
+
bgp.route_distinguisher = bgp.default_route_distinguisher
|
1125
|
+
assert_empty(bgp.route_distinguisher,
|
1126
|
+
'bgp route_distinguisher should *NOT* be configured')
|
1127
|
+
bgp.destroy
|
1128
|
+
remove_all_vrfs
|
1129
|
+
vdc_limit_f3_no_intf_needed(:clear)
|
1130
|
+
config_no_warn('no nv overlay evpn ; no feature nv overlay')
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
def test_router_id
|
1134
|
+
%w(test_default test_vrf).each do |t|
|
1135
|
+
if t == 'test_default'
|
1136
|
+
bgp = setup_default
|
1137
|
+
else
|
1138
|
+
bgp = setup_vrf
|
1139
|
+
end
|
1140
|
+
bgp.router_id = '7.8.9.11'
|
1141
|
+
assert_equal('7.8.9.11', bgp.router_id,
|
1142
|
+
"vrf #{@vrf}: bgp router_id invalid")
|
1143
|
+
bgp.router_id = ''
|
1144
|
+
assert_empty(bgp.router_id,
|
1145
|
+
"vrf #{@vrf}: bgp router_id should *NOT* be configured")
|
1146
|
+
bgp.destroy
|
1147
|
+
end
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
def test_router_id_not_configured
|
1151
|
+
bgp = setup_default
|
1152
|
+
assert_empty(bgp.router_id,
|
1153
|
+
'bgp router_id should *NOT* be configured')
|
1154
|
+
bgp.destroy
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
def test_default_router_id
|
1158
|
+
bgp = setup_default
|
1159
|
+
assert_empty(bgp.default_router_id,
|
1160
|
+
'bgp router_id default value should be empty')
|
1161
|
+
bgp.destroy
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
def test_shutdown
|
1165
|
+
bgp = setup_default
|
1166
|
+
if platform == :ios_xr
|
1167
|
+
assert_raises(Cisco::UnsupportedError) do
|
1168
|
+
bgp.shutdown = true
|
1169
|
+
end
|
1170
|
+
else
|
1171
|
+
bgp.shutdown = true
|
1172
|
+
assert(bgp.shutdown, 'bgp should be shutdown')
|
1173
|
+
bgp.shutdown = false
|
1174
|
+
refute(bgp.shutdown, "bgp should in 'no shutdown' state")
|
1175
|
+
end
|
1176
|
+
bgp.destroy
|
1177
|
+
end
|
1178
|
+
|
1179
|
+
def test_shutdown_not_configured
|
1180
|
+
bgp = setup_default
|
1181
|
+
refute(bgp.shutdown,
|
1182
|
+
"bgp should be in 'no shutdown' state")
|
1183
|
+
bgp.destroy
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
def test_default_shutdown
|
1187
|
+
bgp = setup_default
|
1188
|
+
refute(bgp.default_shutdown,
|
1189
|
+
'bgp shutdown default value should be false')
|
1190
|
+
bgp.destroy
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
def test_suppress_fib_pending
|
1194
|
+
skip_legacy_defect?('7.0.3.I4',
|
1195
|
+
'CSCvd41536: Unable to remove suppress-fib-pending')
|
1196
|
+
bgp = setup_default
|
1197
|
+
if validate_property_excluded?('bgp', 'suppress_fib_pending')
|
1198
|
+
assert_raises(Cisco::UnsupportedError) do
|
1199
|
+
bgp.suppress_fib_pending = true
|
1200
|
+
end
|
1201
|
+
else
|
1202
|
+
bgp.suppress_fib_pending = true
|
1203
|
+
assert(bgp.suppress_fib_pending,
|
1204
|
+
'bgp suppress_fib_pending should be enabled')
|
1205
|
+
bgp.suppress_fib_pending = false
|
1206
|
+
refute(bgp.suppress_fib_pending,
|
1207
|
+
'bgp suppress_fib_pending should be disabled')
|
1208
|
+
bgp.suppress_fib_pending = bgp.default_suppress_fib_pending
|
1209
|
+
assert_equal(bgp.default_suppress_fib_pending, bgp.suppress_fib_pending)
|
1210
|
+
end
|
1211
|
+
bgp.destroy
|
1212
|
+
end
|
1213
|
+
|
1214
|
+
def test_timer_bestpath_limit
|
1215
|
+
%w(test_default test_vrf).each do |t|
|
1216
|
+
if t == 'test_default'
|
1217
|
+
bgp = setup_default
|
1218
|
+
else
|
1219
|
+
bgp = setup_vrf
|
1220
|
+
end
|
1221
|
+
if platform == :ios_xr
|
1222
|
+
assert_raises(Cisco::UnsupportedError) do
|
1223
|
+
bgp.timer_bestpath_limit_set(34)
|
1224
|
+
end
|
1225
|
+
else
|
1226
|
+
bgp.timer_bestpath_limit_set(34)
|
1227
|
+
assert_equal(34, bgp.timer_bestpath_limit, "vrf #{@vrf}: " \
|
1228
|
+
"bgp timer_bestpath_limit should be set to '34'")
|
1229
|
+
bgp.timer_bestpath_limit_set(300)
|
1230
|
+
assert_equal(300, bgp.timer_bestpath_limit, "vrf #{@vrf}: " \
|
1231
|
+
"bgp timer_bestpath_limit should be set to '300'")
|
1232
|
+
end
|
1233
|
+
bgp.destroy
|
1234
|
+
end
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
def test_timer_bestpath_limit_default
|
1238
|
+
bgp = setup_default
|
1239
|
+
if platform == :ios_xr
|
1240
|
+
assert_nil(bgp.timer_bestpath_limit,
|
1241
|
+
'timer_bestpath_limit should be nil for XR')
|
1242
|
+
else
|
1243
|
+
assert_equal(300, bgp.timer_bestpath_limit,
|
1244
|
+
"timer_bestpath_limit should be default value of '300'")
|
1245
|
+
end
|
1246
|
+
bgp.destroy
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
def test_timer_bestpath_limit_always_default
|
1250
|
+
timer_bestpath_limit_always(setup_default)
|
1251
|
+
end
|
1252
|
+
|
1253
|
+
def test_timer_bestpath_limit_always_vrf
|
1254
|
+
timer_bestpath_limit_always(setup_vrf)
|
1255
|
+
end
|
1256
|
+
|
1257
|
+
def timer_bestpath_limit_always(bgp)
|
1258
|
+
if platform == :ios_xr
|
1259
|
+
assert_raises(Cisco::UnsupportedError) do
|
1260
|
+
bgp.timer_bestpath_limit_set(34, true)
|
1261
|
+
end
|
1262
|
+
else
|
1263
|
+
bgp.timer_bestpath_limit_set(34, true)
|
1264
|
+
assert(bgp.timer_bestpath_limit_always,
|
1265
|
+
"vrf #{@vrf}: bgp timer_bestpath_limit_always should be enabled")
|
1266
|
+
bgp.timer_bestpath_limit_set(34, false)
|
1267
|
+
refute(bgp.timer_bestpath_limit_always,
|
1268
|
+
"vrf #{@vrf}: bgp timer_bestpath_limit_always should be disabled")
|
1269
|
+
end
|
1270
|
+
bgp.destroy
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
def test_timer_bestpath_limit_always_not_configured
|
1274
|
+
bgp = setup_default
|
1275
|
+
refute(bgp.timer_bestpath_limit_always,
|
1276
|
+
'bgp timer_bestpath_limit_always should be disabled')
|
1277
|
+
bgp.destroy
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
def test_default_timer_bestpath_limit_always
|
1281
|
+
bgp = setup_default
|
1282
|
+
refute(bgp.default_timer_bestpath_limit_always,
|
1283
|
+
'bgp timer_bestpath_limit_always default value should be false')
|
1284
|
+
bgp.destroy
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
def test_timer_bgp_keepalive_hold
|
1288
|
+
%w(test_default test_vrf).each do |t|
|
1289
|
+
if t == 'test_default'
|
1290
|
+
bgp = setup_default
|
1291
|
+
else
|
1292
|
+
bgp = setup_vrf
|
1293
|
+
end
|
1294
|
+
bgp.timer_bgp_keepalive_hold_set(25, 45)
|
1295
|
+
assert_equal(%w(25 45), bgp.timer_bgp_keepalive_hold, "vrf #{@vrf}: " \
|
1296
|
+
"keepalive and hold values should be '25 and 45'")
|
1297
|
+
bgp.timer_bgp_keepalive_hold_set(60, 180)
|
1298
|
+
assert_equal(%w(60 180), bgp.timer_bgp_keepalive_hold, "vrf #{@vrf}: " \
|
1299
|
+
"keepalive and hold values should be '60 and 180'")
|
1300
|
+
assert_equal(60, bgp.timer_bgp_keepalive, "vrf #{@vrf}: " \
|
1301
|
+
"keepalive value should be '60'")
|
1302
|
+
assert_equal(180, bgp.timer_bgp_holdtime, "vrf #{@vrf}: " \
|
1303
|
+
"keepalive value should be '180'")
|
1304
|
+
bgp.timer_bgp_keepalive_hold_set(500, 3600)
|
1305
|
+
assert_equal(%w(500 3600), bgp.timer_bgp_keepalive_hold, "vrf #{@vrf}: " \
|
1306
|
+
"keepalive and hold values should be '500 and 3600'")
|
1307
|
+
assert_equal(500, bgp.timer_bgp_keepalive, "vrf #{@vrf}: " \
|
1308
|
+
"keepalive value should be '500'")
|
1309
|
+
assert_equal(3600, bgp.timer_bgp_holdtime, "vrf #{@vrf}: " \
|
1310
|
+
"keepalive value should be '3600'")
|
1311
|
+
bgp.destroy
|
1312
|
+
end
|
1313
|
+
end
|
1314
|
+
|
1315
|
+
def test_default_timer_keepalive_hold_default
|
1316
|
+
bgp = setup_default
|
1317
|
+
assert_equal(%w(60 180), bgp.default_timer_bgp_keepalive_hold,
|
1318
|
+
'bgp timer_bestpath_timer_keepalive_hold_default values ' \
|
1319
|
+
"should be '60' and '180'")
|
1320
|
+
assert_equal(%w(60 180), bgp.timer_bgp_keepalive_hold,
|
1321
|
+
'bgp timer_bestpath_timer_keepalive_hold_default should be' \
|
1322
|
+
"set to default values of '60' and '180'")
|
1323
|
+
bgp.destroy
|
1324
|
+
end
|
1325
|
+
end
|