Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Commit 39968c3

Browse files
authored
Merge pull request #4 from DMTF/1.0.0-Tagging
1.0.0 Versioning
2 parents 290cab7 + e844ecb commit 39968c3

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

AUTHORS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Original Contribution:
22

3-
* Paul Vancil- Dell ESI -- tool definition
4-
* Jon Hass - Dell CTO -- tool definition
3+
* Paul Vancil - Dell ESI -- tool definition
4+
* Jon Hass - Dell CTO -- tool definition
55
* John Watts - Dell ESI tools contractor -- initial implementation

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
21
# Change Log
32

4-
## [Unreleased 0.9.0] - 2017-09-28
5-
- Initial upload to DMTF/spmf-tools private repo
3+
## [1.0.0] - 2018-08-17
4+
- Error message improvements
5+
- Added support for caching of schemas
6+
7+
## [0.9.0] - 2017-09-28
8+
- Initial version

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Redfish-JsonSchema-ResponseValidator
1+
Copyright 2017-2018 DMTF. All rights reserved.
22

3-
Copyright 2017 Distributed Management Task Force, Inc. All rights reserved.
3+
# Redfish-JsonSchema-ResponseValidator
44

55
## About
66

7-
***Redfish-JsonSchema-ResponseValidator.py*** is a Python3 utility used to validate any JSON resource against DMTF provided JSON schemas
7+
***Redfish-JsonSchema-ResponseValidator.py*** is a Python3 utility used to validate any JSON resource against DMTF provided JSON schemas.
88

99
### To run:
1010

@@ -44,7 +44,6 @@ NOTE: if -v is specified, resource JSON will be
4444
NOTE: if -g is specified, input files will be the files
4545
found in a previous error file. If used with -v,
4646
the output will include the resource JSON and the Schema
47-
4847
```
4948

5049
## Installation, Path, and Dependencies:
@@ -77,8 +76,6 @@ Redfish-JsonSchema-ResponseValidator.py -g -v [-e errorfile] > saveout
7776
saves the standard out to be examined with an editor
7877
7978
NOTE: here is a shortcut bash script
80-
81-
8279
```
8380

8481
## Known Issues

Redfish-JsonSchema-ResponseValidator.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
The purpose of this program is to validate
1313
redfish resources against DMTF json schemas.
1414
There are three ways to run this:
15-
1) against a directory of all
15+
1) against a directory of all
1616
resources created by the mockup creator
1717
2) selecting individual resources from
18-
that same directory
18+
that same directory
1919
( the -f option )
20-
3) pulling a resource from an actual host
20+
3) pulling a resource from an actual host
2121
of a redfish service.
2222
( -r and -i options )
2323
@@ -32,7 +32,7 @@
3232
#!/usr/bin/env bash
3333
cmd="/usr/bin/scl enable rh-python34"
3434
args="$@"
35-
$cmd "./resourceValidate.py $args "
35+
$cmd "./resourceValidate.py $args "
3636
3737
'''
3838

@@ -44,20 +44,21 @@
4444
import getopt
4545
import requests
4646

47+
tool_version = '1.0.0'
4748

4849
def usage():
49-
print ('\nresourceValidate.py usage:')
50-
print (' -h display usage and exit')
51-
print (' -v verbose')
52-
print (' -m directory path to a mockup tree to validate against, default ./mockup-sim-pull')
53-
print (' -s path to a local dir containing the json schema files to validate against, default ./DMTFSchemas')
50+
print ('\nRedfish-JsonSchema-ResponseValidator.py usage:')
51+
print (' -h display usage and exit')
52+
print (' -v verbose')
53+
print (' -m directory path to a mockup tree to validate against, default ./mockup-sim-pull')
54+
print (' -s path to a local dir containing the json schema files to validate against, default ./DMTFSchemas')
5455
print (' -S tell resourceValidate to get the schemaFiles from http://redfish.dmtf.org/schemas/v1/')
55-
print (' -u user name, default root')
56-
print (' -p password, default calvin')
57-
print (' -e error output file, default ./validate_errs')
58-
print (' -f comma separated list of files to validate. if no -f, it validates entire mockup')
56+
print (' -u user name, default root')
57+
print (' -p password, default calvin')
58+
print (' -e error output file, default ./validate_errs')
59+
print (' -f comma separated list of files to validate. if no -f, it validates entire mockup')
5960
print (' -r hostname or IP address [:portno], default None')
60-
print (' -i url, --used with -r option to specify url for a live system. default /redfish/v1')
61+
print (' -i url, --used with -r option to specify url for a live system. default /redfish/v1')
6162
print (' -x comma separated list of patterns to exclude from errors')
6263
print (' -g validate only resources which failed a previous run')
6364
print ('\n')
@@ -136,7 +137,7 @@ def __init__(self, argv):
136137
elif self.files:
137138
self.traverseFiles()
138139
else:
139-
self.traverseDir()
140+
self.traverseDir()
140141

141142
print ('\n{} resources validated.'.format(self.rescount))
142143
if self.errcount:
@@ -158,7 +159,6 @@ def doErrors(self):
158159
line = line.replace('/index.json','')
159160
self.files += line + ','
160161
self.traverseFiles()
161-
162162

163163
def valFromHost(self):
164164
''' GET one resource from a host (rackmanager?)
@@ -189,7 +189,6 @@ def valFromHost(self):
189189
self.rescount += 1
190190
self.validate(data,schname,self.url)
191191

192-
193192
def traverseFiles(self):
194193
''' read a list of resources specified
195194
with the -f option,
@@ -230,7 +229,7 @@ def traverseFiles(self):
230229
self.validate(data,schname,fname)
231230

232231
def traverseDir(self):
233-
''' walk a directory of resources,i.e a "mockup"
232+
''' walk a directory of resources,i.e a "mockup"
234233
and validate against a DTMF schema.
235234
'''
236235
for dirn, subdir, filelist in os.walk(self.mockdir):
@@ -390,7 +389,7 @@ def parseOdataType(self,resource):
390389
return(None,None,None)
391390

392391
resourceOdataType=resource["@odata.type"]
393-
392+
394393
#the odataType format is: <namespace>.<version>.<type> where version may have periods in it
395394
odataTypeMatch = re.compile('^#([a-zA-Z0-9]*)\.([a-zA-Z0-9\._]*)\.([a-zA-Z0-9]*)$')
396395
resourceMatch = re.match(odataTypeMatch, resourceOdataType)
@@ -413,6 +412,5 @@ def parseOdataType(self,resource):
413412
return(namespace, version, resourceType)
414413

415414
if __name__ == '__main__':
415+
print( "Redfish-JsonSchema-ResponseValidator version {}".format( tool_version ) )
416416
rv = ResourceValidate(sys.argv)
417-
418-

0 commit comments

Comments
 (0)