aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-cnf-adapter/pom.xml153
-rw-r--r--adapters/pom.xml1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java23
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json (renamed from mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json)16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml5
11 files changed, 131 insertions, 224 deletions
diff --git a/adapters/mso-cnf-adapter/pom.xml b/adapters/mso-cnf-adapter/pom.xml
deleted file mode 100644
index 8cfb2dc581..0000000000
--- a/adapters/mso-cnf-adapter/pom.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<!--
- ~*
- ~============LICENSE_START=======================================================
- ~* ONAP - SO
- ~*================================================================================
- ~* Copyright (C) 2020 Huawei Technologies Co., Ltd. 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=========================================================
- ~*/
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>adapters</artifactId>
- <version>1.7.1-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-cnf-adapter</artifactId>
- <packaging>jar</packaging>
- <name>mso-cnf-adapter</name>
- <description>Web service endpoint for cnf operations</description>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${springboot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <mainClass>org.onap.so.adapters.cnf.MSOCnfApplication</mainClass>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jdbc</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpmime</artifactId>
- </dependency>
- <!-- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
- </dependency> -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-requests-db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-requests-db-repositories</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.vorburger.mariaDB4j</groupId>
- <artifactId>mariaDB4j</artifactId>
- <version>2.2.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-configuration-processor</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>3.14.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>1.18.2</version>
- </dependency> -->
- </dependencies>
-</project>
diff --git a/adapters/pom.xml b/adapters/pom.xml
index 49f25b8102..76371abaa6 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -20,7 +20,6 @@
<module>mso-requests-db-adapter</module>
<module>mso-catalog-db-adapter</module>
<module>mso-vfc-adapter</module>
- <module>mso-cnf-adapter</module>
<module>mso-openstack-adapters</module>
<module>etsi-sol003-adapter</module>
<module>mso-nssmf-adapter</module>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
index 9ccc6951ea..897cdfcd7b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
@@ -49,7 +49,8 @@ import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.ObjectMapper
import com.google.gson.JsonObject
-
+import groovy.json.JsonSlurper
+import com.google.gson.Gson
/**
* Internal AN NSSMF to handle NSSI Activation/Deactivation
@@ -78,16 +79,26 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
private static final String ACTIVATE = "activateInstance"
private static final String DEACTIVATE = "deactivateInstance"
- private static final String VENDOR_ONAP = "ONAP"
+ private static final String VENDOR_ONAP = "ONAP_internal"
+
+ enum orchStatusMap {
+ activateInstance("activated"),
+ deactivateInstance("deactivated")
+
+ private String value;
+
+ private orchStatusMap(String value) {
+ this.value = value;
+ }
+ }
- Map<String,String> orchStatusMap = new HashMap<>()
@Override
public void preProcessRequest(DelegateExecution execution) {
logger.debug("${Prefix} - Start preProcessRequest")
String sliceParams = execution.getVariable("sliceParams")
- String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+ List<String> sNssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
String nsiId = execution.getVariable("nsiId")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -95,7 +106,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anNssiId = execution.getVariable("serviceInstanceID")
String operationType = execution.getVariable("operationType")
- if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+ if((sNssaiList.empty) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
@@ -112,9 +123,6 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("nsiId", nsiId)
execution.setVariable("anNssiId", anNssiId)
- orchStatusMap.put(ACTIVATE, "activated")
- orchStatusMap.put(DEACTIVATE, "deactivated")
-
logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
}
@@ -145,11 +153,12 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
ServiceInstance sliceProfileInstance = execution.getVariable(KEY_SLICE_PROFILE)
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeSPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeSPStatus", false)
- }
+ }else {
+ execution.setVariable("shouldChangeSPStatus", true)
+
+ }
logger.debug("${Prefix} - SPOrchStatus : ${orchStatus}")
}
@@ -167,10 +176,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeAN_NF_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeAN_NF_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeAN_NF_SPStatus", true)
}
logger.debug("${Prefix} - getAnNfSPOrchStatus AN_NF SP ID:${anNfSPId} : ${orchStatus}")
}
@@ -181,7 +190,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String action = operationType.equalsIgnoreCase(ACTIVATE) ? "activate":"deactivate"
String anNfNssiId = execution.getVariable("anNfNssiId")
- String sNssai = execution.getVariable("sNssaiList")
+ List<String> sNssai = execution.getVariable("sNssaiList")
String reqId = execution.getVariable("msoRequestId")
String messageType = "SDNRActivateResponse"
StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
@@ -190,7 +199,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject input = new JsonObject()
input.addProperty("RANNFNSSIId", anNfNssiId)
input.addProperty("callbackURL", callbackURL.toString())
- input.addProperty("s-NSSAI", sNssai)
+ input.addProperty("s-NSSAI", sNssai.toString())
JsonObject Payload = new JsonObject()
Payload.addProperty("version", "1.0")
@@ -202,7 +211,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
wrapinput.addProperty("Action", action)
JsonObject CommonHeader = new JsonObject()
- CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+ CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss", TimeZone.getDefault()))
CommonHeader.addProperty("APIver", "1.0")
CommonHeader.addProperty("RequestID", reqId)
CommonHeader.addProperty("SubRequestID", "1")
@@ -211,18 +220,18 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
- Payload.add("input", input)
+ Payload.addProperty("input", input.toString())
wrapinput.add("Payload", Payload)
wrapinput.add("CommonHeader", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
String json = sdnrRequest.toString()
- execution.setVariable("sdnrRequest", sdnrRequest)
+ execution.setVariable("sdnrRequest", json)
execution.setVariable("SDNR_messageType", messageType)
execution.setVariable("SDNR_timeout", "PT10M")
- logger.debug("${Prefix} - prepareSdnrActivationRequest : SDNR Request : ${json}")
+ logger.debug("${Prefix} - Exit prepareSdnrActivationRequest ")
}
void processSdnrResponse(DelegateExecution execution) {
@@ -267,10 +276,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_FH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_FH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_FH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnFhSPOrchStatus TN_FH SP ID:${tnFhSPId} : ${orchStatus}")
@@ -283,9 +292,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
-
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String snssai = sNssaiList.get(0)
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -307,10 +315,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_MH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_MH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_MH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnMhSPOrchStatus TN_MH SP ID:${tnFhSPId} : ${orchStatus}")
}
@@ -322,9 +330,9 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+ String snssai = sNssaiList.get(0)
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -378,7 +386,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anSliceProfileId = execution.getVariable("anSliceProfileId")
updateOrchStatus(execution, anNssiId)
updateOrchStatus(execution, anSliceProfileId)
- logger.debug("${Prefix} Start updateANStatus")
+ logger.debug("${Prefix} Exit updateANStatus")
}
void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
@@ -463,7 +471,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ logger.debug("${Prefix} Exit prepareUpdateJobStatus : ${statusDescription}")
}
@@ -567,20 +576,22 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
actDeactNssi.setSnssaiList(sNssaiList)
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setVendor(VENDOR_ONAP)
- esrInfo.setNetworkType("TN")
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", VENDOR_ONAP)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ serviceInfo.setNssiId(nssiId)
JsonObject json = new JsonObject()
- json.addProperty("actDeActNssi", objectMapper.writeValueAsString(actDeactNssi))
- json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
- json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+ Gson jsonConverter = new Gson()
+ json.add("actDeActNssi", jsonConverter.toJsonTree(actDeactNssi))
+ json.add("esrInfo", esrInfo)
+ json.add("serviceInfo", jsonConverter.toJsonTree(serviceInfo))
return json.toString()
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
index d81f5465b3..2301b47639 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
@@ -154,7 +154,7 @@ activator.processSdnrResponse(execution)</bpmn:script>
<bpmn:outgoing>Flow_0rizzsm</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def activator = new DoActivateAccessNSSI()
-activator..prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
+activator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
</bpmn:scriptTask>
<bpmn:serviceTask id="Activity_08yj5gq" name="Update Resource Operation Status">
<bpmn:extensionElements>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 4be497c469..f5955d6c7d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -46,10 +46,10 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.excpetion.VnfcMultipleRelationshipException;
import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
@@ -490,7 +490,7 @@ public class WorkflowAction {
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
+ if (relationshipsOp.isEmpty()) {
logger.debug("No relationships were found for vfModule in AAI");
} else {
Relationships relationships = relationshipsOp.get();
@@ -503,21 +503,20 @@ public class WorkflowAction {
return vnfcs;
}
- protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception {
+ protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name)
+ throws VnfcMultipleRelationshipException {
T configuration = null;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
+ if (relationshipsOp.isEmpty()) {
logger.debug("No relationships were found for VNFC in AAI");
} else {
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> configurationResultWrappers =
this.getResultWrappersFromRelationships(relationships, name);
if (configurationResultWrappers.size() > 1) {
- String multipleRelationshipsError =
- "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- throw new Exception(multipleRelationshipsError);
+ throw new VnfcMultipleRelationshipException(vnfc.getVnfcName());
}
if (!configurationResultWrappers.isEmpty()) {
Optional<T> configurationOp = configurationResultWrappers.get(0).asBean(resultClass);
@@ -544,7 +543,7 @@ public class WorkflowAction {
}
protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj)
- throws Exception {
+ throws AAIEntityNotFoundException, VnfcMultipleRelationshipException {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
List<OrchestrationFlow> result = dataObj.getOrchFlows().stream()
@@ -658,7 +657,7 @@ public class WorkflowAction {
if (volumeGroupFromVfModule.isPresent()) {
String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId();
volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName();
- logger.debug("Volume group id of the existing volume group is: " + volumeGroupId);
+ logger.debug("Volume group id of the existing volume group is: {}", volumeGroupId);
volumeGroupExisted = true;
dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId);
dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
@@ -675,7 +674,7 @@ public class WorkflowAction {
String newVolumeGroupId = UUID.randomUUID().toString();
dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId);
dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
- logger.debug("newVolumeGroupId: " + newVolumeGroupId);
+ logger.debug("newVolumeGroupId: {}", newVolumeGroupId);
}
}
@@ -702,7 +701,7 @@ public class WorkflowAction {
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
- logger.debug(pair.getValue0() + ", " + pair.getValue1());
+ logger.debug("{}, {}", pair.getValue0(), pair.getValue1());
}
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
@@ -1324,15 +1323,6 @@ public class WorkflowAction {
return sortedOrchFlows;
}
- private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) {
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName);
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
- return configurationResourceKeys;
- }
-
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java
new file mode 100644
index 0000000000..8ef00655f2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2021 Nokia
+ * ================================================================================
+ * 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.onap.so.bpmn.infrastructure.workflow.tasks.excpetion;
+
+public class VnfcMultipleRelationshipException extends Exception {
+
+ public VnfcMultipleRelationshipException(String vnfcName) {
+ super("Multiple relationships exist from VNFC " + vnfcName + " to Configurations");
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
index b1486c9686..a25a140334 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
@@ -20,6 +20,9 @@
package org.onap.so.apihandlerinfra;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.UUID;
@@ -72,6 +75,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -124,6 +128,9 @@ public class Onap3gppServiceInstances {
@Autowired
private ResponseHandler responseHandler;
+ @Value("${subnetCapability.config.file}")
+ private String subnetCapabilityConfigFile;
+
/**
* POST Requests for 3GPP Service create Instance on a version provided
*
@@ -583,13 +590,23 @@ public class Onap3gppServiceInstances {
}
}
- // To be implemented for fetching Subnet capabilities
private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
ObjectMapper oMapper = new ObjectMapper();
- InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+ String inputFileString = "";
Map<String, Object> subnetCapability = new HashMap<>();
+ BufferedReader br = null;
try {
- subnetCapability = oMapper.readValue(inputStream, Map.class);
+ logger.debug("Reading SubnetCapability file");
+ br = new BufferedReader(new FileReader(new File(subnetCapabilityConfigFile)));
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ inputFileString = sb.toString();
+ subnetCapability = oMapper.readValue(inputFileString, Map.class);
} catch (Exception e) {
logger.debug("Exception while reading subnet capability value from json", e);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
index b46690f2a7..6064f73e23 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
@@ -83,3 +83,7 @@ org:
adapters:
network:
encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
+
+subnetCapability:
+ config:
+ file: /app/subnetCapability.json
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
index 95f00c3a39..14a87bf915 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
@@ -187,7 +187,7 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
String request = "{\"subnetTypes\":[\"AN\"]}";
QuerySubnetCapability subnetCapabilityRequest = MAPPER.readValue(request, QuerySubnetCapability.class);
String expectedResponse =
- "{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
+ "{\"AN\":{\"latency\":5,\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");
String actualResponse = (String) response.getEntity();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
index 0d5acef64a..55b3831502 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
@@ -1,25 +1,31 @@
{
"AN": {
- "latency": "5",
+ "latency": 5,
"maxNumberofUEs": "100",
"maxThroughput": "150",
"terminalDensity": "50"
},
"CN": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "50",
"maxNumberofConns": "100"
},
"TN_FH": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "100"
},
"TN_MH": {
- "latency": "5",
+ "latency": 5,
"maxThroughput": "50"
},
"TN_BH": {
- "latency": "10",
+ "latency": 10,
"maxThroughput": "100"
+ },
+ "AN_NF": {
+ "latency": 5,
+ "maxNumberofUEs": "100",
+ "maxThroughput": "150",
+ "terminalDensity": "50"
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 1429ac9b52..bcd36b8643 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -140,3 +140,8 @@ org:
adapters:
network:
encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
+
+subnetCapability:
+ config:
+ file: src/test/resources/Onap3gppServiceInstancesTest/subnetCapability.json
+