<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
  <bpmn:collaboration id="Collaboration_1d0w8lf">
    <bpmn:participant id="Participant_1egg397" name="SO&#10;Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" />
    <bpmn:participant id="Participant_0atuyq0" name="AAI" />
    <bpmn:participant id="Participant_19w87ws" name="Workflow Message Service&#10;(communication with DMAAP)&#10;" />
    <bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0atuyq0" />
    <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" />
    <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" />
    <bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" />
    <bpmn:messageFlow id="MessageFlow_0tg4hw9" sourceRef="InformDmaapClient" targetRef="Participant_19w87ws" />
    <bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="CancelDmaapClientSubscription" targetRef="Participant_19w87ws" />
  </bpmn:collaboration>
  <bpmn:process id="CreateAndActivatePnfResource" name="CreateAndActivatePnfResource" isExecutable="true">
    <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="CancelDmaapClientSubscription" />
    <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="InformDmaapClient" targetRef="WaitForDmaapPnfReadyNotification" />
    <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreatePnfEntryInAai">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
    <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
    <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
    <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
    <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" />
    <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" />
    <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" />
    <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}">
      <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${CancelDmaapSubscription}">
      <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="InformDmaapClient" name="Register in Dmaap" camunda:delegateExpression="${InformDmaapClient}">
      <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:delegateExpression="${CreatePnfEntryInAaiDelegate}">
      <bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?">
      <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
      <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}">
      <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:startEvent id="CreateAndActivatePnf_StartEvent">
      <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception">
      <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
      <bpmn:errorEventDefinition errorRef="Error_1" />
    </bpmn:endEvent>
    <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
      <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
      <bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
    </bpmn:receiveTask>
    <bpmn:boundaryEvent id="WaitForDmaapTimeout" name="Timeout" attachedToRef="WaitForDmaapPnfReadyNotification">
      <bpmn:outgoing>SequenceFlow_1kc34bc</bpmn:outgoing>
      <bpmn:timerEventDefinition>
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:boundaryEvent>
    <bpmn:exclusiveGateway id="AaiEntryExists" name="AAI entry exists">
      <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming>
      <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
    <bpmn:textAnnotation id="TextAnnotation_1eyzes8">
      <bpmn:text>Inputs:
 - timeoutForPnfEntryNotification - String
 - correlationId - String
 - uuid - String
</bpmn:text>
    </bpmn:textAnnotation>
  </bpmn:process>
  <bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
  <bpmn:message id="Message_13h1tlo" name="WorkflowMessage" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1d0w8lf">
      <bpmndi:BPMNShape id="Participant_1egg397_di" bpmnElement="Participant_1egg397">
        <dc:Bounds x="-113" y="0" width="1601" height="438" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true">
        <dc:Bounds x="390" y="182" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="372" y="283" width="85" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
        <dc:Bounds x="1312" y="189" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1287" y="230" width="88" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent">
        <dc:Bounds x="-54" y="189" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="-80" y="228" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId">
        <dc:Bounds x="219" y="167" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreatePnfEntryInAai">
        <dc:Bounds x="511" y="167" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
        <di:waypoint x="319" y="207" />
        <di:waypoint x="390" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="309.5" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
        <di:waypoint x="415" y="182" />
        <di:waypoint x="415" y="66" />
        <di:waypoint x="711" y="66" />
        <di:waypoint x="711" y="182" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="430" y="159" width="19" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
        <di:waypoint x="440" y="207" />
        <di:waypoint x="511" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="448" y="210" width="14" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
        <di:waypoint x="611" y="207" />
        <di:waypoint x="686" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="605" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
        <di:waypoint x="-18" y="207" />
        <di:waypoint x="48" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="-30" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Participant_0i9ban2_di" bpmnElement="Participant_0atuyq0">
        <dc:Bounds x="123" y="523" width="502" height="60" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
        <di:waypoint x="561" y="247" />
        <di:waypoint x="561" y="523" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="531" y="380" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
        <di:waypoint x="250" y="247" />
        <di:waypoint x="250" y="523" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="220" y="380" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
        <di:waypoint x="289" y="523" />
        <di:waypoint x="289" y="247" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="259" y="380" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="Participant_19w87ws">
        <dc:Bounds x="804" y="523" width="463" height="60" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException">
        <dc:Bounds x="1312" y="345" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1305" y="382" width="70" height="27" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8">
        <dc:Bounds x="-37" y="70" width="243" height="82" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz">
        <di:waypoint x="-36" y="189" />
        <di:waypoint x="-36" y="152" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
        <di:waypoint x="1060" y="523" />
        <di:waypoint x="1060" y="247" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="996" y="380" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
        <di:waypoint x="736" y="207" />
        <di:waypoint x="803" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="719" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout">
        <dc:Bounds x="1074" y="229" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1117" y="240" width="40" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
        <di:waypoint x="1092" y="265" />
        <di:waypoint x="1092" y="363" />
        <di:waypoint x="1145" y="363" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1028" y="309" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification">
        <dc:Bounds x="1008" y="167" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
        <di:waypoint x="1108" y="207" />
        <di:waypoint x="1312" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1148" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e">
        <di:waypoint x="903" y="207" />
        <di:waypoint x="1008" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="893.5" y="187" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9">
        <di:waypoint x="853" y="247" />
        <di:waypoint x="853" y="523" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="823" y="380" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ServiceTask_1iax11n_di" bpmnElement="InformDmaapClient">
        <dc:Bounds x="803" y="167" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe">
        <di:waypoint x="1245" y="363" />
        <di:waypoint x="1312" y="363" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1233.5" y="343" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr">
        <di:waypoint x="1195" y="403" />
        <di:waypoint x="1195" y="523" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1165" y="458" width="90" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ServiceTask_12j7hox_di" bpmnElement="CancelDmaapClientSubscription">
        <dc:Bounds x="1145" y="323" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p">
        <di:waypoint x="148" y="207" />
        <di:waypoint x="219" y="207" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="183.5" y="187" width="0" height="10" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ServiceTask_0lx02qn_di" bpmnElement="CheckInputs">
        <dc:Bounds x="48" y="167" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ExclusiveGateway_0qwrtuy_di" bpmnElement="AaiEntryExists" isMarkerVisible="true">
        <dc:Bounds x="686" y="182" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="672" y="242" width="77" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>