diff --git a/.github/workflows/push-checks.yml b/.github/workflows/push-checks.yml index cf03f73..4180691 100644 --- a/.github/workflows/push-checks.yml +++ b/.github/workflows/push-checks.yml @@ -24,3 +24,9 @@ jobs: run: python -m pip install pre-commit - name: Run Pre-Commit run: pre-commit run --all-files + + complexity-badge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DSD-DBS/py-capellambse/ci-templates/github/model-complexity-badge@master diff --git a/README.md b/README.md index 50f68f8..2ad0247 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ This repo contains the "In-Flight Entertainment System" sample model, originally maintained by the Capella developers at . +Model complexity +---------------- +![model complexity](./model-complexity-badge.svg) + This repo also contains some adjustments to the model as well as additional configuration to showcase some features of [py-capellambse](https://github.com/DSD-DBS/py-capellambse). diff --git a/capella2polarion_config.yaml b/capella2polarion_config.yaml index 9523246..8d55422 100644 --- a/capella2polarion_config.yaml +++ b/capella2polarion_config.yaml @@ -73,7 +73,13 @@ sa: ComponentExchange: links: - allocated_functional_exchanges - serializer: add_context_diagram + serializer: + jinja_as_description: + template_folder: jinja/element_templates + template_path: component_exchange.html.j2 + add_context_diagram: + filters: + - SHOW_EX_ITEMS FunctionalExchange: links: - exchange_items @@ -99,7 +105,13 @@ la: LogicalComponent: - links: - allocated_functions - serializer: add_context_diagram + serializer: + jinja_as_description: + template_folder: jinja/element_templates + template_path: logical_component.html.j2 + add_context_diagram: + filters: + - SHOW_EX_ITEMS - is_actor: true polarion_type: logicalActor - is_actor: false @@ -125,7 +137,13 @@ la: Exchange Items: exchange_items - realized_functions ComponentExchange: - serializer: add_context_diagram + serializer: + jinja_as_description: + template_folder: jinja/element_templates + template_path: component_exchange.html.j2 + add_context_diagram: + filters: + - SHOW_EX_ITEMS links: - allocated_functional_exchanges FunctionalExchange: @@ -146,7 +164,13 @@ pa: - exchange_items - polarion_role: physical_links capella_attr: allocating_physical_link - serializer: add_context_diagram + serializer: + jinja_as_description: + template_folder: jinja/element_templates + template_path: component_exchange.html.j2 + add_context_diagram: + filters: + - SHOW_EX_ITEMS FunctionalExchange: links: - exchange_items diff --git a/capella2polarion_document_config.yaml.j2 b/capella2polarion_document_config.yaml.j2 index 55fc586..bd89e4c 100644 --- a/capella2polarion_document_config.yaml.j2 +++ b/capella2polarion_document_config.yaml.j2 @@ -5,9 +5,9 @@ full_authority: - template_directory: jinja/document_templates template: icd-interfaces-full_authority.html.j2 project_id: null # None -> Defaults to Sync Project - status_allow_list: + {# status_allow_list: # Only overwrite content when document has this status - draft - - open + - open #} heading_numbering: True work_item_layouts: componentExchange: @@ -57,18 +57,16 @@ full_authority: - id fields_at_end: - context_diagram - - allocated_functions - componentExchange: + logicalActor: fields_at_start: - id fields_at_end: - context_diagram - - allocated_functional_exchanges - - exchange_items - class: - show_title: False + componentExchange: + fields_at_start: + - id fields_at_end: - - tree_view + - context_diagram exchangeItem: show_title: False instances: @@ -79,39 +77,40 @@ full_authority: params: uuid: {{ cmp.uuid }} {% endfor %} -{# mixed_authority: - - template_directory: jinja/document_templates + +mixed_authority: + - template_directory: jinja/document_templates/logical-architecture heading_numbering: True - project_id: PROJECT_ID + project_id: null work_item_layouts: text: show_title: False - physicalLink: - fields_at_start: - - id - physicalActor: - fields_at_start: - - id - physicalComponentActor: + logicalComponent: fields_at_start: - id - physicalComponentNode: + fields_at_end: + - context_diagram + logicalActor: fields_at_start: - id - physicalComponentBehavior: + fields_at_end: + - context_diagram + componentExchange: fields_at_start: - id - class: - show_title: False fields_at_end: - - tree_view + - context_diagram exchangeItem: show_title: False sections: - IcdContent: icd-interfaces-mixed_authority.html.j2 + IcdContent: logical-component-mixed-authority.html.j2 instances: - polarion_space: _default - polarion_name: NAME - polarion_title: TITLE + polarion_name: Mixed authority showcase + polarion_title: Mixed authority showcase params: - physical_link: UUID #} + uuids: + - c8b78c78-5b11-4fc0-87b7-3ca84622efea # Aircraft + - d475ed7d-4644-4461-97d4-b52772c9b425 # Ground Operator + - 4890eae8-7a62-4d7b-bf8a-1590a199eebf # Cabin Crew + - 181a678c-dca9-46c1-9d18-b5a0c457c0de # Passenger diff --git a/jinja/document_templates/icd-interfaces-full_authority.html.j2 b/jinja/document_templates/icd-interfaces-full_authority.html.j2 index 6c05b24..623f029 100644 --- a/jinja/document_templates/icd-interfaces-full_authority.html.j2 +++ b/jinja/document_templates/icd-interfaces-full_authority.html.j2 @@ -12,7 +12,7 @@
{{ heading(2, "Introduction", session)}}

-This Interface Control Document only covers software message based communication (application layer) between ETCS compatible components. +This Interface Control Document only covers software message based communication (application layer) between compatible components. At the moment physical interface definition is not in scope for this document. The scope of the document covers Interface Requirements and Definition

diff --git a/jinja/document_templates/icd-interfaces-mixed_authority.html.j2 b/jinja/document_templates/icd-interfaces-mixed_authority.html.j2 index 05316b8..63c4ee3 100644 --- a/jinja/document_templates/icd-interfaces-mixed_authority.html.j2 +++ b/jinja/document_templates/icd-interfaces-mixed_authority.html.j2 @@ -6,4 +6,4 @@ {% from 'icd-interfaces-common.html.j2' import render_content %} {% set physical_link = model.by_uuid(physical_link) %} -{{ render_content(physical_link, model, session) }} \ No newline at end of file +{{ render_content(physical_link, model, session) }} diff --git a/jinja/document_templates/logical-architecture/logical-common.html.j2 b/jinja/document_templates/logical-architecture/logical-common.html.j2 index 1fe4b8e..ec64b48 100644 --- a/jinja/document_templates/logical-architecture/logical-common.html.j2 +++ b/jinja/document_templates/logical-architecture/logical-common.html.j2 @@ -10,7 +10,7 @@ {% macro render_content(component, model, session) %} {{ heading(2, component.name, session)}} {{ heading(3, "Logical Component Context", session)}} - The figure below provides an overview of the logical subsystem and external entities that either require the functionality of {{ component.name }} (expect outputs) or enable it (provide inputs). The figure also identifies the interfaces between the subsystem and its environment. + The figure below provides an overview of the logical subsystem and external entities that either require the functionality of {{ component.name }} (expect outputs) or enable it (provide inputs). The figure also identifies the interfaces between the subsystem and its environment. {{ insert_work_item(component, session) }} {{ heading(3, "Logical interface partners of " + component.name, session) }} diff --git a/jinja/document_templates/logical-architecture/logical-component-mixed-authority.html.j2 b/jinja/document_templates/logical-architecture/logical-component-mixed-authority.html.j2 index 415a827..57e38e7 100644 --- a/jinja/document_templates/logical-architecture/logical-component-mixed-authority.html.j2 +++ b/jinja/document_templates/logical-architecture/logical-component-mixed-authority.html.j2 @@ -4,5 +4,7 @@ #} {% from 'logical-common.html.j2' import render_content %} +{% for uuid in uuids %} {% set component = model.by_uuid(uuid) %} {{ render_content(component, model, session) }} +{% endfor %} diff --git a/jinja/element_templates/common_macros.html.j2 b/jinja/element_templates/common_macros.html.j2 index 5f3522c..5bfdcf7 100644 --- a/jinja/element_templates/common_macros.html.j2 +++ b/jinja/element_templates/common_macros.html.j2 @@ -126,8 +126,6 @@ {% macro description(obj) %} {% if obj.description %}

{{ obj.description | safe }}

- {% else %} -

No description available.

{% endif %} {% endmacro %} diff --git a/jinja/element_templates/component_exchange.html.j2 b/jinja/element_templates/component_exchange.html.j2 new file mode 100644 index 0000000..ae24752 --- /dev/null +++ b/jinja/element_templates/component_exchange.html.j2 @@ -0,0 +1,50 @@ +{# + Copyright DB InfraGO AG and contributors + SPDX-License-Identifier: Apache-2.0 +#} + +{% from 'common_macros.html.j2' import linked_name_with_icon %} +{% from 'polarion_props.j2' import table_attributes, th_attributes, td_attributes %} + +{% macro describe_exchange(object) %} +{%- set source_function = object.source.owner -%} +{%- set target_function = object.target.owner -%} +{%- set source = source_function.owner -%} +{%- set target = target_function.owner -%} +The {{ linked_name_with_icon(source) | safe }} shall provide {{ linked_name_with_icon(object) | safe }} to {{ linked_name_with_icon(target) | safe }} so that the {{ linked_name_with_icon(target) | safe }} could {{ linked_name_with_icon(target_function) | safe }}. +{% endmacro %} + +Interface Partners +

This logical interface connects between {{ linked_name_with_icon(object.source.owner) | safe}} and {{ linked_name_with_icon(object.target.owner) | safe}}.

+

The need for the interface is explained and requirements are provided so that the interface partners could find an appropriate interface definition (solution).

+Enabled interactions +

This interface enables the following interactions:

+ + + + + + + + + {% for exchange in object.allocated_functional_exchanges %} + + + + + {% endfor %} + +
IDInteraction description
{{ linked_name_with_icon(exchange) | safe }} + {{ describe_exchange(exchange) | safe }} + {% if exchange.exchange_items |Ā length > 1 %} +

{{ exchange.name }} is further specified via the following Exchange Items:

+
    + {% for item in exchange.exchange_items %} +
  • {{ linked_name_with_icon(item) | safe }}
  • + {% endfor %} +
+ {% elif exchange.exchange_items %} +

This interaction is further specified via {{ linked_name_with_icon(exchange.exchange_items[0]) | safe}}.

+ {% endif %} +
+ diff --git a/jinja/element_templates/logical_component.html.j2 b/jinja/element_templates/logical_component.html.j2 new file mode 100644 index 0000000..56db3f5 --- /dev/null +++ b/jinja/element_templates/logical_component.html.j2 @@ -0,0 +1,21 @@ +{# + Copyright DB InfraGO AG and contributors + SPDX-License-Identifier: Apache-2.0 +#} + +{% from 'common_macros.html.j2' import show_other_attributes, description %} + +{{ description(object) | safe }} + +{%- for fnc in object.allocated_functions -%} + {%- if loop.first -%} +

Allocated functions

+ {%- endif -%} + +

{{ fnc.name }}

+ {{ description(fnc) | safe }} +{%- endfor -%} + +

+The figure below provides an overview of the logical subsystem and external entities that either require the functionality of {{ object.name }} (expect outputs) or enable it (provide inputs). The figure also identifies the interfaces between the subsystem and its environment. +

diff --git a/model-complexity-badge.svg b/model-complexity-badge.svg new file mode 100644 index 0000000..cdd6a48 --- /dev/null +++ b/model-complexity-badge.svg @@ -0,0 +1,38 @@ + + + +710 +objects + + + +14% + +29% + +48% + +77 +diagrams + + +14% + +26% + +23% + +36% + + + +Operational Analysis + +System Analysis + +Logical Architecture + +Physical Architecture + + +