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_vlan_mt_full.rb
CHANGED
@@ -39,7 +39,9 @@ class TestVlanMtFull < CiscoTestCase
|
|
39
39
|
|
40
40
|
def setup
|
41
41
|
super
|
42
|
-
|
42
|
+
return if @@cleaned
|
43
|
+
cleanup
|
44
|
+
remove_all_bridge_domains # BDs may conflict with our test vlans
|
43
45
|
@@cleaned = true # rubocop:disable Style/ClassVars
|
44
46
|
end
|
45
47
|
|
@@ -48,25 +50,12 @@ class TestVlanMtFull < CiscoTestCase
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def interface_ethernet_default(ethernet_id)
|
51
|
-
config("default interface
|
52
|
-
end
|
53
|
-
|
54
|
-
def compatible_interface?
|
55
|
-
# MT-full tests require a specific linecard; either because they need a
|
56
|
-
# compatible interface or simply to enable the features. Either way
|
57
|
-
# we will provide an appropriate interface name if the linecard is present.
|
58
|
-
# Example 'show mod' output to match against:
|
59
|
-
# '9 12 10/40 Gbps Ethernet Module N7K-F312FQ-25 ok'
|
60
|
-
sh_mod = @device.cmd("sh mod | i '^[0-9]+.*N7K-F3'")[/^(\d+)\s.*N7K-F3/]
|
61
|
-
slot = sh_mod.nil? ? nil : Regexp.last_match[1]
|
62
|
-
skip('Unable to find a compatible interface in chassis') if slot.nil?
|
63
|
-
|
64
|
-
"ethernet#{slot}/1"
|
53
|
+
config("default interface #{ethernet_id}")
|
65
54
|
end
|
66
55
|
|
67
56
|
def mt_full_env_setup
|
68
57
|
skip('Platform does not support MT-full') unless VxlanVtep.mt_full_support
|
69
|
-
|
58
|
+
mt_full_interface?
|
70
59
|
v = Vdc.new('default')
|
71
60
|
v.limit_resource_module_type = 'f3' unless
|
72
61
|
v.limit_resource_module_type == 'f3'
|
@@ -77,8 +66,9 @@ class TestVlanMtFull < CiscoTestCase
|
|
77
66
|
|
78
67
|
# Test for valid mode
|
79
68
|
v = Vlan.new(2000)
|
80
|
-
|
81
|
-
|
69
|
+
default = v.default_mode
|
70
|
+
assert_equal(default, v.mode,
|
71
|
+
'Mode should have been default value: #{default}')
|
82
72
|
v.mode = 'fabricpath'
|
83
73
|
assert_equal(:enabled, v.fabricpath_feature,
|
84
74
|
'Fabricpath feature should have been enabled')
|
@@ -87,9 +77,9 @@ class TestVlanMtFull < CiscoTestCase
|
|
87
77
|
|
88
78
|
# Test for invalid mode
|
89
79
|
v = Vlan.new(100)
|
90
|
-
assert_equal(
|
91
|
-
'Mode should have been default
|
80
|
+
assert_equal(default, v.mode,
|
81
|
+
'Mode should have been default value: #{default}')
|
92
82
|
|
93
|
-
assert_raises(
|
83
|
+
assert_raises(CliError) { v.mode = 'junk' }
|
94
84
|
end
|
95
85
|
end
|
@@ -0,0 +1,669 @@
|
|
1
|
+
# NXAPI New test for feature private-vlan
|
2
|
+
# Davide Celotto Febraury 2016
|
3
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require_relative 'ciscotest'
|
18
|
+
require_relative '../lib/cisco_node_utils/vlan'
|
19
|
+
|
20
|
+
include Cisco
|
21
|
+
|
22
|
+
# TestVlan - Minitest for Vlan node utility
|
23
|
+
class TestVlan < CiscoTestCase
|
24
|
+
@skip_unless_supported = 'vlan'
|
25
|
+
|
26
|
+
@@cleaned = false # rubocop:disable Style/ClassVars
|
27
|
+
def cleanup
|
28
|
+
Vlan.vlans.each do |vlan, obj|
|
29
|
+
# skip reserved vlans
|
30
|
+
next if vlan == '1'
|
31
|
+
next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)
|
32
|
+
obj.destroy
|
33
|
+
end
|
34
|
+
config_no_warn('no feature vtp')
|
35
|
+
config_no_warn('no feature private-vlan')
|
36
|
+
end
|
37
|
+
|
38
|
+
def setup
|
39
|
+
super
|
40
|
+
cleanup unless @@cleaned
|
41
|
+
@@cleaned = true # rubocop:disable Style/ClassVars
|
42
|
+
end
|
43
|
+
|
44
|
+
def teardown
|
45
|
+
cleanup
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_private_type_default
|
49
|
+
config_no_warn('no feature vtp')
|
50
|
+
config_no_warn('feature private-vlan')
|
51
|
+
v1 = Vlan.new(100)
|
52
|
+
pv_type = ''
|
53
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
54
|
+
assert_nil(v1.private_vlan_type)
|
55
|
+
else
|
56
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_private_association_default
|
61
|
+
config_no_warn('no feature vtp')
|
62
|
+
config_no_warn('feature private-vlan')
|
63
|
+
v1 = Vlan.new(100)
|
64
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
65
|
+
assert_nil(v1.private_vlan_type)
|
66
|
+
return
|
67
|
+
else
|
68
|
+
result = []
|
69
|
+
assert_equal(result, v1.private_vlan_association)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_private_vlan_type_primary
|
74
|
+
v1 = Vlan.new(100)
|
75
|
+
pv_type = 'primary'
|
76
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
77
|
+
assert_nil(v1.private_vlan_type)
|
78
|
+
assert_raises(Cisco::UnsupportedError) do
|
79
|
+
v1.private_vlan_type = pv_type
|
80
|
+
end
|
81
|
+
else
|
82
|
+
v1.private_vlan_type = pv_type
|
83
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_no_private_vlan_type_primary
|
88
|
+
v1 = Vlan.new(200)
|
89
|
+
pv_type = 'primary'
|
90
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
91
|
+
assert_nil(v1.private_vlan_type)
|
92
|
+
assert_raises(Cisco::UnsupportedError) do
|
93
|
+
v1.private_vlan_type = pv_type
|
94
|
+
end
|
95
|
+
return
|
96
|
+
else
|
97
|
+
v1.private_vlan_type = pv_type
|
98
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
99
|
+
pv_type = ''
|
100
|
+
v1.private_vlan_type = pv_type
|
101
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_multi_private_vlan_type_primary
|
106
|
+
v1 = Vlan.new(100)
|
107
|
+
v2 = Vlan.new(101)
|
108
|
+
v3 = Vlan.new(200)
|
109
|
+
v4 = Vlan.new(201)
|
110
|
+
v5 = Vlan.new(203)
|
111
|
+
pv_type = 'primary'
|
112
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
113
|
+
assert_nil(v1.private_vlan_type)
|
114
|
+
assert_raises(Cisco::UnsupportedError) do
|
115
|
+
v1.private_vlan_type = pv_type
|
116
|
+
end
|
117
|
+
return
|
118
|
+
else
|
119
|
+
v1.private_vlan_type = pv_type
|
120
|
+
v2.private_vlan_type = pv_type
|
121
|
+
v3.private_vlan_type = pv_type
|
122
|
+
v4.private_vlan_type = pv_type
|
123
|
+
v5.private_vlan_type = pv_type
|
124
|
+
|
125
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
126
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
127
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
128
|
+
assert_equal(pv_type, v4.private_vlan_type)
|
129
|
+
assert_equal(pv_type, v5.private_vlan_type)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_private_vlan_type_isolated
|
134
|
+
v1 = Vlan.new(100)
|
135
|
+
pv_type = 'isolated'
|
136
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
137
|
+
assert_nil(v1.private_vlan_type)
|
138
|
+
assert_raises(Cisco::UnsupportedError) do
|
139
|
+
v1.private_vlan_type = pv_type
|
140
|
+
end
|
141
|
+
else
|
142
|
+
v1.private_vlan_type = pv_type
|
143
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_private_vlan_type_community
|
148
|
+
v1 = Vlan.new(100)
|
149
|
+
pv_type = 'community'
|
150
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
151
|
+
assert_nil(v1.private_vlan_type)
|
152
|
+
assert_raises(Cisco::UnsupportedError) do
|
153
|
+
v1.private_vlan_type = pv_type
|
154
|
+
end
|
155
|
+
else
|
156
|
+
v1.private_vlan_type = pv_type
|
157
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_private_vlan_type_isolated_primary
|
162
|
+
v1 = Vlan.new(100)
|
163
|
+
pv_type = 'isolated'
|
164
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
165
|
+
assert_nil(v1.private_vlan_type)
|
166
|
+
assert_raises(Cisco::UnsupportedError) do
|
167
|
+
v1.private_vlan_type = pv_type
|
168
|
+
end
|
169
|
+
return
|
170
|
+
else
|
171
|
+
v1.private_vlan_type = pv_type
|
172
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
173
|
+
v2 = Vlan.new(200)
|
174
|
+
pv_type = 'primary'
|
175
|
+
v2.private_vlan_type = pv_type
|
176
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_private_vlan_type_isolated_community_primary
|
181
|
+
v1 = Vlan.new(100)
|
182
|
+
pv_type = 'isolated'
|
183
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
184
|
+
assert_nil(v1.private_vlan_type)
|
185
|
+
assert_raises(Cisco::UnsupportedError) do
|
186
|
+
v1.private_vlan_type = pv_type
|
187
|
+
end
|
188
|
+
return
|
189
|
+
else
|
190
|
+
v1.private_vlan_type = pv_type
|
191
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
192
|
+
v2 = Vlan.new(200)
|
193
|
+
pv_type = 'primary'
|
194
|
+
v2.private_vlan_type = pv_type
|
195
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
196
|
+
v3 = Vlan.new(300)
|
197
|
+
pv_type = 'community'
|
198
|
+
v3.private_vlan_type = pv_type
|
199
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_private_vlan_type_change_isolated_to_primary
|
204
|
+
v1 = Vlan.new(100)
|
205
|
+
pv_type = 'isolated'
|
206
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
207
|
+
assert_nil(v1.private_vlan_type)
|
208
|
+
assert_raises(Cisco::UnsupportedError) do
|
209
|
+
v1.private_vlan_type = pv_type
|
210
|
+
end
|
211
|
+
return
|
212
|
+
else
|
213
|
+
v1.private_vlan_type = pv_type
|
214
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
215
|
+
pv_type = 'primary'
|
216
|
+
v1.private_vlan_type = pv_type
|
217
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_private_vlan_type_change_isolated_to_community
|
222
|
+
v1 = Vlan.new(100)
|
223
|
+
pv_type = 'isolated'
|
224
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
225
|
+
assert_nil(v1.private_vlan_type)
|
226
|
+
assert_raises(Cisco::UnsupportedError) do
|
227
|
+
v1.private_vlan_type = pv_type
|
228
|
+
end
|
229
|
+
return
|
230
|
+
else
|
231
|
+
v1.private_vlan_type = pv_type
|
232
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
233
|
+
pv_type = 'community'
|
234
|
+
v1.private_vlan_type = pv_type
|
235
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_private_vlan_type_change_community_to_isolated
|
240
|
+
v1 = Vlan.new(100)
|
241
|
+
pv_type = 'community'
|
242
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
243
|
+
assert_nil(v1.private_vlan_type)
|
244
|
+
assert_raises(Cisco::UnsupportedError) do
|
245
|
+
v1.private_vlan_type = pv_type
|
246
|
+
end
|
247
|
+
return
|
248
|
+
else
|
249
|
+
v1.private_vlan_type = pv_type
|
250
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
251
|
+
pv_type = 'isolated'
|
252
|
+
v1.private_vlan_type = pv_type
|
253
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_private_vlan_type_change_community_to_primary
|
258
|
+
v1 = Vlan.new(100)
|
259
|
+
pv_type = 'community'
|
260
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
261
|
+
assert_nil(v1.private_vlan_type)
|
262
|
+
assert_raises(Cisco::UnsupportedError) do
|
263
|
+
v1.private_vlan_type = pv_type
|
264
|
+
end
|
265
|
+
return
|
266
|
+
else
|
267
|
+
v1.private_vlan_type = pv_type
|
268
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
269
|
+
pv_type = 'primary'
|
270
|
+
v1.private_vlan_type = pv_type
|
271
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_private_vlan_type_change_primary_to_isolated
|
276
|
+
v1 = Vlan.new(100)
|
277
|
+
pv_type = 'primary'
|
278
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
279
|
+
assert_nil(v1.private_vlan_type)
|
280
|
+
assert_raises(Cisco::UnsupportedError) do
|
281
|
+
v1.private_vlan_type = pv_type
|
282
|
+
end
|
283
|
+
return
|
284
|
+
else
|
285
|
+
v1.private_vlan_type = pv_type
|
286
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
287
|
+
pv_type = 'isolated'
|
288
|
+
v1.private_vlan_type = pv_type
|
289
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_private_vlan_type_change_primary_to_community
|
294
|
+
v1 = Vlan.new(100)
|
295
|
+
pv_type = 'primary'
|
296
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
297
|
+
assert_nil(v1.private_vlan_type)
|
298
|
+
assert_raises(Cisco::UnsupportedError) do
|
299
|
+
v1.private_vlan_type = pv_type
|
300
|
+
end
|
301
|
+
return
|
302
|
+
else
|
303
|
+
v1.private_vlan_type = pv_type
|
304
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
305
|
+
pv_type = 'community'
|
306
|
+
v1.private_vlan_type = pv_type
|
307
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_private_vlan_isolate_association
|
312
|
+
vlan_list = %w(100 101)
|
313
|
+
result = ['101']
|
314
|
+
v1 = Vlan.new(vlan_list[0])
|
315
|
+
v2 = Vlan.new(vlan_list[1])
|
316
|
+
pv_type = 'primary'
|
317
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
318
|
+
assert_nil(v1.private_vlan_type)
|
319
|
+
assert_raises(Cisco::UnsupportedError) do
|
320
|
+
v1.private_vlan_type = pv_type
|
321
|
+
end
|
322
|
+
return
|
323
|
+
else
|
324
|
+
v1.private_vlan_type = pv_type
|
325
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
326
|
+
pv_type = 'isolated'
|
327
|
+
v2.private_vlan_type = pv_type
|
328
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
329
|
+
|
330
|
+
v1.private_vlan_association = ['101']
|
331
|
+
|
332
|
+
assert_equal(result, v1.private_vlan_association)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_private_vlan_community_association
|
337
|
+
vlan_list = %w(100 101)
|
338
|
+
result = ['101']
|
339
|
+
v1 = Vlan.new(vlan_list[0])
|
340
|
+
v2 = Vlan.new(vlan_list[1])
|
341
|
+
pv_type = 'primary'
|
342
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
343
|
+
assert_nil(v1.private_vlan_type)
|
344
|
+
assert_raises(Cisco::UnsupportedError) do
|
345
|
+
v1.private_vlan_type = pv_type
|
346
|
+
end
|
347
|
+
return
|
348
|
+
else
|
349
|
+
v1.private_vlan_type = pv_type
|
350
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
351
|
+
pv_type = 'community'
|
352
|
+
v2.private_vlan_type = pv_type
|
353
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
354
|
+
|
355
|
+
v1.private_vlan_association = ['101']
|
356
|
+
|
357
|
+
assert_equal(result, v1.private_vlan_association)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
def test_private_vlan_association_failure
|
362
|
+
vlan_list = %w(100 101 200)
|
363
|
+
result = %w(101 200)
|
364
|
+
v1 = Vlan.new(vlan_list[0])
|
365
|
+
v2 = Vlan.new(vlan_list[1])
|
366
|
+
v3 = Vlan.new(vlan_list[2])
|
367
|
+
pv_type = 'primary'
|
368
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
369
|
+
assert_nil(v1.private_vlan_type)
|
370
|
+
assert_raises(Cisco::UnsupportedError) do
|
371
|
+
v1.private_vlan_type = pv_type
|
372
|
+
end
|
373
|
+
return
|
374
|
+
else
|
375
|
+
v1.private_vlan_type = pv_type
|
376
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
377
|
+
pv_type = 'isolated'
|
378
|
+
v2.private_vlan_type = pv_type
|
379
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
380
|
+
pv_type = 'community'
|
381
|
+
v3.private_vlan_type = pv_type
|
382
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
383
|
+
|
384
|
+
v1.private_vlan_association = %w(101 200)
|
385
|
+
|
386
|
+
assert_equal(result, v1.private_vlan_association)
|
387
|
+
|
388
|
+
pv_type = 'isolated'
|
389
|
+
assert_raises(RuntimeError, 'vlan misconf did not raise RuntimeError') do
|
390
|
+
v3.private_vlan_type = pv_type
|
391
|
+
end
|
392
|
+
|
393
|
+
assert_equal(result, v1.private_vlan_association)
|
394
|
+
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def test_private_vlan_association_operational_and_not_operational
|
399
|
+
vlan_list = %w(100 101 200)
|
400
|
+
result = %w(101 200)
|
401
|
+
|
402
|
+
v1 = Vlan.new(vlan_list[0])
|
403
|
+
v2 = Vlan.new(vlan_list[1])
|
404
|
+
|
405
|
+
pv_type = 'primary'
|
406
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
407
|
+
assert_nil(v1.private_vlan_type)
|
408
|
+
assert_raises(Cisco::UnsupportedError) do
|
409
|
+
v1.private_vlan_type = pv_type
|
410
|
+
end
|
411
|
+
return
|
412
|
+
else
|
413
|
+
v1.private_vlan_type = pv_type
|
414
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
415
|
+
|
416
|
+
pv_type = 'isolated'
|
417
|
+
v2.private_vlan_type = pv_type
|
418
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
419
|
+
|
420
|
+
v1.private_vlan_association = %w(101 200)
|
421
|
+
|
422
|
+
assert_equal(result, v1.private_vlan_association)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_private_vlan_association_vlan_not_configured
|
427
|
+
vlan_list = %w(100 101 200)
|
428
|
+
result = %w(101 200)
|
429
|
+
v1 = Vlan.new(vlan_list[0])
|
430
|
+
v2 = Vlan.new(vlan_list[1])
|
431
|
+
pv_type = 'primary'
|
432
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
433
|
+
assert_nil(v1.private_vlan_type)
|
434
|
+
assert_raises(Cisco::UnsupportedError) do
|
435
|
+
v1.private_vlan_type = pv_type
|
436
|
+
end
|
437
|
+
return
|
438
|
+
else
|
439
|
+
v1.private_vlan_type = pv_type
|
440
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
441
|
+
pv_type = 'isolated'
|
442
|
+
v2.private_vlan_type = pv_type
|
443
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
444
|
+
|
445
|
+
v1.private_vlan_association = %w(101 200)
|
446
|
+
assert_equal(result, v1.private_vlan_association)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_private_vlan_association_add_vlan
|
451
|
+
vlan_list = %w(100 101)
|
452
|
+
result = ['101']
|
453
|
+
v1 = Vlan.new(vlan_list[0])
|
454
|
+
v2 = Vlan.new(vlan_list[1])
|
455
|
+
pv_type = 'primary'
|
456
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
457
|
+
assert_nil(v1.private_vlan_type)
|
458
|
+
assert_raises(Cisco::UnsupportedError) do
|
459
|
+
v1.private_vlan_type = pv_type
|
460
|
+
end
|
461
|
+
return
|
462
|
+
else
|
463
|
+
v1.private_vlan_type = pv_type
|
464
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
465
|
+
pv_type = 'isolated'
|
466
|
+
v2.private_vlan_type = pv_type
|
467
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
468
|
+
|
469
|
+
v1.private_vlan_association = ['101']
|
470
|
+
assert_equal(result, v1.private_vlan_association)
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
def test_private_vlan_association_remove_vlan
|
475
|
+
vlan_list = %w(100 101 200)
|
476
|
+
result = %w(101 200)
|
477
|
+
v1 = Vlan.new(vlan_list[0])
|
478
|
+
v2 = Vlan.new(vlan_list[1])
|
479
|
+
v3 = Vlan.new(vlan_list[2])
|
480
|
+
pv_type = 'primary'
|
481
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
482
|
+
assert_nil(v1.private_vlan_type)
|
483
|
+
assert_raises(Cisco::UnsupportedError) do
|
484
|
+
v1.private_vlan_type = pv_type
|
485
|
+
end
|
486
|
+
return
|
487
|
+
else
|
488
|
+
v1.private_vlan_type = pv_type
|
489
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
490
|
+
pv_type = 'isolated'
|
491
|
+
v2.private_vlan_type = pv_type
|
492
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
493
|
+
|
494
|
+
pv_type = 'community'
|
495
|
+
v3.private_vlan_type = pv_type
|
496
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
497
|
+
|
498
|
+
v1.private_vlan_association = %w(101 200)
|
499
|
+
assert_equal(result, v1.private_vlan_association)
|
500
|
+
|
501
|
+
# v1.private_vlan_association_remove_vlans = '101'
|
502
|
+
# result = '200'
|
503
|
+
# assert_equal(result, vlan_list(v1))
|
504
|
+
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
def test_no_private_vlan_association
|
509
|
+
vlan_list = %w(100 101 200)
|
510
|
+
result = %w(101 200)
|
511
|
+
v1 = Vlan.new(vlan_list[0])
|
512
|
+
v2 = Vlan.new(vlan_list[1])
|
513
|
+
v3 = Vlan.new(vlan_list[2])
|
514
|
+
|
515
|
+
pv_type = 'primary'
|
516
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
517
|
+
assert_nil(v1.private_vlan_type)
|
518
|
+
assert_raises(Cisco::UnsupportedError) do
|
519
|
+
v1.private_vlan_type = pv_type
|
520
|
+
end
|
521
|
+
return
|
522
|
+
else
|
523
|
+
v1.private_vlan_type = pv_type
|
524
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
525
|
+
|
526
|
+
pv_type = 'isolated'
|
527
|
+
v2.private_vlan_type = pv_type
|
528
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
529
|
+
|
530
|
+
pv_type = 'community'
|
531
|
+
v3.private_vlan_type = pv_type
|
532
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
533
|
+
|
534
|
+
v1.private_vlan_association = %w(101 200)
|
535
|
+
assert_equal(result, v1.private_vlan_association)
|
536
|
+
|
537
|
+
v1.private_vlan_association = ['200']
|
538
|
+
result = ['200']
|
539
|
+
assert_equal(result, v1.private_vlan_association)
|
540
|
+
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_no_private_vlan_association_all
|
545
|
+
vlan_list = %w(100 101 200)
|
546
|
+
result = %w(101 200)
|
547
|
+
v1 = Vlan.new(vlan_list[0])
|
548
|
+
v2 = Vlan.new(vlan_list[1])
|
549
|
+
v3 = Vlan.new(vlan_list[2])
|
550
|
+
|
551
|
+
pv_type = 'primary'
|
552
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
553
|
+
assert_nil(v1.private_vlan_type)
|
554
|
+
assert_raises(Cisco::UnsupportedError) do
|
555
|
+
v1.private_vlan_type = pv_type
|
556
|
+
end
|
557
|
+
return
|
558
|
+
else
|
559
|
+
v1.private_vlan_type = pv_type
|
560
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
561
|
+
|
562
|
+
pv_type = 'isolated'
|
563
|
+
v2.private_vlan_type = pv_type
|
564
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
565
|
+
|
566
|
+
pv_type = 'community'
|
567
|
+
v3.private_vlan_type = pv_type
|
568
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
569
|
+
|
570
|
+
v1.private_vlan_association = %w(101 200)
|
571
|
+
assert_equal(result, v1.private_vlan_association)
|
572
|
+
v1.private_vlan_association = []
|
573
|
+
result = []
|
574
|
+
assert_equal(result, v1.private_vlan_association)
|
575
|
+
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
def test_private_vlan_isolate_community_association
|
580
|
+
vlan_list = %w(100 101 200)
|
581
|
+
result = %w(101 200)
|
582
|
+
v1 = Vlan.new(vlan_list[0])
|
583
|
+
v2 = Vlan.new(vlan_list[1])
|
584
|
+
v3 = Vlan.new(vlan_list[2])
|
585
|
+
pv_type = 'primary'
|
586
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
587
|
+
assert_nil(v1.private_vlan_type)
|
588
|
+
assert_raises(Cisco::UnsupportedError) do
|
589
|
+
v1.private_vlan_type = pv_type
|
590
|
+
end
|
591
|
+
return
|
592
|
+
else
|
593
|
+
v1.private_vlan_type = pv_type
|
594
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
595
|
+
pv_type = 'isolated'
|
596
|
+
v2.private_vlan_type = pv_type
|
597
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
598
|
+
pv_type = 'community'
|
599
|
+
v3.private_vlan_type = pv_type
|
600
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
601
|
+
|
602
|
+
v1.private_vlan_association = %w(101 200)
|
603
|
+
|
604
|
+
assert_equal(result, v1.private_vlan_association)
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
def test_private_vlan_multi_isolate_community_association
|
609
|
+
vlan_list = %w(100 101 102 104 105 200 201 202)
|
610
|
+
result = %w(101 104 105 200 202)
|
611
|
+
v1 = Vlan.new(vlan_list[0])
|
612
|
+
|
613
|
+
pv_type = 'primary'
|
614
|
+
if validate_property_excluded?('vlan', 'private_vlan_type')
|
615
|
+
assert_nil(v1.private_vlan_type)
|
616
|
+
assert_raises(Cisco::UnsupportedError) do
|
617
|
+
v1.private_vlan_type = pv_type
|
618
|
+
end
|
619
|
+
return
|
620
|
+
else
|
621
|
+
v2 = Vlan.new(vlan_list[1])
|
622
|
+
v3 = Vlan.new(vlan_list[2])
|
623
|
+
v4 = Vlan.new(vlan_list[3])
|
624
|
+
v5 = Vlan.new(vlan_list[4])
|
625
|
+
v6 = Vlan.new(vlan_list[5])
|
626
|
+
v7 = Vlan.new(vlan_list[6])
|
627
|
+
|
628
|
+
v1.private_vlan_type = pv_type
|
629
|
+
assert_equal(pv_type, v1.private_vlan_type)
|
630
|
+
|
631
|
+
pv_type = 'isolated'
|
632
|
+
v2.private_vlan_type = pv_type
|
633
|
+
assert_equal(pv_type, v2.private_vlan_type)
|
634
|
+
|
635
|
+
pv_type = 'isolated'
|
636
|
+
v3.private_vlan_type = pv_type
|
637
|
+
assert_equal(pv_type, v3.private_vlan_type)
|
638
|
+
|
639
|
+
pv_type = 'community'
|
640
|
+
v4.private_vlan_type = pv_type
|
641
|
+
assert_equal(pv_type, v4.private_vlan_type)
|
642
|
+
|
643
|
+
pv_type = 'community'
|
644
|
+
v5.private_vlan_type = pv_type
|
645
|
+
assert_equal(pv_type, v5.private_vlan_type)
|
646
|
+
|
647
|
+
pv_type = 'community'
|
648
|
+
v6.private_vlan_type = pv_type
|
649
|
+
assert_equal(pv_type, v6.private_vlan_type)
|
650
|
+
|
651
|
+
pv_type = 'primary'
|
652
|
+
v7.private_vlan_type = pv_type
|
653
|
+
assert_equal(pv_type, v7.private_vlan_type)
|
654
|
+
|
655
|
+
v1.private_vlan_association = ['101', '104-105', '200', '202']
|
656
|
+
|
657
|
+
assert_equal(result, v1.private_vlan_association)
|
658
|
+
|
659
|
+
v1.private_vlan_association = ['101', '103-105', '108']
|
660
|
+
|
661
|
+
result = %w(101 103 104 105 108)
|
662
|
+
assert_equal(result, v1.private_vlan_association)
|
663
|
+
|
664
|
+
v1.private_vlan_association = ['101', '103-105', '108']
|
665
|
+
result = %w(101 103 104 105 108)
|
666
|
+
assert_equal(result, v1.private_vlan_association)
|
667
|
+
end
|
668
|
+
end
|
669
|
+
end
|