Skip to content

Commit

Permalink
Merge pull request #211 from DMTF/response-time
Browse files Browse the repository at this point in the history
Small changes to response time printing
  • Loading branch information
mraineri authored Jul 26, 2024
2 parents 9f7622f + ffa7bf3 commit c8cc70c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
17 changes: 11 additions & 6 deletions redfish_interop_validator/tohtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,25 @@ def renderHtml(results, finalCounts, tool_version, startTick, nowTick, config):
for cnt, item in enumerate(results):
entry = []
val = results[item]
rtime = '(response time: {})'.format(val['rtime'])
response_time = val.get('rtime')
if isinstance(response_time, float) and response_time >= 0:
rtime = '(response time: {})'.format(response_time)
else:
rtime = ''

if len(val['messages']) == 0 and len(val['errors']) == 0 and len(val['warns']) == 0:
continue

# uri block
prop_type = val['fulltype']
prop_type, type_name = val['fulltype'], ''
if prop_type is not None:
namespace = getNamespace(prop_type)
type_name = getType(prop_type)

infos_a = [str(val.get(x)) for x in ['uri', 'samplemapped'] if val.get(x) not in ['',None]]
infos_a.append(rtime)
infos_a.append(type_name)
infos_a = [str(val.get(x)) for x in ['uri', 'samplemapped'] if val.get(x) not in ['', None]]
if rtime != '':
infos_a.append(rtime)
if type_name:
infos_a.append(type_name)
uriTag = tag.tr(tag.th(infoBlock(infos_a, ' '), 'class="titlerow bluebg"'))
entry.append(uriTag)

Expand Down
6 changes: 4 additions & 2 deletions redfish_interop_validator/traverseInterop.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,13 @@ def createResourceObject(name, uri, jsondata=None, typename=None, context=None,
""" # Create json from service or from given

if jsondata is None and not isComplex:
success, jsondata, status, _, response = callResourceURI(uri)
success, jsondata, status, response_time, response = callResourceURI(uri)
traverseLogger.debug('{}, {}, {}'.format(success, jsondata, status))
if not success:
my_logger.error('{}: URI could not be acquired: {}'.format(uri, status))
return None, status
else:
success, jsondata, status, _, response = True, jsondata, -1, 0, None
success, jsondata, status, response_time, response = True, jsondata, -1, 0, None

# Collect our resource header
if response:
Expand All @@ -354,6 +354,8 @@ def createResourceObject(name, uri, jsondata=None, typename=None, context=None,

newResource = ResourceObj(name, uri, jsondata, typename, context, parent, isComplex, headers=my_header)

newResource.rtime = response_time

return newResource, status


Expand Down
4 changes: 2 additions & 2 deletions redfish_interop_validator/validateResource.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def validateSingleURI(URI, profile, uriName='', expectedType=None, expectedSchem
'messages': messages,
'errors': '',
'warns': '',
'rtime': '',
'rtime': 'n/a',
'context': '',
'fulltype': '',
'rcode': 0,
Expand Down Expand Up @@ -465,7 +465,7 @@ def validateURITree(URI, profile, uriName, expectedType=None, expectedSchema=Non
finalResults['n/a'] = {'uri': "Service Level Requirements", 'success': message_counts.get('fail', 0) == 0,
'counts': message_counts,
'messages': message_list, 'errors': error_messages.getvalue(), 'warns': '',
'rtime': '', 'context': '', 'fulltype': ''}
'rtime': None, 'context': '', 'fulltype': ''}
finalResults.update(results)
error_messages.close()

Expand Down

0 comments on commit c8cc70c

Please sign in to comment.