cisco_node_utils 1.1.0 → 1.2.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 -1
- data/CHANGELOG.md +126 -1
- data/README.md +19 -12
- data/Rakefile +1 -0
- data/bin/git/hooks/commit-msg/enforce_style +8 -0
- data/cisco_node_utils.gemspec +4 -3
- data/docs/README-develop-best-practices.md +127 -109
- data/docs/README-develop-node-utils-APIs.md +47 -39
- data/docs/template-router.rb +3 -7
- data/lib/.rubocop.yml +4 -4
- data/lib/cisco_node_utils.rb +1 -1
- data/lib/cisco_node_utils/aaa_authentication_login.rb +96 -0
- data/lib/cisco_node_utils/aaa_authentication_login_service.rb +133 -0
- data/lib/cisco_node_utils/aaa_authorization_service.rb +150 -0
- data/lib/cisco_node_utils/ace.rb +196 -0
- data/lib/cisco_node_utils/acl.rb +100 -0
- data/lib/cisco_node_utils/bgp.rb +301 -163
- data/lib/cisco_node_utils/bgp_af.rb +187 -19
- data/lib/cisco_node_utils/bgp_neighbor.rb +18 -33
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +25 -48
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +23 -4
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +593 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +31 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +43 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +242 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +164 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +131 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +179 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +172 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +35 -0
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/images.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +339 -0
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +28 -0
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +61 -0
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +54 -0
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +13 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +14 -0
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +74 -0
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +69 -0
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +64 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +14 -0
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +5 -0
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +72 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +23 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +50 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +51 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +55 -0
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +11 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/system.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +49 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +35 -0
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +6 -0
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +56 -0
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +76 -0
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +197 -0
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +88 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +60 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +39 -0
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +13 -0
- data/lib/cisco_node_utils/command_reference.rb +359 -187
- data/lib/cisco_node_utils/configparser_lib.rb +1 -1
- data/lib/cisco_node_utils/dns_domain.rb +19 -5
- data/lib/cisco_node_utils/domain_name.rb +4 -8
- data/lib/cisco_node_utils/evpn_vni.rb +157 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +388 -0
- data/lib/cisco_node_utils/fabricpath_topology.rb +150 -0
- data/lib/cisco_node_utils/feature.rb +111 -0
- data/lib/cisco_node_utils/interface.rb +390 -97
- data/lib/cisco_node_utils/interface_channel_group.rb +124 -0
- data/lib/cisco_node_utils/interface_ospf.rb +11 -34
- data/lib/cisco_node_utils/interface_portchannel.rb +157 -0
- data/lib/cisco_node_utils/interface_service_vni.rb +132 -0
- data/lib/cisco_node_utils/name_server.rb +1 -1
- data/lib/cisco_node_utils/node.rb +55 -249
- data/lib/cisco_node_utils/node_util.rb +5 -1
- data/lib/cisco_node_utils/ntp_config.rb +2 -2
- data/lib/cisco_node_utils/ntp_server.rb +14 -5
- data/lib/cisco_node_utils/overlay_global.rb +153 -0
- data/lib/cisco_node_utils/pim.rb +124 -0
- data/lib/cisco_node_utils/pim_group_list.rb +108 -0
- data/lib/cisco_node_utils/pim_rp_address.rb +102 -0
- data/lib/cisco_node_utils/platform.rb +8 -9
- data/lib/cisco_node_utils/portchannel_global.rb +277 -0
- data/lib/cisco_node_utils/radius_global.rb +9 -19
- data/lib/cisco_node_utils/radius_server.rb +31 -41
- data/lib/cisco_node_utils/radius_server_group.rb +117 -0
- data/lib/cisco_node_utils/router_ospf.rb +1 -1
- data/lib/cisco_node_utils/router_ospf_vrf.rb +14 -19
- data/lib/cisco_node_utils/snmp_notification_receiver.rb +158 -0
- data/lib/cisco_node_utils/snmpcommunity.rb +3 -5
- data/lib/cisco_node_utils/snmpgroup.rb +1 -1
- data/lib/cisco_node_utils/snmpnotification.rb +57 -0
- data/lib/cisco_node_utils/snmpserver.rb +8 -17
- data/lib/cisco_node_utils/snmpuser.rb +67 -28
- data/lib/cisco_node_utils/syslog_server.rb +3 -9
- data/lib/cisco_node_utils/syslog_settings.rb +2 -10
- data/lib/cisco_node_utils/tacacs_server.rb +9 -14
- data/lib/cisco_node_utils/tacacs_server_group.rb +145 -0
- data/lib/cisco_node_utils/tacacs_server_host.rb +5 -9
- data/lib/cisco_node_utils/vdc.rb +88 -0
- data/lib/cisco_node_utils/version.rb +5 -2
- data/lib/cisco_node_utils/vlan.rb +71 -8
- data/lib/cisco_node_utils/vni.rb +227 -0
- data/lib/cisco_node_utils/vpc.rb +377 -0
- data/lib/cisco_node_utils/vrf.rb +60 -9
- data/lib/cisco_node_utils/vrf_af.rb +191 -0
- data/lib/cisco_node_utils/vtp.rb +8 -6
- data/lib/cisco_node_utils/vxlan_vtep.rb +151 -0
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +234 -0
- data/lib/cisco_node_utils/yum.rb +1 -1
- data/tests/.rubocop.yml +1 -1
- data/tests/basetest.rb +16 -7
- data/tests/ciscotest.rb +55 -13
- data/tests/cmd_config.yaml +2 -2
- data/tests/platform_info.rb +3 -2
- data/tests/test_aaa_authentication_login.rb +219 -0
- data/tests/test_aaa_authentication_login_service.rb +759 -0
- data/tests/test_aaa_authorization_service.rb +1041 -0
- data/tests/test_ace.rb +160 -0
- data/tests/test_acl.rb +176 -0
- data/tests/test_bgp_af.rb +269 -13
- data/tests/test_bgp_neighbor.rb +38 -40
- data/tests/test_bgp_neighbor_af.rb +92 -32
- data/tests/test_command_config.rb +5 -5
- data/tests/test_command_reference.rb +284 -101
- data/tests/test_dns_domain.rb +1 -1
- data/tests/test_domain_name.rb +1 -1
- data/tests/test_evpn_vni.rb +106 -0
- data/tests/test_fabricpath_global.rb +243 -0
- data/tests/test_fabricpath_topology.rb +98 -0
- data/tests/test_interface.rb +292 -74
- data/tests/test_interface_channel_group.rb +74 -0
- data/tests/test_interface_ospf.rb +9 -4
- data/tests/test_interface_portchannel.rb +105 -0
- data/tests/test_interface_service_vni.rb +232 -0
- data/tests/test_interface_svi.rb +77 -62
- data/tests/test_interface_switchport.rb +17 -5
- data/tests/test_name_server.rb +1 -1
- data/tests/test_node.rb +1 -1
- data/tests/test_node_ext.rb +10 -20
- data/tests/test_ntp_config.rb +1 -1
- data/tests/test_ntp_server.rb +18 -6
- data/tests/test_overlay_global.rb +102 -0
- data/tests/test_pim.rb +177 -0
- data/tests/test_pim_group_list.rb +181 -0
- data/tests/test_pim_rp_address.rb +153 -0
- data/tests/test_platform.rb +3 -3
- data/tests/test_portchannel_global.rb +202 -0
- data/tests/test_radius_global.rb +1 -1
- data/tests/test_radius_server.rb +92 -57
- data/tests/test_radius_server_group.rb +149 -0
- data/tests/test_router_bgp.rb +283 -112
- data/tests/test_router_ospf.rb +2 -2
- data/tests/test_router_ospf_vrf.rb +4 -4
- data/tests/test_snmp_notification_receiver.rb +167 -0
- data/tests/test_snmpcommunity.rb +1 -1
- data/tests/test_snmpgroup.rb +1 -1
- data/tests/test_snmpnotification.rb +72 -0
- data/tests/test_snmpserver.rb +29 -105
- data/tests/test_snmpuser.rb +32 -30
- data/tests/test_syslog_server.rb +36 -10
- data/tests/test_syslog_settings.rb +1 -1
- data/tests/test_tacacs_server.rb +1 -1
- data/tests/test_tacacs_server_group.rb +405 -0
- data/tests/test_tacacs_server_host.rb +1 -1
- data/tests/test_vdc.rb +78 -0
- data/tests/test_vlan.rb +74 -19
- data/tests/test_vlan_mt_full.rb +95 -0
- data/tests/test_vni.rb +106 -0
- data/tests/test_vpc.rb +361 -0
- data/tests/test_vrf.rb +172 -29
- data/tests/test_vtp.rb +1 -1
- data/tests/test_vxlan_vtep.rb +214 -0
- data/tests/test_vxlan_vtep_vni.rb +201 -0
- data/tests/test_yum.rb +1 -1
- metadata +120 -11
- data/lib/cisco_node_utils/README_YAML.md +0 -325
- data/lib/cisco_node_utils/command_reference_common.yaml +0 -1051
- data/lib/cisco_node_utils/command_reference_common_bgp.yaml +0 -535
- data/lib/cisco_node_utils/command_reference_n3064.yaml +0 -13
- data/lib/cisco_node_utils/command_reference_n7k.yaml +0 -52
- data/lib/cisco_node_utils/command_reference_n9k.yaml +0 -26
- data/tests/platform_info.yaml +0 -10
data/tests/test_dns_domain.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Minitest for DnsDomain class
|
|
3
3
|
#
|
|
4
|
-
# Copyright (c) 2014-
|
|
4
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
data/tests/test_domain_name.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Minitest for DomainName class
|
|
3
3
|
#
|
|
4
|
-
# Copyright (c) 2014-
|
|
4
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Evpn Vni Unit Tests
|
|
2
|
+
#
|
|
3
|
+
# Andi Shen, December, 2015
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
|
|
19
|
+
require_relative 'ciscotest'
|
|
20
|
+
require_relative '../lib/cisco_node_utils/evpn_vni'
|
|
21
|
+
|
|
22
|
+
# TestEvpnVni - Minitest for EvpnVni class
|
|
23
|
+
class TestEvpnVni < CiscoTestCase
|
|
24
|
+
def setup
|
|
25
|
+
# Disable feature bgp and no overlay evpn before each test to
|
|
26
|
+
# ensure we are starting with a clean slate for each test.
|
|
27
|
+
super
|
|
28
|
+
config('no feature bgp')
|
|
29
|
+
config('no nv overlay evpn')
|
|
30
|
+
config('no evpn')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_create_and_destroy
|
|
34
|
+
vni = EvpnVni.new(4096)
|
|
35
|
+
vni_list = EvpnVni.vnis
|
|
36
|
+
assert(vni_list.key?('4096'), 'Error: failed to create evpn vni 4096')
|
|
37
|
+
|
|
38
|
+
vni.destroy
|
|
39
|
+
vni_list = EvpnVni.vnis
|
|
40
|
+
refute(vni_list.key?('4096'), 'Error: failed to destroy evpn vni 4096')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_vni_collection
|
|
44
|
+
vni_list = EvpnVni.vnis
|
|
45
|
+
assert_equal(true, vni_list.empty?, 'VLAN collection is empty')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_route_distinguisher
|
|
49
|
+
vni = EvpnVni.new(4096)
|
|
50
|
+
vni.route_distinguisher = 'auto'
|
|
51
|
+
assert_equal('auto', vni.route_distinguisher,
|
|
52
|
+
"vni route_distinguisher should be set to 'auto'")
|
|
53
|
+
vni.route_distinguisher = '1:1'
|
|
54
|
+
assert_equal('1:1', vni.route_distinguisher,
|
|
55
|
+
"vni route_distinguisher should be set to '1:1'")
|
|
56
|
+
vni.route_distinguisher = vni.default_route_distinguisher
|
|
57
|
+
assert_empty(vni.route_distinguisher,
|
|
58
|
+
'vni route_distinguisher should *NOT* be configured')
|
|
59
|
+
vni.destroy
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# test route_target
|
|
63
|
+
def test_route_target
|
|
64
|
+
vni = EvpnVni.new(4096)
|
|
65
|
+
|
|
66
|
+
# test route target both auto and route target both auto evpn
|
|
67
|
+
opts = [:both, :import, :export]
|
|
68
|
+
|
|
69
|
+
# Master list of communities to test against
|
|
70
|
+
master = ['1.2.3.4:55', '2:2', '55:33', 'auto']
|
|
71
|
+
|
|
72
|
+
# Test 1: both/import/export when no commands are present. Each target
|
|
73
|
+
should = master.clone
|
|
74
|
+
route_target_tester(vni, opts, should, 'Test 1')
|
|
75
|
+
|
|
76
|
+
# Test 2: remove half of the entries
|
|
77
|
+
should = ['2:2', 'auto']
|
|
78
|
+
route_target_tester(vni, opts, should, 'Test 2')
|
|
79
|
+
|
|
80
|
+
# Test 3: restore the removed entries
|
|
81
|
+
should = master.clone
|
|
82
|
+
route_target_tester(vni, opts, should, 'Test 3')
|
|
83
|
+
|
|
84
|
+
# Test 4: 'default'
|
|
85
|
+
should = vni.default_route_target_import
|
|
86
|
+
route_target_tester(vni, opts, should, 'Test 4')
|
|
87
|
+
|
|
88
|
+
vni .destroy
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def route_target_tester(vni, opts, should, test_id)
|
|
92
|
+
# First configure all four property types
|
|
93
|
+
opts.each do |opt|
|
|
94
|
+
# non-evpn
|
|
95
|
+
vni.send("route_target_#{opt}=", should)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Now check the results
|
|
99
|
+
opts.each do |opt|
|
|
100
|
+
# non-evpn
|
|
101
|
+
result = vni.send("route_target_#{opt}")
|
|
102
|
+
assert_equal(should, result,
|
|
103
|
+
"#{test_id} : route_target_#{opt}")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/cisco_cmn_utils'
|
|
17
|
+
require_relative '../lib/cisco_node_utils/fabricpath_global'
|
|
18
|
+
|
|
19
|
+
include Cisco
|
|
20
|
+
|
|
21
|
+
# TestFabricpathGlobal - Minitest for Fabricpath Global node utils
|
|
22
|
+
class TestFabricpathGlobal < CiscoTestCase
|
|
23
|
+
def setup
|
|
24
|
+
# setup runs at the beginning of each test
|
|
25
|
+
super
|
|
26
|
+
skip("Test not supported on #{node.product_id}") if
|
|
27
|
+
cmd_ref.lookup('fabricpath', 'feature').default_value.nil?
|
|
28
|
+
no_feature_fabricpath
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def teardown
|
|
32
|
+
# teardown runs at the end of each test
|
|
33
|
+
no_feature_fabricpath
|
|
34
|
+
super
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def no_feature_fabricpath
|
|
38
|
+
# Turn the feature off for a clean test.
|
|
39
|
+
config('no feature-set fabricpath')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def n5k6k_platforms?
|
|
43
|
+
/N[56]K/ =~ node.product_id
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# TESTS
|
|
47
|
+
|
|
48
|
+
def test_global_collection_empty
|
|
49
|
+
globals = FabricpathGlobal.globals
|
|
50
|
+
assert_equal(true, globals.empty?,
|
|
51
|
+
'Globals should be empty for this test')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_global_create
|
|
55
|
+
@global = FabricpathGlobal.new('default')
|
|
56
|
+
assert_equal(true, @global.name == 'default',
|
|
57
|
+
"Global name not set correctly #{@global.name}")
|
|
58
|
+
assert_equal(:enabled, FabricpathGlobal.fabricpath_feature,
|
|
59
|
+
'Fabricpath feature should have been enabled')
|
|
60
|
+
refute(FabricpathGlobal.globals.empty?,
|
|
61
|
+
'Globals should not be empty after create')
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_global_destroy
|
|
65
|
+
# create and test again
|
|
66
|
+
test_global_create
|
|
67
|
+
@global.destroy
|
|
68
|
+
# now it should be wiped out
|
|
69
|
+
test_global_collection_empty
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_aggregate_multicast_routes
|
|
73
|
+
return if n5k6k_platforms?
|
|
74
|
+
@global = FabricpathGlobal.new('default')
|
|
75
|
+
@global.aggregate_multicast_routes = true
|
|
76
|
+
assert(@global.aggregate_multicast_routes,
|
|
77
|
+
'Aggregate multicast routes not set')
|
|
78
|
+
@global.aggregate_multicast_routes = false
|
|
79
|
+
refute(@global.aggregate_multicast_routes,
|
|
80
|
+
'Aggregate multicast routes not reset')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def test_allocate_delay
|
|
84
|
+
@global = FabricpathGlobal.new('default')
|
|
85
|
+
# test default value
|
|
86
|
+
assert_equal(@global.default_allocate_delay,
|
|
87
|
+
@global.allocate_delay,
|
|
88
|
+
'Default allocate_delay not set correctly')
|
|
89
|
+
@global.allocate_delay = 20
|
|
90
|
+
assert_equal(20, @global.allocate_delay,
|
|
91
|
+
'allocate_delay not set to 20')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_graceful_merge
|
|
95
|
+
@global = FabricpathGlobal.new('default')
|
|
96
|
+
# test default value
|
|
97
|
+
assert_equal(:enable, @global.graceful_merge,
|
|
98
|
+
'Default graceful_merge not set correctly')
|
|
99
|
+
@global.graceful_merge = :disable
|
|
100
|
+
assert_equal(:disable, @global.graceful_merge,
|
|
101
|
+
'graceful merge not set to disable')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_linkup_delay_all
|
|
105
|
+
@global = FabricpathGlobal.new('default')
|
|
106
|
+
# test default value
|
|
107
|
+
assert_equal(@global.default_linkup_delay,
|
|
108
|
+
@global.linkup_delay,
|
|
109
|
+
'Default linkup_delay not set correctly')
|
|
110
|
+
@global.linkup_delay = 25
|
|
111
|
+
assert_equal(25, @global.linkup_delay,
|
|
112
|
+
'linkup_delay not set to 25')
|
|
113
|
+
|
|
114
|
+
return if n5k6k_platforms?
|
|
115
|
+
|
|
116
|
+
refute(@global.linkup_delay_always,
|
|
117
|
+
'linkup_delay_always should not be set by default')
|
|
118
|
+
@global.linkup_delay_always = true
|
|
119
|
+
assert(@global.linkup_delay_always,
|
|
120
|
+
'linkup_delay_always is not getting set')
|
|
121
|
+
|
|
122
|
+
@global.linkup_delay_enable = true
|
|
123
|
+
@global.linkup_delay_enable = false
|
|
124
|
+
refute(@global.linkup_delay_enable,
|
|
125
|
+
'linkup_delay is not getting disabled')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_loadbalance_algorithm
|
|
129
|
+
@global = FabricpathGlobal.new('default')
|
|
130
|
+
# test default value
|
|
131
|
+
check_val = n5k6k_platforms? ? 'source-destination' : 'symmetric'
|
|
132
|
+
assert_equal(check_val, @global.loadbalance_algorithm,
|
|
133
|
+
"default algo should be #{check_val} but is
|
|
134
|
+
#{@global.loadbalance_algorithm}")
|
|
135
|
+
@global.loadbalance_algorithm = 'source'
|
|
136
|
+
assert_equal('source', @global.loadbalance_algorithm,
|
|
137
|
+
'algo not getting set to source-destination')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_loadbalance_multicast
|
|
141
|
+
return if n5k6k_platforms?
|
|
142
|
+
@global = FabricpathGlobal.new('default')
|
|
143
|
+
# test default values first
|
|
144
|
+
assert_equal(@global.default_loadbalance_multicast_rotate,
|
|
145
|
+
@global.loadbalance_multicast_rotate,
|
|
146
|
+
"default mcast rotate should be 6
|
|
147
|
+
but is #{@global.loadbalance_multicast_rotate}")
|
|
148
|
+
assert(@global.loadbalance_multicast_has_vlan,
|
|
149
|
+
"default mcast include-vlan should be true
|
|
150
|
+
but is #{@global.loadbalance_multicast_has_vlan}")
|
|
151
|
+
@global.send(:loadbalance_multicast=, 3, false)
|
|
152
|
+
assert_equal(3, @global.loadbalance_multicast_rotate,
|
|
153
|
+
"mcast rotate should now be 3
|
|
154
|
+
but is #{@global.loadbalance_multicast_rotate}")
|
|
155
|
+
refute(@global.loadbalance_multicast_has_vlan,
|
|
156
|
+
"mcast include-vlan should now be false
|
|
157
|
+
but is #{@global.loadbalance_multicast_has_vlan}")
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_loadbalance_unicast
|
|
161
|
+
@global = FabricpathGlobal.new('default')
|
|
162
|
+
# test default values first
|
|
163
|
+
assert_equal(@global.default_loadbalance_unicast_layer,
|
|
164
|
+
@global.loadbalance_unicast_layer,
|
|
165
|
+
"default unicast layer should be mixed
|
|
166
|
+
but is #{@global.loadbalance_unicast_layer}")
|
|
167
|
+
assert_equal(@global.default_loadbalance_unicast_rotate,
|
|
168
|
+
@global.loadbalance_unicast_rotate,
|
|
169
|
+
"default unicast rotate not set correctly
|
|
170
|
+
but is set to #{@global.loadbalance_unicast_rotate}") unless
|
|
171
|
+
n5k6k_platforms?
|
|
172
|
+
assert(@global.loadbalance_unicast_has_vlan,
|
|
173
|
+
"default unicast include-vlan should be true
|
|
174
|
+
but is #{@global.loadbalance_unicast_has_vlan}")
|
|
175
|
+
@global.send(:loadbalance_unicast=, 'layer4', 3, false)
|
|
176
|
+
assert_equal('layer4', @global.loadbalance_unicast_layer,
|
|
177
|
+
"unicast layer should be layer4
|
|
178
|
+
but is #{@global.loadbalance_unicast_layer}")
|
|
179
|
+
assert_equal(3, @global.loadbalance_unicast_rotate,
|
|
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}")
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def test_mode
|
|
189
|
+
@global = FabricpathGlobal.new('default')
|
|
190
|
+
# test default value
|
|
191
|
+
assert_equal(@global.default_mode, @global.mode,
|
|
192
|
+
"default mode should be normal but is #{@global.mode}")
|
|
193
|
+
@global.mode = 'transit'
|
|
194
|
+
assert_equal('transit', @global.mode,
|
|
195
|
+
'mode not getting set to transit')
|
|
196
|
+
@global.mode = 'normal'
|
|
197
|
+
assert_equal('normal', @global.mode,
|
|
198
|
+
'mode not getting set to transit')
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def test_switch_id
|
|
202
|
+
@global = FabricpathGlobal.new('default')
|
|
203
|
+
# auto_id = @global.switch_id
|
|
204
|
+
@global.switch_id = 100
|
|
205
|
+
assert_equal(100, @global.switch_id,
|
|
206
|
+
'switchid not getting set to 100')
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def test_transition_delay
|
|
210
|
+
@global = FabricpathGlobal.new('default')
|
|
211
|
+
# test default value
|
|
212
|
+
assert_equal(@global.default_transition_delay,
|
|
213
|
+
@global.transition_delay,
|
|
214
|
+
'Default allocate_delay not set correctly')
|
|
215
|
+
@global.transition_delay = 20
|
|
216
|
+
assert_equal(20, @global.transition_delay,
|
|
217
|
+
'transition_delay not set to 20')
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def test_ttl_multicast
|
|
221
|
+
return if n5k6k_platforms?
|
|
222
|
+
@global = FabricpathGlobal.new('default')
|
|
223
|
+
# test default value
|
|
224
|
+
assert_equal(@global.default_ttl_multicast,
|
|
225
|
+
@global.ttl_multicast,
|
|
226
|
+
'Default multicast ttl not set correctly')
|
|
227
|
+
@global.ttl_multicast = 16
|
|
228
|
+
assert_equal(16, @global.ttl_multicast,
|
|
229
|
+
'multicast ttl not getting set to 16')
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def test_ttl_unicast
|
|
233
|
+
return if n5k6k_platforms?
|
|
234
|
+
@global = FabricpathGlobal.new('default')
|
|
235
|
+
# test default value
|
|
236
|
+
assert_equal(@global.default_ttl_unicast,
|
|
237
|
+
@global.ttl_unicast,
|
|
238
|
+
'Default unicast ttl not set correctly')
|
|
239
|
+
@global.ttl_unicast = 40
|
|
240
|
+
assert_equal(40, @global.ttl_unicast,
|
|
241
|
+
'unicast ttl not getting set to 40')
|
|
242
|
+
end
|
|
243
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/cisco_cmn_utils'
|
|
17
|
+
require_relative '../lib/cisco_node_utils/fabricpath_topology'
|
|
18
|
+
|
|
19
|
+
include Cisco
|
|
20
|
+
|
|
21
|
+
# TestFabricpathTopo - Minitest for Fabricpath Topo node utils
|
|
22
|
+
class TestFabricpathTopo < CiscoTestCase
|
|
23
|
+
def setup
|
|
24
|
+
# setup runs at the beginning of each test
|
|
25
|
+
super
|
|
26
|
+
skip("Test not supported on #{node.product_id}") if
|
|
27
|
+
cmd_ref.lookup('fabricpath', 'feature').default_value.nil?
|
|
28
|
+
no_feature_fabricpath
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def teardown
|
|
32
|
+
# teardown runs at the end of each test
|
|
33
|
+
no_feature_fabricpath
|
|
34
|
+
super
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def no_feature_fabricpath
|
|
38
|
+
# Turn the feature off for a clean test.
|
|
39
|
+
config('no feature-set fabricpath')
|
|
40
|
+
config('no install feature-set fabricpath')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# TESTS
|
|
44
|
+
|
|
45
|
+
def test_topo_create
|
|
46
|
+
@topo = FabricpathTopo.new('1')
|
|
47
|
+
@topo.topo_name = 'Topo-1'
|
|
48
|
+
assert_equal('Topo-1', @topo.topo_name,
|
|
49
|
+
"Topo name not set correctly #{@topo.topo_name}")
|
|
50
|
+
assert_equal(:enabled, @topo.fabricpath_feature,
|
|
51
|
+
'Fabricpath feature should have been enabled')
|
|
52
|
+
topos = FabricpathTopo.topos
|
|
53
|
+
assert_equal(2, topos.length,
|
|
54
|
+
'Number of Topos should be 2')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_topo_destroy
|
|
58
|
+
# create and test again
|
|
59
|
+
test_topo_create
|
|
60
|
+
# puts "deleting Topo #{@topo.topo_name}"
|
|
61
|
+
@topo.destroy
|
|
62
|
+
# now it should be wiped out
|
|
63
|
+
topos = FabricpathTopo.topos
|
|
64
|
+
assert_equal(1, topos.length,
|
|
65
|
+
'Number of Topos should be 1 (default)')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_invalid_topo_id
|
|
69
|
+
e = assert_raises(CliError) { FabricpathTopo.new('64') }
|
|
70
|
+
assert_match(/Invalid number.* range/, e.message)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_member_vlans
|
|
74
|
+
@topo = FabricpathTopo.new('25')
|
|
75
|
+
topos = FabricpathTopo.topos
|
|
76
|
+
default_topo = topos['0']
|
|
77
|
+
default_topo_vlans = default_topo.member_vlans.first
|
|
78
|
+
# puts "vlans in default topo is #{default_topo_vlans}"
|
|
79
|
+
assert_equal('1..4096', default_topo_vlans,
|
|
80
|
+
'default topo should have all VLANS')
|
|
81
|
+
@topo.member_vlans = ['2..10', '100', '500']
|
|
82
|
+
topo25_vlans = @topo.member_vlans.join(',')
|
|
83
|
+
# puts "Topo #{@topo.topo_name} member vlans #{topo25_vlans}"
|
|
84
|
+
assert_equal('2..10,100,500', topo25_vlans,
|
|
85
|
+
'Topo 25 not getting set with member vlans')
|
|
86
|
+
default_topo_vlans = default_topo.member_vlans.join(',')
|
|
87
|
+
# puts "vlans in default topo is #{default_topo_vlans}"
|
|
88
|
+
assert_equal('1,11..99,101..499,501..4096', default_topo_vlans,
|
|
89
|
+
'default topo should now have the set
|
|
90
|
+
1,11..99,101..499,501..4096')
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_member_vlans_invalid
|
|
94
|
+
@topo = FabricpathTopo.new('25')
|
|
95
|
+
e = assert_raises(RuntimeError) { @topo.member_vlans = ['1..4095'] }
|
|
96
|
+
assert_match(%r{Invalid value/range}, e.message)
|
|
97
|
+
end
|
|
98
|
+
end
|