cisco_node_utils 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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_vtp.rb
CHANGED
@@ -17,20 +17,16 @@ require_relative '../lib/cisco_node_utils/vtp'
|
|
17
17
|
|
18
18
|
# TestVtp - Minitest for Vtp node utility class
|
19
19
|
class TestVtp < CiscoTestCase
|
20
|
+
@skip_unless_supported = 'vtp'
|
21
|
+
|
20
22
|
def setup
|
21
23
|
super
|
22
|
-
|
24
|
+
config('no feature vtp')
|
23
25
|
end
|
24
26
|
|
25
27
|
def teardown
|
26
|
-
no_feature_vtp
|
27
|
-
super
|
28
|
-
end
|
29
|
-
|
30
|
-
def no_feature_vtp
|
31
|
-
# VTP will raise an error if the domain is configured twice so we need to
|
32
|
-
# turn the feature off for a clean test.
|
33
28
|
config('no feature vtp')
|
29
|
+
super
|
34
30
|
end
|
35
31
|
|
36
32
|
def vtp_domain(domain)
|
@@ -39,19 +35,19 @@ class TestVtp < CiscoTestCase
|
|
39
35
|
vtp
|
40
36
|
end
|
41
37
|
|
42
|
-
def
|
38
|
+
def test_disabled
|
43
39
|
vtp = Vtp.new(false)
|
44
40
|
assert_empty(vtp.domain)
|
45
41
|
assert_equal(vtp.default_password, vtp.password)
|
46
42
|
assert_equal(vtp.default_filename, vtp.filename)
|
47
43
|
assert_equal(vtp.default_version, vtp.version)
|
48
|
-
refute(
|
44
|
+
refute(Feature.vtp_enabled?, 'VTP feature was unexpectedly enabled?')
|
49
45
|
end
|
50
46
|
|
51
|
-
def
|
47
|
+
def test_enabled_but_no_domain
|
52
48
|
vtp = Vtp.new(false)
|
53
49
|
config('feature vtp')
|
54
|
-
assert(
|
50
|
+
assert(Feature.vtp_enabled?)
|
55
51
|
assert_empty(vtp.domain)
|
56
52
|
assert_equal(vtp.default_password, vtp.password)
|
57
53
|
assert_equal(vtp.default_filename, vtp.filename)
|
@@ -62,12 +58,12 @@ class TestVtp < CiscoTestCase
|
|
62
58
|
vtp.version = 1
|
63
59
|
assert_equal(1, vtp.version)
|
64
60
|
# Can't set any of the below without setting a domain first
|
65
|
-
assert_raises(
|
61
|
+
assert_raises(CliError) do
|
66
62
|
vtp.password = 'hello'
|
67
63
|
end
|
68
64
|
end
|
69
65
|
|
70
|
-
def
|
66
|
+
def test_domain_enable_disable
|
71
67
|
assert_empty(Vtp.domain)
|
72
68
|
vtp = vtp_domain('enable')
|
73
69
|
assert_equal('enable', Vtp.domain)
|
@@ -75,57 +71,41 @@ class TestVtp < CiscoTestCase
|
|
75
71
|
assert_empty(Vtp.domain)
|
76
72
|
end
|
77
73
|
|
78
|
-
def
|
79
|
-
vtp_domain('accounting')
|
80
|
-
|
81
|
-
assert_match(/^vtp domain accounting/, s,
|
82
|
-
'Error: failed to create vtp domain')
|
74
|
+
def test_create_valid
|
75
|
+
vtp = vtp_domain('accounting')
|
76
|
+
assert_equal('accounting', vtp.domain)
|
83
77
|
end
|
84
78
|
|
85
|
-
def
|
79
|
+
def test_domain_name_change
|
86
80
|
vtp = vtp_domain('accounting')
|
87
81
|
vtp_domain('uplink')
|
88
82
|
assert_equal('uplink', vtp.domain,
|
89
83
|
'Error: vtp domain name incorrect')
|
90
84
|
end
|
91
85
|
|
92
|
-
def
|
93
|
-
|
86
|
+
def test_negative
|
87
|
+
assert_raises(ArgumentError) { vtp_domain(nil) }
|
88
|
+
assert_raises(ArgumentError) { vtp_domain('') }
|
94
89
|
|
90
|
+
# Create the same domain twice
|
95
91
|
vtp = vtp_domain('accounting')
|
96
|
-
|
97
|
-
'Error: vtp domain wrong')
|
98
|
-
end
|
92
|
+
assert_raises(Cisco::CliError) { vtp_domain('accounting') }
|
99
93
|
|
100
|
-
|
101
|
-
vtp =
|
102
|
-
vtp_new = vtp_domain('accounting')
|
94
|
+
# Set password to nil
|
95
|
+
assert_raises(TypeError) { vtp.password = nil }
|
103
96
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
'Error: vtp_new domain wrong')
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_vtp_create_domain_invalid
|
111
|
-
assert_raises(ArgumentError) do
|
112
|
-
vtp_domain(node)
|
113
|
-
end
|
114
|
-
end
|
97
|
+
# Password too long
|
98
|
+
password = 'a' * (Vtp::MAX_VTP_PASSWORD_SIZE + 1)
|
99
|
+
assert_raises(ArgumentError) { vtp.password = password }
|
115
100
|
|
116
|
-
|
117
|
-
assert_raises(
|
118
|
-
vtp_domain(nil)
|
119
|
-
end
|
120
|
-
end
|
101
|
+
# Set filename to nil
|
102
|
+
assert_raises(TypeError) { vtp.filename = nil }
|
121
103
|
|
122
|
-
|
123
|
-
assert_raises(
|
124
|
-
vtp_domain('')
|
125
|
-
end
|
104
|
+
# Invalid version
|
105
|
+
assert_raises(Cisco::CliError) { vtp.version = 34 }
|
126
106
|
end
|
127
107
|
|
128
|
-
def
|
108
|
+
def test_assignment
|
129
109
|
vtp = vtp_domain('accounting')
|
130
110
|
vtp.password = 'copy_test'
|
131
111
|
assert_equal('copy_test', vtp.password,
|
@@ -135,20 +115,13 @@ class TestVtp < CiscoTestCase
|
|
135
115
|
'Error: vtp password not set')
|
136
116
|
end
|
137
117
|
|
138
|
-
def
|
118
|
+
def test_domain_get
|
139
119
|
vtp = vtp_domain('accounting')
|
140
120
|
assert_equal('accounting', vtp.domain,
|
141
121
|
'Error: vtp domain incorrect')
|
142
122
|
end
|
143
123
|
|
144
|
-
def
|
145
|
-
vtp = vtp_domain('accounting')
|
146
|
-
assert_raises(TypeError) do
|
147
|
-
vtp.password = nil
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_vtp_password_default
|
124
|
+
def test_password_default
|
152
125
|
vtp = vtp_domain('accounting')
|
153
126
|
vtp.password = 'test_me'
|
154
127
|
assert_equal('test_me', vtp.password,
|
@@ -159,14 +132,14 @@ class TestVtp < CiscoTestCase
|
|
159
132
|
'Error: vtp password not correct')
|
160
133
|
end
|
161
134
|
|
162
|
-
def
|
135
|
+
def test_password_zero_length
|
163
136
|
vtp = vtp_domain('accounting')
|
164
137
|
vtp.password = ''
|
165
138
|
assert_equal('', vtp.password,
|
166
139
|
'Error: vtp password not empty')
|
167
140
|
end
|
168
141
|
|
169
|
-
def
|
142
|
+
def test_password_get
|
170
143
|
vtp = vtp_domain('accounting')
|
171
144
|
|
172
145
|
config('vtp password cisco123')
|
@@ -174,13 +147,13 @@ class TestVtp < CiscoTestCase
|
|
174
147
|
'Error: vtp password not correct')
|
175
148
|
end
|
176
149
|
|
177
|
-
def
|
150
|
+
def test_password_get_not_set
|
178
151
|
vtp = vtp_domain('accounting')
|
179
152
|
assert_equal('', vtp.password,
|
180
153
|
'Error: vtp password not empty')
|
181
154
|
end
|
182
155
|
|
183
|
-
def
|
156
|
+
def test_password_clear
|
184
157
|
vtp = vtp_domain('accounting')
|
185
158
|
vtp.password = 'cisco123'
|
186
159
|
assert_equal('cisco123', vtp.password,
|
@@ -191,7 +164,7 @@ class TestVtp < CiscoTestCase
|
|
191
164
|
'Error: vtp default password not set')
|
192
165
|
end
|
193
166
|
|
194
|
-
def
|
167
|
+
def test_password_valid
|
195
168
|
vtp = vtp_domain('accounting')
|
196
169
|
alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
197
170
|
password = ''
|
@@ -203,33 +176,20 @@ class TestVtp < CiscoTestCase
|
|
203
176
|
end
|
204
177
|
end
|
205
178
|
|
206
|
-
def
|
207
|
-
vtp = vtp_domain('accounting')
|
208
|
-
password = 'a' * (Vtp::MAX_VTP_PASSWORD_SIZE + 1)
|
209
|
-
assert_raises(ArgumentError) { vtp.password = password }
|
210
|
-
end
|
211
|
-
|
212
|
-
def test_vtp_password_special_characters
|
179
|
+
def test_password_special_characters
|
213
180
|
vtp = vtp_domain('password')
|
214
181
|
vtp.password = 'hello!//\\#%$x'
|
215
182
|
assert_equal('hello!//\\#%$x', vtp.password)
|
216
183
|
end
|
217
184
|
|
218
|
-
def
|
219
|
-
vtp = vtp_domain('accounting')
|
220
|
-
assert_raises(TypeError) do
|
221
|
-
vtp.filename = nil
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def test_vtp_filename_valid
|
185
|
+
def test_filename_valid
|
226
186
|
vtp = vtp_domain('accounting')
|
227
187
|
vtp.filename = 'bootflash:/test.dat'
|
228
188
|
assert_equal('bootflash:/test.dat', vtp.filename,
|
229
189
|
'Error: vtp file content wrong')
|
230
190
|
end
|
231
191
|
|
232
|
-
def
|
192
|
+
def test_filename_zero_length
|
233
193
|
vtp = vtp_domain('accounting')
|
234
194
|
vtp.filename = vtp.default_filename
|
235
195
|
assert_equal(node.config_get_default('vtp', 'filename'), vtp.filename,
|
@@ -242,30 +202,33 @@ class TestVtp < CiscoTestCase
|
|
242
202
|
'Error: vtp file content wrong')
|
243
203
|
end
|
244
204
|
|
245
|
-
def
|
205
|
+
def test_filename_auto_enable
|
246
206
|
vtp = Vtp.new(false)
|
247
|
-
refute(
|
207
|
+
refute(Feature.vtp_enabled?, 'VTP should not be enabled')
|
248
208
|
vtp.filename = 'bootflash:/foo.bar'
|
249
|
-
assert(
|
209
|
+
assert(Feature.vtp_enabled?)
|
250
210
|
assert_equal('bootflash:/foo.bar', vtp.filename)
|
251
211
|
end
|
252
212
|
|
253
|
-
def
|
213
|
+
def test_version_valid
|
254
214
|
vtp = vtp_domain('accounting')
|
255
215
|
vtp.version = vtp.default_version
|
256
216
|
assert_equal(node.config_get_default('vtp', 'version'), vtp.version,
|
257
217
|
'Error: vtp version not default')
|
258
218
|
end
|
259
219
|
|
260
|
-
def
|
220
|
+
def test_version3_valid
|
261
221
|
vtp = vtp_domain('accounting')
|
262
222
|
|
263
223
|
ref = cmd_ref.lookup('vtp', 'version')
|
264
224
|
assert(ref, 'Error, reference not found for vtp version3')
|
265
225
|
|
266
|
-
|
226
|
+
case node.product_id
|
227
|
+
when /N(5|6|7)K/
|
267
228
|
vtp.version = 3
|
268
|
-
vtp.version
|
229
|
+
assert_equal(vtp.version, 3)
|
230
|
+
else
|
231
|
+
assert_raises(Cisco::CliError) { vtp.version = 3 }
|
269
232
|
end
|
270
233
|
end
|
271
234
|
|
@@ -282,14 +245,7 @@ class TestVtp < CiscoTestCase
|
|
282
245
|
end
|
283
246
|
end
|
284
247
|
|
285
|
-
def
|
286
|
-
vtp = vtp_domain('accounting')
|
287
|
-
assert_raises(Cisco::CliError) do
|
288
|
-
vtp.version = 34
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
def test_vtp_version_default
|
248
|
+
def test_version_default
|
293
249
|
vtp = vtp_domain('accounting')
|
294
250
|
vtp.version = 2
|
295
251
|
assert_equal(2, vtp.version,
|
@@ -299,19 +255,19 @@ class TestVtp < CiscoTestCase
|
|
299
255
|
'Error: vtp version not default')
|
300
256
|
end
|
301
257
|
|
302
|
-
def
|
258
|
+
def test_version_auto_enable
|
303
259
|
vtp = Vtp.new(false)
|
304
|
-
refute(
|
260
|
+
refute(Feature.vtp_enabled?, 'VTP should not be enabled')
|
305
261
|
vtp.version = 1
|
306
|
-
assert(
|
262
|
+
assert(Feature.vtp_enabled?)
|
307
263
|
assert_equal(1, vtp.version)
|
308
264
|
end
|
309
265
|
|
310
|
-
def
|
311
|
-
|
312
|
-
assert(
|
266
|
+
def test_feature_enable_disable
|
267
|
+
Feature.vtp_enable
|
268
|
+
assert(Feature.vtp_enabled?, 'Error: vtp is not enabled')
|
313
269
|
|
314
|
-
|
315
|
-
refute(
|
270
|
+
Feature.vtp_disable
|
271
|
+
refute(Feature.vtp_enabled?, 'Error: vtp is not disabled')
|
316
272
|
end
|
317
273
|
end
|
data/tests/test_vxlan_vtep.rb
CHANGED
@@ -19,8 +19,10 @@ require_relative '../lib/cisco_node_utils/vdc'
|
|
19
19
|
|
20
20
|
include Cisco
|
21
21
|
|
22
|
-
#
|
22
|
+
# TestVxlanVtep - Minitest for VxlanVtep node utility
|
23
23
|
class TestVxlanVtep < CiscoTestCase
|
24
|
+
@skip_unless_supported = 'vxlan_vtep'
|
25
|
+
|
24
26
|
def setup
|
25
27
|
super
|
26
28
|
skip('Platform does not support MT-full or MT-lite') unless
|
@@ -28,37 +30,26 @@ class TestVxlanVtep < CiscoTestCase
|
|
28
30
|
end
|
29
31
|
|
30
32
|
def teardown
|
33
|
+
Feature.nv_overlay_disable
|
31
34
|
return unless Vdc.vdc_support
|
32
35
|
# Reset the vdc module type back to default
|
33
36
|
v = Vdc.new('default')
|
34
37
|
v.limit_resource_module_type = '' if v.limit_resource_module_type == 'f3'
|
35
38
|
end
|
36
39
|
|
37
|
-
def compatible_interface?
|
38
|
-
# MT-full tests require a specific linecard; either because they need a
|
39
|
-
# compatible interface or simply to enable the features. Either way
|
40
|
-
# we will provide an appropriate interface name if the linecard is present.
|
41
|
-
# Example 'show mod' output to match against:
|
42
|
-
# '9 12 10/40 Gbps Ethernet Module N7K-F312FQ-25 ok'
|
43
|
-
sh_mod = @device.cmd("sh mod | i '^[0-9]+.*N7K-F3'")[/^(\d+)\s.*N7K-F3/]
|
44
|
-
slot = sh_mod.nil? ? nil : Regexp.last_match[1]
|
45
|
-
skip('Unable to find a compatible interface in chassis') if slot.nil?
|
46
|
-
|
47
|
-
"ethernet#{slot}/1"
|
48
|
-
end
|
49
|
-
|
50
40
|
def mt_full_env_setup
|
51
41
|
skip('Platform does not support MT-full') unless VxlanVtep.mt_full_support
|
52
|
-
|
42
|
+
vxlan_linecard?
|
53
43
|
v = Vdc.new('default')
|
54
44
|
v.limit_resource_module_type = 'f3' unless
|
55
45
|
v.limit_resource_module_type == 'f3'
|
56
|
-
|
46
|
+
Feature.nv_overlay_disable
|
57
47
|
end
|
58
48
|
|
59
49
|
def mt_lite_env_setup
|
60
50
|
skip('Platform does not support MT-lite') unless VxlanVtep.mt_lite_support
|
61
|
-
|
51
|
+
vxlan_linecard?
|
52
|
+
Feature.nv_overlay_disable
|
62
53
|
config('no feature vn-segment-vlan-based')
|
63
54
|
end
|
64
55
|
|
@@ -211,4 +202,34 @@ class TestVxlanVtep < CiscoTestCase
|
|
211
202
|
vtep.source_interface = val
|
212
203
|
assert_equal(val, vtep.source_interface)
|
213
204
|
end
|
205
|
+
|
206
|
+
def test_source_interface_hold_down_time
|
207
|
+
mt_full_env_setup if VxlanVtep.mt_full_support
|
208
|
+
mt_lite_env_setup if VxlanVtep.mt_lite_support
|
209
|
+
|
210
|
+
vtep = VxlanVtep.new('nve1')
|
211
|
+
if validate_property_excluded?('vxlan_vtep', 'source_intf_hold_down_time')
|
212
|
+
assert_nil(vtep.source_interface_hold_down_time)
|
213
|
+
assert_nil(vtep.default_source_interface_hold_down_time)
|
214
|
+
assert_raises(Cisco::UnsupportedError) do
|
215
|
+
vtep.source_interface_hold_down_time = 50
|
216
|
+
end
|
217
|
+
return
|
218
|
+
end
|
219
|
+
|
220
|
+
# Set source_interface to non-default value
|
221
|
+
val = 'loopback55'
|
222
|
+
vtep.source_interface = val
|
223
|
+
assert_equal(val, vtep.source_interface)
|
224
|
+
|
225
|
+
# Set source_interface_hold_down_time
|
226
|
+
time = 50
|
227
|
+
vtep.source_interface_hold_down_time = time
|
228
|
+
assert_equal(time, vtep.source_interface_hold_down_time)
|
229
|
+
|
230
|
+
# Set source_interface_hold_down_time to default value
|
231
|
+
val = vtep.default_source_interface_hold_down_time
|
232
|
+
vtep.source_interface_hold_down_time = val
|
233
|
+
assert_equal(val, vtep.source_interface_hold_down_time)
|
234
|
+
end
|
214
235
|
end
|
@@ -18,17 +18,35 @@ require_relative '../lib/cisco_node_utils/vxlan_vtep_vni'
|
|
18
18
|
|
19
19
|
include Cisco
|
20
20
|
|
21
|
-
#
|
21
|
+
# TestVxlanVtepVni - Minitest for VxlanVtepVni node utility
|
22
22
|
class TestVxlanVtepVni < CiscoTestCase
|
23
|
+
@skip_unless_supported = 'vxlan_vtep_vni'
|
24
|
+
@@pre_clean_needed = true # rubocop:disable Style/ClassVars
|
25
|
+
|
23
26
|
def setup
|
24
27
|
super
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
return unless @@pre_clean_needed
|
29
|
+
# Disable features on initial cleanup only as it's too expensive
|
30
|
+
# to do a disable for every testcase.
|
31
|
+
Feature.nv_overlay_disable
|
32
|
+
# nv overlay is slow on some platforms
|
33
|
+
sleep 1
|
34
|
+
vxlan_linecard?
|
35
|
+
if VxlanVtep.mt_full_support
|
36
|
+
return unless Vdc.vdc_support
|
37
|
+
v = Vdc.new('default')
|
38
|
+
v.limit_resource_module_type = 'f3' unless
|
39
|
+
v.limit_resource_module_type == 'f3'
|
40
|
+
else
|
41
|
+
config_no_warn('no feature vn-segment-vlan-based')
|
42
|
+
end
|
43
|
+
Feature.nv_overlay_enable
|
44
|
+
config_no_warn('feature vn-segment-vlan-based') if VxlanVtep.mt_lite_support
|
45
|
+
@@pre_clean_needed = false # rubocop:disable Style/ClassVars
|
28
46
|
end
|
29
47
|
|
30
48
|
def teardown
|
31
|
-
|
49
|
+
config_no_warn('no interface nve1')
|
32
50
|
super
|
33
51
|
end
|
34
52
|
|
@@ -49,6 +67,7 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
49
67
|
end
|
50
68
|
|
51
69
|
def test_vnis
|
70
|
+
VxlanVtep.new('nve1')
|
52
71
|
skip('Platform does not support vnis') if VxlanVtepVni.vnis['nve1'].nil?
|
53
72
|
|
54
73
|
# Test empty case
|
@@ -92,6 +111,10 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
92
111
|
|
93
112
|
def test_ingress_replication
|
94
113
|
vni = VxlanVtepVni.new('nve1', '5000')
|
114
|
+
if validate_property_excluded?('vxlan_vtep_vni', 'ingress_replication')
|
115
|
+
assert_raises(Cisco::UnsupportedError) { vni.ingress_replication = 'bgp' }
|
116
|
+
return
|
117
|
+
end
|
95
118
|
|
96
119
|
# Test non-default values
|
97
120
|
vni.ingress_replication = 'static'
|
@@ -127,11 +150,13 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
127
150
|
|
128
151
|
# Test the case where an existing ingress_replication is removed before
|
129
152
|
# configuring multicast_group
|
130
|
-
|
131
|
-
|
153
|
+
unless validate_property_excluded?('vxlan_vtep_vni', 'ingress_replication')
|
154
|
+
vni1.ingress_replication = 'static'
|
155
|
+
assert_equal('static', vni1.ingress_replication)
|
132
156
|
|
133
|
-
|
134
|
-
|
157
|
+
vni1.multicast_group = '224.1.1.1'
|
158
|
+
assert_equal('224.1.1.1', vni1.multicast_group)
|
159
|
+
end
|
135
160
|
|
136
161
|
# Test multicast group range
|
137
162
|
vni2.multicast_group = '224.1.1.1 224.1.1.200'
|
@@ -146,6 +171,10 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
146
171
|
|
147
172
|
def test_peer_list
|
148
173
|
vni = VxlanVtepVni.new('nve1', '6000')
|
174
|
+
if validate_property_excluded?('vxlan_vtep_vni', 'ingress_replication')
|
175
|
+
assert_raises(Cisco::UnsupportedError) { vni.peer_list = ['1.1.1.1'] }
|
176
|
+
return
|
177
|
+
end
|
149
178
|
|
150
179
|
peer_list = ['1.1.1.1', '2.2.2.2', '3.3.3.3', '4.4.4.4']
|
151
180
|
|
@@ -180,6 +209,7 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
180
209
|
|
181
210
|
def test_suppress_arp
|
182
211
|
vni = VxlanVtepVni.new('nve1', '6000')
|
212
|
+
VxlanVtep.new('nve1').host_reachability = 'evpn'
|
183
213
|
|
184
214
|
# Test: Check suppress_arp is not configured.
|
185
215
|
refute(vni.suppress_arp, 'suppress_arp should be disabled')
|
@@ -198,4 +228,26 @@ class TestVxlanVtepVni < CiscoTestCase
|
|
198
228
|
vni.suppress_arp = vni.default_suppress_arp
|
199
229
|
refute(vni.suppress_arp, 'suppress_arp should be disabled')
|
200
230
|
end
|
231
|
+
|
232
|
+
def test_suppress_uuc
|
233
|
+
vni = VxlanVtepVni.new('nve1', '6000')
|
234
|
+
VxlanVtep.new('nve1').host_reachability = 'evpn'
|
235
|
+
if validate_property_excluded?('vxlan_vtep_vni', 'suppress_uuc')
|
236
|
+
assert_nil(vni.suppress_uuc)
|
237
|
+
assert_nil(vni.default_suppress_uuc)
|
238
|
+
assert_raises(Cisco::UnsupportedError) { vni.suppress_uuc = true }
|
239
|
+
return
|
240
|
+
end
|
241
|
+
|
242
|
+
# Test: Check suppress_uuc is not configured.
|
243
|
+
refute(vni.suppress_uuc, 'suppress_uuc should be disabled')
|
244
|
+
|
245
|
+
# Test: Enable suppress_uuc
|
246
|
+
vni.suppress_uuc = true
|
247
|
+
assert(vni.suppress_uuc, 'suppress_uuc should be enabled')
|
248
|
+
|
249
|
+
# Test: Default
|
250
|
+
vni.suppress_uuc = vni.default_suppress_uuc
|
251
|
+
refute(vni.suppress_uuc, 'suppress_uuc should be disabled')
|
252
|
+
end
|
201
253
|
end
|