summaryrefslogtreecommitdiffstats
path: root/docs/BPMN_Subprocess_Process_Flows.rst
blob: cf2da40e87a2489b8df801d980ed33af9e353ef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2017 Huawei Technologies Co., Ltd.

BPMN Subprocess Process Flows
==============================

Characteristics
----------------

**Invoked by other flows**

    A BPMN Call_Activity_ provides the mechanism to invoke subprocess flows.  The Called Element attribute of the Call Activity specifies the name of the subprocess to execute.

.. _Call_Activity: https://docs.camunda.org/manual/7.7/reference/bpmn20/subprocesses/call-activity/

**Input and Output variable mapping**

    In the modeler, you can specify a list of "In Mappings".  With this, you can map execution variables from the calling flow to the subprocess.  The subprocess always has its own copy of each variable.  To transfer values back to the calling flow, you specify "Out Mappings".

**May throw MSOWorkflowException**

    The current best practice for reporting errors from subprocess is described here:
	
	* The subprocess should create a WorkflowException object and store it in an execution called WorkflowException.
    * The WorkflowException object contains an error code and an error message.
    * The subprocess should then throw an MSOWorkflowException BPMN event which may be handled by the calling flow.
	
Example: VnfAdapterRestV1.bpmn
-------------------------------

.. image:: images/BPMN_Subprocess_process_flows_1.png
hlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
<service-logic
    xmlns='http://www.onap.org/sdnc/svclogic'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='GENERIC-RESOURCE-API' version='${project.version}'>
    <method rpc='self-serve-pnf-unassign' mode='sync'>
        <block atomic='true'>
            <set>
                <parameter name='ss.capability.execution-order[0]' value='mS-mac-address-assign' />
                <parameter name='ss.capability.execution-order[1]' value='mac-address-assign' />
                <parameter name='ss.capability.execution-order[2]' value='netbox-ip-assign' />
                <parameter name='ss.capability.execution-order[3]' value='eipam-ip-assignment' />
                <parameter name='ss.capability.execution-order[4]' value='mS-vlan-tag-assign' />
                <parameter name='ss.capability.execution-order[5]' value='vlan-tag-assign' />
                <parameter name='ss.capability.execution-order[6]' value='alts-license-assign' />
                <parameter name='ss.capability.execution-order[7]' value='alts-entitlement-assign' />
                <parameter name='ss.capability.execution-order[8]' value='generate-name' />
                <parameter name='ss.capability.execution-order_length' value='9' />
            </set>
            <set>
                <parameter name='ss.capability-type' value='pnf' />
            </set>
            <switch test='`$prop.controller.user`'>
                <outcome value=''>
                    <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
                        <parameter name='fileName' value='%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties' />
                        <parameter name='contextPrefix' value='prop' />
                    </execute>
                </outcome>
            </switch>
            <for index='cidx' start='0' end='`$ss.capability.execution-order_length`' >
                <set>
                    <parameter name='ss.capability-name' value='`$ss.capability.execution-order[$cidx]`' />
                    <!--
ss.capability.execution-order[]
-->
                </set>
                <set>
                    <parameter name='ss.capability-action' value='unassign' />
                </set>
                <set>
                    <parameter name='ss.capability-dg' value="`'self-serve-' + $ss.capability.execution-order[$cidx]`" />
                </set>
                <for index='pidx' start='0' end='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param_length`' >
                    <set>
                        <parameter name='tmp.param.capability-name' value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.capability-name`' />
                    </set>
                    <switch test='`$ss.capability-name == $tmp.param.capability-name`'>
                        <outcome value='true'>
                            <block atomic='true'>
                                <switch test='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.status`'>
                                    <outcome value='SUCCESS'>
                                        <call module='GENERIC-RESOURCE-API' rpc='`$ss.capability-dg`' mode='sync' >
                                            <outcome value='failure'>
                                                <block atomic='true'>
                                                    <set>
                                                        <parameter name='vf.pnf-id'
    value='`$service-data.pnfs.pnf[$pnf-index].pnf-id`' />
                                                        <parameter name='vf.pnf-data.sdnc-request-header.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.sdnc-request-header.`' />
                                                        <parameter name='vf.pnf-data.request-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.request-information.`' />
                                                        <parameter name='vf.pnf-data.service-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.service-information.`' />
                                                        <parameter name='vf.pnf-data.pnf-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-details.`' />
                                                        <parameter name='vf.pnf-data.pnf-request-input.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-request-input.`' />
                                                        <parameter name='vf.pnf-data.pnf-request-input.pnf-input-parameters.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-request-input.pnf-input-parameters.`' />
                                                        <parameter name='vf.pnf-data.pnf-topology.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.`' />
                                                        <parameter name='vf.pnf-data.pnf-level-oper-status.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-level-oper-status.`' />
                                                    </set>
                                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                        <parameter name="source" value="`$prop.restapi.ss-pnf-assignments`"/>
                                                        <parameter name="outputPath" value="tmp.ss-pnf-url"/>
                                                        <parameter name="target" value="{service-instance-id}"/>
                                                        <parameter name="replacement" value="`$service-data.pnfs.pnf[$pnf-index].pnf-data.service-information.service-instance-id`"/>
                                                    </execute>
                                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                        <parameter name="source" value="`$tmp.ss-pnf-url`"/>
                                                        <parameter name="outputPath" value="tmp.ss-pnf-url"/>
                                                        <parameter name="target" value="{pnf-id}"/>
                                                        <parameter name="replacement" value="`$service-data.pnfs.pnf[$pnf-index].pnf-id`"/>
                                                    </execute>
                                                    <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                                        <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.ss.pnf.templatefile`" />
                                                        <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ss-pnf-url`' />
                                                        <parameter name='restapiUser' value='`$prop.controller.user`' />
                                                        <parameter name='restapiPassword' value='`$prop.controller.pwd`' />
                                                        <parameter name='format' value='json' />
                                                        <parameter name='httpMethod' value='PUT' />
                                                        <parameter name="responsePrefix" value="mdsal-ss-pnf" />
                                                        <outcome value='failure'>
                                                            <block atomic="true">
                                                                <set>
                                                                    <parameter name="error-message" value="Error persisting self-serve pnf assignments in MD-SAL during unassign" />
                                                                </set>
                                                            </block>
                                                        </outcome>
                                                        <outcome value='not-found'>
                                                            <block atomic="true">
                                                                <set>
                                                                    <parameter name="error-message" value="Error persisting self-serve pnf assignments in MD-SAL during unassign" />
                                                                </set>
                                                            </block>
                                                        </outcome>
                                                    </execute>
                                                    <return status='failure'>
                                                        <parameter name='error-code' value='500' />
                                                        <parameter name='error-message' value="`'Failed to unassign self-serve pnf assignments for ' + $ss.capability-dg + ' with error: ' + $error-message`" />
                                                    </return>
                                                </block>
                                            </outcome>
                                            <outcome value='success'>
                                                <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                    <parameter name="logger" value="message-log"/>
                                                    <parameter name="field1" value="`'DONE: ' + $ss.capability-dg`"/>
                                                </record>
                                            </outcome>
                                        </call>
                                    </outcome>
                                    <outcome value='Other'>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="`'SS: resource-resolution-data.status: ' + $service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.status`"/>
                                            <parameter name="field2" value="`'SS: ss.capability-name: ' + $ss.capability-name`"/>
                                            <parameter name="field3" value="`'SS: tmp.param.capability-name: ' + $tmp.param.capability-name`"/>
                                        </record>
                                    </outcome>
                                </switch>
                                <break/>
                            </block>
                        </outcome>
                    </switch>
                </for>
            </for>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
                <parameter name='filename' value='/var/tmp/ss-pnf-unassign.log' />
            </execute>
        </block>
    </method>
</service-logic>