blob: c55ce547c272dbfc8022e003f16762d1a1fdd8de (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*-
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.openecomp.mso.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.client.orchestration.AAIOrchestrator
import org.openecomp.mso.client.orchestration.SDNCOrchestrator
import groovy.json.*
/**
* This groovy class supports the <class>DoCreateServiceInstanceV2.bpmn</class> process.
*
*/
public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor {
AAIOrchestrator aaiO = new AAIOrchestrator()
SDNCOrchestrator sdncO = new SDNCOrchestrator()
@Override
public void preProcessRequest(DelegateExecution execution) {
}
public void createServiceInstance(DelegateExecution execution) {
execution.setVariable("callSDNC",true)
if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){
if(execution.getVariable("sdncVersion").equals("1610")){
execution.setVariable("callSDNC",false);
}
}
ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
try{
aaiO.createServiceInstance(serviceDecomp)
} catch (BpmnError e) {
throw e
}
}
public void createProject(DelegateExecution execution) {
ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) {
try{
aaiO.createProjectandConnectServiceInstance(serviceDecomp)
} catch (BpmnError e) {
throw e
}
}
}
public void createOwningEntity(DelegateExecution execution) {
ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) {
try{
aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp)
} catch (BpmnError e) {
throw e
}
}
}
public void sdncAssignRequest(DelegateExecution execution) {
ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
if (serviceDecomp != null) {
try {
sdncO.sendSyncResponse(serviceDecomp)
} catch (BpmnError e) {
throw e
}
}
}
public void rollback(DelegateExecution execution) {
//TODO
}
}
|