diff options
13 files changed, 109 insertions, 219 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/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index b6227aae16..2e0ec3f154 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -39,8 +39,6 @@ public class AAIPropertiesImpl implements AAIProperties { public static final String AAI_ENABLE_CACHING = "aai.caching.enable"; public static final String AAI_CACHE_MAX_AGE = "aai.caching.maxAge"; - private UrnPropertiesReader reader; - @Override public URL getEndpoint() throws MalformedURLException { return new URL(UrnPropertiesReader.getVariable(AAI_ENDPOINT)); @@ -68,17 +66,17 @@ public class AAIPropertiesImpl implements AAIProperties { @Override public Long getReadTimeout() { - return Long.valueOf(reader.getVariable(AAI_READ_TIMEOUT, "60000")); + return Long.valueOf(UrnPropertiesReader.getVariable(AAI_READ_TIMEOUT, "60000")); } @Override public Long getConnectionTimeout() { - return Long.valueOf(reader.getVariable(AAI_CONNECTION_TIMEOUT, "60000")); + return Long.valueOf(UrnPropertiesReader.getVariable(AAI_CONNECTION_TIMEOUT, "60000")); } @Override public boolean isCachingEnabled() { - return Boolean.parseBoolean(reader.getVariable(AAI_ENABLE_CACHING, "false")); + return Boolean.parseBoolean(UrnPropertiesReader.getVariable(AAI_ENABLE_CACHING, "false")); } @Override @@ -86,7 +84,7 @@ public class AAIPropertiesImpl implements AAIProperties { return new AAICacheProperties() { @Override public Long getMaxAge() { - return Long.valueOf(reader.getVariable(AAI_CACHE_MAX_AGE, "60000")); + return Long.valueOf(UrnPropertiesReader.getVariable(AAI_CACHE_MAX_AGE, "60000")); } }; } 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-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy index ec97972e5d..01aefe2054 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy @@ -123,7 +123,6 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { execution.setVariable("OOFResponse", OOFResponse) String solutions ="" if(requestStatus.equals("completed")) { - solutions = jsonUtil.getJsonValue(OOFResponse, "solutions") List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions")) if(solutionsList!=null && !solutionsList.isEmpty() ) { solutions = solutionsList.get(0) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy index 1ca0605ac8..91599700ef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy @@ -440,7 +440,9 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId) client.create(networkRouteUri, bh_ep) //relationship b/w bh_ep and Core NSSI - def coreNssi = execution.getVariable("nssiServiceInstanceId") + String coreNssi = execution.getVariable("nssiServiceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") Relationship relationship = new Relationship() String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}" relationship.setRelatedLink(relatedLink) @@ -448,10 +450,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf") logger.debug("networkRouteUri: "+networkRouteUri+"relationship: "+relationship) try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - coreNssi).relationshipAPI() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(coreNssi)).relationshipAPI() logger.debug("uri: "+uri) client.create(uri, relationship) } catch (BpmnError e) { @@ -475,6 +474,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") + String nssiId = execution.getVariable("nssiServiceInstanceId") String operationType = "ALLOCATE" ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) @@ -494,15 +494,17 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - String nssiId = execution.getVariable("nssiId") + String nssiId = execution.getVariable("nssiServiceInstanceId") String operationType = "ALLOCATE" //modelUuid String modelUuid= execution.getVariable("modelUuid") - logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "operationType: "+operationType) + logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "nssiId: "+nssiId +" "+ "operationType: "+operationType) ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) resourceOperationStatus.setJobId(jobId) resourceOperationStatus.setOperationId(jobId) + resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceInstanceID(nssiId) resourceOperationStatus.setResourceTemplateUUID(modelUuid) resourceOperationStatus.setOperType(operationType) resourceOperationStatus.setProgress("0") 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/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java index 51b756464e..ab214d8672 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java @@ -34,7 +34,9 @@ public enum AAIVersion implements GraphInventoryVersion { V18("v18"), V19("v19"), V20("v20"), - V21("v21"); + V21("v21"), + V22("v22"), + V23("v23"); public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; private final String value; 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 + |