aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy34
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java18
7 files changed, 81 insertions, 33 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
index 28789f2a98..84e1eb2acc 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
@@ -159,7 +159,7 @@ public class NssmfAdapterConsts {
new NssmfUrlInfo(EXTERNAL_QUERY_JOB_STATUS, HttpMethod.GET));
urlInfoMap.put(generateKey(ExecutorType.INTERNAL, null, ActionType.QUERY_SUB_NET_CAPABILITY),
- new NssmfUrlInfo(INTERNAL_QUERY_SUB_NET_CAPABILITY, HttpMethod.POST));
+ new NssmfUrlInfo(INTERNAL_QUERY_SUB_NET_CAPABILITY, HttpMethod.GET));
}
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
index a4a79bf2cd..432cfacb0b 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
@@ -219,7 +219,11 @@ public class RestUtil {
break;
case GET:
- base = new HttpGet(url);
+ HttpGetWithBody get = new HttpGetWithBody(url);
+ if (content != null) {
+ get.setEntity(new StringEntity(content, APPLICATION_JSON));
+ }
+ base = get;
break;
case PUT:
@@ -280,6 +284,29 @@ public class RestUtil {
}
}
+ class HttpGetWithBody extends HttpEntityEnclosingRequestBase {
+ public static final String METHOD_NAME = "GET";
+
+ public HttpGetWithBody() {
+ super();
+ }
+
+ public HttpGetWithBody(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ public HttpGetWithBody(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+ }
+
public HttpClient getHttpsClient() {
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
index 644cf5e387..1964a189f1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
@@ -95,7 +95,7 @@ class DoHandleOofRequest extends AbstractServiceTaskProcessor {
Response httpResponse = httpClient.post(oofRequest)
int responseCode = httpResponse.getStatus()
logger.debug("OOF sync response code is: " + responseCode)
- if(responseCode != 200){
+ if(responseCode < 200 || responseCode >= 300){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 72fd052f31..5f0d412de0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.so.serviceinstancebeans.Service
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -126,21 +127,22 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
logger.debug("modelInfo: " + serviceModelInfo)
- //requestParameters
- String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
- logger.debug("subscriptionServiceType: " + subscriptionServiceType)
+// //requestParameters
+// String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType")
+// if (isBlank(subscriptionServiceType)) {
+// msg = "Input subscriptionServiceType is null"
+// logger.debug(msg)
+// exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+// } else {
+// subscriptionServiceType = "5G"
+// execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+// }
+// logger.debug("subscriptionServiceType: " + subscriptionServiceType)
/*
* Extracting User Parameters from incoming Request and converting into a Map
*/
- Map reqMap = jsonSlurper.parseText(ssRequest)
+ Map reqMap = jsonSlurper.parseText(ssRequest) as Map
//InputParams
def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
@@ -168,6 +170,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInputParams", inputMap)
execution.setVariable("uuiRequest", uuiRequest)
execution.setVariable("serviceProfile", serviceProfile)
+ execution.setVariable("subscriptionServiceType", serviceObject.get("serviceType"))
//TODO
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
index 48e1acd523..fc80a9f658 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -101,6 +101,9 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
*/
String serviceRole = "service-profile"
String serviceType = execution.getVariable("serviceType")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
Map<String, Object> serviceProfile = sliceParams.getServiceProfile()
String ssInstanceId = execution.getVariable("serviceInstanceId")
try {
@@ -121,7 +124,10 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
ss.setEnvironmentContext(snssai)
ss.setServiceRole(serviceRole)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(ssInstanceId))
client.create(uri, ss)
} catch (BpmnError e) {
throw e
@@ -139,8 +145,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
//rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId)
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", subscriptionServiceType)
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", globalSubscriberId)
execution.setVariable("rollbackData", rollbackData)
execution.setVariable("RollbackData", rollbackData)
logger.debug("RollbackData:" + rollbackData)
@@ -156,6 +162,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
/**
* todo: ServiceProfile params changed
*/
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
Map<String, Object> serviceProfileMap = sliceParams.getServiceProfile()
@@ -181,11 +189,11 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
serviceProfile.setSurvivalTime("0")
serviceProfile.setReliability("")
try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId"))
- .serviceSubscription(execution.getVariable("subscriptionServiceType"))
- .serviceInstance(serviceProfileInstanceId)
- .serviceProfile(serviceProfileId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceProfileInstanceId)
+ .serviceProfile(serviceProfileId))
client.create(uri, serviceProfile)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -206,15 +214,21 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
public void createAllottedResource(DelegateExecution execution) {
try {
-
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
ServiceDecomposition serviceDecomposition =
execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources()
for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) {
String allottedResourceId = UUID.randomUUID().toString()
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceId")).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceInstanceId)
+ .allottedResource(allottedResourceId))
execution.setVariable("allottedResourceUri", allottedResourceUri)
String arType = allottedResource.getAllottedResourceType()
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
index 2aa7da2cd2..f2d4d7c701 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
@@ -44,7 +44,7 @@ dcsi.createAllottedResource(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1wafqwa</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi= new CreateSliceService()
+def dcsi = new DoCreateSliceServiceInstance()
dcsi.prepareDecomposeService(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:callActivity id="CallActivity_0svmkxh" name="Call Decompose Service" calledElement="DecomposeService">
@@ -135,4 +135,4 @@ dcsi.prepareDecomposeService(execution)</bpmn:script>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions> \ No newline at end of file
+</bpmn:definitions>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
index 8ea0eb6587..e97aa704eb 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
@@ -48,23 +48,23 @@ public class SliceTaskParamsAdapter implements Serializable {
private String nstName;
- private Map<String, Object> serviceProfile;
+ private Map<String, Object> serviceProfile = new HashMap<>();
private String suggestNsiId;
private String suggestNsiName;
- private TemplateInfo NSTInfo;
+ private TemplateInfo NSTInfo = new TemplateInfo();
- private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo;
+ private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo;
+ private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo = new SliceTaskInfo<>();
@SuppressWarnings("unchecked")
public void convertFromJson(String jsonString) throws IOException {
@@ -226,6 +226,10 @@ public class SliceTaskParamsAdapter implements Serializable {
*/
private <T> Map<String, Object> bean2Map(T t) {
Map<String, Object> resMap = new HashMap<>();
+ if (t == null) {
+ return resMap;
+ }
+
try {
Field[] fields = t.getClass().getDeclaredFields();
for (Field field : fields) {