Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyI40AAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informations- und Automatisierungssysteme
PyI40AAS
Commits
53e80b18
Commit
53e80b18
authored
4 years ago
by
TorbenD
Browse files
Options
Downloads
Patches
Plain Diff
cli_aasx: add check of file object in check_example
parent
4ff2b14e
No related branches found
No related tags found
1 merge request
!53
compliance_tool: add aasx functionality
Pipeline
#349166
passed
4 years ago
Stage: test
Stage: package
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aas/compliance_tool/compliance_check_aasx.py
+30
-5
30 additions, 5 deletions
aas/compliance_tool/compliance_check_aasx.py
with
30 additions
and
5 deletions
aas/compliance_tool/compliance_check_aasx.py
+
30
−
5
View file @
53e80b18
...
...
@@ -67,7 +67,6 @@ def check_deserialization(file_path: str, state_manager: ComplianceToolStateMana
reader
=
aasx
.
AASXReader
(
file_path
)
state_manager
.
set_step_status_from_log
()
except
ValueError
as
error
:
state_manager
.
set_step_status
(
Status
.
FAILED
)
logger
.
error
(
error
)
state_manager
.
set_step_status_from_log
()
state_manager
.
add_step
(
'
Read file
'
)
...
...
@@ -83,9 +82,8 @@ def check_deserialization(file_path: str, state_manager: ComplianceToolStateMana
new_cp
=
reader
.
get_core_properties
()
state_manager
.
set_step_status
(
Status
.
SUCCESS
)
except
ValueError
as
error
:
state_manager
.
set_step_status
(
Status
.
FAILED
)
logger
.
error
(
error
)
state_manager
.
set_step_status
_from_log
(
)
state_manager
.
set_step_status
(
Status
.
FAILED
)
return
model
.
DictObjectStore
(),
aasx
.
DictSupplementaryFileContainer
(),
pyecma376_2
.
OPCCoreProperties
()
finally
:
reader
.
close
()
...
...
@@ -102,6 +100,11 @@ def check_aas_example(file_path: str, state_manager: ComplianceToolStateManager)
:param file_path: given file which should be checked
:param state_manager: manager to log the steps
"""
logger
=
logging
.
getLogger
(
'
compliance_check
'
)
logger
.
addHandler
(
state_manager
)
logger
.
propagate
=
False
logger
.
setLevel
(
logging
.
INFO
)
# create handler to get logger info
logger_example
=
logging
.
getLogger
(
example_aas
.
__name__
)
logger_example
.
addHandler
(
state_manager
)
...
...
@@ -120,7 +123,8 @@ def check_aas_example(file_path: str, state_manager: ComplianceToolStateManager)
checker
=
AASDataChecker
(
raise_immediately
=
False
)
state_manager
.
add_step
(
'
Check if data is equal to example data
'
)
checker
.
check_object_store
(
obj_store
,
create_example_aas_binding
())
example_data
=
create_example_aas_binding
()
checker
.
check_object_store
(
obj_store
,
example_data
)
state_manager
.
add_log_records_from_data_checker
(
checker
)
if
state_manager
.
status
in
(
Status
.
FAILED
,
Status
.
NOT_EXECUTED
):
...
...
@@ -140,7 +144,28 @@ def check_aas_example(file_path: str, state_manager: ComplianceToolStateManager)
checker2
.
check
(
duration
.
microseconds
<
20
,
"
created must be {}
"
.
format
(
cp
.
created
))
checker2
.
check
(
cp_new
.
creator
==
"
PyI40AAS Testing Framework
"
,
"
creator must be
'
PyI40AAS Testing Framework
'"
)
checker2
.
check
(
cp_new
.
lastModifiedBy
is
cp
.
lastModifiedBy
,
"
lastModifiedBy must be {}
"
.
format
(
cp
.
lastModifiedBy
))
# Check if file in file object is the same
list_of_id_shorts
=
[
"
ExampleSubmodelCollectionUnordered
"
,
"
ExampleFile
"
]
obj
=
example_data
.
get_identifiable
(
model
.
Identifier
(
"
https://acplt.org/Test_Submodel
"
,
model
.
IdentifierType
.
IRI
))
for
id_short
in
list_of_id_shorts
:
obj
=
obj
.
get_referable
(
id_short
)
obj2
=
obj_store
.
get_identifiable
(
model
.
Identifier
(
"
https://acplt.org/Test_Submodel
"
,
model
.
IdentifierType
.
IRI
))
for
id_short
in
list_of_id_shorts
:
obj2
=
obj2
.
get_referable
(
id_short
)
try
:
sha_file
=
files
.
get_sha256
(
obj
.
value
)
except
KeyError
as
error
:
state_manager
.
add_log_records_from_data_checker
(
checker2
)
logger
.
error
(
error
)
state_manager
.
set_step_status
(
Status
.
FAILED
)
return
checker2
.
check
(
sha_file
==
files
.
get_sha256
(
obj2
.
value
),
"
File of {} must be {}.
"
.
format
(
obj
.
value
,
obj2
.
value
))
state_manager
.
add_log_records_from_data_checker
(
checker2
)
if
state_manager
.
status
in
(
Status
.
FAILED
,
Status
.
NOT_EXECUTED
):
state_manager
.
set_step_status
(
Status
.
FAILED
)
else
:
state_manager
.
set_step_status
(
Status
.
SUCCESS
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment