-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
54 lines (44 loc) · 1.31 KB
/
example.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
from on_http_redfish_1_0 import \
ApiClient, \
Configuration, \
RedfishvApi as redfish
from json import loads,dumps
config = Configuration()
config.host = 'http://localhost:8080/redfish/v1'
config.verify_ssl = False
config.api_client = ApiClient(host=config.host)
config.debug = False
api_client = config.api_client
def get_data():
return loads(api_client.last_response.data)
def pprint():
print dumps(get_data(), \
sort_keys=True, \
indent=4, \
separators=(',', ': ')).decode('string-escape')
def getServiceRoot():
redfish().get_service_root()
pprint()
def listChassis():
redfish().list_chassis()
pprint()
def listPower():
redfish().list_chassis()
membersList = get_data().get('Members')
if membersList is not None:
for member in membersList:
id = member.get('@odata.id').split('/redfish/v1/Chassis/')[1]
redfish().get_power(id)
pprint()
def listThermal():
redfish().list_chassis()
membersList = get_data().get('Members')
if membersList is not None:
for member in membersList:
id = member.get('@odata.id').split('/redfish/v1/Chassis/')[1]
redfish().get_thermal(id)
pprint()
getServiceRoot()
listChassis()
listPower()
listThermal()