Model synchronization

To control the migration of model elements, the following YAML file serves as a configuration for the capella2polarion service. In this file, you can specify the layer, class types and attributes for matching Capella model elements. Additionally you have the control of adding relationships with the links key. Underneath the links key use attributes on the matched capellambse model object. Make sure that the attribute name is correct, you can use capellambse’s documentation for that.

Generic

"*": # All layers
  "*": # All class types
    links: # Specify workitem links
      - parent
      - description_reference
  Class:
    serializer:
      add_tree_diagram:
        render_params:
          depth: 1
    links:
      - state_machines
  Diagram:
    links:
      - diagram_elements
  Constraint:
    serializer: linked_text_as_description
  Scenario:
    serializer: include_pre_and_post_condition
  CapabilityRealization:
    serializer: include_pre_and_post_condition
  Entity:
  StateMachine:

The “star” section is a general configuration where you can set links to be migrated for all class types. For example, parent and description_reference are links that will be applied to all specified class types. Since Class is a common class type that exists in all layers, links specific to Class can be specified here to avoid duplication. This will be merged into layer specific configuration for Class if there is any.

Serializers

  OperationalCapability:
    serializer: include_pre_and_post_condition

With serializer you can control which function is called to render the capella2polarion.data_models.CapellaWorkItem. There is a generic serializer including title (name), description and requirement types, taken per default. You may also define multiple serializers by providing a list of serializers in the configs. These will be called in the order provided in the list. Some serializers also support additional configuration. This can be done by providing a dictionary of serializers with the serializer as key and the configuration of the serializer as value. For example Class using the add_tree_diagram serializer:

  Class:
    serializer:
      add_tree_diagram:
        render_params:
          depth: 1

or SystemFunction with the add_context_diagram serializer using filters:

    serializer:
      add_context_diagram:
        filters:
          - EX_ITEMS_OR_EXCH # functional exchange or exchange item name

If a serializer supports additional parameters this will be documented in the supported capella serializers table in Model synchronization.

Different capella type and polarion type ID

  FunctionalExchange:
    polarion_type: operationalInteraction

Sometimes capellambse class types are not the same in Polarion. In order to handle this case you can use the polarion_type key to map capellambse types to the desired Polarion type.

pa:
  PhysicalComponent:
    - links:
        - allocated_functions
    - is_actor: false
      nature: UNSET
      polarion_type: physicalComponent
    - is_actor: false
      nature: NODE
      polarion_type: physicalComponentNode
    - is_actor: false
      nature: BEHAVIOR
      polarion_type: physicalComponentBehavior
    - is_actor: true
      nature: NODE
      polarion_type: physicalActorNode
    - is_actor: true
      nature: BEHAVIOR
      polarion_type: physicalActorBehavior

For the PhysicalComponent you can see this in extreme action, where based on the different permutation of the attributes actor and nature different Polarion types are used. In capellambse however this is just a PhysicalComponent. Combining this with links is possible too. You can configure a generic config and for each specific config you can also add a links section. Both will be merged.