diff --git a/redfish_interop_validator/tohtml.py b/redfish_interop_validator/tohtml.py index 31a1eb4..c3dba1b 100644 --- a/redfish_interop_validator/tohtml.py +++ b/redfish_interop_validator/tohtml.py @@ -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) diff --git a/redfish_interop_validator/traverseInterop.py b/redfish_interop_validator/traverseInterop.py index cb5ba01..f047add 100644 --- a/redfish_interop_validator/traverseInterop.py +++ b/redfish_interop_validator/traverseInterop.py @@ -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: @@ -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 diff --git a/redfish_interop_validator/validateResource.py b/redfish_interop_validator/validateResource.py index 8bd51fa..832f903 100644 --- a/redfish_interop_validator/validateResource.py +++ b/redfish_interop_validator/validateResource.py @@ -66,7 +66,7 @@ def validateSingleURI(URI, profile, uriName='', expectedType=None, expectedSchem 'messages': messages, 'errors': '', 'warns': '', - 'rtime': '', + 'rtime': 'n/a', 'context': '', 'fulltype': '', 'rcode': 0, @@ -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()