diff options
Diffstat (limited to 'nokia/vnfmdriver')
119 files changed, 8636 insertions, 0 deletions
diff --git a/nokia/vnfmdriver/pom.xml b/nokia/vnfmdriver/pom.xml new file mode 100644 index 00000000..ec9dff06 --- /dev/null +++ b/nokia/vnfmdriver/pom.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!-- + 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia</groupId> + <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokia</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId> + <artifactId>vnfmdriver</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>vfc/nfvo/drivers/vnfm/svnfm/nokia/vnfmdriver</name> + <description>nfvo vnfmdriver</description> + <modules> + <module>vfcadaptor</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.19</version> + <configuration> + <testFailureIgnore>true</testFailureIgnore> + <includes> + <include>**/*Spec*</include> + <include>**/Test*.java</include> + <include>**/*Test.java</include> + <include>**/*TestCase.java</include> + <include>**/Test*.scala</include> + <include>**/*Test.scala</include> + <include>**/*TestCase.scala</include> + </includes> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + <version>2.7</version> + <configuration> + <formats> + <format>html</format> + <format>xml</format> + </formats> + <instrumentation> + <excludes> + <exclude>org/**/*Test.class</exclude> + </excludes> + </instrumentation> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/nokia/vnfmdriver/version.properties b/nokia/vnfmdriver/version.properties new file mode 100644 index 00000000..9182f2a9 --- /dev/null +++ b/nokia/vnfmdriver/version.properties @@ -0,0 +1,13 @@ +########################################################### +# Versioning variables +# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) +# because they are used in Jenkins, whose plug-in doesn't support + +major=1 +minor=0 +patch=0 + +base_version=${major}.${minor}.${patch} + +release_version=${base_version} +snapshot_version=${base_version}-SNAPSHOT
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/pom.xml new file mode 100644 index 00000000..ceea2dfb --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/pom.xml @@ -0,0 +1,38 @@ + <!-- + 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>vnfmadapter</artifactId> + <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <artifactId>vnfmadapter-service-root</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>vfc/nfvo/drivers/vnfm/svnfm/nokia/vnfmdriver/vfcadaptorservice</name> + <packaging>pom</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <package.name>vfcadaptor-service</package.name> + </properties> + + <modules> + <module>adaptor</module> + <module>docker</module> + </modules> + +</project> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml new file mode 100644 index 00000000..85a1b18e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml @@ -0,0 +1,189 @@ + <!-- + 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + +<modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId> + <artifactId>vnfmadapter-service-root</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <artifactId>vfcadaptor</artifactId> + <name>vfc/nfvo/drivers/vnfm/svnfm/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor</name> + <packaging>war</packaging> + + <properties> + <springVersion>4.3.11.RELEASE</springVersion> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.6.5</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.6.5</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + <version>1.9.13</version> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-library</artifactId> + <version>1.3</version> + </dependency> + + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.8.1</version> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>4.0.0</version> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + <version>${springVersion}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${springVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-orm</artifactId> + <version>${springVersion}</version> + </dependency> + + <dependency> + <groupId>dom4j</groupId> + <artifactId>dom4j</artifactId> + <version>1.6.1</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.10.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.jayway.jsonpath</groupId> + <artifactId>json-path</artifactId> + <version>2.4.0</version> + <scope>test</scope> + </dependency> +<dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20170516</version> +</dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.2</version> + </dependency> + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.2</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.12</version> + </dependency> + + <dependency> + <groupId>javax.persistence</groupId> + <artifactId>persistence-api</artifactId> + <version>1.0.2</version> + </dependency> + + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.5.4-Final</version> + <type>pom</type> + </dependency> + <!-- + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>5.2.11.Final</version> + </dependency> + --> + </dependencies> + <build> + <finalName>vfcadaptor</finalName> + </build> +</project> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Cbam2DriverResponseConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Cbam2DriverResponseConverter.java new file mode 100644 index 00000000..a6aca56d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Cbam2DriverResponseConverter.java @@ -0,0 +1,136 @@ +/* +* 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 com.nokia.vfcadaptor.adaptor; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Component; + +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse; + +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMOperExecutVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfResponse; + +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.OperStatusVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.QueryVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ResponseDescriptor; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ResponseHistoryList; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.VnfInfo; + +@Component +public class Cbam2DriverResponseConverter { + + + public InstantiateVnfResponse createspConvert(CBAMCreateVnfResponse cbamResponse) { + + InstantiateVnfResponse response = new InstantiateVnfResponse(); + response.setJobId("1"); + response.setVnfInstanceId(cbamResponse.getVnfInfo().getId()); + + return response; + } + + public InstantiateVnfResponse instantspConvert(CBAMInstantiateVnfResponse cbamResponse) { + InstantiateVnfResponse response = new InstantiateVnfResponse(); + response.setJobId("1"); + response.setVnfInstanceId(cbamResponse.getProblemDetails().getInstance()); + return response; + } + + public TerminateVnfResponse terminaterspConvert(CBAMTerminateVnfResponse cbamResponse) { + + TerminateVnfResponse response = new TerminateVnfResponse(); + response.setJobId("1"); + return response; + } + + public QueryVnfResponse queryspConvert(CBAMQueryVnfResponse cbamResponse) { + QueryVnfResponse response = new QueryVnfResponse(); + VnfInfo vnf = new VnfInfo(); + vnf.setVnfdId(cbamResponse.getVnfInfo().getVnfdId()); + vnf.setVersion(cbamResponse.getVnfInfo().getVnfdVersion()); + vnf.setVnfInstanceId(cbamResponse.getVnfInfo().getId()); + vnf.setVnfInstanceName(cbamResponse.getVnfInfo().getName()); + vnf.setVnfInstanceDescription(cbamResponse.getVnfInfo().getDescription()); + vnf.setVnfPackageId(cbamResponse.getVnfInfo().getOnboardedVnfPkgInfoId()); + vnf.setVnfProvider(cbamResponse.getVnfInfo().getVnfProvider()); + vnf.setVnfStatus(cbamResponse.getVnfInfo().getInstantiationState()); + vnf.setVnfType(cbamResponse.getVnfInfo().getVnfSoftwareVersion()); + response.setVnfInfo(vnf); + return response; + } + + public OperStatusVnfResponse operspConvert(CBAMOperExecutVnfResponse cbamResponse) { + + OperStatusVnfResponse response = new OperStatusVnfResponse(); + List<OperationExecution> oper=cbamResponse.getOperationExecution(); + for(int i=0;i<oper.size();i++) { + response.setJobId(oper.get(i).getId()); + ResponseDescriptor er=new ResponseDescriptor(); + er.setProgress(i); + if(oper.get(i).getStatus().equals("STARTED")) { + er.setStatus("started"); + }else + if(oper.get(i).getStatus().equals("FINISHED")) { + er.setStatus("finished"); + }else + if(oper.get(i).getStatus().equals("FAILED")) { + er.setStatus("error"); + }else + if(oper.get(i).getStatus().equals("OTHER")) { + er.setStatus("processing"); + }else { + er.setStatus("error"); + } + er.setStatusDescription(""); + er.setErrorCode(null); + er.setResponseId(oper.get(i).getGrantId().hashCode()); + List<ResponseHistoryList> list=new ArrayList<ResponseHistoryList>(); + ResponseHistoryList relist=new ResponseHistoryList(); + relist.setProgress(i); + relist.setStatus(er.getStatus()); + relist.setStatusDescription(""); + relist.setErrorCode(null); + relist.setResponseId(er.getResponseId()); + list.add(relist); + er.setResponseHistoryList(list); + response.setResponseDescriptor(er); + } + return response; + } + + public HealVnfResponse healspconvert(CBAMHealVnfResponse cbamResponse) { + HealVnfResponse response=new HealVnfResponse(); + response.setJobId("1"); + return response; + } + + public ScaleVnfResponse scalespconvert(CBAMScaleVnfResponse cbamResponse) { + ScaleVnfResponse response=new ScaleVnfResponse(); + response.setJobId("1"); + return response; + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Driver2CbamRequestConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Driver2CbamRequestConverter.java new file mode 100644 index 00000000..5a51917d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/Driver2CbamRequestConverter.java @@ -0,0 +1,120 @@ +/* + * 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 com.nokia.vfcadaptor.adaptor; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.stereotype.Component; + +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.entity.EndpointInfo; +import com.nokia.vfcadaptor.cbam.bo.entity.ExtVirtualLinkData; +import com.nokia.vfcadaptor.cbam.bo.entity.OPENSTACK_V3_INFO; +import com.nokia.vfcadaptor.cbam.bo.entity.OpenStackAccessInfoV3; +import com.nokia.vfcadaptor.cbam.bo.entity.VimInfo; +import com.nokia.vfcadaptor.cbam.bo.entity.VimInfoType; +import com.nokia.vfcadaptor.cbam.bo.entity.VnfExtCpData; +import com.nokia.vfcadaptor.constant.CommonEnum; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.bo.entity.GrantInfo; +import com.nokia.vfcadaptor.nslcm.bo.entity.VimComputeResourceFlavour; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; + +@Component +public class Driver2CbamRequestConverter { + + public CBAMCreateVnfRequest createrqConvert(InstantiateVnfRequest driverRequest) { + CBAMCreateVnfRequest request = new CBAMCreateVnfRequest(); + + request.setVnfdId("vnfd_001"); + request.setName(driverRequest.getVnfInstanceName()); + request.setDescription(driverRequest.getVnfInstanceDescription()); + return request; + } + + public CBAMInstantiateVnfRequest InstantiateCqonvert(InstantiateVnfRequest driverRequest, + NslcmGrantVnfResponse nslc, GrantInfo grant, VimComputeResourceFlavour vimco) { + 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(); + + 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(); + + 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); + request.setFlavourId(driverRequest.getFlavourId()); + request.setExtVirtualLinks(list); + // resquest.setVnfInstanceId(driverRequest.getExtVirtualLink().get(0).getVlInstanceId()); + return request; + } + + public CBAMTerminateVnfRequest terminaterqConvert(TerminateVnfRequest driverRequest) { + CBAMTerminateVnfRequest request = new CBAMTerminateVnfRequest(); + request.setTerminationType(driverRequest.getTerminationType()); + request.setGracefulTerminationTimeout(driverRequest.getGracefulTerminationTimeout()); + return request; + } + + public CBAMHealVnfRequest healconvert(HealVnfRequest driverRequest) { + CBAMHealVnfRequest request = new CBAMHealVnfRequest(); + request.setCause(""); + request.setAdditionalParams(""); + return request; + } + + public CBAMScaleVnfRequest scaleconvert(ScaleVnfRequest driverRequest) { + CBAMScaleVnfRequest request = new CBAMScaleVnfRequest(); + if (driverRequest.getType().equals("SCALE_OUT")) { + request.setType(CommonEnum.ScaleDirection.OUT); + } else { + request.setType(CommonEnum.ScaleDirection.IN); + } + request.setAspectId(driverRequest.getAspectId()); + request.setNumberOfSteps(driverRequest.getNumberOfSteps()); + request.setAdditionalParams(driverRequest.getAdditionalParam()); + return request; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/InstantiateVnfContinueRunnable.java new file mode 100644 index 00000000..7efb9e9d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/InstantiateVnfContinueRunnable.java @@ -0,0 +1,144 @@ +/* + * 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 com.nokia.vfcadaptor.adaptor; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.client.ClientProtocolException; +import org.apache.log4j.Logger; + +import com.nokia.vfcadaptor.catalog.inf.CatalogMgmrInf; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.inf.CbamMgmrInf; +import com.nokia.vfcadaptor.constant.CommonConstants; +import com.nokia.vfcadaptor.constant.CommonEnum; +import com.nokia.vfcadaptor.constant.CommonEnum.LifecycleOperation; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfRequest; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.bo.NslcmNotifyLCMEventsRequest; +import com.nokia.vfcadaptor.nslcm.bo.entity.ResourceDefinition; +import com.nokia.vfcadaptor.nslcm.bo.entity.VnfPackageInfo; +import com.nokia.vfcadaptor.nslcm.inf.NslcmMgmrInf; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; + +public class InstantiateVnfContinueRunnable implements Runnable { + private Logger logger = Logger.getLogger(InstantiateVnfContinueRunnable.class); + + private CbamMgmrInf cbamMgmr; + private CatalogMgmrInf catalogMgmr; + private NslcmMgmrInf nslcmMgmr; + + private InstantiateVnfRequest driverRequest; + private String vnfInstanceId; + private String jobId; + + private Driver2CbamRequestConverter requestConverter; + + public InstantiateVnfContinueRunnable(InstantiateVnfRequest driverRequest, String vnfInstanceId, String jobId, + NslcmMgmrInf nslcmMgmr, CatalogMgmrInf catalogMgmr, CbamMgmrInf cbamMgmr, Driver2CbamRequestConverter requestConverter) + { + this.driverRequest = driverRequest; + this.vnfInstanceId = vnfInstanceId; + this.jobId = jobId; + this.nslcmMgmr = nslcmMgmr; + this.catalogMgmr = catalogMgmr; + this.cbamMgmr = cbamMgmr; + this.requestConverter = requestConverter; + } + + public void run() { + try { + NslcmGrantVnfRequest grantRequest = buildNslcmGrantVnfRequest(); + NslcmGrantVnfResponse grantResponse = nslcmMgmr.grantVnf(grantRequest); + handleNslcmGrantResponse(grantResponse); + + //step 2: query vnfPackage uri + VnfPackageInfo vnfPackageInfo = catalogMgmr.queryVnfPackage(driverRequest.getVnfPackageId()); + + //step 5: instantiate vnf + CBAMInstantiateVnfRequest instantiateReq = requestConverter.InstantiateCqonvert(driverRequest, grantResponse, null, null); + CBAMInstantiateVnfResponse cbamInstantiateResponse = cbamMgmr.instantiateVnf(instantiateReq, vnfInstanceId); + handleCbamInstantiateResponse(cbamInstantiateResponse); + + NslcmNotifyLCMEventsRequest nslcmNotifyReq = buildNslcmNotifyLCMEventsRequest(cbamInstantiateResponse); + nslcmMgmr.notifyVnf(nslcmNotifyReq, vnfInstanceId); + + } catch (ClientProtocolException e) { + logger.error("InstantiateVnfContinueRunnable run error ClientProtocolException", e); + } catch (IOException e) { + logger.error("InstantiateVnfContinueRunnable run error IOException", e); + } + + } + + private NslcmNotifyLCMEventsRequest buildNslcmNotifyLCMEventsRequest(CBAMInstantiateVnfResponse cbamInstantiateResponse) { + NslcmNotifyLCMEventsRequest request = new NslcmNotifyLCMEventsRequest(); + if(CommonEnum.OperationStatus.STARTED == cbamInstantiateResponse.getOperationExecution().getStatus()) + { + request.setStatus(CommonEnum.status.start); + } + else + { + request.setStatus(CommonEnum.status.result); + + //TODO the following are for the result +// request.setAffectedVnfc(affectedVnfc); +// request.setAffectedVI(affectedVI); +// request.setAffectedVirtualStorage(affectedVirtualStorage); + } + + request.setVnfInstanceId(vnfInstanceId); + request.setOperation(CommonConstants.NSLCM_OPERATION_INSTANTIATE); + request.setJobId(jobId); + return request; + } + + private NslcmGrantVnfRequest buildNslcmGrantVnfRequest() { + NslcmGrantVnfRequest request = new NslcmGrantVnfRequest(); + + request.setVnfInstanceId(vnfInstanceId); + request.setVnfDescriptorId(driverRequest.getVnfDescriptorId()); + request.setLifecycleOperation(LifecycleOperation.Instantiate); + request.setJobId(jobId); + + ResourceDefinition resource = getFreeVnfResource(); + List<ResourceDefinition> resourceList = new ArrayList<ResourceDefinition>(); + resourceList.add(resource); + request.setAddResource(resourceList); + + return request; + } + + private ResourceDefinition getFreeVnfResource() { + // TODO Auto-generated method stub + return null; + } + + private void handleCbamInstantiateResponse(CBAMInstantiateVnfResponse cbamInstantiateResponse) { + // TODO + //update job id record according to the executionId + } + + private void handleNslcmGrantResponse(NslcmGrantVnfResponse grantResponse) { + // TODO Auto-generated method stub + + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/TerminateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/TerminateVnfContinueRunnable.java new file mode 100644 index 00000000..de192c54 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/TerminateVnfContinueRunnable.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 com.nokia.vfcadaptor.adaptor; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; +import org.apache.log4j.Logger; + +import com.nokia.vfcadaptor.catalog.inf.CatalogMgmrInf; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; +import com.nokia.vfcadaptor.cbam.inf.CbamMgmrInf; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfRequest; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.inf.NslcmMgmrInf; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; + +public class TerminateVnfContinueRunnable implements Runnable { + private Logger logger = Logger.getLogger(TerminateVnfContinueRunnable.class); + + private CbamMgmrInf cbamMgmr; + private NslcmMgmrInf nslcmMgmr; + + private TerminateVnfRequest driverRequest; + private String vnfInstanceId; + + private Driver2CbamRequestConverter requestConverter; + + public TerminateVnfContinueRunnable(TerminateVnfRequest driverRequest, String vnfInstanceId, + NslcmMgmrInf nslcmMgmr, CbamMgmrInf cbamMgmr, Driver2CbamRequestConverter requestConverter) + { + this.driverRequest = driverRequest; + this.vnfInstanceId = vnfInstanceId; + this.nslcmMgmr = nslcmMgmr; + this.cbamMgmr = cbamMgmr; + this.requestConverter = requestConverter; + } + + public void run() { + try { + NslcmGrantVnfRequest grantRequest = new NslcmGrantVnfRequest(); + NslcmGrantVnfResponse grantResponse = nslcmMgmr.grantVnf(grantRequest); + handleNslcmGrantResponse(grantResponse); + + CBAMTerminateVnfRequest cbamRequest = requestConverter.terminaterqConvert(driverRequest); + CBAMTerminateVnfResponse cbamResponse = cbamMgmr.terminateVnf(cbamRequest, vnfInstanceId); + + cbamMgmr.deleteVnf(vnfInstanceId); + + } catch (ClientProtocolException e) { + logger.error("TerminateVnfContinueRunnable run error ClientProtocolException", e); + } catch (IOException e) { + logger.error("TerminateVnfContinueRunnable run error IOException", e); + } + + } + + private void handleNslcmGrantResponse(NslcmGrantVnfResponse grantResponse) { + // TODO Auto-generated method stub + + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/VnfmDriverMgmrIml.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/VnfmDriverMgmrIml.java new file mode 100644 index 00000000..6c332441 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/adaptor/VnfmDriverMgmrIml.java @@ -0,0 +1,216 @@ +/* + * 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 com.nokia.vfcadaptor.adaptor; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.HttpStatus; +import org.apache.http.client.ClientProtocolException; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.nokia.vfcadaptor.catalog.inf.CatalogMgmrInf; +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; +import com.nokia.vfcadaptor.cbam.inf.CbamMgmrInf; +import com.nokia.vfcadaptor.constant.CommonConstants; +import com.nokia.vfcadaptor.exception.VnfmDriverException; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfRequest; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.bo.VnfmInfo; +import com.nokia.vfcadaptor.nslcm.inf.NslcmMgmrInf; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.OperStatusVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.QueryVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ResponseDescriptor; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ResponseHistoryList; +import com.nokia.vfcadaptor.vnfmdriver.inf.VnfmDriverMgmrInf; + +@Component +public class VnfmDriverMgmrIml implements VnfmDriverMgmrInf{ + private Logger logger = Logger.getLogger(VnfmDriverMgmrIml.class); + + @Autowired + Driver2CbamRequestConverter requestConverter; + + @Autowired + Cbam2DriverResponseConverter responseConverter; + + @Autowired + private CbamMgmrInf cbamMgmr; + + @Autowired + private CatalogMgmrInf catalogMgmr; + + @Autowired + private NslcmMgmrInf nslcmMgmr; + + public InstantiateVnfResponse instantiateVnf(InstantiateVnfRequest driverRequest, String vnfmId) throws VnfmDriverException { + InstantiateVnfResponse driverResponse; + try { + //step 1: query vnfm info + VnfmInfo vnfmInfo = nslcmMgmr.queryVnfm(vnfmId); + + if(vnfmInfo == null || vnfmId.equalsIgnoreCase(vnfmInfo.getVnfmId())) + { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + //step 3: create vnf + CBAMCreateVnfRequest cbamRequest = requestConverter.createrqConvert(driverRequest); + CBAMCreateVnfResponse cbamResponse = cbamMgmr.createVnf(cbamRequest); + driverResponse = responseConverter.createspConvert(cbamResponse); + + String vnfInstanceId = driverResponse.getVnfInstanceId(); + String jobId = driverResponse.getJobId(); + continueInstantiateVnf(driverRequest, vnfInstanceId, jobId); + + + } catch (Exception e) { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + return driverResponse; + } + + public void continueInstantiateVnf(InstantiateVnfRequest driverRequest, String vnfInstanceId, String jobId) { + InstantiateVnfContinueRunnable runnable = new InstantiateVnfContinueRunnable(driverRequest, vnfInstanceId, jobId, + nslcmMgmr, catalogMgmr, cbamMgmr, requestConverter); + + Thread thread = new Thread(runnable); + + thread.run(); + } + + public TerminateVnfResponse terminateVnf(TerminateVnfRequest driverRequest, String vnfmId, String vnfInstanceId) { + TerminateVnfResponse driverResponse; + try { + nslcmMgmr.queryVnfm(vnfmId); + driverResponse = generateTerminateVnfResponse(vnfInstanceId); + continueTerminateVnf(driverRequest, vnfInstanceId); + + } catch (Exception e) { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + return driverResponse; + } + + private TerminateVnfResponse generateTerminateVnfResponse(String vnfInstanceId) { + TerminateVnfResponse response = new TerminateVnfResponse(); + //TODO + response.setJobId(""); + return response; + } + + public void continueTerminateVnf(TerminateVnfRequest driverRequest, String vnfInstanceId) { + TerminateVnfContinueRunnable runnable = new TerminateVnfContinueRunnable(driverRequest, vnfInstanceId, + nslcmMgmr, cbamMgmr, requestConverter); + + Thread thread = new Thread(runnable); + + thread.run(); + } + + + public QueryVnfResponse queryVnf(String vnfmId, String vnfInstanceId) { + QueryVnfResponse driverResponse; + try { + nslcmMgmr.queryVnfm(vnfmId); + CBAMQueryVnfResponse cbamResponse = cbamMgmr.queryVnf(vnfInstanceId); + driverResponse = responseConverter.queryspConvert(cbamResponse); + } catch (Exception e) { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + return driverResponse; + } + + public OperStatusVnfResponse getOperStatus(String vnfmId, String jobId) { + OperStatusVnfResponse response = new OperStatusVnfResponse(); + + List<ResponseHistoryList> list=new ArrayList<ResponseHistoryList>(); + ResponseHistoryList relist=new ResponseHistoryList(); + relist.setErrorCode(41); + relist.setProgress(40); + relist.setResponseId(1); + relist.setStatus("proccessing"); + relist.setStatusDescription("OMC VMs are decommissioned in VIM"); + ResponseDescriptor res=new ResponseDescriptor(); + res.setErrorCode(41); + res.setProgress(40); + res.setResponseId(1); + res.setStatus("proccessing"); + res.setStatusDescription("OMC VMs are decommissioned in VIM"); + for(int i=0; i<2;i++) { + relist.setProgress(4+i); + list.add(relist); + } + res.setResponseHistoryList(list); + + response.setJobId("Jobid="+jobId); + response.setResponseDescriptor(res); + + return response; + } + + public ScaleVnfResponse scaleVnf(ScaleVnfRequest driverRequest, String vnfmId, String vnfInstanceId) throws VnfmDriverException { + ScaleVnfResponse driverResponse; + try { + nslcmMgmr.queryVnfm(vnfmId); + CBAMScaleVnfRequest cbamRequest = requestConverter.scaleconvert(driverRequest); + CBAMScaleVnfResponse cbamResponse = cbamMgmr.scaleVnf(cbamRequest, vnfInstanceId); + driverResponse = responseConverter.scalespconvert(cbamResponse); + } catch (Exception e) { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + return driverResponse; + } + + public HealVnfResponse healVnf(HealVnfRequest driverRequest, String vnfmId, String vnfInstanceId) throws VnfmDriverException { + HealVnfResponse driverResponse; + try { + nslcmMgmr.queryVnfm(vnfmId); + CBAMHealVnfRequest cbamRequest = requestConverter.healconvert(driverRequest); + CBAMHealVnfResponse cbamResponse = cbamMgmr.healVnf(cbamRequest, vnfInstanceId); + driverResponse = responseConverter.healspconvert(cbamResponse); + } catch (Exception e) { + throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); + } + + return driverResponse; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/ResourceType.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/ResourceType.java new file mode 100644 index 00000000..0ce26da0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/ResourceType.java @@ -0,0 +1,8 @@ +package com.nokia.vfcadaptor.beans; + +public enum ResourceType { + VDU, + VL, + CP, + Storage +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmJobExecutionInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmJobExecutionInfo.java new file mode 100644 index 00000000..ad95b1ff --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmJobExecutionInfo.java @@ -0,0 +1,91 @@ +/* + * 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 com.nokia.vfcadaptor.beans; + +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_job_execution_record") +public class VnfmJobExecutionInfo implements Serializable{ + private static final long serialVersionUID = -2880159539002942812L; + + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + private long jobId; + + @Column(name = "vnfmExecutionId") + private String vnfmExecutionId; + + @Column(name = "vnfInstanceId") + private String vnfInstanceId; + + @Column(name = "vnfmInterfceName") + private String vnfmInterfceName; + + @Column(name = "status") + private String status; + + public long getJobId() { + return jobId; + } + + public void setJobId(long jobId) { + this.jobId = jobId; + } + + public String getVnfmExecutionId() { + return vnfmExecutionId; + } + + public void setVnfmExecutionId(String vnfmExecutionId) { + this.vnfmExecutionId = vnfmExecutionId; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfmInterfceName() { + return vnfmInterfceName; + } + + public void setVnfmInterfceName(String vnfmInterfceName) { + this.vnfmInterfceName = vnfmInterfceName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmResourceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmResourceInfo.java new file mode 100644 index 00000000..d969428f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/beans/VnfmResourceInfo.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 com.nokia.vfcadaptor.beans; + +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +public class VnfmResourceInfo { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @Column(name = "type") + private ResourceType type; + + @Column(name = "resourceDefinitionId") + private String resourceDefinitionId; + + @Column(name = "vdu") + private String vdu; + + @Column(name = "status") + private String status; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ResourceType getType() { + return type; + } + + public void setType(ResourceType type) { + this.type = type; + } + + public String getResourceDefinitionId() { + return resourceDefinitionId; + } + + public void setResourceDefinitionId(String resourceDefinitionId) { + this.resourceDefinitionId = resourceDefinitionId; + } + + public String getVdu() { + return vdu; + } + + public void setVdu(String vdu) { + this.vdu = vdu; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfRequest.java new file mode 100644 index 00000000..8b47ac9e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfRequest.java @@ -0,0 +1,21 @@ +/* + * 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 com.nokia.vfcadaptor.catalog.bo; + +public class CatalogQueryVnfRequest { + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfResponse.java new file mode 100644 index 00000000..761f54b0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/CatalogQueryVnfResponse.java @@ -0,0 +1,78 @@ +/* + * 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 com.nokia.vfcadaptor.catalog.bo; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.catalog.bo.entity.ImageInfo; +import com.nokia.vfcadaptor.catalog.bo.entity.VnfInstanceInfo; +import com.nokia.vfcadaptor.nslcm.bo.entity.VnfPackageInfo; + +public class CatalogQueryVnfResponse { + @JsonProperty("csarId") + private String csarId; + + @JsonProperty("packageInfo") + private VnfPackageInfo packageInfo; + + @JsonProperty("imageInfo") + private List<ImageInfo> imageInfo; + + @JsonProperty("vnfInstanceInfo") + private List<VnfInstanceInfo> vnfInstanceInfo; + + public String getCsarId() { + return csarId; + } + + public void setCsarId(String csarId) { + this.csarId = csarId; + } + + + + public VnfPackageInfo getPackageInfo() { + return packageInfo; + } + + public void setPackageInfo(VnfPackageInfo packageInfo) { + this.packageInfo = packageInfo; + } + + public List<ImageInfo> getImageInfo() { + return imageInfo; + } + + public void setImageInfo(List<ImageInfo> imageInfo) { + this.imageInfo = imageInfo; + } + + public List<VnfInstanceInfo> getVnfInstanceInfo() { + return vnfInstanceInfo; + } + + public void setVnfInstanceInfo(List<VnfInstanceInfo> vnfInstanceInfo) { + this.vnfInstanceInfo = vnfInstanceInfo; + } + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/ImageInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/ImageInfo.java new file mode 100644 index 00000000..568179bd --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/ImageInfo.java @@ -0,0 +1,104 @@ +/* + * 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 com.nokia.vfcadaptor.catalog.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ImageInfo { + + @JsonProperty("index") + private String index; + + @JsonProperty("fileName") + private String fileName; + + @JsonProperty("imageId") + private String imageId; + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("vimUser") + private String vimUser; + + @JsonProperty("tenant") + private String tenant; + + @JsonProperty("status") + private String status; + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getImageId() { + return imageId; + } + + public void setImageId(String imageId) { + this.imageId = imageId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getVimUser() { + return vimUser; + } + + public void setVimUser(String vimUser) { + this.vimUser = vimUser; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/VnfInstanceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/VnfInstanceInfo.java new file mode 100644 index 00000000..d3c81fdf --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/bo/entity/VnfInstanceInfo.java @@ -0,0 +1,49 @@ +/* + * 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 com.nokia.vfcadaptor.catalog.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VnfInstanceInfo { + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("vnfInstanceName") + private String vnfInstanceName; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfInstanceName() { + return vnfInstanceName; + } + + public void setVnfInstanceName(String vnfInstanceName) { + this.vnfInstanceName = vnfInstanceName; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/impl/CatalogMgmrImpl.java new file mode 100644 index 00000000..c3553800 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/impl/CatalogMgmrImpl.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 com.nokia.vfcadaptor.catalog.impl; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.google.gson.Gson; +import com.nokia.vfcadaptor.catalog.bo.CatalogQueryVnfResponse; +import com.nokia.vfcadaptor.catalog.inf.CatalogMgmrInf; +import com.nokia.vfcadaptor.common.bo.AdaptorEnv; +import com.nokia.vfcadaptor.constant.CommonConstants; +import com.nokia.vfcadaptor.http.client.HttpRequestProcessor; +import com.nokia.vfcadaptor.nslcm.bo.entity.VnfPackageInfo; + +@Component +public class CatalogMgmrImpl implements CatalogMgmrInf{ + private Logger logger = Logger.getLogger(CatalogMgmrImpl.class); + + private Gson gson = new Gson(); + + @Autowired + private AdaptorEnv adaptorEnv; + + @Autowired + private HttpClientBuilder httpClientBuilder; + + public VnfPackageInfo queryVnfPackage(String vnfPackageId) throws ClientProtocolException, IOException { + String url="http://" + adaptorEnv.getCatalogIp() + ":" + adaptorEnv.getCatalogPort() + String.format(CommonConstants.RetrieveVnfPackagePath, vnfPackageId); + HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, RequestMethod.GET); + + String responseStr = processor.process(url); + + logger.info("CbamMgmrImpl -> queryVnfPackage, responseStr is " + responseStr); + + CatalogQueryVnfResponse resp = gson.fromJson(responseStr, CatalogQueryVnfResponse.class); + + return resp.getPackageInfo(); + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/inf/CatalogMgmrInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/inf/CatalogMgmrInf.java new file mode 100644 index 00000000..bf7ae78c --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/catalog/inf/CatalogMgmrInf.java @@ -0,0 +1,27 @@ +/* + * 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 com.nokia.vfcadaptor.catalog.inf; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; + +import com.nokia.vfcadaptor.nslcm.bo.entity.VnfPackageInfo; + +public interface CatalogMgmrInf { + public VnfPackageInfo queryVnfPackage(String vnfPackageId) throws ClientProtocolException, IOException; +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfRequest.java new file mode 100644 index 00000000..03578d66 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfRequest.java @@ -0,0 +1,57 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CBAMCreateVnfRequest { + @JsonProperty("vnfdId") + private String vnfdId; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + 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; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfResponse.java new file mode 100644 index 00000000..b4099da8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMCreateVnfResponse.java @@ -0,0 +1,49 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; +import com.nokia.vfcadaptor.cbam.bo.entity.VnfInfo; + +public class CBAMCreateVnfResponse { + @JsonProperty("vnfdId") + private VnfInfo vnfInfo; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public VnfInfo getVnfInfo() { + return vnfInfo; + } + + public void setVnfInfo(VnfInfo vnfInfo) { + this.vnfInfo = vnfInfo; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfRequest.java new file mode 100644 index 00000000..2918e3ce --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfRequest.java @@ -0,0 +1,49 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CBAMHealVnfRequest { + + @JsonProperty("cause") + private String cause; + + @JsonProperty("additionalParams") + private Object additionalParams; + + + public String getCause() { + return cause; + } + + public void setCause(String cause) { + this.cause = cause; + } + + public Object getAdditionalParams() { + return additionalParams; + } + + public void setAdditionalParams(Object additionalParams) { + this.additionalParams = additionalParams; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfResponse.java new file mode 100644 index 00000000..4d9a4191 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMHealVnfResponse.java @@ -0,0 +1,48 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; + +public class CBAMHealVnfResponse { + @JsonProperty("operationExecution") + private OperationExecution operationExecution; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public OperationExecution getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(OperationExecution operationExecution) { + this.operationExecution = operationExecution; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfRequest.java new file mode 100644 index 00000000..36628528 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfRequest.java @@ -0,0 +1,82 @@ + +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.ExtManagedVirtualLinkData; +import com.nokia.vfcadaptor.cbam.bo.entity.ExtVirtualLinkData; +import com.nokia.vfcadaptor.cbam.bo.entity.VimInfo; + +public class CBAMInstantiateVnfRequest { + + @JsonProperty("flavourId") + private String flavourId; + + @JsonProperty("vims") + private List<VimInfo> vims; + + @JsonProperty("extVirtualLinks") + private List<ExtVirtualLinkData> extVirtualLinks; + + @JsonProperty("extManagedVirtualLinks") + private List<ExtManagedVirtualLinkData> extManagedVirtualLinks; + + public String getFlavourId() { + return flavourId; + } + + public void setFlavourId(String flavourId) { + this.flavourId = flavourId; + } + + + + public List<VimInfo> getVims() { + return vims; + } + + public void setVims(List<VimInfo> vims) { + this.vims = vims; + } + + public List<ExtVirtualLinkData> getExtVirtualLinks() { + return extVirtualLinks; + } + + public void setExtVirtualLinks(List<ExtVirtualLinkData> extVirtualLinks) { + this.extVirtualLinks = extVirtualLinks; + } + + public List<ExtManagedVirtualLinkData> getExtManagedVirtualLinks() { + return extManagedVirtualLinks; + } + + public void setExtManagedVirtualLinks(List<ExtManagedVirtualLinkData> extManagedVirtualLinks) { + this.extManagedVirtualLinks = extManagedVirtualLinks; + } + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfResponse.java new file mode 100644 index 00000000..276586e8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMInstantiateVnfResponse.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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; + +public class CBAMInstantiateVnfResponse { + @JsonProperty("operationExecution") + private OperationExecution operationExecution; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public OperationExecution getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(OperationExecution operationExecution) { + this.operationExecution = operationExecution; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfRequest.java new file mode 100644 index 00000000..211448c1 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfRequest.java @@ -0,0 +1,22 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +public class CBAMOperExecutVnfRequest { + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfResponse.java new file mode 100644 index 00000000..c0f00b1e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMOperExecutVnfResponse.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 com.nokia.vfcadaptor.cbam.bo; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; + +public class CBAMOperExecutVnfResponse { + + @JsonProperty("operationExecution") + private List<OperationExecution> operationExecution; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + + public List<OperationExecution> getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(List<OperationExecution> operationExecution) { + this.operationExecution = operationExecution; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMQueryVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMQueryVnfResponse.java new file mode 100644 index 00000000..61e23134 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMQueryVnfResponse.java @@ -0,0 +1,49 @@ + +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; +import com.nokia.vfcadaptor.cbam.bo.entity.VnfInfo; + +public class CBAMQueryVnfResponse { + @JsonProperty("vnfInfo") + private VnfInfo vnfInfo; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public VnfInfo getVnfInfo() { + return vnfInfo; + } + + public void setVnfInfo(VnfInfo vnfInfo) { + this.vnfInfo = vnfInfo; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfRequest.java new file mode 100644 index 00000000..1c2abf2c --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfRequest.java @@ -0,0 +1,77 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class CBAMScaleVnfRequest { + @JsonProperty("type") + private CommonEnum.ScaleDirection type; + + @JsonProperty("aspectId") + private String aspectId; + + @JsonProperty("numberOfSteps") + private Integer numberOfSteps; + + + @JsonProperty("additionalParams") + private Object additionalParams; + + + public CommonEnum.ScaleDirection getType() { + return type; + } + + + public void setType(CommonEnum.ScaleDirection type) { + this.type = type; + } + + + + public String getAspectId() { + return aspectId; + } + + + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + public Integer getNumberOfSteps() { + return numberOfSteps; + } + + + public void setNumberOfSteps(Integer numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } + + + public Object getAdditionalParams() { + return additionalParams; + } + + + + public void setAdditionalParams(Object additionalParams) { + this.additionalParams = additionalParams; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfResponse.java new file mode 100644 index 00000000..c001f3af --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMScaleVnfResponse.java @@ -0,0 +1,48 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; + +public class CBAMScaleVnfResponse { + @JsonProperty("operationExecution") + private OperationExecution operationExecution; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public OperationExecution getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(OperationExecution operationExecution) { + this.operationExecution = operationExecution; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfRequest.java new file mode 100644 index 00000000..7761f057 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfRequest.java @@ -0,0 +1,144 @@ + +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class CBAMTerminateVnfRequest { + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("terminationType") + private CommonEnum.TerminationType terminationType; + + @JsonProperty("gracefulTerminationTimeout") + private Integer gracefulTerminationTimeout; + + @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/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfResponse.java new file mode 100644 index 00000000..8629d543 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/CBAMTerminateVnfResponse.java @@ -0,0 +1,51 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; + +public class CBAMTerminateVnfResponse { + @JsonProperty("operationExecution") + private OperationExecution operationExecution; + + @JsonProperty("problemDetails") + private ProblemDetails problemDetails; + + public OperationExecution getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(OperationExecution operationExecution) { + this.operationExecution = operationExecution; + } + + public ProblemDetails getProblemDetails() { + return problemDetails; + } + + public void setProblemDetails(ProblemDetails problemDetails) { + this.problemDetails = problemDetails; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/EndpointInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/EndpointInfo.java new file mode 100644 index 00000000..863920ac --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/EndpointInfo.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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class EndpointInfo { + @JsonProperty("endpoint") + private String endpoint; + + public String getEndpoint() { + return endpoint; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtManagedVirtualLinkData.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtManagedVirtualLinkData.java new file mode 100644 index 00000000..4a7ee81f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtManagedVirtualLinkData.java @@ -0,0 +1,68 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ExtManagedVirtualLinkData { + @JsonProperty("extManagedVirtualLinkId") + private String extManagedVirtualLinkId; + + @JsonProperty("resourceId") + private String resourceId; + + @JsonProperty("virtualLinkDescId") + private String virtualLinkDescId; + + @JsonProperty("vimId") + private String vimId; + + public String getExtManagedVirtualLinkId() { + return extManagedVirtualLinkId; + } + + public void setExtManagedVirtualLinkId(String extManagedVirtualLinkId) { + this.extManagedVirtualLinkId = extManagedVirtualLinkId; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getVirtualLinkDescId() { + return virtualLinkDescId; + } + + public void setVirtualLinkDescId(String virtualLinkDescId) { + this.virtualLinkDescId = virtualLinkDescId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtVirtualLinkData.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtVirtualLinkData.java new file mode 100644 index 00000000..3a7e4127 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ExtVirtualLinkData.java @@ -0,0 +1,68 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ExtVirtualLinkData { + @JsonProperty("flavourId") + private String resourceId; + @JsonProperty("flavourId") + private String vimId; + @JsonProperty("flavourId") + private String extVirtualLinkId; + + @JsonProperty("extVirtualLink") + private List<VnfExtCpData> extCps=new ArrayList<VnfExtCpData>(); + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getExtVirtualLinkId() { + return extVirtualLinkId; + } + + public void setExtVirtualLinkId(String extVirtualLinkId) { + this.extVirtualLinkId = extVirtualLinkId; + } + + public List<VnfExtCpData> getExtCps() { + return extCps; + } + + public void setExtCps(List<VnfExtCpData> extCps) { + this.extCps = extCps; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/Inputs.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/Inputs.java new file mode 100644 index 00000000..d17d6cdc --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/Inputs.java @@ -0,0 +1,66 @@ +package com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Inputs { + + @JsonProperty("key_name") + private String key_name; + + @JsonProperty("value") + private String value; + + @JsonProperty("type") + private String type; + + @JsonProperty("default1") + private String default1; + + @JsonProperty("description") + private String description; + + public String getKey_name() { + return key_name; + } + + public void setKey_name(String key_name) { + this.key_name = key_name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDefault1() { + return default1; + } + + public void setDefault1(String default1) { + this.default1 = default1; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/InstantiatedVnfInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/InstantiatedVnfInfo.java new file mode 100644 index 00000000..1479e963 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/InstantiatedVnfInfo.java @@ -0,0 +1,21 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +public class InstantiatedVnfInfo { + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/NetworkAddress.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/NetworkAddress.java new file mode 100644 index 00000000..b4ebb7f6 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/NetworkAddress.java @@ -0,0 +1,51 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkAddress { + @JsonProperty("subnetId") + private String subnetId; + @JsonProperty("ip") + private String ip; + @JsonProperty("mac") + private String mac; + public String getSubnetId() { + return subnetId; + } + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + public String getIp() { + return ip; + } + public void setIp(String ip) { + this.ip = ip; + } + public String getMac() { + return mac; + } + public void setMac(String mac) { + this.mac = mac; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V2_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V2_INFO.java new file mode 100644 index 00000000..2cca3090 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V2_INFO.java @@ -0,0 +1,58 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OPENSTACK_V2_INFO { + + @JsonProperty("vimInfoType") + private VimInfoType vimInfoType; + @JsonProperty("interfaceInfo") + private EndpointInfo interfaceInfo; + @JsonProperty("id") + private String id; + @JsonProperty("accessInfo") + private OpenStackAccessInfoV2 accessInfo; + public VimInfoType getVimInfoType() { + return vimInfoType; + } + public void setVimInfoType(VimInfoType vimInfoType) { + this.vimInfoType = vimInfoType; + } + public EndpointInfo getInterfaceInfo() { + return interfaceInfo; + } + public void setInterfaceInfo(EndpointInfo interfaceInfo) { + this.interfaceInfo = interfaceInfo; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public OpenStackAccessInfoV2 getAccessInfo() { + return accessInfo; + } + public void setAccessInfo(OpenStackAccessInfoV2 accessInfo) { + this.accessInfo = accessInfo; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V3_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V3_INFO.java new file mode 100644 index 00000000..11cdfdfc --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OPENSTACK_V3_INFO.java @@ -0,0 +1,57 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OPENSTACK_V3_INFO { + + @JsonProperty("vimInfoType") + private VimInfoType vimInfoType; + @JsonProperty("interfaceInfo") + private EndpointInfo interfaceInfo; + @JsonProperty("id") + private String id; + @JsonProperty("accessInfo") + private OpenStackAccessInfoV3 accessInfo; + public VimInfoType getVimInfoType() { + return vimInfoType; + } + public void setVimInfoType(VimInfoType vimInfoType) { + this.vimInfoType = vimInfoType; + } + public EndpointInfo getInterfaceInfo() { + return interfaceInfo; + } + public void setInterfaceInfo(EndpointInfo interfaceInfo) { + this.interfaceInfo = interfaceInfo; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public OpenStackAccessInfoV3 getAccessInfo() { + return accessInfo; + } + public void setAccessInfo(OpenStackAccessInfoV3 accessInfo) { + this.accessInfo = accessInfo; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OTHER_VIM_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OTHER_VIM_INFO.java new file mode 100644 index 00000000..0578ba16 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OTHER_VIM_INFO.java @@ -0,0 +1,45 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OTHER_VIM_INFO { + @JsonProperty("vimInfoType") + private VimInfoType vimInfoType; + + @JsonProperty("id") + private String id; + + public VimInfoType getVimInfoType() { + return vimInfoType; + } + + public void setVimInfoType(VimInfoType vimInfoType) { + this.vimInfoType = vimInfoType; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV2.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV2.java new file mode 100644 index 00000000..bc67a619 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV2.java @@ -0,0 +1,70 @@ +package com.nokia.vfcadaptor.cbam.bo.entity; + +/* +* 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. +*/ +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OpenStackAccessInfoV2 { + + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + + @JsonProperty("region") + private String region; + + @JsonProperty("tenant") + private String tenant; + + + 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 getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV3.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV3.java new file mode 100644 index 00000000..4cf5b6f9 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OpenStackAccessInfoV3.java @@ -0,0 +1,77 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OpenStackAccessInfoV3 { + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + + @JsonProperty("region") + private String region; + + @JsonProperty("project") + private String project; + + @JsonProperty("domain") + private String domain; + + 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 getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OperationExecution.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OperationExecution.java new file mode 100644 index 00000000..efb8f8a4 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/OperationExecution.java @@ -0,0 +1,208 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class OperationExecution { + + @JsonProperty("id") + private String id; + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("operationType") + private OperationType operationType; + + @JsonProperty("operationName") + private String operationName; + + @JsonProperty("status") + private CommonEnum.OperationStatus status; + + @JsonProperty("isCancelPending") + private boolean isCancelPending; + + @JsonProperty("CancelMode") + private CancelMode CancelMode; + + @JsonProperty("error") + private ProblemDetails error; + + @JsonProperty("startTime") + private String startTime; + + @JsonProperty("finishTime") + private String finishTime; + + @JsonProperty("grantId") + private String grantId; + + @JsonProperty("operationParams") + private Object operationParams; + + @JsonProperty("additionalData") + private Object additionalData; + + @JsonProperty("metadata") + private Object metadata; + + @JsonProperty("_links") + private _links _links; + + + + + + public enum OperationType{ + INSTANTIATE, SCALE, SCALE_TO_LEVEL, MODIFY_INFO, CHANGE_FLAVOUR, OPERATE, + HEAL, UPGRADE, TERMINATE, OTHER + } + + + + public enum CancelMode{ + GRACEFUL, FORCEFUL + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public OperationType getOperationType() { + return operationType; + } + + public void setOperationType(OperationType operationType) { + this.operationType = operationType; + } + + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + + + public CommonEnum.OperationStatus getStatus() { + return status; + } + + public void setStatus(CommonEnum.OperationStatus status) { + this.status = status; + } + + public boolean isCancelPending() { + return isCancelPending; + } + + public void setCancelPending(boolean isCancelPending) { + this.isCancelPending = isCancelPending; + } + + public CancelMode getCancelMode() { + return CancelMode; + } + + public void setCancelMode(CancelMode cancelMode) { + CancelMode = cancelMode; + } + + public ProblemDetails getError() { + return error; + } + + public void setError(ProblemDetails error) { + this.error = error; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getFinishTime() { + return finishTime; + } + + public void setFinishTime(String finishTime) { + this.finishTime = finishTime; + } + + public String getGrantId() { + return grantId; + } + + public void setGrantId(String grantId) { + this.grantId = grantId; + } + + public Object getOperationParams() { + return operationParams; + } + + public void setOperationParams(Object operationParams) { + this.operationParams = operationParams; + } + + public Object getAdditionalData() { + return additionalData; + } + + public void setAdditionalData(Object additionalData) { + this.additionalData = additionalData; + } + + public Object getMetadata() { + return metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + public _links get_links() { + return _links; + } + + public void set_links(_links _links) { + this._links = _links; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ProblemDetails.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ProblemDetails.java new file mode 100644 index 00000000..ead7e11a --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ProblemDetails.java @@ -0,0 +1,67 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ProblemDetails { + @JsonProperty("type") + private String type; + @JsonProperty("title") + private String title; + @JsonProperty("status") + private Integer status; + @JsonProperty("detail") + private String detail; + @JsonProperty("instance") + private String instance; + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer status) { + this.status = status; + } + public String getDetail() { + return detail; + } + public void setDetail(String detail) { + this.detail = detail; + } + public String getInstance() { + return instance; + } + public void setInstance(String instance) { + this.instance = instance; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VCloudAccessInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VCloudAccessInfo.java new file mode 100644 index 00000000..32a3abbe --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VCloudAccessInfo.java @@ -0,0 +1,57 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VCloudAccessInfo { + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + + @JsonProperty("organization") + private String organization; + + 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 getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VMWARE_VCLOUD_INFO.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VMWARE_VCLOUD_INFO.java new file mode 100644 index 00000000..866a31f4 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VMWARE_VCLOUD_INFO.java @@ -0,0 +1,58 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VMWARE_VCLOUD_INFO { + + @JsonProperty("vimInfoType") + private VimInfoType vimInfoType; + @JsonProperty("interfaceInfo") + private EndpointInfo interfaceInfo; + @JsonProperty("id") + private String id; + @JsonProperty("accessInfo") + private VCloudAccessInfo accessInfo; + public VimInfoType getVimInfoType() { + return vimInfoType; + } + public void setVimInfoType(VimInfoType vimInfoType) { + this.vimInfoType = vimInfoType; + } + public EndpointInfo getInterfaceInfo() { + return interfaceInfo; + } + public void setInterfaceInfo(EndpointInfo interfaceInfo) { + this.interfaceInfo = interfaceInfo; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public VCloudAccessInfo getAccessInfo() { + return accessInfo; + } + public void setAccessInfo(VCloudAccessInfo accessInfo) { + this.accessInfo = accessInfo; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimComputeResourceFlavour.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimComputeResourceFlavour.java new file mode 100644 index 00000000..2add1c6f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimComputeResourceFlavour.java @@ -0,0 +1,53 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimComputeResourceFlavour { + @JsonProperty("vimId") + private String vimId; + @JsonProperty("resourceId") + private String resourceId; + @JsonProperty("vnfdVirtualComputeDescId") + private String vnfdVirtualComputeDescId; + + 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 getVnfdVirtualComputeDescId() { + return vnfdVirtualComputeDescId; + } + public void setVnfdVirtualComputeDescId(String vnfdVirtualComputeDescId) { + this.vnfdVirtualComputeDescId = vnfdVirtualComputeDescId; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfo.java new file mode 100644 index 00000000..c68d3b3b --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfo.java @@ -0,0 +1,49 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class VimInfo { + @JsonProperty("id") + private String id; + @JsonProperty("vimInfoType") + private VimInfoType vimInfoType; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public VimInfoType getVimInfoType() { + return vimInfoType; + } + + public void setVimInfoType(VimInfoType vimInfoType) { + this.vimInfoType = vimInfoType; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfoType.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfoType.java new file mode 100644 index 00000000..9e4aa88f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimInfoType.java @@ -0,0 +1,56 @@ +/* +* 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 com.nokia.vfcadaptor.cbam.bo.entity; + +public class VimInfoType { + + 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/com/nokia/vfcadaptor/cbam/bo/entity/VimSoftwareImage.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimSoftwareImage.java new file mode 100644 index 00000000..53ea38b8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VimSoftwareImage.java @@ -0,0 +1,49 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimSoftwareImage { + @JsonProperty("vimId") + private String vimId; + @JsonProperty("vnfdSoftwareImageId") + private String vnfdSoftwareImageId; + @JsonProperty("resourceId") + private String resourceId; + public String getVimId() { + return vimId; + } + public void setVimId(String vimId) { + this.vimId = vimId; + } + public String getVnfdSoftwareImageId() { + return vnfdSoftwareImageId; + } + public void setVnfdSoftwareImageId(String vnfdSoftwareImageId) { + this.vnfdSoftwareImageId = vnfdSoftwareImageId; + } + public String getResourceId() { + return resourceId; + } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfExtCpData.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfExtCpData.java new file mode 100644 index 00000000..85c4fbeb --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfExtCpData.java @@ -0,0 +1,60 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VnfExtCpData { + @JsonProperty("cpdId") + private String cpdId; + + @JsonProperty("addresses") + private List<NetworkAddress> addresses=new ArrayList<NetworkAddress>(); + + @JsonProperty("numDynamicAddresses") + private Integer numDynamicAddresses; + + public String getCpdId() { + return cpdId; + } + + public void setCpdId(String cpdId) { + this.cpdId = cpdId; + } + + public List<NetworkAddress> getAddresses() { + return addresses; + } + + public void setAddresses(List<NetworkAddress> addresses) { + this.addresses = addresses; + } + + public Integer getNumDynamicAddresses() { + return numDynamicAddresses; + } + + public void setNumDynamicAddresses(Integer numDynamicAddresses) { + this.numDynamicAddresses = numDynamicAddresses; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfInfo.java new file mode 100644 index 00000000..32cbcb26 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfInfo.java @@ -0,0 +1,208 @@ + +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class VnfInfo { + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("vnfdId") + private String vnfdId; + + @JsonProperty("vnfProvider") + private String vnfProvider; + + @JsonProperty("vnfProductName") + private String vnfProductName; + + @JsonProperty("vnfSoftwareVersion") + private String vnfSoftwareVersion; + + @JsonProperty("vnfdVersion") + private String vnfdVersion; + + @JsonProperty("onboardedVnfPkgInfoId") + private String onboardedVnfPkgInfoId; + + @JsonProperty("instantiationState") + private CommonEnum.InstantiationState instantiationState; + + @JsonProperty("operationExecution") + private List<OperationExecution> operationExecution=new ArrayList<OperationExecution>(); + + @JsonProperty("instantiatedVnfInfo") + private InstantiatedVnfInfo instantiatedVnfInfo; + + @JsonProperty("vnfConfigurableProperties") + private List<VnfProperty> vnfConfigurableProperties=new ArrayList<VnfProperty>(); + + @JsonProperty("extensions") + private List<VnfProperty> extensions=new ArrayList<VnfProperty>(); + + @JsonProperty("metadata") + private Object metadata; + + @JsonProperty("link") + private _links link;//todo + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + 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 String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + public String getVnfProvider() { + return vnfProvider; + } + + public void setVnfProvider(String vnfProvider) { + this.vnfProvider = vnfProvider; + } + + public String getVnfProductName() { + return vnfProductName; + } + + public void setVnfProductName(String vnfProductName) { + this.vnfProductName = vnfProductName; + } + + public String getVnfSoftwareVersion() { + return vnfSoftwareVersion; + } + + public void setVnfSoftwareVersion(String vnfSoftwareVersion) { + this.vnfSoftwareVersion = vnfSoftwareVersion; + } + + public String getVnfdVersion() { + return vnfdVersion; + } + + public void setVnfdVersion(String vnfdVersion) { + this.vnfdVersion = vnfdVersion; + } + + public String getOnboardedVnfPkgInfoId() { + return onboardedVnfPkgInfoId; + } + + public void setOnboardedVnfPkgInfoId(String onboardedVnfPkgInfoId) { + this.onboardedVnfPkgInfoId = onboardedVnfPkgInfoId; + } + + + + public CommonEnum.InstantiationState getInstantiationState() { + return instantiationState; + } + + public void setInstantiationState(CommonEnum.InstantiationState instantiationState) { + this.instantiationState = instantiationState; + } + + public List<OperationExecution> getOperationExecution() { + return operationExecution; + } + + public void setOperationExecution(List<OperationExecution> operationExecution) { + this.operationExecution = operationExecution; + } + + public InstantiatedVnfInfo getInstantiatedVnfInfo() { + return instantiatedVnfInfo; + } + + public void setInstantiatedVnfInfo(InstantiatedVnfInfo instantiatedVnfInfo) { + this.instantiatedVnfInfo = instantiatedVnfInfo; + } + + public List<VnfProperty> getVnfConfigurableProperties() { + return vnfConfigurableProperties; + } + + public void setVnfConfigurableProperties(List<VnfProperty> vnfConfigurableProperties) { + this.vnfConfigurableProperties = vnfConfigurableProperties; + } + + public List<VnfProperty> getExtensions() { + return extensions; + } + + public void setExtensions(List<VnfProperty> extensions) { + this.extensions = extensions; + } + + public Object getMetadata() { + return metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + public _links getLink() { + return link; + } + + public void setLink(_links link) { + this.link = link; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfProperty.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfProperty.java new file mode 100644 index 00000000..8941c393 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/VnfProperty.java @@ -0,0 +1,21 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +public class VnfProperty { + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ZoneInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ZoneInfo.java new file mode 100644 index 00000000..21c830c0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/ZoneInfo.java @@ -0,0 +1,61 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ZoneInfo { + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("resourceId") + private String resourceId; + + @JsonProperty("id") + private String id; + + 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 getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/_links.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/_links.java new file mode 100644 index 00000000..f7b2a4d4 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/bo/entity/_links.java @@ -0,0 +1,84 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class _links { + @JsonProperty("cancel") + private String cancel; + @JsonProperty("operationParams") + private String operationParams; + @JsonProperty("endNotification") + private String endNotification; + @JsonProperty("self") + private String self; + @JsonProperty("additionalData") + private String additionalData; + @JsonProperty("list") + private String list; + @JsonProperty("vnf") + private String vnf; + public String getCancel() { + return cancel; + } + public void setCancel(String cancel) { + this.cancel = cancel; + } + public String getOperationParams() { + return operationParams; + } + public void setOperationParams(String operationParams) { + this.operationParams = operationParams; + } + public String getEndNotification() { + return endNotification; + } + public void setEndNotification(String endNotification) { + this.endNotification = endNotification; + } + public String getSelf() { + return self; + } + public void setSelf(String self) { + this.self = self; + } + public String getAdditionalData() { + return additionalData; + } + public void setAdditionalData(String additionalData) { + this.additionalData = additionalData; + } + public String getList() { + return list; + } + public void setList(String list) { + this.list = list; + } + public String getVnf() { + return vnf; + } + public void setVnf(String vnf) { + this.vnf = vnf; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/controller/CbamController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/controller/CbamController.java new file mode 100644 index 00000000..d0a9158e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/controller/CbamController.java @@ -0,0 +1,150 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.controller; + +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMOperExecutVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMOperExecutVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.entity.OperationExecution; +import com.nokia.vfcadaptor.cbam.bo.entity.ProblemDetails; +import com.nokia.vfcadaptor.cbam.bo.entity.VnfInfo; + +@Controller +@RequestMapping(value = "/vnfm/lcm/v3") +public class CbamController { + + @RequestMapping(value = "/vnfs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMCreateVnfResponse createVnf(CBAMInstantiateVnfRequest request) + { + CBAMCreateVnfResponse response = new CBAMCreateVnfResponse(); + VnfInfo op=new VnfInfo(); + op.setName("VNF_001"); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setVnfInfo(op); + response.setProblemDetails(pr); + return response; + } + @RequestMapping(value = "/vnfs/{vnfInstanceId}/instantiate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMInstantiateVnfResponse initiateVnf(CBAMInstantiateVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId) + { + CBAMInstantiateVnfResponse response = new CBAMInstantiateVnfResponse(); +// response.setJobid("11234"); + + return response; + } + + @RequestMapping(value = "/vnfs/{vnfInstanceId}/terminate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMTerminateVnfResponse terminateVnf(CBAMTerminateVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId) + { + CBAMTerminateVnfResponse response = new CBAMTerminateVnfResponse(); + OperationExecution op=new OperationExecution(); + op.setGrantId("89"); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setOperationExecution(op); + response.setProblemDetails(pr); + return response; + } + + @RequestMapping(value = "/vnfs/{vnfInstanceId}/scale", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMScaleVnfResponse scaleVnf(CBAMScaleVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId) + { + CBAMScaleVnfResponse response = new CBAMScaleVnfResponse(); + OperationExecution op=new OperationExecution(); + op.setGrantId("89"); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setOperationExecution(op); + response.setProblemDetails(pr); + return response; + } + + @RequestMapping(value = "/vnfs/{vnfInstanceId}/heal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMHealVnfResponse healVnf(CBAMHealVnfRequest request, @PathVariable("vnfInstanceId") String vnfInstanceId) + { + CBAMHealVnfResponse response = new CBAMHealVnfResponse(); + OperationExecution op=new OperationExecution(); + op.setGrantId("89"); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setOperationExecution(op); + response.setProblemDetails(pr); + return response; + } + + + @RequestMapping(value = "/vnfs/{vnfInstanceId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMQueryVnfResponse queryVnf(@PathVariable("vnfInstanceId") String vnfInstanceId) + { + CBAMQueryVnfResponse response = new CBAMQueryVnfResponse(); + VnfInfo op=new VnfInfo(); + op.setName("VNF_001"); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setVnfInfo(op); + response.setProblemDetails(pr); + return response; + } + + + @RequestMapping(value = "/operation_executions/{operationExecutionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMOperExecutVnfResponse operVnf(@PathVariable("operationExecutionId") String operationExecutionId) + { + CBAMOperExecutVnfResponse response = new CBAMOperExecutVnfResponse(); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setProblemDetails(pr); + return response; + } + + @RequestMapping(value = "/operation_executions/{operationExecutionId}/cancel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public CBAMOperExecutVnfResponse operCancelVnf(CBAMOperExecutVnfRequest request,@PathVariable("operationExecutionId") String operationExecutionId) + { + CBAMOperExecutVnfResponse response = new CBAMOperExecutVnfResponse(); + ProblemDetails pr=new ProblemDetails(); + pr.setStatus(200); + response.setProblemDetails(pr); + return response; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/impl/CbamMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/impl/CbamMgmrImpl.java new file mode 100644 index 00000000..50e265cd --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/impl/CbamMgmrImpl.java @@ -0,0 +1,185 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.impl; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.log4j.Logger; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.google.gson.Gson; +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; +import com.nokia.vfcadaptor.cbam.inf.CbamMgmrInf; +import com.nokia.vfcadaptor.common.bo.AdaptorEnv; +import com.nokia.vfcadaptor.constant.CommonConstants; +import com.nokia.vfcadaptor.http.client.HttpRequestProcessor; + +@Component +public class CbamMgmrImpl implements CbamMgmrInf { + private Logger logger = Logger.getLogger(CbamMgmrImpl.class); + + private Gson gson = new Gson(); + + @Autowired + private AdaptorEnv adaptorEnv; + + @Autowired + private HttpClientBuilder httpClientBuilder; + + private String retrieveToken() throws ClientProtocolException, IOException { + String result = null; + String url="https://" + adaptorEnv.getCbamIp() + CommonConstants.RetrieveCbamTokenPath; + HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, RequestMethod.POST); + processor.addHdeader(CommonConstants.ACCEPT, "*/*"); + processor.addHdeader(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); + + String bodyPostStr = String.format(CommonConstants.RetrieveCbamTokenPostStr, adaptorEnv.getGrantType(), adaptorEnv.getClientId(), adaptorEnv.getClientSecret()); + processor.addPostEntity(bodyPostStr); + + String responseStr = processor.process(url); + + logger.info("CbamMgmrImpl -> retrieveToken, responseStr is " + responseStr); + + JSONObject tokenJsonObject = new JSONObject(responseStr); + + result = tokenJsonObject.getString(CommonConstants.CBAM_TOKEN_KEY); + + return result; + } + + public CBAMCreateVnfResponse createVnf(CBAMCreateVnfRequest cbamRequest) throws ClientProtocolException, IOException { + String httpPath = CommonConstants.CbamCreateVnfPath; + RequestMethod method = RequestMethod.POST; + + String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method); + + logger.info("CbamMgmrImpl -> createVnf, responseStr is " + responseStr); + + CBAMCreateVnfResponse response = gson.fromJson(responseStr, CBAMCreateVnfResponse.class); + + return response; + } + + /* (non-Javadoc) + * @see com.nokia.vfcadaptor.cbam.impl.CbamMgmrInf#instantiateVnf(com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest, java.lang.String) + */ + public CBAMInstantiateVnfResponse instantiateVnf(CBAMInstantiateVnfRequest cbamRequest, String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.CbamInstantiateVnfPath, vnfInstanceId); + RequestMethod method = RequestMethod.POST; + + String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method); + + logger.info("CbamMgmrImpl -> instantiateVnf, responseStr is " + responseStr); + + CBAMInstantiateVnfResponse response = gson.fromJson(responseStr, CBAMInstantiateVnfResponse.class); + + return response; + } + + public CBAMTerminateVnfResponse terminateVnf(CBAMTerminateVnfRequest cbamRequest, String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.CbamTerminateVnfPath, vnfInstanceId); + RequestMethod method = RequestMethod.POST; + + String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method); + + logger.info("CbamMgmrImpl -> terminateVnf, responseStr is " + responseStr); + + CBAMTerminateVnfResponse response = gson.fromJson(responseStr, CBAMTerminateVnfResponse.class); + + return response; + } + + public void deleteVnf(String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.CbamDeleteVnfPath, vnfInstanceId); + RequestMethod method = RequestMethod.DELETE; + + operateCbamHttpTask(null, httpPath, method); + + logger.info("CbamMgmrImpl -> deleteVnf."); + } + + /* (non-Javadoc) + * @see com.nokia.vfcadaptor.cbam.impl.CbamMgmrInf#scaleVnf(com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest, java.lang.String) + */ + 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); + + CBAMScaleVnfResponse response = gson.fromJson(responseStr, CBAMScaleVnfResponse.class); + + return response; + } + + public CBAMHealVnfResponse healVnf(CBAMHealVnfRequest cbamRequest, String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.CbamHealVnfPath, vnfInstanceId); + RequestMethod method = RequestMethod.POST; + + String responseStr = operateCbamHttpTask(cbamRequest, httpPath, method); + + logger.info("CbamMgmrImpl -> healVnf, responseStr is " + responseStr); + + CBAMHealVnfResponse response = gson.fromJson(responseStr, CBAMHealVnfResponse.class); + + return response; + } + + public CBAMQueryVnfResponse queryVnf(String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.CbamQueryVnfPath, vnfInstanceId); + RequestMethod method = RequestMethod.GET; + + String responseStr = operateCbamHttpTask(null, httpPath, method); + + logger.info("CbamMgmrImpl -> queryVnf, responseStr is " + responseStr); + + CBAMQueryVnfResponse response = gson.fromJson(responseStr, CBAMQueryVnfResponse.class); + + return response; + } + + public String operateCbamHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException { + String token = retrieveToken(); + String url="https://" + adaptorEnv.getCbamIp() + httpPath; + HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, method); + processor.addHdeader(CommonConstants.AUTHORIZATION, "bearer " + token); + processor.addHdeader(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); + + processor.addPostEntity(gson.toJson(httpBodyObj)); + + String responseStr = processor.process(url); + + return responseStr; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/inf/CbamMgmrInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/inf/CbamMgmrInf.java new file mode 100644 index 00000000..fe0f424c --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/cbam/inf/CbamMgmrInf.java @@ -0,0 +1,54 @@ +/* + * 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 com.nokia.vfcadaptor.cbam.inf; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; + +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMCreateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMHealVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMInstantiateVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMQueryVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMScaleVnfResponse; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfRequest; +import com.nokia.vfcadaptor.cbam.bo.CBAMTerminateVnfResponse; + +public interface CbamMgmrInf { + + public CBAMCreateVnfResponse createVnf(CBAMCreateVnfRequest cbamRequest) throws ClientProtocolException, IOException; + + public CBAMInstantiateVnfResponse instantiateVnf(CBAMInstantiateVnfRequest cbamRequest, String vnfInstanceId) + throws ClientProtocolException, IOException; + + public CBAMTerminateVnfResponse terminateVnf(CBAMTerminateVnfRequest cbamRequest, String vnfInstanceId) + throws ClientProtocolException, IOException; + + public CBAMScaleVnfResponse scaleVnf(CBAMScaleVnfRequest cbamRequest, String vnfInstanceId) + throws ClientProtocolException, IOException; + + public CBAMHealVnfResponse healVnf(CBAMHealVnfRequest cbamRequest, String vnfInstanceId) + throws ClientProtocolException, IOException; + + public CBAMQueryVnfResponse queryVnf(String vnfInstanceId) throws ClientProtocolException, IOException; + + public void deleteVnf(String vnfInstanceId) throws ClientProtocolException, IOException; +}
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/AdaptorEnv.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/AdaptorEnv.java new file mode 100644 index 00000000..6400d7f3 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/AdaptorEnv.java @@ -0,0 +1,98 @@ +/* + * 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 com.nokia.vfcadaptor.common.bo; + +public class AdaptorEnv { + private String nslcmIp; + private String nslcmPort; + + //for retrieving token + private String cbamIp; + + private String grantType; + private String clientId; + private String clientSecret; + + private String catalogIp; + private String catalogPort; + + public String getCbamIp() { + return cbamIp; + } + + public void setCbamIp(String cbamIp) { + this.cbamIp = cbamIp; + } + + public String getGrantType() { + return grantType; + } + + public void setGrantType(String grantType) { + this.grantType = grantType; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public String getCatalogIp() { + return catalogIp; + } + + public void setCatalogIp(String catalogIp) { + this.catalogIp = catalogIp; + } + + public String getCatalogPort() { + return catalogPort; + } + + public void setCatalogPort(String catalogPort) { + this.catalogPort = catalogPort; + } + + public String getNslcmIp() { + return nslcmIp; + } + + public void setNslcmIp(String nslcmIp) { + this.nslcmIp = nslcmIp; + } + + public String getNslcmPort() { + return nslcmPort; + } + + public void setNslcmPort(String nslcmPort) { + this.nslcmPort = nslcmPort; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/KeyValuePair.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/KeyValuePair.java new file mode 100644 index 00000000..c883d932 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/common/bo/KeyValuePair.java @@ -0,0 +1,42 @@ +/* + * 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 com.nokia.vfcadaptor.common.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class KeyValuePair { + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private String value; + + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonConstants.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonConstants.java new file mode 100644 index 00000000..c4a9d4a8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonConstants.java @@ -0,0 +1,57 @@ +/* + * 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 com.nokia.vfcadaptor.constant; + +public class CommonConstants { + public static final String HTTP_ERROR_DESC_500 = "Internal Server Error"; + + + public static final String CONTENT_TYPE = "Content-Type"; + public static final String ACCEPT = "Accept"; + + public static final String AUTH = "auth"; + public static final String AUTHORIZATION = "Authorization"; + public static final String UTF_8 = "utf-8"; + + //Nslcm path + public static final String RetrieveNvfmListPath = "/nslcm/vl/vnfms/%s"; + public static final String NslcmGrantPath = "/nslcm/v1/ns/grantvnf"; + public static final String NslcmNotifyPath = "/nslcm/v1/vnfs/%s/Notify"; + + //Catalog path + public static final String RetrieveVnfPackagePath = "/catalog/v1/vnfpackages/%s"; + + //CBAM -- Nokia VNFM path + public static final String CBAM_TOKEN_KEY = "access_token"; + public static final String RetrieveCbamTokenPath="/auth/realms/cbam/protocol/openid-connect/token"; + public static final String RetrieveCbamTokenPostStr="grant_type=%s&client_id=%s&client_secret=%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 NSLCM_OPERATION_INSTANTIATE = "Instantiate"; + public static final String NSLCM_OPERATION_SCALE_OUT = "Scaleout"; + public static final String NSLCM_OPERATION_SCALE_IN = "Scalein"; + public static final String NSLCM_OPERATION_SCALE_UP = "Scaleup"; + public static final String NSLCM_OPERATION_SCALE_DOWN = "Scaledown"; + public static final String NSLCM_OPERATION_SCALE_TERMINATE = "Terminal"; +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonEnum.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonEnum.java new file mode 100644 index 00000000..dcf1b4b3 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/constant/CommonEnum.java @@ -0,0 +1,78 @@ +/* +* 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 com.nokia.vfcadaptor.constant; + +public class CommonEnum { + + // Termination + public enum TerminationType { + GRACEFUL, FORCEFUL + } + + // Instantiation + + public enum InstantiationState { + NOT_INSTANTIATED, INSTANTIATED + } + // operation status + + public enum OperationStatus { + STARTED, FINISHED, FAILED, OTHER + } + + // scale + public enum ScaleDirection { + OUT, IN + } + + public enum ScaleType { + SCALE_OUT, SCALE_IN + } + + public enum Deletionpending { + TRUR, fALSE + } + + // GrantVnf + public enum LifecycleOperation { + Instantiate, Scaleout, Scalein, Scaleup, Scaledown, Terminal + } + + public enum type { + VDU, VL, CP, Strorage + } + + // NotifyLcmEvents + public enum status { + start, result + } + + public enum changeType { + vl_added, vl_removed, vl_modified + + } + + public enum resourceType + + { + vm, volume, network, port + } + + public enum AffectchangeType{ + added,removed, modified + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/exception/VnfmDriverException.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/exception/VnfmDriverException.java new file mode 100644 index 00000000..9ce9f09d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/exception/VnfmDriverException.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 com.nokia.vfcadaptor.exception; + +public class VnfmDriverException extends RuntimeException{ + private static final long serialVersionUID = 14325435432545L; + + private int httpStatus; + + public VnfmDriverException(int httpStatus, String message) + { + super(message); + this.httpStatus = httpStatus; + } + + public int getHttpStatus() { + return httpStatus; + } + + public void setHttpStatus(int httpStatus) { + this.httpStatus = httpStatus; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpClientUtils.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpClientUtils.java new file mode 100644 index 00000000..f00b5664 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpClientUtils.java @@ -0,0 +1,90 @@ +/* + * 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 com.nokia.vfcadaptor.http.client; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; + +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +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.conn.PoolingHttpClientConnectionManager; +import org.apache.http.ssl.SSLContextBuilder; +import org.apache.http.ssl.TrustStrategy; +import org.apache.log4j.Logger; +import org.springframework.web.bind.annotation.RequestMethod; + +public class HttpClientUtils { + private final static Logger logger = Logger.getLogger(HttpClientUtils.class); + + public static HttpClientBuilder createHttpClientBuilder() { + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + + 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); + return httpClientBuilder; + } + + public static HttpRequestBase getHttpRequest(RequestMethod requestMethod) { + HttpRequestBase base = null; + switch(requestMethod) { + case GET: + base = new HttpGet(); + break; + case DELETE: + base = new HttpDelete(); + break; + default: + base = new HttpPost(); + break; + } + return base; + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessor.java new file mode 100644 index 00000000..0e8903a8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessor.java @@ -0,0 +1,70 @@ +/* + * 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 com.nokia.vfcadaptor.http.client; + +import java.io.IOException; +import java.net.URI; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.nokia.vfcadaptor.constant.CommonConstants; + +public class HttpRequestProcessor { + private CloseableHttpClient httpClient; + private HttpRequestBase httpRequest; + + public HttpRequestProcessor(HttpClientBuilder httpClientBuilder, RequestMethod requestMethod) + { + httpClient = httpClientBuilder.build(); + httpRequest = HttpClientUtils.getHttpRequest(requestMethod); + } + + public String process(String url) throws ClientProtocolException, IOException + { + httpRequest.setURI(URI.create(url)); + + HttpResponse response = httpClient.execute(httpRequest); + HttpEntity resEntity = response.getEntity(); + String responseContent = ""; + if (resEntity != null) { + responseContent = EntityUtils.toString(resEntity, CommonConstants.UTF_8); + EntityUtils.consume(resEntity); + } + httpClient.close(); + + return responseContent; + } + + public void addHdeader(String key, String value) { + httpRequest.setHeader(key, value); + + } + + public void addPostEntity(String bodyStr) { + ((HttpPost)httpRequest).setEntity(new StringEntity(bodyStr, CommonConstants.UTF_8)); + + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfRequest.java new file mode 100644 index 00000000..b6d1f92f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfRequest.java @@ -0,0 +1,108 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.common.bo.KeyValuePair; +import com.nokia.vfcadaptor.constant.CommonEnum; +import com.nokia.vfcadaptor.nslcm.bo.entity.ResourceDefinition; + +public class NslcmGrantVnfRequest { + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("vnfDescriptorId") + private String vnfDescriptorId; + + @JsonProperty("lifecycleOperation") + private CommonEnum.LifecycleOperation lifecycleOperation; + + @JsonProperty("jobId") + private String jobId; + + @JsonProperty("addResource") + private List<ResourceDefinition> addResource; + + @JsonProperty("removeResource") + private List<ResourceDefinition> removeResource; + + @JsonProperty("additionalParam") + private List<KeyValuePair> additionalParam; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfDescriptorId() { + return vnfDescriptorId; + } + + public void setVnfDescriptorId(String vnfDescriptorId) { + this.vnfDescriptorId = vnfDescriptorId; + } + + public CommonEnum.LifecycleOperation getLifecycleOperation() { + return lifecycleOperation; + } + + public void setLifecycleOperation(CommonEnum.LifecycleOperation lifecycleOperation) { + this.lifecycleOperation = lifecycleOperation; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public List<KeyValuePair> getAdditionalParam() { + return additionalParam; + } + + public void setAdditionalParam(List<KeyValuePair> additionalParam) { + this.additionalParam = additionalParam; + } + + public List<ResourceDefinition> getAddResource() { + return addResource; + } + + public void setAddResource(List<ResourceDefinition> addResource) { + this.addResource = addResource; + } + + public List<ResourceDefinition> getRemoveResource() { + return removeResource; + } + + public void setRemoveResource(List<ResourceDefinition> removeResource) { + this.removeResource = removeResource; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfResponse.java new file mode 100644 index 00000000..f4169c63 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmGrantVnfResponse.java @@ -0,0 +1,64 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.nslcm.bo.entity.ResourceDefinition; +import com.nokia.vfcadaptor.nslcm.bo.entity.VimAssets; +import com.nokia.vfcadaptor.nslcm.bo.entity.VimInfo; + +public class NslcmGrantVnfResponse { + + @JsonProperty("vim") + private VimInfo vim; + @JsonProperty("vimAssets") + private VimAssets vimAssets; + + @JsonProperty("additionalParam") + private List<ResourceDefinition> additionalParam; + + public VimInfo getVim() { + return vim; + } + + public void setVim(VimInfo vim) { + this.vim = vim; + } + + public VimAssets getVimAssets() { + return vimAssets; + } + + public void setVimAssets(VimAssets vimAssets) { + this.vimAssets = vimAssets; + } + + public List<ResourceDefinition> getAdditionalParam() { + return additionalParam; + } + + public void setAdditionalParam(List<ResourceDefinition> additionalParam) { + this.additionalParam = additionalParam; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmNotifyLCMEventsRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmNotifyLCMEventsRequest.java new file mode 100644 index 00000000..9552cd81 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/NslcmNotifyLCMEventsRequest.java @@ -0,0 +1,88 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; +import com.nokia.vfcadaptor.nslcm.bo.entity.AffectedVirtualLink; +import com.nokia.vfcadaptor.nslcm.bo.entity.AffectedVirtualStorage; +import com.nokia.vfcadaptor.nslcm.bo.entity.AffectedVnfc; + +public class NslcmNotifyLCMEventsRequest { + + @JsonProperty("status") + private CommonEnum.status status; + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + @JsonProperty("operation") + private String operation; + @JsonProperty("jobId") + private String jobId; + @JsonProperty("affectedVnfc") + private AffectedVnfc affectedVnfc; + @JsonProperty("affectedVl") + private AffectedVirtualLink affectedVl; + @JsonProperty("affectedVirtualStorage") + private AffectedVirtualStorage affectedVirtualStorage; + public CommonEnum.status getStatus() { + return status; + } + public void setStatus(CommonEnum.status status) { + this.status = status; + } + public String getVnfInstanceId() { + return vnfInstanceId; + } + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + public String getOperation() { + return operation; + } + public void setOperation(String operation) { + this.operation = operation; + } + public String getJobId() { + return jobId; + } + public void setJobId(String jobId) { + this.jobId = jobId; + } + public AffectedVnfc getAffectedVnfc() { + return affectedVnfc; + } + public void setAffectedVnfc(AffectedVnfc affectedVnfc) { + this.affectedVnfc = affectedVnfc; + } + public AffectedVirtualLink getAffectedVl() { + return affectedVl; + } + public void setAffectedVl(AffectedVirtualLink affectedVl) { + this.affectedVl = affectedVl; + } + public AffectedVirtualStorage getAffectedVirtualStorage() { + return affectedVirtualStorage; + } + public void setAffectedVirtualStorage(AffectedVirtualStorage affectedVirtualStorage) { + this.affectedVirtualStorage = affectedVirtualStorage; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/VnfmInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/VnfmInfo.java new file mode 100644 index 00000000..1d0d295e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/VnfmInfo.java @@ -0,0 +1,153 @@ +/* + * 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 com.nokia.vfcadaptor.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/com/nokia/vfcadaptor/nslcm/bo/entity/AccessInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AccessInfo.java new file mode 100644 index 00000000..2d550227 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AccessInfo.java @@ -0,0 +1,59 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AccessInfo { + + @JsonProperty("tenant") + private String tenant; + + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + 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; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualLink.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualLink.java new file mode 100644 index 00000000..28020ed0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualLink.java @@ -0,0 +1,68 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class AffectedVirtualLink { + @JsonProperty("vlInstanceId") + private String vlInstanceId; + @JsonProperty("vldid") + private String vldid; + @JsonProperty("changeType") + private CommonEnum.changeType changeType; + + @JsonProperty("networkResource") + private ResourceHandle networkResource; + + public String getVlInstanceId() { + return vlInstanceId; + } + + public void setVlInstanceId(String vlInstanceId) { + this.vlInstanceId = vlInstanceId; + } + + public String getVldid() { + return vldid; + } + + public void setVldid(String vldid) { + this.vldid = vldid; + } + + public CommonEnum.changeType getChangeType() { + return changeType; + } + + public void setChangeType(CommonEnum.changeType changeType) { + this.changeType = changeType; + } + + public ResourceHandle getNetworkResource() { + return networkResource; + } + + public void setNetworkResource(ResourceHandle networkResource) { + this.networkResource = networkResource; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualStorage.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualStorage.java new file mode 100644 index 00000000..5080d4e0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVirtualStorage.java @@ -0,0 +1,56 @@ +/* +* 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AffectedVirtualStorage { + @JsonProperty("vsInstanceId") + private String vsInstanceId; + @JsonProperty("vsdId") + private String vsdId; + + @JsonProperty("changeType") + private String changeType; + @JsonProperty("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/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVnfc.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVnfc.java new file mode 100644 index 00000000..5f1fea01 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/AffectedVnfc.java @@ -0,0 +1,57 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class AffectedVnfc { + @JsonProperty("vnfcInstanceId") + private String vnfcInstanceId; + @JsonProperty("vduId") + private String vduId; + @JsonProperty("changeType") + private CommonEnum.AffectchangeType changeType; + @JsonProperty("storageResource") + private ResourceHandle storageResource; + public String getVnfcInstanceId() { + return vnfcInstanceId; + } + public void setVnfcInstanceId(String vnfcInstanceId) { + this.vnfcInstanceId = vnfcInstanceId; + } + public String getVduId() { + return vduId; + } + public void setVduId(String vduId) { + this.vduId = vduId; + } + public CommonEnum.AffectchangeType getChangeType() { + return changeType; + } + public void setChangeType(CommonEnum.AffectchangeType changeType) { + this.changeType = changeType; + } + public ResourceHandle getStorageResource() { + return storageResource; + } + public void setStorageResource(ResourceHandle storageResource) { + this.storageResource = storageResource; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/GrantInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/GrantInfo.java new file mode 100644 index 00000000..47b41f97 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/GrantInfo.java @@ -0,0 +1,83 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class GrantInfo { + + @JsonProperty("resourceDefinitionId") + private String resourceDefinitionId; + + @JsonProperty("reservationId") + private String reservationId; + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("resourceProviderId") + private String resourceProviderId; + + @JsonProperty("zoneId") + private String zoneId; + + public String getResourceDefinitionId() { + return resourceDefinitionId; + } + + public void setResourceDefinitionId(String resourceDefinitionId) { + this.resourceDefinitionId = resourceDefinitionId; + } + + public String getReservationId() { + return reservationId; + } + + public void setReservationId(String reservationId) { + this.reservationId = reservationId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getResourceProviderId() { + return resourceProviderId; + } + + public void setResourceProviderId(String resourceProviderId) { + this.resourceProviderId = resourceProviderId; + } + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/InterfaceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/InterfaceInfo.java new file mode 100644 index 00000000..b0a348ee --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/InterfaceInfo.java @@ -0,0 +1,59 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class InterfaceInfo { + + @JsonProperty("vimType") + private String vimType; + + @JsonProperty("apiVersion") + private String apiVersion; + + @JsonProperty("protocolType") + private String protocolType; + + public String getVimType() { + return vimType; + } + + public void setVimType(String vimType) { + this.vimType = vimType; + } + + public String getApiVersion() { + return apiVersion; + } + + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + public String getProtocolType() { + return protocolType; + } + + public void setProtocolType(String protocolType) { + this.protocolType = protocolType; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceDefinition.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceDefinition.java new file mode 100644 index 00000000..9b18b007 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceDefinition.java @@ -0,0 +1,59 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class ResourceDefinition { + + @JsonProperty("type") + private CommonEnum.type type; + + @JsonProperty("resourceDefinitionId") + private String resourceDefinitionId; + + @JsonProperty("vdu") + private String vdu; + + public CommonEnum.type getType() { + return type; + } + + public void setType(CommonEnum.type type) { + this.type = type; + } + + public String getResourceDefinitionId() { + return resourceDefinitionId; + } + + public void setResourceDefinitionId(String 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/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceHandle.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceHandle.java new file mode 100644 index 00000000..ce7f9ccb --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/ResourceHandle.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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class ResourceHandle { + + @JsonProperty("resourceType") + private CommonEnum.resourceType resourceType; + @JsonProperty("resourceId") + private String resourceId; + @JsonProperty("resourceName") + private String resourceName; + public CommonEnum.resourceType getResourceType() { + return resourceType; + } + public void setResourceType(CommonEnum.resourceType resourceType) { + this.resourceType = resourceType; + } + 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; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimAssets.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimAssets.java new file mode 100644 index 00000000..65ce3cfd --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimAssets.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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimAssets { + + @JsonProperty("softwareImage") + private VimSoftwareImage softwareImage; + + public VimSoftwareImage getSoftwareImage() { + return softwareImage; + } + + public void setSoftwareImage(VimSoftwareImage softwareImage) { + this.softwareImage = softwareImage; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimComputeResourceFlavour.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimComputeResourceFlavour.java new file mode 100644 index 00000000..ae27dd99 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimComputeResourceFlavour.java @@ -0,0 +1,58 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimComputeResourceFlavour { + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("vduId") + private String vduId; + + @JsonProperty("vimFlavourId") + private String vimFlavourId; + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getVduId() { + return vduId; + } + + public void setVduId(String vduId) { + this.vduId = vduId; + } + + public String getVimFlavourId() { + return vimFlavourId; + } + + public void setVimFlavourId(String vimFlavourId) { + this.vimFlavourId = vimFlavourId; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimInfo.java new file mode 100644 index 00000000..ef734a23 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimInfo.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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimInfo { + + @JsonProperty("vimInfoId") + private String vimInfoId; + + @JsonProperty("vimId") + private String vimId; + @JsonProperty("interfaceInfo") + private InterfaceInfo interfaceInfo; + @JsonProperty("accessInfo") + private AccessInfo accessInfo; + + @JsonProperty("interfaceEndpoint") + private String interfaceEndpoint; + + public String getVimInfoId() { + return vimInfoId; + } + + public void setVimInfoId(String vimInfoId) { + this.vimInfoId = vimInfoId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public InterfaceInfo getInterfaceInfo() { + return interfaceInfo; + } + + public void setInterfaceInfo(InterfaceInfo interfaceInfo) { + this.interfaceInfo = interfaceInfo; + } + + public AccessInfo getAccessInfo() { + return accessInfo; + } + + public void setAccessInfo(AccessInfo accessInfo) { + this.accessInfo = accessInfo; + } + + public String getInterfaceEndpoint() { + return interfaceEndpoint; + } + + public void setInterfaceEndpoint(String interfaceEndpoint) { + this.interfaceEndpoint = interfaceEndpoint; + } + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimSoftwareImage.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimSoftwareImage.java new file mode 100644 index 00000000..5aba7761 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VimSoftwareImage.java @@ -0,0 +1,59 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimSoftwareImage { + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("imageName") + private String imageName; + + @JsonProperty("vimImageId") + private String vimImageId; + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getImageName() { + return imageName; + } + + public void setImageName(String imageName) { + this.imageName = imageName; + } + + public String getVimImageId() { + return vimImageId; + } + + public void setVimImageId(String vimImageId) { + this.vimImageId = vimImageId; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VnfPackageInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VnfPackageInfo.java new file mode 100644 index 00000000..1793b148 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/bo/entity/VnfPackageInfo.java @@ -0,0 +1,141 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class VnfPackageInfo { + + @JsonProperty("name") + private String name; + + @JsonProperty("provider") + private String provider; + + @JsonProperty("version") + private String version; + + @JsonProperty("onBoardState") + private String onBoardState; + + @JsonProperty("deletionPending") + private CommonEnum.Deletionpending deletionPending; + + @JsonProperty("downloadUri") + private String downloadUri; + + @JsonProperty("vnfdId") + private String vnfdId; + + @JsonProperty("vnfdProvider") + private String vnfdProvider; + + @JsonProperty("vnfdVersion") + private String vnfdVersion; + + @JsonProperty("vnfVersion") + private String vnfVersion; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getOnBoardState() { + return onBoardState; + } + + public void setOnBoardState(String onBoardState) { + this.onBoardState = onBoardState; + } + + public CommonEnum.Deletionpending getDeletionPending() { + return deletionPending; + } + + public void setDeletionPending(CommonEnum.Deletionpending deletionPending) { + this.deletionPending = deletionPending; + } + + public String getDownloadUri() { + return downloadUri; + } + + public void setDownloadUri(String downloadUri) { + this.downloadUri = downloadUri; + } + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + public String getVnfdProvider() { + return vnfdProvider; + } + + public void setVnfdProvider(String vnfdProvider) { + this.vnfdProvider = vnfdProvider; + } + + public String getVnfdVersion() { + return vnfdVersion; + } + + public void setVnfdVersion(String vnfdVersion) { + this.vnfdVersion = vnfdVersion; + } + + public String getVnfVersion() { + return vnfVersion; + } + + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; + } + + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/impl/NslcmMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/impl/NslcmMgmrImpl.java new file mode 100644 index 00000000..e5b8180b --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/impl/NslcmMgmrImpl.java @@ -0,0 +1,97 @@ +/* + * 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 com.nokia.vfcadaptor.nslcm.impl; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.google.gson.Gson; +import com.nokia.vfcadaptor.common.bo.AdaptorEnv; +import com.nokia.vfcadaptor.constant.CommonConstants; +import com.nokia.vfcadaptor.http.client.HttpRequestProcessor; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfRequest; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.bo.NslcmNotifyLCMEventsRequest; +import com.nokia.vfcadaptor.nslcm.bo.VnfmInfo; +import com.nokia.vfcadaptor.nslcm.inf.NslcmMgmrInf; + +@Component +public class NslcmMgmrImpl implements NslcmMgmrInf{ + private Logger logger = Logger.getLogger(NslcmMgmrImpl.class); + + @Autowired + private AdaptorEnv adaptorEnv; + + @Autowired + private HttpClientBuilder httpClientBuilder; + + private Gson gson = new Gson(); + + public VnfmInfo queryVnfm(String vnfmId) throws ClientProtocolException, IOException + { + String httpPath = String.format(CommonConstants.RetrieveNvfmListPath, vnfmId); + RequestMethod method = RequestMethod.GET; + + String responseStr = operateNslcmHttpTask(null, httpPath, method); + + logger.info("NslcmMgmrImpl->queryVnfm, the vnfmInfo is " + responseStr); + + VnfmInfo response = gson.fromJson(responseStr, VnfmInfo.class); + + return response; + } + + public NslcmGrantVnfResponse grantVnf(NslcmGrantVnfRequest driverRequest) throws ClientProtocolException, IOException { + String httpPath = CommonConstants.NslcmGrantPath; + RequestMethod method = RequestMethod.POST; + + String responseStr = operateNslcmHttpTask(driverRequest, httpPath, method); + + logger.info("NslcmMgmrImpl->grantVnf, the NslcmGrantVnfResponse is " + responseStr); + + NslcmGrantVnfResponse response = gson.fromJson(responseStr, NslcmGrantVnfResponse.class); + + return response; + } + + public void notifyVnf(NslcmNotifyLCMEventsRequest driverRequest, String vnfInstanceId) throws ClientProtocolException, IOException { + String httpPath = String.format(CommonConstants.NslcmNotifyPath, vnfInstanceId); + RequestMethod method = RequestMethod.POST; + + operateNslcmHttpTask(driverRequest, httpPath, method); + } + + public String operateNslcmHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException { + String url="http://" + adaptorEnv.getNslcmIp() + ":" + adaptorEnv.getNslcmPort() + httpPath; + HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, method); + processor.addHdeader(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); + + processor.addPostEntity(gson.toJson(httpBodyObj)); + + String responseStr = processor.process(url); + + return responseStr; + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/inf/NslcmMgmrInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/inf/NslcmMgmrInf.java new file mode 100644 index 00000000..98e27858 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/nslcm/inf/NslcmMgmrInf.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 com.nokia.vfcadaptor.nslcm.inf; + +import java.io.IOException; + +import org.apache.http.client.ClientProtocolException; + +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfRequest; +import com.nokia.vfcadaptor.nslcm.bo.NslcmGrantVnfResponse; +import com.nokia.vfcadaptor.nslcm.bo.NslcmNotifyLCMEventsRequest; +import com.nokia.vfcadaptor.nslcm.bo.VnfmInfo; + +public interface NslcmMgmrInf { + public VnfmInfo queryVnfm(String vnfmId) throws ClientProtocolException, IOException; + + public NslcmGrantVnfResponse grantVnf(NslcmGrantVnfRequest driverRequest) throws ClientProtocolException, IOException; + + public void notifyVnf(NslcmNotifyLCMEventsRequest driverRequest, String vnfInstanceId) throws ClientProtocolException, IOException; +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfRequest.java new file mode 100644 index 00000000..45dc5ed6 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfRequest.java @@ -0,0 +1,55 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.Affectedvm; + + +public class HealVnfRequest { + @JsonProperty("action") + private String action; + + @JsonProperty("affectedvm") + private Affectedvm affectedvm; + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public Affectedvm getAffectedvm() { + return affectedvm; + } + + public void setAffectedvm(Affectedvm affectedvm) { + this.affectedvm = affectedvm; + } + + + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfResponse.java new file mode 100644 index 00000000..f2ec9e78 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/HealVnfResponse.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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class HealVnfResponse { + @JsonProperty("jobId") + private String jobId; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfRequest.java new file mode 100644 index 00000000..267288d3 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfRequest.java @@ -0,0 +1,115 @@ +/* +* 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 com.nokia.vfcadaptor.vnfmdriver.bo; + + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.AdditionalParam; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ExtVirtualLinkData; + +//@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "@id") +// -- zhouyufei added property id cause problem -- 415 Unsupported Media Type (UTF-8 is not supported) +public class InstantiateVnfRequest { + @JsonProperty("vnfInstanceName") + private String vnfInstanceName; + + @JsonProperty("vnfPackageId") + private String vnfPackageId; + + @JsonProperty("vnfDescriptorId") + private String vnfDescriptorId; + + @JsonProperty("flavourId") + private String flavourId; + + @JsonProperty("vnfInstanceDescription") + private String vnfInstanceDescription; + + @JsonProperty("extVirtualLink") +// @JsonBackReference -- zhouyufei deprecated, and mustn't initiate by new ArrayList; +// private List<ExtVirtualLinkData> extVirtualLink = new ArrayList<ExtVirtualLinkData>(); + private List<ExtVirtualLinkData> extVirtualLink; + + @JsonProperty("additionalParam") + private AdditionalParam additionalParam; + + + + public String getVnfInstanceName() { + return vnfInstanceName; + } + + public void setVnfInstanceName(String vnfInstanceName) { + this.vnfInstanceName = vnfInstanceName; + } + + public String getVnfPackageId() { + return vnfPackageId; + } + + public void setVnfPackageId(String vnfPackageId) { + this.vnfPackageId = vnfPackageId; + } + + public String getVnfDescriptorId() { + return vnfDescriptorId; + } + + public void setVnfDescriptorId(String vnfDescriptorId) { + this.vnfDescriptorId = vnfDescriptorId; + } + + public String getFlavourId() { + return flavourId; + } + + public void setFlavourId(String flavourId) { + this.flavourId = flavourId; + } + + public String getVnfInstanceDescription() { + return vnfInstanceDescription; + } + + public void setVnfInstanceDescription(String vnfInstanceDescription) { + this.vnfInstanceDescription = vnfInstanceDescription; + } + + public AdditionalParam getAdditionalParam() { + return additionalParam; + } + + public void setAdditionalParam(AdditionalParam additionalParam) { + this.additionalParam = additionalParam; + } + + public List<ExtVirtualLinkData> getExtVirtualLink() { + return extVirtualLink; + } + + public void setExtVirtualLink(List<ExtVirtualLinkData> extVirtualLink) { + this.extVirtualLink = extVirtualLink; + } + +} + + diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfResponse.java new file mode 100644 index 00000000..c84cde2c --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/InstantiateVnfResponse.java @@ -0,0 +1,43 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class InstantiateVnfResponse { + @JsonProperty("jobId") + private String jobId; + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfRequest.java new file mode 100644 index 00000000..aa663c80 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfRequest.java @@ -0,0 +1,22 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + + +public class OperStatusVnfRequest { + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfResponse.java new file mode 100644 index 00000000..2d84b21b --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/OperStatusVnfResponse.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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.ResponseDescriptor; + +public class OperStatusVnfResponse { + @JsonProperty("jobId") + private String jobId; + + @JsonProperty("responseDescriptor")//Including:vnfStatus��statusDescription��errorCode��progress��responseHistoryList��responseId + private ResponseDescriptor responseDescriptor; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public ResponseDescriptor getResponseDescriptor() { + return responseDescriptor; + } + + public void setResponseDescriptor(ResponseDescriptor responseDescriptor) { + this.responseDescriptor = responseDescriptor; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfRequest.java new file mode 100644 index 00000000..c693adfb --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfRequest.java @@ -0,0 +1,26 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + + + +public class QueryVnfRequest { + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfResponse.java new file mode 100644 index 00000000..7e3b462d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/QueryVnfResponse.java @@ -0,0 +1,36 @@ + +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.VnfInfo; + +public class QueryVnfResponse { + @JsonProperty("vnfInfo") + private VnfInfo vnfInfo; + + + public VnfInfo getVnfInfo() { + return vnfInfo; + } + + public void setVnfInfo(VnfInfo vnfInfo) { + this.vnfInfo = vnfInfo; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfRequest.java new file mode 100644 index 00000000..396d2aaf --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfRequest.java @@ -0,0 +1,85 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; +import com.nokia.vfcadaptor.vnfmdriver.bo.entity.AdditionalParam; + +public class ScaleVnfRequest { + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("type") + private CommonEnum.ScaleType type; + + @JsonProperty("aspectId") + private String aspectId; + + @JsonProperty("numberOfSteps") + private Integer numberOfSteps; + + @JsonProperty("additionalParam") + private AdditionalParam additionalParam; + + + public String getAspectId() { + return aspectId; + } + + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + public Integer getNumberOfSteps() { + return numberOfSteps; + } + + public void setNumberOfSteps(Integer numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } + + public AdditionalParam getAdditionalParam() { + return additionalParam; + } + + public void setAdditionalParam(AdditionalParam additionalParam) { + this.additionalParam = additionalParam; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public CommonEnum.ScaleType getType() { + return type; + } + + public void setType(CommonEnum.ScaleType type) { + this.type = type; + } + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfResponse.java new file mode 100644 index 00000000..4b05b9b9 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/ScaleVnfResponse.java @@ -0,0 +1,39 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ScaleVnfResponse { + @JsonProperty("jobId") + private String jobId; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfRequest.java new file mode 100644 index 00000000..24963392 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfRequest.java @@ -0,0 +1,71 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class TerminateVnfRequest { + + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("terminationType") + private CommonEnum.TerminationType terminationType; + + @JsonProperty("gracefulTerminationTimeout") + private Integer gracefulTerminationTimeout; + + public enum TerminationType{ + + GRACEFUL, FORCEFUL; + } + + + + + + + + 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 String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfResponse.java new file mode 100644 index 00000000..143fdf58 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/TerminateVnfResponse.java @@ -0,0 +1,31 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class TerminateVnfResponse { + @JsonProperty("jobId") + private String jobId; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AccessInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AccessInfo.java new file mode 100644 index 00000000..83cbde44 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AccessInfo.java @@ -0,0 +1,57 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AccessInfo { + @JsonProperty("tenant") + private String tenant; + + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + 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; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AdditionalParam.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AdditionalParam.java new file mode 100644 index 00000000..3e3c25f8 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/AdditionalParam.java @@ -0,0 +1,21 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +public class AdditionalParam { + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/Affectedvm.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/Affectedvm.java new file mode 100644 index 00000000..898404d9 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/Affectedvm.java @@ -0,0 +1,58 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Affectedvm { + @JsonProperty("vimid") + private String vimid; + + @JsonProperty("vduid") + private String vduid; + + @JsonProperty("vmname") + private String vmname; + + public String getVimid() { + return vimid; + } + + public void setVimid(String vimid) { + this.vimid = vimid; + } + + public String getVduid() { + return vduid; + } + + public void setVduid(String vduid) { + this.vduid = vduid; + } + + public String getVmname() { + return vmname; + } + + public void setVmname(String vmname) { + this.vmname = vmname; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ExtVirtualLinkData.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ExtVirtualLinkData.java new file mode 100644 index 00000000..7c52c5b1 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ExtVirtualLinkData.java @@ -0,0 +1,58 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + + +public class ExtVirtualLinkData { + @JsonProperty("vlInstanceId") + private String vlInstanceId; + @JsonProperty("vim") + private VimInfo vim; + @JsonProperty("networkId") + private String networkId; + @JsonProperty("cpdId") + private String cpdId; + public String getVlInstanceId() { + return vlInstanceId; + } + public void setVlInstanceId(String vlInstanceId) { + this.vlInstanceId = vlInstanceId; + } + public VimInfo getVim() { + return vim; + } + public void setVim(VimInfo vim) { + this.vim = vim; + } + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + public String getCpdId() { + return cpdId; + } + public void setCpdId(String cpdId) { + this.cpdId = cpdId; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/InterfaceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/InterfaceInfo.java new file mode 100644 index 00000000..b9464127 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/InterfaceInfo.java @@ -0,0 +1,58 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class InterfaceInfo { + + @JsonProperty("vimInfoId") + private String vimType; + + @JsonProperty("apiVersion") + private String apiVersion; + + @JsonProperty("protocolType") + private String protocolType; + + public String getVimType() { + return vimType; + } + + public void setVimType(String vimType) { + this.vimType = vimType; + } + + public String getApiVersion() { + return apiVersion; + } + + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + public String getProtocolType() { + return protocolType; + } + + public void setProtocolType(String protocolType) { + this.protocolType = protocolType; + } + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseDescriptor.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseDescriptor.java new file mode 100644 index 00000000..197d466f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseDescriptor.java @@ -0,0 +1,104 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ResponseDescriptor { + + + @JsonProperty("status") + private String status;//started;processing;finished;error + + @JsonProperty("progress") + private Integer progress;//progress (1-100) + + @JsonProperty("statusDescription") + private String statusDescription; + + @JsonProperty("errorCode") + private Integer errorCode; + + @JsonProperty("responseId") + private Integer responseId; + + @JsonProperty("responseHistoryList") + private List<ResponseHistoryList> responseHistoryList; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + + public Integer getProgress() { + return progress; + } + + + public void setProgress(Integer progr) { + if(progr>0 && progr<100) { + progress = progr; + } + } + + public String getStatusDescription() { + return statusDescription; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Integer getErrorCode() { + return errorCode; + } + + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + public Integer getResponseId() { + return responseId; + } + + public void setResponseId(Integer responseId) { + this.responseId = responseId; + } + + public List<ResponseHistoryList> getResponseHistoryList() { + return responseHistoryList; + } + + public void setResponseHistoryList(List<ResponseHistoryList> responseHistoryList) { + this.responseHistoryList = responseHistoryList; + } + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseHistoryList.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseHistoryList.java new file mode 100644 index 00000000..5863985d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/ResponseHistoryList.java @@ -0,0 +1,91 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ResponseHistoryList { + + + @JsonProperty("status") + private String status;//started;processing;finished;error + + @JsonProperty("progress") + private Integer progress;//progress (1-100) + + @JsonProperty("statusDescription") + private String statusDescription; + + @JsonProperty("errorCode") + private Integer errorCode; + + @JsonProperty("responseId") + private Integer responseId; + + + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + public Integer getProgress() { + return progress; + } + + public void setProgress(Integer progress) { + this.progress = progress; + } + + public String getStatusDescription() { + return statusDescription; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Integer getErrorCode() { + return errorCode; + } + + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + public Integer getResponseId() { + return responseId; + } + + public void setResponseId(Integer responseId) { + this.responseId = responseId; + } + + + + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VimInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VimInfo.java new file mode 100644 index 00000000..ea9a687f --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VimInfo.java @@ -0,0 +1,80 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VimInfo { + @JsonProperty("vimInfoId") + private String vimInfoId; + + @JsonProperty("vimId") + private String vimId; + + @JsonProperty("interfaceInfo") + private InterfaceInfo interfaceInfo; + + @JsonProperty("accessInfo") + private AccessInfo accessInfo; + + @JsonProperty("interfaceEndpoint") + private String interfaceEndpoint; + + public String getVimInfoId() { + return vimInfoId; + } + + public void setVimInfoId(String vimInfoId) { + this.vimInfoId = vimInfoId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public InterfaceInfo getInterfaceInfo() { + return interfaceInfo; + } + + public void setInterfaceInfo(InterfaceInfo interfaceInfo) { + this.interfaceInfo = interfaceInfo; + } + + public AccessInfo getAccessInfo() { + return accessInfo; + } + + public void setAccessInfo(AccessInfo accessInfo) { + this.accessInfo = accessInfo; + } + + public String getInterfaceEndpoint() { + return interfaceEndpoint; + } + + public void setInterfaceEndpoint(String interfaceEndpoint) { + this.interfaceEndpoint = interfaceEndpoint; + } + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VnfInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VnfInfo.java new file mode 100644 index 00000000..543f805d --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/bo/entity/VnfInfo.java @@ -0,0 +1,125 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.bo.entity; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.nokia.vfcadaptor.constant.CommonEnum; + +public class VnfInfo { + @JsonProperty("vnfInstanceId") + private String vnfInstanceId; + + @JsonProperty("vnfInstanceName") + private String vnfInstanceName; + + @JsonProperty("vnfInstanceDescription") + private String vnfInstanceDescription; + + @JsonProperty("vnfdId") + private String vnfdId; + + @JsonProperty("vnfPackageId") + private String vnfPackageId; + + @JsonProperty("version") + private String version; + + @JsonProperty("vnfProvider") + private String vnfProvider; + + @JsonProperty("vnfType") + private String vnfType; + + @JsonProperty("vnfStatus") + private CommonEnum.InstantiationState vnfStatus; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfInstanceName() { + return vnfInstanceName; + } + + public void setVnfInstanceName(String vnfInstanceName) { + this.vnfInstanceName = vnfInstanceName; + } + + public String getVnfInstanceDescription() { + return vnfInstanceDescription; + } + + public void setVnfInstanceDescription(String vnfInstanceDescription) { + this.vnfInstanceDescription = vnfInstanceDescription; + } + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + public String getVnfPackageId() { + return vnfPackageId; + } + + public void setVnfPackageId(String vnfPackageId) { + this.vnfPackageId = vnfPackageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getVnfProvider() { + return vnfProvider; + } + + public void setVnfProvider(String vnfProvider) { + this.vnfProvider = vnfProvider; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public CommonEnum.InstantiationState getVnfStatus() { + return vnfStatus; + } + + public void setVnfStatus(CommonEnum.InstantiationState vnfStatus) { + this.vnfStatus = vnfStatus; + } + + + + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverController.java new file mode 100644 index 00000000..ba2641b5 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverController.java @@ -0,0 +1,195 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.controller; + +import java.io.IOException; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.http.HttpStatus; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.google.gson.Gson; +import com.nokia.vfcadaptor.exception.VnfmDriverException; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.OperStatusVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.QueryVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.inf.VnfmDriverMgmrInf; + +@Controller +@RequestMapping(value = "/nokiavnfm/v1") +public class VnfmDriverController { + private Logger logger = Logger.getLogger(VnfmDriverController.class); + + @Autowired + private VnfmDriverMgmrInf vnfmDriverMgmr; + + private Gson gson = new Gson(); + + @RequestMapping(value = "/{vnfmId}/vnfs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public InstantiateVnfResponse instantiateVnf(@RequestBody InstantiateVnfRequest request, @PathVariable("vnfmId") String vnfmId, HttpServletResponse httpResponse) + { + String jsonString = gson.toJson(request); + logger.info("instantiateVnf request: vnfmId = " + vnfmId + ", bodyMessage is " + jsonString); + + InstantiateVnfResponse response = vnfmDriverMgmr.instantiateVnf(request, vnfmId); + + httpResponse.setStatus(HttpStatus.SC_CREATED); + + return response; + } + + @RequestMapping(value = "/{vnfmId}/vnfs/{vnfInstanceId}/terminate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public TerminateVnfResponse terminateVnf(@RequestBody TerminateVnfRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletResponse httpResponse) + { + String jsonString = gson.toJson(request); + logger.info("terminateVnf request: vnfmId = " + vnfmId + ", vnfInstanceId = " + vnfInstanceId + ", bodyMessage is " + jsonString); + + try { + TerminateVnfResponse response = vnfmDriverMgmr.terminateVnf(request, vnfmId, vnfInstanceId); + httpResponse.setStatus(HttpStatus.SC_CREATED); + return response; + } + catch(VnfmDriverException e) + { + try { + httpResponse.setStatus(HttpStatus.SC_BAD_REQUEST); + httpResponse.sendError(e.getHttpStatus(), e.getMessage()); + } catch (IOException e1) { + + } + } + + return null; + } + + + @RequestMapping(value = "/{vnfmId}/vnfs/{vnfInstanceId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public QueryVnfResponse queryVnf(@PathVariable("vnfmId") String vnfmId, @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletResponse httpResponse) + { + logger.info("queryVnf request: vnfmId = " + vnfmId + ", vnfInstanceId = " + vnfInstanceId); + + try { + QueryVnfResponse response = vnfmDriverMgmr.queryVnf(vnfmId, vnfInstanceId); + httpResponse.setStatus(HttpStatus.SC_CREATED); + return response; + } + catch(VnfmDriverException e) + { + try { + httpResponse.setStatus(HttpStatus.SC_BAD_REQUEST); + httpResponse.sendError(e.getHttpStatus(), e.getMessage()); + } catch (IOException e1) { + + } + } + + return null; + } + @RequestMapping(value = "/{vnfmId}/jobs/{jobId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public OperStatusVnfResponse getOperStatus(@PathVariable("vnfmId") String vnfmId,@PathVariable("jobId") String jobId, HttpServletResponse httpResponse) + { + logger.info("getOperStatus request: vnfmId = " + vnfmId + ", jobId = " + jobId); + + try { + OperStatusVnfResponse response = vnfmDriverMgmr.getOperStatus(vnfmId, jobId); + httpResponse.setStatus(HttpStatus.SC_CREATED); + return response; + } + catch(VnfmDriverException e) + { + try { + httpResponse.sendError(e.getHttpStatus(), e.getMessage()); + } catch (IOException e1) { + + } + } + + return null; + } + + + @RequestMapping(value = "/{vnfmId}/vnfs/{vnfInstanceId}/scale", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public ScaleVnfResponse scaleVnf(@RequestBody ScaleVnfRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletResponse httpResponse) + { + String jsonString = gson.toJson(request); + logger.info("scaleVnf request: vnfmId = " + vnfmId + ", vnfInstanceId = " + vnfInstanceId + ", bodyMessage is " + jsonString); + + try { + ScaleVnfResponse response = vnfmDriverMgmr.scaleVnf(request, vnfmId, vnfInstanceId); + httpResponse.setStatus(HttpStatus.SC_CREATED); + return response; + } + catch(VnfmDriverException e) + { + try { + httpResponse.sendError(e.getHttpStatus(), e.getMessage()); + } catch (IOException e1) { + + } + } + + return null; + } + + + @RequestMapping(value = "/{vnfmId}/vnfs/{vnfInstanceId}/heal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public HealVnfResponse healVnf(@RequestBody HealVnfRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletResponse httpResponse) + { + String jsonString = gson.toJson(request); + logger.info("healVnf request: vnfmId = " + vnfmId + ", vnfInstanceId = " + vnfInstanceId + ", bodyMessage is " + jsonString); + + try { + HealVnfResponse response = vnfmDriverMgmr.healVnf(request, vnfmId, vnfInstanceId); + httpResponse.setStatus(HttpStatus.SC_CREATED); + return response; + } + catch(VnfmDriverException e) + { + try { + httpResponse.sendError(e.getHttpStatus(), e.getMessage()); + } catch (IOException e1) { + + } + } + + return null; + } + + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/inf/VnfmDriverMgmrInf.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/inf/VnfmDriverMgmrInf.java new file mode 100644 index 00000000..833712a0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/com/nokia/vfcadaptor/vnfmdriver/inf/VnfmDriverMgmrInf.java @@ -0,0 +1,44 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.inf; + +import com.nokia.vfcadaptor.exception.VnfmDriverException; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.HealVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.OperStatusVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.QueryVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.ScaleVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; + +public interface VnfmDriverMgmrInf { + + public InstantiateVnfResponse instantiateVnf(InstantiateVnfRequest request, String vnfmId) throws VnfmDriverException; + + public TerminateVnfResponse terminateVnf(TerminateVnfRequest request, String vnfmId, String vnfInstanceId) throws VnfmDriverException; + + public QueryVnfResponse queryVnf(String vnfmId, String vnfInstanceId) throws VnfmDriverException; + + public OperStatusVnfResponse getOperStatus(String vnfmId, String jobId) throws VnfmDriverException; + + public ScaleVnfResponse scaleVnf(ScaleVnfRequest request, String vnfmId, String vnfInstanceId) throws VnfmDriverException; + + public HealVnfResponse healVnf(HealVnfRequest request, String vnfmId, String vnfInstanceId) throws VnfmDriverException; +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/ProxoolConf.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/ProxoolConf.xml new file mode 100644 index 00000000..1c58dcdc --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/ProxoolConf.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<something-else-entirely> + <proxool> + + <alias>proxoolPool</alias> + <driver-url>jdbc:mysql://135.251.208.57:3306/aware_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round +<!-- <driver-url>jdbc:mysql://10.134.120.95:3306/aware_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round --> + + </driver-url> + <driver-class>com.mysql.jdbc.Driver</driver-class> + <driver-properties> + <property name="user" value="root" /> + <property name="password" value="irlaxjwrMLu03MNgih6czpllxKgnfk" /> + <property name="autoReconnect" value="true" /> + </driver-properties> + + <house-keeping-sleep-time>2700000</house-keeping-sleep-time> + <simultaneous-build-throttle>100</simultaneous-build-throttle> + <!-- + <maximum-new-connections>5</maximum-new-connections> + --> + <prototype-count>5</prototype-count> + <maximum-connection-count>50</maximum-connection-count> + + <maximum-active-time>2700000</maximum-active-time> + <maximum-connection-lifetime>7200000</maximum-connection-lifetime> + + <minimum-connection-count>2</minimum-connection-count> + <test-before-use>true</test-before-use> + <!-- + <test-after-use>true</test-after-use> + --> + <trace>true</trace> + <house-keeping-test-sql>select CURRENT_DATE from dual + </house-keeping-test-sql> + + </proxool> +</something-else-entirely>
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/config.properties b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/config.properties new file mode 100644 index 00000000..ad3ba369 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/config.properties @@ -0,0 +1,27 @@ +############################################################################### +# Copyright 2016, 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. +############################################################################### + +nslcmIp=1.2.3.4 +nslcmPort=88 + +catalogIp=1.2.3.4 +catalogPort=88 + +cbamIp=2.3.4.5 + +grant_type=lient_credentials +client_id=frontend +client_secret=secret
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_job_execution_map.hbm.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_job_execution_map.hbm.xml new file mode 100644 index 00000000..0977b94c --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_job_execution_map.hbm.xml @@ -0,0 +1,31 @@ +<?xml version="1.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. + --> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping> + <class name="com.nokia.vfcadaptor.beans.VnfmJobExecutioInfo" table="vnfm_job_execution_record" dynamic-update="true" lazy="true"> + <id name="jobId" column="jobId" /> + + <property name="vnfInstanceId" column="vnfInstanceId"/> + <property name="vnfmExecutionId" column="vnfmExecutionId"/> + + <property name="vnfmInterfceName" column="vnfmInterfceName"/> + <property name="status" column="status"/> + + </class> +</hibernate-mapping>
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_resource_record.hbm.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_resource_record.hbm.xml new file mode 100644 index 00000000..c1e279e9 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/hdm/vnfm_resource_record.hbm.xml @@ -0,0 +1,30 @@ +<?xml version="1.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. + --> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping> + <class name="com.nokia.vfcadaptor.beans.VnfmResourceInfo" table="vnfm_resource_record" dynamic-update="true" lazy="true"> + <id name="id" column="id" /> + + <property name="type" column="type"/> + <property name="resourceDefinitionId" column="resourceDefinitionId"/> + <property name="vdu" column="vdu"/> + <property name="status" column="status"/> + + </class> +</hibernate-mapping>
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/log4j.properties b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/log4j.properties new file mode 100644 index 00000000..41230be3 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/log4j.properties @@ -0,0 +1,33 @@ +############################################################################### +# Copyright 2016, 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. +############################################################################### +log4j.rootLogger=info, stdout, R +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%5p %d [%t] (%F:%L) - %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=D:/tmp/vnfmdriver.log +log4j.appender.R.MaxFileSize= 10MB + +# Keep one backup file +log4j.appender.R.MaxBackupIndex=5 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%5p %d [%t] (%F:%L) - %m%n + + diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/applicationContext-hibernate.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/applicationContext-hibernate.xml new file mode 100644 index 00000000..08a34c58 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/applicationContext-hibernate.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" +"http://www.springframework.org/dtd/spring-beans.dtd"> +<beans> + + <bean id="sessionFactory" + class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect"> + org.hibernate.dialect.MySQLDialect + </prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.jdbc.batch_size">100</prop> + <!--<prop key="hibernate.connection.autocommit">false</prop>--> + <prop key="hibernate.connection.autocommit">true</prop> + <prop key="hibernate.proxool.pool_alias">proxoolPool</prop> + <prop key="hibernate.proxool.xml">ProxoolConf.xml</prop> + <prop key="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</prop> + <prop key="hibernate.cache.provider_class"> + org.hibernate.cache.HashtableCacheProvider + </prop> + <prop key="hibernate.connection.release_mode">after_transaction</prop> + </props> + </property> + + <!-- mappingResources属性用来列出全部映射文件 --> + <property name="mappingResources"> + <list> + <!-- 配置所有PO映射文件 --> + <value>hbm/vnfm_job_execution_map.hbm.xml</value> + </list> + </property> + </bean> + <!-- 事务管理器 --> + <bean id="transactionManager" + class="org.springframework.orm.hibernate4.HibernateTransactionManager"> + <property name="sessionFactory"> + <ref local="sessionFactory" /> + </property> + </bean> + +</beans>
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/mvc-servlet.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/mvc-servlet.xml new file mode 100644 index 00000000..f26ce071 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-4.3.xsd + http://www.springframework.org/schema/mvc + http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-4.3.xsd" + + default-lazy-init="true"> + + <bean id="propertyConfigurer" + class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="location" value="classpath:config.properties"/> + </bean> + + <bean id="adaptorEnv" class="com.nokia.vfcadaptor.common.bo.AdaptorEnv" scope="singleton" > + <property name = "nslcmIp" value="${nslcmIp}" /> + <property name = "nslcmPort" value="${nslcmPort}" /> + <property name = "catalogIp" value="${catalogIp}" /> + <property name = "catalogPort" value="${catalogPort}" /> + <property name = "cbamIp" value="${cbamIp}" /> + <property name = "grantType" value="${grant_type}" /> + <property name = "clientId" value="${client_id}" /> + <property name = "clientSecret" value="${client_secret}" /> + </bean> + + <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> + + <bean name = "httpClientBuilder" class="com.nokia.vfcadaptor.http.client.HttpClientUtils" factory-method="createHttpClientBuilder"/> + + <context:component-scan base-package="com.nokia.vfcadaptor" /> + + <!-- 将StringHttpMessageCOnverter的默认编码设为UTF-8 --> + <mvc:annotation-driven> + <mvc:message-converters register-defaults="true"> + <bean class="org.springframework.http.converter.StringHttpMessageConverter"> + <constructor-arg value="UTF-8" /> + </bean> + </mvc:message-converters> + </mvc:annotation-driven> + + <!-- public part end --> + + <bean id="sessionFactory" + class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> + <property name="hibernateProperties"> + <props> + <prop key="hibernate.dialect"> + org.hibernate.dialect.MySQLDialect + </prop> + <prop key="hibernate.show_sql">false</prop> + <prop key="hibernate.jdbc.batch_size">100</prop> + <!--<prop key="hibernate.connection.autocommit">false</prop>--> + <prop key="hibernate.connection.autocommit">true</prop> + <prop key="hibernate.proxool.pool_alias">proxoolPool</prop> + <prop key="hibernate.proxool.xml">ProxoolConf.xml</prop> + <prop key="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</prop> + <prop key="hibernate.cache.provider_class"> + org.hibernate.cache.HashtableCacheProvider + </prop> + <prop key="hibernate.connection.release_mode">after_transaction</prop> + </props> + </property> + + <!-- mappingResources属性用来列出全部映射文件 --> + <property name="mappingResources"> + <list> + <!-- 配置所有PO映射文件 --> + <value>hbm/vnfm_job_execution_map.hbm.xml</value> + </list> + </property> + </bean> + <!-- 事务管理器 --> + <bean id="transactionManager" + class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + <property name="sessionFactory"> + <ref local="sessionFactory" /> + </property> + </bean> + +</beans> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/web.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..124ec37e --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!-- + 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. + --> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + <display-name>vfcadaptor</display-name> + + <filter> + <filter-name>CharacterEncoding</filter-name> + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>forceEncoding</param-name> + <param-value>true</param-value> + </init-param> + </filter> + + <filter-mapping> + <filter-name>CharacterEncoding</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + <!-- 设置servlet编码结束 --> +<!-- + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value> + classpath:WEB-INF/applicationContext-hibernate.xml + </param-value> + </context-param> +--> + <servlet> + <servlet-name>springservlet</servlet-name> + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> + <init-param> + <param-name>contextConfigLocation</param-name> + <param-value>/WEB-INF/mvc-servlet.xml</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>springservlet</servlet-name> + <url-pattern>/</url-pattern> + </servlet-mapping> + + <session-config> + <session-timeout>60</session-timeout> + </session-config> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>default.html</welcome-file> + <welcome-file>default.htm</welcome-file> + <welcome-file>default.jsp</welcome-file> + </welcome-file-list> +</web-app>
\ No newline at end of file diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessorTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessorTest.java new file mode 100644 index 00000000..61367505 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/http/client/HttpRequestProcessorTest.java @@ -0,0 +1,125 @@ +/* + * 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 com.nokia.vfcadaptor.http.client; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; + +import org.apache.http.client.ClientProtocolException; +import org.apache.http.impl.client.HttpClientBuilder; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.context.WebApplicationContext; + +import com.google.gson.Gson; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/mvc-servlet.xml"}) +@WebAppConfiguration +public class HttpRequestProcessorTest { + private String url; + private String basicUrl="http://localhost:8080/NvfmDriver/api/nokiavnfm/v1"; + private String funcPath; + + private Gson gson = new Gson(); + + @Autowired + private WebApplicationContext wac; + private MockMvc mockMvc; + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); //MockMvc + } + + @Test + public void testP() + { + String message = "{\"vnfInstanceName\":\"vnfInstanceName_001\",\"vnfPackageId\":\"1\"}"; + InstantiateVnfRequest request = gson.fromJson(message, InstantiateVnfRequest.class); + + System.out.println("vnfInstanceName = " + request.getVnfInstanceName()); + + String result; + try { + result = mockMvc.perform(MockMvcRequestBuilders.post("/nokiavnfm/v1/vnfmId_001/vnfs") + .contentType(MediaType.APPLICATION_JSON).content(message) + .accept(MediaType.APPLICATION_JSON)) //ִ + .andReturn().getResponse().getContentAsString(); + System.out.println("result = " + result); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } +// +// @Test +// public void testProcess() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, ClientProtocolException, IOException +// { +// funcPath = "/vnfmId_001/vnfs"; +// url = basicUrl + funcPath; +// String message = "{\"vnfInstanceName\":\"vnfInstanceName_001\",\"vnfPackageId\":\"1\"}"; +// +// HttpClientBuilder httpClientBuilder = HttpClientUtils.createHttpClientBuilder(); +// HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, RequestMethod.POST); +// processor.addPostEntity(message); +// String result = processor.process(url); +// +// System.out.println(result); +// } +// +// @Test +// public void testHttps() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, ClientProtocolException, IOException +// { +// url = "https://www.baidu.com"; +// HttpClientBuilder httpClientBuilder = HttpClientUtils.createHttpClientBuilder(); +// HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, RequestMethod.GET); +// +// String result = processor.process(url); +// +// System.out.println("The result is :" + result); +// } +// @Test +// public void testHome() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, ClientProtocolException, IOException +// { +// url = "http://172.24.208.168/"; +// HttpClientBuilder httpClientBuilder = HttpClientUtils.createHttpClientBuilder(); +// HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, RequestMethod.GET); +// +// String result = processor.process(url); +// +// System.out.println("The result is :" + result); +// } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/BaseControllerTestCase.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/BaseControllerTestCase.java new file mode 100644 index 00000000..025949c0 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/BaseControllerTestCase.java @@ -0,0 +1,151 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.controller; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; +import org.apache.http.util.EntityUtils; +import org.junit.BeforeClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; + +public class BaseControllerTestCase { + + private static final String CONTENT_TYPE = "Content-Type"; + private static final String AUTH = "auth"; + + private static final String UTF_8 = "utf-8"; + + protected static String serviceUrl = "http://127.0.0.1:8080/AppSenseAnalysisSystem"; + + protected static String baseUrl; + + protected static String pictureServerRootUrl = "http://localhost"; + + protected Logger log = LoggerFactory.getLogger(this.getClass()); + protected boolean isHttpsProtocol = false; + + @BeforeClass + public static void beforeClass() throws Exception { + baseUrl = serviceUrl; + } + + public static org.apache.http.client.HttpClient wrapClient(org.apache.http.client.HttpClient base) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted( + java.security.cert.X509Certificate[] chain, + String authType) + throws java.security.cert.CertificateException { + // TODO Auto-generated method stub + + } + public void checkServerTrusted( + java.security.cert.X509Certificate[] chain, + String authType) + throws java.security.cert.CertificateException { + // TODO Auto-generated method stub + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + SchemeRegistry registry = new SchemeRegistry(); + registry.register(new Scheme("https", 8089, ssf)); + ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(registry); + return new DefaultHttpClient(mgr, base.getParams()); + } catch (Exception ex) { + ex.printStackTrace(); + return null; + } + } + + protected String sendPostMsg(String message, String url) throws UnsupportedEncodingException, + IOException, ClientProtocolException { + + HttpClient httpclient = new DefaultHttpClient(); + if(isHttpsProtocol) + { + httpclient = wrapClient(httpclient); + } + HttpPost httppost = new HttpPost(url); + StringEntity myEntity = new StringEntity(message, UTF_8); + String auth = ""; + httppost.addHeader(AUTH, auth); + httppost.addHeader(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); +// httppost.addHeader(CONTENT_TYPE, MediaType.TEXT_XML_VALUE); + httppost.setEntity(myEntity); + HttpResponse response = httpclient.execute(httppost); + HttpEntity resEntity = response.getEntity(); + String responseContent = ""; + if (resEntity != null) { + responseContent = EntityUtils.toString(resEntity, "UTF-8"); + EntityUtils.consume(resEntity); + } + httpclient.getConnectionManager().shutdown(); + return responseContent; + } + + protected String sendGetMsg(String message, String url) throws UnsupportedEncodingException, + IOException, ClientProtocolException { + + HttpClient httpclient = new DefaultHttpClient(); + if(isHttpsProtocol) + { + httpclient = wrapClient(httpclient); + } + HttpGet httpGet = new HttpGet(url); + StringEntity myEntity = new StringEntity(message, UTF_8); + String auth = ""; + httpGet.addHeader(AUTH, auth); + httpGet.addHeader(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); + //httppost.addHeader(CONTENT_TYPE, MediaType.TEXT_XML_VALUE); + //((HttpResponse) httpGet).setEntity(myEntity); + HttpResponse response = httpclient.execute(httpGet); + HttpEntity resEntity = response.getEntity(); + String responseContent = ""; + if (resEntity != null) { + responseContent = EntityUtils.toString(resEntity, "UTF-8"); + responseContent.replaceAll("\r", "");// + EntityUtils.consume(resEntity); + } + httpclient.getConnectionManager().shutdown(); + return responseContent; + } +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverAdaptorControllerTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverAdaptorControllerTest.java new file mode 100644 index 00000000..69a5c853 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverAdaptorControllerTest.java @@ -0,0 +1,99 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.controller; + +import java.io.IOException; +import java.net.URISyntaxException; + +import org.apache.http.client.ClientProtocolException; +import org.junit.Before; +import org.junit.Test; + +public class VnfmDriverAdaptorControllerTest extends BaseControllerTestCase{ + + private String url; + private String basicUrl="http://localhost:8080/NvfmDriver/api/nokiavnfm/v1"; + private String funcPath; + + @Before + public void setUp() + { + isHttpsProtocol = false; + } + + @Test + public void testInstantiateVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/vnfs"; + url = basicUrl + funcPath; + String message = "{\"vnfInstanceName\":\"vnfInstanceName_001\",\"vnfPackageId\":\"1\"}"; + + String responseContent = sendPostMsg(message, url); + System.out.println("-------------------------------"); + System.out.println( " Initiate Response is " + responseContent); + } + + @Test + public void testTerminateVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/vnfs/vnfInstanceId_001/terminate"; + url = basicUrl + funcPath; + String message = "{\"terminationType\":\"graceful\"}"; + String responseContent = sendPostMsg(message, url); + System.out.println("-------------------------------"); + System.out.println("Terminate Response is " + responseContent); + } + + @Test + public void testQueryVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/vnfs/vnfInstanceId_001"; + url = basicUrl + funcPath; + String message = "{\"vnfInfo\":\"{\"nfInstanceId\":\"1\",\"vnfInstanceName\":\"vFW\",\"vnfInstanceDescription\":\"vFW in Nanjing TIC Edge\",\"vnfdId\":\"1\"}\"}"; + String responseContent = sendGetMsg(message, url); + + System.out.println("-------------------------------"); + System.out.println("QueryResponse is " + responseContent); + } + + @Test + public void testOperStatusVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/jobs/jobId_001&responseId=responseId_001"; + url = basicUrl + funcPath; + String message = "{\"jobId\":\"12345\",\"responseDescriptor\":\"{\"progress\":\"40\",\"status\":\"proccessing\"}\"}"; + String responseContent = sendGetMsg(message, url); + System.out.println("-------------------------------"); + System.out.println(" operStatus Response is " + responseContent); + } + + @Test + public void testScaleVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/vnfs/vnfInstanceId_001/scale"; + url = basicUrl + funcPath; + String message = "{\"type\":\"12345\",\"aspectId\":\"145\"}"; + String responseContent = sendPostMsg(message, url); + System.out.println("-------------------------------"); + System.out.println(" Scale Response is " + responseContent); + } + + @Test + public void testHealVnf() throws URISyntaxException, ClientProtocolException, IOException { + funcPath = "/vnfmId_001/vnfs/vnfInstanceId_001/heal"; + url = basicUrl + funcPath; + String message = "{\"action\":\"12345\"}"; + String responseContent = sendPostMsg(message, url); + System.out.println("-------------------------------"); + System.out.println(" Heal Response is " + responseContent); + } + +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverControllerTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverControllerTest.java new file mode 100644 index 00000000..cd6d93eb --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/com/nokia/vfcadaptor/vnfmdriver/controller/VnfmDriverControllerTest.java @@ -0,0 +1,131 @@ +/* + * 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 com.nokia.vfcadaptor.vnfmdriver.controller; + + +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.apache.http.HttpStatus; +import org.json.JSONObject; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import com.nokia.vfcadaptor.exception.VnfmDriverException; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.InstantiateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfRequest; +import com.nokia.vfcadaptor.vnfmdriver.bo.TerminateVnfResponse; +import com.nokia.vfcadaptor.vnfmdriver.inf.VnfmDriverMgmrInf; + +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/mvc-servlet.xml"}) +//@WebAppConfiguration(value = "src/main/webapp") +public class VnfmDriverControllerTest { + + @Mock + private VnfmDriverMgmrInf vnfmDriverMgmr; + + @InjectMocks + private VnfmDriverController controller; + + private MockMvc mockMvc; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); + } + + @Test + public void testInstantiateVnf() throws Exception + { + InstantiateVnfResponse mockResponse = new InstantiateVnfResponse(); + mockResponse.setJobId("job_001"); + mockResponse.setVnfInstanceId("vnfInstanceId_001"); + String jsonString = "{\"vnfInstanceName\":\"vnfInstanceName_001\",\"vnfPackageId\":\"1\"}"; + when(vnfmDriverMgmr.instantiateVnf(Mockito.any(InstantiateVnfRequest.class), Mockito.anyString())).thenReturn(mockResponse); + + String responseString = mockMvc.perform( + post("/nokiavnfm/v1/vnfmId_001/vnfs"). + characterEncoding("UTF-8"). + accept(MediaType.APPLICATION_JSON). + contentType(MediaType.APPLICATION_JSON). + content(jsonString)) + .andDo(print()) + .andExpect(status().isCreated()) + .andReturn().getResponse().getContentAsString(); + + JSONObject jsonObj = new JSONObject(responseString); + Assert.assertEquals("jobId is ", mockResponse.getJobId(), jsonObj.get("jobId")); + Assert.assertEquals("vnfInstanceId is ", mockResponse.getVnfInstanceId(), jsonObj.get("vnfInstanceId")); + } + + @Test + public void testTerminateVnfSuccess() throws Exception + { + TerminateVnfResponse mockResponse = new TerminateVnfResponse(); + mockResponse.setJobId("job_002"); + String jsonString = "{\"vnfInstanceId\":\"vnfInstanceId_001\"}"; + when(vnfmDriverMgmr.terminateVnf(Mockito.any(TerminateVnfRequest.class), Mockito.anyString(), Mockito.anyString())).thenReturn(mockResponse); + + String responseString = mockMvc.perform( + post("/nokiavnfm/v1/vnfmId_001/vnfs/vnfInstanceId_001/terminate"). + characterEncoding("UTF-8"). + accept(MediaType.APPLICATION_JSON). + contentType(MediaType.APPLICATION_JSON). + content(jsonString)) + .andDo(print()) + .andExpect(status().isCreated()) + .andReturn().getResponse().getContentAsString(); + + JSONObject jsonObj = new JSONObject(responseString); + Assert.assertEquals("jobId is ", mockResponse.getJobId(), jsonObj.get("jobId")); + } + @Test + public void testTerminateVnfException() throws Exception + { + TerminateVnfResponse mockResponse = new TerminateVnfResponse(); + mockResponse.setJobId("job_002"); + String jsonString = "{\"vnfInstanceId\":\"vnfInstanceId_001\"}"; + VnfmDriverException exception = new VnfmDriverException(HttpStatus.SC_BAD_REQUEST, "vnfInstanceId is wrong"); + when(vnfmDriverMgmr.terminateVnf(Mockito.any(TerminateVnfRequest.class), Mockito.anyString(), Mockito.anyString())).thenThrow(exception); + + String erroMsg = mockMvc.perform( + post("/nokiavnfm/v1/vnfmId_001/vnfs/vnfInstanceId_001/terminate"). + characterEncoding("UTF-8"). + accept(MediaType.APPLICATION_JSON). + contentType(MediaType.APPLICATION_JSON). + content(jsonString)) + .andDo(print()) + .andExpect(status().isBadRequest()) + .andReturn().getResponse().getErrorMessage() + ; + Assert.assertEquals("Error Message is ", exception.getMessage(), erroMsg); + } + +} |