|
|
@ -190,7 +190,6 @@ class RedfishUtils(object):
|
|
|
|
def get_logs(self):
|
|
|
|
def get_logs(self):
|
|
|
|
log_svcs_uri_list = []
|
|
|
|
log_svcs_uri_list = []
|
|
|
|
list_of_logs = []
|
|
|
|
list_of_logs = []
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find LogService
|
|
|
|
# Find LogService
|
|
|
|
response = self.get_request(self.root_uri + self.manager_uri)
|
|
|
|
response = self.get_request(self.root_uri + self.manager_uri)
|
|
|
@ -238,8 +237,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True, 'list_of_logs': list_of_logs}
|
|
|
|
return {'ret': True, 'list_of_logs': list_of_logs}
|
|
|
|
|
|
|
|
|
|
|
|
def clear_logs(self):
|
|
|
|
def clear_logs(self):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find LogService
|
|
|
|
# Find LogService
|
|
|
|
response = self.get_request(self.root_uri + self.manager_uri)
|
|
|
|
response = self.get_request(self.root_uri + self.manager_uri)
|
|
|
|
if response['ret'] is False:
|
|
|
|
if response['ret'] is False:
|
|
|
@ -402,7 +399,6 @@ class RedfishUtils(object):
|
|
|
|
|
|
|
|
|
|
|
|
def list_users(self):
|
|
|
|
def list_users(self):
|
|
|
|
# listing all users has always been slower than other operations, why?
|
|
|
|
# listing all users has always been slower than other operations, why?
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
allusers = []
|
|
|
|
allusers = []
|
|
|
|
allusers_details = []
|
|
|
|
allusers_details = []
|
|
|
|
response = self.get_request(self.root_uri + self.accounts_uri)
|
|
|
|
response = self.get_request(self.root_uri + self.accounts_uri)
|
|
|
@ -430,7 +426,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True, 'entries': allusers_details}
|
|
|
|
return {'ret': True, 'entries': allusers_details}
|
|
|
|
|
|
|
|
|
|
|
|
def add_user(self, user):
|
|
|
|
def add_user(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
username = {'UserName': user['username']}
|
|
|
|
username = {'UserName': user['username']}
|
|
|
|
pswd = {'Password': user['userpswd']}
|
|
|
|
pswd = {'Password': user['userpswd']}
|
|
|
@ -443,7 +438,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def enable_user(self, user):
|
|
|
|
def enable_user(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
payload = {'Enabled': True}
|
|
|
|
payload = {'Enabled': True}
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
@ -452,7 +446,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def delete_user(self, user):
|
|
|
|
def delete_user(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
payload = {'UserName': ""}
|
|
|
|
payload = {'UserName': ""}
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
@ -461,7 +454,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def disable_user(self, user):
|
|
|
|
def disable_user(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
payload = {'Enabled': False}
|
|
|
|
payload = {'Enabled': False}
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
@ -470,7 +462,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def update_user_role(self, user):
|
|
|
|
def update_user_role(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
payload = {'RoleId': user['userrole']}
|
|
|
|
payload = {'RoleId': user['userrole']}
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
@ -479,7 +470,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def update_user_password(self, user):
|
|
|
|
def update_user_password(self, user):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
uri = self.root_uri + self.accounts_uri + "/" + user['userid']
|
|
|
|
payload = {'Password': user['userpswd']}
|
|
|
|
payload = {'Password': user['userpswd']}
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
|
response = self.patch_request(uri, payload, HEADERS)
|
|
|
@ -489,7 +479,6 @@ class RedfishUtils(object):
|
|
|
|
|
|
|
|
|
|
|
|
def get_firmware_inventory(self):
|
|
|
|
def get_firmware_inventory(self):
|
|
|
|
result = {}
|
|
|
|
result = {}
|
|
|
|
devices = []
|
|
|
|
|
|
|
|
response = self.get_request(self.root_uri + self.firmware_uri)
|
|
|
|
response = self.get_request(self.root_uri + self.firmware_uri)
|
|
|
|
if response['ret'] is False:
|
|
|
|
if response['ret'] is False:
|
|
|
|
return response
|
|
|
|
return response
|
|
|
@ -640,7 +629,6 @@ class RedfishUtils(object):
|
|
|
|
return {'ret': True}
|
|
|
|
return {'ret': True}
|
|
|
|
|
|
|
|
|
|
|
|
def set_manager_attributes(self, attr):
|
|
|
|
def set_manager_attributes(self, attr):
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
attributes = "Attributes"
|
|
|
|
attributes = "Attributes"
|
|
|
|
|
|
|
|
|
|
|
|
# Example: manager_attr = {\"name\":\"value\"}
|
|
|
|
# Example: manager_attr = {\"name\":\"value\"}
|
|
|
|