cisco_node_utils 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +81 -2
- data/CONTRIBUTING.md +2 -17
- data/Gemfile +5 -0
- data/README.md +92 -47
- data/Rakefile +23 -1
- data/bin/git/hooks/hook_lib +7 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +7 -2
- data/bin/git/hooks/pre-commit/validate-diffs +18 -4
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/update-hooks +64 -6
- data/cisco_node_utils.gemspec +9 -6
- data/docs/README-develop-best-practices.md +149 -50
- data/docs/README-develop-node-utils-APIs.md +92 -42
- data/docs/README-maintainers.md +7 -4
- data/docs/README-test-execution.md +57 -0
- data/docs/cisco_node_utils.yaml.example +30 -0
- data/docs/template-router.rb +4 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +2 -2
- data/lib/cisco_node_utils.rb +5 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +5 -6
- data/lib/cisco_node_utils/aaa_authorization_service.rb +1 -1
- data/lib/cisco_node_utils/ace.rb +165 -12
- data/lib/cisco_node_utils/acl.rb +2 -1
- data/lib/cisco_node_utils/bgp.rb +184 -21
- data/lib/cisco_node_utils/bgp_af.rb +94 -249
- data/lib/cisco_node_utils/bgp_neighbor.rb +94 -14
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +75 -8
- data/lib/cisco_node_utils/bridge_domain.rb +183 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +85 -2
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/client/client.rb +234 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +311 -0
- data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
- data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
- data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
- data/lib/cisco_node_utils/client/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +305 -0
- data/lib/cisco_node_utils/client/utils.rb +164 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +222 -254
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +22 -15
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +11 -8
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +21 -16
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +239 -109
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +114 -55
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +76 -52
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +106 -62
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +35 -14
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +23 -17
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +94 -83
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +22 -17
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +76 -26
- data/lib/cisco_node_utils/cmd_ref/images.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +381 -153
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +21 -21
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +30 -21
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +18 -13
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +26 -31
- data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
- data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +17 -6
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +10 -3
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +17 -5
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +33 -29
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +12 -10
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +16 -19
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +40 -25
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +17 -12
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +71 -35
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +10 -5
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +6 -2
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +47 -43
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +13 -11
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +4 -2
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +23 -21
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +26 -22
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +19 -17
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +18 -6
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +234 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +24 -9
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +5 -3
- data/lib/cisco_node_utils/cmd_ref/system.yaml +4 -3
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +22 -20
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +27 -15
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +45 -16
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +21 -11
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +3 -2
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +60 -32
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +118 -101
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +54 -58
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +118 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +19 -25
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +28 -18
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +34 -17
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +6 -4
- data/lib/cisco_node_utils/command_reference.rb +261 -142
- data/lib/cisco_node_utils/constants.rb +33 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +102 -0
- data/lib/cisco_node_utils/evpn_vni.rb +5 -3
- data/lib/cisco_node_utils/exceptions.rb +111 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +52 -35
- data/lib/cisco_node_utils/fabricpath_topology.rb +44 -57
- data/lib/cisco_node_utils/feature.rb +165 -3
- data/lib/cisco_node_utils/interface.rb +1051 -260
- data/lib/cisco_node_utils/interface_channel_group.rb +11 -10
- data/lib/cisco_node_utils/interface_ospf.rb +1 -2
- data/lib/cisco_node_utils/interface_portchannel.rb +4 -12
- data/lib/cisco_node_utils/interface_service_vni.rb +7 -7
- data/lib/cisco_node_utils/itd_device_group.rb +248 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +523 -0
- data/lib/cisco_node_utils/logger.rb +75 -0
- data/lib/cisco_node_utils/node.rb +62 -192
- data/lib/cisco_node_utils/node_util.rb +56 -10
- data/lib/cisco_node_utils/overlay_global.rb +2 -2
- data/lib/cisco_node_utils/pim.rb +2 -13
- data/lib/cisco_node_utils/pim_group_list.rb +1 -1
- data/lib/cisco_node_utils/pim_rp_address.rb +1 -1
- data/lib/cisco_node_utils/platform.rb +52 -21
- data/lib/cisco_node_utils/portchannel_global.rb +89 -19
- data/lib/cisco_node_utils/radius_server.rb +168 -37
- data/lib/cisco_node_utils/router_ospf.rb +20 -35
- data/lib/cisco_node_utils/router_ospf_vrf.rb +4 -4
- data/lib/cisco_node_utils/snmpserver.rb +1 -6
- data/lib/cisco_node_utils/snmpuser.rb +6 -4
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_server.rb +77 -18
- data/lib/cisco_node_utils/syslog_settings.rb +1 -1
- data/lib/cisco_node_utils/tacacs_server_group.rb +8 -4
- data/lib/cisco_node_utils/tacacs_server_host.rb +115 -25
- data/lib/cisco_node_utils/vdc.rb +12 -0
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +147 -29
- data/lib/cisco_node_utils/vpc.rb +55 -3
- data/lib/cisco_node_utils/vrf.rb +72 -11
- data/lib/cisco_node_utils/vrf_af.rb +114 -29
- data/lib/cisco_node_utils/vtp.rb +34 -52
- data/lib/cisco_node_utils/vxlan_vtep.rb +34 -8
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +36 -4
- data/lib/minitest/environment_plugin.rb +31 -0
- data/lib/minitest/log_level_plugin.rb +41 -0
- data/spec/client_spec.rb +7 -0
- data/spec/environment_spec.rb +263 -0
- data/spec/grpc_client_spec.rb +23 -0
- data/spec/isolate/all_clients_spec.rb +9 -0
- data/spec/isolate/grpc_only_spec.rb +16 -0
- data/spec/isolate/no_clients_spec.rb +26 -0
- data/spec/isolate/nxapi_only_spec.rb +16 -0
- data/spec/nxapi_client_spec.rb +42 -0
- data/spec/schema.yaml +75 -0
- data/spec/shared_examples_for_clients.rb +14 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/whitespace_spec.rb +10 -0
- data/spec/yaml_spec.rb +42 -0
- data/tests/.rubocop.yml +2 -2
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +96 -36
- data/tests/ciscotest.rb +220 -12
- data/tests/cmd_config.yaml +71 -49
- data/tests/cmd_config_invalid.yaml +1 -1
- data/tests/test_aaa_authentication_login.rb +1 -0
- data/tests/test_aaa_authentication_login_service.rb +9 -0
- data/tests/test_aaa_authorization_service.rb +173 -367
- data/tests/test_ace.rb +171 -100
- data/tests/test_acl.rb +10 -1
- data/tests/test_bgp_af.rb +395 -728
- data/tests/test_bgp_neighbor.rb +274 -115
- data/tests/test_bgp_neighbor_af.rb +178 -77
- data/tests/test_bridge_domain.rb +191 -0
- data/tests/test_bridge_domain_vni.rb +116 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_command_config.rb +9 -5
- data/tests/test_command_reference.rb +380 -102
- data/tests/test_dns_domain.rb +13 -3
- data/tests/test_domain_name.rb +13 -3
- data/tests/test_encapsulation.rb +77 -0
- data/tests/test_evpn_vni.rb +25 -7
- data/tests/test_fabricpath_global.rb +167 -163
- data/tests/test_fabricpath_topology.rb +12 -33
- data/tests/test_feature.rb +215 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_interface.rb +585 -344
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +6 -3
- data/tests/test_interface_ospf.rb +26 -24
- data/tests/test_interface_portchannel.rb +1 -0
- data/tests/test_interface_private_vlan.rb +724 -0
- data/tests/test_interface_service_vni.rb +37 -66
- data/tests/test_interface_svi.rb +98 -101
- data/tests/test_interface_switchport.rb +419 -549
- data/tests/test_itd_device_group.rb +145 -0
- data/tests/test_itd_device_group_node.rb +199 -0
- data/tests/test_itd_service.rb +298 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +11 -2
- data/tests/test_node.rb +16 -75
- data/tests/test_node_ext.rb +174 -163
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_config.rb +5 -1
- data/tests/test_ntp_server.rb +2 -2
- data/tests/test_nxapi.rb +221 -0
- data/tests/test_overlay_global.rb +47 -38
- data/tests/test_pim.rb +2 -0
- data/tests/test_pim_group_list.rb +2 -0
- data/tests/test_pim_rp_address.rb +2 -0
- data/tests/test_platform.rb +86 -39
- data/tests/test_portchannel_global.rb +211 -135
- data/tests/test_radius_global.rb +13 -5
- data/tests/test_radius_server.rb +256 -104
- data/tests/test_radius_server_group.rb +2 -0
- data/tests/test_router_bgp.rb +781 -485
- data/tests/test_router_ospf.rb +26 -103
- data/tests/test_router_ospf_vrf.rb +52 -57
- data/tests/test_snmp_notification_receiver.rb +2 -0
- data/tests/test_snmpcommunity.rb +2 -0
- data/tests/test_snmpgroup.rb +2 -0
- data/tests/test_snmpnotification.rb +40 -21
- data/tests/test_snmpserver.rb +2 -0
- data/tests/test_snmpuser.rb +2 -0
- data/tests/test_stp_global.rb +563 -0
- data/tests/test_syslog_server.rb +32 -8
- data/tests/test_syslog_settings.rb +22 -9
- data/tests/test_tacacs_server.rb +32 -27
- data/tests/test_tacacs_server_group.rb +100 -45
- data/tests/test_tacacs_server_host.rb +135 -43
- data/tests/test_vdc.rb +2 -16
- data/tests/test_vlan.rb +106 -54
- data/tests/test_vlan_mt_full.rb +11 -21
- data/tests/test_vlan_private.rb +669 -0
- data/tests/test_vpc.rb +312 -159
- data/tests/test_vrf.rb +122 -113
- data/tests/test_vrf_af.rb +238 -0
- data/tests/test_vtp.rb +58 -102
- data/tests/test_vxlan_vtep.rb +38 -17
- data/tests/test_vxlan_vtep_vni.rb +61 -9
- data/tests/test_yum.rb +49 -25
- metadata +122 -36
- data/lib/cisco_node_utils/cmd_ref/fex.yaml +0 -9
- data/lib/cisco_node_utils/cmd_ref/vni.yaml +0 -76
- data/lib/cisco_node_utils/vni.rb +0 -227
- data/tests/test_vni.rb +0 -106
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/itd_device_group'
|
|
17
|
+
|
|
18
|
+
include Cisco
|
|
19
|
+
# TestInterface - Minitest for general functionality
|
|
20
|
+
# of the ItdDeviceGroup class.
|
|
21
|
+
class TestItdDeviceGroup < CiscoTestCase
|
|
22
|
+
@skip_unless_supported = 'itd_device_group'
|
|
23
|
+
# Tests
|
|
24
|
+
|
|
25
|
+
def setup
|
|
26
|
+
super
|
|
27
|
+
config 'no feature itd'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def teardown
|
|
31
|
+
config 'no feature itd'
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_itd_device_group_create_destroy
|
|
36
|
+
skip_nexus_i2_image?
|
|
37
|
+
i1 = ItdDeviceGroup.new('abc')
|
|
38
|
+
i2 = ItdDeviceGroup.new('BCD')
|
|
39
|
+
i3 = ItdDeviceGroup.new('xyzABC')
|
|
40
|
+
assert_equal(3, ItdDeviceGroup.itds.keys.count)
|
|
41
|
+
|
|
42
|
+
i2.destroy
|
|
43
|
+
assert_equal(2, ItdDeviceGroup.itds.keys.count)
|
|
44
|
+
|
|
45
|
+
i1.destroy
|
|
46
|
+
i3.destroy
|
|
47
|
+
assert_equal(0, ItdDeviceGroup.itds.keys.count)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def probe_helper(props)
|
|
51
|
+
test_hash = {
|
|
52
|
+
probe_frequency: 9,
|
|
53
|
+
probe_retry_down: 5,
|
|
54
|
+
probe_retry_up: 5,
|
|
55
|
+
probe_timeout: 6,
|
|
56
|
+
}.merge!(props)
|
|
57
|
+
|
|
58
|
+
idg = ItdDeviceGroup.new('new_group')
|
|
59
|
+
idg.probe_set(test_hash)
|
|
60
|
+
idg
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_probe_icmp
|
|
64
|
+
skip_nexus_i2_image?
|
|
65
|
+
idg = probe_helper(probe_type: 'icmp')
|
|
66
|
+
assert_equal('icmp', idg.probe_type)
|
|
67
|
+
assert_equal(9, idg.probe_frequency)
|
|
68
|
+
assert_equal(6, idg.probe_timeout)
|
|
69
|
+
assert_equal(5, idg.probe_retry_up)
|
|
70
|
+
assert_equal(5, idg.probe_retry_down)
|
|
71
|
+
idg = probe_helper(probe_type: 'icmp',
|
|
72
|
+
probe_frequency: idg.default_probe_frequency,
|
|
73
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
74
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
75
|
+
probe_timeout: idg.default_probe_timeout)
|
|
76
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
77
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
78
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
79
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
80
|
+
idg = probe_helper(probe_type: idg.default_probe_type)
|
|
81
|
+
assert_equal(idg.default_probe_type, idg.probe_type)
|
|
82
|
+
idg.destroy
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_probe_dns
|
|
86
|
+
skip_nexus_i2_image?
|
|
87
|
+
host = 'resolver1.opendns.com'
|
|
88
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host)
|
|
89
|
+
assert_equal('dns', idg.probe_type)
|
|
90
|
+
assert_equal(host, idg.probe_dns_host)
|
|
91
|
+
assert_equal(9, idg.probe_frequency)
|
|
92
|
+
assert_equal(6, idg.probe_timeout)
|
|
93
|
+
assert_equal(5, idg.probe_retry_up)
|
|
94
|
+
assert_equal(5, idg.probe_retry_down)
|
|
95
|
+
host = '208.67.220.222'
|
|
96
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host,
|
|
97
|
+
probe_frequency: idg.default_probe_frequency,
|
|
98
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
99
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
100
|
+
probe_timeout: idg.default_probe_timeout)
|
|
101
|
+
assert_equal(host, idg.probe_dns_host)
|
|
102
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
103
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
104
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
105
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
106
|
+
host = '2620:0:ccd::2'
|
|
107
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host,
|
|
108
|
+
probe_frequency: idg.default_probe_frequency,
|
|
109
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
110
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
111
|
+
probe_timeout: idg.default_probe_timeout)
|
|
112
|
+
assert_equal(host, idg.probe_dns_host)
|
|
113
|
+
idg.destroy
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_probe_tcp_udp
|
|
117
|
+
skip_nexus_i2_image?
|
|
118
|
+
port = 11_111
|
|
119
|
+
type = 'tcp'
|
|
120
|
+
idg = probe_helper(probe_type: type, probe_port: port,
|
|
121
|
+
probe_control: true)
|
|
122
|
+
assert_equal(type, idg.probe_type)
|
|
123
|
+
assert_equal(port, idg.probe_port)
|
|
124
|
+
assert_equal(true, idg.probe_control)
|
|
125
|
+
assert_equal(9, idg.probe_frequency)
|
|
126
|
+
assert_equal(6, idg.probe_timeout)
|
|
127
|
+
assert_equal(5, idg.probe_retry_up)
|
|
128
|
+
assert_equal(5, idg.probe_retry_down)
|
|
129
|
+
type = 'udp'
|
|
130
|
+
idg = probe_helper(probe_type: type, probe_port: port,
|
|
131
|
+
probe_control: idg.default_probe_control,
|
|
132
|
+
probe_frequency: idg.default_probe_frequency,
|
|
133
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
134
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
135
|
+
probe_timeout: idg.default_probe_timeout)
|
|
136
|
+
assert_equal(type, idg.probe_type)
|
|
137
|
+
assert_equal(port, idg.probe_port)
|
|
138
|
+
assert_equal(idg.default_probe_control, idg.probe_control)
|
|
139
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
140
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
141
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
142
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
143
|
+
idg.destroy
|
|
144
|
+
end
|
|
145
|
+
end
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/itd_device_group_node'
|
|
17
|
+
|
|
18
|
+
include Cisco
|
|
19
|
+
# TestInterface - Minitest for general functionality
|
|
20
|
+
# of the ItdDeviceGroup class.
|
|
21
|
+
class TestItdDeviceGroupNode < CiscoTestCase
|
|
22
|
+
@skip_unless_supported = 'itd_device_group'
|
|
23
|
+
# Tests
|
|
24
|
+
|
|
25
|
+
def setup
|
|
26
|
+
super
|
|
27
|
+
config 'no feature itd'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def teardown
|
|
31
|
+
config 'no feature itd'
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_itd_device_group_node_create_destroy
|
|
36
|
+
skip_nexus_i2_image?
|
|
37
|
+
itddg1 = ItdDeviceGroup.new('abc')
|
|
38
|
+
n1 = ItdDeviceGroupNode.new(itddg1.name, '1.1.1.1', 'ip')
|
|
39
|
+
n2 = ItdDeviceGroupNode.new(itddg1.name, '2.2.2.2', 'ip')
|
|
40
|
+
n3 = ItdDeviceGroupNode.new(itddg1.name, '3.3.3.3', 'ip')
|
|
41
|
+
assert_includes(ItdDeviceGroupNode.itd_nodes['abc'], '1.1.1.1')
|
|
42
|
+
assert_includes(ItdDeviceGroupNode.itd_nodes['abc'], '2.2.2.2')
|
|
43
|
+
assert_includes(ItdDeviceGroupNode.itd_nodes['abc'], '3.3.3.3')
|
|
44
|
+
itddg2 = ItdDeviceGroup.new('xyz')
|
|
45
|
+
n4 = ItdDeviceGroupNode.new(itddg2.name, '2000::1', 'IPv6')
|
|
46
|
+
assert_includes(ItdDeviceGroupNode.itd_nodes['xyz'], '2000::1')
|
|
47
|
+
itddg3 = ItdDeviceGroup.new('efg')
|
|
48
|
+
n5 = ItdDeviceGroupNode.new(itddg3.name, '1.1.1.1', 'ip')
|
|
49
|
+
assert_includes(ItdDeviceGroupNode.itd_nodes['efg'], '1.1.1.1')
|
|
50
|
+
|
|
51
|
+
n1.destroy
|
|
52
|
+
refute_includes(ItdDeviceGroupNode.itd_nodes['abc'], '1.1.1.1')
|
|
53
|
+
n2.destroy
|
|
54
|
+
n3.destroy
|
|
55
|
+
assert_empty(ItdDeviceGroupNode.itd_nodes['abc'])
|
|
56
|
+
n4.destroy
|
|
57
|
+
assert_empty(ItdDeviceGroupNode.itd_nodes['xyz'])
|
|
58
|
+
n5.destroy
|
|
59
|
+
assert_empty(ItdDeviceGroupNode.itd_nodes['efg'])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def probe_helper(props)
|
|
63
|
+
test_hash = {
|
|
64
|
+
probe_frequency: 9,
|
|
65
|
+
probe_retry_down: 5,
|
|
66
|
+
probe_retry_up: 5,
|
|
67
|
+
probe_timeout: 6,
|
|
68
|
+
}.merge!(props)
|
|
69
|
+
|
|
70
|
+
ItdDeviceGroup.new('new_group')
|
|
71
|
+
idg = ItdDeviceGroupNode.new('new_group', '1.1.1.1', 'ip')
|
|
72
|
+
idg.probe_set(test_hash)
|
|
73
|
+
idg
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_probe_icmp
|
|
77
|
+
skip_nexus_i2_image?
|
|
78
|
+
idg = probe_helper(probe_type: 'icmp')
|
|
79
|
+
assert_equal('icmp', idg.probe_type)
|
|
80
|
+
assert_equal(9, idg.probe_frequency)
|
|
81
|
+
assert_equal(6, idg.probe_timeout)
|
|
82
|
+
assert_equal(5, idg.probe_retry_up)
|
|
83
|
+
assert_equal(5, idg.probe_retry_down)
|
|
84
|
+
idg = probe_helper(probe_type: 'icmp',
|
|
85
|
+
probe_frequency: idg.default_probe_frequency,
|
|
86
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
87
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
88
|
+
probe_timeout: idg.default_probe_timeout)
|
|
89
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
90
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
91
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
92
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
93
|
+
idg = probe_helper(probe_type: idg.default_probe_type)
|
|
94
|
+
assert_equal(idg.default_probe_type, idg.probe_type)
|
|
95
|
+
idg.destroy
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_probe_dns
|
|
99
|
+
skip_nexus_i2_image?
|
|
100
|
+
host = 'resolver1.opendns.com'
|
|
101
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host)
|
|
102
|
+
assert_equal('dns', idg.probe_type)
|
|
103
|
+
assert_equal(host, idg.probe_dns_host)
|
|
104
|
+
assert_equal(9, idg.probe_frequency)
|
|
105
|
+
assert_equal(6, idg.probe_timeout)
|
|
106
|
+
assert_equal(5, idg.probe_retry_up)
|
|
107
|
+
assert_equal(5, idg.probe_retry_down)
|
|
108
|
+
host = '208.67.220.222'
|
|
109
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host,
|
|
110
|
+
probe_frequency: idg.default_probe_frequency,
|
|
111
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
112
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
113
|
+
probe_timeout: idg.default_probe_timeout)
|
|
114
|
+
assert_equal(host, idg.probe_dns_host)
|
|
115
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
116
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
117
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
118
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
119
|
+
host = '2620:0:ccd::2'
|
|
120
|
+
idg = probe_helper(probe_type: 'dns', probe_dns_host: host,
|
|
121
|
+
probe_frequency: idg.default_probe_frequency,
|
|
122
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
123
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
124
|
+
probe_timeout: idg.default_probe_timeout)
|
|
125
|
+
assert_equal(host, idg.probe_dns_host)
|
|
126
|
+
idg.destroy
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def test_probe_tcp_udp
|
|
130
|
+
skip_nexus_i2_image?
|
|
131
|
+
port = 11_111
|
|
132
|
+
type = 'tcp'
|
|
133
|
+
idg = probe_helper(probe_type: type, probe_port: port,
|
|
134
|
+
probe_control: true)
|
|
135
|
+
assert_equal(type, idg.probe_type)
|
|
136
|
+
assert_equal(port, idg.probe_port)
|
|
137
|
+
assert_equal(true, idg.probe_control)
|
|
138
|
+
assert_equal(9, idg.probe_frequency)
|
|
139
|
+
assert_equal(6, idg.probe_timeout)
|
|
140
|
+
assert_equal(5, idg.probe_retry_up)
|
|
141
|
+
assert_equal(5, idg.probe_retry_down)
|
|
142
|
+
type = 'udp'
|
|
143
|
+
idg = probe_helper(probe_type: type, probe_port: port,
|
|
144
|
+
probe_control: idg.default_probe_control,
|
|
145
|
+
probe_frequency: idg.default_probe_frequency,
|
|
146
|
+
probe_retry_up: idg.default_probe_retry_up,
|
|
147
|
+
probe_retry_down: idg.default_probe_retry_down,
|
|
148
|
+
probe_timeout: idg.default_probe_timeout)
|
|
149
|
+
assert_equal(type, idg.probe_type)
|
|
150
|
+
assert_equal(port, idg.probe_port)
|
|
151
|
+
assert_equal(idg.default_probe_control, idg.probe_control)
|
|
152
|
+
assert_equal(idg.default_probe_frequency, idg.probe_frequency)
|
|
153
|
+
assert_equal(idg.default_probe_timeout, idg.probe_timeout)
|
|
154
|
+
assert_equal(idg.default_probe_retry_up, idg.probe_retry_up)
|
|
155
|
+
assert_equal(idg.default_probe_retry_down, idg.probe_retry_down)
|
|
156
|
+
idg.destroy
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def test_hot_standby_weight
|
|
160
|
+
skip_nexus_i2_image?
|
|
161
|
+
itddg = ItdDeviceGroup.new('new_group')
|
|
162
|
+
idg = ItdDeviceGroupNode.new('new_group', '1.1.1.1', 'ip')
|
|
163
|
+
hot_standby = true
|
|
164
|
+
weight = idg.default_weight
|
|
165
|
+
idg.hs_weight(hot_standby, weight)
|
|
166
|
+
assert_equal(true, idg.hot_standby)
|
|
167
|
+
assert_equal(idg.default_weight,
|
|
168
|
+
idg.weight)
|
|
169
|
+
hot_standby = idg.default_hot_standby
|
|
170
|
+
weight = idg.default_weight
|
|
171
|
+
idg.hs_weight(hot_standby, weight)
|
|
172
|
+
assert_equal(idg.default_hot_standby, idg.hot_standby)
|
|
173
|
+
assert_equal(idg.default_weight,
|
|
174
|
+
idg.weight)
|
|
175
|
+
hot_standby = idg.default_hot_standby
|
|
176
|
+
weight = 150
|
|
177
|
+
idg.hs_weight(hot_standby, weight)
|
|
178
|
+
assert_equal(idg.default_hot_standby, idg.hot_standby)
|
|
179
|
+
assert_equal(150, idg.weight)
|
|
180
|
+
hot_standby = idg.default_hot_standby
|
|
181
|
+
weight = 200
|
|
182
|
+
idg.hs_weight(hot_standby, weight)
|
|
183
|
+
assert_equal(idg.default_hot_standby, idg.hot_standby)
|
|
184
|
+
assert_equal(200, idg.weight)
|
|
185
|
+
hot_standby = true
|
|
186
|
+
weight = idg.default_weight
|
|
187
|
+
idg.hs_weight(hot_standby, weight)
|
|
188
|
+
assert_equal(true, idg.hot_standby)
|
|
189
|
+
assert_equal(idg.default_weight,
|
|
190
|
+
idg.weight)
|
|
191
|
+
hot_standby = idg.default_hot_standby
|
|
192
|
+
weight = 200
|
|
193
|
+
idg.hs_weight(hot_standby, weight)
|
|
194
|
+
assert_equal(idg.default_hot_standby, idg.hot_standby)
|
|
195
|
+
assert_equal(200, idg.weight)
|
|
196
|
+
idg.destroy
|
|
197
|
+
itddg.destroy
|
|
198
|
+
end
|
|
199
|
+
end
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/itd_device_group_node'
|
|
17
|
+
require_relative '../lib/cisco_node_utils/itd_service'
|
|
18
|
+
|
|
19
|
+
include Cisco
|
|
20
|
+
# TestInterface - Minitest for general functionality
|
|
21
|
+
# of the ItdService class.
|
|
22
|
+
class TestItdService < CiscoTestCase
|
|
23
|
+
@skip_unless_supported = 'itd_service'
|
|
24
|
+
# Tests
|
|
25
|
+
|
|
26
|
+
def setup
|
|
27
|
+
super
|
|
28
|
+
config 'no feature itd'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def teardown
|
|
32
|
+
config 'no feature itd'
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_itd_service_create_destroy
|
|
37
|
+
skip_nexus_i2_image?
|
|
38
|
+
i1 = ItdService.new('abc')
|
|
39
|
+
i2 = ItdService.new('BCD')
|
|
40
|
+
i3 = ItdService.new('xyzABC')
|
|
41
|
+
assert_equal(3, ItdService.itds.keys.count)
|
|
42
|
+
|
|
43
|
+
i2.destroy
|
|
44
|
+
assert_equal(2, ItdService.itds.keys.count)
|
|
45
|
+
|
|
46
|
+
i1.destroy
|
|
47
|
+
i3.destroy
|
|
48
|
+
assert_equal(0, ItdService.itds.keys.count)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_access_list
|
|
52
|
+
skip_nexus_i2_image?
|
|
53
|
+
itd = ItdService.new('new_group')
|
|
54
|
+
config 'ip access-list include'
|
|
55
|
+
config 'ip access-list exclude'
|
|
56
|
+
itd.access_list = 'include'
|
|
57
|
+
itd.exclude_access_list = 'exclude'
|
|
58
|
+
assert_equal('include', itd.access_list)
|
|
59
|
+
assert_equal('exclude', itd.exclude_access_list)
|
|
60
|
+
itd.access_list = itd.default_access_list
|
|
61
|
+
itd.exclude_access_list = itd.default_exclude_access_list
|
|
62
|
+
assert_equal(itd.default_access_list,
|
|
63
|
+
itd.access_list)
|
|
64
|
+
assert_equal(itd.default_exclude_access_list,
|
|
65
|
+
itd.exclude_access_list)
|
|
66
|
+
config 'no ip access-list include'
|
|
67
|
+
config 'no ip access-list exclude'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_device_group
|
|
71
|
+
skip_nexus_i2_image?
|
|
72
|
+
itd = ItdService.new('new_group')
|
|
73
|
+
ItdDeviceGroup.new('myGroup')
|
|
74
|
+
itd.device_group = 'myGroup'
|
|
75
|
+
assert_equal('myGroup', itd.device_group)
|
|
76
|
+
itd.device_group = itd.default_device_group
|
|
77
|
+
assert_equal(itd.default_device_group,
|
|
78
|
+
itd.device_group)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_fail_action
|
|
82
|
+
skip_nexus_i2_image?
|
|
83
|
+
itd = ItdService.new('new_group')
|
|
84
|
+
itd.fail_action = true
|
|
85
|
+
assert_equal(true, itd.fail_action)
|
|
86
|
+
itd.fail_action = itd.default_fail_action
|
|
87
|
+
assert_equal(itd.default_fail_action,
|
|
88
|
+
itd.fail_action)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_ingress_interface
|
|
92
|
+
skip_nexus_i2_image?
|
|
93
|
+
config 'feature interface-vlan'
|
|
94
|
+
config 'vlan 2'
|
|
95
|
+
config 'interface vlan 2'
|
|
96
|
+
config 'interface port-channel 100 ; no switchport'
|
|
97
|
+
itd = ItdService.new('new_group')
|
|
98
|
+
intf = interfaces[0].dup
|
|
99
|
+
new_intf = Interface.new(interfaces[0])
|
|
100
|
+
new_intf.switchport_mode = :disabled
|
|
101
|
+
ii = [['vlan 2', '1.1.1.1'],
|
|
102
|
+
[intf.insert(8, ' '), '2.2.2.2'],
|
|
103
|
+
['port-channel 100', '3.3.3.3']]
|
|
104
|
+
itd.ingress_interface = ii
|
|
105
|
+
assert_equal(itd.ingress_interface, ii)
|
|
106
|
+
itd.ingress_interface = itd.default_ingress_interface
|
|
107
|
+
assert_equal(itd.ingress_interface, itd.default_ingress_interface)
|
|
108
|
+
config 'no interface port-channel 100'
|
|
109
|
+
config 'no interface vlan 2'
|
|
110
|
+
config 'no vlan 2'
|
|
111
|
+
config 'no feature interface-vlan'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def lb_helper(props)
|
|
115
|
+
itd = ItdService.new('new_group')
|
|
116
|
+
test_hash = {
|
|
117
|
+
load_bal_enable: true,
|
|
118
|
+
load_bal_method_bundle_select: itd.default_load_bal_method_bundle_select,
|
|
119
|
+
load_bal_method_bundle_hash: itd.default_load_bal_method_bundle_hash,
|
|
120
|
+
load_bal_method_proto: itd.default_load_bal_method_proto,
|
|
121
|
+
load_bal_buckets: itd.default_load_bal_buckets,
|
|
122
|
+
load_bal_method_end_port: itd.default_load_bal_method_end_port,
|
|
123
|
+
load_bal_method_start_port: itd.default_load_bal_method_start_port,
|
|
124
|
+
}.merge!(props)
|
|
125
|
+
itd.load_balance_set(test_hash)
|
|
126
|
+
itd
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def test_load_balance
|
|
130
|
+
skip_nexus_i2_image?
|
|
131
|
+
itd = lb_helper(load_bal_method_bundle_select: 'src',
|
|
132
|
+
load_bal_method_bundle_hash: 'ip',
|
|
133
|
+
load_bal_buckets: 16,
|
|
134
|
+
load_bal_mask_pos: 4)
|
|
135
|
+
assert_equal(true, itd.load_bal_enable)
|
|
136
|
+
assert_equal(16, itd.load_bal_buckets)
|
|
137
|
+
assert_equal(4, itd.load_bal_mask_pos)
|
|
138
|
+
assert_equal('ip', itd.load_bal_method_bundle_hash)
|
|
139
|
+
assert_equal('src', itd.load_bal_method_bundle_select)
|
|
140
|
+
itd = lb_helper(load_bal_enable: true,
|
|
141
|
+
load_bal_method_bundle_select: 'dst',
|
|
142
|
+
load_bal_method_bundle_hash: 'ip-l4port',
|
|
143
|
+
load_bal_buckets: 128,
|
|
144
|
+
load_bal_mask_pos: 10,
|
|
145
|
+
load_bal_method_end_port: 700,
|
|
146
|
+
load_bal_method_proto: 'tcp',
|
|
147
|
+
load_bal_method_start_port: 200)
|
|
148
|
+
assert_equal(128, itd.load_bal_buckets)
|
|
149
|
+
assert_equal(10, itd.load_bal_mask_pos)
|
|
150
|
+
assert_equal('ip-l4port', itd.load_bal_method_bundle_hash)
|
|
151
|
+
assert_equal('dst', itd.load_bal_method_bundle_select)
|
|
152
|
+
assert_equal(700, itd.load_bal_method_end_port)
|
|
153
|
+
assert_equal(200, itd.load_bal_method_start_port)
|
|
154
|
+
assert_equal('tcp', itd.load_bal_method_proto)
|
|
155
|
+
itd = lb_helper(load_bal_mask_pos: 20)
|
|
156
|
+
assert_equal(itd.default_load_bal_buckets,
|
|
157
|
+
itd.load_bal_buckets)
|
|
158
|
+
assert_equal(20, itd.load_bal_mask_pos)
|
|
159
|
+
assert_equal(itd.default_load_bal_method_bundle_hash,
|
|
160
|
+
itd.load_bal_method_bundle_hash)
|
|
161
|
+
assert_equal(itd.default_load_bal_method_bundle_select,
|
|
162
|
+
itd.load_bal_method_bundle_select)
|
|
163
|
+
assert_equal(itd.default_load_bal_method_end_port,
|
|
164
|
+
itd.load_bal_method_end_port)
|
|
165
|
+
assert_equal(itd.default_load_bal_method_start_port,
|
|
166
|
+
itd.load_bal_method_start_port)
|
|
167
|
+
assert_equal(itd.default_load_bal_method_proto,
|
|
168
|
+
itd.load_bal_method_proto)
|
|
169
|
+
itd = lb_helper(load_bal_enable: true,
|
|
170
|
+
load_bal_buckets: 256)
|
|
171
|
+
assert_equal(256, itd.load_bal_buckets)
|
|
172
|
+
assert_equal(itd.default_load_bal_mask_pos,
|
|
173
|
+
itd.load_bal_mask_pos)
|
|
174
|
+
assert_equal(itd.default_load_bal_method_bundle_hash,
|
|
175
|
+
itd.load_bal_method_bundle_hash)
|
|
176
|
+
assert_equal(itd.default_load_bal_method_bundle_select,
|
|
177
|
+
itd.load_bal_method_bundle_select)
|
|
178
|
+
assert_equal(itd.default_load_bal_method_end_port,
|
|
179
|
+
itd.load_bal_method_end_port)
|
|
180
|
+
assert_equal(itd.default_load_bal_method_start_port,
|
|
181
|
+
itd.load_bal_method_start_port)
|
|
182
|
+
assert_equal(itd.default_load_bal_method_proto,
|
|
183
|
+
itd.load_bal_method_proto)
|
|
184
|
+
itd = lb_helper(load_bal_enable: false)
|
|
185
|
+
assert_equal(itd.load_bal_enable,
|
|
186
|
+
itd.default_load_bal_enable)
|
|
187
|
+
assert_equal(itd.load_bal_buckets, itd.default_load_bal_buckets)
|
|
188
|
+
assert_equal(itd.load_bal_mask_pos, itd.default_load_bal_mask_pos)
|
|
189
|
+
assert_equal(itd.load_bal_method_bundle_hash,
|
|
190
|
+
itd.default_load_bal_method_bundle_hash)
|
|
191
|
+
assert_equal(itd.load_bal_method_bundle_select,
|
|
192
|
+
itd.default_load_bal_method_bundle_select)
|
|
193
|
+
assert_equal(itd.load_bal_method_end_port,
|
|
194
|
+
itd.default_load_bal_method_end_port)
|
|
195
|
+
assert_equal(itd.load_bal_method_start_port,
|
|
196
|
+
itd.default_load_bal_method_start_port)
|
|
197
|
+
assert_equal(itd.load_bal_method_proto,
|
|
198
|
+
itd.default_load_bal_method_proto)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def test_nat_destination
|
|
202
|
+
skip_nexus_i2_image?
|
|
203
|
+
itd = ItdService.new('new_group')
|
|
204
|
+
if validate_property_excluded?('itd_service', 'nat_destination')
|
|
205
|
+
assert_nil(itd.nat_destination)
|
|
206
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
207
|
+
itd.nat_destination = false
|
|
208
|
+
end
|
|
209
|
+
return
|
|
210
|
+
end
|
|
211
|
+
itddg = ItdDeviceGroup.new('abc')
|
|
212
|
+
ItdDeviceGroupNode.new(itddg.name, '1.1.1.1', 'ip')
|
|
213
|
+
itd.device_group = 'abc'
|
|
214
|
+
itd.virtual_ip = ['ip 2.2.2.2 255.255.255.0']
|
|
215
|
+
intf = interfaces[0].dup
|
|
216
|
+
new_intf = Interface.new(interfaces[0])
|
|
217
|
+
new_intf.switchport_mode = :disabled
|
|
218
|
+
ii = [[intf.insert(8, ' '), '2.2.2.2']]
|
|
219
|
+
itd.ingress_interface = ii
|
|
220
|
+
itd.nat_destination = true
|
|
221
|
+
assert_equal(true, itd.nat_destination)
|
|
222
|
+
itd.nat_destination = itd.default_nat_destination
|
|
223
|
+
assert_equal(itd.default_nat_destination, itd.nat_destination)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def test_shutdown
|
|
227
|
+
skip_nexus_i2_image?
|
|
228
|
+
itd = ItdService.new('new_group')
|
|
229
|
+
itddg = ItdDeviceGroup.new('abc')
|
|
230
|
+
ItdDeviceGroupNode.new(itddg.name, '1.1.1.1', 'ip')
|
|
231
|
+
itd.device_group = 'abc'
|
|
232
|
+
itd.virtual_ip = ['ip 2.2.2.2 255.255.255.0']
|
|
233
|
+
intf = Interface.new(interfaces[0])
|
|
234
|
+
new_intf = Interface.new(interfaces[0])
|
|
235
|
+
new_intf.switchport_mode = :disabled
|
|
236
|
+
intf.switchport_mode = :disabled
|
|
237
|
+
intf_dup = interfaces[0].dup
|
|
238
|
+
ii = [[intf_dup.insert(8, ' '), '2.2.2.2']]
|
|
239
|
+
itd.ingress_interface = ii
|
|
240
|
+
itd.shutdown = false
|
|
241
|
+
assert_equal(false, itd.shutdown)
|
|
242
|
+
itd.shutdown = itd.default_shutdown
|
|
243
|
+
assert_equal(itd.default_shutdown,
|
|
244
|
+
itd.shutdown)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def test_peer_vdc
|
|
248
|
+
skip_nexus_i2_image?
|
|
249
|
+
itd = ItdService.new('new_group')
|
|
250
|
+
parray = %w(vdc1 ser1)
|
|
251
|
+
if validate_property_excluded?('itd_service', 'peer_vdc')
|
|
252
|
+
assert_nil(itd.peer_vdc)
|
|
253
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
254
|
+
itd.peer_vdc = parray
|
|
255
|
+
end
|
|
256
|
+
return
|
|
257
|
+
end
|
|
258
|
+
itd.peer_vdc = parray
|
|
259
|
+
assert_equal(parray, itd.peer_vdc)
|
|
260
|
+
itd.peer_vdc = itd.default_peer_vdc
|
|
261
|
+
assert_equal(itd.default_peer_vdc,
|
|
262
|
+
itd.peer_vdc)
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def test_peer_local
|
|
266
|
+
skip_nexus_i2_image?
|
|
267
|
+
itd = ItdService.new('new_group')
|
|
268
|
+
service = 'ser1'
|
|
269
|
+
if validate_property_excluded?('itd_service', 'peer_local')
|
|
270
|
+
assert_nil(itd.peer_local)
|
|
271
|
+
assert_raises(Cisco::UnsupportedError) do
|
|
272
|
+
itd.peer_local = service
|
|
273
|
+
end
|
|
274
|
+
return
|
|
275
|
+
end
|
|
276
|
+
itd.peer_local = service
|
|
277
|
+
assert_equal(service, itd.peer_local)
|
|
278
|
+
itd.peer_local = itd.default_peer_local
|
|
279
|
+
assert_equal(itd.default_peer_local,
|
|
280
|
+
itd.peer_local)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def test_virtual_ip
|
|
284
|
+
skip_nexus_i2_image?
|
|
285
|
+
itd = ItdService.new('new_group')
|
|
286
|
+
ItdDeviceGroup.new('myGroup1')
|
|
287
|
+
ItdDeviceGroup.new('myGroup2')
|
|
288
|
+
values = ['ip 1.1.1.1 255.255.255.0 tcp 2000 advertise enable',
|
|
289
|
+
'ip 2.2.2.2 255.0.0.0 udp 1000 device-group myGroup1',
|
|
290
|
+
'ip 3.3.3.3 255.0.255.0 device-group myGroup2']
|
|
291
|
+
itd.virtual_ip = values
|
|
292
|
+
assert_equal(itd.virtual_ip,
|
|
293
|
+
values)
|
|
294
|
+
itd.virtual_ip = itd.default_virtual_ip
|
|
295
|
+
assert_equal(itd.virtual_ip,
|
|
296
|
+
itd.default_virtual_ip)
|
|
297
|
+
end
|
|
298
|
+
end
|