xclarity_client 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +41 -0
- data/.rubocop_base.yml +211 -0
- data/.rubocop_cc.yml +2 -0
- data/.travis.yml +1 -1
- data/docs/apib/compliance_policies.apib +214 -0
- data/docs/apib/squisher.rb +21 -13
- data/docs/apib/storages.apib +481 -0
- data/docs/apib/switches.apib +4 -0
- data/lib/xclarity_client.rb +3 -4
- data/lib/xclarity_client/client.rb +37 -343
- data/lib/xclarity_client/connection/connection.rb +3 -3
- data/lib/xclarity_client/endpoints/compliance_policy.rb +19 -0
- data/lib/xclarity_client/endpoints/endpoints.rb +2 -0
- data/lib/xclarity_client/endpoints/node.rb +8 -0
- data/lib/xclarity_client/endpoints/storage.rb +18 -0
- data/lib/xclarity_client/endpoints/switch.rb +3 -0
- data/lib/xclarity_client/mixins/aicc_mixin.rb +10 -0
- data/lib/xclarity_client/mixins/cabinet_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/canister_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/chassi_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/cmm_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/compliance_policy_mixin.rb +38 -0
- data/lib/xclarity_client/mixins/config_pattern_mixin.rb +40 -0
- data/lib/xclarity_client/mixins/config_profile_mixin.rb +51 -0
- data/lib/xclarity_client/mixins/config_target_mixin.rb +16 -0
- data/lib/xclarity_client/mixins/discover_request_mixin.rb +18 -0
- data/lib/xclarity_client/mixins/discovery_mixin.rb +10 -0
- data/lib/xclarity_client/mixins/event_mixin.rb +14 -0
- data/lib/xclarity_client/mixins/fan_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/fan_mux_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/ffdc_mixin.rb +16 -0
- data/lib/xclarity_client/mixins/global_setting_mixin.rb +14 -0
- data/lib/xclarity_client/mixins/host_platform_mixin.rb +18 -0
- data/lib/xclarity_client/mixins/job_mixin.rb +32 -0
- data/lib/xclarity_client/mixins/mixins.rb +38 -0
- data/lib/xclarity_client/mixins/node_mixin.rb +66 -0
- data/lib/xclarity_client/mixins/os_image_mixin.rb +14 -0
- data/lib/xclarity_client/mixins/persisted_result_mixin.rb +10 -0
- data/lib/xclarity_client/mixins/power_supply_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/remote_access_mixin.rb +10 -0
- data/lib/xclarity_client/mixins/remote_file_server_mixin.rb +28 -0
- data/lib/xclarity_client/mixins/scalable_complex_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/storage_mixin.rb +20 -0
- data/lib/xclarity_client/mixins/switch_mixin.rb +30 -0
- data/lib/xclarity_client/mixins/unmanage_request_mixin.rb +18 -0
- data/lib/xclarity_client/mixins/update_repo_mixin.rb +10 -0
- data/lib/xclarity_client/mixins/user_mixin.rb +26 -0
- data/lib/xclarity_client/schemas.rb +184 -189
- data/lib/xclarity_client/services/aicc_management.rb +0 -4
- data/lib/xclarity_client/services/cabinet_management.rb +0 -4
- data/lib/xclarity_client/services/canister_management.rb +0 -4
- data/lib/xclarity_client/services/chassi_management.rb +0 -4
- data/lib/xclarity_client/services/cmm_management.rb +0 -4
- data/lib/xclarity_client/services/compliance_policy_management.rb +52 -0
- data/lib/xclarity_client/services/config_pattern_management.rb +0 -4
- data/lib/xclarity_client/services/config_profile_management.rb +0 -4
- data/lib/xclarity_client/services/config_target_management.rb +0 -4
- data/lib/xclarity_client/services/discover_request_management.rb +0 -4
- data/lib/xclarity_client/services/discovery_management.rb +0 -4
- data/lib/xclarity_client/services/event_management.rb +0 -4
- data/lib/xclarity_client/services/fan_management.rb +0 -4
- data/lib/xclarity_client/services/fan_mux_management.rb +0 -4
- data/lib/xclarity_client/services/ffdc_management.rb +0 -4
- data/lib/xclarity_client/services/job_management.rb +0 -9
- data/lib/xclarity_client/services/mixins/power_action_sender_mixin.rb +59 -0
- data/lib/xclarity_client/services/node_management.rb +3 -26
- data/lib/xclarity_client/services/osimage_management.rb +25 -27
- data/lib/xclarity_client/services/persisted_result_management.rb +0 -6
- data/lib/xclarity_client/services/power_supply_management.rb +0 -4
- data/lib/xclarity_client/services/scalable_complex_management.rb +0 -4
- data/lib/xclarity_client/services/services.rb +6 -4
- data/lib/xclarity_client/services/storage_management.rb +8 -0
- data/lib/xclarity_client/services/switch_management.rb +4 -4
- data/lib/xclarity_client/services/unmanage_request_management.rb +0 -4
- data/lib/xclarity_client/services/update_repo_management.rb +30 -9
- data/lib/xclarity_client/services/user_management.rb +0 -4
- data/lib/xclarity_client/services/xclarity_service.rb +6 -5
- data/lib/xclarity_client/version.rb +1 -1
- data/xclarity_client.gemspec +1 -1
- metadata +45 -5
- data/lib/xclarity_client/xclarity_power_management_mixin.rb +0 -36
@@ -0,0 +1,32 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes JobManagement features
|
4
|
+
#
|
5
|
+
module Mixins::JobMixin
|
6
|
+
def discover_jobs(opts = {})
|
7
|
+
JobManagement.new(@config).fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_jobs(ids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
JobManagement.new(@config).get_object_with_id(
|
14
|
+
ids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def cancel_job(id = '')
|
21
|
+
JobManagement.new(@config).cancel_job(id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete_job(id = '')
|
25
|
+
JobManagement.new(@config).delete_job(id)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_job(job_id = '')
|
29
|
+
JobManagement.new(@config).get_job(job_id)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Contains mixins to provide XClarityClient::Client features
|
4
|
+
#
|
5
|
+
module Mixins
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'xclarity_client/mixins/aicc_mixin'
|
10
|
+
require 'xclarity_client/mixins/cabinet_mixin'
|
11
|
+
require 'xclarity_client/mixins/canister_mixin'
|
12
|
+
require 'xclarity_client/mixins/chassi_mixin'
|
13
|
+
require 'xclarity_client/mixins/cmm_mixin'
|
14
|
+
require 'xclarity_client/mixins/compliance_policy_mixin'
|
15
|
+
require 'xclarity_client/mixins/config_pattern_mixin'
|
16
|
+
require 'xclarity_client/mixins/config_profile_mixin'
|
17
|
+
require 'xclarity_client/mixins/config_target_mixin'
|
18
|
+
require 'xclarity_client/mixins/discover_request_mixin'
|
19
|
+
require 'xclarity_client/mixins/discovery_mixin'
|
20
|
+
require 'xclarity_client/mixins/event_mixin'
|
21
|
+
require 'xclarity_client/mixins/fan_mixin'
|
22
|
+
require 'xclarity_client/mixins/fan_mux_mixin'
|
23
|
+
require 'xclarity_client/mixins/ffdc_mixin'
|
24
|
+
require 'xclarity_client/mixins/global_setting_mixin'
|
25
|
+
require 'xclarity_client/mixins/host_platform_mixin'
|
26
|
+
require 'xclarity_client/mixins/job_mixin'
|
27
|
+
require 'xclarity_client/mixins/node_mixin'
|
28
|
+
require 'xclarity_client/mixins/os_image_mixin'
|
29
|
+
require 'xclarity_client/mixins/persisted_result_mixin'
|
30
|
+
require 'xclarity_client/mixins/power_supply_mixin'
|
31
|
+
require 'xclarity_client/mixins/remote_access_mixin'
|
32
|
+
require 'xclarity_client/mixins/remote_file_server_mixin'
|
33
|
+
require 'xclarity_client/mixins/scalable_complex_mixin'
|
34
|
+
require 'xclarity_client/mixins/storage_mixin'
|
35
|
+
require 'xclarity_client/mixins/switch_mixin'
|
36
|
+
require 'xclarity_client/mixins/unmanage_request_mixin'
|
37
|
+
require 'xclarity_client/mixins/update_repo_mixin'
|
38
|
+
require 'xclarity_client/mixins/user_mixin'
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes NodeManagement features
|
4
|
+
#
|
5
|
+
module Mixins::NodeMixin
|
6
|
+
def discover_nodes(opts = {})
|
7
|
+
node_management.fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_nodes(uuids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
node_management.get_object(
|
14
|
+
uuids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def blink_loc_led(uuid = '')
|
21
|
+
node_management.set_loc_led_state(uuid, 'Blinking')
|
22
|
+
end
|
23
|
+
|
24
|
+
def turn_on_loc_led(uuid = '')
|
25
|
+
node_management.set_loc_led_state(uuid, 'On')
|
26
|
+
end
|
27
|
+
|
28
|
+
def turn_off_loc_led(uuid = '')
|
29
|
+
node_management.set_loc_led_state(uuid, 'Off')
|
30
|
+
end
|
31
|
+
|
32
|
+
def power_on_node(uuid = '')
|
33
|
+
node_management.set_power_state(uuid, :powerOn)
|
34
|
+
end
|
35
|
+
|
36
|
+
def power_off_node(uuid = '')
|
37
|
+
node_management.set_power_state(uuid, :powerOffSoftGraceful)
|
38
|
+
end
|
39
|
+
|
40
|
+
def power_off_node_now(uuid = '')
|
41
|
+
node_management.set_power_state(uuid, :powerOff)
|
42
|
+
end
|
43
|
+
|
44
|
+
def power_restart_node(uuid = '')
|
45
|
+
node_management.set_power_state(uuid, :powerCycleSoftGrace)
|
46
|
+
end
|
47
|
+
|
48
|
+
def power_restart_node_now(uuid = '')
|
49
|
+
node_management.set_power_state(uuid, :powerCycleSoft)
|
50
|
+
end
|
51
|
+
|
52
|
+
def power_restart_node_controller(uuid = '')
|
53
|
+
node_management.set_bmc_power_state(uuid, :restart)
|
54
|
+
end
|
55
|
+
|
56
|
+
def power_restart_node_to_setup(uuid = '')
|
57
|
+
node_management.set_power_state(uuid, :bootToF1)
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def node_management
|
63
|
+
NodeManagement.new(@config)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes OsImageManagement features
|
4
|
+
#
|
5
|
+
module Mixins::OsImageMixin
|
6
|
+
def import_osimage(server_id = '', path = '')
|
7
|
+
OsImageManagement.new(@config).import_osimage(server_id, path)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_osimages
|
11
|
+
OsImageManagement.new(@config).population
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes PowerSupplyManagement features
|
4
|
+
#
|
5
|
+
module Mixins::PowerSupplyMixin
|
6
|
+
def discover_power_supplies(opts = {})
|
7
|
+
PowerSupplyManagement.new(@config).fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_power_supplies(uuids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
PowerSupplyManagement.new(@config).get_object(
|
14
|
+
uuids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes RemoteFileServerManagement features
|
4
|
+
#
|
5
|
+
module Mixins::RemoteFileServerMixin
|
6
|
+
def get_remotefileserver_profiles
|
7
|
+
RemoteFileServerManagement.new(@config).population
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_remotefileserver_profile(opts = {})
|
11
|
+
RemoteFileServerManagement.new(@config).create_remotefileserver_profile(
|
12
|
+
opts
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def delete_remotefileserver_profile(server_id = '')
|
17
|
+
RemoteFileServerManagement.new(@config).delete_remotefileserver_profile(
|
18
|
+
server_id
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_remotefileserver_profile(server_id = '')
|
23
|
+
RemoteFileServerManagement.new(@config).get_remotefileserver_profile(
|
24
|
+
server_id
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes ScalableComplexManagement features
|
4
|
+
#
|
5
|
+
module Mixins::ScalableComplexMixin
|
6
|
+
def discover_scalableComplexes(opts = {})
|
7
|
+
ScalableComplexManagement.new(@config).fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_scalableComplexes(uuids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
ScalableComplexManagement.new(@config).get_object(
|
14
|
+
uuids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes StorageManagement features
|
4
|
+
#
|
5
|
+
module Mixins::StorageMixin
|
6
|
+
def discover_storages(opts = {})
|
7
|
+
StorageManagement.new(@config).fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_storages(uuids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
StorageManagement.new(@config).get_object(
|
14
|
+
uuids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes SwitchManagement features
|
4
|
+
#
|
5
|
+
module Mixins::SwitchMixin
|
6
|
+
def discover_switches(opts = {})
|
7
|
+
switch_management.fetch_all(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_switches(uuids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
switch_management.get_object(
|
14
|
+
uuids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def power_cycle_soft_switch(uuid = '')
|
21
|
+
switch_management.set_power_state(uuid, :powerCycleSoft)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def switch_management
|
27
|
+
SwitchManagement.new(@config)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes UnmanageRequestManagement features
|
4
|
+
#
|
5
|
+
module Mixins::UnmanageRequestMixin
|
6
|
+
def fetch_unmanage_request(job_id)
|
7
|
+
UnmanageRequestManagement.new(@config).fetch_unmanage_request(
|
8
|
+
job_id
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def unmanage_discovered_devices(endpoints, force)
|
13
|
+
UnmanageRequestManagement.new(@config).unmanage_discovered_devices(
|
14
|
+
endpoints, force
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
#
|
3
|
+
# Exposes UserManagement features
|
4
|
+
#
|
5
|
+
module Mixins::UserMixin
|
6
|
+
def discover_users(_opts = {})
|
7
|
+
UserManagement.new(@config).fetch_all
|
8
|
+
end
|
9
|
+
|
10
|
+
def fetch_users(ids = nil,
|
11
|
+
include_attributes = nil,
|
12
|
+
exclude_attributes = nil)
|
13
|
+
UserManagement.new(@config).get_object_with_id(
|
14
|
+
ids,
|
15
|
+
include_attributes,
|
16
|
+
exclude_attributes
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def change_user_password(current_password, new_password)
|
21
|
+
UserManagement.new(@config).change_password(
|
22
|
+
current_password, new_password
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -2,198 +2,193 @@ require 'json-schema'
|
|
2
2
|
|
3
3
|
module XClarityClient
|
4
4
|
class Schemas
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@hostplatforms = {
|
44
|
-
"id" => "deploy_osimage",
|
45
|
-
"type" => "array",
|
46
|
-
"items" => {
|
47
|
-
"type" => "object",
|
48
|
-
"required" => ["networkSettings", "selectedImage", "storageSettings", "uuid"],
|
49
|
-
"properties" => {
|
50
|
-
"adusername" => {
|
51
|
-
"type" => "string"
|
52
|
-
},
|
53
|
-
"adpassword" => {
|
54
|
-
"type" => "string"
|
55
|
-
},
|
56
|
-
"configFileId" => {
|
57
|
-
"type" => "string"
|
58
|
-
},
|
59
|
-
"licenseKey" => {
|
60
|
-
"type" => "string"
|
61
|
-
},
|
62
|
-
"selectedImage" => {
|
63
|
-
"type" => "string"
|
64
|
-
},
|
65
|
-
"storageSettings" => {
|
66
|
-
"type" => "object"
|
67
|
-
},
|
68
|
-
"unattendFileId" => {
|
69
|
-
"type" => "string"
|
70
|
-
},
|
71
|
-
"uuid" => {
|
72
|
-
"type" => "string"
|
73
|
-
},
|
74
|
-
"windowsDomain" => {
|
75
|
-
"type" => "string"
|
76
|
-
},
|
77
|
-
"windowsDomainBlob" => {
|
78
|
-
"type" => "string"
|
79
|
-
},
|
80
|
-
"networkSettings" => {
|
81
|
-
"type" => "object",
|
82
|
-
"properties" =>
|
83
|
-
{
|
84
|
-
"dns1" => {
|
85
|
-
"type" => "string"
|
86
|
-
},
|
87
|
-
"dns2" => {
|
88
|
-
"type" => "string"
|
89
|
-
},
|
90
|
-
"gateway" => {
|
91
|
-
"type" => "string"
|
92
|
-
},
|
93
|
-
"hostname" => {
|
94
|
-
"type" => "string"
|
95
|
-
},
|
96
|
-
"ipAddress" => {
|
97
|
-
"type" => "string"
|
98
|
-
},
|
99
|
-
"mtu" => {
|
100
|
-
"type" => "integer"
|
101
|
-
},
|
102
|
-
"prefixLength" => {
|
103
|
-
"type" => "string"
|
104
|
-
},
|
105
|
-
"selectedMAC" => {
|
106
|
-
"type" => "string"
|
107
|
-
},
|
108
|
-
"vlanId" => {
|
109
|
-
"type" => "string"
|
110
|
-
}
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
5
|
+
@remotefs = {
|
6
|
+
"id" => "create_remotefileserver_profile",
|
7
|
+
"type" => "object",
|
8
|
+
"required" => %w(address displayName port protocol),
|
9
|
+
"properties" => {
|
10
|
+
"address" => {
|
11
|
+
"type" => "string"
|
12
|
+
},
|
13
|
+
"displayName" => {
|
14
|
+
"type" => "string"
|
15
|
+
},
|
16
|
+
"keyComment" => {
|
17
|
+
"type" => "string"
|
18
|
+
},
|
19
|
+
"keyPassphras" => {
|
20
|
+
"type" => "string"
|
21
|
+
},
|
22
|
+
"keyType" => {
|
23
|
+
"type" => "string"
|
24
|
+
},
|
25
|
+
"password" => {
|
26
|
+
"type" => "string"
|
27
|
+
},
|
28
|
+
"port" => {
|
29
|
+
"type" => "integer"
|
30
|
+
},
|
31
|
+
"protocol" => {
|
32
|
+
"type" => "string"
|
33
|
+
},
|
34
|
+
"serverId" => {
|
35
|
+
"type" => "string"
|
36
|
+
},
|
37
|
+
"username" => {
|
38
|
+
"type" => "string"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
116
42
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
43
|
+
@hostplatforms = {
|
44
|
+
"id" => "deploy_osimage",
|
45
|
+
"type" => "array",
|
46
|
+
"items" => {
|
47
|
+
"type" => "object",
|
48
|
+
"required" => %w(networkSettings selectedImage storageSettings uuid),
|
49
|
+
"properties" => {
|
50
|
+
"adusername" => {
|
51
|
+
"type" => "string"
|
52
|
+
},
|
53
|
+
"adpassword" => {
|
54
|
+
"type" => "string"
|
55
|
+
},
|
56
|
+
"configFileId" => {
|
57
|
+
"type" => "string"
|
58
|
+
},
|
59
|
+
"licenseKey" => {
|
60
|
+
"type" => "string"
|
61
|
+
},
|
62
|
+
"selectedImage" => {
|
63
|
+
"type" => "string"
|
64
|
+
},
|
65
|
+
"storageSettings" => {
|
66
|
+
"type" => "object"
|
67
|
+
},
|
68
|
+
"unattendFileId" => {
|
69
|
+
"type" => "string"
|
70
|
+
},
|
71
|
+
"uuid" => {
|
72
|
+
"type" => "string"
|
73
|
+
},
|
74
|
+
"windowsDomain" => {
|
75
|
+
"type" => "string"
|
76
|
+
},
|
77
|
+
"windowsDomainBlob" => {
|
78
|
+
"type" => "string"
|
79
|
+
},
|
80
|
+
"networkSettings" => {
|
81
|
+
"type" => "object",
|
82
|
+
"properties" => {
|
83
|
+
"dns1" => {
|
84
|
+
"type" => "string"
|
85
|
+
},
|
86
|
+
"dns2" => {
|
87
|
+
"type" => "string"
|
88
|
+
},
|
89
|
+
"gateway" => {
|
90
|
+
"type" => "string"
|
91
|
+
},
|
92
|
+
"hostname" => {
|
93
|
+
"type" => "string"
|
94
|
+
},
|
95
|
+
"ipAddress" => {
|
96
|
+
"type" => "string"
|
97
|
+
},
|
98
|
+
"mtu" => {
|
99
|
+
"type" => "integer"
|
100
|
+
},
|
101
|
+
"prefixLength" => {
|
102
|
+
"type" => "string"
|
103
|
+
},
|
104
|
+
"selectedMAC" => {
|
105
|
+
"type" => "string"
|
106
|
+
},
|
107
|
+
"vlanId" => {
|
108
|
+
"type" => "string"
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
164
115
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
116
|
+
@globalsettings = {
|
117
|
+
"id" => "set_globalsettings",
|
118
|
+
"type" => "object",
|
119
|
+
"required" => %w(activeDirectory
|
120
|
+
ipAssignment
|
121
|
+
isVLANMode
|
122
|
+
licenseKeys
|
123
|
+
credentials),
|
124
|
+
"properties" => {
|
125
|
+
"activeDirectory" => {
|
126
|
+
"type" => "object"
|
127
|
+
},
|
128
|
+
"ipAssignment" => {
|
129
|
+
"type" => "string"
|
130
|
+
},
|
131
|
+
"isVLANMode" => {
|
132
|
+
"type" => "boolean"
|
133
|
+
},
|
134
|
+
"licenseKeys" => {
|
135
|
+
"type" => "object"
|
136
|
+
},
|
137
|
+
"deploySettings" => {
|
138
|
+
"type" => "string"
|
139
|
+
},
|
140
|
+
"credentials" => {
|
141
|
+
"type" => "array",
|
142
|
+
"items" => {
|
143
|
+
"type" => "object",
|
144
|
+
"required" => %w(type name password passwordChanged),
|
145
|
+
"properties" => {
|
146
|
+
"type" => {
|
147
|
+
"type" => "string"
|
148
|
+
},
|
149
|
+
"name" => {
|
150
|
+
"type" => "string"
|
151
|
+
},
|
152
|
+
"password" => {
|
153
|
+
"type" => "string"
|
154
|
+
},
|
155
|
+
"passwordChanged" => {
|
156
|
+
"type" => "boolean"
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
170
163
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
puts errmsg
|
177
|
-
for k in x
|
178
|
-
$lxca_log.error k, ""
|
179
|
-
puts k
|
180
|
-
end
|
181
|
-
return nil
|
182
|
-
else
|
183
|
-
return 1
|
184
|
-
end
|
185
|
-
end
|
164
|
+
REQ_SCHEMA = {
|
165
|
+
'deploy_osimage' => @hostplatforms,
|
166
|
+
'set_globalsettings' => @globalsettings,
|
167
|
+
'create_remotefileserver_profile' => @remotefs
|
168
|
+
}.freeze
|
186
169
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
170
|
+
def self.validate_input(schema_name, data)
|
171
|
+
x = JSON::Validator.fully_validate(Schemas::REQ_SCHEMA[schema_name], data)
|
172
|
+
if !x.empty?
|
173
|
+
errmsg = "input validation failed for data #{data}"
|
174
|
+
$lxca_log.error(errmsg, '')
|
175
|
+
x.each { |k| $lxca_log.error(k, '') }
|
176
|
+
return nil
|
177
|
+
else
|
178
|
+
return 1
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# parameter name should be string
|
183
|
+
def self.validate_input_parameter(name, value, exp_type)
|
184
|
+
if !value.kind_of?(exp_type)
|
185
|
+
errmsg = "invalid #{name} #{value},"\
|
186
|
+
" expected #{name} of type #{exp_type}"
|
187
|
+
$lxca_log.error(errmsg, '')
|
188
|
+
return nil
|
189
|
+
else
|
190
|
+
return 1
|
191
|
+
end
|
192
|
+
end
|
198
193
|
end
|
199
194
|
end
|