-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyxcli_ibm_discovery.py
81 lines (44 loc) · 1.42 KB
/
pyxcli_ibm_discovery.py
1
2
3
4
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
# -*- coding: utf-8 -*
from pyxcli.client import XCLIClient
import json, sys
# Variable Arguments
ibm_user = sys.argv[1]
ibm_pass = sys.argv[2]
ibm_host_ip = sys.argv[3]
# Connect SSL to XIV - Storage
xcli_client = XCLIClient.connect_ssl(ibm_user, ibm_pass, ibm_host_ip)
result_dict = {}
# CMD command and create data lists for parsing
ups = xcli_client.cmd.ups_list().as_list
result_dict ['ups'] = ups
ats = xcli_client.cmd.ats_list().as_list
result_dict ['ats'] = ats
cna = xcli_client.cmd.cna_list().as_list
result_dict ['cna'] = cna
cpu = xcli_client.cmd.cpu_list().as_list
result_dict ['cpu'] = cpu
dimm = xcli_client.cmd.dimm_list().as_list
result_dict ['dimm'] = dimm
disk = xcli_client.cmd.disk_list().as_list
result_dict ['disk'] = disk
fan = xcli_client.cmd.fan_list().as_list
result_dict ['fan'] = fan
fc_port = xcli_client.cmd.fc_port_list().as_list
result_dict ['fc_port'] = fc_port
mm = xcli_client.cmd.mm_list().as_list
result_dict ['mm'] = mm
psu = xcli_client.cmd.psu_list().as_list
result_dict ['psu'] = psu
switch = xcli_client.cmd.switch_list().as_list
result_dict ['switch'] = switch
pool = xcli_client.cmd.pool_list().as_list
result_dict ['pool'] = pool
mirror = xcli_client.cmd.mirror_list().as_list
result_dict ['mirror'] = mirror
#Translation of data into json format
result_dict_json = json.dumps(result_dict)
try:
print(result_dict_json)
except:
print(1)