redfish-interop-validator 2.2.5__tar.gz → 2.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {redfish_interop_validator-2.2.5/redfish_interop_validator.egg-info → redfish_interop_validator-2.2.7}/PKG-INFO +1 -1
  2. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/RedfishInteropValidator.py +1 -1
  3. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/interop.py +34 -2
  4. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/tohtml.py +11 -6
  5. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/traverseInterop.py +4 -2
  6. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/validateResource.py +4 -5
  7. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7/redfish_interop_validator.egg-info}/PKG-INFO +1 -1
  8. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/setup.py +1 -1
  9. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/AUTHORS.md +0 -0
  10. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/LICENSE.md +0 -0
  11. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/README.md +0 -0
  12. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/RedfishLogo.py +0 -0
  13. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/__init__.py +0 -0
  14. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/config.py +0 -0
  15. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/profile.py +0 -0
  16. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/redfish.py +0 -0
  17. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator/session.py +0 -0
  18. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator.egg-info/SOURCES.txt +0 -0
  19. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator.egg-info/dependency_links.txt +0 -0
  20. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator.egg-info/entry_points.txt +0 -0
  21. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator.egg-info/requires.txt +0 -0
  22. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/redfish_interop_validator.egg-info/top_level.txt +0 -0
  23. {redfish_interop_validator-2.2.5 → redfish_interop_validator-2.2.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redfish_interop_validator
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: Redfish Interop Validator
5
5
  Home-page: https://github.com/DMTF/Redfish-Interop-Validator
6
6
  Author: DMTF, https://www.dmtf.org/standards/feedback
@@ -17,7 +17,7 @@ import redfish_interop_validator.traverseInterop as traverseInterop
17
17
  from redfish_interop_validator.profile import getProfiles, checkProfileAgainstSchema, hashProfile
18
18
  from redfish_interop_validator.validateResource import validateSingleURI, validateURITree
19
19
 
20
- tool_version = '2.2.5'
20
+ tool_version = '2.2.7'
21
21
 
22
22
  # Set up the custom debug levels
23
23
  VERBOSE1 = logging.INFO - 1
@@ -767,6 +767,15 @@ def checkInteropURI(r_obj, profile_entry):
767
767
  my_id, my_uri = r_obj.jsondata.get('Id'), r_obj.uri
768
768
  return compareRedfishURI(profile_entry, my_uri)
769
769
 
770
+ # Expected Type, Key
771
+ entry_type_table = {
772
+ 'ChassisType': ("Chassis", "ChassisType"),
773
+ 'DriveProtocol': ("Drive", "Protocol"),
774
+ 'MemoryType': ("Memory", "MemoryType"),
775
+ 'PortProtocol': ("Port", "PortProtocol"),
776
+ 'ProcessorType': ("Processor", "ProcessorType"),
777
+ }
778
+
770
779
 
771
780
  def validateInteropResource(propResourceObj, interop_profile, rf_payload):
772
781
  """
@@ -783,11 +792,12 @@ def validateInteropResource(propResourceObj, interop_profile, rf_payload):
783
792
  for use_case in interop_profile['UseCases']:
784
793
  entry_title = use_case.get("UseCaseTitle", "NoName").replace(' ', '_')
785
794
  entry_type = use_case.get("UseCaseType", "Normal")
795
+ my_parent = propResourceObj.parent
786
796
  my_logger.debug('UseCase {} {}'.format(entry_title, entry_type))
787
797
 
788
798
  # Check if we have a valid UseCase
789
- if 'URIs' not in use_case and 'UseCaseKeyProperty' not in use_case and entry_type != 'AbsentResource':
790
- my_logger.error('UseCase does not have URIs or UseCaseKeyProperty...')
799
+ if ('URIs' not in use_case) and ('UseCaseKeyProperty' not in use_case) and (entry_type not in ['AbsentResource'] + list(entry_type_table.keys())):
800
+ my_logger.error('UseCase does not have URIs or valid UseCase...')
791
801
 
792
802
  if entry_type == 'AbsentResource':
793
803
  my_status = rf_payload.get('Status')
@@ -797,6 +807,28 @@ def validateInteropResource(propResourceObj, interop_profile, rf_payload):
797
807
  use_case_applies = False
798
808
  if 'URIs' in use_case:
799
809
  use_case_applies = use_case_applies and checkInteropURI(propResourceObj, use_case['URIs'])
810
+
811
+ elif entry_type in entry_type_table:
812
+ target_type_found = False
813
+ target_type, entry_key = entry_type_table[entry_type]
814
+ entry_comparison, entry_values = use_case['UseCaseComparison'], use_case['UseCaseKeyValues']
815
+
816
+ # Iterate until we find our target type, if not found then use case cannot apply
817
+ while my_parent is not None and not target_type_found:
818
+ parent_type = getType(my_parent.jsondata.get('@odata.type', 'NoType'))
819
+ target_type_found = parent_type == target_type
820
+ if not target_type_found:
821
+ my_parent = my_parent.parent
822
+
823
+ if target_type_found:
824
+ target_payload = my_parent.jsondata
825
+ target_value = target_payload.get(entry_key)
826
+
827
+ _, use_case_applies = checkComparison(target_payload.get(entry_key, REDFISH_ABSENT), entry_comparison, entry_values)
828
+ else:
829
+ my_logger.verbose1('Type {} was not found in parent typechain'.format(target_type))
830
+ use_case_applies = False
831
+
800
832
 
801
833
  elif 'UseCaseKeyProperty' in use_case:
802
834
  entry_key, entry_comparison, entry_values = use_case['UseCaseKeyProperty'], use_case['UseCaseComparison'], use_case['UseCaseKeyValues']
@@ -158,20 +158,25 @@ def renderHtml(results, finalCounts, tool_version, startTick, nowTick, config):
158
158
  for cnt, item in enumerate(results):
159
159
  entry = []
160
160
  val = results[item]
161
- rtime = '(response time: {})'.format(val['rtime'])
161
+ response_time = val.get('rtime')
162
+ if isinstance(response_time, float) and response_time >= 0:
163
+ rtime = '(response time: {})'.format(response_time)
164
+ else:
165
+ rtime = ''
162
166
 
163
167
  if len(val['messages']) == 0 and len(val['errors']) == 0 and len(val['warns']) == 0:
164
168
  continue
165
169
 
166
170
  # uri block
167
- prop_type = val['fulltype']
171
+ prop_type, type_name = val['fulltype'], ''
168
172
  if prop_type is not None:
169
- namespace = getNamespace(prop_type)
170
173
  type_name = getType(prop_type)
171
174
 
172
- infos_a = [str(val.get(x)) for x in ['uri', 'samplemapped'] if val.get(x) not in ['',None]]
173
- infos_a.append(rtime)
174
- infos_a.append(type_name)
175
+ infos_a = [str(val.get(x)) for x in ['uri', 'samplemapped'] if val.get(x) not in ['', None]]
176
+ if rtime != '':
177
+ infos_a.append(rtime)
178
+ if type_name:
179
+ infos_a.append(type_name)
175
180
  uriTag = tag.tr(tag.th(infoBlock(infos_a, ' '), 'class="titlerow bluebg"'))
176
181
  entry.append(uriTag)
177
182
 
@@ -336,13 +336,13 @@ def createResourceObject(name, uri, jsondata=None, typename=None, context=None,
336
336
  """ # Create json from service or from given
337
337
 
338
338
  if jsondata is None and not isComplex:
339
- success, jsondata, status, _, response = callResourceURI(uri)
339
+ success, jsondata, status, response_time, response = callResourceURI(uri)
340
340
  traverseLogger.debug('{}, {}, {}'.format(success, jsondata, status))
341
341
  if not success:
342
342
  my_logger.error('{}: URI could not be acquired: {}'.format(uri, status))
343
343
  return None, status
344
344
  else:
345
- success, jsondata, status, _, response = True, jsondata, -1, 0, None
345
+ success, jsondata, status, response_time, response = True, jsondata, -1, 0, None
346
346
 
347
347
  # Collect our resource header
348
348
  if response:
@@ -354,6 +354,8 @@ def createResourceObject(name, uri, jsondata=None, typename=None, context=None,
354
354
 
355
355
  newResource = ResourceObj(name, uri, jsondata, typename, context, parent, isComplex, headers=my_header)
356
356
 
357
+ newResource.rtime = response_time
358
+
357
359
  return newResource, status
358
360
 
359
361
 
@@ -66,7 +66,7 @@ def validateSingleURI(URI, profile, uriName='', expectedType=None, expectedSchem
66
66
  'messages': messages,
67
67
  'errors': '',
68
68
  'warns': '',
69
- 'rtime': '',
69
+ 'rtime': 'n/a',
70
70
  'context': '',
71
71
  'fulltype': '',
72
72
  'rcode': 0,
@@ -168,7 +168,7 @@ def validateSingleURI(URI, profile, uriName='', expectedType=None, expectedSchem
168
168
  profile_resources = profile_resources.get(SchemaType)
169
169
  try:
170
170
  propMessages, propCounts = interop.validateInteropResource(resource_obj, profile_resources, jsondata)
171
- messages = messages.extend(propMessages)
171
+ messages.extend(propMessages)
172
172
  counts.update(propCounts)
173
173
  my_logger.info('{} of {} tests passed.'.format(counts['pass'] + counts['warn'], counts['totaltests']))
174
174
  except Exception:
@@ -312,8 +312,7 @@ def validateURITree(URI, profile, uriName, expectedType=None, expectedSchema=Non
312
312
  allLinks.add(link.rstrip('/'))
313
313
 
314
314
  results.update(linkResults)
315
- counts.update(linkCounts)
316
-
315
+
317
316
  if not linkSuccess:
318
317
  continue
319
318
 
@@ -465,7 +464,7 @@ def validateURITree(URI, profile, uriName, expectedType=None, expectedSchema=Non
465
464
  finalResults['n/a'] = {'uri': "Service Level Requirements", 'success': message_counts.get('fail', 0) == 0,
466
465
  'counts': message_counts,
467
466
  'messages': message_list, 'errors': error_messages.getvalue(), 'warns': '',
468
- 'rtime': '', 'context': '', 'fulltype': ''}
467
+ 'rtime': None, 'context': '', 'fulltype': ''}
469
468
  finalResults.update(results)
470
469
  error_messages.close()
471
470
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redfish_interop_validator
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: Redfish Interop Validator
5
5
  Home-page: https://github.com/DMTF/Redfish-Interop-Validator
6
6
  Author: DMTF, https://www.dmtf.org/standards/feedback
@@ -11,7 +11,7 @@ with open("README.md", "r", "utf-8") as f:
11
11
 
12
12
  setup(
13
13
  name="redfish_interop_validator",
14
- version="2.2.5",
14
+ version="2.2.7",
15
15
  description="Redfish Interop Validator",
16
16
  long_description=long_description,
17
17
  long_description_content_type="text/markdown",