summaryrefslogtreecommitdiffstats
path: root/nokia
diff options
context:
space:
mode:
Diffstat (limited to 'nokia')
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java5
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java22
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java9
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java3
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java8
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfRequest.java21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfResponse.java9
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/entity/VnfInstanceInfo.java6
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java60
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV2Info.java (renamed from nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V2_INFO.java)2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV3Info.java (renamed from nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V3_INFO.java)2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OtherVimInfo.java (renamed from nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OTHER_VIM_INFO.java)2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VimInfoType.java45
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VmwareVcloudInfo.java (renamed from nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VMWARE_VCLOUD_INFO.java)2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java88
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java1
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/exception/VnfmDriverException.java2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/VnfmInfo.java153
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java7
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/inf/NslcmMgmrInf.java1
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseHistoryList.java14
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java42
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java3
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java14
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java67
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java1
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegisterTest.java50
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java85
28 files changed, 329 insertions, 395 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java
index eeac57bd..dc2b8c0c 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java
@@ -25,10 +25,13 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
@SpringBootApplication
-//@ComponentScan(basePackages= {"org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.controller"})
@ComponentScan
public class VfcadaptorApplication {
+ private VfcadaptorApplication() {
+
+ }
+
public final static void main(String[] args) {
SpringApplication.run(VfcadaptorApplication.class, args);
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java
index e741b78e..3358ce59 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java
@@ -20,12 +20,12 @@ import java.util.List;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMCreateVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMHealVnfResponse;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMQueryVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMScaleVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OperationExecution;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.repository.VnfmJobExecutionRepository;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfResponse;
@@ -36,7 +36,6 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ResponseDescriptor;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ResponseHistoryList;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.VnfInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -55,17 +54,6 @@ public class Cbam2DriverResponseConverter {
return response;
}
- public InstantiateVnfResponse instantiateRspConvert(CBAMInstantiateVnfResponse cbamResponse) {
- InstantiateVnfResponse response = new InstantiateVnfResponse();
-
- VnfmJobExecutionInfo jobInfo = jobDbManager.findOne(Long.getLong(cbamResponse.getId()));
-
- response.setJobId("1");
-
- response.setVnfInstanceId("");
- return response;
- }
-
public TerminateVnfResponse terminateRspConvert(CBAMTerminateVnfResponse cbamResponse) {
VnfmJobExecutionInfo jobInfo = new VnfmJobExecutionInfo();
jobInfo.setVnfInstanceId(cbamResponse.getId());
@@ -100,13 +88,13 @@ public class Cbam2DriverResponseConverter {
response.setJobId(oper.getId());
ResponseDescriptor er = new ResponseDescriptor();
// TODO er.setProgress(i);
- if (oper.getStatus().equals("STARTED")) {
+ if (oper.getStatus() == CommonEnum.OperationStatus.STARTED ) {
er.setStatus("started");
- } else if (oper.getStatus().equals("FINISHED")) {
+ } else if (oper.getStatus() == CommonEnum.OperationStatus.FINISHED) {
er.setStatus("finished");
- } else if (oper.getStatus().equals("FAILED")) {
+ } else if (oper.getStatus() == CommonEnum.OperationStatus.FAILED) {
er.setStatus("error");
- } else if (oper.getStatus().equals("OTHER")) {
+ } else if (oper.getStatus() == CommonEnum.OperationStatus.OTHER) {
er.setStatus("processing");
} else {
er.setStatus("error");
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
index 5b9f95fe..42c91058 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
@@ -26,10 +26,9 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMScaleVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.EndpointInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.ExtVirtualLinkData;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OPENSTACK_V3_INFO;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OpenStackAccessInfoV3;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OpenstackV3Info;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VimInfo;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VimInfoType;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VnfExtCpData;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse;
@@ -58,21 +57,17 @@ public class Driver2CbamRequestConverter {
CBAMInstantiateVnfRequest request = new CBAMInstantiateVnfRequest();
List<VimInfo> vims = new ArrayList<VimInfo>();
VimInfo vim = new VimInfo();
- VimInfoType type = new VimInfoType();
EndpointInfo inter = new EndpointInfo();
- OPENSTACK_V3_INFO openstackV3 = new OPENSTACK_V3_INFO();
+ OpenstackV3Info openstackV3 = new OpenstackV3Info();
vim.setId(nslc.getVim().getVimId());
openstackV3.setId(nslc.getVim().getVimId());
inter.setEndpoint(nslc.getVim().getInterfaceEndpoint());
openstackV3.setInterfaceInfo(inter);
- openstackV3.setVimInfoType(type);
OpenStackAccessInfoV3 v3 = new OpenStackAccessInfoV3();
v3.setUsername(nslc.getVim().getAccessInfo().getUsername());
v3.setPassword(nslc.getVim().getAccessInfo().getPassword());
openstackV3.setAccessInfo(v3);
- type.setOPENSTACK_V3_INFO(openstackV3);
- vim.setVimInfoType(type);
vims.add(vim);
List<ExtVirtualLinkData> list = new ArrayList<ExtVirtualLinkData>();
ExtVirtualLinkData ext = new ExtVirtualLinkData();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
index 09cfee86..85077dd1 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
@@ -139,6 +139,9 @@ public class InstantiateVnfContinueRunnable implements Runnable {
VnfmJobExecutionInfo jobInfo = jobDbMgmr.findOne(Long.getLong(jobId));
jobInfo.setVnfmExecutionId(cbamInstantiateResponse.getId());
+ if(CommonEnum.OperationStatus.FAILED == cbamInstantiateResponse.getStatus()){
+ jobInfo.setStatus(CommonConstants.CBAM_OPERATION_STATUS_ERROR);
+ }
jobDbMgmr.save(jobInfo);
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java
index 37348420..2995c140 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java
@@ -73,11 +73,12 @@ public class TerminateVnfContinueRunnable implements Runnable {
CBAMTerminateVnfRequest cbamRequest = requestConverter.terminateReqConvert(driverRequest);
CBAMTerminateVnfResponse cbamResponse = cbamMgmr.terminateVnf(cbamRequest, vnfInstanceId);
- handleCbamInstantiateResponse(cbamResponse, jobId);
+ handleCbamTerminateResponse(cbamResponse, jobId);
cbamMgmr.deleteVnf(vnfInstanceId);
NslcmNotifyLCMEventsRequest nslcmNotifyReq = buildNslcmNotifyLCMEventsRequest(cbamResponse);
+
nslcmMgmr.notifyVnf(nslcmNotifyReq, vnfInstanceId);
} catch (ClientProtocolException e) {
@@ -88,10 +89,13 @@ public class TerminateVnfContinueRunnable implements Runnable {
}
- private void handleCbamInstantiateResponse(CBAMTerminateVnfResponse cbamResponse, String jobId) {
+ private void handleCbamTerminateResponse(CBAMTerminateVnfResponse cbamResponse, String jobId) {
VnfmJobExecutionInfo jobInfo = jobDbMgmr.findOne(Long.getLong(jobId));
jobInfo.setVnfmExecutionId(cbamResponse.getId());
+ if(CommonEnum.OperationStatus.FAILED ==cbamResponse.getStatus()) {
+ jobInfo.setStatus(CommonConstants.CBAM_OPERATION_STATUS_ERROR);
+ }
jobDbMgmr.save(jobInfo);
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfRequest.java
deleted file mode 100644
index 82946b11..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfRequest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.
- */
-package org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo;
-
-public class CatalogQueryVnfRequest {
-
-
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfResponse.java
index f5d44ca7..e050a34f 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfResponse.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/CatalogQueryVnfResponse.java
@@ -44,8 +44,6 @@ public class CatalogQueryVnfResponse {
this.csarId = csarId;
}
-
-
public VnfPackageInfo getPackageInfo() {
return packageInfo;
}
@@ -69,11 +67,4 @@ public class CatalogQueryVnfResponse {
public void setVnfInstanceInfo(List<VnfInstanceInfo> vnfInstanceInfo) {
this.vnfInstanceInfo = vnfInstanceInfo;
}
-
-
-
-
-
-
-
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/entity/VnfInstanceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/entity/VnfInstanceInfo.java
index 6ce4b07b..e458cc7b 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/entity/VnfInstanceInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/bo/entity/VnfInstanceInfo.java
@@ -40,10 +40,4 @@ public class VnfInstanceInfo {
public void setVnfInstanceName(String vnfInstanceName) {
this.vnfInstanceName = vnfInstanceName;
}
-
-
-
-
-
-
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java
index 8552a160..acaa16fc 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/CBAMTerminateVnfRequest.java
@@ -37,109 +37,49 @@ public class CBAMTerminateVnfRequest {
@JsonProperty("additionalParams")
private Object additionalParams;
-
-
public String getName() {
return name;
}
-
-
-
-
-
-
public void setName(String name) {
this.name = name;
}
-
-
-
-
-
-
public String getDescription() {
return description;
}
-
-
-
-
-
-
public void setDescription(String description) {
this.description = description;
}
-
-
-
public CommonEnum.TerminationType getTerminationType() {
return terminationType;
}
-
-
-
-
-
-
public void setTerminationType(CommonEnum.TerminationType terminationType) {
this.terminationType = terminationType;
}
-
-
-
-
-
-
public Integer getGracefulTerminationTimeout() {
return gracefulTerminationTimeout;
}
-
-
-
-
-
-
public void setGracefulTerminationTimeout(Integer gracefulTerminationTimeout) {
this.gracefulTerminationTimeout = gracefulTerminationTimeout;
}
-
-
-
-
-
-
public Object getAdditionalParams() {
return additionalParams;
}
-
-
-
-
-
-
public void setAdditionalParams(Object additionalParams) {
this.additionalParams = additionalParams;
}
-
-
-
-
-
-
public enum TerminationType{
GRACEFUL, FORCEFUL
-
}
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V2_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV2Info.java
index 9fad8cb3..3ffa0fb0 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V2_INFO.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV2Info.java
@@ -17,7 +17,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class OPENSTACK_V2_INFO {
+public class OpenstackV2Info {
@JsonProperty("vimInfoType")
private VimInfoType vimInfoType;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V3_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV3Info.java
index d5cc23a8..22de770e 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OPENSTACK_V3_INFO.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OpenstackV3Info.java
@@ -17,7 +17,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class OPENSTACK_V3_INFO {
+public class OpenstackV3Info {
@JsonProperty("vimInfoType")
private VimInfoType vimInfoType;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OTHER_VIM_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OtherVimInfo.java
index 76651247..4b7fb072 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OTHER_VIM_INFO.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/OtherVimInfo.java
@@ -17,7 +17,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class OTHER_VIM_INFO {
+public class OtherVimInfo {
@JsonProperty("vimInfoType")
private VimInfoType vimInfoType;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VimInfoType.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VimInfoType.java
index 67e6ed76..779e2659 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VimInfoType.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VimInfoType.java
@@ -15,37 +15,22 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity;
-public class VimInfoType {
+public enum VimInfoType {
+
+ OPENSTACK_V2_INFO {
+ private OpenstackV2Info openstackv2;
+
+ },
+ OPENSTACK_V3_INFO{
+ private OpenstackV3Info openstackv3;
+ },
+ VMWARE_VCLOUD_INFO{
+ private VmwareVcloudInfo vmwareInfo;
+ },
+ OTHER_VIM_INFO{
+ private OtherVimInfo other;
+ }
- public OPENSTACK_V2_INFO OPENSTACK_V2_INFO;
- public OPENSTACK_V3_INFO OPENSTACK_V3_INFO;
- public VMWARE_VCLOUD_INFO VMWARE_VCLOUD_INFO;
- public OTHER_VIM_INFO OTHER_VIM_INFO;
- public OPENSTACK_V2_INFO getOPENSTACK_V2_INFO() {
- return OPENSTACK_V2_INFO;
- }
- public void setOPENSTACK_V2_INFO(OPENSTACK_V2_INFO oPENSTACK_V2_INFO) {
- OPENSTACK_V2_INFO = oPENSTACK_V2_INFO;
- }
- public OPENSTACK_V3_INFO getOPENSTACK_V3_INFO() {
- return OPENSTACK_V3_INFO;
- }
- public void setOPENSTACK_V3_INFO(OPENSTACK_V3_INFO oPENSTACK_V3_INFO) {
- OPENSTACK_V3_INFO = oPENSTACK_V3_INFO;
- }
- public VMWARE_VCLOUD_INFO getVMWARE_VCLOUD_INFO() {
- return VMWARE_VCLOUD_INFO;
- }
- public void setVMWARE_VCLOUD_INFO(VMWARE_VCLOUD_INFO vMWARE_VCLOUD_INFO) {
- VMWARE_VCLOUD_INFO = vMWARE_VCLOUD_INFO;
- }
- public OTHER_VIM_INFO getOTHER_VIM_INFO() {
- return OTHER_VIM_INFO;
- }
- public void setOTHER_VIM_INFO(OTHER_VIM_INFO oTHER_VIM_INFO) {
- OTHER_VIM_INFO = oTHER_VIM_INFO;
- }
-
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VMWARE_VCLOUD_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VmwareVcloudInfo.java
index 2e417fec..746cb007 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VMWARE_VCLOUD_INFO.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/entity/VmwareVcloudInfo.java
@@ -17,7 +17,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class VMWARE_VCLOUD_INFO {
+public class VmwareVcloudInfo {
@JsonProperty("vimInfoType")
private VimInfoType vimInfoType;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java
index 79966f63..bb226db9 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java
@@ -39,6 +39,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.inf.CbamMgmrInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
@@ -81,10 +82,16 @@ public class CbamMgmrImpl implements CbamMgmrInf {
String httpPath = CommonConstants.CbamCreateVnfPath;
RequestMethod method = RequestMethod.POST;
- String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(cbamRequest, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> createVnf, responseStr is " + responseStr);
-
+ int code = httpResult.getStatusCode();
+ if(code == 201) {
+ logger.info("CbamMgmrImpl -> createVnf success");
+ }else {
+ logger.error("CbamMgmrImpl -> createVnf error ");
+ }
CBAMCreateVnfResponse response = gson.fromJson(responseStr, CBAMCreateVnfResponse.class);
return response;
@@ -97,10 +104,16 @@ public class CbamMgmrImpl implements CbamMgmrInf {
String httpPath = String.format(CommonConstants.CbamInstantiateVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.POST;
- String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(cbamRequest, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> instantiateVnf, responseStr is " + responseStr);
-
+ int code = httpResult.getStatusCode();
+ if(code == 202) {
+ logger.info("CbamMgmrImpl -> instantiateVnf success " );
+ }else {
+ logger.error("CbamMgmrImpl -> instantiateVnf error " );
+ }
CBAMInstantiateVnfResponse response = gson.fromJson(responseStr, CBAMInstantiateVnfResponse.class);
return response;
@@ -110,10 +123,16 @@ public class CbamMgmrImpl implements CbamMgmrInf {
String httpPath = String.format(CommonConstants.CbamTerminateVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.POST;
- String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(cbamRequest, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> terminateVnf, responseStr is " + responseStr);
-
+ int code = httpResult.getStatusCode();
+ if(code == 202) {
+ logger.info("CbamMgmrImpl -> terminateVnf sucess " );
+ }else {
+ logger.error("CbamMgmrImpl -> terminateVnf error " );
+ }
CBAMTerminateVnfResponse response = gson.fromJson(responseStr, CBAMTerminateVnfResponse.class);
return response;
@@ -122,18 +141,29 @@ public class CbamMgmrImpl implements CbamMgmrInf {
public void deleteVnf(String vnfInstanceId) throws ClientProtocolException, IOException {
String httpPath = String.format(CommonConstants.CbamDeleteVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.DELETE;
+ HttpResult httpResult = operateCbamHttpTask(null, httpPath, method);
- operateCbamHttpTask(null, httpPath, method);
+ int code = httpResult.getStatusCode();
+ if(code == 204) {
+ logger.info("CbamMgmrImpl -> deleteVnf success.");
+ }else {
+ logger.error("CbamMgmrImpl -> deleteVnf error. detail info is " + httpResult.getContent());
+ }
- logger.info("CbamMgmrImpl -> deleteVnf.");
}
public CBAMScaleVnfResponse scaleVnf(CBAMScaleVnfRequest cbamRequest, String vnfInstanceId) throws ClientProtocolException, IOException {
String httpPath = String.format(CommonConstants.CbamScaleVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.POST;
- String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method);
-
+ HttpResult httpResult = operateCbamHttpTask(cbamRequest, httpPath, method);
+ String responseStr = httpResult.getContent();
+ int code = httpResult.getStatusCode();
+ if(code == 202) {
+ logger.info("CbamMgmrImpl -> scaleVnf success.");
+ }else {
+ logger.error("CbamMgmrImpl -> scaleVnf error. " );
+ }
CBAMScaleVnfResponse response = gson.fromJson(responseStr, CBAMScaleVnfResponse.class);
return response;
@@ -143,10 +173,16 @@ public class CbamMgmrImpl implements CbamMgmrInf {
String httpPath = String.format(CommonConstants.CbamHealVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.POST;
- String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(cbamRequest, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> healVnf, responseStr is " + responseStr);
-
+ int code = httpResult.getStatusCode();
+ if(code == 202) {
+ logger.info("CbamMgmrImpl -> healVnf success.");
+ }else {
+ logger.error("CbamMgmrImpl -> healVnf error. " );
+ }
CBAMHealVnfResponse response = gson.fromJson(responseStr, CBAMHealVnfResponse.class);
return response;
@@ -156,16 +192,23 @@ public class CbamMgmrImpl implements CbamMgmrInf {
String httpPath = String.format(CommonConstants.CbamQueryVnfPath, vnfInstanceId);
RequestMethod method = RequestMethod.GET;
- String responseStr = operateCbamHttpTask(null, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(null, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> queryVnf, responseStr is " + responseStr);
+ int code = httpResult.getStatusCode();
+ if(code == 200) {
+ logger.info("CbamMgmrImpl -> queryVnf success.");
+ }else {
+ logger.error("CbamMgmrImpl -> queryVnf error. " );
+ }
CBAMQueryVnfResponse response = gson.fromJson(responseStr, CBAMQueryVnfResponse.class);
return response;
}
- public String operateCbamHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException {
+ public HttpResult operateCbamHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException {
String token = null;
try {
token = retrieveToken();
@@ -179,19 +222,28 @@ public class CbamMgmrImpl implements CbamMgmrInf {
map.put(CommonConstants.AUTHORIZATION, "bearer " + token);
map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
- String responseStr = httpClientProcessor.process(url, method, map, gson.toJson(httpBodyObj)).getContent();
-
- return responseStr;
+ return httpClientProcessor.process(url, method, map, gson.toJson(httpBodyObj));
}
public CBAMQueryOperExecutionResponse queryOperExecution(String execId) throws ClientProtocolException, IOException{
String httpPath = String.format(CommonConstants.CbamGetOperStatusPath, execId);
RequestMethod method = RequestMethod.GET;
- String responseStr = operateCbamHttpTask(null, httpPath, method);
+ HttpResult httpResult = operateCbamHttpTask(null, httpPath, method);
+ String responseStr = httpResult.getContent();
logger.info("CbamMgmrImpl -> CBAMQueryOperExecutionResponse, responseStr is " + responseStr);
+ int code = httpResult.getStatusCode();
+ if(code == 200) {
+ logger.info("CbamMgmrImpl -> CBAMQueryOperExecutionResponse, success" );
+ }else if(code == 202) {
+ logger.info("CbamMgmrImpl -> CBAMQueryOperExecutionResponse, ongoing" );
+ }else {
+ logger.error("CbamMgmrImpl -> CBAMQueryOperExecutionResponse, error" );
+ }
+
+
CBAMQueryOperExecutionResponse response = gson.fromJson(responseStr, CBAMQueryOperExecutionResponse.class);
return response;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
index 368e8a4e..aefd996a 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
@@ -62,6 +62,7 @@ public class CommonConstants {
public static final String CBAM_OPERATION_STATUS_START = "start";
public static final String CBAM_OPERATION_STATUS_FINISH = "finished";
+ public static final String CBAM_OPERATION_STATUS_ERROR = "error";
//MSB
public static final String MSB_REGISTER_SERVICE_PATH = "/api/microservices/v1/services";
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/exception/VnfmDriverException.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/exception/VnfmDriverException.java
index 8a465435..78111a17 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/exception/VnfmDriverException.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/exception/VnfmDriverException.java
@@ -24,7 +24,7 @@ public class VnfmDriverException extends RuntimeException{
public VnfmDriverException(int httpStatus, String message)
{
super(message);
- this.httpStatus = httpStatus;
+ setHttpStatus(httpStatus);
}
public int getHttpStatus() {
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/VnfmInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/VnfmInfo.java
deleted file mode 100644
index bf6608df..00000000
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/VnfmInfo.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * 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.
- */
-
-package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class VnfmInfo {
- @JsonProperty("vnfmId")
- private String vnfmId;
-
- @JsonProperty("name")
- private String name;
-
- @JsonProperty("type")
- private String type;
-
- @JsonProperty("url")
- private String url;
-
- @JsonProperty("userName")
- private String userName;
-
- @JsonProperty("password")
- private String password;
-
- @JsonProperty("vimId")
- private String vimId;
-
- @JsonProperty("vendor")
- private String vendor;
-
- @JsonProperty("version")
- private String version;
-
- @JsonProperty("description")
- private String description;
-
- @JsonProperty("certificateUrl")
- private String certificateUrl;
-
- @JsonProperty("createTime")
- private String createTime;
-
- public String getVnfmId() {
- return vnfmId;
- }
-
- public void setVnfmId(String vnfmId) {
- this.vnfmId = vnfmId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getVimId() {
- return vimId;
- }
-
- public void setVimId(String vimId) {
- this.vimId = vimId;
- }
-
- public String getVendor() {
- return vendor;
- }
-
- public void setVendor(String vendor) {
- this.vendor = vendor;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getCertificateUrl() {
- return certificateUrl;
- }
-
- public void setCertificateUrl(String certificateUrl) {
- this.certificateUrl = certificateUrl;
- }
-
- public String getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(String createTime) {
- this.createTime = createTime;
- }
-}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java
index 57e8fbac..fc0ff31c 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java
@@ -20,18 +20,15 @@ import java.io.IOException;
import java.util.HashMap;
import org.apache.http.client.ClientProtocolException;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmNotifyLCMEventsRequest;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.VnfmInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.inf.NslcmMgmrInf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/inf/NslcmMgmrInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/inf/NslcmMgmrInf.java
index d9c39dff..537290c9 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/inf/NslcmMgmrInf.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/inf/NslcmMgmrInf.java
@@ -22,7 +22,6 @@ import org.apache.http.client.ClientProtocolException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmNotifyLCMEventsRequest;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.VnfmInfo;
public interface NslcmMgmrInf {
// public VnfmInfo queryVnfm(String vnfmId) throws ClientProtocolException, IOException;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseHistoryList.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseHistoryList.java
index b9bbd6c4..895fa0f9 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseHistoryList.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/ResponseHistoryList.java
@@ -16,12 +16,9 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity;
-
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class ResponseHistoryList {
-
@JsonProperty("status")
private String status;//started;processing;finished;error
@@ -38,8 +35,6 @@ public class ResponseHistoryList {
@JsonProperty("responseId")
private Integer responseId;
-
-
public String getStatus() {
return status;
}
@@ -48,7 +43,6 @@ public class ResponseHistoryList {
this.status = status;
}
-
public Integer getProgress() {
return progress;
}
@@ -80,12 +74,4 @@ public class ResponseHistoryList {
public void setResponseId(Integer responseId) {
this.responseId = responseId;
}
-
-
-
-
-
-
-
-
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
index 2336c941..25fef06d 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java
@@ -84,12 +84,7 @@ public class VnfmDriverController {
}
catch(VnfmDriverException e)
{
- try {
- httpResponse.setStatus(HttpStatus.SC_BAD_REQUEST);
- httpResponse.sendError(e.getHttpStatus(), e.getMessage());
- } catch (IOException e1) {
-
- }
+ processControllerException(httpResponse, e);
}
return null;
@@ -109,12 +104,7 @@ public class VnfmDriverController {
}
catch(VnfmDriverException e)
{
- try {
- httpResponse.setStatus(HttpStatus.SC_BAD_REQUEST);
- httpResponse.sendError(e.getHttpStatus(), e.getMessage());
- } catch (IOException e1) {
-
- }
+ processControllerException(httpResponse, e);
}
return null;
@@ -132,11 +122,7 @@ public class VnfmDriverController {
}
catch(VnfmDriverException e)
{
- try {
- httpResponse.sendError(e.getHttpStatus(), e.getMessage());
- } catch (IOException e1) {
-
- }
+ processControllerException(httpResponse, e);
}
return null;
@@ -157,11 +143,7 @@ public class VnfmDriverController {
}
catch(VnfmDriverException e)
{
- try {
- httpResponse.sendError(e.getHttpStatus(), e.getMessage());
- } catch (IOException e1) {
-
- }
+ processControllerException(httpResponse, e);
}
return null;
@@ -182,15 +164,21 @@ public class VnfmDriverController {
}
catch(VnfmDriverException e)
{
- try {
- httpResponse.sendError(e.getHttpStatus(), e.getMessage());
- } catch (IOException e1) {
-
- }
+ processControllerException(httpResponse, e);
}
return null;
}
+ private void processControllerException(HttpServletResponse httpResponse, VnfmDriverException e) {
+ try {
+ logger.error(" VnfmDriverController --> processControllerException", e);
+ httpResponse.setStatus(HttpStatus.SC_BAD_REQUEST);
+ httpResponse.sendError(e.getHttpStatus(), e.getMessage());
+ } catch (IOException e1) {
+ logger.error("VnfmDriverController --> processControllerException error to sendError ", e1);
+ }
+ }
+
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
index ceeb6fba..3a2ca761 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
@@ -53,6 +53,9 @@ public class AaiMgmrInfImplTest {
String json = "{"
+ "\"vnfm-id\":\"vnfm-id_001\","
+ + "\"vim-id\":\"vim-id_001\","
+ + "\"certificate-url\":\"certificate-url_001\","
+ + "\"resource-version\":\"resource-version_001\","
+ "\"esr-system-info-list\":[{\"ip-address\" : \"1.3.5.6\"}]"
+ "}"
+ "";
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
index b738fcc5..3948638c 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
@@ -108,11 +108,25 @@ public class VnfmDriverMgmrImplTest {
esrSystemInfo.setProtocal(protocol);
esrSystemInfo.setIp(ip);
esrSystemInfo.setPort(port);
+ esrSystemInfo.setCloudDomain("cloudDomain");
+ esrSystemInfo.setDefaultTenant("defaultTenant");
+ esrSystemInfo.setEsrSystemId("esrSystemId");
+ esrSystemInfo.setPassword("password");
+ esrSystemInfo.setServiceUrl("serviceUrl");
+ esrSystemInfo.setSslCacert("sslCacert");
+ esrSystemInfo.setSslInsecure("sslInsecure");
+ esrSystemInfo.setType("type");
+ esrSystemInfo.setUserName("userName");
+ esrSystemInfo.setVendor("vendor");
+ esrSystemInfo.setVersion("version");
List<EsrSystemInfo> esrSystemInfoList = new ArrayList<EsrSystemInfo>();
esrSystemInfoList.add(esrSystemInfo);
AaiVnfmInfo mockVnfmInfo = new AaiVnfmInfo();
mockVnfmInfo.setVnfmId(vnfmId);
+ mockVnfmInfo.setVimId("vimId");
+ mockVnfmInfo.setResourceVersion("resourceVersion");
+ mockVnfmInfo.setCertificateUrl("certificateUrl");
mockVnfmInfo.setEsrSystemInfoList(esrSystemInfoList);
Driver2CbamRequestConverter reqConverter = new Driver2CbamRequestConverter();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java
index 33ca1761..5667908d 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java
@@ -19,7 +19,9 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.impl;
import static org.mockito.Mockito.when;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.apache.http.client.ClientProtocolException;
import org.junit.Assert;
@@ -29,12 +31,19 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.CatalogQueryVnfResponse;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.entity.ImageInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.entity.VnfInstanceInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum.Deletionpending;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VnfPackageInfo;
import org.springframework.web.bind.annotation.RequestMethod;
+import com.google.gson.Gson;
+
public class CatalogMgmrImplTest {
@InjectMocks
private CatalogMgmrImpl catalogMgmr;
@@ -44,29 +53,63 @@ public class CatalogMgmrImplTest {
private String vnfPackageId = "vnfPackageId_001";
+ private Gson gson = new Gson();
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
AdaptorEnv env = new AdaptorEnv();
catalogMgmr.setAdaptorEnv(env);
MockitoAnnotations.initMocks(this);
-
- String json = "{"
- + "\"csarId\":\"vnfPackageId_001\","
- + "\"packageInfo\":{\"downloadUri\" : \"1.3.5.6\"}"
- + "}"
- + "";
- HttpResult httpResult = new HttpResult();
- httpResult.setContent(json);
-
- when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
}
-
@Test
public void testQueryVnfPackage() throws ClientProtocolException, IOException
{
- VnfPackageInfo packageInfo = catalogMgmr.queryVnfPackage(vnfPackageId);
+ CatalogQueryVnfResponse response = new CatalogQueryVnfResponse();
+ List<VnfInstanceInfo> vnfInstanceInfos = new ArrayList<VnfInstanceInfo>();
+ VnfInstanceInfo vnfInstanceInfo = new VnfInstanceInfo();
+ vnfInstanceInfo.setVnfInstanceId("vnfInstanceId");
+ vnfInstanceInfo.setVnfInstanceName("vnfInstanceName");
+ vnfInstanceInfos.add(vnfInstanceInfo );
+
+
+ response.setVnfInstanceInfo(vnfInstanceInfos);
+
+ response.setCsarId("csarId");
+ List<ImageInfo> imageInfos = new ArrayList<ImageInfo>();
+ ImageInfo imageInfo = new ImageInfo();
+ imageInfo.setFileName("fileName");
+ imageInfo.setImageId("imageId");
+ imageInfo.setIndex("index");
+ imageInfo.setStatus("status");
+ imageInfo.setTenant("tenant");
+ imageInfo.setVimId("vimId");
+ imageInfo.setVimUser("vimUser");
+
+ imageInfos.add(imageInfo);
+ response.setImageInfo(imageInfos);
+
+ VnfPackageInfo packageInfo = new VnfPackageInfo();
+ packageInfo.setDownloadUri("1.3.5.6");
+ packageInfo.setName("name");
+ packageInfo.setOnBoardState("onBoardState");
+ packageInfo.setVnfdId("vnfdId");
+ packageInfo.setVnfdProvider("vnfdProvider");
+ packageInfo.setVnfdVersion("vnfdVersion");
+ packageInfo.setVnfVersion("vnfVersion");
+ Deletionpending deletionPending = CommonEnum.Deletionpending.fALSE;
+ packageInfo.setDeletionPending(deletionPending );
+
+ response.setPackageInfo(packageInfo );
+
+ String json = gson.toJson(packageInfo);
+
+ HttpResult httpResult = new HttpResult();
+ httpResult.setContent(json);
+
+ when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
+ VnfPackageInfo packageInfo1 = catalogMgmr.queryVnfPackage(vnfPackageId);
Assert.assertEquals("1.3.5.6", packageInfo.getDownloadUri());
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java
index 6c7eede1..900e7021 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImplTest.java
@@ -58,7 +58,6 @@ public class CbamMgmrImplTest {
MockitoAnnotations.initMocks(this);
AdaptorEnv env = new AdaptorEnv();
cbamMgmr.setAdaptorEnv(env);
- MockitoAnnotations.initMocks(this);
String json = "{\"access_token\":\"1234567\"}";
HttpResult httpResult = new HttpResult();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegisterTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegisterTest.java
new file mode 100644
index 00000000..8741bc80
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegisterTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * 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.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.service;
+
+import java.io.IOException;
+
+import org.apache.http.client.ClientProtocolException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.inf.IMsbMgmr;
+import org.springframework.boot.ApplicationArguments;
+
+public class MsbServiceRegisterTest {
+ @InjectMocks
+ private MsbServiceRegister msbServiceRegister;
+
+ @Mock
+ private IMsbMgmr msbMgmr;
+
+ @Mock
+ private ApplicationArguments argments;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testRegister() throws ClientProtocolException, IOException
+ {
+ msbServiceRegister.run(argments);
+ }
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
index 5a26b2ef..ddff4ca2 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
@@ -19,7 +19,9 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.impl;
import static org.mockito.Mockito.when;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import org.apache.http.client.ClientProtocolException;
import org.junit.Before;
@@ -29,13 +31,25 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.KeyValuePair;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum.LifecycleOperation;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmNotifyLCMEventsRequest;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AccessInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVirtualStorage;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVnfc;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.InterfaceInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimInfo;
import org.springframework.web.bind.annotation.RequestMethod;
+import com.google.gson.Gson;
+
public class NslcmMgmrImplTest {
@InjectMocks
private NslcmMgmrImpl nslcmMgmr;
@@ -45,31 +59,90 @@ public class NslcmMgmrImplTest {
private String vnfInstanceId = "vnfInstanceId_001";
+ private Gson gson = new Gson();
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
AdaptorEnv env = new AdaptorEnv();
nslcmMgmr.setAdaptorEnv(env);
MockitoAnnotations.initMocks(this);
-
- String json = "{\"access_token\":\"1234567\"}";
- HttpResult httpResult = new HttpResult();
- httpResult.setContent(json);
-
- when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
}
@Test
public void testGrantVnf() throws ClientProtocolException, IOException
{
+ ResourceDefinition resource = new ResourceDefinition();
+ resource.setResourceDefinitionId("resourceDefinitionId");
+ resource.setVdu("vdu");
+
+ NslcmGrantVnfResponse gresponse = new NslcmGrantVnfResponse();
+ List<KeyValuePair> additionalParam1 = new ArrayList<KeyValuePair>();
+ KeyValuePair pair = new KeyValuePair();
+ pair.setKey("key");
+ pair.setValue("value");
+ additionalParam1.add(pair);
+
+ List<ResourceDefinition> additionalParam2 = new ArrayList<ResourceDefinition>();
+ additionalParam2.add(resource);
+ gresponse.setAdditionalParam(additionalParam2);
+
+ VimInfo vim = new VimInfo();
+ vim.setInterfaceEndpoint("interfaceEndpoint");
+ vim.setVimId("vimId");
+ AccessInfo accessInfo = null;
+ vim.setAccessInfo(accessInfo );
+ InterfaceInfo interfaceInfo = null;
+ vim.setInterfaceInfo(interfaceInfo);
+
+ VimAssets vimAssets = null;
+ gresponse.setVimAssets(vimAssets);
+
+ gresponse.setVim(vim );
+ String json = gson.toJson(gresponse);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setContent(json);
+
+ when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
+
NslcmGrantVnfRequest cbamRequest = new NslcmGrantVnfRequest();
+ List<KeyValuePair> additionalParam = new ArrayList<KeyValuePair>();
+ pair = new KeyValuePair();
+ pair.setKey("key");
+ pair.setValue("value");
+ additionalParam.add(pair);
+ cbamRequest.setAdditionalParam(additionalParam);
+
+
+ List<ResourceDefinition> addResource = new ArrayList<ResourceDefinition>();
+ addResource.add(resource);
+
+ cbamRequest.setAddResource(addResource);
+ cbamRequest.setVnfInstanceId("vnfInstanceId");
+ cbamRequest.setJobId("jobId");
+ LifecycleOperation lifecycleOperation = CommonEnum.LifecycleOperation.Instantiate;
+ cbamRequest.setLifecycleOperation(lifecycleOperation);
+ cbamRequest.setRemoveResource(addResource);
+
NslcmGrantVnfResponse response = nslcmMgmr.grantVnf(cbamRequest);
}
@Test
public void testNotifyVnf() throws ClientProtocolException, IOException
{
+ String json = "{}";
+ HttpResult httpResult = new HttpResult();
+ httpResult.setContent(json);
+
+ when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
NslcmNotifyLCMEventsRequest cbamRequest = new NslcmNotifyLCMEventsRequest();
+ cbamRequest.setJobId("jobId");
+ cbamRequest.setOperation("operation");
+ cbamRequest.setVnfInstanceId(vnfInstanceId);
+ AffectedVirtualStorage affectedVirtualStorage = new AffectedVirtualStorage();
+ cbamRequest.setAffectedVirtualStorage(affectedVirtualStorage );
+ AffectedVnfc affectedVnfc = new AffectedVnfc();
+ cbamRequest.setAffectedVnfc(affectedVnfc );
nslcmMgmr.notifyVnf(cbamRequest, vnfInstanceId);
}
}