diff options
author | 2017-09-22 15:43:34 +0800 | |
---|---|---|
committer | 2017-09-22 16:33:17 +0800 | |
commit | 915c0a2a5bfc6f458a5402ff5a225ae943df6040 (patch) | |
tree | 9e7d5c904fcc1de1cae4388956e8911264dac665 /nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java | |
parent | 640f5f2669eff17a14cb721452061da46913ebb5 (diff) |
Create seed code of svnfm vnfmdriver
Upload the seed code to gerrit for the first time.
Change-Id: I5df47364f17e28d59ab4bacf6421fd92c9743384
Issue-ID: VFC-53
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java')
103 files changed, 7424 insertions, 0 deletions
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; +} |