diff options
Diffstat (limited to 'adapters')
13 files changed, 189 insertions, 40 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 639b809888..0b921ecfb4 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -228,9 +228,9 @@ values (902, 'VNF-Macro-Modify',2,'ControllerExecutionBB',1,500,'vnf','config-de INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES ('Service-Macro-Create', '10', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'DEFAULT'), 'pnf', 'config-assign'); --- change to test the pnf regitsration works with the gating... ---INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES ---('Service-Macro-Create', '11', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = --'Service-Macro-Create' and CLOUD_OWNER = 'DEFAULT'), 'pnf', 'config-deploy'); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES +('Service-Macro-Create', '11', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'DEFAULT'), 'pnf', 'config-deploy'); INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) VALUES @@ -952,3 +952,8 @@ VALUES ('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'), ('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'), ('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*'); + +UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB'; +UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB'; +UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='HealthCheck' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB'; +UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vfmodule', ACTION='ScaleOutReconfiguration' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB'; 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 84e1eb2acc..1e3c76cdde 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 @@ -91,8 +91,7 @@ public class NssmfAdapterConsts { private final static String INTERNAL_MODIFY_URL = "/onap/so/infra/3gppservices/{apiVersion}/modify"; // - private final static String EXTERNAL_QUERY_JOB_STATUS = - "/api/rest/provMns/{apiVersion}/NSS/jobs/{jobId}?responseId={responseId}"; + private final static String EXTERNAL_QUERY_JOB_STATUS = "/api/rest/provMns/{apiVersion}/NSS/jobs/{jobId}"; private final static String INTERNAL_QUERY_SUB_NET_CAPABILITY = "/onap/so/infra/3gppservices/{apiVersion}/subnetCapabilityQuery"; diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java index 9df20bac1c..530cc1be0d 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java @@ -24,6 +24,9 @@ import lombok.Getter; @Getter public enum ActionType { + /** + * allocate + */ ALLOCATE("allocate"), DEALLOCATE("deallocate"), @@ -52,4 +55,13 @@ public enum ActionType { ActionType(String type) { this.type = type; } + + public static ActionType getActionType(String value) { + for (ActionType actionType : ActionType.values()) { + if (actionType.type.equalsIgnoreCase(value)) { + return actionType; + } + } + return null; + } } diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java index 0b332af607..e397201e4b 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java @@ -77,6 +77,12 @@ public class NssmfManagerBuilder { return; } + if (ExecutorType.EXTERNAL.equals(executorType) && NetworkType.TRANSPORT.equals(networkType)) { + this.nssmfManger = new ExternalAnNssmfManager().setEsrInfo(esrInfo).setExecutorType(executorType) + .setInitStatus("activated"); + return; + } + if (ExecutorType.EXTERNAL.equals(executorType) && NetworkType.ACCESS.equals(networkType)) { this.nssmfManger = new ExternalAnNssmfManager().setEsrInfo(esrInfo).setExecutorType(executorType) .setInitStatus("activated"); 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 acaa3945bd..0456c90fae 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 @@ -31,14 +31,19 @@ import org.onap.so.adapters.nssmf.util.RestUtil; import org.onap.so.beans.nsmf.*; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.data.domain.Example; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Optional; import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal; public abstract class BaseNssmfManager implements NssmfManager { + private static final Logger logger = LoggerFactory.getLogger(BaseNssmfManager.class); + protected RestUtil restUtil; protected ResourceOperationStatusRepository repository; @@ -152,6 +157,7 @@ public abstract class BaseNssmfManager implements NssmfManager { ResourceOperationStatus status = getOperationStatus(serviceInfo.getNsiId(), jobId, serviceInfo.getServiceUuid()); + logger.info("ResourceOperationStatus = {}", status); this.restResponse = doQueryJobStatus(status); afterQueryJobStatus(status); @@ -165,11 +171,16 @@ public abstract class BaseNssmfManager implements NssmfManager { private ResourceOperationStatus getOperationStatus(String nsiId, String jobId, String serviceUuid) { - ResourceOperationStatus status = new ResourceOperationStatus(nsiId, jobId, serviceUuid); + logger.info("Query operations: nsiId = [{}], jobId = [{}], serviceUuid = [{}]", nsiId, jobId, serviceUuid); - Optional<ResourceOperationStatus> optional = repository.findOne(Example.of(status)); + List<ResourceOperationStatus> resourceOperationStatuses = + repository.findByServiceIdAndOperationId(nsiId, jobId); - return optional.orElse(null); + logger.info("resourceOperationStatuses = {}", resourceOperationStatuses); + if (resourceOperationStatuses.size() == 0) { + return null; + } + return resourceOperationStatuses.get(0); } @Override @@ -193,7 +204,7 @@ public abstract class BaseNssmfManager implements NssmfManager { return doQuerySubnetCapability(nbiRequest.getSubnetCapabilityQuery()); } - protected abstract <T> RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException; + protected abstract RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException; /** * send request to nssmf 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 9dcd2d4cfb..7ec6c0f9e1 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 @@ -75,8 +75,9 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { @Override protected void afterQueryJobStatus(ResourceOperationStatus status) { + logger.info("afterQueryJobStatus = " + status); if (Integer.parseInt(status.getProgress()) == 100) { - + logger.info("after query finished = " + status); ActionType jobOperType = ActionType.valueOf(status.getOperType()); if (ActionType.ALLOCATE.equals(jobOperType)) { @@ -118,6 +119,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { JobStatusResponse jobStatusResponse = unMarshal(restResponse.getResponseContent(), JobStatusResponse.class); ResponseDescriptor rspDesc = jobStatusResponse.getResponseDescriptor(); + + logger.info("status = {}", status); rspDesc.setNssiId(status.getResourceInstanceID()); jobStatusResponse.setResponseDescriptor(rspDesc); @@ -152,7 +155,7 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { protected void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, RestResponse rsp) throws ApplicationException { - + status.setProgress(Integer.toString(rspDesc.getProgress())); switch (fromString(rspDesc.getStatus())) { case STARTED: updateDbStatus(status, rsp.getStatus(), STARTED, QUERY_JOB_STATUS_SUCCESS); @@ -168,6 +171,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { case ERROR: updateDbStatus(status, rsp.getStatus(), ERROR, QUERY_JOB_STATUS_FAILED); throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED); + default: + throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED); } } @@ -180,11 +185,11 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { } @Override - protected <T> RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException { + protected RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException { ObjectMapper oMapper = new ObjectMapper(); InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json"); - Map<String, Object> subnetCapability = new HashMap<>(); + Map subnetCapability = new HashMap<>(); try { subnetCapability = oMapper.readValue(inputStream, Map.class); } catch (Exception e) { @@ -201,7 +206,7 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { try { response = oMapper.writeValueAsString(responseMap); } catch (JsonProcessingException e) { - logger.debug("Exception while converting subnet capability object to String {}", e); + logger.debug("Exception while converting subnet capability object to String {}", e.getMessage()); } RestResponse rsp = new RestResponse(); @@ -227,7 +232,11 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { ResourceOperationStatus status = new ResourceOperationStatus(serviceInfo.getNsiId(), response.getJobId(), serviceInfo.getServiceUuid()); status.setResourceInstanceID(response.getNssiId()); + status.setOperType(actionType.toString()); + status.setProgress("0"); + response.setStatus(STARTED.toString()); + restResponse.setResponseContent(marshal(response)); updateDbStatus(status, restResponse.getStatus(), STARTED, NssmfAdapterUtil.getStatusDesc(actionType)); } } 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 296c30c1d8..64ab199bc1 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 @@ -66,19 +66,20 @@ public abstract class InternalNssmfManager extends BaseNssmfManager { } private RestResponse responseDBStatus(ResourceOperationStatus status) throws ApplicationException { + JobStatusResponse statusResponse = new JobStatusResponse(); ResponseDescriptor descriptor = new ResponseDescriptor(); if (status == null) { descriptor.setProgress(0); descriptor.setStatus(PROCESSING.name()); descriptor.setStatusDescription("Initiating Nssi Instance"); - return restUtil.createResponse(200, marshal(descriptor)); + } else { + descriptor.setStatus(status.getStatus()); + descriptor.setStatusDescription(status.getStatusDescription()); + descriptor.setProgress(Integer.parseInt(status.getProgress())); + descriptor.setNssiId(status.getResourceInstanceID()); } - descriptor.setStatus(status.getStatus()); - descriptor.setStatusDescription(status.getStatusDescription()); - descriptor.setProgress(Integer.parseInt(status.getProgress())); - descriptor.setNssiId(status.getResourceInstanceID()); - // descriptor.setResponseId(status.getOperationId()); - return restUtil.createResponse(200, marshal(descriptor)); + statusResponse.setResponseDescriptor(descriptor); + return restUtil.createResponse(200, marshal(statusResponse)); } @Override @@ -122,7 +123,7 @@ public abstract class InternalNssmfManager extends BaseNssmfManager { protected abstract String doWrapModifyReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException; @Override - protected <T> RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException { + protected RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException { // handler return sendRequest(marshal(req)); } diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java index c51b72d61e..3d0d0926fd 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java @@ -27,6 +27,7 @@ import org.onap.so.adapters.nssmf.enums.SelectionType; import org.onap.so.adapters.nssmf.exceptions.ApplicationException; import org.onap.so.adapters.nssmf.manager.impl.ExternalNssmfManager; import org.onap.so.adapters.nssmf.util.NssmfAdapterUtil; +import org.onap.so.beans.nsmf.AnSliceProfile; import org.onap.so.beans.nsmf.DeAllocateNssi; import org.onap.so.beans.nsmf.NssiResponse; import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest; @@ -47,7 +48,21 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager { @Override protected String doWrapExtAllocateReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException { Map<String, Object> request = new HashMap<>(); - request.put("attributeListIn", nbiRequest.getAllocateAnNssi().getSliceProfile()); + + AnSliceProfile anSliceProfile = nbiRequest.getAllocateAnNssi().getSliceProfile(); + + RanSliceProfile ranSliceProfile = new RanSliceProfile(); + ranSliceProfile.setSliceProfileId(anSliceProfile.getSliceProfileId()); + ranSliceProfile.setSNSSAIList(anSliceProfile.getSNSSAIList()); + ranSliceProfile.setPLMNIdList(anSliceProfile.getPLMNIdList()); + ranSliceProfile.setPerfReq(anSliceProfile.getPerfReq()); + ranSliceProfile.setMaxNumberofUEs(anSliceProfile.getMaxNumberOfUEs()); + ranSliceProfile.setCoverageAreaTAList(anSliceProfile.getCoverageAreaTAList()); + ranSliceProfile.setLatency(anSliceProfile.getLatency()); + ranSliceProfile.setUEMobilityLevel(anSliceProfile.getUeMobilityLevel()); + ranSliceProfile.setResourceSharingLevel(anSliceProfile.getResourceSharingLevel()); + + request.put("attributeListIn", ranSliceProfile); return marshal(request); } diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/RanSliceProfile.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/RanSliceProfile.java new file mode 100644 index 0000000000..7035456d75 --- /dev/null +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/RanSliceProfile.java @@ -0,0 +1,70 @@ +/*- + * ============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========================================================= + */ + +package org.onap.so.adapters.nssmf.manager.impl.external; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import java.io.Serializable; +import java.util.List; +import org.onap.so.beans.nsmf.PerfReq; +import org.onap.so.beans.nsmf.UeMobilityLevel; +import org.onap.so.beans.nsmf.ResourceSharingLevel; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Data +public class RanSliceProfile implements Serializable { + /* + * Reference 3GPP TS 28.541 V16.5.0, Section 6.3.4. + */ + + private static final long serialVersionUID = 172447042469370448L; + + @JsonProperty(value = "sliceProfileId", required = true) + private String sliceProfileId; + + @JsonProperty(value = "sNSSAIList", required = true) + private List<String> sNSSAIList; + + @JsonProperty(value = "pLMNIdList", required = true) + private List<String> pLMNIdList; + + @JsonProperty(value = "perfReq", required = true) + private PerfReq perfReq; + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + @JsonProperty(value = "maxNumberofUEs") + private long maxNumberofUEs; + + @JsonProperty(value = "coverageAreaTAList") + private List<Integer> coverageAreaTAList; + + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + @JsonProperty(value = "latency") + private int latency; + + @JsonProperty(value = "uEMobilityLevel") + private UeMobilityLevel uEMobilityLevel; + + @JsonProperty(value = "resourceSharingLevel") + private ResourceSharingLevel resourceSharingLevel; + +} diff --git a/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json b/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json index 8db52168ae..8753e85ea2 100644 --- a/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json +++ b/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json @@ -1,19 +1,10 @@ { "AN": { - "latency": "5", + "latency": 5, "maxNumberofUEs": "100" }, "CN": { - "latency": "10", + "latency": 5, "maxNumberofConns": "100" - }, - "TN_FH": { - "latency": "10" - }, - "TN_MH": { - "latency": "5" - }, - "TN_BH": { - "latency": "10" } } diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java index f150f47f4f..f78bfd297a 100644 --- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java +++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java @@ -78,6 +78,7 @@ public class NssmfAdapterRestTest { + " \"networkType\" : \"cn\"\n" + " },\n" + " \"allocateCnNssi\" : {\n" + " \"nssiId\" : \"NSST-C-001-HDBNJ-NSSMF-01-A-ZX\",\n" + " \"nssiName\" : \"eMBB-001\",\n" + " \"sliceProfile\" : {\n" + " \"snssaiList\" : [ \"001-100001\" ],\n" + + " \"maxNumberofPDUSession\" : 10,\n" + " \"sliceProfileId\" : \"ab9af40f13f721b5f13539d87484098\",\n" + " \"plmnIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n" + " \"perfReqEmbbList\" : [ {\n" + " \"activityFactor\" : 50\n" + " } ]\n" @@ -315,12 +316,13 @@ public class NssmfAdapterRestTest { taList.add("3"); sP.setSnssaiList(sns); sP.setSliceProfileId("ab9af40f13f721b5f13539d87484098"); - sP.setPlmnIdList(plmn); + sP.setPLMNIdList(plmn); sP.setPerfReq(perfReq); - sP.setMaxNumberofUEs(200); + sP.setMaxNumberOfUEs(200); sP.setCoverageAreaTAList(taList); sP.setLatency(6); sP.setResourceSharingLevel(NON_SHARED); + sP.setMaxNumberOfPDUSession(10); NsiInfo nsiInfo = new NsiInfo(); nsiInfo.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX"); nsiInfo.setNsiName("eMBB-001"); diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java index 0d86056821..d7b3b03333 100644 --- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java +++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java @@ -204,9 +204,9 @@ public class NssmfManagerServiceImplTest { taList.add("3"); sP.setSnssaiList(sns); sP.setSliceProfileId("ab9af40f13f721b5f13539d87484098"); - sP.setPlmnIdList(plmn); + sP.setPLMNIdList(plmn); sP.setPerfReq(perfReq); - sP.setMaxNumberofUEs(200); + sP.setMaxNumberOfUEs(200); sP.setCoverageAreaTAList(taList); sP.setLatency(6); sP.setResourceSharingLevel(NON_SHARED); @@ -361,9 +361,10 @@ public class NssmfManagerServiceImplTest { NssmfAdapterNBIRequest nbiRequest = createNbiRequest(); nbiRequest.setResponseId("7512eb3feb5249eca5ddd742fedddd39"); - Optional<ResourceOperationStatus> optional = Optional.of(operationStatus); + List<ResourceOperationStatus> optional = new ArrayList<>(); + optional.add(operationStatus); - doAnswer(invocation -> optional).when(repository).findOne(any()); + doAnswer(invocation -> optional).when(repository).findByServiceIdAndOperationId(any(), any()); createCommonMock(200, nssmf); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java index 12e416f43c..cd32cc208a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java @@ -24,6 +24,7 @@ import java.net.MalformedURLException; import java.net.URL; import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.aaiclient.client.aai.AAIVersion; +import org.onap.so.client.CacheProperties; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; @@ -32,6 +33,9 @@ public class AaiClientPropertiesImpl implements AAIProperties { private String aaiEndpoint; private String auth; private String key; + private Long readTimeout; + private boolean enableCaching; + private Long cacheMaxAge; private static final String SYSTEM_NAME = "MSO"; public AaiClientPropertiesImpl() { @@ -39,6 +43,9 @@ public class AaiClientPropertiesImpl implements AAIProperties { aaiEndpoint = context.getEnvironment().getProperty("aai.endpoint"); this.auth = context.getEnvironment().getProperty("aai.auth"); this.key = context.getEnvironment().getProperty("mso.msoKey"); + this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000)); + this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false); + this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L); } @Override @@ -65,4 +72,24 @@ public class AaiClientPropertiesImpl implements AAIProperties { public String getKey() { return this.key; } + + @Override + public Long getReadTimeout() { + return this.readTimeout; + } + + @Override + public boolean isCachingEnabled() { + return this.enableCaching; + } + + @Override + public CacheProperties getCacheProperties() { + return new AAICacheProperties() { + @Override + public Long getMaxAge() { + return cacheMaxAge; + } + }; + } } |