Skip to content

Commit 2b10cd4

Browse files
process: update metamodel safety analysis (#104)
* process: update metamodel safety analysis * process: graph_check ASIL update * process: update safety analysis templates * process: update graph check * process: add test cases requirements * process: add checks safety analysis * process: delete ASIL_D option. Add testcases * process: fix test required options * Update ASIL_D check * increase version Ref: closes #102 --------- Signed-off-by: Volker Häussler <[email protected]> Co-authored-by: Sven Bachmann <[email protected]>
1 parent a4e19d4 commit 2b10cd4

File tree

9 files changed

+849
-74
lines changed

9 files changed

+849
-74
lines changed

.vscode/settings.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@
3838
],
3939

4040
// Disable internal type checking, since we use basedpyright
41-
"python.analysis.typeCheckingMode": "off"
41+
"python.analysis.typeCheckingMode": "off",
42+
"cSpell.words": [
43+
"ASIL",
44+
"FMEA",
45+
"isopas",
46+
"isosae",
47+
"stkh",
48+
"workproduct"
49+
]
4250
}

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module(
1515
name = "score_docs_as_code",
16-
version = "0.4.1",
16+
version = "0.4.2",
1717
compatibility_level = 0,
1818
)
1919

src/extensions/score_metamodel/checks/check_options.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def remove_prefix(word: str, prefixes: list[str]) -> str:
8282
try:
8383
if not re.match(pattern, value):
8484
log.warning_for_option(
85-
need, field, f"does not follow pattern `{pattern}`."
85+
need,
86+
field,
87+
f"does not follow pattern `{pattern}`.",
88+
new_check="ASIL_D" in value,
8689
)
8790
except TypeError:
8891
log.warning_for_option(

src/extensions/score_metamodel/checks/graph_checks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,9 @@ def check_metamodel_graph(
137137
# Convert list to dictionary for easy lookup
138138
needs_dict_all = {need["id"]: need for need in all_needs.values()}
139139
needs_local = list(all_needs.filter_is_external(False).values())
140-
141140
# Iterate over all graph checks
142141
for check in graph_checks_global.items():
143142
apply, eval = check[1].values()
144-
145143
# Get all needs that match the selection criteria
146144
selected_needs = get_need_selection(needs_local, apply, log)
147145

src/extensions/score_metamodel/metamodel.yaml

Lines changed: 124 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ needs_types:
188188
id: ^doc__[0-9a-z_]*$
189189
status: ^(valid|draft|invalid)$
190190
optional_options:
191-
safety: "^(QM|ASIL_B|ASIL_D)$"
191+
safety: "^(QM|ASIL_B)$"
192192
security: "^(YES|NO)$"
193193
realizes: "^wp__.+$"
194194

@@ -201,7 +201,7 @@ needs_types:
201201
id: ^stkh_req__[0-9a-z_]*$
202202
# req-Id: tool_req__docs_req_attr_reqtype
203203
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
204-
safety: ^(QM|ASIL_B|ASIL_D)$
204+
safety: ^(QM|ASIL_B)$
205205
status: ^(valid|invalid)$
206206
# req-Id: tool_req__docs_req_attr_rationale
207207
rationale: ^.+$
@@ -225,7 +225,7 @@ needs_types:
225225
# req-Id: tool_req__docs_req_attr_reqtype
226226
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
227227
security: ^(YES|NO)$
228-
safety: ^(QM|ASIL_B|ASIL_D)$
228+
safety: ^(QM|ASIL_B)$
229229
status: ^(valid|invalid)$
230230
mandatory_links:
231231
# req-Id: tool_req__docs_req_link_satisfies_allowed
@@ -248,7 +248,7 @@ needs_types:
248248
# req-Id: tool_req__docs_req_attr_reqtype
249249
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
250250
security: ^(YES|NO)$
251-
safety: ^(QM|ASIL_B|ASIL_D)$
251+
safety: ^(QM|ASIL_B)$
252252
status: ^(valid|invalid)$
253253
mandatory_links:
254254
# req-Id: tool_req__docs_req_link_satisfies_allowed
@@ -269,7 +269,7 @@ needs_types:
269269
mandatory_options:
270270
id: ^tool_req__[0-9a-z_]*$
271271
security: ^(YES|NO)$
272-
safety: ^(QM|ASIL_B|ASIL_D)$
272+
safety: ^(QM|ASIL_B)$
273273
status: ^(valid|invalid)$
274274
optional_links:
275275
# req-Id: tool_req__docs_req_link_satisfies_allowed
@@ -298,7 +298,7 @@ needs_types:
298298
# req-Id: tool_req__docs_req_attr_reqtype
299299
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
300300
security: ^(YES|NO)$
301-
safety: ^(QM|ASIL_B|ASIL_D)$
301+
safety: ^(QM|ASIL_B)$
302302
status: ^(valid|invalid)$
303303
optional_options:
304304
codelink: ^.*$
@@ -321,7 +321,7 @@ needs_types:
321321
mandatory_options:
322322
id: ^feat_arc_sta__[0-9a-z_]+$
323323
security: ^(YES|NO)$
324-
safety: ^(QM|ASIL_B|ASIL_D)$
324+
safety: ^(QM|ASIL_B)$
325325
status: ^(valid|invalid)$
326326
mandatory_links:
327327
includes: ^logic_arc_int(_op)*__.+$
@@ -336,7 +336,7 @@ needs_types:
336336
mandatory_options:
337337
id: ^feat_arc_dyn__[0-9a-z_]+$
338338
security: ^(YES|NO)$
339-
safety: ^(QM|ASIL_B|ASIL_D)$
339+
safety: ^(QM|ASIL_B)$
340340
status: ^(valid|invalid)$
341341
mandatory_links:
342342
fulfils: ^feat_req__.+$
@@ -349,7 +349,7 @@ needs_types:
349349
mandatory_options:
350350
id: ^logic_arc_int__[0-9a-z_]+$
351351
security: ^(YES|NO)$
352-
safety: ^(QM|ASIL_B|ASIL_D)$
352+
safety: ^(QM|ASIL_B)$
353353
status: ^(valid|invalid)$
354354
optional_links:
355355
includes: ^logic_arc_int_op__.+$
@@ -363,7 +363,7 @@ needs_types:
363363
mandatory_options:
364364
id: ^logic_arc_int_op__[0-9a-z_]+$
365365
security: ^(YES|NO)$
366-
safety: ^(QM|ASIL_B|ASIL_D)$
366+
safety: ^(QM|ASIL_B)$
367367
status: ^(valid|invalid)$
368368
mandatory_links:
369369
included_by: ^logic_arc_int__.+$
@@ -394,7 +394,7 @@ needs_types:
394394
mandatory_options:
395395
id: ^comp_arc_sta__[0-9a-z_]+$
396396
security: ^(YES|NO)$
397-
safety: ^(QM|ASIL_B|ASIL_D)$
397+
safety: ^(QM|ASIL_B)$
398398
status: ^(valid|invalid)$
399399
optional_links:
400400
implements: ^real_arc_int(_op)*__.+$
@@ -410,7 +410,7 @@ needs_types:
410410
mandatory_options:
411411
id: ^comp_arc_dyn__[0-9a-z_]+$
412412
security: ^(YES|NO)$
413-
safety: ^(QM|ASIL_B|ASIL_D)$
413+
safety: ^(QM|ASIL_B)$
414414
status: ^(valid|invalid)$
415415
optional_links:
416416
fulfils: ^comp_req__.+$
@@ -423,7 +423,7 @@ needs_types:
423423
mandatory_options:
424424
id: ^real_arc_int__[0-9a-z_]+$
425425
security: ^(YES|NO)$
426-
safety: ^(QM|ASIL_B|ASIL_D)$
426+
safety: ^(QM|ASIL_B)$
427427
status: ^(valid|invalid)$
428428
language: ^(cpp|rust)$
429429
optional_links:
@@ -437,7 +437,7 @@ needs_types:
437437
mandatory_options:
438438
id: ^real_arc_int_op__[0-9a-z_]+$
439439
security: ^(YES|NO)$
440-
safety: ^(QM|ASIL_B|ASIL_D)$
440+
safety: ^(QM|ASIL_B)$
441441
status: ^(valid|invalid)$
442442
mandatory_links:
443443
included_by: ^real_arc_int__.+$
@@ -463,7 +463,7 @@ needs_types:
463463
mandatory_options:
464464
id: ^dd_sta__[0-9a-z_]*$
465465
security: ^(YES|NO)$
466-
safety: ^(QM|ASIL_B|ASIL_D)$
466+
safety: ^(QM|ASIL_B)$
467467
status: ^(valid|invalid)$
468468
mandatory_links:
469469
implements: ^comp_req__.*$
@@ -479,7 +479,7 @@ needs_types:
479479
mandatory_options:
480480
id: ^dd_dyn__[0-9a-z_]*$
481481
security: ^(YES|NO)$
482-
safety: ^(QM|ASIL_B|ASIL_D)$
482+
safety: ^(QM|ASIL_B)$
483483
status: ^(valid|invalid)$
484484
mandatory_links:
485485
implements: ^comp_req__.*$
@@ -491,7 +491,7 @@ needs_types:
491491
mandatory_options:
492492
id: ^sw_unit__[0-9a-z_]*$
493493
security: ^(YES|NO)$
494-
safety: ^(QM|ASIL_B|ASIL_D)$
494+
safety: ^(QM|ASIL_B)$
495495
status: ^(valid|invalid)$
496496
sw_unit_int:
497497
title: Software unit interfaces
@@ -501,9 +501,86 @@ needs_types:
501501
mandatory_options:
502502
id: ^sw_unit_int__[0-9a-z_]*$
503503
security: ^(YES|NO)$
504-
safety: ^(QM|ASIL_B|ASIL_D)$
504+
safety: ^(QM|ASIL_B)$
505505
status: ^(valid|invalid)$
506506

507+
# Safety Analysis DFA
508+
feat_plat_saf_dfa:
509+
title: DFA
510+
prefix: feat_plat_saf_dfa__
511+
mandatory_options:
512+
id: ^feat_plat_saf_dfa__[0-9a-z_]+$
513+
violation_id: ^.*$
514+
violation_cause: ^.*$
515+
sufficient: ^(yes|no)$
516+
status: ^(valid|invalid)$
517+
mandatory_links:
518+
mitigates: ^(feat_req__.*|aou_req__.*)$
519+
verifies: ^feat_arc_dyn__[0-9a-z_]*$
520+
optional_links:
521+
mitigation_issue: ^https://github.com/.*$
522+
523+
feat_saf_dfa:
524+
title: DFA
525+
prefix: feat_saf_dfa__
526+
mandatory_options:
527+
id: ^feat_saf_dfa__[0-9a-z_]+$
528+
violation_id: ^.*$
529+
violation_cause: ^.*$
530+
sufficient: ^(yes|no)$
531+
status: ^(valid|invalid)$
532+
mandatory_links:
533+
mitigates: ^(feat_req__.*|aou_req__.*)$
534+
verifies: ^feat_arc_dyn__[0-9a-z_]*$
535+
optional_links:
536+
mitigation_issue: ^https://github.com/.*$
537+
538+
comp_saf_dfa:
539+
title: DFA
540+
prefix: comp_saf_dfa__
541+
mandatory_options:
542+
id: ^comp_saf_dfa__[0-9a-z_]+$
543+
violation_id: ^.*$
544+
violation_cause: ^.*$
545+
sufficient: ^(yes|no)$
546+
status: ^(valid|invalid)$
547+
mandatory_links:
548+
mitigates: ^(comp_req__.*|aou_req__.*)$
549+
verifies: ^comp_arc_dyn__[0-9a-z_]*$
550+
optional_links:
551+
mitigation_issue: ^https://github.com/.*$
552+
553+
# # Safety Analysis FMEA
554+
feat_saf_fmea:
555+
title: FMEA
556+
prefix: feat_saf_fmea__
557+
mandatory_options:
558+
id: ^feat_saf_fmea__[0-9a-z_]+$
559+
violation_id: ^.*$
560+
violation_cause: ^.*$
561+
sufficient: ^(yes|no)$
562+
status: ^(valid|invalid)$
563+
mandatory_links:
564+
mitigates: ^(feat_req__.*|aou_req__.*)$
565+
verifies: ^feat_arc_dyn__[0-9a-z_]*$
566+
optional_links:
567+
mitigation_issue: ^https://github.com/.*$
568+
569+
comp_saf_fmea:
570+
title: FMEA
571+
prefix: comp_saf_fmea__
572+
mandatory_options:
573+
id: ^comp_saf_fmea__[0-9a-z_]+$
574+
violation_id: ^.*$
575+
violation_cause: ^.*$
576+
sufficient: ^(yes|no)$
577+
status: ^(valid|invalid)$
578+
mandatory_links:
579+
mitigates: ^(comp_req__.*|aou_req__.*)$
580+
verifies: ^comp_arc_dyn__[0-9a-z_]*$
581+
optional_links:
582+
mitigation_issue: ^https://github.com/.*$
583+
507584
# Extra link types, which shall be available and allow need types to be linked to each other.
508585
# We use a dedicated linked type for each type of a connection, for instance from
509586
# a specification to a requirement. This makes filtering and visualization of such connections
@@ -576,6 +653,14 @@ needs_extra_links:
576653
included_by:
577654
incoming: includes
578655
outgoing: included by
656+
657+
mitigates:
658+
incoming: mitigated by
659+
outgoing: mitigates
660+
661+
verifies:
662+
incoming: verified by
663+
outgoing: verifies
579664
##############################################################
580665
# Graph Checks
581666
# The graph checks focus on the relation of the needs and their attributes.
@@ -594,36 +679,33 @@ needs_extra_links:
594679
##############################################################
595680
# req- Id: gd_req__req__linkage_architecture
596681
# req- Id: gd_req__req__linkage_safety
682+
683+
# Checks if the child requirement has the at least the same safety level as the parent requirement. It's allowed to "overfill" the safety level of the parent.
684+
# ASIL decomposition is not foreseen in S-CORE. Therefore it's not allowed to have a child requirement with a lower safety level than the parent requirement as
685+
# it is possible in an decomposition case.
686+
# If need-req is `QM`, parent must be `QM`.
597687
graph_checks:
598-
# req- Id: gd_req__req__linkage_safety
599-
req_safety_linkage:
688+
req_safety_linkage_qm:
600689
needs:
601690
include: comp_req, feat_req
602-
condition:
603-
and:
604-
- safety != QM
605-
- status == valid
691+
condition: safety == QM
606692
check:
607-
satisfies:
608-
and:
609-
- safety != QM
610-
- status == valid
611-
req_linkage:
693+
satisfies: safety == QM
694+
# If need-req is `ASIL_B`, parent must be `QM` or `ASIL_B`.
695+
req_safety_linkage_asil_b:
612696
needs:
613697
include: comp_req, feat_req
614-
condition: status == valid
698+
condition: safety == ASIL_B
615699
check:
616-
# req- Id: gd_req__req__linkage_architecture
617-
satisfies: status == valid
618-
arch_safety_linkage:
700+
satisfies: safety != ASIL_D
701+
# saf - ID gd_req__saf_linkage_safety
702+
# It shall be checked that Safety Analysis (DFA and FMEA) can only be linked via mitigate against
703+
# - <Feature | Component | AoU> Requirements with the same ASIL or
704+
# - <Feature | Component | AoU> Requirements with a higher ASIL
705+
# as the corresponding ASIL of the Feature or Component that is analyzed.
706+
saf_linkage_safety:
619707
needs:
620-
include: comp_req, feat_req
621-
condition:
622-
and:
623-
- safety != QM
624-
- status == valid
708+
include: feat_saf_fmea, comp_saf_fmea, feat_plat_saf_dfa, feat_saf_dfa, comp_saf_dfa
709+
condition: safety == ASIL_B
625710
check:
626-
fulfils:
627-
and:
628-
- safety != QM
629-
- status == valid
711+
mitigates: safety != QM

0 commit comments

Comments
 (0)