vipruby 0.1.4 → 0.1.6.1
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 +3 -0
- data/.yardoc/checksums +7 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/doc/Host.html +910 -0
- data/doc/Vipr.html +656 -0
- data/doc/ViprBase.html +928 -0
- data/doc/ViprHost.html +1952 -0
- data/doc/ViprStorageSystem.html +2695 -0
- data/doc/ViprVcenter.html +1540 -0
- data/doc/Vipruby.html +139 -0
- data/doc/Vipruby/Auth.html +745 -0
- data/doc/_index.html +135 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +121 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +121 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +333 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/.yardoc/checksums +0 -0
- data/lib/.yardoc/object_types +0 -0
- data/lib/.yardoc/objects/root.dat +0 -0
- data/lib/.yardoc/proxy_types +0 -0
- data/lib/vipruby.rb +6 -426
- data/lib/vipruby/.yardoc/checksums +0 -0
- data/lib/vipruby/.yardoc/object_types +0 -0
- data/lib/vipruby/.yardoc/objects/root.dat +0 -0
- data/lib/vipruby/.yardoc/proxy_types +0 -0
- data/lib/vipruby/objects/host.rb +234 -0
- data/lib/vipruby/objects/storagesystem.rb +278 -0
- data/lib/vipruby/objects/vcenter.rb +162 -0
- data/lib/vipruby/version.rb +6 -0
- data/lib/vipruby/vipr.rb +45 -0
- data/lib/vipruby/viprbase.rb +84 -0
- data/vipruby.gemspec +29 -0
- metadata +100 -9
File without changes
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,234 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
# The Following Host calls will get Host information for all tenants
|
5
|
+
module ViprHost
|
6
|
+
|
7
|
+
# generate JSON for Host POST
|
8
|
+
#
|
9
|
+
# @param host_type [String] Type of Host. Required Param.
|
10
|
+
# @param ip_or_dns [String] IP Address or FQDN of the host to add. Required Param.
|
11
|
+
# @param name [String] Arbitrary name given to the host. Required Param
|
12
|
+
# @param port [String] Port for connecting to the specfic host. Will be autogenerated if not specified by the {#add_host} method
|
13
|
+
# @param user_name [String] User Name to connect to this host.
|
14
|
+
# @param password [String] Password for the Username to connect to this host.
|
15
|
+
# @param use_ssl [String] True or False
|
16
|
+
# @param discoverable [String] True or False for searching initators after being added.
|
17
|
+
#
|
18
|
+
# @return [JSON] The JSON object for the POST operation
|
19
|
+
def generate_host_post_json(host_type, ip_or_dns, name, port, user_name, password, use_ssl, discoverable)
|
20
|
+
payload = {
|
21
|
+
type: host_type,
|
22
|
+
host_name: ip_or_dns,
|
23
|
+
name: name,
|
24
|
+
port_number: port,
|
25
|
+
user_name: user_name,
|
26
|
+
password: password,
|
27
|
+
use_ssl: use_ssl,
|
28
|
+
discoverable: discoverable
|
29
|
+
}.to_json
|
30
|
+
|
31
|
+
return payload
|
32
|
+
end
|
33
|
+
|
34
|
+
# generate JSON for Initators POST
|
35
|
+
#
|
36
|
+
# @param protocol [String] Type of protocol. Required Param
|
37
|
+
# @param initiator_node [String] Node string. Required Param
|
38
|
+
# @param initiator_port [Array] Ports should be passed as an array. Every port will be added into another array for the entire JSON object
|
39
|
+
#
|
40
|
+
# @return [ARRAY] JSON objects will be put into an Array
|
41
|
+
def generate_initiators_json(protocol, initiator_node, initiator_port)
|
42
|
+
initiator_json = []
|
43
|
+
initiator_port.each do |initiator|
|
44
|
+
initiator_json <<
|
45
|
+
{
|
46
|
+
protocol: protocol,
|
47
|
+
initiator_node: initiator_node,
|
48
|
+
initiator_port: initiator
|
49
|
+
}.to_json
|
50
|
+
end
|
51
|
+
return initiator_json
|
52
|
+
end
|
53
|
+
|
54
|
+
# Add a host to ViPR
|
55
|
+
#
|
56
|
+
# @param host_type [String] Type of Host. "Windows", "Linux", or, "HPUX". Required Param
|
57
|
+
# @param ip_or_dns [String] IP Address or FQDN of host. Required Param
|
58
|
+
# @param name [String] Arbitrary Name only necesary and identifiable by ViPR. Required Param.
|
59
|
+
# @param user_name [String] User Name to connect to the host. Required Param
|
60
|
+
# @param password [String] Password for the User Name to connect to the host. Required Param
|
61
|
+
# @param port [String] Port to connect to the host. Optional Param. Defaults will be used if no param is passed
|
62
|
+
# @param use_ssl [String] Whether SSL is used. Trur or False. Optional Param
|
63
|
+
# @param discoverable [String] True or False. Initators and Nodes will be discovered after being added. By default this is true
|
64
|
+
#
|
65
|
+
# @return [JSON] returns host information
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# vipr.add_host('Windows', 'windowshost.mydomain.org', 'WindowsHOST' 'DOMAIN\user', 'userpw')
|
69
|
+
# vipr.add_host('Windows', 'windowshost.mydomain.org', 'WindowsHOST' 'DOMAIN\user', 'userpw', '453', 'true', 'true')
|
70
|
+
# vipr.add_host('Linux', 'linuxhost.mydomain.org', 'LinuxHOST' 'DOMAIN\user', 'userpw')
|
71
|
+
def add_host(host_type=nil, ip_or_dns=nil, name=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, discoverable=nil, auth=nil, cert=nil)
|
72
|
+
check_host_post(host_type, ip_or_dns, name, user_name, password)
|
73
|
+
host_type = host_type.split('_').collect(&:capitalize).join
|
74
|
+
|
75
|
+
if host_type == "Windows"
|
76
|
+
use_ssl.nil? ? use_ssl = false : use_ssl
|
77
|
+
if use_ssl == true
|
78
|
+
port.nil? ? port = '5986' : port
|
79
|
+
else
|
80
|
+
port.nil? ? port = '5985' : port
|
81
|
+
end
|
82
|
+
discoverable.nil? ? discoverable = true : discoverable
|
83
|
+
user_name.nil? ? user_name = "admin" : user_name
|
84
|
+
password.nil? ? password = "#1Password" : password
|
85
|
+
elsif host_type == "Linux"
|
86
|
+
use_ssl.nil? ? use_ssl = false : use_ssl
|
87
|
+
port.nil? ? port = '22' : port = port
|
88
|
+
discoverable.nil? ? discoverable = true : discoverable
|
89
|
+
user_name.nil? ? user_name = "admin" : user_name
|
90
|
+
password.nil? ? password = "#1Password" : password
|
91
|
+
elsif host_type == "Hpux"
|
92
|
+
host_type = "HPUX"
|
93
|
+
end
|
94
|
+
rest_post(generate_host_post_json(host_type, ip_or_dns, name, port, user_name, password, use_ssl, discoverable), "#{@base_url}/tenants/#{@tenant_uid}/hosts", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Add an initiator to a host in ViPR
|
98
|
+
#
|
99
|
+
# @param host_id [String] The Host UID. Required Param.
|
100
|
+
# @param protocol [String] The protocol type. iSCSI or FC. Required
|
101
|
+
# @param initiator_port [String] Initator Port as a string. Required
|
102
|
+
# @param initiator_node [Array] Initator Nodes must be passed in as strings in an array. Required.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# x = vipr.get_all_hosts['id'][0]
|
106
|
+
# vipr.add_host_initiator(x, 'FC', '10:13:27:65:60:38:68:BE', ['10:13:27:65:60:38:68:BD','10:13:27:65:60:38:68:BC'])
|
107
|
+
def add_host_initiator(host_id=nil, protocol=nil, initiator_port=nil, initiator_node=nil, auth=nil, cert=nil)
|
108
|
+
check_host_get(host_id)
|
109
|
+
check_host_post_initiator(protocol, initiator_port)
|
110
|
+
|
111
|
+
protocol = protocol.upcase
|
112
|
+
if protocol == "ISCSI"
|
113
|
+
protocol = "iSCSI"
|
114
|
+
end
|
115
|
+
initiator_payload_array = generate_initiators_json(protocol, initiator_node, initiator_port)
|
116
|
+
initiator_payload_array.each do |i|
|
117
|
+
rest_post(i, "#{@base_url}/compute/hosts/#{host_id}/initiators", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Get all Host objects in ViPR
|
122
|
+
#
|
123
|
+
# @return [JSON] returns a JSON collection of all hosts in ViPR for a particular tenant
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
# vipr.get_all_hosts
|
127
|
+
def get_all_hosts(auth=nil, cert=nil)
|
128
|
+
rest_get("#{@base_url}/tenants/#{@tenant_uid}/hosts", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Get an individual host's details in ViPR
|
132
|
+
#
|
133
|
+
# @param host_id [STRING] ID of host to get information. Required Param
|
134
|
+
#
|
135
|
+
# @return [Hash] the object converted into Hash format and can be parsed with object[0] or object['id'] notation
|
136
|
+
#
|
137
|
+
# @example
|
138
|
+
# x = vipr.get_all_hosts['id'][0]
|
139
|
+
# vipr.get_host(x)
|
140
|
+
def get_host(host_id=nil, auth=nil, cert=nil)
|
141
|
+
check_host_get(host_id)
|
142
|
+
rest_get("#{@base_url}/compute/hosts/#{host_id}", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Deactive and Remove a Host from ViPR
|
146
|
+
#
|
147
|
+
# @param host_id [STRING] ID of host to get information. Required Param
|
148
|
+
#
|
149
|
+
# @return [JSON] returns information from POST for removing Host object
|
150
|
+
#
|
151
|
+
# @example
|
152
|
+
# x = vipr.get_all_hosts['id'][0]
|
153
|
+
# vipr.deactivate_host(x)
|
154
|
+
def deactivate_host(host_id=nil, auth=nil, cert=nil)
|
155
|
+
check_host_get(host_id)
|
156
|
+
rest_post(nil, "#{@base_url}/compute/hosts/#{host_id}/deactivate", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
157
|
+
end
|
158
|
+
|
159
|
+
# Determine if a host already exists in ViPR
|
160
|
+
#
|
161
|
+
# @param hostname [STRING] The name of the host to search for. Requires full name and not partials
|
162
|
+
#
|
163
|
+
# @return [BOOLEAN] returns TRUE/FALSE
|
164
|
+
#
|
165
|
+
# @example
|
166
|
+
# vipr.host_exists?('windowslab.mydomain.com')
|
167
|
+
def host_exists?(hostname, auth=nil, cert=nil)
|
168
|
+
hostname = hostname.downcase
|
169
|
+
host_array = []
|
170
|
+
hosts = get_all_hosts
|
171
|
+
hosts.each do |key, value|
|
172
|
+
value.each do |k|
|
173
|
+
host_array << k['name'].to_s.downcase
|
174
|
+
end
|
175
|
+
end
|
176
|
+
host_array.include?(hostname)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Find and return query results for a host in ViPR
|
180
|
+
#
|
181
|
+
# @param search_param [STRING] Value to search host for. This will work with partials
|
182
|
+
#
|
183
|
+
# @return [JSON] returns search results
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# vipr.find_host_object('host1')
|
187
|
+
def find_host_object(search_param, auth=nil, cert=nil)
|
188
|
+
rest_get("#{@base_url}/compute/hosts/search?name=#{search_param}", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
189
|
+
end
|
190
|
+
|
191
|
+
private
|
192
|
+
# Error Handling method to check for Missing Host Post params. If the pass fails, an error exception is raised
|
193
|
+
#
|
194
|
+
# @param host_type [String] Requires the string of the host type.
|
195
|
+
# @param ip_or_dns [String] Requires the string of the IP Address or FQDN.
|
196
|
+
# @param name [String] Requires the string of the Arbitrary name for ViPR.
|
197
|
+
# @param user_name [String] Requires the string of the User Name for access.
|
198
|
+
# @param password [String] Requires the string of the Password of the User Name for access
|
199
|
+
#
|
200
|
+
# @return [Boolean] True if pass, false if it fails
|
201
|
+
#
|
202
|
+
# @private
|
203
|
+
def check_host_post(host_type, ip_or_dns, name, user_name, password)
|
204
|
+
if host_type == nil || ip_or_dns == nil || name == nil
|
205
|
+
raise "Missing a Required param (host_type, ip_or_dns, name)"
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Error Handling method to check for Missing Host ID param. If the pass fails, an error exception is raised
|
210
|
+
#
|
211
|
+
# @param host_id [String] Requires the string of the vcenter uid
|
212
|
+
# @return [Boolean] True if pass, false if it fails
|
213
|
+
#
|
214
|
+
# @private
|
215
|
+
def check_host_get(host_id)
|
216
|
+
if host_id == nil
|
217
|
+
raise "Missing the Required param (host_id). Find the host_id by using the get_all_hosts method."
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Error Handling method to check for Initiator params. If the pass fails, an error exception is raised
|
222
|
+
#
|
223
|
+
# @param protocol [String] Requires the string of the Port
|
224
|
+
# @param initiator_port [String] Requires the string of the initiator_port
|
225
|
+
# @return [Boolean] True if pass, false if it fails
|
226
|
+
#
|
227
|
+
# @private
|
228
|
+
def check_host_post_initiator(protocol, initiator_port)
|
229
|
+
if protocol== nil || initiator_port == nil
|
230
|
+
raise "Missing the Required param (protocol or initiator_port)."
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
@@ -0,0 +1,278 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
# The Following Storage System calls will add Storage Systems for all tenants. these commands can only be ran as the root/default tenant
|
5
|
+
module ViprStorageSystem
|
6
|
+
# JSON Structure for creating the payload for Storage Providers
|
7
|
+
#
|
8
|
+
# @param name [String] Name of the Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
9
|
+
# @param interface_type [String] Interface type of the Storage Provider. This generated automatically based on the method call for types of storage providers. This is a required string.
|
10
|
+
# @param ip_or_dns [String] IP Address or FQDN of the Storage Provider. This is a required string.
|
11
|
+
# @param port [String] Port of the Storage Provider. This is a required string. This generated automatically based on the method call for types of storage providers. This is a required string. This can be modified based depending upon the storage system method call
|
12
|
+
# @param user_name [String] User Name that will be used for authenticating against the Storage Provider. This is a required string. If a User Name is not provided, then 'admin' is used
|
13
|
+
# @param password [String] Password for the user_name that will be used for authenticating against the Storage Provider. This is a required string. If a Password is not provided, then '#1Password' is used
|
14
|
+
# @param use_ssl [Boolean] Specify true or false for communicating to the Storage Provider. This is a required string, and will default to false unless 'true' is specified
|
15
|
+
#
|
16
|
+
# @return [JSON] The JSON structure for the post operation
|
17
|
+
def storage_provider_payload(name, interface_type, ip_or_dns, port, user_name, password, use_ssl)
|
18
|
+
payload = {
|
19
|
+
name: name,
|
20
|
+
interface_type: interface_type,
|
21
|
+
ip_address: ip_or_dns,
|
22
|
+
port_number: port,
|
23
|
+
user_name: user_name.nil? ? 'admin' : user_name,
|
24
|
+
password: password.nil? ? '#1Password' : password,
|
25
|
+
use_ssl: use_ssl.nil? ? false : use_ssl
|
26
|
+
}.to_json
|
27
|
+
|
28
|
+
return payload
|
29
|
+
end
|
30
|
+
|
31
|
+
# JSON Structure for creating the payload for Storage Providers
|
32
|
+
#
|
33
|
+
# @param name [String] Name of the Storage System. This name is arbitrary and only exists within ViPR. This is a required string.
|
34
|
+
# @param system_type [String] Interface type of the Storage System. This generated automatically based on the method call for types of storage providers. This is a required string.
|
35
|
+
# @param ip_or_dns [String] IP Address or FQDN of the Storage System. This is a required string.
|
36
|
+
# @param port [String] Port of the Storage System. This is a required string. This generated automatically based on the method call for types of storage providers. This is a required string. This can be modified based depending upon the storage system method call
|
37
|
+
# @param user_name [String] User Name that will be used for authenticating against the Storage System. This is a required string. If a User Name is not provided, then 'admin' is used
|
38
|
+
# @param password [String] Password for the user_name that will be used for authenticating against the Storage System. This is a required string. If a Password is not provided, then '#1Password' is used
|
39
|
+
# @param smis_provider_ip [String] IP Address or FQDN of the SMI-S Provider for the Storage System. This is a required string. Only used for {#add_emc_file} method
|
40
|
+
# @param smis_port_number [String] Port Number of the SMI-S Provider for the Storage System. This is a required string, and will default to '5988' unless something else is specified. Only used for {#add_emc_file} method
|
41
|
+
# @param smis_user_name [String] User Name that will be used for authenticating against the SMI-S Provider to the Storage System. This is a required string, and will default to 'admin' unless something else is specified. Only used for {#add_emc_file} method
|
42
|
+
# @param smis_password [String] Password that will be used for authenticating against the SMI-S Provider to the Storage System. This is a required string, and will default to '#1Password' unless something else is specified. Only used for {#add_emc_file} method
|
43
|
+
# @param smis_use_ssl [Boolean] Specify true or false for communicating to the Storage System. This is a required string, and will default to false unless true is passed. Only used for {#add_emc_file} method
|
44
|
+
#
|
45
|
+
# @return [JSON] The JSON structure for the post operation
|
46
|
+
def storage_system_payload(name, system_type, ip_or_dns, port, user_name, password, smis_provider_ip=nil, smis_port_number=nil, smis_user_name=nil, smis_password=nil, smis_use_ssl=nil)
|
47
|
+
if smis_provider_ip == nil
|
48
|
+
payload = {
|
49
|
+
name: name,
|
50
|
+
system_type: system_type,
|
51
|
+
ip_address: ip_or_dns,
|
52
|
+
port_number: port,
|
53
|
+
user_name: user_name.nil? ? 'admin' : user_name,
|
54
|
+
password: password.nil? ? '#1Password' : password,
|
55
|
+
}.to_json
|
56
|
+
else
|
57
|
+
payload = {
|
58
|
+
name: name,
|
59
|
+
system_type: system_type,
|
60
|
+
ip_address: ip_or_dns,
|
61
|
+
port_number: port,
|
62
|
+
user_name: user_name.nil? ? 'admin' : user_name,
|
63
|
+
password: password.nil? ? '#1Password' : password,
|
64
|
+
smis_provider_ip: smis_provider_ip,
|
65
|
+
smis_port_number: smis_port_number.nil? ? '5988' : smis_port_number,
|
66
|
+
smis_user_name: smis_user_name.nil? ? 'admin' : smis_user_name,
|
67
|
+
smis_password: smis_password.nil? ? '#1Password' : smis_password,
|
68
|
+
smis_use_ssl: smis_use_ssl.nil? ? false : smis_use_ssl
|
69
|
+
}.to_json
|
70
|
+
end
|
71
|
+
|
72
|
+
return payload
|
73
|
+
end
|
74
|
+
|
75
|
+
# Add EMC VMAX and VNX Block Storage System
|
76
|
+
# @note For supported versions, see the EMC ViPR Support Matrix on the EMC Community Network (community.emc.com)
|
77
|
+
#
|
78
|
+
# @param name [String] Name of the EMC Block Device. This name is arbitrary and only exists within ViPR. This is a required string.
|
79
|
+
# @param ip_or_dns [String] FQDN or IP Address of the EMC Block Device to add. This is a required string.
|
80
|
+
# @param user_name [String] User Name that will be used for authenticating against the EMC Block Device. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
81
|
+
# @param password [String] Password that will be used for authenticating against the EMC Block Device. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
82
|
+
# @param port [String] Port that will be used for communicating with the EMC Block Device. This is an optional string. If no parameter is passed, then '5989' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
83
|
+
# @param use_ssl [String] SSL setting for communicating with the EMC Block Device. This is an optional string. If no parameter is passed, then 'false' is used.
|
84
|
+
#
|
85
|
+
# @return [Hash] The resulted post operation
|
86
|
+
#
|
87
|
+
# @example Add EMC VMAX and VNX Block Storage System
|
88
|
+
# vipr.add_emc_block('vnx01', 'vnx01.mydomain.com')
|
89
|
+
# vipr.add_emc_block('vnx02', 'vnx02.mydomain.com', 'sysadmin', 'sysadmin')
|
90
|
+
# vipr.add_emc_block('vnx03', 'vnx03.mydomain.com', 'sysadmin', 'sysadmin', '8093', 'true')
|
91
|
+
def add_emc_block(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, auth=nil, cert=nil)
|
92
|
+
check_storage_provider_payload(name, ip_or_dns)
|
93
|
+
port.nil? ? port = '5989' : port = port
|
94
|
+
rest_post(storage_provider_payload(name, 'smis', ip_or_dns, port, user_name, password, use_ssl), "#{@base_url}/vdc/storage-providers", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Add Hitachi Storage Systems
|
98
|
+
# @note For supported versions, see the EMC ViPR Support Matrix on the EMC Community Network (community.emc.com).
|
99
|
+
# Hitachi HiCommand Device Manager is required to use HDS storage with ViPR.
|
100
|
+
# You need to obtain the following information to configure and add the Hitachi HiCommand Device manager to ViPR:
|
101
|
+
# (1) A host or virtual machine for HiCommand Device manager setup
|
102
|
+
# (2) HiCommand Device Manager license, host address, credentials, and host port (default is 2001)
|
103
|
+
#
|
104
|
+
# @param name [String] Name of the Hitachi Device. This name is arbitrary and only exists within ViPR. This is a required string.
|
105
|
+
# @param ip_or_dns [String] FQDN or IP Address of the Hitachi Device to add. This is a required string.
|
106
|
+
# @param user_name [String] User Name that will be used for authenticating against the Hitachi Device. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
107
|
+
# @param password [String] Password that will be used for authenticating against the Hitachi Device. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
108
|
+
# @param port [String] Port that will be used for communicating with the Hitachi Device. This is an optional string. If no parameter is passed, then '2001' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
109
|
+
# @param use_ssl [String] SSL setting for communicating with the Hitachi Device. This is an optional string. If no parameter is passed, then 'false' is used.
|
110
|
+
#
|
111
|
+
# @return [Hash] The resulted post operation
|
112
|
+
#
|
113
|
+
# @example Add Hitachi Storage System
|
114
|
+
# vipr.add_hitachi('hitachi01', 'hitachi01.mydomain.com')
|
115
|
+
# vipr.add_hitachi('hitachi02', 'hitachi02.mydomain.com', 'sysadmin', 'sysadmin')
|
116
|
+
# vipr.add_hitachi('hitachi03', 'hitachi03.mydomain.com', 'sysadmin', 'sysadmin', '8093', 'true')
|
117
|
+
def add_hitachi(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, auth=nil, cert=nil)
|
118
|
+
check_storage_provider_payload(name, ip_or_dns)
|
119
|
+
port.nil? ? port = '2001' : port = port
|
120
|
+
rest_post(storage_provider_payload(name, 'hicommand', ip_or_dns, port, user_name, password, use_ssl), "#{@base_url}/vdc/storage-providers", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
121
|
+
end
|
122
|
+
|
123
|
+
# Add VPLEX Storage Systems
|
124
|
+
# @note ViPR supports VPLEX in a Local or Metro configuration. VPLEX Geo configurations are not supported.
|
125
|
+
#
|
126
|
+
# @param name [String] Name of the VPLEX Device. This name is arbitrary and only exists within ViPR. This is a required string.
|
127
|
+
# @param ip_or_dns [String] FQDN or IP Address of the VPLEX Device to add. This is a required string.
|
128
|
+
# @param user_name [String] User Name that will be used for authenticating against the VPLEX Device. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
129
|
+
# @param password [String] Password that will be used for authenticating against the VPLEX Device. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
130
|
+
# @param port [String] Port that will be used for communicating with the VPLEX Device. This is an optional string. If no parameter is passed, then '443' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
131
|
+
# @param use_ssl [String] SSL setting for communicating with the VPLEX Device. This is an optional string. If no parameter is passed, then 'false' is used.
|
132
|
+
#
|
133
|
+
# @return [Hash] The resulted post operation
|
134
|
+
#
|
135
|
+
# @example Add VPLEX Storage System
|
136
|
+
# vipr.add_vplex('VPLEX01', 'VPLEX01.mydomain.com')
|
137
|
+
# vipr.add_vplex('VPLEX02', 'VPLEX02.mydomain.com', 'sysadmin', 'sysadmin')
|
138
|
+
# vipr.add_vplex('VPLEX03', 'VPLEX03.mydomain.com', 'sysadmin', 'sysadmin', '8093', 'true')
|
139
|
+
def add_vplex(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, auth=nil, cert=nil)
|
140
|
+
check_storage_provider_payload(name, ip_or_dns)
|
141
|
+
port.nil? ? port = '443' : port = port
|
142
|
+
rest_post(storage_provider_payload(name, 'vplex', ip_or_dns, port, user_name, password, use_ssl), "#{@base_url}/vdc/storage-providers", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Add ScaleIO Storage Systems
|
146
|
+
# @note Supported versions: ScaleIO 1.21.0.20 or later.
|
147
|
+
# Preconfiguration requirements:
|
148
|
+
# (1) Protection domains are defined.
|
149
|
+
# (2) All storage pools are defined.
|
150
|
+
#
|
151
|
+
# @param name [String] Name of the ScaleIO Storage System. This name is arbitrary and only exists within ViPR. This is a required string.
|
152
|
+
# @param ip_or_dns [String] FQDN or IP Address of the ScaleIO Storage System to add. This is a required string.
|
153
|
+
# @param user_name [String] User Name that will be used for authenticating against the ScaleIO Storage System. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
154
|
+
# @param password [String] Password that will be used for authenticating against the ScaleIO Storage System. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
155
|
+
# @param port [String] Port that will be used for communicating with the ScaleIO Storage System. This is an optional string. If no parameter is passed, then '22' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
156
|
+
# @param use_ssl [String] SSL setting for communicating with the ScaleIO Storage System. This is an optional string. If no parameter is passed, then 'false' is used.
|
157
|
+
#
|
158
|
+
# @return [Hash] The resulted post operation
|
159
|
+
#
|
160
|
+
# @example Add ScaleIO Storage System
|
161
|
+
# vipr.add_scaleio('scaleio01', 'scaleio01.mydomain.com')
|
162
|
+
# vipr.add_scaleio('scaleio02', 'scaleio02.mydomain.com', 'sysadmin', 'sysadmin')
|
163
|
+
# vipr.add_scaleio('scaleio03', 'scaleio03.mydomain.com', 'sysadmin', 'sysadmin', '8093', 'true')
|
164
|
+
def add_scaleio(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, auth=nil, cert=nil)
|
165
|
+
check_storage_provider_payload(name, ip_or_dns)
|
166
|
+
port.nil? ? port = '22' : port = port
|
167
|
+
rest_post(storage_provider_payload(name, 'scaleio', ip_or_dns, port, user_name, password, use_ssl), "#{@base_url}/vdc/storage-providers", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Add Third Party Block Storage Provider
|
171
|
+
# @note ViPR uses the OpenStack Block Storage (Cinder) Service to add third-party block storage systems to ViPR.
|
172
|
+
# For supported versions, see the EMC ViPR Support Matrix available on the EMC Community Network (community.emc.com).
|
173
|
+
#
|
174
|
+
# @param name [String] Name of the Third Party Block Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
175
|
+
# @param ip_or_dns [String] FQDN or IP Address of the Third Party Block Storage Provider to add. This is a required string.
|
176
|
+
# @param user_name [String] User Name that will be used for authenticating against the Third Party Block Storage Provider. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
177
|
+
# @param password [String] Password that will be used for authenticating against the Third Party Block Storage Provider. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
178
|
+
# @param port [String] Port that will be used for communicating with the Third Party Block Storage Provider. This is an optional string. If no parameter is passed, then '22' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
179
|
+
# @param use_ssl [String] SSL setting for communicating with the Third Party Block Storage Provider. This is an optional string. If no parameter is passed, then 'false' is used.
|
180
|
+
#
|
181
|
+
# @return [Hash] The resulted post operation
|
182
|
+
#
|
183
|
+
# @example Add Third Party Block Storage Provider
|
184
|
+
# vipr.add_third_party_block('cinder01', 'cinder01.mydomain.com')
|
185
|
+
# vipr.add_third_party_block('cinder01', 'cinder01.mydomain.com', 'sysadmin', 'sysadmin')
|
186
|
+
# vipr.add_third_party_block('cinder01', 'cinder01.mydomain.com', 'sysadmin', 'sysadmin', '8093', 'true')
|
187
|
+
def add_third_party_block(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, use_ssl=nil, auth=nil, cert=nil)
|
188
|
+
check_storage_provider_payload(name, ip_or_dns)
|
189
|
+
port.nil? ? port = '22' : port = port
|
190
|
+
rest_post(storage_provider_payload(name, 'cinder', ip_or_dns, port, user_name, password, use_ssl), "#{@base_url}/vdc/storage-providers", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Add Isilon Storage Provider
|
194
|
+
# @note Supported Protocol: NFS, CIFS (Snapshot restore is not supported for Isilon storage systems.).
|
195
|
+
# Port (default is 8080)
|
196
|
+
#
|
197
|
+
# @param name [String] Name of the Isilon Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
198
|
+
# @param ip_or_dns [String] FQDN or IP Address of the Isilon Storage Provider to add. This is a required string.
|
199
|
+
# @param user_name [String] User Name that will be used for authenticating against the Isilon Storage Provider. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
200
|
+
# @param password [String] Password that will be used for authenticating against the Isilon Storage Provider. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
201
|
+
# @param port [String] Port that will be used for communicating with the Isilon Storage Provider. This is an optional string. If no parameter is passed, then '8080' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
202
|
+
#
|
203
|
+
# @return [Hash] The resulted post operation
|
204
|
+
#
|
205
|
+
# @example Add Isilon Storage Provider
|
206
|
+
# vipr.add_isilon('isilon01', 'isilon01.mydomain.com')
|
207
|
+
# vipr.add_isilon('isilon01', 'isilon01.mydomain.com', 'sysadmin', 'sysadmin')
|
208
|
+
# vipr.add_isilon('isilon01', 'isilon01.mydomain.com', 'sysadmin', 'sysadmin', '8093')
|
209
|
+
def add_isilon(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, auth=nil, cert=nil)
|
210
|
+
check_storage_provider_payload(name, ip_or_dns)
|
211
|
+
port.nil? ? port = '8080' : port = port
|
212
|
+
rest_post(storage_system_payload(name, 'isilon', ip_or_dns, port, user_name, password), "#{@base_url}/vdc/storage-systems", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Add EMC VNX for File Storage Provider
|
216
|
+
# @note VNX File Control Station default port is 443. VNX File Onboard Storage Provider default port is 5988
|
217
|
+
#
|
218
|
+
# @param name [String] Name of the EMC VNX for File Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
219
|
+
# @param ip_or_dns [String] FQDN or IP Address of the EMC VNX for File Storage Provider to add. This is a required string.
|
220
|
+
# @param user_name [String] User Name that will be used for authenticating against the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
221
|
+
# @param password [String] Password that will be used for authenticating against the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
222
|
+
# @param port [String] Port that will be used for communicating with the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then '443' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
223
|
+
# @param smis_provider_ip [String] IP Address for the SMI-S Communicator for the EMC VNX for File Storage Provider. This is a required string.
|
224
|
+
# @param smis_user_name [String] User Name for the SMI-S Communicator for the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then 'admin' is used.
|
225
|
+
# @param smis_password [String] Password for the user_name for the SMI-S Communicator for the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then '#1Password' is used.
|
226
|
+
# @param smis_port_number [String] Port Number for the SMI-S Communicator for the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then '5988' is used.
|
227
|
+
# @param smis_use_ssl [String] SSL setting for communicating with the SMI-S Communicator for the EMC VNX for File Storage Provider. This is an optional string. If no parameter is passed, then 'false' is used.
|
228
|
+
#
|
229
|
+
# @return [Hash] The resulted post operation
|
230
|
+
#
|
231
|
+
# @example Add EMC VNX for File Storage Provider
|
232
|
+
# vipr.add_emc_file('vnx01', 'vnx01.mydomain.com', 'sysadmin', 'sysadmin', nil, 'smi_s_ip', 'smi_s_un', 'smi_s_pw')
|
233
|
+
# vipr.add_emc_file('vnx01', 'vnx01.mydomain.com', 'sysadmin', 'sysadmin', '1067', 'smi_s_ip', 'smi_s_un', 'smi_s_pw', '1068', 'true')
|
234
|
+
def add_emc_file(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, smis_provider_ip=nil, smis_user_name=nil, smis_password=nil, smis_port_number=nil, smis_use_ssl=nil, auth=nil, cert=nil)
|
235
|
+
check_storage_provider_payload(name, ip_or_dns)
|
236
|
+
port.nil? ? port = '443' : port = port
|
237
|
+
smis_port_number.nil? ? smis_port_number = '5988' : smis_port_number = smis_port_number
|
238
|
+
rest_post(storage_system_payload(name, 'vnxfile', ip_or_dns, port, user_name, password, smis_provider_ip, smis_port_number, smis_user_name, smis_password, smis_use_ssl), "#{@base_url}/vdc/storage-systems", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
239
|
+
end
|
240
|
+
|
241
|
+
# Add NetApp Storage Provider
|
242
|
+
# @note Supported Protocol: NFS, CIFS
|
243
|
+
# For supported versions, see the EMC ViPR Support Matrix available on the EMC Community Network (community.emc.com).
|
244
|
+
#
|
245
|
+
# @param name [String] Name of the NetApp Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
246
|
+
# @param ip_or_dns [String] FQDN or IP Address of the NetApp Storage Provider to add. This is a required string.
|
247
|
+
# @param user_name [String] User Name that will be used for authenticating against the NetApp Storage Provider. This is an optional string. If no parameter is passed, then 'admin' is used. If you wish to specify a different password, port, or use_ssl param set this to nil
|
248
|
+
# @param password [String] Password that will be used for authenticating against the NetApp Storage Provider. This is an optional string. If no parameter is passed, then '#1Password' is used. If you wish to specify a different username, port, or use_ssl param set this to nil
|
249
|
+
# @param port [String] Port that will be used for communicating with the NetApp Storage Provider. This is an optional string. If no parameter is passed, then '443' is used. If you wish to specify a different user_name, password, or use_ssl param set this to nil
|
250
|
+
#
|
251
|
+
# @return [Hash] The resulted post operation
|
252
|
+
#
|
253
|
+
# @example Add NetApp Storage Provider
|
254
|
+
# vipr.netapp('netapp01', 'netapp01.mydomain.com')
|
255
|
+
# vipr.netapp('netapp01', 'netapp01.mydomain.com', 'sysadmin', 'sysadmin')
|
256
|
+
# vipr.netapp('netapp01', 'netapp01.mydomain.com', 'sysadmin', 'sysadmin', '8093')
|
257
|
+
def add_netapp(name=nil, ip_or_dns=nil, user_name=nil, password=nil, port=nil, auth=nil, cert=nil)
|
258
|
+
check_storage_provider_payload(name, ip_or_dns)
|
259
|
+
port.nil? ? port = '443' : port = port
|
260
|
+
rest_post(storage_system_payload(name, 'netapp', ip_or_dns, port, user_name, password), "#{@base_url}/vdc/storage-systems", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
private
|
265
|
+
|
266
|
+
# Error Handling method to check for Missing Param. If the pass fails, an error exception is raised
|
267
|
+
#
|
268
|
+
# @param name [String] Name of the Storage Provider. This name is arbitrary and only exists within ViPR. This is a required string.
|
269
|
+
# @param ip_or_dns [String] FQDN or IP Address of the Storage Provider to add. This is a required string.
|
270
|
+
#
|
271
|
+
# @return [Boolean] True if passes. If fails, raise exception
|
272
|
+
def check_storage_provider_payload(name=nil, ip_or_dns=nil)
|
273
|
+
if name == nil || ip_or_dns == nil
|
274
|
+
raise "Missing Param 'name' or 'ip_or_dns'"
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|