summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java10
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java1
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java9
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application.yaml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy136
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy67
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java8
13 files changed, 148 insertions, 107 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index c4f269c3a0..789f4f239d 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -210,10 +210,12 @@ public abstract class BaseNssmfManager implements NssmfManager {
private void urlHandler() {
NssmfUrlInfo nssmfUrlInfo =
NssmfAdapterConsts.getNssmfUrlInfo(this.executorType, this.esrInfo.getNetworkType(), actionType);
- this.nssmfUrl = nssmfUrlInfo.getUrl();
- this.httpMethod = nssmfUrlInfo.getHttpMethod();
- this.nssmfUrl = nssmfUrl.replaceAll("\\{apiVersion}", getApiVersion());
- this.params.forEach((k, v) -> this.nssmfUrl = this.nssmfUrl.replaceAll("\\{" + k + "}", v));
+ if (nssmfUrlInfo != null) {
+ this.nssmfUrl = nssmfUrlInfo.getUrl();
+ this.httpMethod = nssmfUrlInfo.getHttpMethod();
+ this.nssmfUrl = nssmfUrl.replaceAll("\\{apiVersion}", getApiVersion());
+ this.params.forEach((k, v) -> this.nssmfUrl = this.nssmfUrl.replaceAll("\\{" + k + "}", v));
+ }
}
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index bb2b83fd59..72d1b53781 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -95,6 +95,7 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
return marshal(actDeActNssi);
}
+ @Override
protected RestResponse doQueryJobStatus(ResourceOperationStatus status) throws ApplicationException {
return doResponseStatus(status);
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
index 4705e871f3..88b5071371 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
@@ -98,7 +98,7 @@ public abstract class InternalNssmfManager extends BaseNssmfManager {
// internal
private RestResponse sendInternalRequest(String content) {
- Header header = new BasicHeader("X-Auth-Token", adapterConfig.getInfraAuth());
+ Header header = new BasicHeader("Authorization", adapterConfig.getInfraAuth());
this.nssmfUrl = adapterConfig.getInfraEndpoint() + this.nssmfUrl;
return restUtil.send(this.nssmfUrl, this.httpMethod, content, header);
}
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 a7adbe116a..7a86c5ba2b 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
@@ -270,6 +270,7 @@ public class RestUtil {
class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
public static final String METHOD_NAME = "DELETE";
+ @Override
public String getMethod() {
return METHOD_NAME;
}
@@ -316,12 +317,15 @@ public class RestUtil {
public HttpClient getHttpsClient() {
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
+ @Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
+ @Override
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
+ @Override
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
}};
@@ -329,10 +333,9 @@ public class RestUtil {
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
- // HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- SSLConnectionSocketFactory sslsf =
- new SSLConnectionSocketFactory(sc, new String[] {"TLSv1"}, null, (s, sslSession) -> true);
+ SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sc,
+ new String[] {"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"}, null, (s, sslSession) -> true);
return HttpClients.custom().setSSLSocketFactory(sslsf).build();
} catch (Exception e) {
throw new IllegalArgumentException(e);
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
index 8da911d4e0..5501fba88f 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
@@ -59,7 +59,7 @@ mso:
endpoint: https://so-request-db-adapter.{{ include "common.namespace" . }}:8083
auth: Basic YnBlbDpwYXNzd29yZDEk
infra:
- endpoint: https://so.{{ include "common.namespace" . }}:8080
+ endpoint: http://so.onap:8080
auth: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==
#Actuator
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
index 775f088136..bbe5f0d0a4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
@@ -22,22 +22,15 @@ package org.onap.so.bpmn.common.scripts
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray
-import org.json.JSONObject
-import org.onap.logging.filter.base.ErrorCode
import org.onap.logging.filter.base.ONAPComponents
-import org.onap.logging.ref.slf4j.ONAPLogConstants
+import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils
-import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
/***
@@ -94,56 +87,91 @@ class NssmfAdapterUtils {
}
- public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest) {
- try {
-
- String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
- String queryEndpoint = nssmfEndpoint + endPoint
- def responseData
- HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
- String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
- client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
-
- logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
- Response response = client.post(nssmfRequest)
-
- responseData = response.readEntity(String.class)
- if (responseData != null) {
- logger.debug("Received data from NSSMF: " + responseData)
- }
-
- logger.debug('Response code:' + response.getStatus())
- logger.debug('Response:' + System.lineSeparator() + responseData)
- if (response.getStatus() >= 200 && response.getStatus() < 300) {
- // parse response as needed
- return responseData
- }
- else {
- return null
- }
- }
- catch (Exception e) {
- logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
- throw e
- }
+ public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest) {
+ try {
- }
+ String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
+ String queryEndpoint = nssmfEndpoint + endPoint
+ def responseData
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
+ String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
+ client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
+ logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
+ Response response = client.post(nssmfRequest)
+
+ responseData = response.readEntity(String.class)
+ if (responseData != null) {
+ logger.debug("Received data from NSSMF: " + responseData)
+ }
+
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
+ if (response.getStatus() >= 200 && response.getStatus() < 300) {
+ // parse response as needed
+ return responseData
+ }
+ else {
+ return null
+ }
+ }
+ catch (Exception e) {
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ throw e
+ }
- private String getBasicDBAuthHeader(DelegateExecution execution) {
+ }
- String encodedString = null
- try {
- String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, NssmfAdapterNBIRequest nssmfRequest) {
+ try {
+
+ String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
+ String queryEndpoint = nssmfEndpoint + endPoint
+ def responseData
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
+ String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
+ client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
+
+ logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
+ Response response = client.post(nssmfRequest)
+
+ responseData = response.readEntity(String.class)
+ if (responseData != null) {
+ logger.debug("Received data from NSSMF: " + responseData)
+ }
+
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
+ if (response.getStatus() >= 200 && response.getStatus() < 300) {
+ // parse response as needed
+ return responseData
+ }
+ else {
+ return null
+ }
+ }
+ catch (Exception e) {
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ throw e
+ }
+
+ }
+
+ private String getBasicDBAuthHeader(DelegateExecution execution) {
+
+ String encodedString = null
+ try {
+ String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ execution.setVariable("BasicAuthHeaderValue", encodedString)
+ } catch (IOException ex) {
+ String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+ logger.error(dataErrorMessage)
+ }
+ return encodedString
+ }
- encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
- execution.setVariable("BasicAuthHeaderValue", encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- logger.error(dataErrorMessage)
- }
- return encodedString
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index ff31c46a3a..37b30567c7 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import com.google.gson.GsonBuilder
import org.onap.so.beans.nsmf.oof.NsiReqBody
import org.onap.so.beans.nsmf.oof.NssiReqBody
import org.onap.so.beans.nsmf.oof.RequestInfo
@@ -682,9 +683,7 @@ return json.toString()
nsiReqBody.setNSSTInfo(nsstInfo)
nsiReqBody.setPreferReuse(preferReuse)
- ObjectMapper objectMapper = new ObjectMapper()
-
- return objectMapper.writeValueAsString(nsiReqBody)
+ return bean2JsonStr(nsiReqBody)
}
public <T> String buildSelectNSSIRequest(String requestId, TemplateInfo nsstInfo, String messageType,
@@ -710,9 +709,10 @@ return json.toString()
nssiReqBody.setSliceProfile(sliceProfile)
nssiReqBody.setNSSTInfo(nsstInfo)
+ return bean2JsonStr(nssiReqBody)
+ }
- ObjectMapper objectMapper = new ObjectMapper()
-
- return objectMapper.writeValueAsString(nssiReqBody)
+ private static <T> String bean2JsonStr(T t) {
+ return new GsonBuilder().setPrettyPrinting().create().toJson(t)
}
}
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 5f0d412de0..70acadf0d8 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
@@ -349,7 +349,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
TemplateInfo nstInfo = new TemplateInfo()
nstInfo.setUUID(nstSolution.get("UUID") as String)
nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String)
- nstInfo.setName(nstSolution.get("name") as String)
+ nstInfo.setName(nstSolution.get("NSTName") as String)
sliceTaskParams.setNSTInfo(nstInfo)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 3e834fa7bb..896d7ff4b1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -139,7 +139,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
case SubnetType.CN:
sliceTaskParams.cnSliceTaskInfo = sliceTaskInfo
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceTaskParams.anSliceTaskInfo = sliceTaskInfo
break
case SubnetType.TN_BH:
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index cfdbe98c34..bc4060e10d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -44,6 +44,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.ResponseEntity
+import org.springframework.util.StringUtils
class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
@@ -139,7 +140,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* @param execution
*/
public void processDecompositionNSST(DelegateExecution execution) {
-
List<ServiceDecomposition> nsstServiceDecompositions =
execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
@@ -153,6 +153,9 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
int num = execution.getVariable("maxNsstIndex") as Integer
int index = execution.getVariable("currentNsstIndex") as Integer
+ List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
+ nsstInfos.get(index).name = nsstServiceDecomposition.modelInfo.modelName
+ execution.setVariable("nsstInfos", nsstInfos)
execution.setVariable("currentNsstIndex", index + 1)
if (index >= num) {
@@ -178,17 +181,16 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<SubnetCapability> subnetCapabilities = new ArrayList<>()
for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
- SubnetCapability subnetCapability = new SubnetCapability()
- handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
- subnetCapabilities.add(subnetCapability)
+ handleByType(execution, serviceDecomposition, sliceParams, subnetCapabilities)
}
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("subnetCapabilities", subnetCapabilities)
+ logger.debug("sliceTaskParams= " + sliceParams.toString())
}
private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
- SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
+ SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) {
ModelInfo modelInfo = serviceDecomposition.getModelInfo()
String vendor = serviceDecomposition.getServiceRole()
SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory())
@@ -210,7 +212,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceParams.anSliceTaskInfo.vendor = vendor
sliceParams.anSliceTaskInfo.subnetType = subnetType
sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
@@ -236,12 +238,14 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String response = querySubnetCapability(execution, vendor, subnetType)
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
-
- Map<String, Object> result = responseEntity.getBody() as Map
- for (Map.Entry<String, Object> entry : result.entrySet()) {
- subnetCapability.setDomainType(entry.getKey())
- subnetCapability.setCapabilityDetails(entry.getValue())
+ if (!StringUtils.isEmpty(response)) {
+ SubnetCapability subnetCapability = new SubnetCapability()
+ Map<String, Object> result = objectMapper.readValue(response, Map.class)
+ for (Map.Entry<String, Object> entry : result.entrySet()) {
+ subnetCapability.setDomainType(entry.getKey())
+ subnetCapability.setCapabilityDetails(entry.getValue())
+ }
+ subnetCapabilities.add(subnetCapability)
}
}
@@ -254,7 +258,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
return SubnetType.CN
}
if (serviceCategory ==~ /AN.*NF.*/){
- return SubnetType.AN_NF
+ return SubnetType.AN
}
if (serviceCategory ==~ /TN.*BH.*/){
return SubnetType.TN_BH
@@ -271,9 +275,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
*/
private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) {
- String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType))
-
- String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+ String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY,
+ buildQuerySubnetCapRequest(vendor, subnetType))
return response
}
@@ -284,24 +287,24 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* @param networkType
* @return
*/
- private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
+ private static NssmfAdapterNBIRequest buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
-// List<String> subnetTypes = new ArrayList<>()
-// subnetTypes.add(subnetType.subnetType)
- Map<String, Object> paramMap = new HashMap()
- paramMap.put("subnetType", subnetType.subnetType)
+ List<String> subnetTypes = new ArrayList<>()
+
+ subnetTypes.add(subnetType.subnetType)
+
+ Map<String, Object> paramMap = new HashMap<>()
+ paramMap.put("subnetTypes", subnetTypes)
- request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
+ request.setSubnetCapabilityQuery(paramMap)
EsrInfo esrInfo = new EsrInfo()
esrInfo.setVendor(vendor)
esrInfo.setNetworkType(subnetType.networkType)
request.setEsrInfo(esrInfo)
- String strRequest = objectMapper.writeValueAsString(request)
-
- return strRequest
+ return request
}
/**
@@ -336,7 +339,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.getVariable("subnetCapabilities") as List<SubnetCapability>
String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
- messageType, profileInfo, subnetCapabilities, timeout as Integer, preferReuse)
+ messageType, profileInfo, subnetCapabilities, 600, preferReuse)
execution.setVariable("nsiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
@@ -358,7 +361,13 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
//This needs to be changed to derive a value when we add policy to decide the solution options.
Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class)
+ String requestStatus = resMap.get("requestStatus")
+ if (StringUtils.isEmpty(requestStatus)) {
+ exceptionUtil.buildWorkflowException(execution, 7000, "get nsi from oof error: " + oofResponse)
+ }
+
List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+
Map<String, Object> solution = nsiSolutions.get(0)
String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
@@ -378,7 +387,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
}
}
execution.setVariable("sliceTaskParams", sliceTaskParams)
- //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
logger.debug("*** Completed options Call to OOF ***")
}
@@ -402,6 +410,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
break
case "an-nf":
+ case "an":
sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
break
case "cn":
@@ -602,7 +611,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.setVariable("nssiSelection_timeout", timeout)
String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType,
- profileInfo, timeout as Integer)
+ profileInfo, 600)
execution.setVariable("nssiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
@@ -665,7 +674,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
break
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
index 71c50c1684..9b6406d57f 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
@@ -40,7 +40,7 @@ public class SliceTaskInfo<T> implements Serializable {
private T sliceProfile;
- private TemplateInfo NSSTInfo;
+ private TemplateInfo NSSTInfo = new TemplateInfo();
private String sliceInstanceId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java
index 292a0d5ae4..ee3d8aecf8 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java
@@ -40,7 +40,7 @@ public class RequestInfo implements Serializable {
private Integer numSolutions;
- private Integer timeout;
+ private Object timeout;
private Map<?, ?> addtnlArgs;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java
index 4b0136a798..536bb04fce 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java
@@ -26,15 +26,13 @@ import org.onap.so.beans.nsmf.NetworkType;
public enum SubnetType {
AN("AN", NetworkType.ACCESS),
- AN_NF("AN-NF", NetworkType.ACCESS),
-
CN("CN", NetworkType.CORE),
- TN_FH("TN-FH", NetworkType.TRANSPORT),
+ TN_FH("TN_FH", NetworkType.TRANSPORT),
- TN_MH("TN-MH", NetworkType.TRANSPORT),
+ TN_MH("TN_MH", NetworkType.TRANSPORT),
- TN_BH("TN-BH", NetworkType.TRANSPORT),;
+ TN_BH("TN_BH", NetworkType.TRANSPORT),;
private NetworkType networkType;