cisco_node_utils 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +81 -2
- data/CONTRIBUTING.md +2 -17
- data/Gemfile +5 -0
- data/README.md +92 -47
- data/Rakefile +23 -1
- data/bin/git/hooks/hook_lib +7 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +7 -2
- data/bin/git/hooks/pre-commit/validate-diffs +18 -4
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/update-hooks +64 -6
- data/cisco_node_utils.gemspec +9 -6
- data/docs/README-develop-best-practices.md +149 -50
- data/docs/README-develop-node-utils-APIs.md +92 -42
- data/docs/README-maintainers.md +7 -4
- data/docs/README-test-execution.md +57 -0
- data/docs/cisco_node_utils.yaml.example +30 -0
- data/docs/template-router.rb +4 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +2 -2
- data/lib/cisco_node_utils.rb +5 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +5 -6
- data/lib/cisco_node_utils/aaa_authorization_service.rb +1 -1
- data/lib/cisco_node_utils/ace.rb +165 -12
- data/lib/cisco_node_utils/acl.rb +2 -1
- data/lib/cisco_node_utils/bgp.rb +184 -21
- data/lib/cisco_node_utils/bgp_af.rb +94 -249
- data/lib/cisco_node_utils/bgp_neighbor.rb +94 -14
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +75 -8
- data/lib/cisco_node_utils/bridge_domain.rb +183 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +85 -2
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/client/client.rb +234 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +311 -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/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +305 -0
- data/lib/cisco_node_utils/client/utils.rb +164 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +222 -254
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +22 -15
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +21 -16
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +239 -109
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +114 -55
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +76 -52
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +106 -62
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +35 -14
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +23 -17
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +94 -83
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +22 -17
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +76 -26
- data/lib/cisco_node_utils/cmd_ref/images.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +381 -153
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +21 -21
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +30 -21
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +18 -13
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +26 -31
- 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 +17 -6
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +10 -3
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +17 -5
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +33 -29
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +12 -10
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +16 -19
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +40 -25
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +17 -12
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +71 -35
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +10 -5
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +6 -2
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +47 -43
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +13 -11
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +4 -2
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +23 -21
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +26 -22
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +19 -17
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +18 -6
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +234 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +24 -9
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +5 -3
- data/lib/cisco_node_utils/cmd_ref/system.yaml +4 -3
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +22 -20
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +27 -15
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +45 -16
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +60 -32
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +118 -101
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +54 -58
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +118 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +19 -25
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +28 -18
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +34 -17
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +6 -4
- data/lib/cisco_node_utils/command_reference.rb +261 -142
- data/lib/cisco_node_utils/constants.rb +33 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +102 -0
- data/lib/cisco_node_utils/evpn_vni.rb +5 -3
- data/lib/cisco_node_utils/exceptions.rb +111 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +52 -35
- data/lib/cisco_node_utils/fabricpath_topology.rb +44 -57
- data/lib/cisco_node_utils/feature.rb +165 -3
- data/lib/cisco_node_utils/interface.rb +1051 -260
- data/lib/cisco_node_utils/interface_channel_group.rb +11 -10
- data/lib/cisco_node_utils/interface_ospf.rb +1 -2
- data/lib/cisco_node_utils/interface_portchannel.rb +4 -12
- data/lib/cisco_node_utils/interface_service_vni.rb +7 -7
- data/lib/cisco_node_utils/itd_device_group.rb +248 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +523 -0
- data/lib/cisco_node_utils/logger.rb +75 -0
- data/lib/cisco_node_utils/node.rb +62 -192
- data/lib/cisco_node_utils/node_util.rb +56 -10
- data/lib/cisco_node_utils/overlay_global.rb +2 -2
- data/lib/cisco_node_utils/pim.rb +2 -13
- data/lib/cisco_node_utils/pim_group_list.rb +1 -1
- data/lib/cisco_node_utils/pim_rp_address.rb +1 -1
- data/lib/cisco_node_utils/platform.rb +52 -21
- data/lib/cisco_node_utils/portchannel_global.rb +89 -19
- data/lib/cisco_node_utils/radius_server.rb +168 -37
- data/lib/cisco_node_utils/router_ospf.rb +20 -35
- data/lib/cisco_node_utils/router_ospf_vrf.rb +4 -4
- data/lib/cisco_node_utils/snmpserver.rb +1 -6
- data/lib/cisco_node_utils/snmpuser.rb +6 -4
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_server.rb +77 -18
- data/lib/cisco_node_utils/syslog_settings.rb +1 -1
- data/lib/cisco_node_utils/tacacs_server_group.rb +8 -4
- data/lib/cisco_node_utils/tacacs_server_host.rb +115 -25
- data/lib/cisco_node_utils/vdc.rb +12 -0
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +147 -29
- data/lib/cisco_node_utils/vpc.rb +55 -3
- data/lib/cisco_node_utils/vrf.rb +72 -11
- data/lib/cisco_node_utils/vrf_af.rb +114 -29
- data/lib/cisco_node_utils/vtp.rb +34 -52
- data/lib/cisco_node_utils/vxlan_vtep.rb +34 -8
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +36 -4
- 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 +263 -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 +75 -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 +2 -2
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +96 -36
- data/tests/ciscotest.rb +220 -12
- data/tests/cmd_config.yaml +71 -49
- data/tests/cmd_config_invalid.yaml +1 -1
- data/tests/test_aaa_authentication_login.rb +1 -0
- data/tests/test_aaa_authentication_login_service.rb +9 -0
- data/tests/test_aaa_authorization_service.rb +173 -367
- data/tests/test_ace.rb +171 -100
- data/tests/test_acl.rb +10 -1
- data/tests/test_bgp_af.rb +395 -728
- data/tests/test_bgp_neighbor.rb +274 -115
- data/tests/test_bgp_neighbor_af.rb +178 -77
- data/tests/test_bridge_domain.rb +191 -0
- data/tests/test_bridge_domain_vni.rb +116 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_command_config.rb +9 -5
- data/tests/test_command_reference.rb +380 -102
- data/tests/test_dns_domain.rb +13 -3
- data/tests/test_domain_name.rb +13 -3
- data/tests/test_encapsulation.rb +77 -0
- data/tests/test_evpn_vni.rb +25 -7
- data/tests/test_fabricpath_global.rb +167 -163
- data/tests/test_fabricpath_topology.rb +12 -33
- data/tests/test_feature.rb +215 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_interface.rb +585 -344
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +6 -3
- data/tests/test_interface_ospf.rb +26 -24
- data/tests/test_interface_portchannel.rb +1 -0
- data/tests/test_interface_private_vlan.rb +724 -0
- data/tests/test_interface_service_vni.rb +37 -66
- data/tests/test_interface_svi.rb +98 -101
- data/tests/test_interface_switchport.rb +419 -549
- 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 +298 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +11 -2
- data/tests/test_node.rb +16 -75
- data/tests/test_node_ext.rb +174 -163
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_config.rb +5 -1
- data/tests/test_ntp_server.rb +2 -2
- data/tests/test_nxapi.rb +221 -0
- data/tests/test_overlay_global.rb +47 -38
- data/tests/test_pim.rb +2 -0
- data/tests/test_pim_group_list.rb +2 -0
- data/tests/test_pim_rp_address.rb +2 -0
- data/tests/test_platform.rb +86 -39
- data/tests/test_portchannel_global.rb +211 -135
- data/tests/test_radius_global.rb +13 -5
- data/tests/test_radius_server.rb +256 -104
- data/tests/test_radius_server_group.rb +2 -0
- data/tests/test_router_bgp.rb +781 -485
- data/tests/test_router_ospf.rb +26 -103
- data/tests/test_router_ospf_vrf.rb +52 -57
- data/tests/test_snmp_notification_receiver.rb +2 -0
- data/tests/test_snmpcommunity.rb +2 -0
- data/tests/test_snmpgroup.rb +2 -0
- data/tests/test_snmpnotification.rb +40 -21
- data/tests/test_snmpserver.rb +2 -0
- data/tests/test_snmpuser.rb +2 -0
- data/tests/test_stp_global.rb +563 -0
- data/tests/test_syslog_server.rb +32 -8
- data/tests/test_syslog_settings.rb +22 -9
- data/tests/test_tacacs_server.rb +32 -27
- data/tests/test_tacacs_server_group.rb +100 -45
- data/tests/test_tacacs_server_host.rb +135 -43
- data/tests/test_vdc.rb +2 -16
- data/tests/test_vlan.rb +106 -54
- data/tests/test_vlan_mt_full.rb +11 -21
- data/tests/test_vlan_private.rb +669 -0
- data/tests/test_vpc.rb +312 -159
- data/tests/test_vrf.rb +122 -113
- data/tests/test_vrf_af.rb +238 -0
- data/tests/test_vtp.rb +58 -102
- data/tests/test_vxlan_vtep.rb +38 -17
- data/tests/test_vxlan_vtep_vni.rb +61 -9
- data/tests/test_yum.rb +49 -25
- metadata +122 -36
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +0 -9
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +0 -76
- data/lib/cisco_node_utils/vni.rb +0 -227
- data/tests/test_vni.rb +0 -106
data/tests/test_dns_domain.rb
CHANGED
|
@@ -20,23 +20,33 @@ require_relative '../lib/cisco_node_utils/dns_domain'
|
|
|
20
20
|
|
|
21
21
|
# TestDnsDomain - Minitest for DnsDomain node utility.
|
|
22
22
|
class TestDnsDomain < CiscoTestCase
|
|
23
|
+
@skip_unless_supported = 'dnsclient'
|
|
24
|
+
|
|
23
25
|
def setup
|
|
24
26
|
# setup runs at the beginning of each test
|
|
25
27
|
super
|
|
28
|
+
@backup_resolve = backup_resolv_file
|
|
26
29
|
no_dnsdomain_tests
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def teardown
|
|
30
33
|
# teardown runs at the end of each test
|
|
31
34
|
no_dnsdomain_tests
|
|
35
|
+
restore_resolv_file(@backup_resolve)
|
|
32
36
|
super
|
|
33
37
|
end
|
|
34
38
|
|
|
35
39
|
def no_dnsdomain_tests
|
|
36
40
|
# Turn the feature off for a clean test.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
if platform == :ios_xr
|
|
42
|
+
config('no domain list aoeu.com',
|
|
43
|
+
'no domain list asdf.com',
|
|
44
|
+
'no vrf test')
|
|
45
|
+
else
|
|
46
|
+
config('no ip domain-list aoeu.com',
|
|
47
|
+
'no ip domain-list asdf.com',
|
|
48
|
+
'no vrf context test')
|
|
49
|
+
end
|
|
40
50
|
end
|
|
41
51
|
|
|
42
52
|
# TESTS
|
data/tests/test_domain_name.rb
CHANGED
|
@@ -20,23 +20,33 @@ require_relative '../lib/cisco_node_utils/domain_name'
|
|
|
20
20
|
|
|
21
21
|
# TestDomainName - Minitest for DomainName node utility.
|
|
22
22
|
class TestDomainName < CiscoTestCase
|
|
23
|
+
@skip_unless_supported = 'dnsclient'
|
|
24
|
+
|
|
23
25
|
def setup
|
|
24
26
|
# setup runs at the beginning of each test
|
|
25
27
|
super
|
|
28
|
+
@backup_resolve = backup_resolv_file
|
|
26
29
|
no_domainname_test_xyz
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def teardown
|
|
30
33
|
# teardown runs at the end of each test
|
|
31
34
|
no_domainname_test_xyz
|
|
35
|
+
restore_resolv_file(@backup_resolve)
|
|
32
36
|
super
|
|
33
37
|
end
|
|
34
38
|
|
|
35
39
|
def no_domainname_test_xyz
|
|
36
40
|
# Turn the feature off for a clean test.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
if platform == :ios_xr
|
|
42
|
+
config('no domain name test.abc',
|
|
43
|
+
'no domain name test.xyz',
|
|
44
|
+
'no vrf test')
|
|
45
|
+
else
|
|
46
|
+
config('no ip domain-name test.abc',
|
|
47
|
+
'no ip domain-name test.xyz',
|
|
48
|
+
'no vrf context test')
|
|
49
|
+
end
|
|
40
50
|
end
|
|
41
51
|
|
|
42
52
|
# TESTS
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/encapsulation'
|
|
17
|
+
require_relative '../lib/cisco_node_utils/vdc'
|
|
18
|
+
|
|
19
|
+
# TestEncapsulation - Minitest for Encapsulation node utility class
|
|
20
|
+
class TestEncapsulation < CiscoTestCase
|
|
21
|
+
@skip_unless_supported = 'encapsulation'
|
|
22
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
|
23
|
+
|
|
24
|
+
def setup
|
|
25
|
+
super
|
|
26
|
+
return unless @@pre_clean_needed
|
|
27
|
+
|
|
28
|
+
# This provider requires MT-Full and a compatible linecard
|
|
29
|
+
mt_full_interface?
|
|
30
|
+
Vdc.new('default').limit_resource_module_type = 'f3'
|
|
31
|
+
cleanup
|
|
32
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def teardown
|
|
36
|
+
cleanup
|
|
37
|
+
super
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def cleanup
|
|
41
|
+
config_no_warn('no feature vni')
|
|
42
|
+
Encapsulation.encaps.each do |_encap, obj|
|
|
43
|
+
obj.destroy
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# TESTS
|
|
48
|
+
|
|
49
|
+
def test_create_destroy
|
|
50
|
+
profile = 'cisco'
|
|
51
|
+
e = Encapsulation.new(profile)
|
|
52
|
+
assert(Encapsulation.encaps[profile], "profile '#{profile}' not found")
|
|
53
|
+
e.destroy
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_dot1q_map
|
|
57
|
+
e = Encapsulation.new('cisco')
|
|
58
|
+
assert_equal(e.default_dot1q_map, e.dot1q_map)
|
|
59
|
+
|
|
60
|
+
map = ['100-110,150', '5000-5010,5050']
|
|
61
|
+
e.dot1q_map = map
|
|
62
|
+
assert_equal(map, e.dot1q_map)
|
|
63
|
+
|
|
64
|
+
e.dot1q_map = e.default_dot1q_map
|
|
65
|
+
assert_equal(e.default_dot1q_map, e.dot1q_map)
|
|
66
|
+
|
|
67
|
+
e.destroy
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_dot1q_map_negative
|
|
71
|
+
e = Encapsulation.new('cisco')
|
|
72
|
+
assert_raises(CliError) do
|
|
73
|
+
# Test for range imbalance (3 vlans to only 2 vnis)
|
|
74
|
+
e.dot1q_map = ['101-103', '5101-5102']
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
data/tests/test_evpn_vni.rb
CHANGED
|
@@ -21,13 +21,23 @@ require_relative '../lib/cisco_node_utils/evpn_vni'
|
|
|
21
21
|
|
|
22
22
|
# TestEvpnVni - Minitest for EvpnVni class
|
|
23
23
|
class TestEvpnVni < CiscoTestCase
|
|
24
|
+
@skip_unless_supported = 'evpn_vni'
|
|
25
|
+
|
|
24
26
|
def setup
|
|
25
27
|
# Disable feature bgp and no overlay evpn before each test to
|
|
26
28
|
# ensure we are starting with a clean slate for each test.
|
|
27
29
|
super
|
|
28
30
|
config('no feature bgp')
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
# Some platforms complain when nv overlay is not configured
|
|
33
|
+
config_no_warn('no nv overlay evpn')
|
|
34
|
+
|
|
35
|
+
# Some platforms remove the 'evpn' command when 'no nv overlay evpn'
|
|
36
|
+
# is processed, while others must remove it explicitly.
|
|
37
|
+
config_no_warn('no evpn')
|
|
38
|
+
|
|
39
|
+
rescue RuntimeError => e
|
|
40
|
+
hardware_supports_feature?(e.message)
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
def test_create_and_destroy
|
|
@@ -38,11 +48,9 @@ class TestEvpnVni < CiscoTestCase
|
|
|
38
48
|
vni.destroy
|
|
39
49
|
vni_list = EvpnVni.vnis
|
|
40
50
|
refute(vni_list.key?('4096'), 'Error: failed to destroy evpn vni 4096')
|
|
41
|
-
end
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
assert_equal(true, vni_list.empty?, 'VLAN collection is empty')
|
|
52
|
+
rescue RuntimeError => e
|
|
53
|
+
hardware_supports_feature?(e.message)
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def test_route_distinguisher
|
|
@@ -57,6 +65,9 @@ class TestEvpnVni < CiscoTestCase
|
|
|
57
65
|
assert_empty(vni.route_distinguisher,
|
|
58
66
|
'vni route_distinguisher should *NOT* be configured')
|
|
59
67
|
vni.destroy
|
|
68
|
+
|
|
69
|
+
rescue RuntimeError => e
|
|
70
|
+
hardware_supports_feature?(e.message)
|
|
60
71
|
end
|
|
61
72
|
|
|
62
73
|
# test route_target
|
|
@@ -64,7 +75,11 @@ class TestEvpnVni < CiscoTestCase
|
|
|
64
75
|
vni = EvpnVni.new(4096)
|
|
65
76
|
|
|
66
77
|
# test route target both auto and route target both auto evpn
|
|
67
|
-
|
|
78
|
+
if Utils.nexus_i2_image
|
|
79
|
+
opts = [:import, :export]
|
|
80
|
+
else
|
|
81
|
+
opts = [:both, :import, :export]
|
|
82
|
+
end
|
|
68
83
|
|
|
69
84
|
# Master list of communities to test against
|
|
70
85
|
master = ['1.2.3.4:55', '2:2', '55:33', 'auto']
|
|
@@ -86,6 +101,9 @@ class TestEvpnVni < CiscoTestCase
|
|
|
86
101
|
route_target_tester(vni, opts, should, 'Test 4')
|
|
87
102
|
|
|
88
103
|
vni .destroy
|
|
104
|
+
|
|
105
|
+
rescue RuntimeError => e
|
|
106
|
+
hardware_supports_feature?(e.message)
|
|
89
107
|
end
|
|
90
108
|
|
|
91
109
|
def route_target_tester(vni, opts, should, test_id)
|
|
@@ -15,16 +15,19 @@
|
|
|
15
15
|
require_relative 'ciscotest'
|
|
16
16
|
require_relative '../lib/cisco_node_utils/cisco_cmn_utils'
|
|
17
17
|
require_relative '../lib/cisco_node_utils/fabricpath_global'
|
|
18
|
+
require_relative '../lib/cisco_node_utils/interface'
|
|
19
|
+
require_relative '../lib/cisco_node_utils/platform'
|
|
18
20
|
|
|
19
21
|
include Cisco
|
|
20
22
|
|
|
21
23
|
# TestFabricpathGlobal - Minitest for Fabricpath Global node utils
|
|
22
24
|
class TestFabricpathGlobal < CiscoTestCase
|
|
25
|
+
@skip_unless_supported = 'fabricpath'
|
|
26
|
+
|
|
23
27
|
def setup
|
|
24
28
|
# setup runs at the beginning of each test
|
|
25
29
|
super
|
|
26
|
-
|
|
27
|
-
cmd_ref.lookup('fabricpath', 'feature').default_value.nil?
|
|
30
|
+
fabricpath_testenv_setup
|
|
28
31
|
no_feature_fabricpath
|
|
29
32
|
end
|
|
30
33
|
|
|
@@ -35,209 +38,210 @@ class TestFabricpathGlobal < CiscoTestCase
|
|
|
35
38
|
end
|
|
36
39
|
|
|
37
40
|
def no_feature_fabricpath
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
fg = FabricpathGlobal.globals
|
|
42
|
+
fg.each { |_key, elem| elem.destroy } unless fg.empty?
|
|
40
43
|
end
|
|
41
44
|
|
|
42
|
-
def
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
# def no_feature_fabricpath
|
|
46
|
+
# # Turn the feature off for a clean test.
|
|
47
|
+
# config('no feature-set fabricpath')
|
|
48
|
+
# end
|
|
45
49
|
|
|
46
50
|
# TESTS
|
|
47
51
|
|
|
48
|
-
def
|
|
49
|
-
|
|
50
|
-
assert_equal(true, globals.empty?,
|
|
51
|
-
'Globals should be empty for this test')
|
|
52
|
-
end
|
|
52
|
+
def test_create_destroy
|
|
53
|
+
assert_empty(FabricpathGlobal.globals)
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
assert_equal(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'Fabricpath feature should have been enabled')
|
|
60
|
-
refute(FabricpathGlobal.globals.empty?,
|
|
61
|
-
'Globals should not be empty after create')
|
|
62
|
-
end
|
|
55
|
+
# create
|
|
56
|
+
fg = FabricpathGlobal.new('default')
|
|
57
|
+
assert_equal('default', fg.name)
|
|
58
|
+
assert_equal(:enabled, FabricpathGlobal.fabricpath_feature)
|
|
59
|
+
refute_empty(FabricpathGlobal.globals)
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@global.destroy
|
|
68
|
-
# now it should be wiped out
|
|
69
|
-
test_global_collection_empty
|
|
61
|
+
# destroy
|
|
62
|
+
fg.destroy
|
|
63
|
+
assert_empty(FabricpathGlobal.globals)
|
|
70
64
|
end
|
|
71
65
|
|
|
72
66
|
def test_aggregate_multicast_routes
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
fg = FabricpathGlobal.new('default')
|
|
68
|
+
if validate_property_excluded?('fabricpath', 'aggregate_multicast_routes')
|
|
69
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
70
|
+
fg.aggregate_multicast_routes = true
|
|
71
|
+
end
|
|
72
|
+
return
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
fg = FabricpathGlobal.new('default')
|
|
76
|
+
fg.aggregate_multicast_routes = true
|
|
77
|
+
assert(fg.aggregate_multicast_routes,
|
|
78
|
+
'aggregate_multicast_routes: Expected: true')
|
|
79
|
+
|
|
80
|
+
fg.aggregate_multicast_routes = false
|
|
81
|
+
refute(fg.aggregate_multicast_routes,
|
|
82
|
+
'aggregate_multicast_routes: Expected: false')
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
def test_allocate_delay
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@global.allocate_delay = 20
|
|
90
|
-
assert_equal(20, @global.allocate_delay,
|
|
91
|
-
'allocate_delay not set to 20')
|
|
86
|
+
fg = FabricpathGlobal.new('default')
|
|
87
|
+
assert_equal(fg.default_allocate_delay, fg.allocate_delay)
|
|
88
|
+
|
|
89
|
+
fg.allocate_delay = 20
|
|
90
|
+
assert_equal(20, fg.allocate_delay)
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
def test_graceful_merge
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
assert_equal(:disable, @global.graceful_merge,
|
|
101
|
-
'graceful merge not set to disable')
|
|
94
|
+
fg = FabricpathGlobal.new('default')
|
|
95
|
+
assert_equal(fg.default_graceful_merge, fg.graceful_merge)
|
|
96
|
+
|
|
97
|
+
fg.graceful_merge = :disable
|
|
98
|
+
assert_equal(:disable, fg.graceful_merge)
|
|
102
99
|
end
|
|
103
100
|
|
|
104
101
|
def test_linkup_delay_all
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
102
|
+
fg = FabricpathGlobal.new('default')
|
|
103
|
+
assert_equal(fg.default_linkup_delay, fg.linkup_delay)
|
|
104
|
+
|
|
105
|
+
fg.linkup_delay = 25
|
|
106
|
+
assert_equal(25, fg.linkup_delay)
|
|
107
|
+
|
|
108
|
+
if validate_property_excluded?('fabricpath', 'linkup_delay_always')
|
|
109
|
+
assert_raises(Cisco::UnsupportedError) { fg.linkup_delay_always = true }
|
|
110
|
+
else
|
|
111
|
+
assert_equal(fg.default_linkup_delay_always, fg.linkup_delay_always)
|
|
112
|
+
fg.linkup_delay_always = true
|
|
113
|
+
assert(fg.linkup_delay_always, 'linkup_delay_always: Expected: true')
|
|
114
|
+
fg.linkup_delay_always = false
|
|
115
|
+
refute(fg.linkup_delay_always, 'linkup_delay_always: Expected: false')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if validate_property_excluded?('fabricpath', 'linkup_delay_enable')
|
|
119
|
+
assert_raises(Cisco::UnsupportedError) { fg.linkup_delay_enable = true }
|
|
120
|
+
return
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
assert_equal(fg.default_linkup_delay_enable, fg.linkup_delay_enable)
|
|
124
|
+
fg.linkup_delay_enable = true
|
|
125
|
+
assert(fg.linkup_delay_enable, 'linkup_delay_enable: Expected: true')
|
|
126
|
+
fg.linkup_delay_enable = false
|
|
127
|
+
refute(fg.linkup_delay_enable, 'linkup_delay_enable: Expected: false')
|
|
126
128
|
end
|
|
127
129
|
|
|
128
130
|
def test_loadbalance_algorithm
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
fg = FabricpathGlobal.new('default')
|
|
132
|
+
assert_equal(fg.default_loadbalance_algorithm, fg.loadbalance_algorithm)
|
|
133
|
+
|
|
134
|
+
fg.loadbalance_algorithm = 'source'
|
|
135
|
+
assert_equal('source', fg.loadbalance_algorithm)
|
|
136
|
+
if validate_property_excluded?('fabricpath',
|
|
137
|
+
'loadbalance_algorithm_symmetric_support')
|
|
138
|
+
assert_nil(fg.loadbalance_algorithm_symmetric_support)
|
|
139
|
+
return
|
|
140
|
+
end
|
|
141
|
+
fg.loadbalance_algorithm = 'symmetric'
|
|
142
|
+
assert_equal('symmetric', fg.loadbalance_algorithm)
|
|
138
143
|
end
|
|
139
144
|
|
|
140
145
|
def test_loadbalance_multicast
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
# loadbalance_multicast= is a custom setter that takes 2 args:
|
|
147
|
+
# rotate, has_vlan
|
|
148
|
+
fg = FabricpathGlobal.new('default')
|
|
149
|
+
if validate_property_excluded?('fabricpath',
|
|
150
|
+
'loadbalance_multicast_set')
|
|
151
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
152
|
+
(fg.send(:loadbalance_multicast=, 0, 0))
|
|
153
|
+
end
|
|
154
|
+
return
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# default_loadbalance_multicast_rotate: n/a
|
|
158
|
+
assert(fg.loadbalance_multicast_has_vlan,
|
|
159
|
+
'loadbalance_multicast_has_vlan: Expected: true')
|
|
160
|
+
|
|
161
|
+
fg.send(:loadbalance_multicast=, 3, false)
|
|
162
|
+
assert_equal(3, fg.loadbalance_multicast_rotate)
|
|
163
|
+
refute(fg.loadbalance_multicast_has_vlan,
|
|
164
|
+
'loadbalance_multicast_has_vlan: Expected: false')
|
|
158
165
|
end
|
|
159
166
|
|
|
160
167
|
def test_loadbalance_unicast
|
|
161
|
-
|
|
162
|
-
#
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"unicast rotate should now be 3
|
|
181
|
-
but is #{@global.loadbalance_unicast_rotate}") unless
|
|
182
|
-
n5k6k_platforms?
|
|
183
|
-
refute(@global.loadbalance_unicast_has_vlan,
|
|
184
|
-
"unicast include-vlan should now be false
|
|
185
|
-
but is #{@global.loadbalance_unicast_has_vlan}")
|
|
168
|
+
# loadbalance_unicast= is a custom setter that takes up to 3 args:
|
|
169
|
+
# layer, rotate, has_vlan (rotate is not supported on some plats)
|
|
170
|
+
|
|
171
|
+
fg = FabricpathGlobal.new('default')
|
|
172
|
+
assert_equal(fg.default_loadbalance_unicast_layer,
|
|
173
|
+
fg.loadbalance_unicast_layer)
|
|
174
|
+
|
|
175
|
+
# default_loadbalance_unicast_rotate: n/a
|
|
176
|
+
assert_equal(fg.default_loadbalance_unicast_has_vlan,
|
|
177
|
+
fg.loadbalance_unicast_has_vlan)
|
|
178
|
+
|
|
179
|
+
fg.send(:loadbalance_unicast=, 'layer4', 3, false)
|
|
180
|
+
assert_equal('layer4', fg.loadbalance_unicast_layer)
|
|
181
|
+
unless validate_property_excluded?('fabricpath',
|
|
182
|
+
'loadbalance_unicast_rotate')
|
|
183
|
+
assert_equal(3, fg.loadbalance_unicast_rotate)
|
|
184
|
+
end
|
|
185
|
+
refute(fg.loadbalance_unicast_has_vlan,
|
|
186
|
+
'loadbalance_unicast_has_vlan: Expected: false')
|
|
186
187
|
end
|
|
187
188
|
|
|
188
189
|
def test_mode
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
@global.mode = 'normal'
|
|
197
|
-
assert_equal('normal', @global.mode,
|
|
198
|
-
'mode not getting set to transit')
|
|
190
|
+
fg = FabricpathGlobal.new('default')
|
|
191
|
+
assert_equal(fg.default_mode, fg.mode)
|
|
192
|
+
|
|
193
|
+
fg.mode = 'transit'
|
|
194
|
+
assert_equal('transit', fg.mode)
|
|
195
|
+
fg.mode = 'normal'
|
|
196
|
+
assert_equal('normal', fg.mode)
|
|
199
197
|
end
|
|
200
198
|
|
|
201
199
|
def test_switch_id
|
|
202
|
-
|
|
203
|
-
# auto_id =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
fg = FabricpathGlobal.new('default')
|
|
201
|
+
# auto_id = fg.switch_id
|
|
202
|
+
# switch_id does not have a default
|
|
203
|
+
fg.switch_id = 100
|
|
204
|
+
assert_equal(100, fg.switch_id)
|
|
207
205
|
end
|
|
208
206
|
|
|
209
207
|
def test_transition_delay
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
@global.transition_delay = 20
|
|
216
|
-
assert_equal(20, @global.transition_delay,
|
|
217
|
-
'transition_delay not set to 20')
|
|
208
|
+
fg = FabricpathGlobal.new('default')
|
|
209
|
+
assert_equal(fg.default_transition_delay, fg.transition_delay)
|
|
210
|
+
|
|
211
|
+
fg.transition_delay = 20
|
|
212
|
+
assert_equal(20, fg.transition_delay)
|
|
218
213
|
end
|
|
219
214
|
|
|
220
215
|
def test_ttl_multicast
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
216
|
+
fg = FabricpathGlobal.new('default')
|
|
217
|
+
if validate_property_excluded?('fabricpath', 'ttl_multicast')
|
|
218
|
+
assert_raises(Cisco::UnsupportedError) { fg.ttl_multicast = 40 }
|
|
219
|
+
return
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
assert_equal(fg.default_ttl_multicast, fg.ttl_multicast)
|
|
223
|
+
fg.ttl_multicast = 16
|
|
224
|
+
assert_equal(16, fg.ttl_multicast)
|
|
230
225
|
end
|
|
231
226
|
|
|
232
227
|
def test_ttl_unicast
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
assert_equal(40,
|
|
241
|
-
|
|
228
|
+
fg = FabricpathGlobal.new('default')
|
|
229
|
+
if validate_property_excluded?('fabricpath', 'ttl_unicast')
|
|
230
|
+
assert_raises(Cisco::UnsupportedError) { fg.ttl_unicast = 40 }
|
|
231
|
+
return
|
|
232
|
+
end
|
|
233
|
+
assert_equal(fg.default_ttl_unicast, fg.ttl_unicast)
|
|
234
|
+
fg.ttl_unicast = 40
|
|
235
|
+
assert_equal(40, fg.ttl_unicast)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def test_interface_switchport_mode
|
|
239
|
+
i = Interface.new(interfaces[0])
|
|
240
|
+
i.switchport_mode = :fabricpath
|
|
241
|
+
assert_equal(:fabricpath, i.switchport_mode)
|
|
242
|
+
|
|
243
|
+
i.switchport_mode = :trunk
|
|
244
|
+
assert_equal(:trunk, i.switchport_mode)
|
|
245
|
+
config("default interface #{interfaces[0]}")
|
|
242
246
|
end
|
|
243
247
|
end
|