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_interface_svi.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -19,6 +19,27 @@ include Cisco
|
|
|
19
19
|
|
|
20
20
|
# TestSvi - Minitest for Interface configuration of SVI interfaces.
|
|
21
21
|
class TestSvi < CiscoTestCase
|
|
22
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
|
23
|
+
|
|
24
|
+
def remove_all_svis
|
|
25
|
+
Interface.interfaces.each do |int, obj|
|
|
26
|
+
next unless int[/vlan/]
|
|
27
|
+
next if int[/vlan1/]
|
|
28
|
+
obj.destroy
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def setup
|
|
33
|
+
super
|
|
34
|
+
remove_all_svis if @@pre_clean_needed
|
|
35
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def teardown
|
|
39
|
+
super
|
|
40
|
+
remove_all_svis
|
|
41
|
+
end
|
|
42
|
+
|
|
22
43
|
def cmd_ref_autostate
|
|
23
44
|
ref = cmd_ref.lookup('interface', 'svi_autostate')
|
|
24
45
|
assert(ref, 'Error, reference not found for autostate')
|
|
@@ -35,11 +56,17 @@ class TestSvi < CiscoTestCase
|
|
|
35
56
|
end
|
|
36
57
|
end
|
|
37
58
|
|
|
59
|
+
def skip_autostate_test?
|
|
60
|
+
skip('svi autostate properties are not supported on this platform') if
|
|
61
|
+
node.product_id =~ /N(5|6)K/
|
|
62
|
+
end
|
|
63
|
+
|
|
38
64
|
def system_default_svi_autostate(state='')
|
|
39
65
|
config("#{state}system default interface-vlan autostate")
|
|
40
66
|
end
|
|
41
67
|
|
|
42
|
-
def
|
|
68
|
+
def test_prop_nil_when_ethernet
|
|
69
|
+
skip_autostate_test?
|
|
43
70
|
intf = Interface.new(interfaces[0])
|
|
44
71
|
assert_nil(intf.svi_autostate,
|
|
45
72
|
'Error: svi_autostate should be nil when interface is ethernet')
|
|
@@ -47,7 +74,7 @@ class TestSvi < CiscoTestCase
|
|
|
47
74
|
'Error: svi_management should be nil when interface is ethernet')
|
|
48
75
|
end
|
|
49
76
|
|
|
50
|
-
def
|
|
77
|
+
def test_create_valid
|
|
51
78
|
svi = Interface.new('Vlan23')
|
|
52
79
|
s = @device.cmd('show run interface all | inc Vlan')
|
|
53
80
|
cmd = 'interface Vlan1'
|
|
@@ -63,25 +90,25 @@ class TestSvi < CiscoTestCase
|
|
|
63
90
|
refute(s.include?(cmd), 'Error: svi Vlan23 still configured')
|
|
64
91
|
end
|
|
65
92
|
|
|
66
|
-
def
|
|
93
|
+
def test_create_vlan_invalid
|
|
67
94
|
assert_raises(CliError) { Interface.new('10.1.1.1') }
|
|
68
95
|
end
|
|
69
96
|
|
|
70
|
-
def
|
|
97
|
+
def test_create_vlan_invalid_value
|
|
71
98
|
assert_raises(CliError) { Interface.new('Vlan0') }
|
|
72
99
|
end
|
|
73
100
|
|
|
74
|
-
def
|
|
101
|
+
def test_create_vlan_nil
|
|
75
102
|
assert_raises(TypeError) { Interface.new(nil) }
|
|
76
103
|
end
|
|
77
104
|
|
|
78
|
-
def
|
|
105
|
+
def test_name
|
|
79
106
|
svi = Interface.new('Vlan23')
|
|
80
107
|
assert_equal('vlan23', svi.name, 'Error: svi vlan name is wrong')
|
|
81
108
|
svi.destroy
|
|
82
109
|
end
|
|
83
110
|
|
|
84
|
-
def
|
|
111
|
+
def test_assignment
|
|
85
112
|
svi = Interface.new('Vlan23')
|
|
86
113
|
svi.svi_management = true
|
|
87
114
|
assert(svi.svi_management, 'Error: svi svi_management, false')
|
|
@@ -90,32 +117,26 @@ class TestSvi < CiscoTestCase
|
|
|
90
117
|
svi.destroy
|
|
91
118
|
end
|
|
92
119
|
|
|
93
|
-
def
|
|
120
|
+
def test_get_autostate_false
|
|
121
|
+
skip_autostate_test?
|
|
94
122
|
svi = Interface.new('Vlan23')
|
|
95
123
|
|
|
96
124
|
config('interface vlan 23', 'no autostate')
|
|
97
|
-
|
|
98
|
-
result = ref.default_value
|
|
99
|
-
result = false if ref.config_set
|
|
100
|
-
assert_equal(result, svi.svi_autostate,
|
|
101
|
-
'Error: svi autostate not correct.')
|
|
125
|
+
refute(svi.svi_autostate, 'Error: svi autostate not correct.')
|
|
102
126
|
svi.destroy
|
|
103
127
|
end
|
|
104
128
|
|
|
105
|
-
def
|
|
129
|
+
def test_get_autostate_true
|
|
130
|
+
skip_autostate_test?
|
|
106
131
|
svi = Interface.new('Vlan23')
|
|
107
132
|
|
|
108
133
|
config('interface vlan 23', 'autostate')
|
|
109
|
-
|
|
110
|
-
ref = cmd_ref_autostate
|
|
111
|
-
result = ref.default_value
|
|
112
|
-
result = true if ref.config_set
|
|
113
|
-
assert_equal(result, svi.svi_autostate,
|
|
114
|
-
'Error: svi autostate not correct.')
|
|
134
|
+
assert(svi.svi_autostate, 'Error: svi autostate not correct.')
|
|
115
135
|
svi.destroy
|
|
116
136
|
end
|
|
117
137
|
|
|
118
|
-
def
|
|
138
|
+
def test_set_autostate_false
|
|
139
|
+
skip_autostate_test?
|
|
119
140
|
ref = cmd_ref_autostate
|
|
120
141
|
svi = Interface.new('Vlan23')
|
|
121
142
|
assert_result(ref.test_config_result(false),
|
|
@@ -125,7 +146,8 @@ class TestSvi < CiscoTestCase
|
|
|
125
146
|
svi.destroy
|
|
126
147
|
end
|
|
127
148
|
|
|
128
|
-
def
|
|
149
|
+
def test_set_autostate_true
|
|
150
|
+
skip_autostate_test?
|
|
129
151
|
svi = Interface.new('Vlan23')
|
|
130
152
|
ref = cmd_ref_autostate
|
|
131
153
|
assert_result(ref.test_config_result(true),
|
|
@@ -135,7 +157,8 @@ class TestSvi < CiscoTestCase
|
|
|
135
157
|
svi.destroy
|
|
136
158
|
end
|
|
137
159
|
|
|
138
|
-
def
|
|
160
|
+
def test_set_autostate_default
|
|
161
|
+
skip_autostate_test?
|
|
139
162
|
svi = Interface.new('Vlan23')
|
|
140
163
|
ref = cmd_ref_autostate
|
|
141
164
|
default_value = ref.default_value
|
|
@@ -146,7 +169,7 @@ class TestSvi < CiscoTestCase
|
|
|
146
169
|
svi.destroy
|
|
147
170
|
end
|
|
148
171
|
|
|
149
|
-
def
|
|
172
|
+
def test_get_management_true
|
|
150
173
|
svi = Interface.new('Vlan23')
|
|
151
174
|
|
|
152
175
|
config('interface vlan 23', 'management')
|
|
@@ -155,21 +178,21 @@ class TestSvi < CiscoTestCase
|
|
|
155
178
|
svi.destroy
|
|
156
179
|
end
|
|
157
180
|
|
|
158
|
-
def
|
|
181
|
+
def test_set_management_false
|
|
159
182
|
svi = Interface.new('Vlan23')
|
|
160
183
|
svi.svi_management = false
|
|
161
184
|
refute(svi.svi_management)
|
|
162
185
|
svi.destroy
|
|
163
186
|
end
|
|
164
187
|
|
|
165
|
-
def
|
|
188
|
+
def test_set_management_true
|
|
166
189
|
svi = Interface.new('Vlan23')
|
|
167
190
|
svi.svi_management = true
|
|
168
191
|
assert(svi.svi_management)
|
|
169
192
|
svi.destroy
|
|
170
193
|
end
|
|
171
194
|
|
|
172
|
-
def
|
|
195
|
+
def test_set_management_default
|
|
173
196
|
svi = Interface.new('Vlan23')
|
|
174
197
|
svi.svi_management = true
|
|
175
198
|
assert(svi.svi_management)
|
|
@@ -179,47 +202,38 @@ class TestSvi < CiscoTestCase
|
|
|
179
202
|
svi.destroy
|
|
180
203
|
end
|
|
181
204
|
|
|
182
|
-
def
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
str = 'Vlan' + i.to_s
|
|
189
|
-
svi = Interface.new(str)
|
|
190
|
-
assert_result(ref.test_config_result(false),
|
|
191
|
-
'Error: svi autostate not set to false') do
|
|
192
|
-
svi.svi_autostate = false
|
|
193
|
-
end
|
|
194
|
-
svi.svi_management = true
|
|
205
|
+
def config_svi_properties(state)
|
|
206
|
+
# Skip default vlan1
|
|
207
|
+
(2..6).each do |i|
|
|
208
|
+
svi = Interface.new('Vlan' + i.to_s)
|
|
209
|
+
svi.svi_autostate = state unless /N(5|6)K/.match(node.product_id)
|
|
210
|
+
svi.svi_management = state
|
|
195
211
|
end
|
|
212
|
+
end
|
|
196
213
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
assert_equal(result, svi.svi_autostate,
|
|
205
|
-
'Error: svis collection, Vlan1, incorrect autostate')
|
|
206
|
-
refute(svi.svi_management,
|
|
207
|
-
'Error: svis collection, Vlan1, incorrect management')
|
|
208
|
-
when /^vlan/
|
|
209
|
-
result = false if ref.config_set
|
|
210
|
-
assert_equal(result, svi.svi_autostate,
|
|
211
|
-
"Error: svis collection, Vlan#{id}, incorrect autostate")
|
|
212
|
-
assert(svi.svi_management,
|
|
213
|
-
"Error: svis collection, Vlan#{id}, incorrect management")
|
|
214
|
+
def test_get_svis
|
|
215
|
+
config_svi_properties(true)
|
|
216
|
+
Interface.interfaces.each do |id, obj|
|
|
217
|
+
next if id[/vlan1/]
|
|
218
|
+
next unless id[/vlan/]
|
|
219
|
+
unless /N(5|6)K/.match(node.product_id)
|
|
220
|
+
assert(obj.svi_autostate, "svi autostate should be enabled #{id}")
|
|
214
221
|
end
|
|
222
|
+
assert(obj.svi_management, "svi management should be enabled #{id}")
|
|
215
223
|
end
|
|
216
224
|
|
|
217
|
-
|
|
218
|
-
|
|
225
|
+
config_svi_properties(false)
|
|
226
|
+
Interface.interfaces.each do |id, obj|
|
|
227
|
+
next if id[/vlan1/]
|
|
228
|
+
next unless id[/vlan/]
|
|
229
|
+
unless /N(5|6)K/.match(node.product_id)
|
|
230
|
+
refute(obj.svi_autostate, "svi autostate should be disabled #{id}")
|
|
231
|
+
end
|
|
232
|
+
refute(obj.svi_management, "svi management should be disabled #{id}")
|
|
219
233
|
end
|
|
220
234
|
end
|
|
221
235
|
|
|
222
|
-
def
|
|
236
|
+
def test_create_interface_description
|
|
223
237
|
svi = Interface.new('Vlan23')
|
|
224
238
|
|
|
225
239
|
description = 'Test description'
|
|
@@ -230,7 +244,8 @@ class TestSvi < CiscoTestCase
|
|
|
230
244
|
end
|
|
231
245
|
|
|
232
246
|
def test_system_default_svi_autostate_on_off
|
|
233
|
-
|
|
247
|
+
skip_autostate_test?
|
|
248
|
+
interface = Interface.new(interfaces[0])
|
|
234
249
|
|
|
235
250
|
system_default_svi_autostate('no ')
|
|
236
251
|
refute(interface.system_default_svi_autostate,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2016 Cisco and/or its affiliates.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -49,6 +49,11 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
def platform_supports_vtp_switchport_access?
|
|
53
|
+
skip('Platform does not support VTP when switchport mode is access') if
|
|
54
|
+
node.product_id =~ /N(5|6|7)/
|
|
55
|
+
end
|
|
56
|
+
|
|
52
57
|
def system_default_switchport(state='')
|
|
53
58
|
config("#{state} system default switchport")
|
|
54
59
|
end
|
|
@@ -100,6 +105,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
100
105
|
end
|
|
101
106
|
|
|
102
107
|
def test_switchport_vtp_enabled_access
|
|
108
|
+
platform_supports_vtp_switchport_access?
|
|
103
109
|
vtp = Vtp.new(true)
|
|
104
110
|
interface = Interface.new(interfaces[0])
|
|
105
111
|
interface.switchport_mode = :access
|
|
@@ -147,6 +153,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
147
153
|
end
|
|
148
154
|
|
|
149
155
|
def test_set_switchport_vtp_default_access
|
|
156
|
+
platform_supports_vtp_switchport_access?
|
|
150
157
|
vtp = Vtp.new(true)
|
|
151
158
|
interface = Interface.new(interfaces[0])
|
|
152
159
|
interface.switchport_mode = :access
|
|
@@ -188,6 +195,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
188
195
|
end
|
|
189
196
|
|
|
190
197
|
def test_set_switchport_vtp_true_access
|
|
198
|
+
platform_supports_vtp_switchport_access?
|
|
191
199
|
vtp = Vtp.new(true)
|
|
192
200
|
interface = Interface.new(interfaces[0])
|
|
193
201
|
|
|
@@ -304,7 +312,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
304
312
|
'switchport autostate exclude')
|
|
305
313
|
|
|
306
314
|
cmd_ref = cmd_ref_switchport_autostate_exclude
|
|
307
|
-
if cmd_ref.config_set
|
|
315
|
+
if cmd_ref.config_set?
|
|
308
316
|
assert(interface.switchport_autostate_exclude,
|
|
309
317
|
'Error: interface, access, autostate exclude not enabled')
|
|
310
318
|
else
|
|
@@ -333,7 +341,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
333
341
|
'switchport autostate exclude')
|
|
334
342
|
|
|
335
343
|
cmd_ref = cmd_ref_switchport_autostate_exclude
|
|
336
|
-
if cmd_ref.config_set
|
|
344
|
+
if cmd_ref.config_set?
|
|
337
345
|
assert(interface.switchport_autostate_exclude,
|
|
338
346
|
'Error: interface, access, autostate exclude not enabled')
|
|
339
347
|
else
|
|
@@ -715,7 +723,7 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
715
723
|
# end
|
|
716
724
|
|
|
717
725
|
def test_system_default_switchport_on_off
|
|
718
|
-
interface = Interface.new(
|
|
726
|
+
interface = Interface.new(interfaces[0])
|
|
719
727
|
|
|
720
728
|
system_default_switchport('')
|
|
721
729
|
assert(interface.system_default_switchport,
|
|
@@ -725,10 +733,14 @@ class TestInterfaceSwitchport < CiscoTestCase
|
|
|
725
733
|
system_default_switchport('no ')
|
|
726
734
|
refute(interface.system_default_switchport,
|
|
727
735
|
'Test for disabled - failed')
|
|
736
|
+
rescue RuntimeError => e
|
|
737
|
+
skip('NX-OS defect: system default switchport nvgens twice') if
|
|
738
|
+
e.message[/Expected zero.one value/]
|
|
739
|
+
flunk(e.message)
|
|
728
740
|
end
|
|
729
741
|
|
|
730
742
|
def test_system_default_switchport_shutdown_on_off
|
|
731
|
-
interface = Interface.new(
|
|
743
|
+
interface = Interface.new(interfaces[0])
|
|
732
744
|
|
|
733
745
|
system_default_switchport_shutdown('no ')
|
|
734
746
|
refute(interface.system_default_switchport_shutdown,
|
data/tests/test_name_server.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Minitest for NameServer 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_node.rb
CHANGED
data/tests/test_node_ext.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013-
|
|
1
|
+
# Copyright (c) 2013-2016 Cisco and/or its affiliates.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -84,17 +84,7 @@ vrf blue",
|
|
|
84
84
|
node.client.config(['interface loopback1', 'no shutdown'])
|
|
85
85
|
|
|
86
86
|
result = node.config_get('interface', 'shutdown', 'loopback1')
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def test_node_token_str_to_regexp
|
|
91
|
-
token = ['/%s/i', '/%s foo %s/', '/zzz/i']
|
|
92
|
-
args = %w(LoopBack2 no bar)
|
|
93
|
-
expected = [/LoopBack2/i, /no foo bar/, /zzz/i]
|
|
94
|
-
|
|
95
|
-
result = node.token_str_to_regexp(token, args)
|
|
96
|
-
# puts "intersection: #{result & expected}, diff: #{result - expected}"
|
|
97
|
-
assert_equal(expected, result)
|
|
87
|
+
refute(result)
|
|
98
88
|
end
|
|
99
89
|
|
|
100
90
|
def test_node_config_get_invalid
|
|
@@ -126,13 +116,13 @@ vrf blue",
|
|
|
126
116
|
def test_node_config_set
|
|
127
117
|
node.config_set('snmp_server', 'aaa_user_cache_timeout', '', 100)
|
|
128
118
|
run = node.client.show('show run all | inc snmp')
|
|
129
|
-
val =
|
|
130
|
-
assert_equal('100', val)
|
|
119
|
+
val = find_ascii(run, /snmp-server aaa-user cache-timeout (\d+)/)
|
|
120
|
+
assert_equal(['100'], val)
|
|
131
121
|
|
|
132
122
|
node.config_set('snmp_server', 'aaa_user_cache_timeout', 'no', 100)
|
|
133
123
|
run = node.client.show('show run all | inc snmp')
|
|
134
|
-
val =
|
|
135
|
-
assert_equal('3600', val)
|
|
124
|
+
val = find_ascii(run, /snmp-server aaa-user cache-timeout (\d+)/)
|
|
125
|
+
assert_equal(['3600'], val)
|
|
136
126
|
end
|
|
137
127
|
|
|
138
128
|
def test_node_config_set_invalid
|
|
@@ -236,8 +226,8 @@ vrf blue",
|
|
|
236
226
|
assert_equal('switch', name)
|
|
237
227
|
|
|
238
228
|
return unless configured_name
|
|
239
|
-
config("hostname #{configured_name}") if
|
|
240
|
-
config("switchname #{configured_name}") if
|
|
229
|
+
config("hostname #{configured_name}") if switchname == false
|
|
230
|
+
config("switchname #{configured_name}") if switchname == true
|
|
241
231
|
end
|
|
242
232
|
|
|
243
233
|
def test_node_get_host_name_when_set
|
|
@@ -266,8 +256,8 @@ vrf blue",
|
|
|
266
256
|
assert_equal('xyz', host_name)
|
|
267
257
|
|
|
268
258
|
if configured_name
|
|
269
|
-
config("hostname #{configured_name}") if
|
|
270
|
-
config("switchname #{configured_name}") if
|
|
259
|
+
config("hostname #{configured_name}") if switchname == false
|
|
260
|
+
config("switchname #{configured_name}") if switchname == true
|
|
271
261
|
else
|
|
272
262
|
switchname ? config('no switchname') : config('no hostname')
|
|
273
263
|
end
|
data/tests/test_ntp_config.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Minitest for NtpConfig class
|
|
3
3
|
#
|
|
4
|
-
# Copyright (c) 2015 Cisco and/or its affiliates.
|
|
4
|
+
# Copyright (c) 2015-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_ntp_server.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Minitest for NtpServer 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.
|
|
@@ -35,7 +35,7 @@ class TestNtpServer < CiscoTestCase
|
|
|
35
35
|
def no_ntpserver_uk
|
|
36
36
|
# Turn the feature off for a clean test.
|
|
37
37
|
config('no ntpserver 130.88.203.12',
|
|
38
|
-
'no ntpserver
|
|
38
|
+
'no ntpserver 2003::5')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# TESTS
|
|
@@ -46,7 +46,19 @@ class TestNtpServer < CiscoTestCase
|
|
|
46
46
|
|
|
47
47
|
ntp = Cisco::NtpServer.new(id, false)
|
|
48
48
|
assert_includes(Cisco::NtpServer.ntpservers, id)
|
|
49
|
-
assert_equal(Cisco::NtpServer.ntpservers[id]
|
|
49
|
+
assert_equal(ntp, Cisco::NtpServer.ntpservers[id])
|
|
50
|
+
|
|
51
|
+
ntp.destroy
|
|
52
|
+
refute_includes(Cisco::NtpServer.ntpservers, id)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_ntpserver_create_destroy_single_ipv6
|
|
56
|
+
id = '2003::5'
|
|
57
|
+
refute_includes(Cisco::NtpServer.ntpservers, id)
|
|
58
|
+
|
|
59
|
+
ntp = Cisco::NtpServer.new(id, false)
|
|
60
|
+
assert_includes(Cisco::NtpServer.ntpservers, id)
|
|
61
|
+
assert_equal(ntp, Cisco::NtpServer.ntpservers[id])
|
|
50
62
|
|
|
51
63
|
ntp.destroy
|
|
52
64
|
refute_includes(Cisco::NtpServer.ntpservers, id)
|
|
@@ -54,7 +66,7 @@ class TestNtpServer < CiscoTestCase
|
|
|
54
66
|
|
|
55
67
|
def test_ntpserver_create_destroy_multiple
|
|
56
68
|
id1 = '130.88.203.12'
|
|
57
|
-
id2 = '
|
|
69
|
+
id2 = '2003::5'
|
|
58
70
|
refute_includes(Cisco::NtpServer.ntpservers, id1)
|
|
59
71
|
refute_includes(Cisco::NtpServer.ntpservers, id2)
|
|
60
72
|
|
|
@@ -63,8 +75,8 @@ class TestNtpServer < CiscoTestCase
|
|
|
63
75
|
refute_equal(ntp1, ntp2)
|
|
64
76
|
assert_includes(Cisco::NtpServer.ntpservers, id1)
|
|
65
77
|
assert_includes(Cisco::NtpServer.ntpservers, id2)
|
|
66
|
-
assert_equal(Cisco::NtpServer.ntpservers[id1]
|
|
67
|
-
assert_equal(Cisco::NtpServer.ntpservers[id2]
|
|
78
|
+
assert_equal(ntp1, Cisco::NtpServer.ntpservers[id1])
|
|
79
|
+
assert_equal(ntp2, Cisco::NtpServer.ntpservers[id2])
|
|
68
80
|
|
|
69
81
|
ntp1.destroy
|
|
70
82
|
ntp2.destroy
|