Commit ba3461c6 authored by markc's avatar markc

Cleanup/ts103120

parent 46fd5670
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://FooServiceSchema.example.com/schema/v1.1.1/"
elementFormDefault="qualified"
xmlns="http://FooServiceSchema.example.com/schema/v1.1.1/"
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="FooItem" type="FooItem"></xs:element>
<xs:complexType name="FooItem">
<xs:sequence>
<xs:element name="item1" type="ItemType"></xs:element>
<xs:element name="item2" type="ItemType"></xs:element>
<xs:element name="item3" type="ItemType"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ItemType">
<xs:restriction base="xs:string">
<xs:enumeration value="Foo"></xs:enumeration>
<xs:enumeration value="Bar"></xs:enumeration>
<xs:enumeration value="Baz"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:schema>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDc9UQSsRmchhOC
ixyrHvmjmDFeIApVlfTfVV5RJL/280wDlAYymhAcEcvMOyvBCHq4c3M8hBxt9zKD
mV+NbcDqXyblt8rVpjzbggn3Ch2dMJ/kLNO+O+WJSl3Jpyx3b4r8IVoUDXai2sjX
8jLNYI4TC673X3xX1VikzcGwFjt2zbL+WLHEnvUVeG/8FJfRl2ttWlSFMA2252ak
OwtAPF4AKJBW5pXSeILA+K32bf+Y5JMODWwI+njylAafTFV1eM/dTOSEKYCHVCN0
cxiO6KCC2GSzLeQEGWmh/C+uyhSlLW/6EyEHJcLdi6eTPunYJGanai6PLLr5zNWX
lvcj/YbZAgMBAAECggEAbm1BPRo3U4uKWpaNmFPdrU3VdlYK9CUCgU8X2PPF4HRN
TAiBZG6smGqocIQt5MYJFv/T2q2ny6lcHHrdT0BHxpoRRYMqIsZ26bk+o7DxheqU
LiPdGtiyaX+6CZq71WDwk/tTGmx0GwW+lH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/+CHG91mRvMSha6jQD7jLMT9xjND5Dob
/scV
-----END CERTIFICATE-----
......@@ -12,7 +12,7 @@
<TransactionIdentifier>d442c58c-d5e1-4fd9-90ec-9c228ad947f1</TransactionIdentifier>
<Timestamp>2020-09-22T08:06:17.025833Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.1.1</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>c02358b2-76cf-4ba4-a8eb-f6436ccaea2e</TransactionIdentifier>
<Timestamp>2015-09-01T12:00:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>45002c1e-dc4a-470a-9152-8e752638c86c</TransactionIdentifier>
<Timestamp>2015-09-01T12:01:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>69353ac0-9582-4c71-b162-86259c99de20</TransactionIdentifier>
<Timestamp>2015-09-01T12:02:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>c02358b2-76cf-4ba4-a8eb-f6436ccaea2e</TransactionIdentifier>
<Timestamp>2019-09-30T13:37:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>8854cfad-44ac-43b8-99ae-530b690b43da</TransactionIdentifier>
<Timestamp>2019-09-30T13:37:37.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>8854cfad-44ac-43b8-99ae-530b690b43da</TransactionIdentifier>
<Timestamp>2019-09-30T13:37:37.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
<HI1Message xmlns="http://uri.etsi.org/03120/common/2019/10/Core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:common="http://uri.etsi.org/03120/common/2016/02/Common" xmlns:task="http://uri.etsi.org/03120/common/2020/09/Task" xmlns:auth="http://uri.etsi.org/03120/common/2020/09/Authorisation">
<Header>
<SenderIdentifier>
<CountryCode>XX</CountryCode>
<UniqueIdentifier>ACTOR01</UniqueIdentifier>
</SenderIdentifier>
<ReceiverIdentifier>
<CountryCode>XX</CountryCode>
<UniqueIdentifier>ACTOR02</UniqueIdentifier>
</ReceiverIdentifier>
<TransactionIdentifier>9964584e-c1a5-4ffa-b949-d9da504c4efb</TransactionIdentifier>
<Timestamp>2021-06-25T12:00:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.9.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
</Header>
<Payload>
<RequestPayload>
<ActionRequests>
<ActionRequest>
<ActionIdentifier>0</ActionIdentifier>
<CREATE>
<HI1Object xsi:type="auth:AuthorisationObject">
<ObjectIdentifier>68c78910-c922-45f2-aeb3-017eb958bb05</ObjectIdentifier>
<CountryCode>XX</CountryCode>
<OwnerIdentifier>ACTOR01</OwnerIdentifier>
<auth:AuthorisationReference>W000001</auth:AuthorisationReference>
<auth:AuthorisationTimespan>
<auth:StartTime>2021-06-25T12:00:00Z</auth:StartTime>
<auth:EndTime>2021-09-01T12:00:00Z</auth:EndTime>
</auth:AuthorisationTimespan>
</HI1Object>
</CREATE>
</ActionRequest>
<ActionRequest>
<ActionIdentifier>1</ActionIdentifier>
<CREATE>
<HI1Object xsi:type="task:LITaskObject">
<ObjectIdentifier>4d8127db-e8bc-4a69-9378-457f0424ec2c</ObjectIdentifier>
<CountryCode>XX</CountryCode>
<OwnerIdentifier>ACTOR01</OwnerIdentifier>
<AssociatedObjects>
<AssociatedObject>68c78910-c922-45f2-aeb3-017eb958bb05</AssociatedObject>
</AssociatedObjects>
<task:Reference>LIID1</task:Reference>
<task:TargetIdentifier>
<task:TargetIdentifierValues>
<task:TargetIdentifierValue>
<task:FormatType>
<task:FormatOwner>ETSI</task:FormatOwner>
<task:FormatName>InternationalizedEmailAddress</task:FormatName>
</task:FormatType>
<task:Value>Όνομα.παραδείγματος@example.com</task:Value>
</task:TargetIdentifierValue>
</task:TargetIdentifierValues>
</task:TargetIdentifier>
<task:DeliveryType>
<common:Owner>ETSI</common:Owner>
<common:Name>TaskDeliveryType</common:Name>
<common:Value>IRIandCC</common:Value>
</task:DeliveryType>
<task:DeliveryDetails>
<task:DeliveryDestination>
<task:DeliveryAddress>
<task:IPv4Address>192.0.2.0</task:IPv4Address>
</task:DeliveryAddress>
</task:DeliveryDestination>
</task:DeliveryDetails>
<task:CSPID>
<CountryCode>XX</CountryCode>
<UniqueIdentifier>RECVER01</UniqueIdentifier>
</task:CSPID>
</HI1Object>
</CREATE>
</ActionRequest>
</ActionRequests>
</RequestPayload>
</Payload>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>kARbaz+wH6oJWSvmy6Fk4vTQ7t4m3Y16IiNNdDO08/I=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>DdT9ie03Z9O47sN8ad9gsfuhZhchtNhtvTyNhtiHKuqgNCt696tDH2c68tVqr+iJ3WpCn0gWJHKnYeniTwVPj6fxDh2RbCqk5SVHvdggZjCv3BInNH0ZfOrlvuArJS3UP/gifYXlT5s59Seze1nSjZDNeC25o9WRxNy0krGrhbqIFjxTHDilR40cmKq2SI1540yM3rsc+5D3hgsxGu7ly2dg7qtiFGQIQaFJi8twrViQUnOyDZ63yJHhWeLVU+2FvIuBZh3orDc3VipKsbqrjrDqdfi8qfYEHHPp25DfTpHXnCuhD/3hOwcxvhVJ4+47R8ysO9qMTvGRCUNptgskhQ==</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>MIIC/zCCAeegAwIBAgIUUOGdj0hEfnnW9gqIOCTJ9EUocnMwDQYJKoZIhvcNAQEL
BQAwDzENMAsGA1UEAwwEdGVzdDAeFw0yMTA2MjUwNzIyMDlaFw0yNDAzMjEwNzIy
MDlaMA8xDTALBgNVBAMMBHRlc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQDc9UQSsRmchhOCixyrHvmjmDFeIApVlfTfVV5RJL/280wDlAYymhAcEcvM
OyvBCHq4c3M8hBxt9zKDmV+NbcDqXyblt8rVpjzbggn3Ch2dMJ/kLNO+O+WJSl3J
pyx3b4r8IVoUDXai2sjX8jLNYI4TC673X3xX1VikzcGwFjt2zbL+WLHEnvUVeG/8
FJfRl2ttWlSFMA2252akOwtAPF4AKJBW5pXSeILA+K32bf+Y5JMODWwI+njylAaf
TFV1eM/dTOSEKYCHVCN0cxiO6KCC2GSzLeQEGWmh/C+uyhSlLW/6EyEHJcLdi6eT
PunYJGanai6PLLr5zNWXlvcj/YbZAgMBAAGjUzBRMB0GA1UdDgQWBBSFT3NqexF1
LcYkjqUr9MMTIFp/ATAfBgNVHSMEGDAWgBSFT3NqexF1LcYkjqUr9MMTIFp/ATAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCzwydpNgq680qWmd0D
4ya9fHUopeX7LBSYOU7NU3CagjXnUMwaCmSpokkH0Wvn1UtXDUF+slA9bEeXkfZm
70YW8msIEt1mljDi4CBI+MvaJ40OJkXwkQUE3dhj9LJl5Nv0UBEyv7k/a/6+eO9K
OQoHIVqXwrWs9JHTW6T4diN1w7xcgvSXhlcOySHjfNzFzferqx8i0/Wz6jD/7YSC
FOEaUrXbeFS3asRoZRLW6uXgfDJ7qfCmUZZ853OF3MN63OwWjPGxtFmeZAqMS/K0
FKgwMCrmZlVq6Fx87E+sc3eppXIceCau/+CHG91mRvMSha6jQD7jLMT9xjND5Dob
/scV
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
</HI1Message>
\ No newline at end of file
......@@ -12,7 +12,7 @@
<TransactionIdentifier>c02358b2-76cf-4ba4-a8eb-f6436ccaea2e</TransactionIdentifier>
<Timestamp>2015-09-01T12:00:01.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>45002c1e-dc4a-470a-9152-8e752638c86c</TransactionIdentifier>
<Timestamp>2015-09-01T12:01:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>69353ac0-9582-4c71-b162-86259c99de20</TransactionIdentifier>
<Timestamp>2015-09-01T12:02:00.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -12,7 +12,7 @@
<TransactionIdentifier>c02358b2-76cf-4ba4-a8eb-f6436ccaea2e</TransactionIdentifier>
<Timestamp>2019-09-30T13:37:01.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -17,7 +17,7 @@
<TransactionIdentifier>8854cfad-44ac-43b8-99ae-530b690b43da</TransactionIdentifier>
<Timestamp>2019-09-30T13:37:37.000000Z</Timestamp>
<Version>
<ETSIVersion>V1.8.1</ETSIVersion>
<ETSIVersion>V1.10.1</ETSIVersion>
<NationalProfileOwner>XX</NationalProfileOwner>
<NationalProfileVersion>v1.0</NationalProfileVersion>
</Version>
......
......@@ -11,7 +11,6 @@ from lxml import etree
from xml.etree.ElementTree import ParseError
from xmlschema import XMLSchema, XMLSchemaParseError
def BuildSchemaDictonary (fileList):
if len(fileList) == 0:
logging.info("No schema files provided")
......@@ -22,7 +21,7 @@ def BuildSchemaDictonary (fileList):
for schemaFile in fileList:
try:
xs = XMLSchema(schemaFile, validation='skip')
schemaLocations.append((xs.default_namespace, str(Path(schemaFile).resolve())))
schemaLocations.append((xs.target_namespace, str(Path(schemaFile).resolve())))
logging.info(" [ {0} -> {1} ]".format(xs.default_namespace, schemaFile))
except ParseError as ex:
logging.warning (" [ {0} failed to parse: {1} ]".format(schemaFile, ex))
......@@ -53,6 +52,7 @@ def ValidateXSDFiles (fileList):
schemaLocations = BuildSchemaDictonary(fileList)
errors = {}
schemaDictionary = {}
logging.info("Schema validation:")
for schemaFile in fileList:
......@@ -60,6 +60,7 @@ def ValidateXSDFiles (fileList):
schema = XMLSchema(schemaFile, locations = schemaLocations)
logging.info(schemaFile + ": OK")
errors[schemaFile] = []
schemaDictionary[schema.target_namespace] = schema
except XMLSchemaParseError as ex:
if (ex.schema_url) and (ex.schema_url != ex.origin_url):
logging.info(" Error {1} comes from {0}, suppressing".format(ex.schema_url, ex.message))
......@@ -67,7 +68,7 @@ def ValidateXSDFiles (fileList):
else:
logging.warning(schemaFile + ": Failed validation ({0})".format(ex))
errors[schemaFile] = [ex.message]
return errors
return errors, schemaDictionary
def ValidateInstanceDocuments (coreFile, supportingSchemas, instanceDocs):
......@@ -91,6 +92,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbosity", help="verbosity level", action="count", default=0)
parser.add_argument("input", help="include a directory or file", action="append", nargs="+")
parser.add_argument("-p", "--primaryNamespace", help="Primary schema namespace for instance doc validation")
args = parser.parse_args()
logging.getLogger().setLevel(logging.WARNING)
......@@ -100,8 +102,10 @@ if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("Very verbose selected")
logging.debug(f"Path: {args.input}")
includeFileList = []
includeInstanceDocList = []
for path in args.input[0]:
p = Path(path)
if not p.exists():
......@@ -112,12 +116,25 @@ if __name__ == '__main__':
for g in glob.glob(os.path.join(str(p), "*.xsd")):
logging.info(f">Including {g}")
includeFileList.append(g)
for g in glob.glob(os.path.join(str(p), "*.xml")):
logging.info(f">Including instance doc {g}")
includeInstanceDocList.append(g)
else:
logging.info(f"Including {p.absolute()}")
includeFileList.append(p.absolute())
logging.info(f">Including {p.absolute()}")
if str(p.absolute()).endswith('.xml'):
includeInstanceDocList.append(str(p.absolute()))
elif str(p.absolute()).endswith('.xsd'):
includeFileList.append(str(p.absolute()))
else:
logging.warning(f'Ignoring file {p.absolute()}')
if len(includeInstanceDocList) and (args.primaryNamespace is None):
print("Cannot validate instance documents without specifying a primary namespace (use -h for usage guidelines)")
exit(-1)
syntaxErrors = 0
print ("=============================")
print ("XSD syntax checks:")
print ("-----------------------------")
for file in includeFileList:
......@@ -132,9 +149,12 @@ if __name__ == '__main__':
if (syntaxErrors > 0):
print (f"{syntaxErrors} syntax errors detected")
exit(syntaxErrors)
else:
print ("0 syntax errors detected")
results = ValidateXSDFiles(includeFileList)
results, schemaDict = ValidateXSDFiles(includeFileList)
print ("=============================")
print ("XSD build checks:")
print ("-----------------------------")
errorCount = 0
......@@ -152,4 +172,23 @@ if __name__ == '__main__':
print ("-----------------------------")
print (f"{errorCount} build errors detected")
exit(errorCount)
\ No newline at end of file
if (errorCount > 0):
exit(errorCount)
print ("=============================")
print ("Instance document checks")
print ("-----------------------------")
errorCount = 0
primarySchema = schemaDict[args.primaryNamespace]
for instanceDoc in includeInstanceDocList:
try:
results = primarySchema.validate(instanceDoc)
print (f" {instanceDoc} : OK")
except Exception as ex:
errorCount += 1
print (f" {instanceDoc} : {str(ex)}")
print ("-----------------------------")
print (f"{errorCount} instance doc errors detected")
print ("=============================")
exit(errorCount)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment