diff --git a/docs/internals/requirements/requirements.rst b/docs/internals/requirements/requirements.rst index a49df7bf4..30098606d 100644 --- a/docs/internals/requirements/requirements.rst +++ b/docs/internals/requirements/requirements.rst @@ -546,11 +546,11 @@ Architecture Attributes 🔗 Linkage ------------------------ -.. tool_req:: Mandatory Architecture Attribute: fulfils +.. tool_req:: Architecture fulfils linkage rules :id: tool_req__docs_arch_link_fulfils :tags: Architecture :implemented: YES - :version: 2 + :version: 3 :satisfies: gd_req__arch_linkage_requirement_type[version==1], gd_req__arch_attr_fulfils[version==1], @@ -558,33 +558,35 @@ Architecture Attributes gd_req__req_linkage_fulfill[version==1], :parent_covered: YES - Docs-as-Code shall enforce that linking via the ``fulfils`` attribute follows defined rules. + Docs-as-Code shall allow or enforce where necessary that linking via the ``fulfils`` + attribute follows the defined rules. Allowed source and target combinations are defined in the following table: .. table:: :widths: auto - ==================================== ========================================== - Link Source Allowed Link Target - ==================================== ========================================== - feat_arc_sta feat_req, aou_req - feat_arc_dyn feat_req - logic_arc_int feat_req - comp_arc_sta comp_req, aou_req - comp_arc_dyn comp_req - real_arc_int comp_req - ==================================== ========================================== + ==================================== ========================================== ============== + Link Source Allowed Link Target Optional/Mandatory + ==================================== ========================================== ============== + feat_arc_sta feat_req Optional + feat_arc_dyn feat_req Optional + logic_arc_int feat_req Optional + comp_arc_sta comp_req Optional + comp_arc_dyn comp_req Optional + real_arc_int comp_req Optional + ==================================== ========================================== ============== .. tool_req:: Architecture fulfils linkage to AoU :id: tool_req__docs_arch_link_fulfils_aou :implemented: YES - :version: 1 + :version: 3 :satisfies: gd_req__arch_attr_fulfils_aou[version==1] :parent_covered: YES - Architectural static views (feat_arc_sta, comp_arc_sta) - link to Assumptions of Use (aou_req) via the ``fulfils`` attribute. + Architectural static views (feat_arc_sta) and the component itself (comp) + may link to Assumptions of Use (aou_req) via the ``fulfils`` attribute. + When such a link is present, Docs-as-Code shall restrict its target to aou_req. .. tool_req:: Check Architecture linkage to AoU :id: tool_req__docs_arch_link_aou_check diff --git a/src/extensions/score_metamodel/metamodel.yaml b/src/extensions/score_metamodel/metamodel.yaml index 9a6deb4ad..25257106d 100644 --- a/src/extensions/score_metamodel/metamodel.yaml +++ b/src/extensions/score_metamodel/metamodel.yaml @@ -430,10 +430,11 @@ needs_types: mandatory_links: # req-Id: tool_req__docs_arch_links includes: logic_arc_int, logic_arc_int_op - # req-Id: tool_req__docs_arch_link_fulfils, tool_req__docs_arch_link_fulfils_aou - fulfils: feat_req, aou_req # req-Id: tool_req__docs_arch_links belongs_to: feat # make it mandatory for evaluation + optional_links: + # req-Id: tool_req__docs_arch_link_fulfils, tool_req__docs_arch_link_fulfils_aou + fulfils: feat_req, aou_req tags: - architecture_element - architecture_view @@ -453,9 +454,11 @@ needs_types: # req-Id: tool_req__docs_common_attr_status status: ^(valid|invalid)$ mandatory_links: - fulfils: feat_req # req-Id: tool_req__docs_arch_links belongs_to: feat + optional_links: + # req-Id: tool_req__docs_arch_link_fulfils + fulfils: feat_req tags: - architecture_view - architecture_element @@ -561,7 +564,6 @@ needs_types: safety: ^(QM|ASIL_B)$ # req-Id: tool_req__docs_common_attr_status status: ^(valid|invalid)$ - mandatory_links: belongs_to: feat # preparation for linking change according to DR-005 optional_links: @@ -569,6 +571,8 @@ needs_types: implements: logic_arc_int, real_arc_int_op uses: logic_arc_int, real_arc_int_op consists_of: comp + # tool_req__docs_arch_link_fulfils_aou + fulfils: aou_req tags: - architecture_element parts: 2 @@ -589,10 +593,10 @@ needs_types: mandatory_links: # req-Id: tool_req__docs_arch_links belongs_to: comp - # req-Id: tool_req__docs_arch_link_fulfils, tool_req__docs_arch_link_fulfils_aou - fulfils: comp_req, aou_req optional_links: uses: logic_arc_int, real_arc_int_op + # req-Id: tool_req__docs_arch_link_fulfils, tool_req__docs_arch_link_fulfils_aou + fulfils: comp_req tags: - architecture_view parts: 3 @@ -613,6 +617,7 @@ needs_types: mandatory_links: # req-Id: tool_req__docs_arch_links belongs_to: comp + optional_links: fulfils: comp_req tags: - architecture_view diff --git a/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst b/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst index 576c6e19c..d2b345203 100644 --- a/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst +++ b/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst @@ -223,6 +223,31 @@ --- feat_saf_fmea violates end --- +--- arch fulfils optional begin --- + +.. Positive Test: fulfils is optional for static views, an unlinked feat_arc_sta is accepted. + +.. feat_arc_sta:: Static view without fulfils + :id: feat_arc_sta__fulfils__optional + :status: valid + :safety: ASIL_B + :security: YES + :expect_not: is missing required link: `fulfils` + + +.. Negative Test: when fulfils is present, its target type is still restricted. + +.. feat_arc_sta:: Static view with invalid fulfils target + :id: feat_arc_sta__fulfils__bad_target + :status: valid + :safety: ASIL_B + :security: YES + :fulfils: comp_req__child__ASIL_B + :expect: feat_arc_sta__fulfils__bad_target: references 'comp_req__child__ASIL_B' as 'fulfils', but it must reference Feature Requirement (feat_req) or Assumption of Use Requirement (aou_req). + +--- arch fulfils optional end --- + + .. Tests if the attribute `safety` follows the pattern `^(QM|ASIL_B)$` .. document:: This is a test document