Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,13 @@
],

// Disable internal type checking, since we use basedpyright
"python.analysis.typeCheckingMode": "off"
"python.analysis.typeCheckingMode": "off",
"cSpell.words": [
"ASIL",
"FMEA",
"isopas",
"isosae",
"stkh",
"workproduct"
]
}
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

module(
name = "score_docs_as_code",
version = "0.4.1",
version = "0.4.2",
compatibility_level = 0,
)

Expand Down
5 changes: 4 additions & 1 deletion src/extensions/score_metamodel/checks/check_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def remove_prefix(word: str, prefixes: list[str]) -> str:
try:
if not re.match(pattern, value):
log.warning_for_option(
need, field, f"does not follow pattern `{pattern}`."
need,
field,
f"does not follow pattern `{pattern}`.",
new_check="ASIL_D" in value,
)
except TypeError:
log.warning_for_option(
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/score_metamodel/checks/graph_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,9 @@ def check_metamodel_graph(
# Convert list to dictionary for easy lookup
needs_dict_all = {need["id"]: need for need in all_needs.values()}
needs_local = list(all_needs.filter_is_external(False).values())

# Iterate over all graph checks
for check in graph_checks_global.items():
apply, eval = check[1].values()

# Get all needs that match the selection criteria
selected_needs = get_need_selection(needs_local, apply, log)

Expand Down
166 changes: 124 additions & 42 deletions src/extensions/score_metamodel/metamodel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ needs_types:
id: ^doc__[0-9a-z_]*$
status: ^(valid|draft|invalid)$
optional_options:
safety: "^(QM|ASIL_B|ASIL_D)$"
safety: "^(QM|ASIL_B)$"
security: "^(YES|NO)$"
realizes: "^wp__.+$"

Expand All @@ -201,7 +201,7 @@ needs_types:
id: ^stkh_req__[0-9a-z_]*$
# req-Id: tool_req__docs_req_attr_reqtype
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
# req-Id: tool_req__docs_req_attr_rationale
rationale: ^.+$
Expand All @@ -225,7 +225,7 @@ needs_types:
# req-Id: tool_req__docs_req_attr_reqtype
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
# req-Id: tool_req__docs_req_link_satisfies_allowed
Expand All @@ -248,7 +248,7 @@ needs_types:
# req-Id: tool_req__docs_req_attr_reqtype
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
# req-Id: tool_req__docs_req_link_satisfies_allowed
Expand All @@ -269,7 +269,7 @@ needs_types:
mandatory_options:
id: ^tool_req__[0-9a-z_]*$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
optional_links:
# req-Id: tool_req__docs_req_link_satisfies_allowed
Expand Down Expand Up @@ -298,7 +298,7 @@ needs_types:
# req-Id: tool_req__docs_req_attr_reqtype
reqtype: ^(Functional|Interface|Process|Legal|Non-Functional)$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
optional_options:
codelink: ^.*$
Expand All @@ -321,7 +321,7 @@ needs_types:
mandatory_options:
id: ^feat_arc_sta__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
includes: ^logic_arc_int(_op)*__.+$
Expand All @@ -336,7 +336,7 @@ needs_types:
mandatory_options:
id: ^feat_arc_dyn__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
fulfils: ^feat_req__.+$
Expand All @@ -349,7 +349,7 @@ needs_types:
mandatory_options:
id: ^logic_arc_int__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
optional_links:
includes: ^logic_arc_int_op__.+$
Expand All @@ -363,7 +363,7 @@ needs_types:
mandatory_options:
id: ^logic_arc_int_op__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
included_by: ^logic_arc_int__.+$
Expand Down Expand Up @@ -394,7 +394,7 @@ needs_types:
mandatory_options:
id: ^comp_arc_sta__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
optional_links:
implements: ^real_arc_int(_op)*__.+$
Expand All @@ -410,7 +410,7 @@ needs_types:
mandatory_options:
id: ^comp_arc_dyn__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
optional_links:
fulfils: ^comp_req__.+$
Expand All @@ -423,7 +423,7 @@ needs_types:
mandatory_options:
id: ^real_arc_int__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
language: ^(cpp|rust)$
optional_links:
Expand All @@ -437,7 +437,7 @@ needs_types:
mandatory_options:
id: ^real_arc_int_op__[0-9a-z_]+$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
included_by: ^real_arc_int__.+$
Expand All @@ -463,7 +463,7 @@ needs_types:
mandatory_options:
id: ^dd_sta__[0-9a-z_]*$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
implements: ^comp_req__.*$
Expand All @@ -479,7 +479,7 @@ needs_types:
mandatory_options:
id: ^dd_dyn__[0-9a-z_]*$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
mandatory_links:
implements: ^comp_req__.*$
Expand All @@ -491,7 +491,7 @@ needs_types:
mandatory_options:
id: ^sw_unit__[0-9a-z_]*$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$
sw_unit_int:
title: Software unit interfaces
Expand All @@ -501,9 +501,86 @@ needs_types:
mandatory_options:
id: ^sw_unit_int__[0-9a-z_]*$
security: ^(YES|NO)$
safety: ^(QM|ASIL_B|ASIL_D)$
safety: ^(QM|ASIL_B)$
status: ^(valid|invalid)$

# Safety Analysis DFA
feat_plat_saf_dfa:
title: DFA
prefix: feat_plat_saf_dfa__
mandatory_options:
id: ^feat_plat_saf_dfa__[0-9a-z_]+$
violation_id: ^.*$
violation_cause: ^.*$
sufficient: ^(yes|no)$
status: ^(valid|invalid)$
mandatory_links:
mitigates: ^(feat_req__.*|aou_req__.*)$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I saw in the process that 'mitigates' can be left empty.
If this is the case, then this should be a optional_link not madatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mitigation link can be open as long as there is no mitigation (gd_guidl__safety_analysis). To finish a safety analysis a sufficient and linked mitigation is needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That then means though that this should be optional?

verifies: ^feat_arc_dyn__[0-9a-z_]*$
optional_links:
mitigation_issue: ^https://github.com/.*$

feat_saf_dfa:
title: DFA
prefix: feat_saf_dfa__
mandatory_options:
id: ^feat_saf_dfa__[0-9a-z_]+$
violation_id: ^.*$
violation_cause: ^.*$
sufficient: ^(yes|no)$
status: ^(valid|invalid)$
mandatory_links:
mitigates: ^(feat_req__.*|aou_req__.*)$
verifies: ^feat_arc_dyn__[0-9a-z_]*$
optional_links:
mitigation_issue: ^https://github.com/.*$

comp_saf_dfa:
title: DFA
prefix: comp_saf_dfa__
mandatory_options:
id: ^comp_saf_dfa__[0-9a-z_]+$
violation_id: ^.*$
violation_cause: ^.*$
sufficient: ^(yes|no)$
status: ^(valid|invalid)$
mandatory_links:
mitigates: ^(comp_req__.*|aou_req__.*)$
verifies: ^comp_arc_dyn__[0-9a-z_]*$
optional_links:
mitigation_issue: ^https://github.com/.*$

# # Safety Analysis FMEA
feat_saf_fmea:
title: FMEA
prefix: feat_saf_fmea__
mandatory_options:
id: ^feat_saf_fmea__[0-9a-z_]+$
violation_id: ^.*$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "failure_mode"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed to be consitent accross the types if I remember correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned to the actual PR it's "fault_models". ](eclipse-score/process_description#54)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, consistent is nice, but according to #54 above the name of the attribute and the content to be written is completely inconsistent: ":violation_cause: "description of failure effect of the fault model on the element"" - the attribute asks for the "cause" and the description is about the "effect"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we discuss this then tomorrow?

violation_cause: ^.*$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "failure_effect"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion I changed it to violation. If needed we shall discuss it in our round.

sufficient: ^(yes|no)$
status: ^(valid|invalid)$
mandatory_links:
mitigates: ^(feat_req__.*|aou_req__.*)$
verifies: ^feat_arc_dyn__[0-9a-z_]*$
optional_links:
mitigation_issue: ^https://github.com/.*$

comp_saf_fmea:
title: FMEA
prefix: comp_saf_fmea__
mandatory_options:
id: ^comp_saf_fmea__[0-9a-z_]+$
violation_id: ^.*$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "failure_mode"

violation_cause: ^.*$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "failure_effect"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned to the actual PR it's "fault_models". ](eclipse-score/process_description#54)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

sufficient: ^(yes|no)$
status: ^(valid|invalid)$
mandatory_links:
mitigates: ^(comp_req__.*|aou_req__.*)$
verifies: ^comp_arc_dyn__[0-9a-z_]*$
optional_links:
mitigation_issue: ^https://github.com/.*$

# Extra link types, which shall be available and allow need types to be linked to each other.
# We use a dedicated linked type for each type of a connection, for instance from
# a specification to a requirement. This makes filtering and visualization of such connections
Expand Down Expand Up @@ -576,6 +653,14 @@ needs_extra_links:
included_by:
incoming: includes
outgoing: included by

mitigates:
incoming: mitigated by
outgoing: mitigates

verifies:
incoming: verified by
outgoing: verifies
##############################################################
# Graph Checks
# The graph checks focus on the relation of the needs and their attributes.
Expand All @@ -594,36 +679,33 @@ needs_extra_links:
##############################################################
# req- Id: gd_req__req__linkage_architecture
# req- Id: gd_req__req__linkage_safety

# 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.
# 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
# it is possible in an decomposition case.
# If need-req is `QM`, parent must be `QM`.
graph_checks:
# req- Id: gd_req__req__linkage_safety
req_safety_linkage:
req_safety_linkage_qm:
needs:
include: comp_req, feat_req
condition:
and:
- safety != QM
- status == valid
condition: safety == QM
check:
satisfies:
and:
- safety != QM
- status == valid
req_linkage:
satisfies: safety == QM
# If need-req is `ASIL_B`, parent must be `QM` or `ASIL_B`.
req_safety_linkage_asil_b:
needs:
include: comp_req, feat_req
condition: status == valid
condition: safety == ASIL_B
check:
# req- Id: gd_req__req__linkage_architecture
satisfies: status == valid
arch_safety_linkage:
satisfies: safety != ASIL_D
# saf - ID gd_req__saf_linkage_safety
# It shall be checked that Safety Analysis (DFA and FMEA) can only be linked via mitigate against
# - <Feature | Component | AoU> Requirements with the same ASIL or
# - <Feature | Component | AoU> Requirements with a higher ASIL
# as the corresponding ASIL of the Feature or Component that is analyzed.
saf_linkage_safety:
needs:
include: comp_req, feat_req
condition:
and:
- safety != QM
- status == valid
include: feat_saf_fmea, comp_saf_fmea, feat_plat_saf_dfa, feat_saf_dfa, comp_saf_dfa
condition: safety == ASIL_B
check:
fulfils:
and:
- safety != QM
- status == valid
mitigates: safety != QM
Loading