summaryrefslogtreecommitdiffstats
path: root/nokia/vnfmdriver
diff options
context:
space:
mode:
authoryufei_zhou <yufei.zhou@nokia-sbell.com>2017-11-05 23:17:21 +0800
committeryufei_zhou <yufei.zhou@nokia-sbell.com>2017-11-05 23:37:09 +0800
commit029a1743a0e3e5c81a232c2153ea9d1b808ba7b6 (patch)
treeeadb5e5ee59c462a34d179c5873e9b6ae5a7b71a /nokia/vnfmdriver
parent98b79d96202bc04aec130bf7df6cfc3c78b58ec9 (diff)
Update db process part
Change-Id: Ie66c98744f3b27c9abf4e6bb24d1be84580ccb91 Issue-ID: VFC-544 Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver')
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/deployment/pom.xml6
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/conf/server.xml3
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql18
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml5
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java133
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java8
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/SslConfInfo.java74
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java98
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/MultipartUtility.java291
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java52
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/util/CommonUtil.java2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java24
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmJobExecutionInfo.java15
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java11
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java81
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java5
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java36
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java6
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AddResource.java62
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AdditionalParam.java52
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedCp.java86
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedVirtualStorage.java20
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/PortResource.java81
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceDefinition.java51
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceTemplate.java50
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualComputeDescriptor.java40
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualCpu.java34
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualMemory.java35
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualStorageDescriptor.java52
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/VimInfo.java16
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java17
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties22
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/register.properties2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java4
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java38
36 files changed, 1373 insertions, 159 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/deployment/pom.xml
index f0c4df7f..d1f943c3 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/deployment/pom.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/pom.xml
@@ -74,7 +74,11 @@
fileset(dir: "${basedir}/src/main/release"){
exclude(name: "**/.gitignore")
}
-
+ }
+ ant.copy(todir: "${deployUnzip}/docker") {
+ fileset(dir: "${basedir}/../docker"){
+ exclude(name: "**/.gitignore")
+ }
}
System.out.println("******** start copying from ${project.build.directory}/../../vfcadaptor/target/${package.name}-${project.version} to ${deployUnzip}/webapps/ROOT. ************")
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/conf/server.xml b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/conf/server.xml
index 825cbc01..4c503eb2 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/conf/server.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/conf/server.xml
@@ -32,13 +32,14 @@
<Service name="Catalina">
<Connector connectionTimeout="20000" port="8486" protocol="HTTP/1.1" redirectPort="8443" />
<Connector port="8821" protocol="AJP/1.3" redirectPort="8443" />
+<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="true"
keystoreFile="conf/server.p12" keystorePass="Changeme_123" keystoreType="PKCS12"
truststoreFile="conf/trust.jks" truststoreType="JKS" truststorePass="Changeme_123"
sslProtocol="TLS"
ciphers="TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA" connectionTimeout="20000"/>
-
+-->
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
index 2f2c8913..8a3b2a28 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
+++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
@@ -36,21 +36,21 @@ set Names 'utf8';
/******************drop old table and create new***************************/
-DROP TABLE IF EXISTS vnfm_job_execution_record;
-CREATE TABLE `vnfm_job_execution_record` (
- `jobId` int(11) auto_increment primary key,
- `vnfInstanceId` varchar(60) DEFAULT NULL,
- `vnfmExecutionId` varchar(60) DEFAULT NULL,
- `vnfmInterfceName` varchar(60) DEFAULT NULL,
+DROP TABLE IF EXISTS vnfm_job_execution_info;
+CREATE TABLE `vnfm_job_execution_info` (
+ `job_id` int(11) auto_increment primary key,
+ `vnf_instance_id` varchar(60) DEFAULT NULL,
+ `vnfm_execution_id` varchar(60) DEFAULT NULL,
+ `vnfm_interface_name` varchar(60) DEFAULT NULL,
`status` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-DROP TABLE IF EXISTS vnfm_resource_record;
-CREATE TABLE `vnfm_resource_record` (
+DROP TABLE IF EXISTS vnfm_resource_info;
+CREATE TABLE `vnfm_resource_info` (
`id` int(11) auto_increment primary key,
`type` enum ('VDU','VL','CP','Storage') DEFAULT NULL,
- `resourceDefinitionId` varchar(60) DEFAULT NULL,
+ `resource_definition_id` varchar(60) DEFAULT NULL,
`vdu` varchar(60) DEFAULT NULL,
`status` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
index 0a159f91..ec7ed2b2 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
@@ -138,6 +138,11 @@
<version>1.12</version>
</dependency>
+<dependency>
+ <groupId>ca.juliusdavies</groupId>
+ <artifactId>not-yet-commons-ssl</artifactId>
+ <version>0.3.9</version>
+</dependency>
</dependencies>
<build>
<!--
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 2e05e1aa..55448096 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,15 +26,19 @@ 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.OpenStackAccessInfoV2;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OpenStackAccessInfoV3;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OpenstackV2Info;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OpenstackV3Info;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OtherVimInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VCloudAccessInfo;
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.VmwareVcloudInfo;
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;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AccessInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.GrantInfo;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimComputeResourceFlavour;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest;
@@ -57,39 +61,116 @@ public class Driver2CbamRequestConverter {
public CBAMInstantiateVnfRequest InstantiateReqConvert(InstantiateVnfRequest driverRequest,
NslcmGrantVnfResponse nslc, GrantInfo grant, VimComputeResourceFlavour vimco) {
CBAMInstantiateVnfRequest request = new CBAMInstantiateVnfRequest();
+
List<VimInfo> vims = new ArrayList<VimInfo>();
VimInfo vim = new VimInfo();
EndpointInfo inter = new EndpointInfo();
- OpenstackV3Info openstackV3 = new OpenstackV3Info();
- List<NslcmVimInfo> nslcmVim=nslc.getVim();
- for(int i=0;i<=nslcmVim.size();i++) {
- vim.setId(nslcmVim.get(i).getVimInfoId());
- openstackV3.setId(nslcmVim.get(i).getVimId());
- inter.setEndpoint(nslcmVim.get(i).getInterfaceEndpoint());
- openstackV3.setInterfaceInfo(inter);
- OpenStackAccessInfoV3 v3 = new OpenStackAccessInfoV3();
- List<AccessInfo> accessInfo=nslcmVim.get(i).getAccessInfo();
- for(int j=0;j<=accessInfo.size();j++) {
- v3.setUsername(accessInfo.get(j).getUsername());
- v3.setPassword(accessInfo.get(j).getPassword());
- }
- openstackV3.setAccessInfo(v3);
- }
-
- vims.add(vim);
List<ExtVirtualLinkData> list = new ArrayList<ExtVirtualLinkData>();
ExtVirtualLinkData ext = new ExtVirtualLinkData();
-
- ext.setResourceId(grant.getResourceDefinitionId());
- ext.setVimId(grant.getVimId());
List<VnfExtCpData> cps = new ArrayList<VnfExtCpData>();
VnfExtCpData cp = new VnfExtCpData();
- cp.setCpdId(vimco.getVduId());
- ext.setExtCps(cps);
- request.setVims(vims);
+ OpenStackAccessInfoV3 v3 = new OpenStackAccessInfoV3();
+ OpenStackAccessInfoV2 v2 = new OpenStackAccessInfoV2();
+ VCloudAccessInfo vcloudInfo = new VCloudAccessInfo();
+ if(vim.getVimInfoType().equals(VimInfoType.OPENSTACK_V2_INFO)) {
+ OpenstackV2Info openstackV2=new OpenstackV2Info();
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ExtVirtualLinkData> link=driverRequest.getExtVirtualLink();
+ for(int i=0;i<link.size();i++) {
+ vim.setId(link.get(i).getVim().getVimId());
+ inter.setEndpoint(link.get(i).getVim().getInterfaceEndpoint());
+ openstackV2.setId(link.get(i).getVim().getVimId());
+ openstackV2.setInterfaceInfo(inter);
+
+ ext.setResourceId(link.get(i).getNetworkId());// todo resourceId
+
+ cp.setCpdId(link.get(i).getCpdId());
+ cps.add(cp);
+ ext.setExtCps(cps);
+
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.AccessInfo> accessInfo=link.get(i).getVim().getAccessInfo();
+ for(int j=0;j<=accessInfo.size();j++) {
+ v2.setUsername(accessInfo.get(j).getUsername());
+ v2.setPassword(accessInfo.get(j).getPassword());
+ v2.setTenant(accessInfo.get(j).getTenant());
+ //todo region
+ }
+ openstackV2.setAccessInfo(v2);
+ vims.add(vim);
+ list.add(ext);
+ }
+ }else if(vim.getVimInfoType().equals(VimInfoType.OPENSTACK_V3_INFO)) {
+ OpenstackV3Info openstackV3=new OpenstackV3Info();
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ExtVirtualLinkData> link=driverRequest.getExtVirtualLink();
+ for(int i=0;i<link.size();i++) {
+ vim.setId(link.get(i).getVim().getVimId());
+ inter.setEndpoint(link.get(i).getVim().getInterfaceEndpoint());
+ openstackV3.setId(link.get(i).getVim().getVimId());
+ openstackV3.setInterfaceInfo(inter);
+
+ ext.setResourceId(link.get(i).getNetworkId());// todo resourceId
+
+ cp.setCpdId(link.get(i).getCpdId());
+ cps.add(cp);
+ ext.setExtCps(cps);
+
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.AccessInfo> accessInfo=link.get(i).getVim().getAccessInfo();
+ for(int j=0;j<=accessInfo.size();j++) {
+ v3.setUsername(accessInfo.get(j).getUsername());
+ v3.setPassword(accessInfo.get(j).getPassword());
+ //todo region project domain
+ }
+ openstackV3.setAccessInfo(v3);
+ vims.add(vim);
+ list.add(ext);
+ }
+
+ }else if(vim.getVimInfoType().equals(VimInfoType.OTHER_VIM_INFO)) {
+ OtherVimInfo other=new OtherVimInfo();
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ExtVirtualLinkData> link=driverRequest.getExtVirtualLink();
+ for(int i=0;i<link.size();i++) {
+ vim.setId(link.get(i).getVim().getVimId());
+ inter.setEndpoint(link.get(i).getVim().getInterfaceEndpoint());
+ other.setId(link.get(i).getVim().getVimId());
+
+ ext.setResourceId(link.get(i).getNetworkId());// todo resourceId
+
+ cp.setCpdId(link.get(i).getCpdId());
+ cps.add(cp);
+ ext.setExtCps(cps);
+ vims.add(vim);
+ list.add(ext);
+ }
+
+ }else if(vim.getVimInfoType().equals(VimInfoType.VMWARE_VCLOUD_INFO)) {
+ VmwareVcloudInfo vcloud=new VmwareVcloudInfo();
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ExtVirtualLinkData> link=driverRequest.getExtVirtualLink();
+ for(int i=0;i<link.size();i++) {
+ vim.setId(link.get(i).getVim().getVimId());
+ inter.setEndpoint(link.get(i).getVim().getInterfaceEndpoint());
+ vcloud.setId(link.get(i).getVim().getVimId());
+ vcloud.setInterfaceInfo(inter);
+
+ ext.setResourceId(link.get(i).getNetworkId());// todo resourceId
+
+ cp.setCpdId(link.get(i).getCpdId());
+ cps.add(cp);
+ ext.setExtCps(cps);
+
+
+ List<org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.AccessInfo> accessInfo=link.get(i).getVim().getAccessInfo();
+ for(int j=0;j<=accessInfo.size();j++) {
+ vcloudInfo.setUsername(accessInfo.get(j).getUsername());
+ vcloudInfo.setPassword(accessInfo.get(j).getPassword());
+ }
+ vcloud.setAccessInfo(vcloudInfo);
+ vims.add(vim);
+ list.add(ext);
+ }
+
+ }
request.setFlavourId(driverRequest.getFlavourId());
+ request.setVims(vims);
request.setExtVirtualLinks(list);
- // resquest.setVnfInstanceId(driverRequest.getExtVirtualLink().get(0).getVlInstanceId());
return request;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
index 79fb10f7..236a17e6 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
@@ -101,6 +101,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{
CBAMCreateVnfRequest cbamRequest = requestConverter.createReqConvert(driverRequest);
CBAMCreateVnfResponse cbamResponse = cbamMgmr.createVnf(cbamRequest);
String vnfInstanceId = cbamResponse.getId();
+
Long jobId = saveCreateVnfJob(vnfInstanceId);
driverResponse = responseConverter.createRspConvert(cbamResponse, jobId);
@@ -220,6 +221,11 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{
}
public String buildVnfmHttpPathById(String vnfmId) throws ClientProtocolException, IOException, VnfmDriverException {
+
+ return null;
+ }
+
+ public String buildVnfmHttpPathByRealId(String vnfmId) throws ClientProtocolException, IOException, VnfmDriverException {
AaiVnfmInfo vnfmInfo = aaiMgmr.queryVnfm(vnfmId);
logger.info("vnfmInfo in AAI is {}", gson.toJson(vnfmInfo));
if(isVnfmInfoValid(vnfmId, vnfmInfo))
@@ -238,7 +244,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{
}
private boolean isVnfmInfoValid(String vnfmId, AaiVnfmInfo vnfmInfo) {
- return vnfmInfo == null || !vnfmId.equalsIgnoreCase(vnfmInfo.getVnfmId()) || vnfmInfo.getEsrSystemInfoList() == null || vnfmInfo.getEsrSystemInfoList().isEmpty();
+ return vnfmInfo == null || vnfmInfo.getEsrSystemInfoList() == null || vnfmInfo.getEsrSystemInfoList().isEmpty();
}
public void setRequestConverter(Driver2CbamRequestConverter requestConverter) {
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
index 4598fa59..4fa74d5e 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
@@ -51,7 +51,7 @@ public class CatalogMgmrImpl implements CatalogMgmrInf{
String responseStr = httpClientProcessor.process(url, RequestMethod.GET, null, null).getContent();
- logger.info("CbamMgmrImpl -> queryVnfPackage, responseStr is " + responseStr);
+ logger.info("CatalogMgmrImpl -> queryVnfPackage, responseStr is " + responseStr);
CatalogQueryVnfResponse resp = gson.fromJson(responseStr, CatalogQueryVnfResponse.class);
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/SslConfInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/SslConfInfo.java
new file mode 100644
index 00000000..4186114a
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/bo/SslConfInfo.java
@@ -0,0 +1,74 @@
+/*
+ * 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.cbam.bo;
+
+public class SslConfInfo {
+ private String trustStore;
+ private String trustStoreType;
+ private String trustStorePass;
+ private String keyStore;
+ private String keyStoreType;
+ private String keyStorePass;
+
+ public String getTrustStore() {
+ return trustStore;
+ }
+
+ public void setTrustStore(String trustStore) {
+ this.trustStore = trustStore;
+ }
+
+ public String getTrustStoreType() {
+ return trustStoreType;
+ }
+
+ public void setTrustStoreType(String trustStoreType) {
+ this.trustStoreType = trustStoreType;
+ }
+
+ public String getTrustStorePass() {
+ return trustStorePass;
+ }
+
+ public void setTrustStorePass(String trustStorePass) {
+ this.trustStorePass = trustStorePass;
+ }
+
+ public String getKeyStore() {
+ return keyStore;
+ }
+
+ public void setKeyStore(String keyStore) {
+ this.keyStore = keyStore;
+ }
+
+ public String getKeyStoreType() {
+ return keyStoreType;
+ }
+
+ public void setKeyStoreType(String keyStoreType) {
+ this.keyStoreType = keyStoreType;
+ }
+
+ public String getKeyStorePass() {
+ return keyStorePass;
+ }
+
+ public void setKeyStorePass(String keyStorePass) {
+ this.keyStorePass = keyStorePass;
+ }
+
+}
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 dc6a6189..49a51f3a 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
@@ -16,7 +16,10 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.impl;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.util.HashMap;
import org.apache.http.client.ClientProtocolException;
@@ -37,7 +40,6 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfResponse;
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.common.util.CommonUtil;
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;
@@ -283,19 +285,93 @@ public class CbamMgmrImpl implements CbamMgmrInf {
} catch (JSONException e) {
logger.error("retrieveTokenError ", e);
}
-
String url = adaptorEnv.getCbamApiUriFront() + httpPath;
+ String command = "curl --insecure -X POST -H \"Authorization: bearer " + token + "\" --form content=@" + filePath + " " + url;
+ StringBuffer respStr = new StringBuffer();
+ try {
+ logger.info("start to upload file.");
+ String os = System.getProperty("os.name");
+ String[] cmd = {"cmd", "/C", command};
+ if(!os.toLowerCase().startsWith("win")){
+ cmd = new String[]{"/bin/sh"," -c ", command};
+ }
+ Process process = Runtime.getRuntime().exec(cmd);
+ InputStream fis=process.getInputStream();
+ InputStreamReader isr=new InputStreamReader(fis);
+ BufferedReader br=new BufferedReader(isr);
+ String line=null;
+ while((line = br.readLine())!=null)
+ {
+ respStr.append(line);
+ }
+
+ } catch (Exception e) {
+ logger.error("operateCbamHttpUploadTask error", e);
+ }
- HashMap<String, String> map = new HashMap<>();
- map.put(CommonConstants.AUTHORIZATION, "bearer " + token);
- map.put(CommonConstants.CONTENT_TYPE, "multipart/form-data, boundary=--fsgdsfgjgjdsgdfjgjgj");
- byte[] fileBytes = CommonUtil.getBytes(filePath);
- logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, url is " + url);
- logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, token is " + token);
- logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, bodyPostStr byte lenth is " + fileBytes.length);
-
- return httpClientProcessor.processBytes(url, method, map, fileBytes);
+// HashMap<String, String> map = new HashMap<>();
+// map.put(CommonConstants.AUTHORIZATION, "bearer " + token);
+// map.put(CommonConstants.CONTENT_TYPE, "multipart/form-data, boundary=---CFSGSSGGSGdssdfsdhd---");
+// byte[] fileBytes = CommonUtil.getBytes(filePath);
+// logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, url is " + url);
+// logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, token is " + token);
+// logger.info("CbamMgmrImpl -> operateCbamHttpUploadTask, bodyPostStr byte lenth is " + fileBytes.length);
+
+// return httpClientProcessor.processBytes(url, method, map, fileBytes);
+
+ HttpResult hResult = new HttpResult();
+ hResult.setContent(respStr.toString());
+ hResult.setStatusCode(200);
+ return hResult;
+
+// String charset = "UTF-8";
+// File uploadFile1 = new File(filePath);
+// String requestURL = url;
+// HttpResult result = new HttpResult();
+//
+// try {
+// MultipartUtility multipart = new MultipartUtility(requestURL, charset);
+//
+// multipart.addHeaderField("User-Agent", "CodeJava");
+// multipart.addHeaderField(CommonConstants.AUTHORIZATION, "bearer " + token);
+//
+// multipart.addFilePart("fileUpload", uploadFile1);
+//
+// List<String> response = multipart.finish();
+//
+// result.setContent(Arrays.deepToString(response.toArray(new String[0])));
+// result.setStatusCode(200);
+// } catch (Exception ex) {
+// logger.error("CbamMgmrImpl -> operateCbamHttpUploadTask, error ", ex);
+// result.setStatusCode(500);
+// }
+//
+// return result;
}
+
+// public static String postByHttps(String url, String body, Object contentType) {
+// String result = "";
+// Protocol https = new Protocol("https", new HTTPSSecureProtocolSocketFactory(), 443);
+// Protocol.registerProtocol("https", https);
+// PostMethod post = new PostMethod(url);
+// HttpClient client = new HttpClient();
+// try {
+// post.setRequestHeader("Content-Type", contentType);
+// post.setRequestBody(body);
+// client.executeMethod(post);
+// result = post.getResponseBodyAsString();
+// Protocol.unregisterProtocol("https");
+// return result;
+// } catch (HttpException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// } catch(Exception e) {
+// e.printStackTrace();
+// }
+//
+// return "error";
+// }
public HttpClientProcessorInf getHttpClientProcessor() {
return httpClientProcessor;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/MultipartUtility.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/MultipartUtility.java
new file mode 100644
index 00000000..d9203137
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/MultipartUtility.java
@@ -0,0 +1,291 @@
+/*
+ * 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.cbam.impl;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.KeyStore;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.log4j.Logger;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.SslConfInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.util.CommonUtil;
+
+import com.google.gson.Gson;
+
+/**
+ * This utility class provides an abstraction layer for sending multipart HTTP
+ * POST requests to a web server.
+ * @author www.codejava.net
+ *
+ */
+public class MultipartUtility {
+ private static final Logger logger = Logger.getLogger(MultipartUtility.class);
+ private final String boundary;
+ private static final String LINE_FEED = "\r\n";
+ private HttpsURLConnection httpConn;
+ private String charset;
+ private OutputStream outputStream;
+ private PrintWriter writer;
+ private Gson gson = new Gson();
+
+ /**
+ * This constructor initializes a new HTTP POST request with content type
+ * is set to multipart/form-data
+ * @param requestURL
+ * @param charset
+ * @throws IOException
+ */
+ public MultipartUtility(String requestURL, String charset)
+ throws Exception {
+ this.charset = charset;
+
+ // creates a unique boundary based on time stamp
+ boundary = "---" + System.currentTimeMillis() + "---";
+
+ HostnameVerifier hv = new HostnameVerifier() {
+ public boolean verify(String urlHostName, SSLSession session) {
+ return true;
+ }
+ };
+ TrustManager[] trustAllCerts = new TrustManager[1];
+ TrustManager tm = new TrustManager() {
+
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ public boolean isServerTrusted(X509Certificate[] certs) {
+ return true;
+ }
+
+ public boolean isClientTrusted(X509Certificate[] certs) {
+ return true;
+ }
+
+ public void checkServerTrusted(X509Certificate[] certs, String authType)
+ throws CertificateException {
+ return;
+ }
+
+ public void checkClientTrusted(X509Certificate[] certs, String authType)
+ throws CertificateException {
+ return;
+ }
+ };
+ trustAllCerts[0] = tm;
+ SSLContext sslContext = SSLContext.getInstance("SSL");
+ String filePath = "/etc/conf/sslconf.json";
+ String fileContent = CommonUtil.getJsonStrFromFile(filePath);
+ sslContext.init(createKeyManager(gson.fromJson(fileContent, SslConfInfo.class)), createTrustManager(gson.fromJson(fileContent, SslConfInfo.class)), new SecureRandom());
+ sslContext.init(null, trustAllCerts, null);
+ sslContext.init(null, new TrustManager[] {new TrustAnyTrustManager()}, new SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
+ HttpsURLConnection.setDefaultHostnameVerifier(hv);
+
+ URL url = new URL(requestURL);
+ httpConn = (HttpsURLConnection) url.openConnection();
+ httpConn.setRequestMethod("POST");
+ httpConn.setUseCaches(false);
+ httpConn.setDoOutput(true); // indicates POST method
+ httpConn.setDoInput(true);
+ httpConn.setRequestProperty("Content-Type",
+ "multipart/form-data; boundary=" + boundary);
+ httpConn.setRequestProperty("User-Agent", "CodeJava Agent");
+ httpConn.setRequestProperty("Test", "Bonjour");
+ outputStream = httpConn.getOutputStream();
+ writer = new PrintWriter(new OutputStreamWriter(outputStream, charset),
+ true);
+ }
+
+ private static class TrustAnyTrustManager implements X509TrustManager {
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[] {};
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ // NOSONAR
+ }
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ // NOSONAR
+ }
+ }
+
+ private KeyManager[] createKeyManager(SslConfInfo sslConf) {
+ KeyManager[] kms = null;
+ try {
+ String CERT_STORE = "/etc/conf/server.p12";
+ String CERT_STORE_PASSWORD = "Changeme_123";
+ String KEY_STORE_TYPE = "PKCS12";
+ if(sslConf != null) {
+ CERT_STORE = sslConf.getKeyStore();
+ CERT_STORE_PASSWORD = sslConf.getKeyStorePass();
+ KEY_STORE_TYPE = sslConf.getKeyStoreType();
+ }
+ // load jks file
+ FileInputStream f_certStore = new FileInputStream(CommonUtil.getAppRoot() + CERT_STORE);
+ KeyStore ks = KeyStore.getInstance(KEY_STORE_TYPE);
+ ks.load(f_certStore, CERT_STORE_PASSWORD.toCharArray());
+ f_certStore.close();
+
+ // init and create
+ String alg = KeyManagerFactory.getDefaultAlgorithm();
+ KeyManagerFactory kmFact = KeyManagerFactory.getInstance(alg);
+ kmFact.init(ks, CERT_STORE_PASSWORD.toCharArray());
+
+ kms = kmFact.getKeyManagers();
+ } catch(Exception e) {
+ logger.error("create KeyManager fail!", e);
+ }
+ return kms;
+ }
+
+ private TrustManager[] createTrustManager(SslConfInfo sslConf) {
+ TrustManager[] tms = null;
+ try {
+
+ String TRUST_STORE = "/etc/conf/trust.jks";
+ String TRUST_STORE_PASSWORD = "Changeme_123";
+ String TRUST_STORE_TYPE = "jks";
+ if(sslConf != null) {
+ TRUST_STORE = sslConf.getTrustStore();
+ TRUST_STORE_PASSWORD = sslConf.getTrustStorePass();
+ TRUST_STORE_TYPE = sslConf.getTrustStoreType();
+ }
+ String jksFilePath1 =CommonUtil.getAppRoot() + TRUST_STORE;
+ logger.info("jks path is " + jksFilePath1);
+ FileInputStream f_trustStore = new FileInputStream(jksFilePath1);
+ KeyStore ks = KeyStore.getInstance(TRUST_STORE_TYPE);
+ ks.load(f_trustStore, TRUST_STORE_PASSWORD.toCharArray());
+ f_trustStore.close();
+
+ String alg = TrustManagerFactory.getDefaultAlgorithm();
+ TrustManagerFactory tmFact = TrustManagerFactory.getInstance(alg);
+ tmFact.init(ks);
+ tms = tmFact.getTrustManagers();
+
+ } catch(Exception e) {
+ logger.error("create TrustManager fail!", e);
+ }
+ return tms;
+ }
+
+
+ /**
+ * Adds a upload file section to the request
+ * @param fieldName name attribute in <input type="file" name="..." />
+ * @param uploadFile a File to be uploaded
+ * @throws IOException
+ */
+ public void addFilePart(String fieldName, File uploadFile)
+ throws IOException {
+ String fileName = uploadFile.getName();
+ writer.append("--" + boundary).append(LINE_FEED);
+ writer.append(
+ "Content-Disposition: form-data; name=\"" + fieldName
+ + "\"; filename=\"" + fileName + "\"")
+ .append(LINE_FEED);
+ writer.append(
+ "Content-Type: "
+ + URLConnection.guessContentTypeFromName(fileName))
+ .append(LINE_FEED);
+ writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
+ writer.append(LINE_FEED);
+ writer.flush();
+
+ FileInputStream inputStream = new FileInputStream(uploadFile);
+ byte[] buffer = new byte[4096];
+ int bytesRead = -1;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ outputStream.flush();
+ inputStream.close();
+
+ writer.append(LINE_FEED);
+ writer.flush();
+ }
+
+ /**
+ * Adds a header field to the request.
+ * @param name - name of the header field
+ * @param value - value of the header field
+ */
+ public void addHeaderField(String name, String value) {
+ writer.append(name + ": " + value).append(LINE_FEED);
+ writer.flush();
+ }
+
+ /**
+ * Completes the request and receives response from the server.
+ * @return a list of Strings as response in case the server returned
+ * status OK, otherwise an exception is thrown.
+ * @throws IOException
+ */
+ public List<String> finish() throws IOException {
+ List<String> response = new ArrayList<String>();
+
+ writer.append(LINE_FEED).flush();
+ writer.append("--" + boundary + "--").append(LINE_FEED);
+ writer.close();
+
+ // checks server's status code first
+ int status = httpConn.getResponseCode();
+ logger.info("MultipartUtility --> finish " + httpConn.getResponseMessage());
+ if (status == HttpsURLConnection.HTTP_OK) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ httpConn.getInputStream()));
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ response.add(line);
+ }
+ reader.close();
+ httpConn.disconnect();
+ } else {
+ throw new IOException("Server returned non-OK status: " + status);
+ }
+
+ return response;
+ }
+} \ No newline at end of file
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
index 1a41765f..1fed73f3 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
@@ -55,13 +55,18 @@ public class AdaptorEnv {
private String catalogApiUriFront;
//cbamApiFront is from aai query
+ @Value("${cbamApiUriFront}")
private String cbamApiUriFront;
+
+ @Value("${cbamUserName}")
private String cbamUserName;
+
+ @Value("${cbamPassword}")
private String cbamPassword;
private String msbApiUriFront;
-
+
// for retrieving token from CBAM, configured in application.properties
@Value("${grantType}")
private String grantType;
@@ -71,6 +76,19 @@ public class AdaptorEnv {
@Value("${clientSecret}")
private String clientSecret;
+
+ // for granting
+ @Value("${type}")
+ private String type;
+
+ @Value("${sizeOfStorage}")
+ private String sizeOfStorage;
+
+ @Value("${virtualMemSize}")
+ private String virtualMemSize;
+
+ @Value("${numVirtualCpu}")
+ private String numVirtualCpu;
public String getAaiServiceNameInMsb() {
return aaiServiceNameInMsb;
@@ -240,5 +258,37 @@ public class AdaptorEnv {
this.cbamPassword = cbamPassword;
}
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getSizeOfStorage() {
+ return sizeOfStorage;
+ }
+
+ public void setSizeOfStorage(String sizeOfStorage) {
+ this.sizeOfStorage = sizeOfStorage;
+ }
+
+ public String getVirtualMemSize() {
+ return virtualMemSize;
+ }
+
+ public void setVirtualMemSize(String virtualMemSize) {
+ this.virtualMemSize = virtualMemSize;
+ }
+
+ public String getNumVirtualCpu() {
+ return numVirtualCpu;
+ }
+
+ public void setNumVirtualCpu(String numVirtualCpu) {
+ this.numVirtualCpu = numVirtualCpu;
+ }
+
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/util/CommonUtil.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/util/CommonUtil.java
index c49d1f04..e59a301a 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/util/CommonUtil.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/util/CommonUtil.java
@@ -59,7 +59,7 @@ public final class CommonUtil {
return fileContent;
}
- private static String getAppRoot() {
+ public static String getAppRoot() {
String appRoot = System.getProperty("catalina.base");
if(appRoot != null) {
appRoot = getCanonicalPath(appRoot);
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 a2be9f12..fd1864eb 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
@@ -31,27 +31,27 @@ public class CommonConstants {
//AAI path get vnfm
// /external-system/esr-vnfm-list/esr-vnfm/{vnfm-id}/esr-system-info-list
- public static final String RetrieveVnfmListPath = "/external-system/esr-vnfm-list/esr-vnfm/%s/esr-system-info-list";
+ public static final String RetrieveVnfmListPath = "/aai/v11/external-system/esr-vnfm-list/esr-vnfm/%s/esr-system-info-list";
//Nslcm path
- public static final String NslcmGrantPath = "/ns/grantvnf";
- public static final String NslcmNotifyPath = "/vnfs/%s/Notify";
+ public static final String NslcmGrantPath = "/api/vnflcm/v1//ns/grantvnf";
+ public static final String NslcmNotifyPath = "/api/vnflcm/v1/vnfs/%s/Notify";
//Catalog path
- public static final String RetrieveVnfPackagePath = "/catalog/v1/vnfpackages/%s";
+ public static final String RetrieveVnfPackagePath = "/api/catalog/v1/vnfpackages/%s";
//CBAM -- Nokia VNFM path
public static final String CBAM_TOKEN_KEY = "access_token";
public static final String CbamRetrieveTokenPath="/auth/realms/cbam/protocol/openid-connect/token";
public static final String CbamRetrieveTokenPostStr="grant_type=password&client_id=%s&client_secret=%s&username=%s&password=%s";
- public static final String CbamCreateVnfPath="/vnfs";
- public static final String CbamInstantiateVnfPath="/vnfs/%s/instantiate";
- public static final String CbamQueryVnfPath="/vnfs/%s";
- public static final String CbamDeleteVnfPath="/vnfs/%s";
- public static final String CbamTerminateVnfPath="/vnfs/%s/terminate";
- public static final String CbamGetOperStatusPath="/operation_executions/%s";
- public static final String CbamScaleVnfPath = "/vnfs/%s/scale";
- public static final String CbamHealVnfPath="/vnfs/%s/heal";
+ public static final String CbamCreateVnfPath="/vnfm/lcm/v3/vnfs";
+ public static final String CbamInstantiateVnfPath="/vnfm/lcm/v3/vnfs/%s/instantiate";
+ public static final String CbamQueryVnfPath="/vnfm/lcm/v3/vnfs/%s";
+ public static final String CbamDeleteVnfPath="/vnfm/lcm/v3/vnfs/%s";
+ public static final String CbamTerminateVnfPath="/vnfm/lcm/v3/vnfs/%s/terminate";
+ public static final String CbamGetOperStatusPath="/vnfm/lcm/v3/operation_executions/%s";
+ public static final String CbamScaleVnfPath = "/vnfm/lcm/v3/vnfs/%s/scale";
+ public static final String CbamHealVnfPath="/vnfm/lcm/v3/vnfs/%s/heal";
public static final String CbamUploadVnfPackagePath="/api/catalog/adapter/vnfpackages";
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmJobExecutionInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmJobExecutionInfo.java
index 9c53c516..cf79b052 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmJobExecutionInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmJobExecutionInfo.java
@@ -16,6 +16,8 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean;
+import java.io.Serializable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -25,21 +27,22 @@ import javax.persistence.Table;
@Entity
-@Table(name = "vnfm_job_execution_record")
-public class VnfmJobExecutionInfo{
- private static final long serialVersionUID = -2880159539002942812L;
+@Table(name = "vnfm_job_execution_info")
+public class VnfmJobExecutionInfo implements Serializable {
+ private static final long serialVersionUID = -288015953900428312L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name = "job_id")
private long jobId;
- @Column(name = "vnfmExecutionId")
+ @Column(name = "vnfm_execution_id")
private String vnfmExecutionId;
- @Column(name = "vnfInstanceId")
+ @Column(name = "vnf_instance_id")
private String vnfInstanceId;
- @Column(name = "vnfmInterfceName")
+ @Column(name = "vnfm_interface_name")
private String vnfmInterfceName;
@Column(name = "status")
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java
index b245f2b8..dadb2b9f 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/db/bean/VnfmResourceInfo.java
@@ -16,16 +16,19 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean;
-import javax.persistence.Entity;
+import java.io.Serializable;
+
import javax.persistence.Column;
+import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
-@Table(name = "vnfm_resource_record")
-public class VnfmResourceInfo {
+@Table(name="vnfm_resource_info")
+public class VnfmResourceInfo implements Serializable {
+ private static final long serialVersionUID = -288015953900428312L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@@ -33,7 +36,7 @@ public class VnfmResourceInfo {
@Column(name = "type")
private ResourceType type;
- @Column(name = "resourceDefinitionId")
+ @Column(name = "resource_definition_id")
private String resourceDefinitionId;
@Column(name = "vdu")
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
index e5a77f7b..13f1014f 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java
@@ -16,12 +16,15 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@@ -30,12 +33,10 @@ import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.ssl.SSLContextBuilder;
-import org.apache.http.ssl.TrustStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -50,36 +51,54 @@ public class HttpClientUtils {
@Bean
public static HttpClientBuilder createHttpClientBuilder() {
- HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
-
- SSLContext sslContext = null;
+ org.apache.commons.httpclient.protocol.Protocol.unregisterProtocol("https");
+ SSLContext sslcontext = null;
try {
- sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
- public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
- return true;
- }
- }).build();
- } catch (Exception e) {
- logger.error("Error to createHttpClientBuilder", e);
- }
- httpClientBuilder.setSSLContext(sslContext);
-
- HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
-
- SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
- Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
- .register("http", PlainConnectionSocketFactory.getSocketFactory())
- .register("https", sslSocketFactory)
- .build();
-
- PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
- connMgr.setMaxTotal(200);
- connMgr.setDefaultMaxPerRoute(50);
- httpClientBuilder.setConnectionManager(connMgr);
+ sslcontext = createIgnoreVerifySSL();
+ } catch (KeyManagementException | NoSuchAlgorithmException e) {
+ logger.error("HttpRequestProcessor -> generateHttpClient exception. ", e);
+ }
+
+ Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
+ .register("http", PlainConnectionSocketFactory.INSTANCE)
+ .register("https", new SSLConnectionSocketFactory(sslcontext))
+ .build();
+
+ PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
+ connManager.setMaxTotal(200);
+ connManager.setDefaultMaxPerRoute(50);
+
+ HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(connManager);
return httpClientBuilder;
}
+ private static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {
+ SSLContext sc = SSLContext.getInstance("TLSv1.2");
+
+ X509TrustManager trustManager = new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(
+ java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
+ String paramString) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(
+ java.security.cert.X509Certificate[] paramArrayOfX509Certificate,
+ String paramString) throws CertificateException {
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ };
+
+ sc.init(null, new TrustManager[] { trustManager }, null);
+ return sc;
+ }
+
public static HttpRequestBase getHttpRequest(RequestMethod requestMethod) {
HttpRequestBase base = null;
switch(requestMethod) {
@@ -93,6 +112,8 @@ public class HttpClientUtils {
base = new HttpPost();
break;
}
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).setConnectionRequestTimeout(20000).build();
+ base.setConfig(requestConfig);
return base;
}
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java
index 8963dd49..2681be3f 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpRequestProcessor.java
@@ -30,9 +30,12 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMethod;
public class HttpRequestProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(HttpRequestProcessor.class);
private CloseableHttpClient httpClient;
private HttpRequestBase httpRequest;
@@ -47,6 +50,8 @@ public class HttpRequestProcessor {
httpRequest.setURI(URI.create(url));
HttpResponse response = httpClient.execute(httpRequest);
+ httpRequest.releaseConnection();
+// httpClient.close();
HttpResult httpResult = buildHttpResult(response);
return httpResult;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
index 1fb7138a..81cc281d 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
@@ -51,23 +51,27 @@ public class EnvVariablesInitialization implements ApplicationRunner {
return;
}
- try {
- handleAaiMsbServiceInfo();
- } catch (Exception e) {
- logger.error("handleAaiMsbServiceInfo error", e);
- }
-
- try {
- handleLcmMsbServiceInfo();
- } catch (Exception e) {
- logger.error("handleLcmMsbServiceInfo error", e);
- }
+ adaptorEnv.setAaiApiUriFront(adaptorEnv.getMsbApiUriFront());
+ adaptorEnv.setLcmApiUriFront(adaptorEnv.getMsbApiUriFront());
+ adaptorEnv.setCatalogApiUriFront(adaptorEnv.getMsbApiUriFront());
- try {
- handleCatalogMsbServiceInfo();
- } catch (Exception e) {
- logger.error("handleCatalogMsbServiceInfo error", e);
- }
+// try {
+// handleAaiMsbServiceInfo();
+// } catch (Exception e) {
+// logger.error("handleAaiMsbServiceInfo error", e);
+// }
+//
+// try {
+// handleLcmMsbServiceInfo();
+// } catch (Exception e) {
+// logger.error("handleLcmMsbServiceInfo error", e);
+// }
+//
+// try {
+// handleCatalogMsbServiceInfo();
+// } catch (Exception e) {
+// logger.error("handleCatalogMsbServiceInfo error", e);
+// }
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
index ccfe8f25..a30cf50b 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
@@ -18,6 +18,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo;
import java.util.List;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedCp;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVirtualLink;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVirtualStorage;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVnfc;
@@ -28,7 +29,6 @@ public class NslcmNotifyLCMEventsRequest {
@JsonProperty("status")
private CommonEnum.status status;
-
@JsonProperty("vnfInstanceId")
private String vnfInstanceId;
@JsonProperty("operation")
@@ -37,10 +37,14 @@ public class NslcmNotifyLCMEventsRequest {
private String jobId;
@JsonProperty("affectedVnfc")
private List<AffectedVnfc> affectedVnfc;
+ @JsonProperty("affectedCp")
+ private List<AffectedCp> affectedCp;
@JsonProperty("affectedVl")
private List<AffectedVirtualLink> affectedVl;
@JsonProperty("affectedVirtualStorage")
private List<AffectedVirtualStorage> affectedVirtualStorage;
+
+
public CommonEnum.status getStatus() {
return status;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AddResource.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AddResource.java
new file mode 100644
index 00000000..0bb58ec4
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AddResource.java
@@ -0,0 +1,62 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AddResource {
+ @JsonProperty("type")
+ private String type;
+
+ @JsonProperty("resourceTemplate")
+ private ResourceTemplate resourceTemplate;
+
+ @JsonProperty("resourceDefinitionId")
+ private int resourceDefinitionId;
+
+ @JsonProperty("vdu")
+ private String vdu;
+
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public ResourceTemplate getResourceTemplate() {
+ return resourceTemplate;
+ }
+ public void setResourceTemplate(ResourceTemplate resourceTemplate) {
+ this.resourceTemplate = resourceTemplate;
+ }
+ public int getResourceDefinitionId() {
+ return resourceDefinitionId;
+ }
+ public void setResourceDefinitionId(int resourceDefinitionId) {
+ this.resourceDefinitionId = resourceDefinitionId;
+ }
+ public String getVdu() {
+ return vdu;
+ }
+ public void setVdu(String vdu) {
+ this.vdu = vdu;
+ }
+
+
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AdditionalParam.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AdditionalParam.java
new file mode 100644
index 00000000..513e9df4
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AdditionalParam.java
@@ -0,0 +1,52 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AdditionalParam {
+ @JsonProperty("vnfmid")
+ private String vnfmid;
+ @JsonProperty("vimid")
+ private String vimid;
+ @JsonProperty("tenant")
+ private String tenant;
+
+ public String getVnfmid() {
+ return vnfmid;
+ }
+
+ public void setVnfmid(String vnfmid) {
+ this.vnfmid = vnfmid;
+ }
+
+ public String getVimid() {
+ return vimid;
+ }
+
+ public void setVimid(String vimid) {
+ this.vimid = vimid;
+ }
+
+ public String getTenant() {
+ return tenant;
+ }
+
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
+ }
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedCp.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedCp.java
new file mode 100644
index 00000000..299e6f57
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedCp.java
@@ -0,0 +1,86 @@
+/*
+ * 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.entity;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AffectedCp {
+
+ @JsonProperty("virtualLinkInstanceId")
+ private String virtualLinkInstanceId;
+ @JsonProperty("cpinstanceid")
+ private String cpinstanceid;
+ @JsonProperty("cpdid")
+ private String cpdid;
+ @JsonProperty("ownerType")
+ private String ownerType;
+ @JsonProperty("ownerId")
+ private String ownerId;
+ @JsonProperty("changeType")
+ private CommonEnum.changeType changeType;
+ @JsonProperty("portResource")
+ private PortResource portResource;
+
+ public String getVirtualLinkInstanceId() {
+ return virtualLinkInstanceId;
+ }
+ public void setVirtualLinkInstanceId(String virtualLinkInstanceId) {
+ this.virtualLinkInstanceId = virtualLinkInstanceId;
+ }
+ public String getCpinstanceid() {
+ return cpinstanceid;
+ }
+ public void setCpinstanceid(String cpinstanceid) {
+ this.cpinstanceid = cpinstanceid;
+ }
+ public String getCpdid() {
+ return cpdid;
+ }
+ public void setCpdid(String cpdid) {
+ this.cpdid = cpdid;
+ }
+ public String getOwnerType() {
+ return ownerType;
+ }
+ public void setOwnerType(String ownerType) {
+ this.ownerType = ownerType;
+ }
+ public String getOwnerId() {
+ return ownerId;
+ }
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
+ public CommonEnum.changeType getChangeType() {
+ return changeType;
+ }
+ public void setChangeType(CommonEnum.changeType changeType) {
+ this.changeType = changeType;
+ }
+ public PortResource getPortResource() {
+ return portResource;
+ }
+ public void setPortResource(PortResource portResource) {
+ this.portResource = portResource;
+ }
+
+
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedVirtualStorage.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedVirtualStorage.java
index 6139adb8..c16c5399 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedVirtualStorage.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/AffectedVirtualStorage.java
@@ -19,38 +19,44 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class AffectedVirtualStorage {
@JsonProperty("vsInstanceId")
- private String vsInstanceId;
+ private String vsInstanceId;
@JsonProperty("vsdId")
- private String vsdId;
-
+ private String vsdId;
@JsonProperty("changeType")
- private String changeType;
+ private String changeType;
@JsonProperty("storageResource")
- private String storageResource;
+ private String storageResource;
+
public String getVsInstanceId() {
return vsInstanceId;
}
+
public void setVsInstanceId(String vsInstanceId) {
this.vsInstanceId = vsInstanceId;
}
+
public String getVsdId() {
return vsdId;
}
+
public void setVsdId(String vsdId) {
this.vsdId = vsdId;
}
+
public String getChangeType() {
return changeType;
}
+
public void setChangeType(String changeType) {
this.changeType = changeType;
}
+
public String getStorageResource() {
return storageResource;
}
+
public void setStorageResource(String storageResource) {
this.storageResource = storageResource;
}
-
-
+
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/PortResource.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/PortResource.java
new file mode 100644
index 00000000..e39edf82
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/PortResource.java
@@ -0,0 +1,81 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class PortResource {
+
+ @JsonProperty("vimid")
+ private String vimid;
+ @JsonProperty("resourceid")
+ private String resourceid;
+ @JsonProperty("resourceName")
+ private String resourceName;
+ @JsonProperty("tenant")
+ private String tenant;
+ @JsonProperty("ipAddress")
+ private String ipAddress;
+ @JsonProperty("macAddress")
+ private String macAddress;
+ @JsonProperty("instId")
+ private String instId;
+
+ public String getVimid() {
+ return vimid;
+ }
+ public void setVimid(String vimid) {
+ this.vimid = vimid;
+ }
+ public String getResourceid() {
+ return resourceid;
+ }
+ public void setResourceid(String resourceid) {
+ this.resourceid = resourceid;
+ }
+ public String getResourceName() {
+ return resourceName;
+ }
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+ public String getTenant() {
+ return tenant;
+ }
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
+ }
+ public String getIpAddress() {
+ return ipAddress;
+ }
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+ public String getMacAddress() {
+ return macAddress;
+ }
+ public void setMacAddress(String macAddress) {
+ this.macAddress = macAddress;
+ }
+ public String getInstId() {
+ return instId;
+ }
+ public void setInstId(String instId) {
+ this.instId = instId;
+ }
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceDefinition.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceDefinition.java
index 4a10ae99..0439f606 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceDefinition.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceDefinition.java
@@ -15,22 +15,63 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
+import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ResourceDefinition {
- @JsonProperty("type")
+ @JsonProperty("vnfInstanceId")
+ private String vnfInstanceId;
+ @JsonProperty("addResource")
+ private List<AddResource> addResource;
+ @JsonProperty("vimId")
+ private String vimId;
+ @JsonProperty("additionalParam")
+ private AdditionalParam additionalParam;
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public List<AddResource> getAddResource() {
+ return addResource;
+ }
+
+ public void setAddResource(List<AddResource> addResource) {
+ this.addResource = addResource;
+ }
+
+ public String getVimId() {
+ return vimId;
+ }
+
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+ public AdditionalParam getAdditionalParam() {
+ return additionalParam;
+ }
+
+ public void setAdditionalParam(AdditionalParam additionalParam) {
+ this.additionalParam = additionalParam;
+ }
+
+ /*@JsonProperty("type")
private CommonEnum.type type;
@JsonProperty("resourceDefinitionId")
private String resourceDefinitionId;
@JsonProperty("vdu")
- private String vdu;
+ private String vdu;*/
- public CommonEnum.type getType() {
+ /*public CommonEnum.type getType() {
return type;
}
@@ -53,7 +94,7 @@ public class ResourceDefinition {
public void setVdu(String vdu) {
this.vdu = vdu;
}
-
+ */
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceTemplate.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceTemplate.java
new file mode 100644
index 00000000..35ad4054
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/ResourceTemplate.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.nslcm.bo.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ResourceTemplate {
+ @JsonProperty("virtualStorageDescriptor")
+ private VirtualStorageDescriptor virtualStorageDescriptor;
+ @JsonProperty("virtualComputeDescriptor")
+ private VirtualComputeDescriptor virtualComputeDescriptor;
+
+
+ public VirtualStorageDescriptor getVirtualStorageDescriptor() {
+ return virtualStorageDescriptor;
+ }
+ public void setVirtualStorageDescriptor(VirtualStorageDescriptor virtualStorageDescriptor) {
+ this.virtualStorageDescriptor = virtualStorageDescriptor;
+ }
+ public VirtualComputeDescriptor getVirtualComputeDescriptor() {
+ return virtualComputeDescriptor;
+ }
+ public void setVirtualComputeDescriptor(VirtualComputeDescriptor virtualComputeDescriptor) {
+ this.virtualComputeDescriptor = virtualComputeDescriptor;
+ }
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualComputeDescriptor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualComputeDescriptor.java
new file mode 100644
index 00000000..ec937e83
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualComputeDescriptor.java
@@ -0,0 +1,40 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class VirtualComputeDescriptor {
+ @JsonProperty("virtualMemory")
+ private VirtualMemory virtualMemory;
+ @JsonProperty("virtualCpu")
+ private VirtualCpu virtualCpu;
+ public VirtualMemory getVirtualMemory() {
+ return virtualMemory;
+ }
+ public void setVirtualMemory(VirtualMemory virtualMemory) {
+ this.virtualMemory = virtualMemory;
+ }
+ public VirtualCpu getVirtualCpu() {
+ return virtualCpu;
+ }
+ public void setVirtualCpu(VirtualCpu virtualCpu) {
+ this.virtualCpu = virtualCpu;
+ }
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualCpu.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualCpu.java
new file mode 100644
index 00000000..38e57151
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualCpu.java
@@ -0,0 +1,34 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class VirtualCpu {
+ @JsonProperty("numVirtualCpu")
+ private int numVirtualCpu;
+
+ public int getNumVirtualCpu() {
+ return numVirtualCpu;
+ }
+
+ public void setNumVirtualCpu(int numVirtualCpu) {
+ this.numVirtualCpu = numVirtualCpu;
+ }
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualMemory.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualMemory.java
new file mode 100644
index 00000000..95df117c
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualMemory.java
@@ -0,0 +1,35 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class VirtualMemory {
+ @JsonProperty("virtualMemSize")
+ private int virtualMemSize;
+
+ public int getVirtualMemSize() {
+ return virtualMemSize;
+ }
+
+ public void setVirtualMemSize(int virtualMemSize) {
+ this.virtualMemSize = virtualMemSize;
+ }
+
+
+
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualStorageDescriptor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualStorageDescriptor.java
new file mode 100644
index 00000000..6e5247c9
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VirtualStorageDescriptor.java
@@ -0,0 +1,52 @@
+/*
+ * 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.entity;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class VirtualStorageDescriptor {
+ @JsonProperty("sizeOfStorage")
+ private int sizeOfStorage;
+ @JsonProperty("typeOfStorage")
+ private String typeOfStorage;
+ @JsonProperty("swImageDescriptor")
+ private String swImageDescriptor;
+
+ public int getSizeOfStorage() {
+ return sizeOfStorage;
+ }
+
+ public void setSizeOfStorage(int sizeOfStorage) {
+ this.sizeOfStorage = sizeOfStorage;
+ }
+
+ public String getTypeOfStorage() {
+ return typeOfStorage;
+ }
+
+ public void setTypeOfStorage(String typeOfStorage) {
+ this.typeOfStorage = typeOfStorage;
+ }
+
+ public String getSwImageDescriptor() {
+ return swImageDescriptor;
+ }
+
+ public void setSwImageDescriptor(String swImageDescriptor) {
+ this.swImageDescriptor = swImageDescriptor;
+ }
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/VimInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/VimInfo.java
index bd4e9d7a..ed226775 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/VimInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/bo/entity/VimInfo.java
@@ -16,6 +16,8 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity;
+import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class VimInfo {
@@ -26,10 +28,10 @@ public class VimInfo {
private String vimId;
@JsonProperty("interfaceInfo")
- private InterfaceInfo interfaceInfo;
+ private List<InterfaceInfo> interfaceInfo;
@JsonProperty("accessInfo")
- private AccessInfo accessInfo;
+ private List<AccessInfo> accessInfo;
@JsonProperty("interfaceEndpoint")
private String interfaceEndpoint;
@@ -50,19 +52,21 @@ public class VimInfo {
this.vimId = vimId;
}
- public InterfaceInfo getInterfaceInfo() {
+
+
+ public List<InterfaceInfo> getInterfaceInfo() {
return interfaceInfo;
}
- public void setInterfaceInfo(InterfaceInfo interfaceInfo) {
+ public void setInterfaceInfo(List<InterfaceInfo> interfaceInfo) {
this.interfaceInfo = interfaceInfo;
}
- public AccessInfo getAccessInfo() {
+ public List<AccessInfo> getAccessInfo() {
return accessInfo;
}
- public void setAccessInfo(AccessInfo accessInfo) {
+ public void setAccessInfo(List<AccessInfo> accessInfo) {
this.accessInfo = accessInfo;
}
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 e55c8677..8dd68323 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
@@ -20,8 +20,8 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
-import org.apache.http.HttpStatus;
import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpStatus;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.exception.VnfmDriverException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfResponse;
@@ -31,7 +31,6 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.OperStatusVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.QueryVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfResponse;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.SwaggerInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.inf.VnfmDriverMgmrInf;
@@ -60,17 +59,9 @@ public class VnfmDriverController {
@RequestMapping(value = "/swagger.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
- public SwaggerInfo apidoc() {
+ public String apidoc() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
- SwaggerInfo info = null;
- try {
- String json = IOUtils.toString(classLoader.getResourceAsStream("swagger.json"));
- info = gson.fromJson(json, SwaggerInfo.class);
- } catch (IOException e) {
- logger.error("", e);
- }
-
- return info;
+ return IOUtils.toString(classLoader.getResourceAsStream("swagger.json"));
}
@RequestMapping(value = "/{vnfmId}/vnfs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@@ -82,6 +73,8 @@ public class VnfmDriverController {
InstantiateVnfResponse response = vnfmDriverMgmr.instantiateVnf(request, vnfmId);
+ logger.info("InstantiateVnfResponse is " + gson.toJson(response));
+
httpResponse.setStatus(HttpStatus.SC_CREATED);
return response;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties
index 850e6cad..5b7f742d 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties
@@ -16,6 +16,13 @@
server.error.whitelabel.enabled=false
## for MySql Database begin ##
+spring.jpa.show-sql=true
+spring.jpa.generate-ddl=true
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
+spring.jackson.serialization.indent_output=false
+
+
spring.datasource.username=vnfm
spring.datasource.password=vnfmpass
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vnfm_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round&useSSL=false
@@ -43,7 +50,16 @@ catalogVersionInMsb=v1
## configure service name and version of MSB services AAI/LCM/Catalog end ##
## for retrieving token from CBAM begin ##
-grantType=grantType1
-clientId=clientId1
-clientSecret=clientSecret1
+grantType=password
+clientId=Orchestrator
+clientSecret=.1.qtcePQQ3.BqxiGBeyWUjREnGooRr6x1
+cbamApiUriFront=https://172.30.24.3
+cbamUserName=cbam
+cbamPassword=Nokia@123
## for retrieving token from CBAM end ##
+
+## Granting part
+type=vdu
+sizeOfStorage=40
+virtualMemSize=8192
+numVirtualCpu=4
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/register.properties b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/register.properties
index 04929955..59babb8c 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/register.properties
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/register.properties
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
-serviceName=nokia-vnfm-driver
+serviceName=nokiavnfmdriver
version=v1
url=/api/nokiavnfmdriver/v1
protocol=HTTP
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 d7834465..d5a0e100 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
@@ -139,13 +139,13 @@ public class VnfmDriverMgmrImplTest {
@Test
public void testBuildVnfmHttpPathById() throws ClientProtocolException, IOException {
- String vnfmHttpPathHead = vnfmDriverMgmr.buildVnfmHttpPathById(vnfmId);
+ String vnfmHttpPathHead = vnfmDriverMgmr.buildVnfmHttpPathByRealId(vnfmId);
Assert.assertEquals("result is ", cbamHttpHead, vnfmHttpPathHead);
}
@Test(expected = VnfmDriverException.class)
public void testBuildVnfmHttpPathByIdException() throws ClientProtocolException, IOException{
- vnfmDriverMgmr.buildVnfmHttpPathById(vnfmId + "001");
+ vnfmDriverMgmr.buildVnfmHttpPathByRealId(vnfmId + "001");
}
@Test
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 47c33bf1..c55b39d9 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
@@ -40,11 +40,18 @@ 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.AddResource;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AdditionalParam;
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.ResourceTemplate;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VirtualComputeDescriptor;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VirtualCpu;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VirtualMemory;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VirtualStorageDescriptor;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -73,8 +80,35 @@ public class NslcmMgmrImplTest {
public void testGrantVnf() throws ClientProtocolException, IOException
{
ResourceDefinition resource = new ResourceDefinition();
- resource.setResourceDefinitionId("resourceDefinitionId");
- resource.setVdu("vdu");
+ resource.setVimId("vimId");
+ resource.setVnfInstanceId("vnfInstanceId");
+
+ List<AddResource> addresources=new ArrayList<AddResource>();
+ AddResource addresource=new AddResource();
+ addresource.setResourceDefinitionId(1);
+ addresource.setType("type");
+ addresource.setVdu("vdu");
+ ResourceTemplate temp=new ResourceTemplate();
+ VirtualComputeDescriptor compute=new VirtualComputeDescriptor();
+ VirtualCpu cpu=new VirtualCpu();
+ cpu.setNumVirtualCpu(1);
+ VirtualMemory memory=new VirtualMemory();
+ compute.setVirtualCpu(cpu);
+ compute.setVirtualMemory(memory);
+ VirtualStorageDescriptor storage=new VirtualStorageDescriptor();
+ storage.setSizeOfStorage(1);
+ storage.setSwImageDescriptor("swImageDescriptor");
+ storage.setSizeOfStorage(1);
+ temp.setVirtualComputeDescriptor(compute);
+ temp.setVirtualStorageDescriptor(storage);
+ addresources.add(addresource);
+ AdditionalParam param=new AdditionalParam();
+ param.setTenant("tenant");
+ param.setVimid("vimid");
+ param.setVnfmid("vnfmid");
+
+ resource.setAdditionalParam(param);
+ resource.setAddResource(addresources);
NslcmGrantVnfResponse gresponse = new NslcmGrantVnfResponse();
List<KeyValuePair> additionalParam1 = new ArrayList<KeyValuePair>();