From 3279b96ba8e6f356633016418ecba22d815c0e06 Mon Sep 17 00:00:00 2001 From: Abhishek Bajaj Date: Fri, 12 Mar 2021 13:05:34 +0530 Subject: so-etsi-sol005-adapter build failed issues Issue-ID: SO-3520 Signed-off-by: Abhishek Bajaj Change-Id: Id339297e27d217dde2d8a2e72337b4398bffa047 Signed-off-by: Abhishek Bajaj --- packages/docker/pom.xml | 157 +++++ .../src/main/docker/docker-files/Dockerfile.so-app | 31 + .../docker/docker-files/Dockerfile.so-base-image | 19 + .../docker-files/ca-certificates/onap-ca.crt | 31 + .../configs/logging/logback-spring.xml | 203 ++++++ .../docker/docker-files/scripts/.gitattributes | 5 + .../main/docker/docker-files/scripts/start-app.sh | 89 +++ .../main/docker/docker-files/scripts/wait-for.sh | 85 +++ packages/pom.xml | 35 + pom.xml | 284 +++----- so-etsi-sol005-adapter-application/pom.xml | 155 +++++ .../org/onap/so/adapters/vfc/CXFConfiguration.java | 84 +++ .../onap/so/adapters/vfc/MSOVfcApplication.java | 37 + .../org/onap/so/adapters/vfc/RequestDBConfig.java | 69 ++ .../so/adapters/vfc/constant/CommonConstant.java | 157 +++++ .../adapters/vfc/constant/DriverExceptionID.java | 62 ++ .../onap/so/adapters/vfc/constant/HttpCode.java | 92 +++ .../vfc/exceptions/ApplicationException.java | 75 ++ .../org/onap/so/adapters/vfc/model/AddPnfData.java | 68 ++ .../onap/so/adapters/vfc/model/AddressRange.java | 33 + .../org/onap/so/adapters/vfc/model/AffectedNs.java | 40 ++ .../onap/so/adapters/vfc/model/AffectedPnf.java | 67 ++ .../onap/so/adapters/vfc/model/AffectedSap.java | 49 ++ .../so/adapters/vfc/model/AffectedVirtualLink.java | 49 ++ .../onap/so/adapters/vfc/model/AffectedVnf.java | 78 +++ .../onap/so/adapters/vfc/model/AffectedVnffg.java | 40 ++ .../vfc/model/AffinityOrAntiAffinityRule.java | 51 ++ .../onap/so/adapters/vfc/model/ChangedInfo.java | 33 + .../so/adapters/vfc/model/CivicAddressElement.java | 33 + .../onap/so/adapters/vfc/model/CpProtocolData.java | 33 + .../onap/so/adapters/vfc/model/CpProtocolInfo.java | 31 + .../so/adapters/vfc/model/CreateNsRequest.java | 53 ++ .../onap/so/adapters/vfc/model/CustomerModel.java | 69 ++ .../org/onap/so/adapters/vfc/model/ExtCpInfo.java | 27 + .../so/adapters/vfc/model/ExtLinkPortInfo.java | 33 + .../vfc/model/ExtManagedVirtualLinkInfo.java | 57 ++ .../so/adapters/vfc/model/ExtVirtualLinkInfo.java | 42 ++ .../adapters/vfc/model/InstantiateNsRequest.java | 207 ++++++ .../so/adapters/vfc/model/InstantiatedVnfInfo.java | 116 ++++ .../onap/so/adapters/vfc/model/IpAddresses.java | 63 ++ .../vfc/model/IpOverEthernetAddressData.java | 35 + .../java/org/onap/so/adapters/vfc/model/Link.java | 24 + .../java/org/onap/so/adapters/vfc/model/Links.java | 78 +++ .../so/adapters/vfc/model/LocationConstraint.java | 73 ++ .../so/adapters/vfc/model/LocationConstraints.java | 33 + .../java/org/onap/so/adapters/vfc/model/Mask.java | 47 ++ .../so/adapters/vfc/model/ModifyVnfInfoData.java | 80 +++ .../vfc/model/NSResourceInputParameter.java | 154 ++++ .../org/onap/so/adapters/vfc/model/NfpInfo.java | 89 +++ .../org/onap/so/adapters/vfc/model/NfpRule.java | 108 +++ .../org/onap/so/adapters/vfc/model/NsCpHandle.java | 69 ++ .../onap/so/adapters/vfc/model/NsCreateReq.java | 102 +++ .../org/onap/so/adapters/vfc/model/NsInstance.java | 166 +++++ .../so/adapters/vfc/model/NsInstanceLinks.java | 82 +++ .../so/adapters/vfc/model/NsInstantiateReq.java | 50 ++ .../org/onap/so/adapters/vfc/model/NsLcmOpOcc.java | 125 ++++ .../onap/so/adapters/vfc/model/NsLinkPortInfo.java | 46 ++ .../onap/so/adapters/vfc/model/NsOperationKey.java | 140 ++++ .../onap/so/adapters/vfc/model/NsParameters.java | 70 ++ .../so/adapters/vfc/model/NsProgressStatus.java | 84 +++ .../onap/so/adapters/vfc/model/NsScaleInfo.java | 37 + .../so/adapters/vfc/model/NsScaleParameters.java | 66 ++ .../org/onap/so/adapters/vfc/model/NsScaleReq.java | 49 ++ .../so/adapters/vfc/model/NsVirtualLinkInfo.java | 57 ++ .../onap/so/adapters/vfc/model/ParamsForVnf.java | 35 + .../onap/so/adapters/vfc/model/PnfExtCpData.java | 44 ++ .../onap/so/adapters/vfc/model/PnfExtCpInfo.java | 48 ++ .../org/onap/so/adapters/vfc/model/PnfInfo.java | 74 ++ .../org/onap/so/adapters/vfc/model/PortRange.java | 37 + .../onap/so/adapters/vfc/model/ProblemDetails.java | 62 ++ .../so/adapters/vfc/model/ResourceChanges.java | 71 ++ .../onap/so/adapters/vfc/model/ResourceHandle.java | 51 ++ .../so/adapters/vfc/model/ResponseDescriptor.java | 114 +++ .../so/adapters/vfc/model/RestfulResponse.java | 100 +++ .../org/onap/so/adapters/vfc/model/SapData.java | 56 ++ .../org/onap/so/adapters/vfc/model/SapInfo.java | 68 ++ .../so/adapters/vfc/model/ScaleNsByStepsData.java | 88 +++ .../onap/so/adapters/vfc/model/ScaleNsData.java | 48 ++ .../onap/so/adapters/vfc/model/VFCScaleData.java | 84 +++ .../onap/so/adapters/vfc/model/VimLocation.java | 51 ++ .../onap/so/adapters/vfc/model/VnfInstance.java | 156 +++++ .../so/adapters/vfc/model/VnfInstanceData.java | 33 + .../so/adapters/vfc/model/VnfLinkPortInfo.java | 46 ++ .../adapters/vfc/model/VnfLocationConstraint.java | 33 + .../onap/so/adapters/vfc/model/VnfScaleInfo.java | 38 + .../vfc/model/VnfVirtualLinkResourceInfo.java | 76 ++ .../org/onap/so/adapters/vfc/model/VnfcCpInfo.java | 65 ++ .../so/adapters/vfc/model/VnfcResourceInfo.java | 85 +++ .../org/onap/so/adapters/vfc/model/VnffgInfo.java | 87 +++ .../org/onap/so/adapters/vfc/rest/AaiUtil.java | 47 ++ .../so/adapters/vfc/rest/HealthCheckHandler.java | 58 ++ .../onap/so/adapters/vfc/rest/VfcAdapterRest.java | 265 +++++++ .../org/onap/so/adapters/vfc/rest/VfcManager.java | 492 +++++++++++++ .../so/adapters/vfc/rest/VfcManagerSol005.java | 620 +++++++++++++++++ .../org/onap/so/adapters/vfc/util/JsonUtil.java | 137 ++++ .../org/onap/so/adapters/vfc/util/RestfulUtil.java | 393 +++++++++++ .../onap/so/adapters/vfc/util/ValidateUtil.java | 86 +++ .../src/main/resources/application-aaf.yaml | 0 .../src/main/resources/application-basic.yaml | 0 .../src/main/resources/application.yaml | 37 + .../vfc/exceptions/ApplicationExceptionTest.java | 36 + .../onap/so/adapters/vfc/model/AddPnfDataTest.java | 189 +++++ .../so/adapters/vfc/model/AddressRangeTest.java | 39 ++ .../onap/so/adapters/vfc/model/AffectedNsTest.java | 40 ++ .../so/adapters/vfc/model/AffectedPnfTest.java | 69 ++ .../so/adapters/vfc/model/AffectedSapTest.java | 49 ++ .../vfc/model/AffectedVirtualLinkTest.java | 49 ++ .../so/adapters/vfc/model/AffectedVnfTest.java | 69 ++ .../so/adapters/vfc/model/AffectedVnffgTest.java | 39 ++ .../vfc/model/AffinityOrAntiAffinityRuleTest.java | 283 ++++++++ .../so/adapters/vfc/model/ChangedInfoTest.java | 39 ++ .../vfc/model/CivicAddressElementTest.java | 39 ++ .../so/adapters/vfc/model/CpProtocolDataTest.java | 39 ++ .../so/adapters/vfc/model/CreateNsRequestTest.java | 49 ++ .../so/adapters/vfc/model/CustomerModelTest.java | 49 ++ .../so/adapters/vfc/model/ExtLinkPortInfoTest.java | 40 ++ .../adapters/vfc/model/ExtVirtualLinkInfoTest.java | 49 ++ .../vfc/model/InstantiateNsRequestTest.java | 413 +++++++++++ .../so/adapters/vfc/model/IpAddressesTest.java | 188 +++++ .../vfc/model/IpOverEthernetAddressDataTest.java | 158 +++++ .../org/onap/so/adapters/vfc/model/LinkTest.java | 29 + .../org/onap/so/adapters/vfc/model/LinksTest.java | 89 +++ .../adapters/vfc/model/LocationConstraintTest.java | 49 ++ .../vfc/model/LocationConstraintsTest.java | 40 ++ .../adapters/vfc/model/ModifyVnfInfoDataTest.java | 90 +++ .../vfc/model/NSResourceInputParameterTest.java | 69 ++ .../so/adapters/vfc/model/NsCreateReqTest.java | 69 ++ .../adapters/vfc/model/NsInstantiateReqTest.java | 39 ++ .../onap/so/adapters/vfc/model/NsLcmOpOccTest.java | 142 ++++ .../so/adapters/vfc/model/NsOperationKeyTest.java | 79 +++ .../so/adapters/vfc/model/NsParametersTest.java | 51 ++ .../adapters/vfc/model/NsProgressStatusTest.java | 60 ++ .../so/adapters/vfc/model/ParamsForVnfTest.java | 41 ++ .../so/adapters/vfc/model/PnfExtCpDataTest.java | 168 +++++ .../so/adapters/vfc/model/ProblemDetailsTest.java | 69 ++ .../so/adapters/vfc/model/ResourceChangesTest.java | 773 +++++++++++++++++++++ .../so/adapters/vfc/model/ResourceHandleTest.java | 59 ++ .../adapters/vfc/model/ResponseDescriptorTest.java | 79 +++ .../so/adapters/vfc/model/RestfulResponseTest.java | 75 ++ .../onap/so/adapters/vfc/model/SapDataTest.java | 179 +++++ .../so/adapters/vfc/model/VimLocationTest.java | 39 ++ .../so/adapters/vfc/model/VnfInstanceDataTest.java | 39 ++ .../vfc/model/VnfLocationConstraintTest.java | 39 ++ .../adapters/vfc/rest/EmbeddedMariaDbConfig.java | 86 +++ .../adapters/vfc/rest/HealthCheckHandlerTest.java | 67 ++ .../so/adapters/vfc/rest/VfcManagerSol005Test.java | 256 +++++++ .../onap/so/adapters/vfc/rest/VfcManagerTest.java | 156 +++++ .../onap/so/adapters/vfc/util/RestfulUtilTest.java | 209 ++++++ .../src/test/resources/application-test.yaml | 64 ++ .../src/test/resources/json/LICENSE.txt | 19 + .../src/test/resources/json/aainfvoResponse.json | 10 + .../src/test/resources/json/createNsReq.json | 56 ++ .../src/test/resources/json/createNsRsp.json | 3 + .../resources/json/createNsSol005Response.json | 210 ++++++ .../src/test/resources/json/deleteNsReq.json | 7 + .../src/test/resources/json/instantiateNsReq.json | 32 + .../src/test/resources/json/instantiateNsRsp.json | 3 + .../src/test/resources/json/lcmOperRsp.json | 7 + .../src/test/resources/json/queryJobReq.json | 7 + .../src/test/resources/json/queryJobRsp.json | 10 + .../src/test/resources/json/terminateNsReq.json | 7 + .../src/test/resources/json/terminateNsRsp.json | 3 + .../src/test/resources/logback-test.xml | 42 ++ .../org/onap/so/adapters/vfc/CXFConfiguration.java | 84 --- .../onap/so/adapters/vfc/MSOVfcApplication.java | 37 - .../org/onap/so/adapters/vfc/RequestDBConfig.java | 69 -- .../so/adapters/vfc/constant/CommonConstant.java | 157 ----- .../adapters/vfc/constant/DriverExceptionID.java | 62 -- .../onap/so/adapters/vfc/constant/HttpCode.java | 92 --- .../vfc/exceptions/ApplicationException.java | 75 -- .../org/onap/so/adapters/vfc/model/AddPnfData.java | 68 -- .../onap/so/adapters/vfc/model/AddressRange.java | 33 - .../org/onap/so/adapters/vfc/model/AffectedNs.java | 40 -- .../onap/so/adapters/vfc/model/AffectedPnf.java | 67 -- .../onap/so/adapters/vfc/model/AffectedSap.java | 49 -- .../so/adapters/vfc/model/AffectedVirtualLink.java | 49 -- .../onap/so/adapters/vfc/model/AffectedVnf.java | 78 --- .../onap/so/adapters/vfc/model/AffectedVnffg.java | 40 -- .../vfc/model/AffinityOrAntiAffinityRule.java | 51 -- .../onap/so/adapters/vfc/model/ChangedInfo.java | 33 - .../so/adapters/vfc/model/CivicAddressElement.java | 33 - .../onap/so/adapters/vfc/model/CpProtocolData.java | 33 - .../onap/so/adapters/vfc/model/CpProtocolInfo.java | 31 - .../so/adapters/vfc/model/CreateNsRequest.java | 53 -- .../onap/so/adapters/vfc/model/CustomerModel.java | 69 -- .../org/onap/so/adapters/vfc/model/ExtCpInfo.java | 27 - .../so/adapters/vfc/model/ExtLinkPortInfo.java | 33 - .../vfc/model/ExtManagedVirtualLinkInfo.java | 57 -- .../so/adapters/vfc/model/ExtVirtualLinkInfo.java | 42 -- .../adapters/vfc/model/InstantiateNsRequest.java | 207 ------ .../so/adapters/vfc/model/InstantiatedVnfInfo.java | 116 ---- .../onap/so/adapters/vfc/model/IpAddresses.java | 63 -- .../vfc/model/IpOverEthernetAddressData.java | 35 - .../java/org/onap/so/adapters/vfc/model/Link.java | 24 - .../java/org/onap/so/adapters/vfc/model/Links.java | 78 --- .../so/adapters/vfc/model/LocationConstraint.java | 73 -- .../so/adapters/vfc/model/LocationConstraints.java | 33 - .../java/org/onap/so/adapters/vfc/model/Mask.java | 47 -- .../so/adapters/vfc/model/ModifyVnfInfoData.java | 80 --- .../vfc/model/NSResourceInputParameter.java | 154 ---- .../org/onap/so/adapters/vfc/model/NfpInfo.java | 89 --- .../org/onap/so/adapters/vfc/model/NfpRule.java | 108 --- .../org/onap/so/adapters/vfc/model/NsCpHandle.java | 69 -- .../onap/so/adapters/vfc/model/NsCreateReq.java | 102 --- .../org/onap/so/adapters/vfc/model/NsInstance.java | 166 ----- .../so/adapters/vfc/model/NsInstanceLinks.java | 82 --- .../so/adapters/vfc/model/NsInstantiateReq.java | 50 -- .../org/onap/so/adapters/vfc/model/NsLcmOpOcc.java | 125 ---- .../onap/so/adapters/vfc/model/NsLinkPortInfo.java | 46 -- .../onap/so/adapters/vfc/model/NsOperationKey.java | 140 ---- .../onap/so/adapters/vfc/model/NsParameters.java | 70 -- .../so/adapters/vfc/model/NsProgressStatus.java | 84 --- .../onap/so/adapters/vfc/model/NsScaleInfo.java | 37 - .../so/adapters/vfc/model/NsScaleParameters.java | 66 -- .../org/onap/so/adapters/vfc/model/NsScaleReq.java | 49 -- .../so/adapters/vfc/model/NsVirtualLinkInfo.java | 57 -- .../onap/so/adapters/vfc/model/ParamsForVnf.java | 35 - .../onap/so/adapters/vfc/model/PnfExtCpData.java | 44 -- .../onap/so/adapters/vfc/model/PnfExtCpInfo.java | 48 -- .../org/onap/so/adapters/vfc/model/PnfInfo.java | 74 -- .../org/onap/so/adapters/vfc/model/PortRange.java | 37 - .../onap/so/adapters/vfc/model/ProblemDetails.java | 62 -- .../so/adapters/vfc/model/ResourceChanges.java | 71 -- .../onap/so/adapters/vfc/model/ResourceHandle.java | 51 -- .../so/adapters/vfc/model/ResponseDescriptor.java | 114 --- .../so/adapters/vfc/model/RestfulResponse.java | 100 --- .../org/onap/so/adapters/vfc/model/SapData.java | 56 -- .../org/onap/so/adapters/vfc/model/SapInfo.java | 68 -- .../so/adapters/vfc/model/ScaleNsByStepsData.java | 88 --- .../onap/so/adapters/vfc/model/ScaleNsData.java | 48 -- .../onap/so/adapters/vfc/model/VFCScaleData.java | 84 --- .../onap/so/adapters/vfc/model/VimLocation.java | 51 -- .../onap/so/adapters/vfc/model/VnfInstance.java | 156 ----- .../so/adapters/vfc/model/VnfInstanceData.java | 33 - .../so/adapters/vfc/model/VnfLinkPortInfo.java | 46 -- .../adapters/vfc/model/VnfLocationConstraint.java | 33 - .../onap/so/adapters/vfc/model/VnfScaleInfo.java | 38 - .../vfc/model/VnfVirtualLinkResourceInfo.java | 76 -- .../org/onap/so/adapters/vfc/model/VnfcCpInfo.java | 65 -- .../so/adapters/vfc/model/VnfcResourceInfo.java | 85 --- .../org/onap/so/adapters/vfc/model/VnffgInfo.java | 87 --- .../org/onap/so/adapters/vfc/rest/AaiUtil.java | 47 -- .../so/adapters/vfc/rest/HealthCheckHandler.java | 58 -- .../onap/so/adapters/vfc/rest/VfcAdapterRest.java | 265 ------- .../org/onap/so/adapters/vfc/rest/VfcManager.java | 492 ------------- .../so/adapters/vfc/rest/VfcManagerSol005.java | 620 ----------------- .../org/onap/so/adapters/vfc/util/JsonUtil.java | 137 ---- .../org/onap/so/adapters/vfc/util/RestfulUtil.java | 393 ----------- .../onap/so/adapters/vfc/util/ValidateUtil.java | 86 --- src/main/resources/application-aaf.yaml | 0 src/main/resources/application-basic.yaml | 0 src/main/resources/application.yaml | 37 - .../vfc/exceptions/ApplicationExceptionTest.java | 36 - .../onap/so/adapters/vfc/model/AddPnfDataTest.java | 189 ----- .../so/adapters/vfc/model/AddressRangeTest.java | 39 -- .../onap/so/adapters/vfc/model/AffectedNsTest.java | 40 -- .../so/adapters/vfc/model/AffectedPnfTest.java | 69 -- .../so/adapters/vfc/model/AffectedSapTest.java | 49 -- .../vfc/model/AffectedVirtualLinkTest.java | 49 -- .../so/adapters/vfc/model/AffectedVnfTest.java | 69 -- .../so/adapters/vfc/model/AffectedVnffgTest.java | 39 -- .../vfc/model/AffinityOrAntiAffinityRuleTest.java | 283 -------- .../so/adapters/vfc/model/ChangedInfoTest.java | 39 -- .../vfc/model/CivicAddressElementTest.java | 39 -- .../so/adapters/vfc/model/CpProtocolDataTest.java | 39 -- .../so/adapters/vfc/model/CreateNsRequestTest.java | 49 -- .../so/adapters/vfc/model/CustomerModelTest.java | 49 -- .../so/adapters/vfc/model/ExtLinkPortInfoTest.java | 40 -- .../adapters/vfc/model/ExtVirtualLinkInfoTest.java | 49 -- .../vfc/model/InstantiateNsRequestTest.java | 413 ----------- .../so/adapters/vfc/model/IpAddressesTest.java | 188 ----- .../vfc/model/IpOverEthernetAddressDataTest.java | 158 ----- .../org/onap/so/adapters/vfc/model/LinkTest.java | 29 - .../org/onap/so/adapters/vfc/model/LinksTest.java | 89 --- .../adapters/vfc/model/LocationConstraintTest.java | 49 -- .../vfc/model/LocationConstraintsTest.java | 40 -- .../adapters/vfc/model/ModifyVnfInfoDataTest.java | 90 --- .../vfc/model/NSResourceInputParameterTest.java | 69 -- .../so/adapters/vfc/model/NsCreateReqTest.java | 69 -- .../adapters/vfc/model/NsInstantiateReqTest.java | 39 -- .../onap/so/adapters/vfc/model/NsLcmOpOccTest.java | 142 ---- .../so/adapters/vfc/model/NsOperationKeyTest.java | 79 --- .../so/adapters/vfc/model/NsParametersTest.java | 51 -- .../adapters/vfc/model/NsProgressStatusTest.java | 60 -- .../so/adapters/vfc/model/ParamsForVnfTest.java | 41 -- .../so/adapters/vfc/model/PnfExtCpDataTest.java | 168 ----- .../so/adapters/vfc/model/ProblemDetailsTest.java | 69 -- .../so/adapters/vfc/model/ResourceChangesTest.java | 773 --------------------- .../so/adapters/vfc/model/ResourceHandleTest.java | 59 -- .../adapters/vfc/model/ResponseDescriptorTest.java | 79 --- .../so/adapters/vfc/model/RestfulResponseTest.java | 75 -- .../onap/so/adapters/vfc/model/SapDataTest.java | 179 ----- .../so/adapters/vfc/model/VimLocationTest.java | 39 -- .../so/adapters/vfc/model/VnfInstanceDataTest.java | 39 -- .../vfc/model/VnfLocationConstraintTest.java | 39 -- .../adapters/vfc/rest/EmbeddedMariaDbConfig.java | 86 --- .../adapters/vfc/rest/HealthCheckHandlerTest.java | 67 -- .../so/adapters/vfc/rest/VfcManagerSol005Test.java | 256 ------- .../onap/so/adapters/vfc/rest/VfcManagerTest.java | 156 ----- .../onap/so/adapters/vfc/util/RestfulUtilTest.java | 209 ------ src/test/resources/application-test.yaml | 64 -- src/test/resources/json/LICENSE.txt | 19 - src/test/resources/json/aainfvoResponse.json | 10 - src/test/resources/json/createNsReq.json | 56 -- src/test/resources/json/createNsRsp.json | 3 - .../resources/json/createNsSol005Response.json | 210 ------ src/test/resources/json/deleteNsReq.json | 7 - src/test/resources/json/instantiateNsReq.json | 32 - src/test/resources/json/instantiateNsRsp.json | 3 - src/test/resources/json/lcmOperRsp.json | 7 - src/test/resources/json/queryJobReq.json | 7 - src/test/resources/json/queryJobRsp.json | 10 - src/test/resources/json/terminateNsReq.json | 7 - src/test/resources/json/terminateNsRsp.json | 3 - src/test/resources/logback-test.xml | 42 -- version.properties | 2 +- 316 files changed, 13963 insertions(+), 13217 deletions(-) create mode 100644 packages/docker/pom.xml create mode 100644 packages/docker/src/main/docker/docker-files/Dockerfile.so-app create mode 100644 packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image create mode 100644 packages/docker/src/main/docker/docker-files/ca-certificates/onap-ca.crt create mode 100644 packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml create mode 100644 packages/docker/src/main/docker/docker-files/scripts/.gitattributes create mode 100644 packages/docker/src/main/docker/docker-files/scripts/start-app.sh create mode 100644 packages/docker/src/main/docker/docker-files/scripts/wait-for.sh create mode 100644 packages/pom.xml create mode 100644 so-etsi-sol005-adapter-application/pom.xml create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Link.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Links.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Mask.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java create mode 100644 so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java create mode 100644 so-etsi-sol005-adapter-application/src/main/resources/application-aaf.yaml create mode 100644 so-etsi-sol005-adapter-application/src/main/resources/application-basic.yaml create mode 100644 so-etsi-sol005-adapter-application/src/main/resources/application.yaml create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/application-test.yaml create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/LICENSE.txt create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/aainfvoResponse.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/createNsReq.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/createNsRsp.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/createNsSol005Response.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/deleteNsReq.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsReq.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsRsp.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/lcmOperRsp.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/queryJobReq.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/queryJobRsp.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsReq.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsRsp.json create mode 100644 so-etsi-sol005-adapter-application/src/test/resources/logback-test.xml delete mode 100644 src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/Link.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/Links.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/Mask.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/PortRange.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/SapData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java delete mode 100644 src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java delete mode 100644 src/main/resources/application-aaf.yaml delete mode 100644 src/main/resources/application-basic.yaml delete mode 100644 src/main/resources/application.yaml delete mode 100644 src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java delete mode 100644 src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java delete mode 100644 src/test/resources/application-test.yaml delete mode 100644 src/test/resources/json/LICENSE.txt delete mode 100644 src/test/resources/json/aainfvoResponse.json delete mode 100644 src/test/resources/json/createNsReq.json delete mode 100644 src/test/resources/json/createNsRsp.json delete mode 100644 src/test/resources/json/createNsSol005Response.json delete mode 100644 src/test/resources/json/deleteNsReq.json delete mode 100644 src/test/resources/json/instantiateNsReq.json delete mode 100644 src/test/resources/json/instantiateNsRsp.json delete mode 100644 src/test/resources/json/lcmOperRsp.json delete mode 100644 src/test/resources/json/queryJobReq.json delete mode 100644 src/test/resources/json/queryJobRsp.json delete mode 100644 src/test/resources/json/terminateNsReq.json delete mode 100644 src/test/resources/json/terminateNsRsp.json delete mode 100644 src/test/resources/logback-test.xml diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml new file mode 100644 index 0000000..59a47d8 --- /dev/null +++ b/packages/docker/pom.xml @@ -0,0 +1,157 @@ + + 4.0.0 + + org.onap.so.adapters.so-sol005-adapter + packages + 1.8.0-SNAPSHOT + + org.onap.so.adapters.so-sol005-adapter.packages + 1.8.0-SNAPSHOT + pom + docker + SO SOL005 Adapter Docker Packaging + + + ${project.version} + false + false + false + nexus3.onap.org:10001 + nexus3.onap.org:10003 + onap/so + deploy + + + + ${project.artifactId}-${project.version} + + + org.codehaus.groovy.maven + gmaven-plugin + 1.0 + + + validate + + execute + + + + println 'Project version: ' + project.properties['sol005-adapter-project-version']; + def versionArray; + if (project.properties['sol005-adapter-project-version'] != null) { + versionArray = project.properties['sol005-adapter-project-version'].split('-'); + } + + if (project.properties['sol005-adapter-project-version'].endsWith("-SNAPSHOT")) { + project.properties['project.docker.latesttag.version'] = versionArray[0] + "-SNAPSHOT-latest"; + } else { + project.properties['project.docker.latesttag.version'] = versionArray[0] + "-STAGING-latest"; + } + + println 'New tag for docker: ' + project.properties['project.docker.latesttag.version']; + + + + + + + + io.fabric8 + docker-maven-plugin + + true + 1.23 + ${docker.pull.registry} + ${docker.push.registry} + + + ${docker.image.prefix}/base-image:1.0 + + try + docker-files/Dockerfile.so-base-image + + + + ${docker.image.prefix}/so-sol005-adapter + + try + docker-files/Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + + org.onap.so.adapters.so-sol005-adapter:so-sol005-adapter-application + + + app.jar + + + + + + + + + + + + + clean-images + pre-clean + + remove + + + true + + + + + generate-images + generate-sources + + build + + + + + push-images + ${docker.push.phase} + + build + push + + + ${docker.image.prefix}/so-sol005-adapter + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + + + org.onap.so.adapters.so-sol005-adapter + so-sol005-adapter-application + ${project.version} + + + \ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app new file mode 100644 index 0000000..dc86ff8 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app @@ -0,0 +1,31 @@ +FROM onap/so/base-image:1.0 + +ARG http_proxy +ENV HTTP_PROXY=$http_proxy +ENV http_proxy=$HTTP_PROXY +ARG https_proxy +ENV HTTPS_PROXY=$https_proxy +ENV https_proxy=$HTTPS_PROXY + +USER root +RUN mkdir -p /app/config +RUN mkdir -p /app/certificates +RUN mkdir -p /app/logs +RUN mkdir -p /app/ca-certificates + +COPY maven/app.jar /app +COPY configs/logging/logback-spring.xml /app +COPY scripts/start-app.sh /app +COPY scripts/wait-for.sh /app +COPY ca-certificates/onap-ca.crt /app/ca-certificates/onap-ca.crt +RUN chown -R so:so /app + +USER so +# Springboot configuration (required) +VOLUME /app/config + +# Root certificates (optional) +VOLUME /app/ca-certificates + +WORKDIR /app +ENTRYPOINT ["/app/start-app.sh"] diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image new file mode 100644 index 0000000..a1f4fc1 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image @@ -0,0 +1,19 @@ +FROM adoptopenjdk/openjdk11:jre-11.0.8_10-alpine + +ARG http_proxy +ARG https_proxy +ENV HTTP_PROXY=$http_proxy +ENV HTTPS_PROXY=$https_proxy +ENV http_proxy=$HTTP_PROXY +ENV https_proxy=$HTTPS_PROXY + +# Install commonly needed tools +RUN apk --no-cache add curl netcat-openbsd nss apache2-utils java-cacerts + +# Create symlink for default Java truststore +RUN set -eux; \ + rm -rf "$JAVA_HOME/lib/security/cacerts"; \ + ln -sT /etc/ssl/certs/java/cacerts "$JAVA_HOME/lib/security/cacerts" + +# Create 'so' user +RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so diff --git a/packages/docker/src/main/docker/docker-files/ca-certificates/onap-ca.crt b/packages/docker/src/main/docker/docker-files/ca-certificates/onap-ca.crt new file mode 100644 index 0000000..e9a50d7 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/ca-certificates/onap-ca.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPjCCAyagAwIBAgIJAJ6u7cCnzrWdMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV +BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA0MDUx +NDE1MjhaFw0zODAzMzExNDE1MjhaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK +DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBAMA5pkgRs7NhGG4ew5JouhyYakgYUyFaG121+/h8qbSdt0hVQv56+EA41Yq7 +XGie7RYDQK9NmAFF3gruE+6X7wvJiChp+Cyd7sFMnb65uWhxEdxWTM2BJFrgfzUn +H8ZCxgaCo3XH4PzlKRy2LQQJEJECwl/RZmRCXijMt5e9h8XoZY/fKkKcZZUsWNCM +pTo266wjvA9MXLmdgReRj0+vrCjrNqy+htwJDztoiHWiYPqT6o8EvGcgjNqjlZx7 +NUNf8MfLDByqKF6+wRbHv1GKjn3/Vijd45Fv8riyRYROiFanvbV6jIfBkv8PZbXg +2VDWsYsgp8NAvMxK+iV8cO+Ck3lBI2GOPZbCEqpPVTYbLUz6sczAlCXwQoPzDIZY +wYa3eR/gYLY1gP2iEVHORag3bLPap9ZX5E8DZkzTNTjovvLk8KaCmfcaUMJsBtDd +ApcUitz10cnRyZc1sX3gE1f3DpzQM6t9C5sOVyRhDcSrKqqwb9m0Ss04XAS9FsqM +P3UWYQyqDXSxlUAYaX892u8mV1hxnt2gjb22RloXMM6TovM3sSrJS0wH+l1nznd6 +aFXftS/G4ZVIVZ/LfT1is4StoyPWZCwwwly1z8qJQ/zhip5NgZTxQw4mi7ww35DY +PdAQOCoajfSvFjqslQ/cPRi/MRCu079heVb5fQnnzVtnpFQRAgMBAAGjYzBhMB0G +A1UdDgQWBBRTVTPyS+vQUbHBeJrBKDF77+rtSTAfBgNVHSMEGDAWgBRTVTPyS+vQ +UbHBeJrBKDF77+rtSTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAN +BgkqhkiG9w0BAQsFAAOCAgEAPx/IaK94n02wPxpnYTy+LVLIxwdq/kawNd6IbiMz +L87zmNMDmHcGbfoRCj8OkhuggX9Lx1/CkhpXimuYsZOFQi5blr/u+v4mIbsgbmi9 +7j+cUHDP0zLycvSvxKHty51LwmaX9a4wkJl5zBU4O1sd/H9tWcEmwJ39ltKoBKBx +c94Zc3iMm5ytRWGj+0rKzLDAXEWpoZ5bE5PLJauA6UDCxDLfs3FwhbS7uDggxYvf +jySF5FCNET94oJ+m8s7VeHvoa8iPGKvXrIqdd7XDHnqJJlVKr7m9S0fMbyEB8ci2 +RtOXDt93ifY1uhoEtEykn4dqBSp8ezvNMnwoXdYPDvTd9uCAFeWFLVreBAWxd25h +PsBTkZA5hpa/rA+mKv6Af4VBViYr8cz4dZCsFChuioVebe9ighrfjB//qKepFjPF +CyjzKN1u0JKm/2x/ORqxkTONG8p3uDwoIOyimUcTtTMv42bfYD88RKakqSFXE9G+ +Z0LlaKABqfjK49o/tsAp+c5LoNlYllKhnetO3QAdraHwdmC36BhoghzR1jpX751A +cZn2VH3Q4XKyp01cJNCJIrua+A+bx6zh3RyW6zIIkbRCbET+UD+4mr8WIcSE3mtR +ZVlnhUDO4z9//WKMVzwS9Rh8/kuszrGFI1KQozXCHLrce3YP6RYZfOed79LXaRwX +dYY= +-----END CERTIFICATE----- diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml new file mode 100644 index 0000000..e4be709 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${errorPattern} + + + + + + + EXIT + + DENY + ACCEPT + + ${logs_dir:-.}/${auditLogName}.log + + ${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${auditPattern} + + + + + 256 + + + + + + + INVOKE-RETURN + + DENY + ACCEPT + + ${logs_dir:-.}/${metricsLogName}.log + + ${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${metricPattern} + + + + + + 256 + + + + + + ERROR + ACCEPT + DENY + + ${logs_dir:-.}/${errorLogName}.log + + ${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${errorPattern} + + + + + 256 + + + + + + + INVOKE + INVOKE-RETURN + ENTRY + EXIT + + ACCEPT + DENY + + ${logs_dir:-.}/${debugLogName}.log + + ${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/scripts/.gitattributes b/packages/docker/src/main/docker/docker-files/scripts/.gitattributes new file mode 100644 index 0000000..b905d1d --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/scripts/.gitattributes @@ -0,0 +1,5 @@ +# Default behavior +* text=auto + +# Files to have unix style line endings on checkout +*.sh text eol=lf \ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh new file mode 100644 index 0000000..54ed9ed --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -0,0 +1,89 @@ +#!/bin/sh +#temprary condition +if [ `id -u` = 0 ] +then + # Install certificates found in the /app/ca-certificates volume, if any. + + needUpdate=FALSE + + for certificate in `ls -1 /app/ca-certificates`; do + echo "Installing $certificate in /usr/local/share/ca-certificates" + # cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate + needUpdate=FALSE + done + + # Re-exec this script as the 'onap' user. + this=`readlink -f $0` + # exec su so -c "$this" +fi + +touch /app/app.jar + +if [ ! -z "$DB_HOST" -a -z "$DB_PORT" ]; then + export DB_PORT=3306 +fi + +if [ -z "${CONFIG_PATH}" ]; then + export CONFIG_PATH=/app/config/override.yaml +fi + +if [ "${SSL_DEBUG}" = "log" ]; then + export SSL_DEBUG="-Djavax.net.debug=all" +else + export SSL_DEBUG= +fi + +# Set java keystore and truststore options, if specified in the environment. + +jksargs= + +if [ ! -z "${KEYSTORE}" ]; then + jksargs="$jksargs -Dmso.load.ssl.client.keystore=true" + jksargs="$jksargs -Djavax.net.ssl.keyStore=$KEYSTORE" + jksargs="$jksargs -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWORD}" +fi + +if [ ! -z "${TRUSTSTORE}" ]; then + jksargs="$jksargs -Djavax.net.ssl.trustStore=${TRUSTSTORE}" + jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}" +fi + +if [ -z "${ACTIVE_PROFILE}" ]; then + export ACTIVE_PROFILE="basic" +fi + +jvmargs="${JVM_ARGS} -Dspring.profiles.active=${ACTIVE_PROFILE} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" + + +read_properties(){ + while IFS="=" read -r key value; do + case "${key}" in + '#'*) ;; + *) + eKey=$(echo $key | tr '[:lower:]' '[:upper:]') + export "$eKey"="$value" + esac + done <<-EOF + $1 + EOF +} + + + +if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then +read_properties "$(head -n 4 /app/certs/.passphrases)" +fi + +echo "JVM Arguments: ${jvmargs}" + +java ${jvmargs} -jar app.jar +rc=$? + +echo "Application exiting with status code $rc" + +if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then + echo "Delaying $APP exit for $EXIT_DELAY seconds" + sleep $EXIT_DELAY +fi + +exit $rc diff --git a/packages/docker/src/main/docker/docker-files/scripts/wait-for.sh b/packages/docker/src/main/docker/docker-files/scripts/wait-for.sh new file mode 100644 index 0000000..2525821 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/scripts/wait-for.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# https://github.com/Eficode/wait-for.git +# MIT License + +TIMEOUT=15 +QUIET=0 + +echoerr() { + if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi +} + +usage() { + exitcode="$1" + cat << USAGE >&2 +Usage: + $cmdname host:port [-t timeout] [-- command args] + -q | --quiet Do not output any status messages + -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit "$exitcode" +} + +wait_for() { + command="$*" + if [ "$QUIET" -ne 1 ]; then echo "$0: probing host $HOST port $PORT"; fi + for i in `seq $TIMEOUT` ; do + nc -z "$HOST" "$PORT" > /dev/null 2>&1 + result=$? + if [ $result -eq 0 ] ; then + if [ "$QUIET" -ne 1 ]; then echo "$0: operation succeeded on try $i"; fi + if [ -n "$command" ] ; then + if [ "$QUIET" -ne 1 ]; then echo "$0: exec-ing command $command"; fi + exec $command + fi + exit 0 + fi + if [ "$QUIET" -ne 1 ]; then echo "$0: sleeping after try $i"; fi + sleep 1 + done + echo "$0: Operation timed out" >&2 + exit 1 +} + +while [ $# -gt 0 ] +do + case "$1" in + *:* ) + HOST=$(printf "%s\n" "$1"| cut -d : -f 1) + PORT=$(printf "%s\n" "$1"| cut -d : -f 2) + shift 1 + ;; + -q | --quiet) + QUIET=1 + shift 1 + ;; + -t) + TIMEOUT="$2" + if [ "$TIMEOUT" = "" ]; then break; fi + shift 2 + ;; + --timeout=*) + TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + break + ;; + --help) + usage 0 + ;; + *) + echoerr "Unknown argument: $1" + usage 1 + ;; + esac +done + +if [ "$HOST" = "" -o "$PORT" = "" ]; then + echoerr "Error: you need to provide a host and port to test." + usage 2 +fi + +wait_for "$@" diff --git a/packages/pom.xml b/packages/pom.xml new file mode 100644 index 0000000..f79e000 --- /dev/null +++ b/packages/pom.xml @@ -0,0 +1,35 @@ + + 4.0.0 + + org.onap.so.adapters.so-sol005-adapter + so-sol005-adapter + 1.8.0-SNAPSHOT + + packages + pom + 1.8.0-SNAPSHOT + SO SOL005 Adapter Packages + + + + + + default + + true + + + + + + docker + + docker + + + false + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f225a16..f1be9ac 100755 --- a/pom.xml +++ b/pom.xml @@ -1,176 +1,112 @@ - 4.0.0 - - org.onap.so - adapters - 1.7.1-SNAPSHOT - - org.onap.so.adapters - so-vfc-adapter - so-vfc-adapter - Web service endpoint for vfc operations - - - - org.springframework.boot - spring-boot-dependencies - ${springboot.version} - pom - import - - - - - ${project.artifactId}-${project.version} - - - org.springframework.boot - spring-boot-maven-plugin - - org.onap.so.adapters.vfc.MSOVfcApplication - - - - - repackage - - - - - - org.jacoco - jacoco-maven-plugin - - - net.revelc.code.formatter - formatter-maven-plugin - 2.9.0 - - - format-java - - format - - process-sources - - ${format.skipExecute} - ${project.basedir}/onap-eclipse-format.xml - - - - format-xml - - format - - process-sources - - ${format.skipExecute} - ${project.basedir} - ${project.basedir}/pom-format.properties - - pom.xml - - - - - validate-java - - validate - - - ${format.skipValidate} - ${project.basedir}/onap-eclipse-format.xml - - - - validate-poms - - validate - - - ${format.skipValidate} - ${project.basedir}/pom-format.properties - - pom.xml - - - - - - - com.fasterxml.jackson.core - jackson-annotations - 2.9.8 - - - - - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.apache.tomcat - tomcat-jdbc - - - - - org.apache.cxf - cxf-spring-boot-starter-jaxws - - - org.apache.cxf - cxf-spring-boot-starter-jaxrs - - - org.apache.cxf - cxf-rt-rs-service-description-swagger - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-test - test - - - org.onap.so - mso-requests-db - ${project.version} - - - org.onap.so - mso-requests-db-repositories - ${project.version} - - - org.mariadb.jdbc - mariadb-java-client - - - ch.vorburger.mariaDB4j - mariaDB4j - 2.2.3 - test - - - org.springframework.boot - spring-boot-configuration-processor - true - - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.so + so + 1.8.0-SNAPSHOT + + org.onap.so.adapters.so-sol005-adapter + so-sol005-adapter + 1.8.0-SNAPSHOT + SO SOL005 Adapter + pom + + + 11 + 11 + UTF-8 + UTF-8 + 2.3.1 + 1.8.2 + 2.7.2 + 1.3.5 + 1.0.1 + 1.5.21 + 3.14.0 + 2.7.5 + 1.13.0 + 2.3.6.RELEASE + 2.3.0 + 0.11 + 2.2 + 3.4.1 + 1.8.0-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${version.java.compiler} + ${version.java.compiler} + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + net.revelc.code.formatter + formatter-maven-plugin + 2.9.0 + + + format-java + + format + + process-sources + + true + + + + format-xml + + format + + process-sources + + true + + pom.xml + + + + + validate-java + + validate + + + true + + + + validate-poms + + validate + + + true + + pom.xml + + + + + + + + + + so-etsi-sol005-adapter-application + packages + diff --git a/so-etsi-sol005-adapter-application/pom.xml b/so-etsi-sol005-adapter-application/pom.xml new file mode 100644 index 0000000..5b8a855 --- /dev/null +++ b/so-etsi-sol005-adapter-application/pom.xml @@ -0,0 +1,155 @@ + + 4.0.0 + + org.onap.so.adapters.so-sol005-adapter + so-sol005-adapter + 1.8.0-SNAPSHOT + + + so-etsi-sol005-adapter-application + 1.8.0-SNAPSHOT + so-vfc-adapter + + Web service endpoint for vfc operations + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + + + ${project.artifactId}-${project.version} + + + org.springframework.boot + spring-boot-maven-plugin + + org.onap.so.adapters.vfc.MSOVfcApplication + + + + + repackage + + + + + + org.jacoco + jacoco-maven-plugin + + + net.revelc.code.formatter + formatter-maven-plugin + 2.9.0 + + + format-java + + format + + process-sources + + ${format.skipExecute} + ${project.basedir}/onap-eclipse-format.xml + + + + format-xml + + format + + process-sources + + ${format.skipExecute} + ${project.basedir} + ${project.basedir}/pom-format.properties + + pom.xml + + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.8 + + + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.apache.tomcat + tomcat-jdbc + + + + + org.apache.cxf + cxf-spring-boot-starter-jaxws + + + org.apache.cxf + cxf-spring-boot-starter-jaxrs + + + org.apache.cxf + cxf-rt-rs-service-description-swagger + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-test + test + + + org.onap.so + mso-requests-db + 1.8.0-SNAPSHOT + + + org.onap.so + mso-requests-db-repositories + 1.8.0-SNAPSHOT + + + org.mariadb.jdbc + mariadb-java-client + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + org.springframework.boot + spring-boot-configuration-processor + true + + + diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java new file mode 100644 index 0000000..dd875c5 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc; + +import java.util.Arrays; +import org.apache.cxf.Bus; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.onap.so.adapters.vfc.rest.VfcAdapterRest; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + + +@Configuration +public class CXFConfiguration { + + @Autowired + private Bus bus; + + @Autowired + private VfcAdapterRest vfcAdapterRest; + + @Autowired + private SOAuditLogContainerFilter soAuditLogContainerFilter; + + @Autowired + private ObjectMapper mapper; + + @Bean + public ServletRegistrationBean cxfServlet() { + return new ServletRegistrationBean(new CXFServlet(), "/services/*"); + } + + @Bean + public Server rsServer() { + JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); + endpoint.setBus(bus); + endpoint.setServiceBeans(Arrays.asList(vfcAdapterRest)); + endpoint.setAddress("/"); + endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); + return endpoint.create(); + } + + @Bean + public Swagger2Feature createSwaggerFeature() { + Swagger2Feature swagger2Feature = new Swagger2Feature(); + swagger2Feature.setPrettyPrint(true); + swagger2Feature.setTitle("SO VFC Adapter"); + swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setDescription("This project is the SO Orchestration Engine"); + swagger2Feature.setVersion("1.0.0"); + swagger2Feature.setResourcePackage("org.onap.so.adapters.vfc.rest"); + swagger2Feature.setScan(true); + return swagger2Feature; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java new file mode 100644 index 0000000..62234f9 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + + +@SpringBootApplication(scanBasePackages = {"org.onap.so"}) +public class MSOVfcApplication { + + public static void main(String... args) { + SpringApplication.run(MSOVfcApplication.class, args); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java new file mode 100644 index 0000000..d7397c8 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc; + + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.Profile; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Profile({"!test"}) +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", + transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) +public class RequestDBConfig { + + @Primary + @Bean(name = "requestDataSource") + @ConfigurationProperties(prefix = "spring.datasource") + public DataSource dataSource() { + return DataSourceBuilder.create().build(); + } + + @Primary + @Bean(name = "requestEntityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, + @Qualifier("requestDataSource") DataSource dataSource) { + return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") + .build(); + } + + @Primary + @Bean(name = "requestTransactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java new file mode 100644 index 0000000..51a0fc0 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.constant; + +/** + * CommonConstant
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +public class CommonConstant { + + public static final String STR_EMPTY = ""; + + public static final String NFVO_CREATE_URL = "/api/nslcm/v1/ns"; + public static final String SOL005_NFVO_CREATE_URL = "/api/nslcm/v1/ns_instances"; + + public static final String NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns/%s/instantiate"; + public static final String SOL005_NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns_instances/%s/instantiate"; + + public static final String NFVO_TERMINATE_URL = "/api/nslcm/v1/ns/%s/terminate"; + public static final String SOL005_NFVO_TERMINATE_URL = "/api/nslcm/v1/ns_instances/%s/terminate"; + + public static final String NFVO_DELETE_URL = "/api/nslcm/v1/ns/%s"; + public static final String SOL005_NFVO_DELETE_URL = "/api/nslcm/v1/ns_instances/%s"; + + public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s"; + public static final String SOL005_NFVO_QUERY_URL = "/api/nslcm/v1/ns_lcm_op_occs/%s"; + + public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale"; + + public enum operationState { + PROCESSING, COMPLETED, PARTIALLY_COMPLETED, FAILED_TEMP, FAILED, ROLLING_BACK, ROLLED_BACK + } + public enum lcmOperationType { + INSTANTIATE, SCALE, UPDATE, TERMINATE, HEAL + }; + public enum cancelMode { + GRACEFUL, FORCEFUL + }; + + /** + * + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ + public static class MethodType { + + public static final String POST = "post"; + + public static final String DELETE = "delete"; + + public static final String PUT = "put"; + + public static final String GET = "get"; + + private MethodType() { + + } + } + + /** + * + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ + public static class Step { + + public static final String CREATE = "create"; + + public static final String INSTANTIATE = "instantiate"; + + public static final String STATUS = "status"; + + public static final String TERMINATE = "terminate"; + + public static final String QUERY = "query"; + + public static final String DELETE = "delete"; + + public static final String SCALE = "scale"; + + private Step() { + + } + + } + + + public static final String NSD_ID = "nsdId"; + + public static final String NS_NAME = "nsName"; + + public static final String DESC = "description"; + + public static final String NS_INSTANCE_ID = "nsInstanceId"; + public static final String SOL005_NS_INSTANCE_ID = "id"; + + + public static final String JOB_ID = "jobId"; + public static final String JOB_URI = "Location"; + + public static final String ADDITIONAL_PARAM_FOR_NS = "additionalParamForNs"; + + public static final String LOCAL_HOST = "localhost"; + + public static class StatusDesc { + + public static final String INSTANTIATE_NS_FAILED = "instantiate ns failed"; + + public static final String QUERY_JOB_STATUS_FAILED = "query job status failed"; + + public static final String TERMINATE_NS_FAILED = "terminate ns failed"; + + public static final String DELETE_NS_FAILED = "delete ns failed"; + + public static final String CREATE_NS_FAILED = "create ns failed"; + + public static final String SCALE_NS_FAILED = "scale ns failed"; + + private StatusDesc() { + + } + } + + private CommonConstant() { + + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java new file mode 100644 index 0000000..6133002 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.constant; + +/** + *
+ *

+ *

+ * identification of adapter exception + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class DriverExceptionID { + + public static final String INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION = + "Invalid response from instantiate operation"; + + public static final String INVALID_RESPONSEE_FROM_CREATE_OPERATION = "Invalid response from create operation"; + + public static final String FAIL_TO_INSTANTIATE_NS = "Fail to instantiate ns"; + + public static final String FAIL_TO_CREATE_NS = "Fail to create ns"; + + public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation"; + + public static final String FAIL_TO_DELETE_NS = "Fail to delete ns"; + + public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns"; + + public static final String JOB_STATUS_ERROR = "Job status error"; + + public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status"; + + public static final String FAIL_TO_SCALE_NS = "Fail to scale network service"; + + public static final String INVALID_RESPONSE_FROM_SCALE_OPERATION = "Invalid response from scale operation"; + + + private DriverExceptionID() { + + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java new file mode 100644 index 0000000..e08c157 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.constant; + +/** + * Constant Class.
+ *

+ * Define constant for http operation. + *

+ * + * @author + * @version ONAP Amsterdam 2016/8/4 + */ +public class HttpCode { + + /** + * Fail to request. + */ + public static final int BAD_REQUEST = 400; + + /** + * Inner error + */ + public static final int INTERNAL_SERVER_ERROR = 500; + + /** + * Not accept request. + */ + public static final int NOT_ACCEPTABLE = 406; + + /** + * Not found service. + */ + public static final int NOT_FOUND = 404; + + /** + * Accept request. + */ + public static final int RESPOND_ACCEPTED = 202; + + /** + * Http response is ok. + */ + public static final int RESPOND_OK = 200; + + public static final int CREATED_OK = 201; + + /** + * Conflict + */ + public static final int RESPOND_CONFLICT = 409; + + /** + * Constructor
+ *

+ *

+ * + * @since ONAP Amsterdam Release 2017-9-6 + */ + private HttpCode() { + + } + + /** + * Whether request is successful.
+ * + * @param httpCode response code + * @return true or false + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static boolean isSucess(int httpCode) { + return httpCode / 100 == 2; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java new file mode 100644 index 0000000..88260a7 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.exceptions; + +import javax.ws.rs.core.Response; + +public class ApplicationException extends Exception { + + /** + * Serial number. + */ + private static final long serialVersionUID = 1L; + + private int errorCode; + + private String errorMsg; + + /** + * Constructor
+ *

+ *

+ * + * @param errorCode error status + * @param errorMsg error detail + * @since ONAP Amsterdam Release 2017-9-6 + */ + public ApplicationException(int errorCode, String errorMsg) { + this.errorCode = errorCode; + this.errorMsg = errorMsg; + } + + public int getErrorCode() { + return errorCode; + } + + public void setErrorCode(int errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + /** + * build error Response
+ * + * @return + * @since ONAP Amsterdam Release + */ + public Response buildErrorResponse() { + return Response.status(errorCode).entity(errorMsg).build(); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java new file mode 100644 index 0000000..d312501 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java @@ -0,0 +1,68 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class AddPnfData { + private String pnfId; + private String pnfName; + private String pnfdId; + private String pnfProfileId; + private List cpData; + + /*** + * + * @return id of pnf + */ + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getPnfdId() { + return pnfdId; + } + + public void setPnfdId(String pnfdId) { + this.pnfdId = pnfdId; + } + + public String getPnfProfileId() { + return pnfProfileId; + } + + public void setPnfProfileId(String pnfProfileId) { + this.pnfProfileId = pnfProfileId; + } + + public List getCpData() { + return cpData; + } + + public void setCpData(List cpData) { + this.cpData = cpData; + } +} + diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java new file mode 100644 index 0000000..9f357a5 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AddressRange { + private String minAddress; + private String maxAddress; + + public String getMinAddress() { + return minAddress; + } + + public void setMinAddress(String minAddress) { + this.minAddress = minAddress; + } + + public String getMaxAddress() { + return maxAddress; + } + + public void setMaxAddress(String maxAddress) { + this.maxAddress = maxAddress; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java new file mode 100644 index 0000000..fa502f3 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java @@ -0,0 +1,40 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedNs { + private String nsInstanceId; + private String nsdId; + + private enum changeType { + ADD, REMOVE, INSTANTIATE, TERMINATE, SCALE, UPDATE, HEAL + } + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED, PARTIALLY_COMPLETED + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public String getNsdId() { + return nsdId; + } + + public void setNsdId(String nsdId) { + this.nsdId = nsdId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java new file mode 100644 index 0000000..9d98e1c --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java @@ -0,0 +1,67 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedPnf { + private String pnfid; + private String pnfdid; + private String pnfProfileId; + private String pnfName; + private String cpInstanceId; + + private enum changeType { + ADD, REMOVE, MODIFY + } + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED + } + + public String getPnfid() { + return pnfid; + } + + public void setPnfid(String pnfid) { + this.pnfid = pnfid; + } + + public String getPnfdid() { + return pnfdid; + } + + public void setPnfdid(String pnfdid) { + this.pnfdid = pnfdid; + } + + public String getPnfProfileId() { + return pnfProfileId; + } + + public void setPnfProfileId(String pnfProfileId) { + this.pnfProfileId = pnfProfileId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getCpInstanceId() { + return cpInstanceId; + } + + public void setCpInstanceId(String cpInstanceId) { + this.cpInstanceId = cpInstanceId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java new file mode 100644 index 0000000..62f4f92 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java @@ -0,0 +1,49 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedSap { + private String sapInstanceId; + private String sapdId; + private String sapName; + + private enum changeType { + ADD, REMOVE, MODIFY + } + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED + } + + public String getSapInstanceId() { + return sapInstanceId; + } + + public void setSapInstanceId(String sapInstanceId) { + this.sapInstanceId = sapInstanceId; + } + + public String getSapdId() { + return sapdId; + } + + public void setSapdId(String sapdId) { + this.sapdId = sapdId; + } + + public String getSapName() { + return sapName; + } + + public void setSapName(String sapName) { + this.sapName = sapName; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java new file mode 100644 index 0000000..ecaa1c5 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java @@ -0,0 +1,49 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedVirtualLink { + private String nsVirtualLinkInstanceId; + private String nsVirtualLinkDescId; + private String vlProfileId; + + private enum changeType { + ADD, DELETE, MODIFY, ADD_LINK_PORT, REMOVE_LINK_PORT + }; + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED + } + + public String getNsVirtualLinkInstanceId() { + return nsVirtualLinkInstanceId; + } + + public void setNsVirtualLinkInstanceId(String nsVirtualLinkInstanceId) { + this.nsVirtualLinkInstanceId = nsVirtualLinkInstanceId; + } + + public String getNsVirtualLinkDescId() { + return nsVirtualLinkDescId; + } + + public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) { + this.nsVirtualLinkDescId = nsVirtualLinkDescId; + } + + public String getVlProfileId() { + return vlProfileId; + } + + public void setVlProfileId(String vlProfileId) { + this.vlProfileId = vlProfileId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java new file mode 100644 index 0000000..6463c7a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java @@ -0,0 +1,78 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedVnf { + private String vnfInstanceId; + private String vnfdId; + private String vnfProfileId; + private String vnfName; + + private enum changeType { + ADD, + REMOVE, + INSTANTIATE, + TERMINATE, + SCALE, + CHANGE_FLAVOUR, + HEAL, + OPERATE, + MODIFY_INFORMATION, + CHANGE_EXTERNAL_VNF_CONNECTIVITY + }; + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED + } + + private ChangedInfo changedInfo; + + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + public String getVnfProfileId() { + return vnfProfileId; + } + + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public ChangedInfo getChangedInfo() { + return changedInfo; + } + + public void setChangedInfo(ChangedInfo changedInfo) { + this.changedInfo = changedInfo; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java new file mode 100644 index 0000000..04e9481 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java @@ -0,0 +1,40 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class AffectedVnffg { + private String vnffgInstanceId; + private String vnffgdId; + + private enum changeType { + ADD, REMOVE, MODIFY + } + private enum changeResult { + COMPLETED, ROLLED_BACK, FAILED + } + + public String getVnffgInstanceId() { + return vnffgInstanceId; + } + + public void setVnffgInstanceId(String vnffgInstanceId) { + this.vnffgInstanceId = vnffgInstanceId; + } + + public String getVnffgdId() { + return vnffgdId; + } + + public void setVnffgdId(String vnffgdId) { + this.vnffgdId = vnffgdId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java new file mode 100644 index 0000000..7f019bc --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java @@ -0,0 +1,51 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class AffinityOrAntiAffinityRule { + private String vnfdId; + private List vnfProfileId; + private List vnfInstanceId; + + private enum affinityOrAntiAffiinty { + AFFINITY, ANTI_AFFIINTY + }; + private enum scope { + NFVI_POP, ZONE, ZONE_GROUP, NFVI_NODE + }; + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(String vnfdId) { + this.vnfdId = vnfdId; + } + + public List getVnfProfileId() { + return vnfProfileId; + } + + public void setVnfProfileId(List vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + public List getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(List vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java new file mode 100644 index 0000000..5de6cbf --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class ChangedInfo { + private ModifyVnfInfoData changedVnfInfo; + private ExtVirtualLinkInfo changedExtConnectivity; + + public ModifyVnfInfoData getChangedVnfInfo() { + return changedVnfInfo; + } + + public void setChangedVnfInfo(ModifyVnfInfoData changedVnfInfo) { + this.changedVnfInfo = changedVnfInfo; + } + + public ExtVirtualLinkInfo getChangedExtConnectivity() { + return changedExtConnectivity; + } + + public void setChangedExtConnectivity(ExtVirtualLinkInfo changedExtConnectivity) { + this.changedExtConnectivity = changedExtConnectivity; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java new file mode 100644 index 0000000..2a63d39 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class CivicAddressElement { + private int caType; + private String caValue; + + public int getCaType() { + return caType; + } + + public void setCaType(int caType) { + this.caType = caType; + } + + public String getCaValue() { + return caValue; + } + + public void setCaValue(String caValue) { + this.caValue = caValue; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java new file mode 100644 index 0000000..27272ea --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class CpProtocolData { + private String layerProtocol; + private IpOverEthernetAddressData ipOverEthernet; + + public String getLayerProtocol() { + return layerProtocol; + } + + public void setLayerProtocol(String layerProtocol) { + this.layerProtocol = layerProtocol; + } + + public IpOverEthernetAddressData getIpOverEthernet() { + return ipOverEthernet; + } + + public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) { + this.ipOverEthernet = ipOverEthernet; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java new file mode 100644 index 0000000..5f1191e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class CpProtocolInfo { + @NotNull + private enum layerProtocol { + IP_OVER_ETHERNET + }; + + private IpOverEthernetAddressData ipOverEthernet; + + public IpOverEthernetAddressData getIpOverEthernet() { + return ipOverEthernet; + } + + public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) { + this.ipOverEthernet = ipOverEthernet; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java new file mode 100644 index 0000000..878ce60 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java @@ -0,0 +1,53 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class CreateNsRequest { + + String nsdId; + + String nsName; + + String nsDescription; + + + public String getNsdId() { + return nsdId; + } + + public void setNsdId(String nsdId) { + this.nsdId = nsdId; + } + + public String getNsDescription() { + return nsDescription; + } + + public void setNsDescription(String nsDescription) { + this.nsDescription = nsDescription; + } + + /** + * @return Returns the nsName. + */ + public String getNsName() { + return nsName; + } + + /** + * @param nsName The nsName to set. + */ + public void setNsName(String nsName) { + this.nsName = nsName; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java new file mode 100644 index 0000000..e54f0df --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + * The Customer Model
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-10-12 + */ +public class CustomerModel { + + String globalCustomerId; + + String serviceType; + + + /** + * @return Returns the globalCustomerId. + */ + public String getGlobalCustomerId() { + return globalCustomerId; + } + + + /** + * @param globalCustomerId The globalCustomerId to set. + */ + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java new file mode 100644 index 0000000..63ca66b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class ExtCpInfo { + @NotNull + private String id; + @NotNull + private String cpdId; + private List cpProtocolInfo; + private List extLinkPortId; + + + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java new file mode 100644 index 0000000..a1ab3fd --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class ExtLinkPortInfo { + private String id; + private ResourceHandle resourceHandle; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ResourceHandle getResourceHandle() { + return resourceHandle; + } + + public void setResourceHandle(ResourceHandle resourceHandle) { + this.resourceHandle = resourceHandle; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java new file mode 100644 index 0000000..3f643a8 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class ExtManagedVirtualLinkInfo { + @NotNull + private String id; + @NotNull + private String vnfVirtualLinkDescId; + @NotNull + private ResourceHandle networkResource; + private List vnfLinkPorts; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVnfVirtualLinkDescId() { + return vnfVirtualLinkDescId; + } + + public void setVnfVirtualLinkDescId(String vnfVirtualLinkDescId) { + this.vnfVirtualLinkDescId = vnfVirtualLinkDescId; + } + + public ResourceHandle getNetworkResource() { + return networkResource; + } + + public void setNetworkResource(ResourceHandle networkResource) { + this.networkResource = networkResource; + } + + public List getVnfLinkPorts() { + return vnfLinkPorts; + } + + public void setVnfLinkPorts(List vnfLinkPorts) { + this.vnfLinkPorts = vnfLinkPorts; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java new file mode 100644 index 0000000..ce7d1cf --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java @@ -0,0 +1,42 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class ExtVirtualLinkInfo { + private String id; + private ResourceHandle resourceHandle; + private ExtLinkPortInfo extLinkPorts; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ResourceHandle getResourceHandle() { + return resourceHandle; + } + + public void setResourceHandle(ResourceHandle resourceHandle) { + this.resourceHandle = resourceHandle; + } + + public ExtLinkPortInfo getExtLinkPorts() { + return extLinkPorts; + } + + public void setExtLinkPorts(ExtLinkPortInfo extLinkPorts) { + this.extLinkPorts = extLinkPorts; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java new file mode 100644 index 0000000..ff0730a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java @@ -0,0 +1,207 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; +import java.util.Map; + +public class InstantiateNsRequest { + + private String nsFlavourId; + private List sapData; + private List addpnfData; + private List vnfInstanceData; + private List nestedNsInstanceId; + private List localizationLanguage; + private Map aditionalParamsForNs; + private List additionalParamsForVnf; + private String startTime; + private String nsInstantiationLevelId; + private List additionalAffinityOrAntiAffiniityRule; + + /*** + * + * @return nsFlavourId + */ + public String getNsFlavourId() { + return nsFlavourId; + } + + /*** + * + * @param nsFlavourId + */ + public void setNsFlavourId(String nsFlavourId) { + this.nsFlavourId = nsFlavourId; + } + + /*** + * + * @return + */ + public List getSapData() { + return sapData; + } + + /*** + * + * @param sapData + */ + public void setSapData(List sapData) { + this.sapData = sapData; + } + + /*** + * + * @return + */ + public List getAddpnfData() { + return addpnfData; + } + + /*** + * + * @param addpnfData + */ + public void setAddpnfData(List addpnfData) { + this.addpnfData = addpnfData; + } + + /*** + * + * @return + */ + public List getVnfInstanceData() { + return vnfInstanceData; + } + + /*** + * + * @param vnfInstanceData + */ + public void setVnfInstanceData(List vnfInstanceData) { + this.vnfInstanceData = vnfInstanceData; + } + + /*** + * + * @return + */ + public List getNestedNsInstanceId() { + return nestedNsInstanceId; + } + + /*** + * + * @param nestedNsInstanceId + */ + public void setNestedNsInstanceId(List nestedNsInstanceId) { + this.nestedNsInstanceId = nestedNsInstanceId; + } + + /*** + * + * @return + */ + public List getLocalizationLanguage() { + return localizationLanguage; + } + + /*** + * + * @param localizationLanguage + */ + public void setLocalizationLanguage(List localizationLanguage) { + this.localizationLanguage = localizationLanguage; + } + + /*** + * + * @return + */ + public Map getAditionalParamsForNs() { + return aditionalParamsForNs; + } + + /*** + * + * @param aditionalParamsForNs + */ + public void setAditionalParamsForNs(Map aditionalParamsForNs) { + this.aditionalParamsForNs = aditionalParamsForNs; + } + + /*** + * + * @return + */ + public List getAdditionalParamsForVnf() { + return additionalParamsForVnf; + } + + /*** + * + * @param additionalParamsForVnf + */ + public void setAdditionalParamsForVnf(List additionalParamsForVnf) { + this.additionalParamsForVnf = additionalParamsForVnf; + } + + /*** + * + * @return + */ + public String getStartTime() { + return startTime; + } + + /*** + * + * @param startTime + */ + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + /*** + * + * @return + */ + public String getNsInstantiationLevelId() { + return nsInstantiationLevelId; + } + + /*** + * + * @param nsInstantiationLevelId + */ + public void setNsInstantiationLevelId(String nsInstantiationLevelId) { + this.nsInstantiationLevelId = nsInstantiationLevelId; + } + + /*** + * + * @return + */ + public List getAdditionalAffinityOrAntiAffiniityRule() { + return additionalAffinityOrAntiAffiniityRule; + } + + /*** + * + * @param additionalAffinityOrAntiAffiniityRule + */ + public void setAdditionalAffinityOrAntiAffiniityRule( + List additionalAffinityOrAntiAffiniityRule) { + this.additionalAffinityOrAntiAffiniityRule = additionalAffinityOrAntiAffiniityRule; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java new file mode 100644 index 0000000..e66bb90 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class InstantiatedVnfInfo { + @NotNull + private String flavourId; + @NotNull + private String vnfState; + private List vnfScaleInfos; + @NotNull + private List extCpInfo; + private List extVirtualLinkInfo; + private List extManagedVirtualLinkInfo; + // Defination of MonitoringParameter is not there in ETSI document + // considering as String + private List monitoringParameters; + private String localizationLanguage; + + private List vnfcResourceInfo; + // Defination of VirtualStorageResourceInfo is not there in ETSI document + // considering as String + private List virtualStorageResourceInfo; + + public String getFlavourId() { + return flavourId; + } + + public void setFlavourId(String flavourId) { + this.flavourId = flavourId; + } + + public String getVnfState() { + return vnfState; + } + + public void setVnfState(String vnfState) { + this.vnfState = vnfState; + } + + public List getVnfScaleInfos() { + return vnfScaleInfos; + } + + public void setVnfScaleInfos(List vnfScaleInfos) { + this.vnfScaleInfos = vnfScaleInfos; + } + + public List getExtCpInfo() { + return extCpInfo; + } + + public void setExtCpInfo(List extCpInfo) { + this.extCpInfo = extCpInfo; + } + + public List getExtVirtualLinkInfo() { + return extVirtualLinkInfo; + } + + public void setExtVirtualLinkInfo(List extVirtualLinkInfo) { + this.extVirtualLinkInfo = extVirtualLinkInfo; + } + + public List getExtManagedVirtualLinkInfo() { + return extManagedVirtualLinkInfo; + } + + public void setExtManagedVirtualLinkInfo(List extManagedVirtualLinkInfo) { + this.extManagedVirtualLinkInfo = extManagedVirtualLinkInfo; + } + + public List getMonitoringParameters() { + return monitoringParameters; + } + + public void setMonitoringParameters(List monitoringParameters) { + this.monitoringParameters = monitoringParameters; + } + + public String getLocalizationLanguage() { + return localizationLanguage; + } + + public void setLocalizationLanguage(String localizationLanguage) { + this.localizationLanguage = localizationLanguage; + } + + public List getVnfcResourceInfo() { + return vnfcResourceInfo; + } + + public void setVnfcResourceInfo(List vnfcResourceInfo) { + this.vnfcResourceInfo = vnfcResourceInfo; + } + + public List getVirtualStorageResourceInfo() { + return virtualStorageResourceInfo; + } + + public void setVirtualStorageResourceInfo(List virtualStorageResourceInfo) { + this.virtualStorageResourceInfo = virtualStorageResourceInfo; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java new file mode 100644 index 0000000..32c5571 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java @@ -0,0 +1,63 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class IpAddresses { + private String type; + private List fixedAddresses; + private int numDynamicAddresses; + private AddressRange addressRange; + private String subnetId; + + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List getFixedAddresses() { + return fixedAddresses; + } + + public void setFixedAddresses(List fixedAddresses) { + this.fixedAddresses = fixedAddresses; + } + + public int getNumDynamicAddresses() { + return numDynamicAddresses; + } + + public void setNumDynamicAddresses(int numDynamicAddresses) { + this.numDynamicAddresses = numDynamicAddresses; + } + + public AddressRange getAddressRange() { + return addressRange; + } + + public void setAddressRange(AddressRange addressRange) { + this.addressRange = addressRange; + } + + public String getSubnetId() { + return subnetId; + } + + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java new file mode 100644 index 0000000..48529e5 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java @@ -0,0 +1,35 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class IpOverEthernetAddressData { + private String macAddress; + private List ipAddresses; + + public String getMacAddress() { + return macAddress; + } + + public void setMacAddress(String macAddress) { + this.macAddress = macAddress; + } + + public List getIpAddresses() { + return ipAddresses; + } + + public void setIpAddresses(List ipAddresses) { + this.ipAddresses = ipAddresses; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Link.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Link.java new file mode 100644 index 0000000..2459346 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Link.java @@ -0,0 +1,24 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class Link { + private String href; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Links.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Links.java new file mode 100644 index 0000000..8ad8f00 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Links.java @@ -0,0 +1,78 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class Links { + private Link self; + private Link nsInstance; + private Link cancel; + private Link retry; + private Link rollback; + private Link continues; + private Link fail; + + public Link getSelf() { + return self; + } + + public void setSelf(Link self) { + this.self = self; + } + + public Link getNsInstance() { + return nsInstance; + } + + public void setNsInstance(Link nsInstance) { + this.nsInstance = nsInstance; + } + + public Link getCancel() { + return cancel; + } + + public void setCancel(Link cancel) { + this.cancel = cancel; + } + + public Link getRetry() { + return retry; + } + + public void setRetry(Link retry) { + this.retry = retry; + } + + public Link getRollback() { + return rollback; + } + + public void setRollback(Link rollback) { + this.rollback = rollback; + } + + public Link getContinues() { + return continues; + } + + public void setContinues(Link continues) { + this.continues = continues; + } + + public Link getFail() { + return fail; + } + + public void setFail(Link fail) { + this.fail = fail; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java new file mode 100644 index 0000000..b79565d --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class LocationConstraint { + + /** + * vnf profile id + */ + private String vnfProfileId; + + /** + * location constraints: vimId + */ + private VimLocation locationConstraints; + + /** + * @return Returns the vnfProfileId. + */ + public String getVnfProfileId() { + return vnfProfileId; + } + + /** + * @param vnfProfileId The vnfProfileId to set. + */ + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + + /** + * @return Returns the locationConstraints. + */ + public VimLocation getLocationConstraints() { + return locationConstraints; + } + + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(VimLocation locationConstraints) { + this.locationConstraints = locationConstraints; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java new file mode 100644 index 0000000..b636d49 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class LocationConstraints { + private String countryCode; + private CivicAddressElement civicAddressElement; + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + public CivicAddressElement getCivicAddressElement() { + return civicAddressElement; + } + + public void setCivicAddressElement(CivicAddressElement civicAddressElement) { + this.civicAddressElement = civicAddressElement; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Mask.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Mask.java new file mode 100644 index 0000000..352f47e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/Mask.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class Mask { + @NotNull + private int startingPoint; + @NotNull + private int length; + @NotNull + private String value; + + public int getStartingPoint() { + return startingPoint; + } + + public void setStartingPoint(int startingPoint) { + this.startingPoint = startingPoint; + } + + public int getLength() { + return length; + } + + public void setLength(int length) { + this.length = length; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java new file mode 100644 index 0000000..55ab21e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java @@ -0,0 +1,80 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.Map; + +public class ModifyVnfInfoData { + private String vnfInstanceId; + private String vnfInstanceName; + private String vnfInstanceDescription; + private String vnfPkgId; + private Map vnfConfigurableProperties; + private Map Metadata; + private Map Extensions; + + 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 getVnfPkgId() { + return vnfPkgId; + } + + public void setVnfPkgId(String vnfPkgId) { + this.vnfPkgId = vnfPkgId; + } + + public Map getVnfConfigurableProperties() { + return vnfConfigurableProperties; + } + + public void setVnfConfigurableProperties(Map vnfConfigurableProperties) { + this.vnfConfigurableProperties = vnfConfigurableProperties; + } + + public Map getMetadata() { + return Metadata; + } + + public void setMetadata(Map metadata) { + Metadata = metadata; + } + + public Map getExtensions() { + return Extensions; + } + + public void setExtensions(Map extensions) { + Extensions = extensions; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java new file mode 100644 index 0000000..266e5ee --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 CMCC All rights reserved. + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.io.ByteArrayOutputStream; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * NS Create Input Parameter For VFC Adapter
+ *

+ *

+ * + * @version ONAP Amsterdam Release 2017/1/7 + */ +public class NSResourceInputParameter { + + private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class); + + private NsOperationKey nsOperationKey; + + private String nsServiceName; + + private String nsServiceDescription; + + private String nsServiceModelUUID; + + private NsParameters nsParameters; + + private NsScaleParameters nsScaleParameters; + + + /** + * @return Returns the nsServiceName. + */ + public String getNsServiceName() { + return nsServiceName; + } + + + /** + * @param nsServiceName The nsServiceName to set. + */ + public void setNsServiceName(String nsServiceName) { + this.nsServiceName = nsServiceName; + } + + + /** + * @return Returns the nsServiceDescription. + */ + public String getNsServiceDescription() { + return nsServiceDescription; + } + + + /** + * @param nsServiceDescription The nsServiceDescription to set. + */ + public void setNsServiceDescription(String nsServiceDescription) { + this.nsServiceDescription = nsServiceDescription; + } + + /** + * @return Returns the nsParameters. + */ + public NsParameters getNsParameters() { + return nsParameters; + } + + /** + * @param nsParameters The nsParameters to set. + */ + public void setNsParameters(NsParameters nsParameters) { + this.nsParameters = nsParameters; + } + + public NsOperationKey getNsOperationKey() { + return nsOperationKey; + } + + public void setNsOperationKey(NsOperationKey nsOperationKey) { + this.nsOperationKey = nsOperationKey; + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + } catch (Exception e) { + logger.debug("Exception:", e); + } + return jsonString; + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + logger.debug("Exception:", e); + return ""; + } + } + + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } + + + public String getNsServiceModelUUID() { + return nsServiceModelUUID; + } + + + public void setNsServiceModelUUID(String nsServiceModelUUID) { + this.nsServiceModelUUID = nsServiceModelUUID; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java new file mode 100644 index 0000000..a6e3963 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class NfpInfo { + @NotNull + private String id; + private String nfpdId; + private String nfpName; + private String description; + @NotNull + private List nscpHandle; + private int totalCp; + @NotNull + private NfpRule nfpRule; + + @NotNull + private enum nfpState { + ENABLED, DISABLED + }; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNfpdId() { + return nfpdId; + } + + public void setNfpdId(String nfpdId) { + this.nfpdId = nfpdId; + } + + public String getNfpName() { + return nfpName; + } + + public void setNfpName(String nfpName) { + this.nfpName = nfpName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getNscpHandle() { + return nscpHandle; + } + + public void setNscpHandle(List nscpHandle) { + this.nscpHandle = nscpHandle; + } + + public int getTotalCp() { + return totalCp; + } + + public void setTotalCp(int totalCp) { + this.totalCp = totalCp; + } + + public NfpRule getNfpRule() { + return nfpRule; + } + + public void setNfpRule(NfpRule nfpRule) { + this.nfpRule = nfpRule; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java new file mode 100644 index 0000000..b4f684a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class NfpRule { + private String etherDestinationAddress; + private String etherSourceAddress; + + private enum etherType { + IPV4, IPV6 + }; + + private List vlanTag; + + private enum protocol { + TCP, UDP, ICMP + } + + private String dscp; + private PortRange sourcePortRange; + private PortRange destinationPortRange; + private String sourceIpAddressPrefix; + private String destinationIpAddressPrefix; + private List extendedCriteria; + + public String getEtherDestinationAddress() { + return etherDestinationAddress; + } + + public void setEtherDestinationAddress(String etherDestinationAddress) { + this.etherDestinationAddress = etherDestinationAddress; + } + + public String getEtherSourceAddress() { + return etherSourceAddress; + } + + public void setEtherSourceAddress(String etherSourceAddress) { + this.etherSourceAddress = etherSourceAddress; + } + + public List getVlanTag() { + return vlanTag; + } + + public void setVlanTag(List vlanTag) { + this.vlanTag = vlanTag; + } + + public String getDscp() { + return dscp; + } + + public void setDscp(String dscp) { + this.dscp = dscp; + } + + public PortRange getSourcePortRange() { + return sourcePortRange; + } + + public void setSourcePortRange(PortRange sourcePortRange) { + this.sourcePortRange = sourcePortRange; + } + + public PortRange getDestinationPortRange() { + return destinationPortRange; + } + + public void setDestinationPortRange(PortRange destinationPortRange) { + this.destinationPortRange = destinationPortRange; + } + + public String getSourceIpAddressPrefix() { + return sourceIpAddressPrefix; + } + + public void setSourceIpAddressPrefix(String sourceIpAddressPrefix) { + this.sourceIpAddressPrefix = sourceIpAddressPrefix; + } + + public String getDestinationIpAddressPrefix() { + return destinationIpAddressPrefix; + } + + public void setDestinationIpAddressPrefix(String destinationIpAddressPrefix) { + this.destinationIpAddressPrefix = destinationIpAddressPrefix; + } + + public List getExtendedCriteria() { + return extendedCriteria; + } + + public void setExtendedCriteria(List extendedCriteria) { + this.extendedCriteria = extendedCriteria; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java new file mode 100644 index 0000000..326488f --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class NsCpHandle { + private String vnfInstanceId; + private String vnfExtCpInstanceId; + private String pnfInfoId; + private String pnfExtCpInstanceId; + private String nsInstanceId; + private String nsSapInstanceId; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfExtCpInstanceId() { + return vnfExtCpInstanceId; + } + + public void setVnfExtCpInstanceId(String vnfExtCpInstanceId) { + this.vnfExtCpInstanceId = vnfExtCpInstanceId; + } + + public String getPnfInfoId() { + return pnfInfoId; + } + + public void setPnfInfoId(String pnfInfoId) { + this.pnfInfoId = pnfInfoId; + } + + public String getPnfExtCpInstanceId() { + return pnfExtCpInstanceId; + } + + public void setPnfExtCpInstanceId(String pnfExtCpInstanceId) { + this.pnfExtCpInstanceId = pnfExtCpInstanceId; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public String getNsSapInstanceId() { + return nsSapInstanceId; + } + + public void setNsSapInstanceId(String nsSapInstanceId) { + this.nsSapInstanceId = nsSapInstanceId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java new file mode 100644 index 0000000..63358cb --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + * Network Service Request
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Sep 2, 2016 + */ +public class NsCreateReq { + + CustomerModel context; + + String csarId; + + String nsName; + + String description; + + + /** + * @return Returns the context. + */ + public CustomerModel getContext() { + return context; + } + + + + /** + * @param context The context to set. + */ + public void setContext(CustomerModel context) { + this.context = context; + } + + + /** + * @return Returns the csarId. + */ + public String getCsarId() { + return csarId; + } + + + /** + * @param csarId The csarId to set. + */ + public void setCsarId(String csarId) { + this.csarId = csarId; + } + + /** + * @return Returns the nsName. + */ + public String getNsName() { + return nsName; + } + + /** + * @param nsName The nsName to set. + */ + public void setNsName(String nsName) { + this.nsName = nsName; + } + + /** + * @return Returns the description. + */ + public String getDescription() { + return description; + } + + /** + * @param description The description to set. + */ + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java new file mode 100644 index 0000000..d2d4b4e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class NsInstance { + @NotNull + private String id; + @NotNull + private String nsInstanceName; + @NotNull + private String nsInstanceDescription; + @NotNull + private String nsdId; + @NotNull + private String nsdInfoId; + private String flavourId; + private List vnfInstance; + private List pnfInfo; + private List virtualLinkInfo; + private List vnffgInfo; + private List sapInfo; + private List nestedNsInstanceId; + + @NotNull + private enum nsState { + NOT_INSTANTIATED, INSTANTIATED + }; + + private List nsScaleStatus; + private List additionalAffinityOrAntiAffinityRule; + @NotNull + private NsInstanceLinks _links; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNsInstanceName() { + return nsInstanceName; + } + + public void setNsInstanceName(String nsInstanceName) { + this.nsInstanceName = nsInstanceName; + } + + public String getNsInstanceDescription() { + return nsInstanceDescription; + } + + public void setNsInstanceDescription(String nsInstanceDescription) { + this.nsInstanceDescription = nsInstanceDescription; + } + + public String getNsdId() { + return nsdId; + } + + public void setNsdId(String nsdId) { + this.nsdId = nsdId; + } + + public String getNsdInfoId() { + return nsdInfoId; + } + + public void setNsdInfoId(String nsdInfoId) { + this.nsdInfoId = nsdInfoId; + } + + public String getFlavourId() { + return flavourId; + } + + public void setFlavourId(String flavourId) { + this.flavourId = flavourId; + } + + public List getVnfInstance() { + return vnfInstance; + } + + public void setVnfInstance(List vnfInstance) { + this.vnfInstance = vnfInstance; + } + + public List getPnfInfo() { + return pnfInfo; + } + + public void setPnfInfo(List pnfInfo) { + this.pnfInfo = pnfInfo; + } + + public List getVirtualLinkInfo() { + return virtualLinkInfo; + } + + public void setVirtualLinkInfo(List virtualLinkInfo) { + this.virtualLinkInfo = virtualLinkInfo; + } + + public List getVnffgInfo() { + return vnffgInfo; + } + + public void setVnffgInfo(List vnffgInfo) { + this.vnffgInfo = vnffgInfo; + } + + public List getSapInfo() { + return sapInfo; + } + + public void setSapInfo(List sapInfo) { + this.sapInfo = sapInfo; + } + + public List getNestedNsInstanceId() { + return nestedNsInstanceId; + } + + public void setNestedNsInstanceId(List nestedNsInstanceId) { + this.nestedNsInstanceId = nestedNsInstanceId; + } + + public List getNsScaleStatus() { + return nsScaleStatus; + } + + public void setNsScaleStatus(List nsScaleStatus) { + this.nsScaleStatus = nsScaleStatus; + } + + public List getAdditionalAffinityOrAntiAffinityRule() { + return additionalAffinityOrAntiAffinityRule; + } + + public void setAdditionalAffinityOrAntiAffinityRule( + List additionalAffinityOrAntiAffinityRule) { + this.additionalAffinityOrAntiAffinityRule = additionalAffinityOrAntiAffinityRule; + } + + public NsInstanceLinks get_links() { + return _links; + } + + public void set_links(NsInstanceLinks _links) { + this._links = _links; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java new file mode 100644 index 0000000..08b3c63 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class NsInstanceLinks { + @NotNull + private Link self; + private List nestedNsInstances; + private Link instantiate; + private Link terminate; + private Link update; + private Link scale; + private Link heal; + + public Link getSelf() { + return self; + } + + public void setSelf(Link self) { + this.self = self; + } + + public List getNestedNsInstances() { + return nestedNsInstances; + } + + public void setNestedNsInstances(List nestedNsInstances) { + this.nestedNsInstances = nestedNsInstances; + } + + public Link getInstantiate() { + return instantiate; + } + + public void setInstantiate(Link instantiate) { + this.instantiate = instantiate; + } + + public Link getTerminate() { + return terminate; + } + + public void setTerminate(Link terminate) { + this.terminate = terminate; + } + + public Link getUpdate() { + return update; + } + + public void setUpdate(Link update) { + this.update = update; + } + + public Link getScale() { + return scale; + } + + public void setScale(Link scale) { + this.scale = scale; + } + + public Link getHeal() { + return heal; + } + + public void setHeal(Link heal) { + this.heal = heal; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java new file mode 100644 index 0000000..4281026 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + *
+ *

+ *

+ * request model for instatiate + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsInstantiateReq extends NsParameters { + + String nsInstanceId; + + /** + * @return Returns the nsInstanceId. + */ + public String getNsInstanceId() { + return nsInstanceId; + } + + /** + * @param nsInstanceId The nsInstanceId to set. + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java new file mode 100644 index 0000000..559b1f7 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java @@ -0,0 +1,125 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.onap.so.adapters.vfc.constant.CommonConstant; + +public class NsLcmOpOcc { + private String id; + private CommonConstant.operationState operationState; + private String statusEnteredTime; + private String nsInstanceId; + private CommonConstant.lcmOperationType lcmOperationType; + private String startTime; + private Boolean isAutomaticInvocation; + private String operationParams; + private Boolean isCancelPending; + private CommonConstant.cancelMode cancelMode; + private ProblemDetails error; + private Links links; + + public CommonConstant.lcmOperationType getLcmOperationType() { + return lcmOperationType; + } + + public void setLcmOperationType(CommonConstant.lcmOperationType lcmOperationType) { + this.lcmOperationType = lcmOperationType; + } + + public CommonConstant.cancelMode getCancelMode() { + return cancelMode; + } + + public void setCancelMode(CommonConstant.cancelMode cancelMode) { + this.cancelMode = cancelMode; + } + + public CommonConstant.operationState getOperationState() { + return operationState; + } + + public void setOperationState(CommonConstant.operationState operationState) { + this.operationState = operationState; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getStatusEnteredTime() { + return statusEnteredTime; + } + + public void setStatusEnteredTime(String statusEnteredTime) { + this.statusEnteredTime = statusEnteredTime; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public Boolean getAutomaticInvocation() { + return isAutomaticInvocation; + } + + public void setAutomaticInvocation(Boolean automaticInvocation) { + isAutomaticInvocation = automaticInvocation; + } + + public String getOperationParams() { + return operationParams; + } + + public void setOperationParams(String operationParams) { + this.operationParams = operationParams; + } + + public Boolean getCancelPending() { + return isCancelPending; + } + + public void setCancelPending(Boolean cancelPending) { + isCancelPending = cancelPending; + } + + public ProblemDetails getError() { + return error; + } + + public void setError(ProblemDetails error) { + this.error = error; + } + + public Links getLinks() { + return links; + } + + public void setLinks(Links links) { + this.links = links; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java new file mode 100644 index 0000000..2dff432 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class NsLinkPortInfo { + @NotNull + private String id; + @NotNull + private ResourceHandle resourceHandle; + private NsCpHandle nsCpHandle; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ResourceHandle getResourceHandle() { + return resourceHandle; + } + + public void setResourceHandle(ResourceHandle resourceHandle) { + this.resourceHandle = resourceHandle; + } + + public NsCpHandle getNsCpHandle() { + return nsCpHandle; + } + + public void setNsCpHandle(NsCpHandle nsCpHandle) { + this.nsCpHandle = nsCpHandle; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java new file mode 100644 index 0000000..2088d68 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + * The operation key object for NS
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-09-15 + */ +public class NsOperationKey { + + /** + * The subscriber id + */ + private String globalSubscriberId; + + /** + * The serviceType + */ + private String serviceType; + + /** + * The service ID + */ + private String serviceId; + + /** + * The Operation ID + */ + private String operationId; + + /** + * the NS template uuid + */ + private String nodeTemplateUUID; + + /** + * @return Returns the globalSubscriberId. + */ + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + /** + *
+ * + * @return + * @since ONAP Amsterdam Release + */ + public String getServiceId() { + return serviceId; + } + + /** + *
+ * + * @param serviceId + * @since ONAP Amsterdam Release + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + *
+ * + * @return + * @since ONAP Amsterdam Release + */ + public String getOperationId() { + return operationId; + } + + /** + *
+ * + * @param operationId + * @since ONAP Amsterdam Release + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the nodeTemplateUUID. + */ + public String getNodeTemplateUUID() { + return nodeTemplateUUID; + } + + /** + * @param nodeTemplateUUID The nodeTemplateUUID to set. + */ + public void setNodeTemplateUUID(String nodeTemplateUUID) { + this.nodeTemplateUUID = nodeTemplateUUID; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java new file mode 100644 index 0000000..e82ee2a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsParameters { + + private List locationConstraints; + + private Map additionalParamForNs = new HashMap<>(); + + /** + * @return Returns the locationConstraints. + */ + public List getLocationConstraints() { + return locationConstraints; + } + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(List locationConstraints) { + this.locationConstraints = locationConstraints; + } + + + /** + * @return Returns the additionalParamForNs. + */ + public Map getAdditionalParamForNs() { + return additionalParamForNs; + } + + + /** + * @param additionalParamForNs The additionalParamForNs to set. + */ + public void setAdditionalParamForNs(Map additionalParamForNs) { + this.additionalParamForNs = additionalParamForNs; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java new file mode 100644 index 0000000..a7e72ef --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +/** + *
+ *

+ *

+ * response model of query operation status + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsProgressStatus { + + String jobId; + + ResponseDescriptor responseDescriptor; + + List responseHistoryList; + + /** + * @return Returns the jobId. + */ + public String getJobId() { + return jobId; + } + + /** + * @param jobId The jobId to set. + */ + public void setJobId(String jobId) { + this.jobId = jobId; + } + + /** + * @return Returns the responseDescriptor. + */ + public ResponseDescriptor getResponseDescriptor() { + return responseDescriptor; + } + + /** + * @param responseDescriptor The responseDescriptor to set. + */ + public void setResponseDescriptor(ResponseDescriptor responseDescriptor) { + this.responseDescriptor = responseDescriptor; + } + + /** + * @return Returns the responseHistoryList. + */ + public List getResponseHistoryList() { + return responseHistoryList; + } + + /** + * @param responseHistoryList The responseHistoryList to set. + */ + public void setResponseHistoryList(List responseHistoryList) { + this.responseHistoryList = responseHistoryList; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java new file mode 100644 index 0000000..59acf56 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class NsScaleInfo { + @NotNull + private String nsScalingAspectId; + @NotNull + private String nsScaleLevelId; + + public String getNsScalingAspectId() { + return nsScalingAspectId; + } + + public void setNsScalingAspectId(String nsScalingAspectId) { + this.nsScalingAspectId = nsScalingAspectId; + } + + public String getNsScaleLevelId() { + return nsScaleLevelId; + } + + public void setNsScaleLevelId(String nsScaleLevelId) { + this.nsScaleLevelId = nsScaleLevelId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java new file mode 100644 index 0000000..6d089c0 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List scaleNsByStepsData; + + private String scaleType; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java new file mode 100644 index 0000000..79ed02c --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +/** + *
+ *

+ *

+ * request model for scale + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleReq extends NsScaleParameters { + + String nsInstanceId; + + /** + * @return Returns the nsInstanceId. + */ + public String getNsInstanceId() { + return nsInstanceId; + } + + /** + * @param nsInstanceId The nsInstanceId to set. + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java new file mode 100644 index 0000000..ed2debd --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class NsVirtualLinkInfo { + @NotNull + private String id; + @NotNull + private String nsVirtualLinkDescId; + @NotNull + private List resourceHandle; + private List linkPort; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNsVirtualLinkDescId() { + return nsVirtualLinkDescId; + } + + public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) { + this.nsVirtualLinkDescId = nsVirtualLinkDescId; + } + + public List getResourceHandle() { + return resourceHandle; + } + + public void setResourceHandle(List resourceHandle) { + this.resourceHandle = resourceHandle; + } + + public List getLinkPort() { + return linkPort; + } + + public void setLinkPort(List linkPort) { + this.linkPort = linkPort; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java new file mode 100644 index 0000000..b7324e5 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java @@ -0,0 +1,35 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.Map; + +public class ParamsForVnf { + private String vnfProfileId; + private Map additionalParams; + + public String getVnfProfileId() { + return vnfProfileId; + } + + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + public Map getAdditionalParams() { + return additionalParams; + } + + public void setAdditionalParams(Map additionalParams) { + this.additionalParams = additionalParams; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java new file mode 100644 index 0000000..d5d091f --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java @@ -0,0 +1,44 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class PnfExtCpData { + private String cpInstanceI16; + private String cpdId; + private List cpProtocolData; + + public String getCpInstanceI16() { + return cpInstanceI16; + } + + public void setCpInstanceI16(String cpInstanceI16) { + this.cpInstanceI16 = cpInstanceI16; + } + + public String getCpdId() { + return cpdId; + } + + public void setCpdId(String cpdId) { + this.cpdId = cpdId; + } + + public List getCpProtocolData() { + return cpProtocolData; + } + + public void setCpProtocolData(List cpProtocolData) { + this.cpProtocolData = cpProtocolData; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java new file mode 100644 index 0000000..402cb83 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class PnfExtCpInfo { + @NotNull + private String cpInstanceId; + @NotNull + private String cpdId; + @NotNull + private List cpProtocolData; + + public String getCpInstanceI16() { + return cpInstanceId; + } + + public void setCpInstanceI16(String cpInstanceI16) { + this.cpInstanceId = cpInstanceI16; + } + + public String getCpdId() { + return cpdId; + } + + public void setCpdId(String cpdId) { + this.cpdId = cpdId; + } + + public List getCpProtocolData() { + return cpProtocolData; + } + + public void setCpProtocolData(List cpProtocolData) { + this.cpProtocolData = cpProtocolData; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java new file mode 100644 index 0000000..a1cc11b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class PnfInfo { + + @NotNull + private String pnfId; + @NotNull + private String pnfName; + @NotNull + private String pnfdId; + @NotNull + private String pnfdInfoId; + @NotNull + private String pnfProfileId; + private List cpData; + + /*** + * + * @return id of pnf + */ + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getPnfdId() { + return pnfdId; + } + + public void setPnfdId(String pnfdId) { + this.pnfdId = pnfdId; + } + + public String getPnfProfileId() { + return pnfProfileId; + } + + public void setPnfProfileId(String pnfProfileId) { + this.pnfProfileId = pnfProfileId; + } + + public List getCpData() { + return cpData; + } + + public void setCpData(List cpData) { + this.cpData = cpData; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java new file mode 100644 index 0000000..8318a8c --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class PortRange { + @NotNull + private int lowerPort; + @NotNull + private int upperPort; + + public int getLowerPort() { + return lowerPort; + } + + public void setLowerPort(int lowerPort) { + this.lowerPort = lowerPort; + } + + public int getUpperPort() { + return upperPort; + } + + public void setUpperPort(int upperPort) { + this.upperPort = upperPort; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java new file mode 100644 index 0000000..efaa5de --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java @@ -0,0 +1,62 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class ProblemDetails { + private String type; + private String title; + private int status; + private String detail; + 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 int getStatus() { + return status; + } + + public void setStatus(int 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/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java new file mode 100644 index 0000000..062a6aa --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java @@ -0,0 +1,71 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class ResourceChanges { + private List affectedVnfs; + private List affectedPnfs; + private List affectedVls; + private List affectedVnffgs; + private List affectedNss; + private List affectedSaps; + + public List getAffectedVnfs() { + return affectedVnfs; + } + + public void setAffectedVnfs(List affectedVnfs) { + this.affectedVnfs = affectedVnfs; + } + + public List getAffectedPnfs() { + return affectedPnfs; + } + + public void setAffectedPnfs(List affectedPnfs) { + this.affectedPnfs = affectedPnfs; + } + + public List getAffectedVls() { + return affectedVls; + } + + public void setAffectedVls(List affectedVls) { + this.affectedVls = affectedVls; + } + + public List getAffectedVnffgs() { + return affectedVnffgs; + } + + public void setAffectedVnffgs(List affectedVnffgs) { + this.affectedVnffgs = affectedVnffgs; + } + + public List getAffectedNss() { + return affectedNss; + } + + public void setAffectedNss(List affectedNss) { + this.affectedNss = affectedNss; + } + + public List getAffectedSaps() { + return affectedSaps; + } + + public void setAffectedSaps(List affectedSaps) { + this.affectedSaps = affectedSaps; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java new file mode 100644 index 0000000..fbfecaa --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java @@ -0,0 +1,51 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class ResourceHandle { + private String vimId; + private String resourceProviderId; + private String resourceId; + private String vimLevelResourceType; + + 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 getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getVimLevelResourceType() { + return vimLevelResourceType; + } + + public void setVimLevelResourceType(String vimLevelResourceType) { + this.vimLevelResourceType = vimLevelResourceType; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java new file mode 100644 index 0000000..3ea51c1 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + *
+ *

+ *

+ * response model of query operation status + * + * @author + * @version SDNO 0.5 September 3, 2016 + */ +public class ResponseDescriptor { + + String status; + + String progress; + + String statusDescription; + + Integer errorCode; + + Integer responseId; + + /** + * @return Returns the status. + */ + public String getStatus() { + return status; + } + + /** + * @param status The status to set. + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return Returns the progress. + */ + public String getProgress() { + return progress; + } + + /** + * @param progress The progress to set. + */ + public void setProgress(String progress) { + this.progress = progress; + } + + /** + * @return Returns the statusDescription. + */ + public String getStatusDescription() { + return statusDescription; + } + + /** + * @param statusDescription The statusDescription to set. + */ + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + /** + * @return Returns the errorCode. + */ + public Integer getErrorCode() { + return errorCode; + } + + /** + * @param errorCode The errorCode to set. + */ + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + /** + * @return Returns the responseId. + */ + public Integer getResponseId() { + return responseId; + } + + /** + * @param responseId The responseId to set. + */ + public void setResponseId(Integer responseId) { + this.responseId = responseId; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java new file mode 100644 index 0000000..27c9a89 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.Map; + +/** + * The Unified Restful Reponse Class
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-09-06 + */ +public class RestfulResponse { + + // the response content + private String responseContent; + + // the response status + private int status; + + // the response header + private Map respHeaderMap; + + public RestfulResponse() { + this.status = -1; + + this.respHeaderMap = null; + } + + public int getStatus() { + return this.status; + } + + public void setStatus(int status) { + this.status = status; + } + + public Map getRespHeaderMap() { + return this.respHeaderMap; + } + + public void setRespHeaderMap(Map header) { + this.respHeaderMap = header; + } + + public int getRespHeaderInt(String key) { + if (this.respHeaderMap != null) { + String result = this.respHeaderMap.get(key); + if (result != null) { + return Integer.parseInt(result); + } + } + return -1; + } + + public long getRespHeaderLong(String key) { + if (this.respHeaderMap != null) { + String result = this.respHeaderMap.get(key); + if (result != null) { + return Long.parseLong(result); + } + } + return -1L; + } + + public String getRespHeaderStr(String key) { + if (this.respHeaderMap != null) { + return this.respHeaderMap.get(key); + } + return null; + } + + public String getResponseContent() { + return this.responseContent; + } + + public void setResponseContent(String responseString) { + this.responseContent = responseString; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapData.java new file mode 100644 index 0000000..d8e96e2 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapData.java @@ -0,0 +1,56 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +public class SapData { + private String sapdId; + private String sapName; + private String description; + private List sapProtocolData; + + public String getSapdId() { + return sapdId; + } + + public void setSapdId(String sapdId) { + this.sapdId = sapdId; + } + + public String getSapName() { + return sapName; + } + + public void setSapName(String sapName) { + this.sapName = sapName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getSapProtocolData() { + return sapProtocolData; + } + + public void setSapProtocolData(List sapProtocolData) { + this.sapProtocolData = sapProtocolData; + } + + + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java new file mode 100644 index 0000000..182aceb --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class SapInfo { + @NotNull + private String id; + @NotNull + private String sapdId; + @NotNull + private String sapName; + @NotNull + private String description; + @NotNull + private List sapProtocolInfo; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSapdId() { + return sapdId; + } + + public void setSapdId(String sapdId) { + this.sapdId = sapdId; + } + + public String getSapName() { + return sapName; + } + + public void setSapName(String sapName) { + this.sapName = sapName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getSapProtocolInfo() { + return sapProtocolInfo; + } + + public void setSapProtocolInfo(List sapProtocolInfo) { + this.sapProtocolInfo = sapProtocolInfo; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java new file mode 100644 index 0000000..f9d6274 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +/** + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private Integer numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberOfSteps. + */ + public Integer getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberOfSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java new file mode 100644 index 0000000..bd50827 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.List; + +/** + * aim to wrap List as a new list then be provided for the usage of vfc json + * + * added on 2018/01/30 by Qihui Zhao from CMCC + */ + +public class ScaleNsData { + + private List scaleNsByStepsData; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java new file mode 100644 index 0000000..1939fa4 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Object totally matches required VFC input json format JsonUtil.marshal will convert this Object to string + * + * added on 2018/01/30 by Qihui Zhao from CMCC + */ + +public class VFCScaleData { + + private String nsInstanceId; + + private String scaleType; + + private List scaleNsData = new ArrayList<>(); + + /** + * @return Returns the nsInstanceId. + */ + public String getNsInstanceId() { + return nsInstanceId; + } + + /** + * @param nsInstanceId The nsInstanceId to set. + */ + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + /** + * @return Returns the scaleNsDate. + */ + public List getScaleNsData() { + return scaleNsData; + } + + /** + * The scaleNsData to set. + */ + public void setScaleNsData(List scaleNsByStepsData) { + ScaleNsData scaleNsDataObj = new ScaleNsData(); + scaleNsDataObj.setScaleNsByStepsData(scaleNsByStepsData); + + this.scaleNsData.add(scaleNsDataObj); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java new file mode 100644 index 0000000..456835b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.model; + +/** + * + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-10-18 + */ +public class VimLocation { + private String vimId; + + + /** + * @return Returns the vimId. + */ + public String getVimId() { + return vimId; + } + + + /** + * @param vimId The vimId to set. + */ + public void setVimId(String vimId) { + this.vimId = vimId; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java new file mode 100644 index 0000000..ccd6532 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.Map; + +public class VnfInstance { + @NotNull + private String id; + private String vnfInstanceName; + private String vnfInstanceDescription; + @NotNull + private String vnfdId; + @NotNull + private String vnfProvider; + @NotNull + private String vnfProductName; + @NotNull + private String vnfSoftwareVersion; + @NotNull + private String vnfdVersion; + @NotNull + private String vnfPkgId; + private Map vnfConfigurableProperties; + private String vimId; + + private enum instantiationState { + NOT_INSTANTIATED, INSTANTIATED + }; + + private InstantiatedVnfInfo instantiatedVnfInfo; + private Map metadata; + private Map extensions; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + 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 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 getVnfPkgId() { + return vnfPkgId; + } + + public void setVnfPkgId(String vnfPkgId) { + this.vnfPkgId = vnfPkgId; + } + + public Map getVnfConfigurableProperties() { + return vnfConfigurableProperties; + } + + public void setVnfConfigurableProperties(Map vnfConfigurableProperties) { + this.vnfConfigurableProperties = vnfConfigurableProperties; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public InstantiatedVnfInfo getInstantiatedVnfInfo() { + return instantiatedVnfInfo; + } + + public void setInstantiatedVnfInfo(InstantiatedVnfInfo instantiatedVnfInfo) { + this.instantiatedVnfInfo = instantiatedVnfInfo; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public Map getExtensions() { + return extensions; + } + + public void setExtensions(Map extensions) { + this.extensions = extensions; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java new file mode 100644 index 0000000..83345fc --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class VnfInstanceData { + private String vnfInstanceId; + private String vnfProfileId; + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getVnfProfileId() { + return vnfProfileId; + } + + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java new file mode 100644 index 0000000..0b09d06 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class VnfLinkPortInfo { + @NotNull + private String id; + @NotNull + private ResourceHandle resourceHandle; + private String cpInstanceId; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ResourceHandle getResourceHandle() { + return resourceHandle; + } + + public void setResourceHandle(ResourceHandle resourceHandle) { + this.resourceHandle = resourceHandle; + } + + public String getCpInstanceId() { + return cpInstanceId; + } + + public void setCpInstanceId(String cpInstanceId) { + this.cpInstanceId = cpInstanceId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java new file mode 100644 index 0000000..5db3060 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java @@ -0,0 +1,33 @@ +/*** + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +public class VnfLocationConstraint { + private String vnfProfileId; + private LocationConstraint locationConstraints; + + public String getVnfProfileId() { + return vnfProfileId; + } + + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + public LocationConstraint getLocationConstraints() { + return locationConstraints; + } + + public void setLocationConstraints(LocationConstraint locationConstraints) { + this.locationConstraints = locationConstraints; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java new file mode 100644 index 0000000..e702edc --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; + +public class VnfScaleInfo { + @NotNull + private String aspectlId; + @NotNull + private int scaleLevel; + + public String getAspectlId() { + return aspectlId; + } + + public void setAspectlId(String aspectlId) { + this.aspectlId = aspectlId; + } + + public int getScaleLevel() { + return scaleLevel; + } + + public void setScaleLevel(int scaleLevel) { + this.scaleLevel = scaleLevel; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java new file mode 100644 index 0000000..9f41a38 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class VnfVirtualLinkResourceInfo { + @NotNull + private String id; + @NotNull + private String virtualLinkDescId; + @NotNull + private ResourceHandle networkResource; + private String reservationId; + private List vnfLinkPorts; + Map metadata; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVirtualLinkDescId() { + return virtualLinkDescId; + } + + public void setVirtualLinkDescId(String virtualLinkDescId) { + this.virtualLinkDescId = virtualLinkDescId; + } + + public ResourceHandle getNetworkResource() { + return networkResource; + } + + public void setNetworkResource(ResourceHandle networkResource) { + this.networkResource = networkResource; + } + + public String getReservationId() { + return reservationId; + } + + public void setReservationId(String reservationId) { + this.reservationId = reservationId; + } + + public List getVnfLinkPorts() { + return vnfLinkPorts; + } + + public void setVnfLinkPorts(List vnfLinkPorts) { + this.vnfLinkPorts = vnfLinkPorts; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java new file mode 100644 index 0000000..ec629ef --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class VnfcCpInfo { + @NotNull + private String id; + @NotNull + private String cpdId; + private String vnfExtCpId; + private List cpProtocolInfo; + private String vnfLinkPortId; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCpdId() { + return cpdId; + } + + public void setCpdId(String cpdId) { + this.cpdId = cpdId; + } + + public String getVnfExtCpId() { + return vnfExtCpId; + } + + public void setVnfExtCpId(String vnfExtCpId) { + this.vnfExtCpId = vnfExtCpId; + } + + public List getCpProtocolInfo() { + return cpProtocolInfo; + } + + public void setCpProtocolInfo(List cpProtocolInfo) { + this.cpProtocolInfo = cpProtocolInfo; + } + + public String getVnfLinkPortId() { + return vnfLinkPortId; + } + + public void setVnfLinkPortId(String vnfLinkPortId) { + this.vnfLinkPortId = vnfLinkPortId; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java new file mode 100644 index 0000000..1f7aa67 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Map; + +public class VnfcResourceInfo { + @NotNull + private String id; + @NotNull + private String vduId; + @NotNull + private ResourceHandle computeResource; + private List storageResourceIds; + private String reservationId; + private List vnfcCpInfo; + private Map metadata; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVduId() { + return vduId; + } + + public void setVduId(String vduId) { + this.vduId = vduId; + } + + public ResourceHandle getComputeResource() { + return computeResource; + } + + public void setComputeResource(ResourceHandle computeResource) { + this.computeResource = computeResource; + } + + public List getStorageResourceIds() { + return storageResourceIds; + } + + public void setStorageResourceIds(List storageResourceIds) { + this.storageResourceIds = storageResourceIds; + } + + public String getReservationId() { + return reservationId; + } + + public void setReservationId(String reservationId) { + this.reservationId = reservationId; + } + + public List getVnfcCpInfo() { + return vnfcCpInfo; + } + + public void setVnfcCpInfo(List vnfcCpInfo) { + this.vnfcCpInfo = vnfcCpInfo; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java new file mode 100644 index 0000000..c02d517 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import javax.validation.constraints.NotNull; +import java.util.List; + +public class VnffgInfo { + @NotNull + private String id; + @NotNull + private String vnffgdId; + @NotNull + private List vnfInstanceId; + private String pnfInfoId; + @NotNull + private List nsVirtualLinkInfoId; + @NotNull + private List nsCpHandle; + @NotNull + private List nfpInfo; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVnffgdId() { + return vnffgdId; + } + + public void setVnffgdId(String vnffgdId) { + this.vnffgdId = vnffgdId; + } + + public List getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(List vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public String getPnfInfoId() { + return pnfInfoId; + } + + public void setPnfInfoId(String pnfInfoId) { + this.pnfInfoId = pnfInfoId; + } + + public List getNsVirtualLinkInfoId() { + return nsVirtualLinkInfoId; + } + + public void setNsVirtualLinkInfoId(List nsVirtualLinkInfoId) { + this.nsVirtualLinkInfoId = nsVirtualLinkInfoId; + } + + public List getNsCpHandle() { + return nsCpHandle; + } + + public void setNsCpHandle(List nsCpHandle) { + this.nsCpHandle = nsCpHandle; + } + + public List getNfpInfo() { + return nfpInfo; + } + + public void setNfpInfo(List nfpInfo) { + this.nfpInfo = nfpInfo; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java new file mode 100644 index 0000000..7f81dfb --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import org.onap.so.adapters.vfc.model.RestfulResponse; + +/** + * Implement class of operating aai database table
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +public class AaiUtil { + + public static RestfulResponse addRelation(String globalSubsriberId, String serviceType, String serviceInstanceId, + String resourceInstanceId) { + // sent rest to aai to add relation for service and ns. + + return null; + } + + public static RestfulResponse removeRelation(String globalSubsriberId, String serviceType, String serviceInstanceId, + String resourceInstanceId) { + // sent rest to aai to remove relation between service an ns. + return null; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java new file mode 100644 index 0000000..2dcdf11 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import javax.ws.rs.HEAD; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import org.apache.http.HttpStatus; +import org.springframework.stereotype.Component; + +/** + * Health Check
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +@Path("/") +@Component +public class HealthCheckHandler { + + + private static final String CHECK_HTML = + "Health CheckApplication ready"; + + public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build(); + + @HEAD + @Path("/healthcheck") + @Produces("text/html") + public Response healthcheck(@QueryParam("requestId") String requestId) { + return HEALTH_CHECK_RESPONSE; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java new file mode 100644 index 0000000..5a89c04 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java @@ -0,0 +1,265 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.so.adapters.vfc.model.NSResourceInputParameter; +import org.onap.so.adapters.vfc.model.NsOperationKey; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.onap.so.adapters.vfc.util.JsonUtil; +import org.onap.so.adapters.vfc.util.ValidateUtil; +import org.onap.so.db.request.beans.InstanceNfvoMapping; +import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * The rest class for VF-c Adapter
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +@Component +@Path("/v1/vfcadapter") +public class VfcAdapterRest { + + private static final Logger logger = LoggerFactory.getLogger(VfcAdapterRest.class); + private static final String REQUEST_DEBUG_MSG = "body from request is {}"; + private static final String APPLICATION_EXCEPTION = "ApplicationException: "; + @Autowired + private VfcManagerSol005 vfcManagerSol005; + + @Autowired + private VfcManager driverMgr; + @Autowired + private InstanceNfvoMappingRepository instanceNfvoMappingRepository; + + public VfcAdapterRest() { + + } + + /** + * Create a NS
+ * + * @param data http request + * @return + * @since ONAP Amsterdam Release + */ + @POST + @Path("/ns") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response createNfvoNs(String data) { + try { + ValidateUtil.assertObjectNotNull(data); + logger.debug(REQUEST_DEBUG_MSG + data); + NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); + RestfulResponse rsp; + if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) { + rsp = vfcManagerSol005.createNs(nsInput); + } else { + rsp = driverMgr.createNs(nsInput); + } + + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + /** + * Delete NS instance
+ * + * @param data The http request + * @param nsInstanceId The NS instance id + * @return response + * @since ONAP Amsterdam Release + */ + @DELETE + @Path("/ns/{nsInstanceId}") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response deleteNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { + try { + + ValidateUtil.assertObjectNotNull(data); + logger.debug(REQUEST_DEBUG_MSG + data); + NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); + RestfulResponse rsp; + InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); + if (instanceNfvoMapping != null) { + rsp = vfcManagerSol005.deleteNs(nsOperationKey, nsInstanceId); + } else { + rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); + } + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + /** + * Query Operation job status
+ * + * @param data The Http Request + * @param jobId The job id + * @return + * @since ONAP Amsterdam Release + */ + @POST + @Path("/jobs/{jobId}") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) { + try { + ValidateUtil.assertObjectNotNull(data); + logger.debug(REQUEST_DEBUG_MSG + data); + NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); + RestfulResponse rsp; + InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId); + if (instanceNfvoMapping != null) { + rsp = vfcManagerSol005.getNsProgress(nsOperationKey, jobId); + } else { + rsp = driverMgr.getNsProgress(nsOperationKey, jobId); + } + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + /** + * Instantiate NS instance
+ * + * @param data The http request + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + @POST + @Path("/ns/{nsInstanceId}/instantiate") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { + try { + ValidateUtil.assertObjectNotNull(data); + logger.debug(REQUEST_DEBUG_MSG + data); + NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); + RestfulResponse rsp; + if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) { + rsp = vfcManagerSol005.instantiateNs(nsInstanceId, nsInput); + } else { + rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); + } + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + /** + * Terminate NS instance
+ * + * @param data The http request + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + @POST + @Path("/ns/{nsInstanceId}/terminate") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { + try { + ValidateUtil.assertObjectNotNull(data); + logger.debug(REQUEST_DEBUG_MSG + data); + NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); + RestfulResponse rsp; + InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); + if (instanceNfvoMapping != null) { + rsp = vfcManagerSol005.terminateNs(nsOperationKey, nsInstanceId); + } else { + rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); + } + + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + /** + * Scale NS instance
+ * + * @param servletReq The http request + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + @POST + @Path("/ns/{nsInstanceId}/scale") + @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + public Response scaleNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { + try { + ValidateUtil.assertObjectNotNull(data); + logger.debug("Scale Ns Request Received.Body from request is {}" + data); + NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); + RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput); + return buildResponse(rsp); + } catch (ApplicationException e) { + logger.debug(APPLICATION_EXCEPTION, e); + return e.buildErrorResponse(); + } + } + + + /** + * build response from restful response
+ * + * @param rsp general response object + * @return + * @since ONAP Amsterdam Release + */ + private Response buildResponse(RestfulResponse rsp) { + return Response.status(rsp.getStatus()).entity(rsp.getResponseContent()).build(); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java new file mode 100644 index 0000000..b817b5b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java @@ -0,0 +1,492 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import java.util.HashMap; +import java.util.Map; +import org.onap.so.adapters.vfc.constant.CommonConstant; +import org.onap.so.adapters.vfc.constant.CommonConstant.Step; +import org.onap.so.adapters.vfc.constant.DriverExceptionID; +import org.onap.so.adapters.vfc.constant.HttpCode; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.so.adapters.vfc.model.CustomerModel; +import org.onap.so.adapters.vfc.model.NSResourceInputParameter; +import org.onap.so.adapters.vfc.model.NsCreateReq; +import org.onap.so.adapters.vfc.model.NsInstantiateReq; +import org.onap.so.adapters.vfc.model.NsOperationKey; +import org.onap.so.adapters.vfc.model.NsParameters; +import org.onap.so.adapters.vfc.model.NsProgressStatus; +import org.onap.so.adapters.vfc.model.NsScaleParameters; +import org.onap.so.adapters.vfc.model.ResponseDescriptor; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.onap.so.adapters.vfc.model.VFCScaleData; +import org.onap.so.adapters.vfc.util.JsonUtil; +import org.onap.so.adapters.vfc.util.RestfulUtil; +import org.onap.so.adapters.vfc.util.ValidateUtil; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.data.domain.Example; +import org.springframework.stereotype.Component; + +/** + * VF-C Manager
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +@Component +@Primary +public class VfcManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class); + + /** + * nfvo url map + */ + private Map nfvoUrlMap; + + @Autowired + private ResourceOperationStatusRepository resourceOperationStatusRepository; + + @Autowired + private RestfulUtil restfulUtil; + + + public VfcManager() { + nfvoUrlMap = new HashMap<>(); + nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL); + nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL); + nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL); + nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL); + nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL); + nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL); + } + + /** + * create network service
+ * + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { + + // Step1: get service template by node type + String csarId = segInput.getNsServiceModelUUID(); + // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" + LOGGER.info("serviceTemplateId is {}, id is {}", csarId, csarId); + + LOGGER.info("create ns -> begin"); + // Step2: Prepare url and method type + String url = getUrl(null, CommonConstant.Step.CREATE); + String methodType = CommonConstant.MethodType.POST; + + // Step3: Prepare restful parameters and options + NsCreateReq oRequest = new NsCreateReq(); + oRequest.setCsarId(csarId); + oRequest.setNsName(segInput.getNsServiceName()); + oRequest.setDescription(segInput.getNsServiceDescription()); + CustomerModel context = new CustomerModel(); + context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId()); + context.setServiceType(segInput.getNsOperationKey().getServiceType()); + oRequest.setContext(context); + String createReq = JsonUtil.marshal(oRequest); + + // Step4: Call NFVO or SDNO lcm to create ns + RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq); + ValidateUtil.assertObjectNotNull(createRsp); + LOGGER.info("create ns response status is : {}", createRsp.getStatus()); + LOGGER.info("create ns response content is : {}", createRsp.getResponseContent()); + + // Step 5: save resource operation information + ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), + segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + status = resourceOperationStatusRepository.save(status); + if (!HttpCode.isSucess(createRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to create ns"); + status.setProgress("40"); + status.setStatusDescription("NS is created"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(createRsp.getStatus())); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); + } + @SuppressWarnings("unchecked") + Map rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); + String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID); + if (ValidateUtil.isStrEmpty(nsInstanceId)) { + LOGGER.error("Invalid instanceId from create operation"); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); + } + LOGGER.info("create ns -> end"); + LOGGER.info("save segment and operaton info -> begin"); + // Step 6: add relation between service and NS + AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(), + segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(), + nsInstanceId); + LOGGER.info("save segment and operation info -> end"); + return createRsp; + } + + /** + * delete network service
+ * + * @param nsOperationKey The operation key of the NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + LOGGER.info("delete ns -> begin"); + // Step1: prepare url and methodType + String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); + String methodType = CommonConstant.MethodType.DELETE; + + // Step2: prepare restful parameters and options + RestfulResponse deleteRsp = restfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(deleteRsp); + LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus()); + LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent()); + LOGGER.info("delete ns -> end"); + + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + if (!HttpCode.isSucess(deleteRsp.getStatus())) { + LOGGER.error("fail to delete ns"); + + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(deleteRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS); + } + + // Step3: remove relation info between service and ns + AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(), + nsOperationKey.getServiceId(), nsInstanceId); + LOGGER.info("delete segment information -> end"); + + // Step4: update service segment operation status + status.setStatus(RequestsDbConstant.Status.FINISHED); + status.setErrorCode(String.valueOf(deleteRsp.getStatus())); + status.setProgress("100"); + status.setStatusDescription("VFC resource deletion finished"); + resourceOperationStatusRepository.save(status); + LOGGER.info("update segment operaton status for delete -> end"); + + return deleteRsp; + + } + + /** + * instantiate network service
+ * + * @param nsInstanceId The NS instance id + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) + throws ApplicationException { + // Call the NFVO or SDNO service to instantiate service + LOGGER.info("instantiate ns -> begin"); + + // Step1: Prepare restful parameters and options + NsInstantiateReq oRequest = new NsInstantiateReq(); + oRequest.setNsInstanceId(nsInstanceId); + NsParameters nsParameters = segInput.getNsParameters(); + oRequest.setLocationConstraints(nsParameters.getLocationConstraints()); + oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs()); + String instReq = JsonUtil.marshal(oRequest); + // Step2: prepare url and + String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); + String methodType = CommonConstant.MethodType.POST; + + RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq); + ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), + segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); + ValidateUtil.assertObjectNotNull(instRsp); + if (!HttpCode.isSucess(instRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to instantiate ns"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(instRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } + LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); + LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent()); + ValidateUtil.assertObjectNotNull(instRsp.getResponseContent()); + @SuppressWarnings("unchecked") + Map rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if (ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from instantiate operation"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(instRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); + } + LOGGER.info("instantiate ns -> end"); + // Step 3: update segment operation job id + LOGGER.info("update resource operation status job id -> begin"); + status.setJobId(jobId); + status.setProgress("100"); + status.setStatusDescription("NS initiation completed."); + resourceOperationStatusRepository.save(status); + LOGGER.info("update segment operation job id -> end"); + + return instRsp; + } + + /** + * terminate network service
+ * + * @param nsOperationKey The operation key for NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + // Step1: save segment operation info for delete process + LOGGER.info("save segment operation for delete process"); + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + resourceOperationStatusRepository.save(status); + + LOGGER.info("terminate ns -> begin"); + // Step2: prepare url and method type + String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); + String methodType = CommonConstant.MethodType.POST; + + // Step3: prepare restful parameters and options + Map reqBody = new HashMap<>(); + reqBody.put("nsInstanceId", nsInstanceId); + reqBody.put("terminationType", "graceful"); + reqBody.put("gracefulTerminationTimeout", "60"); + + // Step4: Call the NFVO or SDNO service to terminate service + RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody)); + ValidateUtil.assertObjectNotNull(terminateRsp); + LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus()); + LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent()); + // Step 3: update segment operation + if (!HttpCode.isSucess(terminateRsp.getStatus())) { + LOGGER.error("fail to instantiate ns"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(terminateRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } + @SuppressWarnings("unchecked") + Map rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if (ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from terminate operation"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(terminateRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION); + } + LOGGER.info("terminate ns -> end"); + + LOGGER.info("update segment job id -> begin"); + status.setProgress("60"); + status.setStatusDescription("NS is termination completed"); + status.setJobId(jobId); + resourceOperationStatusRepository.save(status); + LOGGER.info("update segment job id -> end"); + + return terminateRsp; + } + + /** + * get ns progress by job Id
+ * + * @param nsOperationKey The OperationKey for NS resource + * @param jobId the job id + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { + + ValidateUtil.assertObjectNotNull(jobId); + // Step 1: query the current resource operation status + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + status = resourceOperationStatusRepository.findOne(Example.of(status)) + .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); + // Step 2: start query + LOGGER.info("query ns status -> begin"); + String url = getUrl(jobId, CommonConstant.Step.QUERY); + String methodType = CommonConstant.MethodType.GET; + // prepare restful parameters and options + RestfulResponse rsp = restfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(rsp); + LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); + LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); + // Step 3:check the response staus + if (!HttpCode.isSucess(rsp.getStatus())) { + LOGGER.info("fail to query job status"); + status.setErrorCode(String.valueOf(rsp.getStatus())); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 4: Process Network Service Instantiate Response + NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); + ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); + // Step 5: update segment operation progress + + status.setProgress(rspDesc.getProgress()); + status.setStatusDescription(rspDesc.getStatusDescription()); + resourceOperationStatusRepository.save(status); + + // Step 6: update segment operation status + if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) + && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { + LOGGER.info("job result is succeeded, operType is {}", status.getOperType()); + status.setErrorCode(String.valueOf(rsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + + if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(status.getOperType()) + || "createInstance".equalsIgnoreCase(status.getOperType())) { + status.setStatus(RequestsDbConstant.Status.FINISHED); + } + resourceOperationStatusRepository.save(status); + } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { + LOGGER.error("job result is failed, operType is {}", status.getOperType()); + status.setErrorCode(String.valueOf(rsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); + status.setStatus(RequestsDbConstant.Status.ERROR); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); + } else { + LOGGER.error("unexcepted response status"); + } + LOGGER.info("query ns status -> end"); + + return rsp; + } + + /** + * Scale NS instance
+ * + * @param nsInstanceId The NS instance id + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Amsterdam Release + */ + public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput) throws ApplicationException { + // Call the NFVO to scale service + LOGGER.info("scale ns -> begin"); + + // Step1: Prepare restful parameters and options + VFCScaleData oRequest = new VFCScaleData(); + oRequest.setNsInstanceId(nsInstanceId); + NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters(); + oRequest.setScaleType(nsScaleParameters.getScaleType()); + oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData()); + String scaleReq = JsonUtil.marshal(oRequest); + + // Step2: prepare url and method type + String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE); + String methodType = CommonConstant.MethodType.POST; + LOGGER.info("scale ns request is {}", scaleReq); + // Step3: Call NFVO lcm to scale ns + RestfulResponse scaleRsp = restfulUtil.send(url, methodType, scaleReq); + + ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), + segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); + ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status)) + .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); + ValidateUtil.assertObjectNotNull(scaleRsp); + if (!HttpCode.isSucess(scaleRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to scale ns"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); + resourceOperationStatusRepository.save(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS); + } + LOGGER.info("scale ns response status is {}", scaleRsp.getStatus()); + LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent()); + + ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent()); + @SuppressWarnings("unchecked") + Map rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class); + String jobId = rsp.get(CommonConstant.JOB_ID); + if (ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from scale operation"); + nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); + nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); + nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); + resourceOperationStatusRepository.save(nsOperInfo); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION); + } + + LOGGER.info("update resource operation status job id -> begin"); + // Step 4: update segment operation job id + nsOperInfo.setJobId(jobId); + resourceOperationStatusRepository.save(nsOperInfo); + LOGGER.info("update segment operation job id -> end"); + LOGGER.info("scale ns -> end"); + + return scaleRsp; + } + + /** + * get url for the operation
+ * + * @param variable variable should be put in the url + * @param step step of the operation (terminate,query,delete) + * @return + * @since ONAP Amsterdam Release + */ + private String getUrl(String variable, String step) { + + String url; + String originalUrl; + originalUrl = nfvoUrlMap.get(step); + url = String.format(originalUrl, variable); + return url; + + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java new file mode 100644 index 0000000..9033bec --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java @@ -0,0 +1,620 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.rest; + +import java.time.LocalDateTime; +import java.util.*; +import org.onap.so.adapters.vfc.constant.CommonConstant; +import org.onap.so.adapters.vfc.constant.CommonConstant.Step; +import org.onap.so.adapters.vfc.constant.DriverExceptionID; +import org.onap.so.adapters.vfc.constant.HttpCode; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.so.adapters.vfc.model.*; +import org.onap.so.adapters.vfc.util.JsonUtil; +import org.onap.so.adapters.vfc.util.RestfulUtil; +import org.onap.so.adapters.vfc.util.ValidateUtil; +import org.onap.so.db.request.beans.InstanceNfvoMapping; +import org.onap.so.db.request.beans.OperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; +import org.onap.so.db.request.data.repository.OperationStatusRepository; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.data.domain.Example; +import org.springframework.stereotype.Component; + +/** + * VF-C Manager
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +@Component +@Primary +public class VfcManagerSol005 { + + private static final Logger LOGGER = LoggerFactory.getLogger(VfcManagerSol005.class); + + /** + * nfvo url map + */ + private Map nfvoUrlMap; + + @Autowired + private ResourceOperationStatusRepository resourceOperationStatusRepository; + + @Autowired + private RestfulUtil restfulUtil; + + @Autowired + private OperationStatusRepository operationStatusRepository; + + @Autowired + private InstanceNfvoMappingRepository instanceNfvoMappingRepository; + + private InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping(); + + public VfcManagerSol005() { + nfvoUrlMap = new HashMap<>(); + nfvoUrlMap.put(Step.CREATE, CommonConstant.SOL005_NFVO_CREATE_URL); + nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.SOL005_NFVO_INSTANTIATE_URL); + nfvoUrlMap.put(Step.TERMINATE, CommonConstant.SOL005_NFVO_TERMINATE_URL); + nfvoUrlMap.put(Step.DELETE, CommonConstant.SOL005_NFVO_DELETE_URL); + nfvoUrlMap.put(Step.QUERY, CommonConstant.SOL005_NFVO_QUERY_URL); + nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL); + } + + /** + * create network service
+ * + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Dubilin Release + */ + public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { + + Map nfvoDetails; + // Step1: get service template by node type + String nsdId = segInput.getNsServiceModelUUID(); + // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" + LOGGER.info("serviceTemplateId is {}, id is {}", nsdId, nsdId); + + + LOGGER.info("SOL005 create ns -> begin"); + // Step2: Prepare url and method type + String url = getUrl(null, CommonConstant.Step.CREATE); + String methodType = CommonConstant.MethodType.POST; + + // Step3: Prepare restful parameters and options + CreateNsRequest createNsRequest = new CreateNsRequest(); + createNsRequest.setNsDescription(segInput.getNsServiceDescription()); + createNsRequest.setNsdId(segInput.getNsServiceModelUUID()); + createNsRequest.setNsName(segInput.getNsServiceName()); + + String createReq = JsonUtil.marshal(createNsRequest); + RestfulResponse aaiRestfulResponse = null; + NsParameters nsParameters = segInput.getNsParameters(); + if (nsParameters.getAdditionalParamForNs().containsKey("orchestrator")) { + if (nsParameters.getAdditionalParamForNs().get("orchestrator") != null) { + String nfvo = nsParameters.getAdditionalParamForNs().get("nfvo").toString(); + aaiRestfulResponse = restfulUtil.getNfvoFromAAI(nfvo); + nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class); + url = nfvoDetails.get("url") + nfvoDetails.get("api-root") + url; + + } + } else { + LOGGER.error("Nfvo not present in AAI"); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); + } + + + // Prepare request header for createNs request. + Map requestHeader = new HashMap<>(); + requestHeader.put("GLOBALCUSTOMERID", segInput.getNsOperationKey().getGlobalSubscriberId()); + requestHeader.put("SERVICETYPE", segInput.getNsOperationKey().getServiceType()); + + // Step4: Call NFVO or SDNO lcm to create ns + LOGGER.info("Request Payload for CreateNs: " + createReq); + + RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq, requestHeader); + ValidateUtil.assertObjectNotNull(createRsp); + LOGGER.info("create ns response status is : {}", createRsp.getStatus()); + LOGGER.info("create ns response content is : {}", createRsp.getResponseContent()); + + // Step 5: save resource operation information + ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), + segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + status = resourceOperationStatusRepository.save(status); + if (!HttpCode.isSucess(createRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to create ns"); + status.setProgress("40"); + status.setStatusDescription("NS not created"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(createRsp.getStatus())); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); + } + // TODO: Capture all the content of the response. Currently fetching ID value alone. + // Should be converted into the NsInstance.class + @SuppressWarnings("unchecked") + Map rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); + String nsInstanceId = rsp.get(CommonConstant.SOL005_NS_INSTANCE_ID); + if (ValidateUtil.isStrEmpty(nsInstanceId)) { + LOGGER.error("Invalid instanceId from create operation"); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); + } + + nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class); + instanceNfvoMapping.setInstanceId(nsInstanceId); + instanceNfvoMapping.setPassword(nfvoDetails.get("password")); + instanceNfvoMapping.setUsername(nfvoDetails.get("userName")); + instanceNfvoMapping.setNfvoName(nfvoDetails.get("nfvoId")); + instanceNfvoMapping.setEndpoint(nfvoDetails.get("url")); + instanceNfvoMapping.setApiRoot(nfvoDetails.get("api-root")); + instanceNfvoMappingRepository.save(instanceNfvoMapping); + LOGGER.info("create ns -> end"); + LOGGER.info("save segment and operaton info -> begin"); + // Step 6: add relation between service and NS + AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(), + segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(), + nsInstanceId); + LOGGER.info("save segment and operation info -> end"); + return createRsp; + } + + /** + * delete network service
+ * + * @param nsOperationKey The operation key of the NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Dublin Release + */ + public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + LOGGER.info("SOL005 delete ns -> begin"); + // Step1: prepare url and methodType + String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); + String methodType = CommonConstant.MethodType.DELETE; + + // Step2: prepare restful parameters and options + RestfulResponse deleteRsp = restfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(deleteRsp); + LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus()); + LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent()); + LOGGER.info("delete ns -> end"); + + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + if (!HttpCode.isSucess(deleteRsp.getStatus())) { + LOGGER.error("fail to delete ns"); + + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(deleteRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS); + } + + // Step3: remove relation info between service and ns + AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(), + nsOperationKey.getServiceId(), nsInstanceId); + LOGGER.info("delete segment information -> end"); + + // Step4: update service segment operation status + status.setStatus(RequestsDbConstant.Status.FINISHED); + status.setErrorCode(String.valueOf(deleteRsp.getStatus())); + status.setProgress("100"); + status.setStatusDescription("VFC resource deletion finished"); + resourceOperationStatusRepository.save(status); + LOGGER.info("update segment operaton status for delete -> end"); + + return deleteRsp; + + } + + /** + * instantiate network service
+ * + * @param nsInstanceId The NS instance id + * @param segInput input parameters for current node from http request + * @return + * @since ONAP Dublin Release + */ + public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) + throws ApplicationException { + // Call the NFVO or SDNO service to instantiate service + LOGGER.info("SOL005 instantiate ns -> begin"); + + // Step1: Prepare restful parameters and options + InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest(); + + NsInstantiateReq oRequest = new NsInstantiateReq(); + oRequest.setNsInstanceId(nsInstanceId); + NsParameters nsParameters = segInput.getNsParameters(); + + ArrayList vnfLocationConstraints = new ArrayList(); + for (LocationConstraint locationConstraint : nsParameters.getLocationConstraints()) { + VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint(); + vnfLocationConstraint.setVnfProfileId(locationConstraint.getVnfProfileId()); + vnfLocationConstraint.setLocationConstraints(null); + vnfLocationConstraints.add(vnfLocationConstraint); + + } + instantiateNsRequest.setAditionalParamsForNs(nsParameters.getAdditionalParamForNs()); + // Setting FlavourID which is a mandatory paramater to default + // as UUI is not sending this parameter to so + instantiateNsRequest.setNsFlavourId("default"); + String instReq = JsonUtil.marshal(instantiateNsRequest); + LOGGER.info("Request Payload for InstantiateNs: " + instReq); + // Step2: prepare url and + String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); + String methodType = CommonConstant.MethodType.POST; + instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); + + if (instanceNfvoMapping != null) { + + url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; + + } else { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + + } + // Step3: prepare restful parameters and options + Map reqBody = new HashMap<>(); + reqBody.put("terminationTime", LocalDateTime.now().toString()); + RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq); + ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), + segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); + ValidateUtil.assertObjectNotNull(instRsp); + if (!HttpCode.isSucess(instRsp.getStatus())) { + LOGGER.error("update segment operation status : fail to instantiate ns"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(instRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } + LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); + LOGGER.info("response payload is {}", instRsp.getResponseContent()); + String jobId = null; + if (instRsp.getStatus() == 202) { + String jobUri = instRsp.getRespHeaderStr(CommonConstant.JOB_URI); + LOGGER.info("JOB URI" + jobUri); + jobId = jobUri.split("/")[4]; + if (ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from instantiate operation"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(instRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); + } + + } else if (instRsp.getStatus() > 400 && instRsp.getStatus() < 600) { + LOGGER.error("ERROR while executing instantiateNs request"); + ProblemDetails problemDetails = JsonUtil.unMarshal(instRsp.getResponseContent(), ProblemDetails.class); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(instRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + problemDetails.getDetail()); + resourceOperationStatusRepository.save(status); + if (instRsp.getStatus() == 406) { + throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } else if (instRsp.getStatus() == 400) { + throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } else if (instRsp.getStatus() == 404) { + throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } else if (instRsp.getStatus() == 409) { + LOGGER.error("The operation cannot be executed currently,\n" + + "due to a conflict with the state of the resource"); + throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } else if (instRsp.getStatus() == 500) { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } else { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.FAIL_TO_INSTANTIATE_NS); + } + + } + LOGGER.info("Job id is " + jobId); + LOGGER.info("Nfvo Details" + instanceNfvoMapping.toString()); + LOGGER.info("instantiate ns -> end"); + // Step 3: update segment operation job id + LOGGER.info("update resource operation status job id -> begin"); + status.setJobId(jobId); + status.setProgress("100"); + status.setStatusDescription("NS initiation completed."); + resourceOperationStatusRepository.save(status); + instanceNfvoMapping.setJobId(jobId); + instanceNfvoMappingRepository.save(instanceNfvoMapping); + LOGGER.info("update segment operation job id -> end" + instanceNfvoMapping.toString()); + return instRsp; + } + + /** + * terminate network service
+ * + * @param nsOperationKey The operation key for NS resource + * @param nsInstanceId The NS instance id + * @return + * @since ONAP Dublin Release + */ + public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { + // Step1: save segment operation info for delete process + LOGGER.info("save segment operation for delete process"); + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + resourceOperationStatusRepository.save(status); + + LOGGER.info("SOL005 terminate ns -> begin"); + // Step2: prepare url and method type + String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); + String methodType = CommonConstant.MethodType.POST; + + instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); + + if (instanceNfvoMapping != null) { + + url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; + + } else { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } + // Step3: prepare restful parameters and options + Map reqBody = new HashMap<>(); + reqBody.put("terminationTime", LocalDateTime.now().toString()); + + // Step4: Call the NFVO or SDNO service to terminate service + LOGGER.info("request body for terminate NS" + JsonUtil.marshal(reqBody)); + RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody)); + ValidateUtil.assertObjectNotNull(terminateRsp); + LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus()); + LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent()); + // Step 3: update segment operation + if (!HttpCode.isSucess(terminateRsp.getStatus())) { + LOGGER.error("fail to terminate ns"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(terminateRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } + // @SuppressWarnings("unchecked") + String jobId = null; + Map rsp = new HashMap<>(); + if (terminateRsp.getStatus() == 202) { + String jobUri = terminateRsp.getRespHeaderStr(CommonConstant.JOB_URI); + jobId = jobUri.split("/")[4]; + jobId.split("/"); + if (ValidateUtil.isStrEmpty(jobId)) { + LOGGER.error("Invalid jobId from instantiate operation"); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(terminateRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, + DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); + } + rsp.put(CommonConstant.JOB_ID, jobId); + LOGGER.info("terminate ns -> end"); + LOGGER.info("update segment job id -> begin"); + status.setProgress("60"); + status.setStatusDescription("NS is termination completed"); + status.setJobId(jobId); + resourceOperationStatusRepository.save(status); + LOGGER.info("update segment job id -> end"); + } else if (terminateRsp.getStatus() > 400 && terminateRsp.getStatus() < 600) { + LOGGER.error("ERROR while executing instantiateNs request"); + ProblemDetails problemDetails = JsonUtil.unMarshal(terminateRsp.getResponseContent(), ProblemDetails.class); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setErrorCode(String.valueOf(terminateRsp.getStatus())); + status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED + problemDetails.getDetail()); + resourceOperationStatusRepository.save(status); + if (terminateRsp.getStatus() == 406) { + throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } else if (terminateRsp.getStatus() == 400) { + throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } else if (terminateRsp.getStatus() == 404) { + throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } else if (terminateRsp.getStatus() == 409) { + LOGGER.error("The operation cannot be executed currently,\n" + + "due to a conflict with the state of the resource"); + throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } else if (terminateRsp.getStatus() == 500) { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } else { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); + } + + } + instanceNfvoMapping.setJobId(jobId); + instanceNfvoMappingRepository.save(instanceNfvoMapping); + terminateRsp.setResponseContent(rsp.toString()); + return terminateRsp; + } + + /** + * get ns progress by job Id
+ * + * @param nsOperationKey The OperationKey for NS resource + * @param jobId the job id + * @return + * @since ONAP Dublin Release + */ + public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { + + ValidateUtil.assertObjectNotNull(jobId); + // Step 1: query the current resource operation status + ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), + nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); + // status = resourceOperationStatusRepository.findOne(Example.of(status)) + // .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); + + // Get NFVO details + instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId); + + // Step 2: start query + LOGGER.info("SOL005 query ns status -> begin"); + String url = getUrl(jobId, CommonConstant.Step.QUERY); + String methodType = CommonConstant.MethodType.GET; + if (instanceNfvoMapping != null) { + + url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; + + } else { + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + + // prepare restful parameters and options + RestfulResponse rsp = restfulUtil.send(url, methodType, ""); + ValidateUtil.assertObjectNotNull(rsp); + LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); + LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); + // Step 3:check the response staus + if (!HttpCode.isSucess(rsp.getStatus())) { + LOGGER.info("fail to query job status"); + ProblemDetails problemDetails = JsonUtil.unMarshal(rsp.getResponseContent(), ProblemDetails.class); + status.setErrorCode(String.valueOf(rsp.getStatus())); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED + problemDetails.getDetail()); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 4: Process Network Service Instantiate Response + NsLcmOpOcc nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsLcmOpOcc.class); + if (CommonConstant.operationState.FAILED.equals(nsProgress.getOperationState())) { + LOGGER.info("NS instantiate fails"); + status.setErrorCode(String.valueOf(rsp.getStatus())); + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setStatusDescription( + CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + nsProgress.getError().getDetail()); + resourceOperationStatusRepository.save(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); + } + // Step 5: update segment operation progress + + if (nsProgress.getOperationState().equals(CommonConstant.operationState.PROCESSING)) { + status.setProgress("40"); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + status.setStatusDescription("NS operation is in progress"); + resourceOperationStatusRepository.save(status); + updateOperationStatusBasedOnResourceStatus(status); + } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.PARTIALLY_COMPLETED)) { + status.setProgress("60"); + status.setStatus(RequestsDbConstant.Status.PROCESSING); + status.setStatusDescription("NS operation is partially completed"); + resourceOperationStatusRepository.save(status); + } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.COMPLETED)) { + status.setStatus(RequestsDbConstant.Status.FINISHED); + status.setProgress("100"); + status.setStatusDescription("NS operation is Completed"); + resourceOperationStatusRepository.save(status); + updateOperationStatusBasedOnResourceStatus(status); + + } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED) + || nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED_TEMP)) { + status.setStatus(RequestsDbConstant.Status.ERROR); + status.setProgress("0"); + status.setStatusDescription("NS operation Failed"); + resourceOperationStatusRepository.save(status); + updateOperationStatusBasedOnResourceStatus(status); + throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); + } else { + LOGGER.error("unexcepted response status"); + + } + return rsp; + } + + /** + * get url for the operation
+ * + * @param variable variable should be put in the url + * @param step step of the operation (terminate,query,delete) + * @return + * @since ONAP Dublin Release + */ + private String getUrl(String variable, String step) { + + String url; + String originalUrl; + originalUrl = nfvoUrlMap.get(step); + url = String.format(originalUrl, variable); + return url; + + } + + private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) { + String serviceId = operStatus.getServiceId(); + String operationId = operStatus.getOperationId(); + + LOGGER.debug("Request database - update Operation Status Based On Resource Operation Status with service Id: " + + "{}, operationId: {}", serviceId, operationId); + + List lstResourceStatus = + resourceOperationStatusRepository.findByServiceIdAndOperationId(serviceId, operationId); + if (lstResourceStatus == null) { + LOGGER.error("Unable to retrieve resourceOperStatus Object by ServiceId: {} operationId: {}", serviceId, + operationId); + return; + } + + // count the total progress + int resourceCount = lstResourceStatus.size(); + int progress = 0; + boolean isFinished = true; + for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) { + progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount; + if (RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatu.getStatus())) { + isFinished = false; + } + } + + OperationStatus serviceOperStatus = + operationStatusRepository.findOneByServiceIdAndOperationId(serviceId, operationId); + if (serviceOperStatus == null) { + String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + + " operationId: " + operationId; + LOGGER.error(error); + + serviceOperStatus = new OperationStatus(); + serviceOperStatus.setOperationId(operationId); + serviceOperStatus.setServiceId(serviceId); + } + + progress = progress > 100 ? 100 : progress; + serviceOperStatus.setProgress(String.valueOf(progress)); + serviceOperStatus.setOperationContent(operStatus.getStatusDescription()); + // if current resource failed. service failed. + if (RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) { + serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR); + serviceOperStatus.setReason(operStatus.getStatusDescription()); + } else if (isFinished) { + // if finished + serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED); + serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED); + } + + operationStatusRepository.save(serviceOperStatus); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java new file mode 100644 index 0000000..04109bd --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.util; + +import java.io.IOException; +import org.onap.so.logger.LoggingAnchor; +import org.onap.so.adapters.vfc.constant.HttpCode; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.so.logger.MessageEnum; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Interface for json analyzing.
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class JsonUtil { + + /** + * Log service + */ + private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class); + + /** + * Mapper. + */ + private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final String UNMARSHAL_FAIL_MSG = "fail to unMarshal json"; + static { + MAPPER.setConfig(MAPPER.getDeserializationConfig().without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); + MAPPER.setSerializationInclusion(Include.NON_NULL); + } + + /** + * Constructor
+ *

+ *

+ * + * @since ONAP Amsterdam Release 2017-9-6 + */ + private JsonUtil() { + + } + + /** + * Parse the string in form of json.
+ * + * @param jsonstr json string. + * @param type that convert json string to + * @return model object + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static T unMarshal(String jsonstr, Class type) throws ApplicationException { + try { + return MAPPER.readValue(jsonstr, type); + } catch (IOException e) { + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e); + throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); + } + } + + /** + * Parse the string in form of json.
+ * + * @param jsonstr json string. + * @param type that convert json string to + * @return model object + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static T unMarshal(String jsonstr, TypeReference type) throws ApplicationException { + try { + return MAPPER.readValue(jsonstr, type); + } catch (IOException e) { + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e); + throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); + } + } + + /** + * Convert object to json string.
+ * + * @param srcObj data object + * @return json string + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static String marshal(Object srcObj) throws ApplicationException { + try { + return MAPPER.writeValueAsString(srcObj); + } catch (IOException e) { + logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcessError.getValue(), "fail to marshal json", e); + throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!"); + } + } + + /** + * Get mapper.
+ * + * @return mapper + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static ObjectMapper getMapper() { + return MAPPER; + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java new file mode 100644 index 0000000..54a2a98 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -0,0 +1,393 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018. + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.util; + +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.core.UriBuilder; +import org.onap.so.logger.LoggingAnchor; +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.so.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + *
+ *

+ *

+ * utility to invoke restclient + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +@Component +public class RestfulUtil { + + /** + * Log service + */ + private static final Logger logger = LoggerFactory.getLogger(RestfulUtil.class); + + private static final int DEFAULT_TIME_OUT = 60000; + + private static final String ONAP_IP = "ONAP_IP"; + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + + private static final Integer DEFAULT_MSB_PORT = 80; + + private static final String VFC_ADAPTER = "VFC Adapter"; + + @Autowired + private Environment env; + + @Autowired + private HttpClient client; + + public String getMsbHost() { + // MSB_IP will be set as ONAP_IP environment parameter in install flow. + String msbIp = System.getenv().get(ONAP_IP); + // if ONAP IP is not set. get it from config file. + if (null == msbIp || msbIp.isEmpty()) { + msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP); + } + Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT); + + String msbEndpoint = UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString(); + logger.debug("msbEndpoint in vfc adapter: {}", msbEndpoint); + + return msbEndpoint; + } + + private RestfulUtil() { + + } + + + public RestfulResponse send(String msbUrl, String methodType, String content, Map requestHeader) { + // String msbUrl = getMsbHost() + url; + logger.debug("Begin to sent message " + methodType + ": " + msbUrl); + + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = DEFAULT_TIME_OUT; + + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout).build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equalsIgnoreCase(methodType)) { + HttpPost httpPost = new HttpPost(msbUrl); + httpPost.setConfig(requestConfig); + for (String key : requestHeader.keySet()) { + httpPost.setHeader(key, requestHeader.get(key)); + } + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPost; + } else if ("PUT".equalsIgnoreCase(methodType)) { + HttpPut httpPut = new HttpPut(msbUrl); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPut; + } else if ("GET".equalsIgnoreCase(methodType)) { + HttpGet httpGet = new HttpGet(msbUrl); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equalsIgnoreCase(methodType)) { + HttpDelete httpDelete = new HttpDelete(msbUrl); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + // now VFC have no auth + // String userCredentials = + // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, + // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + // String authorization = "Basic " + + // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + // method.setHeader("Authorization", authorization); + + httpResponse = client.execute(method); + Map responseHeader = new HashMap<>(); + String responseContent = null; + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + Header[] httpResponseAllHeaders = httpResponse.getAllHeaders(); + for (Header header : httpResponseAllHeaders) { + responseHeader.put(header.getName(), header.getValue()); + + } + } + + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); + + logger.debug("VFC Response: {} {}", statusCode, + statusMessage + (responseContent == null ? "" : System.lineSeparator() + responseContent)); + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String errMsg = "VFC returned " + statusCode + " " + statusMessage; + logError(errMsg); + return createResponse(statusCode, errMsg); + } + + httpResponse = null; + + if (null != method) { + method.reset(); + } else { + logger.debug("method is NULL:"); + } + + method = null; + return createResponse(statusCode, responseContent, responseHeader); + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + String errMsg = "Request to VFC timed out"; + logError(errMsg, e); + return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); + + } catch (Exception e) { + String errMsg = "Error processing request to VFC"; + logError(errMsg, e); + return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + logger.debug("Exception :", e); + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + logger.debug("Exception :", e); + } + } + } + } + + public RestfulResponse send(String msbUrl, String methodType, String content) { + if (!msbUrl.contains("http")) { + msbUrl = getMsbHost() + msbUrl; + } + // String msbUrl = getMsbHost() + url; + logger.debug("Begin to sent message " + methodType + ": " + msbUrl); + + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = DEFAULT_TIME_OUT; + + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout).build(); + + if ("POST".equalsIgnoreCase(methodType)) { + HttpPost httpPost = new HttpPost(msbUrl); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPost; + } else if ("PUT".equalsIgnoreCase(methodType)) { + HttpPut httpPut = new HttpPut(msbUrl); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPut; + } else if ("GET".equalsIgnoreCase(methodType)) { + HttpGet httpGet = new HttpGet(msbUrl); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equalsIgnoreCase(methodType)) { + HttpDelete httpDelete = new HttpDelete(msbUrl); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + // now VFC have no auth + // String userCredentials = + // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, + // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + // String authorization = "Basic " + + // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + // method.setHeader("Authorization", authorization); + + httpResponse = client.execute(method); + Map responseHeader = new HashMap<>(); + String responseContent = null; + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + Header[] httpResponseAllHeaders = httpResponse.getAllHeaders(); + for (Header header : httpResponseAllHeaders) { + responseHeader.put(header.getName(), header.getValue()); + + } + } + + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); + + logger.debug("VFC Response: " + statusCode + " " + statusMessage + + (responseContent == null ? "" : System.lineSeparator() + responseContent)); + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String errMsg = "VFC returned " + statusCode + " " + statusMessage; + logError(errMsg); + return createResponse(statusCode, errMsg); + } + + httpResponse = null; + + if (null != method) { + method.reset(); + } else { + logger.debug("method is NULL:"); + } + + method = null; + return createResponse(statusCode, responseContent, responseHeader); + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + String errMsg = "Request to VFC timed out"; + logError(errMsg, e); + return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); + + } catch (Exception e) { + String errMsg = "Error processing request to VFC"; + logError(errMsg, e); + return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + logger.debug("Exception :", e); + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + logger.debug("Exception :", e); + } + } + } + } + + public RestfulResponse getNfvoFromAAI(String nfvo) { + HttpRequestBase method = null; + HttpResponse httpResponse = null; + String endPoint = getMsbHost() + "/api/aai-esr-server/v1/nfvos/" + nfvo; + logger.info("Endpoint URL" + endPoint); + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(DEFAULT_TIME_OUT) + .setConnectTimeout(DEFAULT_TIME_OUT).setConnectionRequestTimeout(DEFAULT_TIME_OUT).build(); + HttpClient client = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet(endPoint); + httpGet.setConfig(requestConfig); + String encoding = Base64.getEncoder().encodeToString(("AAI:AAI").getBytes()); + httpGet.setHeader("Authorization", "Basic " + encoding); + method = httpGet; + String responseContent = null; + Map responseHeader = null; + try { + httpResponse = client.execute(method); + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } + + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); + + logger.debug("AAI Response: " + statusCode + " " + statusMessage + + (responseContent == null ? "" : System.lineSeparator() + responseContent)); + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String errMsg = "AAI returned " + statusCode + " " + statusMessage; + logError(errMsg); + return createResponse(statusCode, errMsg); + } + } catch (Exception e) { + String errMsg = "Error processing request to AAI"; + logError(errMsg, e); + return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); + } + return createResponse(200, responseContent); + } + + private static void logError(String errMsg, Throwable t) { + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + ErrorCode.AvailabilityError.getValue(), errMsg, t); + } + + private static void logError(String errMsg) { + logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + ErrorCode.AvailabilityError.toString(), errMsg); + } + + private static RestfulResponse createResponse(int statusCode, String content) { + RestfulResponse rsp = new RestfulResponse(); + rsp.setStatus(statusCode); + rsp.setResponseContent(content); + return rsp; + } + + private static RestfulResponse createResponse(int statusCode, String content, Map responseHeader) { + RestfulResponse rsp = new RestfulResponse(); + rsp.setStatus(statusCode); + rsp.setRespHeaderMap(responseHeader); + rsp.setResponseContent(content); + return rsp; + } + +} diff --git a/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java new file mode 100644 index 0000000..f56f5af --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.util; + +import org.onap.so.adapters.vfc.constant.HttpCode; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ValidateUtil { + + /** + * Log server. + */ + private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class); + + /** + * Constructor
+ *

+ *

+ * + * @since ONAP Amsterdam Release 2017-9-6 + */ + private ValidateUtil() { + + } + + /** + * Assert String parameter.
+ * + * @param paramValue parameter data + * @param paramName parameter name + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static void assertStringNotNull(String paramValue, String paramName) throws ApplicationException { + if (null != paramValue && !paramValue.isEmpty()) { + return; + } + + LOGGER.error(paramName + ": Parameter is null or empty."); + throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter."); + } + + /** + * Assert object is null.
+ * + * @param object data object + * @since ONAP Amsterdam Release 2017-9-6 + */ + public static void assertObjectNotNull(Object object) throws ApplicationException { + if (null == object) { + LOGGER.error("Object is null."); + throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null."); + } + + } + + /** + *
+ * + * @param str + * @return + * @since ONAP Amsterdam Release + */ + public static boolean isStrEmpty(String str) { + return null == str || str.isEmpty(); + } +} diff --git a/so-etsi-sol005-adapter-application/src/main/resources/application-aaf.yaml b/so-etsi-sol005-adapter-application/src/main/resources/application-aaf.yaml new file mode 100644 index 0000000..e69de29 diff --git a/so-etsi-sol005-adapter-application/src/main/resources/application-basic.yaml b/so-etsi-sol005-adapter-application/src/main/resources/application-basic.yaml new file mode 100644 index 0000000..e69de29 diff --git a/so-etsi-sol005-adapter-application/src/main/resources/application.yaml b/so-etsi-sol005-adapter-application/src/main/resources/application.yaml new file mode 100644 index 0000000..4a500b3 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/main/resources/application.yaml @@ -0,0 +1,37 @@ + +server: + port: 8080 + tomcat: + max-threads: 50 + +mso: + site-name: unknown + logPath: ./logs/vfc/ + +spring: + datasource: + jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: org.mariadb.jdbc.Driver + jpa: + show-sql: false + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + +#Actuator +management: + endpoints: + web: + base-path: /manage + exposure: + include: "*" + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java new file mode 100644 index 0000000..c0305f1 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ Licensed under the Apache License, + * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.exceptions; + +import static org.junit.Assert.*; +import org.junit.Test; + +public class ApplicationExceptionTest { + private ApplicationException application = new ApplicationException(500, null); + + @Test + public void testApplicationException() { + application.setErrorCode(500); + application.setErrorMsg("ErrorMsg"); + assertEquals(application.getErrorCode(), 500); + assertEquals(application.getErrorMsg(), "ErrorMsg"); + } + + @Test + public void testbuildErrorResponse() { + assert (application.buildErrorResponse() != null); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java new file mode 100644 index 0000000..1fedac9 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class AddPnfDataTest { + AddPnfData pnfData = new AddPnfData(); + + @Test + public void getPnfId() { + pnfData.getPnfId(); + } + + + @Test + public void setPnfId() { + pnfData.setPnfId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getPnfName() { + pnfData.getPnfName(); + } + + @Test + public void setPnfName() { + pnfData.setPnfName("Router"); + } + + @Test + public void getPnfdId() { + pnfData.getPnfdId(); + } + + @Test + public void setPnfdId() { + pnfData.setPnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getPnfProfileId() { + pnfData.getPnfProfileId(); + } + + @Test + public void setPnfProfileId() { + pnfData.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getCpData() { + pnfData.getCpData(); + } + + @Test + public void setCpData() { + pnfData.setCpData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(PnfExtCpData pnfExtCpData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public PnfExtCpData get(int index) { + return null; + } + + @Override + public PnfExtCpData set(int index, PnfExtCpData element) { + return null; + } + + @Override + public void add(int index, PnfExtCpData element) { + + } + + @Override + public PnfExtCpData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java new file mode 100644 index 0000000..9444efd --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AddressRangeTest { + AddressRange addressRange = new AddressRange(); + + @Test + public void getMinAddress() { + addressRange.getMinAddress(); + } + + @Test + public void setMinAddress() { + addressRange.setMinAddress("192.168.10.10"); + } + + @Test + public void getMaxAddress() { + addressRange.getMaxAddress(); + } + + @Test + public void setMaxAddress() { + addressRange.setMaxAddress("192.168.10.10"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java new file mode 100644 index 0000000..06c52e2 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedNsTest { + + AffectedNs affectedNs = new AffectedNs(); + + @Test + public void getNsInstanceId() { + affectedNs.getNsInstanceId(); + } + + @Test + public void setNsInstanceId() { + affectedNs.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getNsdId() { + affectedNs.getNsdId(); + } + + @Test + public void setNsdId() { + affectedNs.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java new file mode 100644 index 0000000..beecbe0 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedPnfTest { + AffectedPnf affectedPnf = new AffectedPnf(); + + @Test + public void getPnfid() { + affectedPnf.getPnfid(); + } + + @Test + public void setPnfid() { + affectedPnf.setPnfid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getPnfdid() { + affectedPnf.getPnfdid(); + } + + @Test + public void setPnfdid() { + affectedPnf.setPnfdid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getPnfProfileId() { + affectedPnf.getPnfProfileId(); + } + + @Test + public void setPnfProfileId() { + affectedPnf.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getPnfName() { + affectedPnf.getPnfName(); + } + + @Test + public void setPnfName() { + affectedPnf.setPnfName("Router"); + } + + @Test + public void getCpInstanceId() { + affectedPnf.getCpInstanceId(); + } + + @Test + public void setCpInstanceId() { + affectedPnf.setCpInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java new file mode 100644 index 0000000..b96fe32 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedSapTest { + AffectedSap affectedSap = new AffectedSap(); + + @Test + public void getSapInstanceId() { + affectedSap.getSapInstanceId(); + } + + @Test + public void setSapInstanceId() { + affectedSap.setSapInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getSapdId() { + affectedSap.getSapdId(); + } + + @Test + public void setSapdId() { + affectedSap.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getSapName() { + affectedSap.getSapName(); + } + + @Test + public void setSapName() { + affectedSap.setSapName("Dummy SAP"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java new file mode 100644 index 0000000..dbc6d08 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedVirtualLinkTest { + AffectedVirtualLink affectedVirtualLink = new AffectedVirtualLink(); + + @Test + public void getNsVirtualLinkInstanceId() { + affectedVirtualLink.getNsVirtualLinkInstanceId(); + } + + @Test + public void setNsVirtualLinkInstanceId() { + affectedVirtualLink.setNsVirtualLinkInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getNsVirtualLinkDescId() { + affectedVirtualLink.getNsVirtualLinkDescId(); + } + + @Test + public void setNsVirtualLinkDescId() { + affectedVirtualLink.setNsVirtualLinkDescId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVlProfileId() { + affectedVirtualLink.getVlProfileId(); + } + + @Test + public void setVlProfileId() { + affectedVirtualLink.setVlProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java new file mode 100644 index 0000000..810f32d --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedVnfTest { + AffectedVnf affectedVnf = new AffectedVnf(); + + @Test + public void getVnfInstanceId() { + affectedVnf.getVnfInstanceId(); + } + + @Test + public void setVnfInstanceId() { + affectedVnf.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfdId() { + affectedVnf.getVnfdId(); + } + + @Test + public void setVnfdId() { + affectedVnf.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfProfileId() { + affectedVnf.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() { + affectedVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfName() { + affectedVnf.getVnfName(); + } + + @Test + public void setVnfName() { + affectedVnf.setVnfName("Dummy Vnf Name"); + } + + @Test + public void getChangedInfo() { + affectedVnf.getChangedInfo(); + } + + @Test + public void setChangedInfo() { + affectedVnf.setChangedInfo(new ChangedInfo()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java new file mode 100644 index 0000000..0d56701 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AffectedVnffgTest { + AffectedVnffg affectedVnffg = new AffectedVnffg(); + + @Test + public void getVnffgInstanceId() { + affectedVnffg.getVnffgInstanceId(); + } + + @Test + public void setVnffgInstanceId() { + affectedVnffg.setVnffgInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnffgdId() { + affectedVnffg.getVnffgdId(); + } + + @Test + public void setVnffgdId() { + affectedVnffg.setVnffgdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java new file mode 100644 index 0000000..99a40e4 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class AffinityOrAntiAffinityRuleTest { + AffinityOrAntiAffinityRule affinityOrAntiAffinityRule = new AffinityOrAntiAffinityRule(); + + @Test + public void getVnfdId() { + affinityOrAntiAffinityRule.getVnfdId(); + } + + @Test + public void setVnfdId() { + affinityOrAntiAffinityRule.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfProfileId() { + affinityOrAntiAffinityRule.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() { + affinityOrAntiAffinityRule.setVnfProfileId(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(String s) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public String get(int index) { + return null; + } + + @Override + public String set(int index, String element) { + return null; + } + + @Override + public void add(int index, String element) { + + } + + @Override + public String remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getVnfInstanceId() { + affinityOrAntiAffinityRule.getVnfInstanceId(); + } + + @Test + public void setVnfInstanceId() { + affinityOrAntiAffinityRule.setVnfInstanceId(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(String s) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public String get(int index) { + return null; + } + + @Override + public String set(int index, String element) { + return null; + } + + @Override + public void add(int index, String element) { + + } + + @Override + public String remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java new file mode 100644 index 0000000..41077fb --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class ChangedInfoTest { + ChangedInfo changedInfo = new ChangedInfo(); + + @Test + public void getChangedVnfInfo() { + changedInfo.getChangedVnfInfo(); + } + + @Test + public void setChangedVnfInfo() { + changedInfo.setChangedVnfInfo(new ModifyVnfInfoData()); + } + + @Test + public void getChangedExtConnectivity() { + changedInfo.getChangedExtConnectivity(); + } + + @Test + public void setChangedExtConnectivity() { + changedInfo.setChangedExtConnectivity(new ExtVirtualLinkInfo()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java new file mode 100644 index 0000000..e9c011b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class CivicAddressElementTest { + CivicAddressElement civicAddressElement = new CivicAddressElement(); + + @Test + public void getCaType() { + civicAddressElement.getCaType(); + } + + @Test + public void setCaType() { + civicAddressElement.setCaType(12); + } + + @Test + public void getCaValue() { + civicAddressElement.getCaValue(); + } + + @Test + public void setCaValue() { + civicAddressElement.setCaValue("Dummy Ca value"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java new file mode 100644 index 0000000..e47d02c --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class CpProtocolDataTest { + CpProtocolData cpProtocolData = new CpProtocolData(); + + @Test + public void getLayerProtocol() { + cpProtocolData.getLayerProtocol(); + } + + @Test + public void setLayerProtocol() { + cpProtocolData.setLayerProtocol("BGP"); + } + + @Test + public void getIpOverEthernet() { + cpProtocolData.getIpOverEthernet(); + } + + @Test + public void setIpOverEthernet() { + cpProtocolData.setIpOverEthernet(new IpOverEthernetAddressData()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java new file mode 100644 index 0000000..a2a6ae4 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class CreateNsRequestTest { + CreateNsRequest createNsRequest = new CreateNsRequest(); + + @Test + public void getNsdId() { + createNsRequest.getNsdId(); + } + + @Test + public void setNsdId() { + createNsRequest.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getNsDescription() { + createNsRequest.getNsDescription(); + } + + @Test + public void setNsDescription() { + createNsRequest.setNsDescription("Dummy description"); + } + + @Test + public void getNsName() { + createNsRequest.getNsName(); + } + + @Test + public void setNsName() { + createNsRequest.setNsName("Dummy Name"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java new file mode 100644 index 0000000..548d8b3 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class CustomerModelTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + CustomerModel customerModel = new CustomerModel(); + + @Test + public void getGlobalCustomerId() throws Exception { + customerModel.getGlobalCustomerId(); + } + + @Test + public void setGlobalCustomerId() throws Exception { + customerModel.setGlobalCustomerId("test"); + } + + @Test + public void getServiceType() throws Exception { + customerModel.getServiceType(); + } + + @Test + public void setServiceType() throws Exception { + customerModel.setServiceType("service"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java new file mode 100644 index 0000000..92cec88 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class ExtLinkPortInfoTest { + + ExtLinkPortInfo extLinkPortInfo = new ExtLinkPortInfo(); + + @Test + public void getId() { + extLinkPortInfo.getId(); + } + + @Test + public void setId() { + extLinkPortInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getResourceHandle() { + extLinkPortInfo.getResourceHandle(); + } + + @Test + public void setResourceHandle() { + extLinkPortInfo.setResourceHandle(new ResourceHandle()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java new file mode 100644 index 0000000..c455b36 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class ExtVirtualLinkInfoTest { + ExtVirtualLinkInfo extVirtualLinkInfo = new ExtVirtualLinkInfo(); + + @Test + public void getId() { + extVirtualLinkInfo.getId(); + } + + @Test + public void setId() { + extVirtualLinkInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getResourceHandle() { + extVirtualLinkInfo.getResourceHandle(); + } + + @Test + public void setResourceHandle() { + extVirtualLinkInfo.setResourceHandle(new ResourceHandle()); + } + + @Test + public void getExtLinkPorts() { + extVirtualLinkInfo.getExtLinkPorts(); + } + + @Test + public void setExtLinkPorts() { + extVirtualLinkInfo.setExtLinkPorts(new ExtLinkPortInfo()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java new file mode 100644 index 0000000..f27b041 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java @@ -0,0 +1,413 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class InstantiateNsRequestTest { + InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest(); + + @Test + public void getNsFlavourId() { + instantiateNsRequest.getNsFlavourId(); + } + + @Test + public void setNsFlavourId() { + instantiateNsRequest.setNsFlavourId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getSapData() { + instantiateNsRequest.getSapData(); + } + + @Test + public void setSapData() { + instantiateNsRequest.setSapData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(SapData sapData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public SapData get(int index) { + return null; + } + + @Override + public SapData set(int index, SapData element) { + return null; + } + + @Override + public void add(int index, SapData element) { + + } + + @Override + public SapData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAddpnfData() { + instantiateNsRequest.getAddpnfData(); + } + + @Test + public void setAddpnfData() { + instantiateNsRequest.setAddpnfData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AddPnfData addPnfData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AddPnfData get(int index) { + return null; + } + + @Override + public AddPnfData set(int index, AddPnfData element) { + return null; + } + + @Override + public void add(int index, AddPnfData element) { + + } + + @Override + public AddPnfData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getVnfInstanceData() { + instantiateNsRequest.getVnfInstanceData(); + } + + @Test + public void setVnfInstanceData() { + instantiateNsRequest.setVnfInstanceData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(VnfInstanceData vnfInstanceData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public VnfInstanceData get(int index) { + return null; + } + + @Override + public VnfInstanceData set(int index, VnfInstanceData element) { + return null; + } + + @Override + public void add(int index, VnfInstanceData element) { + + } + + @Override + public VnfInstanceData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getNestedNsInstanceId() { + instantiateNsRequest.getNestedNsInstanceId(); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java new file mode 100644 index 0000000..edf6346 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class IpAddressesTest { + IpAddresses ipAddresses = new IpAddresses(); + + @Test + public void getType() { + ipAddresses.getType(); + } + + @Test + public void setType() { + ipAddresses.setType("Dummy Type"); + } + + @Test + public void getFixedAddresses() { + ipAddresses.getFixedAddresses(); + } + + @Test + public void setFixedAddresses() { + ipAddresses.setFixedAddresses(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(String s) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public String get(int index) { + return null; + } + + @Override + public String set(int index, String element) { + return null; + } + + @Override + public void add(int index, String element) { + + } + + @Override + public String remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getNumDynamicAddresses() { + ipAddresses.getNumDynamicAddresses(); + } + + @Test + public void setNumDynamicAddresses() { + ipAddresses.setNumDynamicAddresses(5); + } + + @Test + public void getAddressRange() { + ipAddresses.getAddressRange(); + } + + @Test + public void setAddressRange() { + ipAddresses.setAddressRange(new AddressRange()); + } + + @Test + public void getSubnetId() { + ipAddresses.getSubnetId(); + } + + @Test + public void setSubnetId() { + ipAddresses.setSubnetId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java new file mode 100644 index 0000000..0088cdc --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class IpOverEthernetAddressDataTest { + IpOverEthernetAddressData ipOverEthernetAddressData = new IpOverEthernetAddressData(); + + @Test + public void getMacAddress() { + ipOverEthernetAddressData.getMacAddress(); + } + + @Test + public void setMacAddress() { + ipOverEthernetAddressData.setMacAddress("4e:86:9f:62:c1:bf"); + } + + @Test + public void getIpAddresses() { + ipOverEthernetAddressData.getIpAddresses(); + } + + @Test + public void setIpAddresses() { + ipOverEthernetAddressData.setIpAddresses(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(IpAddresses ipAddresses) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public IpAddresses get(int index) { + return null; + } + + @Override + public IpAddresses set(int index, IpAddresses element) { + return null; + } + + @Override + public void add(int index, IpAddresses element) { + + } + + @Override + public IpAddresses remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java new file mode 100644 index 0000000..e447c85 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LinkTest { + Link link = new Link(); + + @Test + public void getHref() { + link.getHref(); + } + + @Test + public void setHref() { + link.setHref("dummy href"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java new file mode 100644 index 0000000..aef87c4 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LinksTest { + Links links = new Links(); + + @Test + public void getSelf() { + links.getSelf(); + } + + @Test + public void setSelf() { + links.setSelf(new Link()); + } + + @Test + public void getNsInstance() { + links.getNsInstance(); + } + + @Test + public void setNsInstance() { + links.setNsInstance(new Link()); + } + + @Test + public void getCancel() { + links.getCancel(); + } + + @Test + public void setCancel() { + links.setCancel(new Link()); + } + + @Test + public void getRetry() { + links.getRetry(); + } + + @Test + public void setRetry() { + links.setRetry(new Link()); + } + + @Test + public void getRollback() { + links.getRollback(); + } + + @Test + public void setRollback() { + links.setRollback(new Link()); + } + + @Test + public void getContinues() { + links.getContinues(); + } + + @Test + public void setContinues() { + links.setContinues(new Link()); + } + + @Test + public void getFail() { + links.getFail(); + } + + @Test + public void setFail() { + links.setFail(new Link()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java new file mode 100644 index 0000000..2b21746 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class LocationConstraintTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + LocationConstraint locationConstraint = new LocationConstraint(); + + @Test + public void getVnfProfileId() throws Exception { + locationConstraint.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() throws Exception { + locationConstraint.setVnfProfileId("profileID"); + } + + @Test + public void getLocationConstraints() throws Exception { + locationConstraint.getLocationConstraints(); + } + + @Test + public void setLocationConstraints() throws Exception { + locationConstraint.setLocationConstraints(new VimLocation()); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java new file mode 100644 index 0000000..e68b12a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class LocationConstraintsTest { + LocationConstraints locationConstraints = new LocationConstraints(); + + @Test + public void getCountryCode() { + locationConstraints.getCountryCode(); + } + + @Test + public void setCountryCode() { + locationConstraints.setCountryCode("IND"); + + } + + @Test + public void getCivicAddressElement() { + locationConstraints.getCivicAddressElement(); + } + + @Test + public void setCivicAddressElement() { + locationConstraints.setCivicAddressElement(new CivicAddressElement()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java new file mode 100644 index 0000000..c300923 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.HashMap; +import static org.junit.Assert.*; + +public class ModifyVnfInfoDataTest { + ModifyVnfInfoData modifyVnfInfoData = new ModifyVnfInfoData(); + + @Test + public void getVnfInstanceId() { + modifyVnfInfoData.getVnfInstanceId(); + } + + @Test + public void setVnfInstanceId() { + modifyVnfInfoData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfInstanceName() { + modifyVnfInfoData.getVnfInstanceName(); + } + + @Test + public void setVnfInstanceName() { + modifyVnfInfoData.setVnfInstanceName("Dummy vnfInstanceName"); + } + + @Test + public void getVnfInstanceDescription() { + modifyVnfInfoData.getVnfInstanceDescription(); + } + + @Test + public void setVnfInstanceDescription() { + modifyVnfInfoData.setVnfInstanceDescription("Dummy vnfInstanceDescription"); + } + + @Test + public void getVnfPkgId() { + modifyVnfInfoData.getVnfPkgId(); + } + + @Test + public void setVnfPkgId() { + modifyVnfInfoData.setVnfPkgId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfConfigurableProperties() { + modifyVnfInfoData.getVnfConfigurableProperties(); + } + + @Test + public void setVnfConfigurableProperties() { + modifyVnfInfoData.setVnfConfigurableProperties(new HashMap<>()); + } + + @Test + public void getMetadata() { + modifyVnfInfoData.getMetadata(); + } + + @Test + public void setMetadata() { + modifyVnfInfoData.setMetadata(new HashMap<>()); + } + + @Test + public void getExtensions() { + modifyVnfInfoData.getExtensions(); + } + + @Test + public void setExtensions() { + modifyVnfInfoData.setExtensions(new HashMap<>()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java new file mode 100644 index 0000000..082d4e6 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class NSResourceInputParameterTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); + + @Test + public void getNsServiceName() throws Exception { + nsResourceInputParameter.getNsServiceName(); + } + + @Test + public void setNsServiceName() throws Exception { + nsResourceInputParameter.setNsServiceName("service"); + } + + @Test + public void getNsServiceDescription() throws Exception { + nsResourceInputParameter.getNsServiceDescription(); + } + + @Test + public void setNsServiceDescription() throws Exception { + nsResourceInputParameter.setNsServiceDescription("desc"); + } + + @Test + public void getNsParameters() throws Exception { + nsResourceInputParameter.getNsParameters(); + } + + @Test + public void setNsParameters() throws Exception { + nsResourceInputParameter.setNsParameters(new NsParameters()); + } + + @Test + public void getNsOperationKey() throws Exception { + nsResourceInputParameter.getNsOperationKey(); + } + + @Test + public void setNsOperationKey() throws Exception { + nsResourceInputParameter.setNsOperationKey(new NsOperationKey()); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java new file mode 100644 index 0000000..c2e6b58 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class NsCreateReqTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsCreateReq nsCreateReq = new NsCreateReq(); + + @Test + public void getContext() throws Exception { + nsCreateReq.getContext(); + } + + @Test + public void setContext() throws Exception { + nsCreateReq.setContext(new CustomerModel()); + } + + @Test + public void getCsarId() throws Exception { + nsCreateReq.getCsarId(); + } + + @Test + public void setCsarId() throws Exception { + nsCreateReq.setCsarId("csarid"); + } + + @Test + public void getNsName() throws Exception { + nsCreateReq.getNsName(); + } + + @Test + public void setNsName() throws Exception { + nsCreateReq.setNsName("nsname"); + } + + @Test + public void getDescription() throws Exception { + nsCreateReq.getDescription(); + } + + @Test + public void setDescription() throws Exception { + nsCreateReq.setDescription("desc"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java new file mode 100644 index 0000000..70e54a1 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class NsInstantiateReqTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsInstantiateReq nsInstantiateReq = new NsInstantiateReq(); + + @Test + public void getNsInstanceId() throws Exception { + nsInstantiateReq.getNsInstanceId(); + } + + @Test + public void setNsInstanceId() throws Exception { + nsInstantiateReq.setNsInstanceId("test"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java new file mode 100644 index 0000000..f5d485a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import org.onap.so.adapters.vfc.constant.CommonConstant; +import java.time.LocalDateTime; +import java.util.Date; +import static org.junit.Assert.*; + +public class NsLcmOpOccTest { + NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc(); + + @Test + public void getLcmOperationType() { + nsLcmOpOcc.getLcmOperationType(); + } + + @Test + public void setLcmOperationType() { + nsLcmOpOcc.setLcmOperationType(CommonConstant.lcmOperationType.INSTANTIATE); + } + + @Test + public void getCancelMode() { + nsLcmOpOcc.getCancelMode(); + } + + @Test + public void setCancelMode() { + nsLcmOpOcc.setCancelMode(CommonConstant.cancelMode.GRACEFUL); + } + + @Test + public void getOperationState() { + nsLcmOpOcc.getOperationState(); + } + + @Test + public void setOperationState() { + nsLcmOpOcc.setOperationState(CommonConstant.operationState.COMPLETED); + } + + @Test + public void getId() { + nsLcmOpOcc.getId(); + } + + @Test + public void setId() { + nsLcmOpOcc.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getStatusEnteredTime() { + nsLcmOpOcc.getStatusEnteredTime(); + } + + @Test + public void setStatusEnteredTime() { + nsLcmOpOcc.setStatusEnteredTime(LocalDateTime.now().toString()); + } + + @Test + public void getNsInstanceId() { + nsLcmOpOcc.getNsInstanceId(); + } + + @Test + public void setNsInstanceId() { + nsLcmOpOcc.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getStartTime() { + nsLcmOpOcc.getStartTime(); + } + + @Test + public void setStartTime() { + nsLcmOpOcc.setStartTime(LocalDateTime.now().toString()); + } + + @Test + public void getAutomaticInvocation() { + nsLcmOpOcc.getAutomaticInvocation(); + } + + @Test + public void setAutomaticInvocation() { + nsLcmOpOcc.setAutomaticInvocation(true); + } + + @Test + public void getOperationParams() { + nsLcmOpOcc.getOperationParams(); + } + + @Test + public void setOperationParams() { + nsLcmOpOcc.setOperationParams("Dummy operationParams"); + } + + @Test + public void getCancelPending() { + nsLcmOpOcc.getCancelPending(); + } + + @Test + public void setCancelPending() { + nsLcmOpOcc.setCancelPending(true); + } + + @Test + public void getError() { + nsLcmOpOcc.getError(); + } + + @Test + public void setError() { + nsLcmOpOcc.setError(new ProblemDetails()); + } + + @Test + public void getLinks() { + nsLcmOpOcc.getLinks(); + } + + @Test + public void setLinks() { + nsLcmOpOcc.setLinks(new Links()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java new file mode 100644 index 0000000..a8939f8 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class NsOperationKeyTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsOperationKey nsOperationKey = new NsOperationKey(); + + @Test + public void getGlobalSubscriberId() throws Exception { + nsOperationKey.getGlobalSubscriberId(); + } + + @Test + public void setGlobalSubscriberId() throws Exception { + nsOperationKey.setGlobalSubscriberId("subscriberid"); + } + + @Test + public void getServiceType() throws Exception { + nsOperationKey.getServiceType(); + } + + @Test + public void setServiceType() throws Exception { + nsOperationKey.setServiceType("servicetype"); + } + + @Test + public void getServiceId() throws Exception { + nsOperationKey.getServiceId(); + } + + @Test + public void setServiceId() throws Exception { + nsOperationKey.setServiceId("serviceid"); + } + + @Test + public void getOperationId() throws Exception { + nsOperationKey.getOperationId(); + } + + @Test + public void setOperationId() throws Exception { + nsOperationKey.setOperationId("test"); + } + + @Test + public void getNodeTemplateUUID() throws Exception { + nsOperationKey.getNodeTemplateUUID(); + } + + @Test + public void setNodeTemplateUUID() throws Exception { + nsOperationKey.setNodeTemplateUUID("nodeTemplateid"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java new file mode 100644 index 0000000..45c46ed --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collections; +import java.util.HashMap; + +public class NsParametersTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsParameters nsParameters = new NsParameters(); + + @Test + public void getLocationConstraints() throws Exception { + nsParameters.getLocationConstraints(); + } + + @Test + public void setLocationConstraints() throws Exception { + nsParameters.setLocationConstraints(Collections.emptyList()); + } + + @Test + public void getAdditionalParamForNs() throws Exception { + nsParameters.getAdditionalParamForNs(); + } + + @Test + public void setAdditionalParamForNs() throws Exception { + nsParameters.setAdditionalParamForNs(new HashMap<>()); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java new file mode 100644 index 0000000..b1040ef --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Arrays; + +public class NsProgressStatusTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsProgressStatus nsProgressStatus = new NsProgressStatus(); + + @Test + public void getJobId() throws Exception { + nsProgressStatus.getJobId(); + } + + @Test + public void setJobId() throws Exception { + nsProgressStatus.setJobId("jobid"); + } + + @Test + public void getResponseDescriptor() throws Exception { + nsProgressStatus.getResponseDescriptor(); + } + + @Test + public void setResponseDescriptor() throws Exception { + nsProgressStatus.setResponseDescriptor(new ResponseDescriptor()); + } + + @Test + public void getResponseHistoryList() throws Exception { + nsProgressStatus.getResponseHistoryList(); + } + + @Test + public void setResponseHistoryList() throws Exception { + nsProgressStatus.setResponseHistoryList(Arrays.asList(new ResponseDescriptor())); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java new file mode 100644 index 0000000..e0455b0 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.HashMap; +import static org.junit.Assert.*; + +public class ParamsForVnfTest { + + ParamsForVnf paramsForVnf = new ParamsForVnf(); + + @Test + public void getVnfProfileId() { + paramsForVnf.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() { + paramsForVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getAdditionalParams() { + paramsForVnf.getAdditionalParams(); + } + + @Test + public void setAdditionalParams() { + paramsForVnf.setAdditionalParams(new HashMap<>()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java new file mode 100644 index 0000000..c586c7e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class PnfExtCpDataTest { + PnfExtCpData pnfExtCpData = new PnfExtCpData(); + + @Test + public void getCpInstanceI16() { + pnfExtCpData.getCpInstanceI16(); + } + + @Test + public void setCpInstanceI16() { + pnfExtCpData.setCpInstanceI16("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getCpdId() { + pnfExtCpData.getCpdId(); + } + + @Test + public void setCpdId() { + pnfExtCpData.setCpdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getCpProtocolData() { + pnfExtCpData.getCpProtocolData(); + } + + @Test + public void setCpProtocolData() { + pnfExtCpData.setCpProtocolData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(CpProtocolData cpProtocolData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public CpProtocolData get(int index) { + return null; + } + + @Override + public CpProtocolData set(int index, CpProtocolData element) { + return null; + } + + @Override + public void add(int index, CpProtocolData element) { + + } + + @Override + public CpProtocolData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java new file mode 100644 index 0000000..ddea6cc --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class ProblemDetailsTest { + ProblemDetails problemDetails = new ProblemDetails(); + + @Test + public void getType() { + problemDetails.getType(); + } + + @Test + public void setType() { + problemDetails.setType("Dummy Type"); + } + + @Test + public void getTitle() { + problemDetails.getTitle(); + } + + @Test + public void setTitle() { + problemDetails.setTitle("Dummy Title"); + } + + @Test + public void getStatus() { + problemDetails.getStatus(); + } + + @Test + public void setStatus() { + problemDetails.setStatus(200); + } + + @Test + public void getDetail() { + problemDetails.getDetail(); + } + + @Test + public void setDetail() { + problemDetails.setTitle("Dummy Title"); + } + + @Test + public void getInstance() { + problemDetails.getInstance(); + } + + @Test + public void setInstance() { + problemDetails.setInstance("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java new file mode 100644 index 0000000..9c4a029 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java @@ -0,0 +1,773 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class ResourceChangesTest { + ResourceChanges resourceChanges = new ResourceChanges(); + + @Test + public void getAffectedVnfs() { + resourceChanges.getAffectedVnfs(); + } + + @Test + public void setAffectedVnfs() { + resourceChanges.setAffectedVnfs(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedVnf affectedVnf) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedVnf get(int index) { + return null; + } + + @Override + public AffectedVnf set(int index, AffectedVnf element) { + return null; + } + + @Override + public void add(int index, AffectedVnf element) { + + } + + @Override + public AffectedVnf remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAffectedPnfs() { + resourceChanges.getAffectedPnfs(); + } + + @Test + public void setAffectedPnfs() { + resourceChanges.setAffectedPnfs(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedPnf affectedPnf) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedPnf get(int index) { + return null; + } + + @Override + public AffectedPnf set(int index, AffectedPnf element) { + return null; + } + + @Override + public void add(int index, AffectedPnf element) { + + } + + @Override + public AffectedPnf remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAffectedVls() { + resourceChanges.getAffectedVls(); + } + + @Test + public void setAffectedVls() { + resourceChanges.setAffectedVls(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedVirtualLink affectedVirtualLink) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedVirtualLink get(int index) { + return null; + } + + @Override + public AffectedVirtualLink set(int index, AffectedVirtualLink element) { + return null; + } + + @Override + public void add(int index, AffectedVirtualLink element) { + + } + + @Override + public AffectedVirtualLink remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAffectedVnffgs() { + resourceChanges.getAffectedVnffgs(); + } + + @Test + public void setAffectedVnffgs() { + resourceChanges.setAffectedVnffgs(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedVnffg affectedVnffg) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedVnffg get(int index) { + return null; + } + + @Override + public AffectedVnffg set(int index, AffectedVnffg element) { + return null; + } + + @Override + public void add(int index, AffectedVnffg element) { + + } + + @Override + public AffectedVnffg remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAffectedNss() { + resourceChanges.getAffectedNss(); + } + + @Test + public void setAffectedNss() { + resourceChanges.setAffectedNss(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedNs affectedNs) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedNs get(int index) { + return null; + } + + @Override + public AffectedNs set(int index, AffectedNs element) { + return null; + } + + @Override + public void add(int index, AffectedNs element) { + + } + + @Override + public AffectedNs remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } + + @Test + public void getAffectedSaps() { + resourceChanges.getAffectedSaps(); + } + + @Test + public void setAffectedSaps() { + resourceChanges.setAffectedSaps(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(AffectedSap affectedSap) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public AffectedSap get(int index) { + return null; + } + + @Override + public AffectedSap set(int index, AffectedSap element) { + return null; + } + + @Override + public void add(int index, AffectedSap element) { + + } + + @Override + public AffectedSap remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java new file mode 100644 index 0000000..6390c5a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class ResourceHandleTest { + ResourceHandle resourceHandle = new ResourceHandle(); + + @Test + public void getVimId() { + resourceHandle.getVimId(); + } + + @Test + public void setVimId() { + resourceHandle.setVimId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getResourceProviderId() { + resourceHandle.getResourceProviderId(); + } + + @Test + public void setResourceProviderId() { + resourceHandle.setResourceProviderId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getResourceId() { + resourceHandle.getResourceId(); + } + + @Test + public void setResourceId() { + resourceHandle.setResourceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVimLevelResourceType() { + resourceHandle.getVimLevelResourceType(); + } + + @Test + public void setVimLevelResourceType() { + resourceHandle.setVimLevelResourceType("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java new file mode 100644 index 0000000..3f2f735 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class ResponseDescriptorTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + ResponseDescriptor responseDescriptor = new ResponseDescriptor(); + + @Test + public void getStatus() throws Exception { + responseDescriptor.getStatus(); + } + + @Test + public void setStatus() throws Exception { + responseDescriptor.setStatus("test"); + } + + @Test + public void getProgress() throws Exception { + responseDescriptor.getProgress(); + } + + @Test + public void setProgress() throws Exception { + responseDescriptor.setProgress("10"); + } + + @Test + public void getStatusDescription() throws Exception { + responseDescriptor.getStatusDescription(); + } + + @Test + public void setStatusDescription() throws Exception { + responseDescriptor.setStatusDescription("test"); + } + + @Test + public void getErrorCode() throws Exception { + responseDescriptor.getErrorCode(); + } + + @Test + public void setErrorCode() throws Exception { + responseDescriptor.setErrorCode(-1); + } + + @Test + public void getResponseId() throws Exception { + responseDescriptor.getResponseId(); + } + + @Test + public void setResponseId() throws Exception { + responseDescriptor.setResponseId(1); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java new file mode 100644 index 0000000..64f8da6 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.HashMap; + +public class RestfulResponseTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + RestfulResponse restfulResponse = new RestfulResponse(); + + @Test + public void getStatus() throws Exception { + restfulResponse.getStatus(); + } + + @Test + public void setStatus() throws Exception { + restfulResponse.setStatus(1); + } + + @Test + public void getRespHeaderMap() throws Exception { + restfulResponse.getRespHeaderMap(); + } + + @Test + public void setRespHeaderMap() throws Exception { + restfulResponse.setRespHeaderMap(new HashMap<>()); + } + + @Test + public void getRespHeaderInt() throws Exception { + restfulResponse.getRespHeaderInt("1"); + } + + @Test + public void getRespHeaderLong() throws Exception { + restfulResponse.getRespHeaderLong("1"); + } + + @Test + public void getRespHeaderStr() throws Exception { + restfulResponse.getRespHeaderStr("test"); + } + + @Test + public void getResponseContent() throws Exception { + restfulResponse.getResponseContent(); + } + + @Test + public void setResponseContent() throws Exception { + restfulResponse.setResponseContent("responseString"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java new file mode 100644 index 0000000..2a45599 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import static org.junit.Assert.*; + +public class SapDataTest { + + SapData sapData = new SapData(); + + @Test + public void getSapdId() { + sapData.getSapdId(); + } + + @Test + public void setSapdId() { + sapData.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getSapName() { + sapData.getSapName(); + } + + @Test + public void setSapName() { + sapData.setSapName("Dummy SapName"); + } + + @Test + public void getDescription() { + sapData.getDescription(); + } + + @Test + public void setDescription() { + sapData.setDescription("Dummy Description"); + } + + @Test + public void getSapProtocolData() { + sapData.getSapProtocolData(); + } + + @Test + public void setSapProtocolData() { + sapData.setSapProtocolData(new List() { + @Override + public int size() { + return 0; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public Object[] toArray() { + return new Object[0]; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public boolean add(CpProtocolData cpProtocolData) { + return false; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public boolean addAll(int index, Collection c) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public void clear() { + + } + + @Override + public CpProtocolData get(int index) { + return null; + } + + @Override + public CpProtocolData set(int index, CpProtocolData element) { + return null; + } + + @Override + public void add(int index, CpProtocolData element) { + + } + + @Override + public CpProtocolData remove(int index) { + return null; + } + + @Override + public int indexOf(Object o) { + return 0; + } + + @Override + public int lastIndexOf(Object o) { + return 0; + } + + @Override + public ListIterator listIterator() { + return null; + } + + @Override + public ListIterator listIterator(int index) { + return null; + } + + @Override + public List subList(int fromIndex, int toIndex) { + return null; + } + }); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java new file mode 100644 index 0000000..85d3a13 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java @@ -0,0 +1,39 @@ + +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */package org.onap.so.adapters.vfc.model; + +import org.junit.Test; + +public class VimLocationTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + VimLocation vimLocation = new VimLocation(); + + @Test + public void getVimId() throws Exception { + vimLocation.getVimId(); + } + + @Test + public void setVimId() throws Exception { + vimLocation.setVimId("vimid"); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java new file mode 100644 index 0000000..b9bdfe3 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class VnfInstanceDataTest { + VnfInstanceData vnfInstanceData = new VnfInstanceData(); + + @Test + public void getVnfInstanceId() { + vnfInstanceData.getVnfInstanceId(); + } + + @Test + public void setVnfInstanceId() { + vnfInstanceData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getVnfProfileId() { + vnfInstanceData.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() { + vnfInstanceData.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java new file mode 100644 index 0000000..b8f9b8e --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.model; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class VnfLocationConstraintTest { + VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint(); + + @Test + public void getVnfProfileId() { + vnfLocationConstraint.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() { + vnfLocationConstraint.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); + } + + @Test + public void getLocationConstraints() { + vnfLocationConstraint.getLocationConstraints(); + } + + @Test + public void setLocationConstraints() { + vnfLocationConstraint.setLocationConstraints(new LocationConstraint()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000..feb40f7 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.Profile; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +@EnableTransactionManagement +@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", + transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + return new MariaDB4jSpringService(); + } + + @Primary + @Bean(name = "requestDataSource") + @ConfigurationProperties(prefix = "spring.datasource") + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + // Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) + .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); + } + + @Primary + @Bean(name = "requestEntityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, + @Qualifier("requestDataSource") DataSource dataSource) { + return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") + .build(); + } + + @Primary + @Bean(name = "requestTransactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java new file mode 100644 index 0000000..fe2bd0b --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import static org.junit.Assert.*; +import javax.ws.rs.core.Response; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.vfc.MSOVfcApplication; +import org.springframework.boot.configurationprocessor.json.JSONException; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MSOVfcApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class HealthCheckHandlerTest { + + @LocalServerPort + private int port; + + TestRestTemplate restTemplate = new TestRestTemplate(); + + HttpHeaders headers = new HttpHeaders(); + + + @Test + public void testHealthcheck() throws JSONException { + + HttpEntity entity = new HttpEntity(null, headers); + + ResponseEntity response = + restTemplate.exchange(createURLWithPort("manage/health"), HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } + + private String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java new file mode 100644 index 0000000..15dc744 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java @@ -0,0 +1,256 @@ +/* + * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onap.so.adapters.vfc.rest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.so.adapters.vfc.exceptions.ApplicationException; +import org.onap.so.adapters.vfc.model.NSResourceInputParameter; +import org.onap.so.adapters.vfc.model.NsOperationKey; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.onap.so.adapters.vfc.util.JsonUtil; +import org.onap.so.adapters.vfc.util.RestfulUtil; +import org.onap.so.db.request.beans.InstanceNfvoMapping; +import org.onap.so.db.request.beans.OperationStatus; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; +import org.onap.so.db.request.data.repository.OperationStatusRepository; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.springframework.test.context.junit4.SpringRunner; +import java.io.File; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.when; + +@RunWith(SpringRunner.class) +public class VfcManagerSol005Test { + @InjectMocks + VfcManagerSol005 vfcManagerSol005; + + @Mock + InstanceNfvoMappingRepository instanceNfvoMappingRepository; + + @Mock + ResourceOperationStatusRepository resourceOperationStatusRepository; + + @Mock + OperationStatusRepository operationStatusRepository; + + @Mock + RestfulUtil restfulUtil; + + OperationStatus operationStatus = new OperationStatus(); + + InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping(); + RestfulResponse restfulResponse = new RestfulResponse(); + RestfulResponse vfcrestfulResponse = new RestfulResponse(); + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + NsOperationKey nsOperationKey = new NsOperationKey(); + + @Test + public void createNs() throws ApplicationException, Exception { + restfulResponse.setStatus(200); + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + + File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); + String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); + file = new File(classLoader.getResource("json/aainfvoResponse.json").getFile()); + content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + restfulResponse.setResponseContent(content); + // restfulResponse.setResponseContent("{\"nfvoId\":\"6ee79fe2-9579-475a-9bb9-20cf4358a19e\",\"name\":\"external_nfvo\",\"api-root\":\"xyz\",\"vendor\":\"vz\",\"version\":\"v1.0\",\"url\":\"http://sample.com/\",\"userName\":\"admin\",\"password\":\"sacjnasnc\"}"); + file = new File(classLoader.getResource("json/createNsSol005Response.json").getFile()); + content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + vfcrestfulResponse.setStatus(202); + vfcrestfulResponse.setResponseContent(content); + // vfcrestfulResponse.setResponseContent("{\"_links\": {\"heal\": {\"href\": \"\"}, \"instantiate\": {\"href\": + // \"\"}, \"nestedNsInstances\": {\"href\": \"\"}, \"scale\": {\"href\": \"\"}, \"self\": {\"href\": \"\"}, + // \"terminate\": {\"href\": \"\"}, \"update\": {\"href\": \"\"}}, \"additionalAffinityOrAntiAffiniityRule\": + // [{\"Scope\": \"\", \"affinityOrAntiAffiinty\": \"\", \"vnfInstanceId\": [], \"vnfProfileId\": [], \"vnfdId\": + // []}], \"flavourId\": \"\", \"id\": \"c9f0a95e-dea0-4698-96e5-5a79bc5a233d\", \"nestedNsInstanceId\": [], + // \"nsInstanceDescription\": \"\", \"nsInstanceName\": \"\", \"nsScaleStatus\": [{\"nsScaleLevelId\": \"\", + // \"nsScalingAspectId\": \"\"}], \"nsState\": \"\", \"nsdId\": \"\", \"nsdInfoId\": \"\", \"pnfInfo\": + // [{\"cpInfo\": [{\"cpInstanceId\": \"\", \"cpProtocolData\": {\"ipOverEthernet\": {\"ipAddresses\": + // {\"addressRange\": {\"maxAddress\": \"\", \"minAddress\": \"\"}, \"fixedAddresses\": \"\", + // \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": \"\"}, \"macAddress\": {}}, \"layerProtocol\": + // \"IP_OVER_ETHERNET\"}, \"cpdId\": \"\"}], \"pnfId\": \"\", \"pnfName\": \"\", \"pnfProfileId\": \"\", + // \"pnfdId\": \"\", \"pnfdInfoId\": \"\"}], \"sapInfo\": [{\"description\": \"\", \"id\": \"\", \"sapName\": + // \"\", \"sapProtocolInfo\": {\"ipOverEthernet\": {\"ipAddresses\": {\"addressRange\": {\"maxAddress\": \"\", + // \"minAddress\": \"\"}, \"fixedAddresses\": \"\", \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": + // \"\"}, \"macAddress\": \"\"}, \"layerProtocol\": \"IP_OVER_ETHERNET\"}, \"sapdId\": \"\"}], + // \"virtualLinkInfo\": [{\"id\": \"\", \"linkPort\": [{\"id\": \"\", \"resourceHandle\": {\"resourceId\": \"\", + // \"resourceProviderId\": \"\", \"vimId\": \"\", \"vimLevelResourceType\": \"\"}}], \"nsVirtualLinkDescId\": + // \"\", \"resourceHandle\": [{\"resourceId\": \"\", \"resourceProviderId\": \"\", \"vimId\": \"\", + // \"vimLevelResourceType\": \"\"}]}], \"vnfInstance\": [{\"vnfInstanceId\": \"\", \"vnfProfileId\": \"\"}], + // \"vnffgInfo\": [{\"id\": \"\", \"nfpInfo\": [{\"description\": \"\", \"id\": \"\", \"nfpName\": \"\", + // \"nfpRule\": {\"destinationIpAddressPrefix\": \"\", \"destinationPortRange\": \"\", \"dscp\": \"\", + // \"etherDestinationAddress\": \"\", \"etherSourceAddress\": \"\", \"etherType\": \"\", \"extendedCriteria\": + // [{\"length\": 1, \"startingPoint\": 1, \"value\": \"\"}], \"protocol\": \"\", \"sourceIpAddressPrefix\": + // \"\", \"sourcePortRange\": \"\", \"vlanTag\": []}, \"nfpState\": \"\", \"nfpdId\": \"\", \"nscpHandle\": + // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", + // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"totalCp\": 1}], \"nsCpHandle\": + // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", + // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"nsVirtualLinkInfoId\": [], \"pnfInfoId\": [], + // \"vnfInstanceId\": [], \"vnffgdId\": \"\"}]}"); + + resourceOperationStatus.setStatus("processing"); + resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); + resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); + resourceOperationStatus + .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); + when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); + when(restfulUtil.getNfvoFromAAI("b1bb0ce7-2222-4fa7-95ed-4840d70a1101")).thenReturn(restfulResponse); + when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())) + .thenReturn(vfcrestfulResponse); + when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); + vfcManagerSol005.createNs(nsResourceInputParameter); + + } + + @Test + public void terminateNs() throws Exception { + instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); + instanceNfvoMapping.setPassword("sacjnasnc"); + instanceNfvoMapping.setUsername("admin"); + instanceNfvoMapping.setNfvoName("external_nfvo"); + instanceNfvoMapping.setEndpoint("http://sample.com/"); + instanceNfvoMapping.setApiRoot("xyz"); + String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); + String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); + Map header = new HashMap<>(); + header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); + vfcrestfulResponse.setStatus(202); + vfcrestfulResponse.setResponseContent(null); + vfcrestfulResponse.setRespHeaderMap(header); + when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); + when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(vfcrestfulResponse); + vfcManagerSol005.terminateNs(nsResourceInputParameter.getNsOperationKey(), nsInstanceId); + } + + @Test + public void getNsProgress() throws Exception { + String jobId = "12204a12-7da2-4ddf-8c2f-992a1a1acebf"; + instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); + instanceNfvoMapping.setPassword("sacjnasnc"); + instanceNfvoMapping.setUsername("admin"); + instanceNfvoMapping.setNfvoName("external_nfvo"); + instanceNfvoMapping.setEndpoint("http://sample.com/"); + instanceNfvoMapping.setApiRoot("xyz"); + instanceNfvoMapping.setJobId(jobId); + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); + String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); + operationStatus.setProgress("40"); + operationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); + operationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); + ResourceOperationStatus resourceOperationStatus = + new ResourceOperationStatus(nsResourceInputParameter.getNsOperationKey().getServiceId(), + nsResourceInputParameter.getNsOperationKey().getOperationId(), + nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); + file = new File(classLoader.getResource("json/lcmOperRsp.json").getFile()); + content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + vfcrestfulResponse.setStatus(202); + vfcrestfulResponse.setResponseContent(content); + List resourceOperationStatuses = new ArrayList<>(); + resourceOperationStatuses.add(resourceOperationStatus); + when(instanceNfvoMappingRepository.findOneByJobId(jobId)).thenReturn(instanceNfvoMapping); + when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(vfcrestfulResponse); + when(operationStatusRepository.findOneByServiceIdAndOperationId( + nsResourceInputParameter.getNsOperationKey().getServiceId(), + nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(operationStatus); + when(resourceOperationStatusRepository.findByServiceIdAndOperationId( + nsResourceInputParameter.getNsOperationKey().getServiceId(), + nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(resourceOperationStatuses); + when(operationStatusRepository.save(operationStatus)).thenReturn(operationStatus); + vfcManagerSol005.getNsProgress(nsResourceInputParameter.getNsOperationKey(), jobId); + + } + + @Test + public void instantiateNs() throws Exception { + String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); + String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); + instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); + instanceNfvoMapping.setPassword("sacjnasnc"); + instanceNfvoMapping.setUsername("admin"); + instanceNfvoMapping.setNfvoName("external_nfvo"); + instanceNfvoMapping.setEndpoint("http://sample.com/"); + instanceNfvoMapping.setApiRoot("xyz"); + resourceOperationStatus.setStatus("processing"); + resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); + resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); + resourceOperationStatus + .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); + Map header = new HashMap<>(); + header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); + vfcrestfulResponse.setStatus(202); + vfcrestfulResponse.setResponseContent(null); + vfcrestfulResponse.setRespHeaderMap(header); + when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); + when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(vfcrestfulResponse); + when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); + when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); + vfcManagerSol005.instantiateNs(nsInstanceId, nsResourceInputParameter); + + } + + @Test + public void deleteNs() throws Exception { + String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); + String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); + nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); + instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); + instanceNfvoMapping.setPassword("sacjnasnc"); + instanceNfvoMapping.setUsername("admin"); + instanceNfvoMapping.setNfvoName("external_nfvo"); + instanceNfvoMapping.setEndpoint("http://sample.com/"); + instanceNfvoMapping.setApiRoot("xyz"); + nsOperationKey.setServiceId("1"); + resourceOperationStatus.setStatus("processing"); + resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); + resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); + resourceOperationStatus + .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); + Map header = new HashMap<>(); + header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); + vfcrestfulResponse.setStatus(202); + vfcrestfulResponse.setResponseContent(null); + vfcrestfulResponse.setRespHeaderMap(header); + when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); + when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(vfcrestfulResponse); + when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); + when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); + vfcManagerSol005.deleteNs(nsOperationKey, nsInstanceId); + + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java new file mode 100644 index 0000000..08fe618 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (c) 2019 Samsung. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.rest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.adapters.vfc.constant.CommonConstant; +import org.onap.so.adapters.vfc.model.NSResourceInputParameter; +import org.onap.so.adapters.vfc.model.NsOperationKey; +import org.onap.so.adapters.vfc.model.NsParameters; +import org.onap.so.adapters.vfc.model.NsScaleParameters; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.onap.so.adapters.vfc.util.RestfulUtil; +import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.springframework.http.HttpStatus; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class VfcManagerTest { + + @Mock + private ResourceOperationStatusRepository resourceOperationStatusRepository; + + @Mock + private RestfulUtil restfulUtil; + + @InjectMocks + @Spy + private VfcManager vfcManager; + + @Test + public void createNs() throws Exception { + + NSResourceInputParameter segInput = new NSResourceInputParameter(); + segInput.setNsOperationKey(new NsOperationKey()); + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + RestfulResponse response = vfcManager.createNs(segInput); + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + } + + @Test + public void deleteNs() throws Exception { + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + NsOperationKey nsOperationKey = new NsOperationKey(); + + RestfulResponse response = vfcManager.deleteNs(nsOperationKey, "someNsInstanceId"); + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + } + + @Test + public void instantiateNs() throws Exception { + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + NsParameters nsParameters = new NsParameters(); + NSResourceInputParameter segInput = new NSResourceInputParameter(); + segInput.setNsParameters(nsParameters); + segInput.setNsOperationKey(new NsOperationKey()); + + RestfulResponse response = vfcManager.instantiateNs("someNsInstanceId", segInput); + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + } + + @Test + public void terminateNs() throws Exception { + + NsOperationKey nsOperationKey = new NsOperationKey(); + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + RestfulResponse response = vfcManager.terminateNs(nsOperationKey, "someNsInstanceId"); + assertEquals(HttpStatus.OK.value(), response.getStatus()); + } + + @Test + public void getNsProgress() throws Exception { + + NsOperationKey nsOperationKey = new NsOperationKey(); + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + restfulResponse.setResponseContent( + "{\"" + CommonConstant.JOB_ID + "\": \"someJobId\", " + "\"responseDescriptor\" : {}}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + when(resourceOperationStatusRepository.findOne(any())) + .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); + + RestfulResponse response = vfcManager.getNsProgress(nsOperationKey, "someJobId"); + assertEquals(HttpStatus.OK.value(), response.getStatus()); + } + + @Test + public void scaleNs() throws Exception { + + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); + NSResourceInputParameter segInput = new NSResourceInputParameter(); + NsScaleParameters nsScaleParameters = new NsScaleParameters(); + segInput.setNsScaleParameters(nsScaleParameters); + + RestfulResponse restfulResponse = new RestfulResponse(); + restfulResponse.setStatus(HttpStatus.OK.value()); + segInput.setNsOperationKey(new NsOperationKey()); + restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); + when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); + + when(resourceOperationStatusRepository.findOne(any())) + .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); + + RestfulResponse response = vfcManager.scaleNs("someNsInstanceId", segInput); + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + } + +} diff --git a/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java new file mode 100644 index 0000000..a3a3fd2 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java @@ -0,0 +1,209 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (c) 2019 Samsung. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vfc.util; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.Header; +import org.apache.http.message.BasicHeader; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpClient; +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.HttpPut; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.adapters.vfc.model.RestfulResponse; +import org.springframework.http.HttpStatus; +import javax.ws.rs.HttpMethod; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class RestfulUtilTest { + + @InjectMocks + @Spy + private RestfulUtil restfulUtil; + + @Mock + private HttpClient client; + + private HttpEntity httpEntity; + private HttpResponse httpResponse; + private StatusLine statusLine; + private Header httpResponseHeader; + + @Before + public void setUp() { + httpEntity = mock(HttpEntity.class); + httpResponse = mock(HttpResponse.class); + statusLine = mock(StatusLine.class); + httpResponseHeader = mock(Header.class); + } + + private void sendInit() throws IOException { + + Header[] headerList = new BasicHeader[2]; + headerList[0] = new BasicHeader("Content-Type", "application/json"); + headerList[1] = new BasicHeader("cache-control", "no-cache"); + doReturn("https://testHost/").when(restfulUtil).getMsbHost(); + + when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value()); + when(httpResponse.getStatusLine()).thenReturn(statusLine); + when(httpResponse.getEntity()).thenReturn(httpEntity); + when(httpResponse.getAllHeaders()).thenReturn(headerList); + } + + @Test + public void sendGet() throws Exception { + + sendInit(); + + ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("GET").getBytes()); + when(client.execute(any(HttpGet.class))).thenReturn(httpResponse); + when(httpEntity.getContent()).thenReturn(responseStream); + + RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.GET, "some request content"); + + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + assertEquals("GET", restfulResponse.getResponseContent()); + + Map requestHeader = new HashMap<>(); + requestHeader.put("a", "b"); + RestfulResponse restfulResponse1 = + restfulUtil.send("test", HttpMethod.GET, "some request content", requestHeader); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); + + } + + @Test + public void sendPost() throws Exception { + + sendInit(); + + + ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("POST").getBytes()); + when(client.execute(any(HttpPost.class))).thenReturn(httpResponse); + when(httpEntity.getContent()).thenReturn(responseStream); + + RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.POST, "some request content"); + + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + assertEquals("POST", restfulResponse.getResponseContent()); + + Map requestHeader = new HashMap<>(); + requestHeader.put("a", "b"); + RestfulResponse restfulResponse1 = + restfulUtil.send("test", HttpMethod.POST, "some request content", requestHeader); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); + + } + + @Test + public void sendPut() throws Exception { + + sendInit(); + + ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("PUT").getBytes()); + when(client.execute(any(HttpPut.class))).thenReturn(httpResponse); + when(httpEntity.getContent()).thenReturn(responseStream); + + RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.PUT, "some request content"); + + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + assertEquals("PUT", restfulResponse.getResponseContent()); + + Map requestHeader = new HashMap<>(); + requestHeader.put("a", "b"); + RestfulResponse restfulResponse1 = + restfulUtil.send("test", HttpMethod.PUT, "some request content", requestHeader); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); + + } + + @Test + public void sendDelete() throws Exception { + + sendInit(); + + ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("DELETE").getBytes()); + when(client.execute(any(HttpDelete.class))).thenReturn(httpResponse); + when(httpEntity.getContent()).thenReturn(responseStream); + + RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.DELETE, "some request content"); + + assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); + assertEquals("DELETE", restfulResponse.getResponseContent()); + + Map requestHeader = new HashMap<>(); + requestHeader.put("a", "b"); + RestfulResponse restfulResponse1 = + restfulUtil.send("test", HttpMethod.DELETE, "some request content", requestHeader); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); + + } + + @Test + public void sendOptions() throws Exception { + + doReturn("https://testHost/").when(restfulUtil).getMsbHost(); + + RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.OPTIONS, "some request content"); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus()); + assertEquals("Error processing request to VFC", restfulResponse.getResponseContent()); + + Map requestHeader = new HashMap<>(); + requestHeader.put("a", "b"); + RestfulResponse restfulResponse1 = + restfulUtil.send("test", HttpMethod.OPTIONS, "some request content", requestHeader); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); + } + + @Test + public void getNfvoFromAAITest() throws Exception { + + doReturn("https://testHost/").when(restfulUtil).getMsbHost(); + + RestfulResponse restfulResponse = restfulUtil.getNfvoFromAAI("test"); + + assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus()); + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/resources/application-test.yaml b/so-etsi-sol005-adapter-application/src/test/resources/application-test.yaml new file mode 100644 index 0000000..b43d382 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/application-test.yaml @@ -0,0 +1,64 @@ + +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false +mso: + adapters: + requestDb: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + endpoint: http://localhost:8081 + logPath: logs + site-name: localSite + infra-requests: + archived: + period: 1 +spring: + datasource: + jdbc-url: jdbc:mariadb://localhost:3307/requestdb + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + initialization-mode: never + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client +mariaDB4j: + dataDir: + port: 3307 + databaseName: requestdb + +#Actuator +management: + endpoints: + web: + base-path: /manage + server: + servlet: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. + + +flyway: + baseline-on-migrate: false + url: jdbc:mariadb://localhost:3307/requestdb + user: root + password: password diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/LICENSE.txt b/so-etsi-sol005-adapter-application/src/test/resources/json/LICENSE.txt new file mode 100644 index 0000000..bc40e66 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/LICENSE.txt @@ -0,0 +1,19 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/aainfvoResponse.json b/so-etsi-sol005-adapter-application/src/test/resources/json/aainfvoResponse.json new file mode 100644 index 0000000..35047a9 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/aainfvoResponse.json @@ -0,0 +1,10 @@ +{ + "nfvoId":"6ee79fe2-9579-475a-9bb9-20cf4358a19e", + "name":"external_nfvo", + "api-root":"xyz", + "vendor":"vz", + "version":"v1.0", + "url":"http://sample.com/", + "userName":"admin", + "password":"sacjnasnc" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/createNsReq.json b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsReq.json new file mode 100644 index 0000000..aec8ae8 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsReq.json @@ -0,0 +1,56 @@ +{ + "nsServiceName":"vcpe_e2e_vnf_test2", + "nsServiceDescription":"null", + "nsServiceModelUUID":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", + "nsOperationKey":{ + "globalSubscriberId":"Demonstration", + "serviceType":"vCPE", + "serviceId":"996fadbb-e806-4a19-b0e5-3454ad6ac29e", + "operationId":"1f1dd6b2-b027-4008-a9df-3b6c8274fb24", + "nodeTemplateUUID":"4d3a835c-29c8-4a63-83a4-50de5f7ffe16" + }, + "nsParameters":{ + "locationConstraints":[ + { + "locationConstraints":{ + "vimId":"CloudOwner_regionOne" + }, + "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101" + }, + { + "locationConstraints":{ + "vimId":"CloudOwner_regionOne" + }, + "vnfProfileId":"0408f076-e6c0-4c82-9940-272fddbb82de" + }, + { + "locationConstraints":{ + "vimId":"CloudOwner_regionOne" + }, + "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1100" + }, + { + "locationConstraints":{ + "vimId":"CloudOwner_regionOne" + }, + "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1102" + }, + { + "locationConstraints":{ + "vimId":"CloudOwner_regionOne" + }, + "vnfProfileId":"3fca3543-07f5-492f-812c-ed462e4f94f4" + } + ], + "additionalParamForNs":{ + "orchestrator":"", + "nfvo":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101", + "nf_naming":"true", + "multi_stage_design":"false", + "availability_zone_max_count":"1", + "xyz":"123", + "nsd0_providing_service_invariant_uuid":"12204a12-7da2-4ddf-8c2f-992a1a1acebf", + "nsd0_providing_service_uuid":"5791dbeb-19d4-43e8-bf44-5b327ccf6bca" + } + } +} diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/createNsRsp.json b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsRsp.json new file mode 100644 index 0000000..ccd1d66 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsRsp.json @@ -0,0 +1,3 @@ +{ + "nsInstanceId": "9b9f02c0-298b-458a-bc9c-be3692e4f354" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/createNsSol005Response.json b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsSol005Response.json new file mode 100644 index 0000000..938969a --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/createNsSol005Response.json @@ -0,0 +1,210 @@ +{ + "_links":{ + "heal":{ + "href":"" + }, + "instantiate":{ + "href":"" + }, + "nestedNsInstances":{ + "href":"" + }, + "scale":{ + "href":"" + }, + "self":{ + "href":"" + }, + "terminate":{ + "href":"" + }, + "update":{ + "href":"" + } + }, + "additionalAffinityOrAntiAffiniityRule":[ + { + "Scope":"", + "affinityOrAntiAffiinty":"", + "vnfInstanceId":[ + + ], + "vnfProfileId":[ + + ], + "vnfdId":[ + + ] + } + ], + "flavourId":"", + "id":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", + "nestedNsInstanceId":[ + + ], + "nsInstanceDescription":"", + "nsInstanceName":"", + "nsScaleStatus":[ + { + "nsScaleLevelId":"", + "nsScalingAspectId":"" + } + ], + "nsState":"", + "nsdId":"", + "nsdInfoId":"", + "pnfInfo":[ + { + "cpInfo":[ + { + "cpInstanceId":"", + "cpProtocolData":{ + "ipOverEthernet":{ + "ipAddresses":{ + "addressRange":{ + "maxAddress":"", + "minAddress":"" + }, + "fixedAddresses":"", + "numDynamicAddresses":1, + "subnetId":"", + "type":"" + }, + "macAddress":{ + + } + }, + "layerProtocol":"IP_OVER_ETHERNET" + }, + "cpdId":"" + } + ], + "pnfId":"", + "pnfName":"", + "pnfProfileId":"", + "pnfdId":"", + "pnfdInfoId":"" + } + ], + "sapInfo":[ + { + "description":"", + "id":"", + "sapName":"", + "sapProtocolInfo":{ + "ipOverEthernet":{ + "ipAddresses":{ + "addressRange":{ + "maxAddress":"", + "minAddress":"" + }, + "fixedAddresses":"", + "numDynamicAddresses":1, + "subnetId":"", + "type":"" + }, + "macAddress":"" + }, + "layerProtocol":"IP_OVER_ETHERNET" + }, + "sapdId":"" + } + ], + "virtualLinkInfo":[ + { + "id":"", + "linkPort":[ + { + "id":"", + "resourceHandle":{ + "resourceId":"", + "resourceProviderId":"", + "vimId":"", + "vimLevelResourceType":"" + } + } + ], + "nsVirtualLinkDescId":"", + "resourceHandle":[ + { + "resourceId":"", + "resourceProviderId":"", + "vimId":"", + "vimLevelResourceType":"" + } + ] + } + ], + "vnfInstance":[ + { + "vnfInstanceId":"", + "vnfProfileId":"" + } + ], + "vnffgInfo":[ + { + "id":"", + "nfpInfo":[ + { + "description":"", + "id":"", + "nfpName":"", + "nfpRule":{ + "destinationIpAddressPrefix":"", + "destinationPortRange":"", + "dscp":"", + "etherDestinationAddress":"", + "etherSourceAddress":"", + "etherType":"", + "extendedCriteria":[ + { + "length":1, + "startingPoint":1, + "value":"" + } + ], + "protocol":"", + "sourceIpAddressPrefix":"", + "sourcePortRange":"", + "vlanTag":[ + + ] + }, + "nfpState":"", + "nfpdId":"", + "nscpHandle":[ + { + "nsInstanceId":"", + "nsSapInstanceId":"", + "pnfExtCpInstanceId":"", + "pnfInfoId":"", + "vnfExtCpInstanceId":"", + "vnfInstanceId":"" + } + ], + "totalCp":1 + } + ], + "nsCpHandle":[ + { + "nsInstanceId":"", + "nsSapInstanceId":"", + "pnfExtCpInstanceId":"", + "pnfInfoId":"", + "vnfExtCpInstanceId":"", + "vnfInstanceId":"" + } + ], + "nsVirtualLinkInfoId":[ + + ], + "pnfInfoId":[ + + ], + "vnfInstanceId":[ + + ], + "vnffgdId":"" + } + ] +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/deleteNsReq.json b/so-etsi-sol005-adapter-application/src/test/resources/json/deleteNsReq.json new file mode 100644 index 0000000..ac095e6 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/deleteNsReq.json @@ -0,0 +1,7 @@ +{ + "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", + "serviceType":"service", + "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", + "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", + "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsReq.json b/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsReq.json new file mode 100644 index 0000000..047c810 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsReq.json @@ -0,0 +1,32 @@ +{ + "nsServiceName":"vIMS", + "nsServiceDescription":"vIMS NS", + "nsOperationKey":{ + "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", + "serviceType":"service", + "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", + "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", + "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" + }, + "nsParameters":{ + "locationConstraints":[ + { + "vnfProfileId":"zte-CSCF-1.0", + "locationConstraints":{ + "vimId":"1" + } + } + ], + "additionalParamForNs":{ + "externalDataNetworkName":"Flow_out_net", + "m6000_mng_ip":"192.168.20.2", + "externalCompanyFtpDataNetworkName":"Flow_out_net", + "externalPluginManageNetworkName":"plugin_net_2014", + "externalManageNetworkName":"mng_net_2017", + "sfc_data_network":"sfc_data_net_2016", + "NatIpRange":"210.1.1.10-210.1.1.20", + "location":"4050083f-465f-4838-af1e-47a545222ad0", + "sdncontroller":"9b9f02c0-298b-458a-bc9c-be3692e4f35e" + } + } +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsRsp.json b/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsRsp.json new file mode 100644 index 0000000..51e4d01 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/instantiateNsRsp.json @@ -0,0 +1,3 @@ +{ + "jobId":"1" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/lcmOperRsp.json b/so-etsi-sol005-adapter-application/src/test/resources/json/lcmOperRsp.json new file mode 100644 index 0000000..111afc1 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/lcmOperRsp.json @@ -0,0 +1,7 @@ +{ + "id":"12204a12-7da2-4ddf-8c2f-992a1a1acebf", + "lcmOperationType":"INSTANTIATE", + "nsInstanceId":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", + "operationState":"PROCESSING", + "statusEnteredTime":"Time" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobReq.json b/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobReq.json new file mode 100644 index 0000000..ac095e6 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobReq.json @@ -0,0 +1,7 @@ +{ + "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", + "serviceType":"service", + "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", + "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", + "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobRsp.json b/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobRsp.json new file mode 100644 index 0000000..9238b47 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/queryJobRsp.json @@ -0,0 +1,10 @@ +{ + "jobId": "1", + "responseDescriptor": { + "progress": "100", + "status": "finished", + "statusDescription": "OMC VMs are decommissioned in VIM", + "errorCode": "", + "responseId": "22" + } +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsReq.json b/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsReq.json new file mode 100644 index 0000000..ac095e6 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsReq.json @@ -0,0 +1,7 @@ +{ + "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", + "serviceType":"service", + "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", + "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", + "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsRsp.json b/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsRsp.json new file mode 100644 index 0000000..51e4d01 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/json/terminateNsRsp.json @@ -0,0 +1,3 @@ +{ + "jobId":"1" +} \ No newline at end of file diff --git a/so-etsi-sol005-adapter-application/src/test/resources/logback-test.xml b/so-etsi-sol005-adapter-application/src/test/resources/logback-test.xml new file mode 100644 index 0000000..c2e0098 --- /dev/null +++ b/so-etsi-sol005-adapter-application/src/test/resources/logback-test.xml @@ -0,0 +1,42 @@ + + + + + + + + %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java deleted file mode 100644 index dd875c5..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc; - -import java.util.Arrays; -import org.apache.cxf.Bus; -import org.apache.cxf.endpoint.Server; -import org.apache.cxf.feature.LoggingFeature; -import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; -import org.apache.cxf.jaxrs.swagger.Swagger2Feature; -import org.apache.cxf.transport.servlet.CXFServlet; -import org.onap.so.adapters.vfc.rest.VfcAdapterRest; -import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - - -@Configuration -public class CXFConfiguration { - - @Autowired - private Bus bus; - - @Autowired - private VfcAdapterRest vfcAdapterRest; - - @Autowired - private SOAuditLogContainerFilter soAuditLogContainerFilter; - - @Autowired - private ObjectMapper mapper; - - @Bean - public ServletRegistrationBean cxfServlet() { - return new ServletRegistrationBean(new CXFServlet(), "/services/*"); - } - - @Bean - public Server rsServer() { - JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); - endpoint.setBus(bus); - endpoint.setServiceBeans(Arrays.asList(vfcAdapterRest)); - endpoint.setAddress("/"); - endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); - return endpoint.create(); - } - - @Bean - public Swagger2Feature createSwaggerFeature() { - Swagger2Feature swagger2Feature = new Swagger2Feature(); - swagger2Feature.setPrettyPrint(true); - swagger2Feature.setTitle("SO VFC Adapter"); - swagger2Feature.setContact("The ONAP SO team"); - swagger2Feature.setDescription("This project is the SO Orchestration Engine"); - swagger2Feature.setVersion("1.0.0"); - swagger2Feature.setResourcePackage("org.onap.so.adapters.vfc.rest"); - swagger2Feature.setScan(true); - return swagger2Feature; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java b/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java deleted file mode 100644 index 62234f9..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc; - - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - - - -@SpringBootApplication(scanBasePackages = {"org.onap.so"}) -public class MSOVfcApplication { - - public static void main(String... args) { - SpringApplication.run(MSOVfcApplication.class, args); - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java b/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java deleted file mode 100644 index d7397c8..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc; - - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Profile({"!test"}) -@Configuration -@EnableTransactionManagement -@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", - transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) -public class RequestDBConfig { - - @Primary - @Bean(name = "requestDataSource") - @ConfigurationProperties(prefix = "spring.datasource") - public DataSource dataSource() { - return DataSourceBuilder.create().build(); - } - - @Primary - @Bean(name = "requestEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, - @Qualifier("requestDataSource") DataSource dataSource) { - return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") - .build(); - } - - @Primary - @Bean(name = "requestTransactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { - return new JpaTransactionManager(entityManagerFactory); - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java b/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java deleted file mode 100644 index 51a0fc0..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java +++ /dev/null @@ -1,157 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.constant; - -/** - * CommonConstant
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -public class CommonConstant { - - public static final String STR_EMPTY = ""; - - public static final String NFVO_CREATE_URL = "/api/nslcm/v1/ns"; - public static final String SOL005_NFVO_CREATE_URL = "/api/nslcm/v1/ns_instances"; - - public static final String NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns/%s/instantiate"; - public static final String SOL005_NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns_instances/%s/instantiate"; - - public static final String NFVO_TERMINATE_URL = "/api/nslcm/v1/ns/%s/terminate"; - public static final String SOL005_NFVO_TERMINATE_URL = "/api/nslcm/v1/ns_instances/%s/terminate"; - - public static final String NFVO_DELETE_URL = "/api/nslcm/v1/ns/%s"; - public static final String SOL005_NFVO_DELETE_URL = "/api/nslcm/v1/ns_instances/%s"; - - public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s"; - public static final String SOL005_NFVO_QUERY_URL = "/api/nslcm/v1/ns_lcm_op_occs/%s"; - - public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale"; - - public enum operationState { - PROCESSING, COMPLETED, PARTIALLY_COMPLETED, FAILED_TEMP, FAILED, ROLLING_BACK, ROLLED_BACK - } - public enum lcmOperationType { - INSTANTIATE, SCALE, UPDATE, TERMINATE, HEAL - }; - public enum cancelMode { - GRACEFUL, FORCEFUL - }; - - /** - * - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ - public static class MethodType { - - public static final String POST = "post"; - - public static final String DELETE = "delete"; - - public static final String PUT = "put"; - - public static final String GET = "get"; - - private MethodType() { - - } - } - - /** - * - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ - public static class Step { - - public static final String CREATE = "create"; - - public static final String INSTANTIATE = "instantiate"; - - public static final String STATUS = "status"; - - public static final String TERMINATE = "terminate"; - - public static final String QUERY = "query"; - - public static final String DELETE = "delete"; - - public static final String SCALE = "scale"; - - private Step() { - - } - - } - - - public static final String NSD_ID = "nsdId"; - - public static final String NS_NAME = "nsName"; - - public static final String DESC = "description"; - - public static final String NS_INSTANCE_ID = "nsInstanceId"; - public static final String SOL005_NS_INSTANCE_ID = "id"; - - - public static final String JOB_ID = "jobId"; - public static final String JOB_URI = "Location"; - - public static final String ADDITIONAL_PARAM_FOR_NS = "additionalParamForNs"; - - public static final String LOCAL_HOST = "localhost"; - - public static class StatusDesc { - - public static final String INSTANTIATE_NS_FAILED = "instantiate ns failed"; - - public static final String QUERY_JOB_STATUS_FAILED = "query job status failed"; - - public static final String TERMINATE_NS_FAILED = "terminate ns failed"; - - public static final String DELETE_NS_FAILED = "delete ns failed"; - - public static final String CREATE_NS_FAILED = "create ns failed"; - - public static final String SCALE_NS_FAILED = "scale ns failed"; - - private StatusDesc() { - - } - } - - private CommonConstant() { - - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java b/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java deleted file mode 100644 index 6133002..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.constant; - -/** - *
- *

- *

- * identification of adapter exception - * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class DriverExceptionID { - - public static final String INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION = - "Invalid response from instantiate operation"; - - public static final String INVALID_RESPONSEE_FROM_CREATE_OPERATION = "Invalid response from create operation"; - - public static final String FAIL_TO_INSTANTIATE_NS = "Fail to instantiate ns"; - - public static final String FAIL_TO_CREATE_NS = "Fail to create ns"; - - public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation"; - - public static final String FAIL_TO_DELETE_NS = "Fail to delete ns"; - - public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns"; - - public static final String JOB_STATUS_ERROR = "Job status error"; - - public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status"; - - public static final String FAIL_TO_SCALE_NS = "Fail to scale network service"; - - public static final String INVALID_RESPONSE_FROM_SCALE_OPERATION = "Invalid response from scale operation"; - - - private DriverExceptionID() { - - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java b/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java deleted file mode 100644 index e08c157..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.constant; - -/** - * Constant Class.
- *

- * Define constant for http operation. - *

- * - * @author - * @version ONAP Amsterdam 2016/8/4 - */ -public class HttpCode { - - /** - * Fail to request. - */ - public static final int BAD_REQUEST = 400; - - /** - * Inner error - */ - public static final int INTERNAL_SERVER_ERROR = 500; - - /** - * Not accept request. - */ - public static final int NOT_ACCEPTABLE = 406; - - /** - * Not found service. - */ - public static final int NOT_FOUND = 404; - - /** - * Accept request. - */ - public static final int RESPOND_ACCEPTED = 202; - - /** - * Http response is ok. - */ - public static final int RESPOND_OK = 200; - - public static final int CREATED_OK = 201; - - /** - * Conflict - */ - public static final int RESPOND_CONFLICT = 409; - - /** - * Constructor
- *

- *

- * - * @since ONAP Amsterdam Release 2017-9-6 - */ - private HttpCode() { - - } - - /** - * Whether request is successful.
- * - * @param httpCode response code - * @return true or false - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static boolean isSucess(int httpCode) { - return httpCode / 100 == 2; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java b/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java deleted file mode 100644 index 88260a7..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.exceptions; - -import javax.ws.rs.core.Response; - -public class ApplicationException extends Exception { - - /** - * Serial number. - */ - private static final long serialVersionUID = 1L; - - private int errorCode; - - private String errorMsg; - - /** - * Constructor
- *

- *

- * - * @param errorCode error status - * @param errorMsg error detail - * @since ONAP Amsterdam Release 2017-9-6 - */ - public ApplicationException(int errorCode, String errorMsg) { - this.errorCode = errorCode; - this.errorMsg = errorMsg; - } - - public int getErrorCode() { - return errorCode; - } - - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - /** - * build error Response
- * - * @return - * @since ONAP Amsterdam Release - */ - public Response buildErrorResponse() { - return Response.status(errorCode).entity(errorMsg).build(); - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java b/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java deleted file mode 100644 index d312501..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java +++ /dev/null @@ -1,68 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class AddPnfData { - private String pnfId; - private String pnfName; - private String pnfdId; - private String pnfProfileId; - private List cpData; - - /*** - * - * @return id of pnf - */ - public String getPnfId() { - return pnfId; - } - - public void setPnfId(String pnfId) { - this.pnfId = pnfId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getPnfdId() { - return pnfdId; - } - - public void setPnfdId(String pnfdId) { - this.pnfdId = pnfdId; - } - - public String getPnfProfileId() { - return pnfProfileId; - } - - public void setPnfProfileId(String pnfProfileId) { - this.pnfProfileId = pnfProfileId; - } - - public List getCpData() { - return cpData; - } - - public void setCpData(List cpData) { - this.cpData = cpData; - } -} - diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java b/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java deleted file mode 100644 index 9f357a5..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AddressRange { - private String minAddress; - private String maxAddress; - - public String getMinAddress() { - return minAddress; - } - - public void setMinAddress(String minAddress) { - this.minAddress = minAddress; - } - - public String getMaxAddress() { - return maxAddress; - } - - public void setMaxAddress(String maxAddress) { - this.maxAddress = maxAddress; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java deleted file mode 100644 index fa502f3..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java +++ /dev/null @@ -1,40 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedNs { - private String nsInstanceId; - private String nsdId; - - private enum changeType { - ADD, REMOVE, INSTANTIATE, TERMINATE, SCALE, UPDATE, HEAL - } - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED, PARTIALLY_COMPLETED - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - public String getNsdId() { - return nsdId; - } - - public void setNsdId(String nsdId) { - this.nsdId = nsdId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java deleted file mode 100644 index 9d98e1c..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java +++ /dev/null @@ -1,67 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedPnf { - private String pnfid; - private String pnfdid; - private String pnfProfileId; - private String pnfName; - private String cpInstanceId; - - private enum changeType { - ADD, REMOVE, MODIFY - } - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED - } - - public String getPnfid() { - return pnfid; - } - - public void setPnfid(String pnfid) { - this.pnfid = pnfid; - } - - public String getPnfdid() { - return pnfdid; - } - - public void setPnfdid(String pnfdid) { - this.pnfdid = pnfdid; - } - - public String getPnfProfileId() { - return pnfProfileId; - } - - public void setPnfProfileId(String pnfProfileId) { - this.pnfProfileId = pnfProfileId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getCpInstanceId() { - return cpInstanceId; - } - - public void setCpInstanceId(String cpInstanceId) { - this.cpInstanceId = cpInstanceId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java deleted file mode 100644 index 62f4f92..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java +++ /dev/null @@ -1,49 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedSap { - private String sapInstanceId; - private String sapdId; - private String sapName; - - private enum changeType { - ADD, REMOVE, MODIFY - } - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED - } - - public String getSapInstanceId() { - return sapInstanceId; - } - - public void setSapInstanceId(String sapInstanceId) { - this.sapInstanceId = sapInstanceId; - } - - public String getSapdId() { - return sapdId; - } - - public void setSapdId(String sapdId) { - this.sapdId = sapdId; - } - - public String getSapName() { - return sapName; - } - - public void setSapName(String sapName) { - this.sapName = sapName; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java deleted file mode 100644 index ecaa1c5..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java +++ /dev/null @@ -1,49 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedVirtualLink { - private String nsVirtualLinkInstanceId; - private String nsVirtualLinkDescId; - private String vlProfileId; - - private enum changeType { - ADD, DELETE, MODIFY, ADD_LINK_PORT, REMOVE_LINK_PORT - }; - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED - } - - public String getNsVirtualLinkInstanceId() { - return nsVirtualLinkInstanceId; - } - - public void setNsVirtualLinkInstanceId(String nsVirtualLinkInstanceId) { - this.nsVirtualLinkInstanceId = nsVirtualLinkInstanceId; - } - - public String getNsVirtualLinkDescId() { - return nsVirtualLinkDescId; - } - - public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) { - this.nsVirtualLinkDescId = nsVirtualLinkDescId; - } - - public String getVlProfileId() { - return vlProfileId; - } - - public void setVlProfileId(String vlProfileId) { - this.vlProfileId = vlProfileId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java deleted file mode 100644 index 6463c7a..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java +++ /dev/null @@ -1,78 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedVnf { - private String vnfInstanceId; - private String vnfdId; - private String vnfProfileId; - private String vnfName; - - private enum changeType { - ADD, - REMOVE, - INSTANTIATE, - TERMINATE, - SCALE, - CHANGE_FLAVOUR, - HEAL, - OPERATE, - MODIFY_INFORMATION, - CHANGE_EXTERNAL_VNF_CONNECTIVITY - }; - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED - } - - private ChangedInfo changedInfo; - - - public String getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(String vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getVnfdId() { - return vnfdId; - } - - public void setVnfdId(String vnfdId) { - this.vnfdId = vnfdId; - } - - public String getVnfProfileId() { - return vnfProfileId; - } - - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - public String getVnfName() { - return vnfName; - } - - public void setVnfName(String vnfName) { - this.vnfName = vnfName; - } - - public ChangedInfo getChangedInfo() { - return changedInfo; - } - - public void setChangedInfo(ChangedInfo changedInfo) { - this.changedInfo = changedInfo; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java b/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java deleted file mode 100644 index 04e9481..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java +++ /dev/null @@ -1,40 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class AffectedVnffg { - private String vnffgInstanceId; - private String vnffgdId; - - private enum changeType { - ADD, REMOVE, MODIFY - } - private enum changeResult { - COMPLETED, ROLLED_BACK, FAILED - } - - public String getVnffgInstanceId() { - return vnffgInstanceId; - } - - public void setVnffgInstanceId(String vnffgInstanceId) { - this.vnffgInstanceId = vnffgInstanceId; - } - - public String getVnffgdId() { - return vnffgdId; - } - - public void setVnffgdId(String vnffgdId) { - this.vnffgdId = vnffgdId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java b/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java deleted file mode 100644 index 7f019bc..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java +++ /dev/null @@ -1,51 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class AffinityOrAntiAffinityRule { - private String vnfdId; - private List vnfProfileId; - private List vnfInstanceId; - - private enum affinityOrAntiAffiinty { - AFFINITY, ANTI_AFFIINTY - }; - private enum scope { - NFVI_POP, ZONE, ZONE_GROUP, NFVI_NODE - }; - - public String getVnfdId() { - return vnfdId; - } - - public void setVnfdId(String vnfdId) { - this.vnfdId = vnfdId; - } - - public List getVnfProfileId() { - return vnfProfileId; - } - - public void setVnfProfileId(List vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - public List getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(List vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java deleted file mode 100644 index 5de6cbf..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class ChangedInfo { - private ModifyVnfInfoData changedVnfInfo; - private ExtVirtualLinkInfo changedExtConnectivity; - - public ModifyVnfInfoData getChangedVnfInfo() { - return changedVnfInfo; - } - - public void setChangedVnfInfo(ModifyVnfInfoData changedVnfInfo) { - this.changedVnfInfo = changedVnfInfo; - } - - public ExtVirtualLinkInfo getChangedExtConnectivity() { - return changedExtConnectivity; - } - - public void setChangedExtConnectivity(ExtVirtualLinkInfo changedExtConnectivity) { - this.changedExtConnectivity = changedExtConnectivity; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java b/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java deleted file mode 100644 index 2a63d39..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class CivicAddressElement { - private int caType; - private String caValue; - - public int getCaType() { - return caType; - } - - public void setCaType(int caType) { - this.caType = caType; - } - - public String getCaValue() { - return caValue; - } - - public void setCaValue(String caValue) { - this.caValue = caValue; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java b/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java deleted file mode 100644 index 27272ea..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class CpProtocolData { - private String layerProtocol; - private IpOverEthernetAddressData ipOverEthernet; - - public String getLayerProtocol() { - return layerProtocol; - } - - public void setLayerProtocol(String layerProtocol) { - this.layerProtocol = layerProtocol; - } - - public IpOverEthernetAddressData getIpOverEthernet() { - return ipOverEthernet; - } - - public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) { - this.ipOverEthernet = ipOverEthernet; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java deleted file mode 100644 index 5f1191e..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class CpProtocolInfo { - @NotNull - private enum layerProtocol { - IP_OVER_ETHERNET - }; - - private IpOverEthernetAddressData ipOverEthernet; - - public IpOverEthernetAddressData getIpOverEthernet() { - return ipOverEthernet; - } - - public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) { - this.ipOverEthernet = ipOverEthernet; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java b/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java deleted file mode 100644 index 878ce60..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class CreateNsRequest { - - String nsdId; - - String nsName; - - String nsDescription; - - - public String getNsdId() { - return nsdId; - } - - public void setNsdId(String nsdId) { - this.nsdId = nsdId; - } - - public String getNsDescription() { - return nsDescription; - } - - public void setNsDescription(String nsDescription) { - this.nsDescription = nsDescription; - } - - /** - * @return Returns the nsName. - */ - public String getNsName() { - return nsName; - } - - /** - * @param nsName The nsName to set. - */ - public void setNsName(String nsName) { - this.nsName = nsName; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java b/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java deleted file mode 100644 index e54f0df..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - * The Customer Model
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-10-12 - */ -public class CustomerModel { - - String globalCustomerId; - - String serviceType; - - - /** - * @return Returns the globalCustomerId. - */ - public String getGlobalCustomerId() { - return globalCustomerId; - } - - - /** - * @param globalCustomerId The globalCustomerId to set. - */ - public void setGlobalCustomerId(String globalCustomerId) { - this.globalCustomerId = globalCustomerId; - } - - - /** - * @return Returns the serviceType. - */ - public String getServiceType() { - return serviceType; - } - - - /** - * @param serviceType The serviceType to set. - */ - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java deleted file mode 100644 index 63ca66b..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class ExtCpInfo { - @NotNull - private String id; - @NotNull - private String cpdId; - private List cpProtocolInfo; - private List extLinkPortId; - - - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java deleted file mode 100644 index a1ab3fd..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class ExtLinkPortInfo { - private String id; - private ResourceHandle resourceHandle; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ResourceHandle getResourceHandle() { - return resourceHandle; - } - - public void setResourceHandle(ResourceHandle resourceHandle) { - this.resourceHandle = resourceHandle; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java deleted file mode 100644 index 3f643a8..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class ExtManagedVirtualLinkInfo { - @NotNull - private String id; - @NotNull - private String vnfVirtualLinkDescId; - @NotNull - private ResourceHandle networkResource; - private List vnfLinkPorts; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getVnfVirtualLinkDescId() { - return vnfVirtualLinkDescId; - } - - public void setVnfVirtualLinkDescId(String vnfVirtualLinkDescId) { - this.vnfVirtualLinkDescId = vnfVirtualLinkDescId; - } - - public ResourceHandle getNetworkResource() { - return networkResource; - } - - public void setNetworkResource(ResourceHandle networkResource) { - this.networkResource = networkResource; - } - - public List getVnfLinkPorts() { - return vnfLinkPorts; - } - - public void setVnfLinkPorts(List vnfLinkPorts) { - this.vnfLinkPorts = vnfLinkPorts; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java deleted file mode 100644 index ce7d1cf..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class ExtVirtualLinkInfo { - private String id; - private ResourceHandle resourceHandle; - private ExtLinkPortInfo extLinkPorts; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ResourceHandle getResourceHandle() { - return resourceHandle; - } - - public void setResourceHandle(ResourceHandle resourceHandle) { - this.resourceHandle = resourceHandle; - } - - public ExtLinkPortInfo getExtLinkPorts() { - return extLinkPorts; - } - - public void setExtLinkPorts(ExtLinkPortInfo extLinkPorts) { - this.extLinkPorts = extLinkPorts; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java b/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java deleted file mode 100644 index ff0730a..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java +++ /dev/null @@ -1,207 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; -import java.util.Map; - -public class InstantiateNsRequest { - - private String nsFlavourId; - private List sapData; - private List addpnfData; - private List vnfInstanceData; - private List nestedNsInstanceId; - private List localizationLanguage; - private Map aditionalParamsForNs; - private List additionalParamsForVnf; - private String startTime; - private String nsInstantiationLevelId; - private List additionalAffinityOrAntiAffiniityRule; - - /*** - * - * @return nsFlavourId - */ - public String getNsFlavourId() { - return nsFlavourId; - } - - /*** - * - * @param nsFlavourId - */ - public void setNsFlavourId(String nsFlavourId) { - this.nsFlavourId = nsFlavourId; - } - - /*** - * - * @return - */ - public List getSapData() { - return sapData; - } - - /*** - * - * @param sapData - */ - public void setSapData(List sapData) { - this.sapData = sapData; - } - - /*** - * - * @return - */ - public List getAddpnfData() { - return addpnfData; - } - - /*** - * - * @param addpnfData - */ - public void setAddpnfData(List addpnfData) { - this.addpnfData = addpnfData; - } - - /*** - * - * @return - */ - public List getVnfInstanceData() { - return vnfInstanceData; - } - - /*** - * - * @param vnfInstanceData - */ - public void setVnfInstanceData(List vnfInstanceData) { - this.vnfInstanceData = vnfInstanceData; - } - - /*** - * - * @return - */ - public List getNestedNsInstanceId() { - return nestedNsInstanceId; - } - - /*** - * - * @param nestedNsInstanceId - */ - public void setNestedNsInstanceId(List nestedNsInstanceId) { - this.nestedNsInstanceId = nestedNsInstanceId; - } - - /*** - * - * @return - */ - public List getLocalizationLanguage() { - return localizationLanguage; - } - - /*** - * - * @param localizationLanguage - */ - public void setLocalizationLanguage(List localizationLanguage) { - this.localizationLanguage = localizationLanguage; - } - - /*** - * - * @return - */ - public Map getAditionalParamsForNs() { - return aditionalParamsForNs; - } - - /*** - * - * @param aditionalParamsForNs - */ - public void setAditionalParamsForNs(Map aditionalParamsForNs) { - this.aditionalParamsForNs = aditionalParamsForNs; - } - - /*** - * - * @return - */ - public List getAdditionalParamsForVnf() { - return additionalParamsForVnf; - } - - /*** - * - * @param additionalParamsForVnf - */ - public void setAdditionalParamsForVnf(List additionalParamsForVnf) { - this.additionalParamsForVnf = additionalParamsForVnf; - } - - /*** - * - * @return - */ - public String getStartTime() { - return startTime; - } - - /*** - * - * @param startTime - */ - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - /*** - * - * @return - */ - public String getNsInstantiationLevelId() { - return nsInstantiationLevelId; - } - - /*** - * - * @param nsInstantiationLevelId - */ - public void setNsInstantiationLevelId(String nsInstantiationLevelId) { - this.nsInstantiationLevelId = nsInstantiationLevelId; - } - - /*** - * - * @return - */ - public List getAdditionalAffinityOrAntiAffiniityRule() { - return additionalAffinityOrAntiAffiniityRule; - } - - /*** - * - * @param additionalAffinityOrAntiAffiniityRule - */ - public void setAdditionalAffinityOrAntiAffiniityRule( - List additionalAffinityOrAntiAffiniityRule) { - this.additionalAffinityOrAntiAffiniityRule = additionalAffinityOrAntiAffiniityRule; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java deleted file mode 100644 index e66bb90..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class InstantiatedVnfInfo { - @NotNull - private String flavourId; - @NotNull - private String vnfState; - private List vnfScaleInfos; - @NotNull - private List extCpInfo; - private List extVirtualLinkInfo; - private List extManagedVirtualLinkInfo; - // Defination of MonitoringParameter is not there in ETSI document - // considering as String - private List monitoringParameters; - private String localizationLanguage; - - private List vnfcResourceInfo; - // Defination of VirtualStorageResourceInfo is not there in ETSI document - // considering as String - private List virtualStorageResourceInfo; - - public String getFlavourId() { - return flavourId; - } - - public void setFlavourId(String flavourId) { - this.flavourId = flavourId; - } - - public String getVnfState() { - return vnfState; - } - - public void setVnfState(String vnfState) { - this.vnfState = vnfState; - } - - public List getVnfScaleInfos() { - return vnfScaleInfos; - } - - public void setVnfScaleInfos(List vnfScaleInfos) { - this.vnfScaleInfos = vnfScaleInfos; - } - - public List getExtCpInfo() { - return extCpInfo; - } - - public void setExtCpInfo(List extCpInfo) { - this.extCpInfo = extCpInfo; - } - - public List getExtVirtualLinkInfo() { - return extVirtualLinkInfo; - } - - public void setExtVirtualLinkInfo(List extVirtualLinkInfo) { - this.extVirtualLinkInfo = extVirtualLinkInfo; - } - - public List getExtManagedVirtualLinkInfo() { - return extManagedVirtualLinkInfo; - } - - public void setExtManagedVirtualLinkInfo(List extManagedVirtualLinkInfo) { - this.extManagedVirtualLinkInfo = extManagedVirtualLinkInfo; - } - - public List getMonitoringParameters() { - return monitoringParameters; - } - - public void setMonitoringParameters(List monitoringParameters) { - this.monitoringParameters = monitoringParameters; - } - - public String getLocalizationLanguage() { - return localizationLanguage; - } - - public void setLocalizationLanguage(String localizationLanguage) { - this.localizationLanguage = localizationLanguage; - } - - public List getVnfcResourceInfo() { - return vnfcResourceInfo; - } - - public void setVnfcResourceInfo(List vnfcResourceInfo) { - this.vnfcResourceInfo = vnfcResourceInfo; - } - - public List getVirtualStorageResourceInfo() { - return virtualStorageResourceInfo; - } - - public void setVirtualStorageResourceInfo(List virtualStorageResourceInfo) { - this.virtualStorageResourceInfo = virtualStorageResourceInfo; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java b/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java deleted file mode 100644 index 32c5571..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java +++ /dev/null @@ -1,63 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class IpAddresses { - private String type; - private List fixedAddresses; - private int numDynamicAddresses; - private AddressRange addressRange; - private String subnetId; - - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List getFixedAddresses() { - return fixedAddresses; - } - - public void setFixedAddresses(List fixedAddresses) { - this.fixedAddresses = fixedAddresses; - } - - public int getNumDynamicAddresses() { - return numDynamicAddresses; - } - - public void setNumDynamicAddresses(int numDynamicAddresses) { - this.numDynamicAddresses = numDynamicAddresses; - } - - public AddressRange getAddressRange() { - return addressRange; - } - - public void setAddressRange(AddressRange addressRange) { - this.addressRange = addressRange; - } - - public String getSubnetId() { - return subnetId; - } - - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java b/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java deleted file mode 100644 index 48529e5..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java +++ /dev/null @@ -1,35 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class IpOverEthernetAddressData { - private String macAddress; - private List ipAddresses; - - public String getMacAddress() { - return macAddress; - } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public List getIpAddresses() { - return ipAddresses; - } - - public void setIpAddresses(List ipAddresses) { - this.ipAddresses = ipAddresses; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/Link.java b/src/main/java/org/onap/so/adapters/vfc/model/Link.java deleted file mode 100644 index 2459346..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/Link.java +++ /dev/null @@ -1,24 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class Link { - private String href; - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/Links.java b/src/main/java/org/onap/so/adapters/vfc/model/Links.java deleted file mode 100644 index 8ad8f00..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/Links.java +++ /dev/null @@ -1,78 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class Links { - private Link self; - private Link nsInstance; - private Link cancel; - private Link retry; - private Link rollback; - private Link continues; - private Link fail; - - public Link getSelf() { - return self; - } - - public void setSelf(Link self) { - this.self = self; - } - - public Link getNsInstance() { - return nsInstance; - } - - public void setNsInstance(Link nsInstance) { - this.nsInstance = nsInstance; - } - - public Link getCancel() { - return cancel; - } - - public void setCancel(Link cancel) { - this.cancel = cancel; - } - - public Link getRetry() { - return retry; - } - - public void setRetry(Link retry) { - this.retry = retry; - } - - public Link getRollback() { - return rollback; - } - - public void setRollback(Link rollback) { - this.rollback = rollback; - } - - public Link getContinues() { - return continues; - } - - public void setContinues(Link continues) { - this.continues = continues; - } - - public Link getFail() { - return fail; - } - - public void setFail(Link fail) { - this.fail = fail; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java b/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java deleted file mode 100644 index b79565d..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class LocationConstraint { - - /** - * vnf profile id - */ - private String vnfProfileId; - - /** - * location constraints: vimId - */ - private VimLocation locationConstraints; - - /** - * @return Returns the vnfProfileId. - */ - public String getVnfProfileId() { - return vnfProfileId; - } - - /** - * @param vnfProfileId The vnfProfileId to set. - */ - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - - /** - * @return Returns the locationConstraints. - */ - public VimLocation getLocationConstraints() { - return locationConstraints; - } - - - /** - * @param locationConstraints The locationConstraints to set. - */ - public void setLocationConstraints(VimLocation locationConstraints) { - this.locationConstraints = locationConstraints; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java b/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java deleted file mode 100644 index b636d49..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class LocationConstraints { - private String countryCode; - private CivicAddressElement civicAddressElement; - - public String getCountryCode() { - return countryCode; - } - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - public CivicAddressElement getCivicAddressElement() { - return civicAddressElement; - } - - public void setCivicAddressElement(CivicAddressElement civicAddressElement) { - this.civicAddressElement = civicAddressElement; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/Mask.java b/src/main/java/org/onap/so/adapters/vfc/model/Mask.java deleted file mode 100644 index 352f47e..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/Mask.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class Mask { - @NotNull - private int startingPoint; - @NotNull - private int length; - @NotNull - private String value; - - public int getStartingPoint() { - return startingPoint; - } - - public void setStartingPoint(int startingPoint) { - this.startingPoint = startingPoint; - } - - public int getLength() { - return length; - } - - public void setLength(int length) { - this.length = length; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java b/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java deleted file mode 100644 index 55ab21e..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java +++ /dev/null @@ -1,80 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.Map; - -public class ModifyVnfInfoData { - private String vnfInstanceId; - private String vnfInstanceName; - private String vnfInstanceDescription; - private String vnfPkgId; - private Map vnfConfigurableProperties; - private Map Metadata; - private Map Extensions; - - 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 getVnfPkgId() { - return vnfPkgId; - } - - public void setVnfPkgId(String vnfPkgId) { - this.vnfPkgId = vnfPkgId; - } - - public Map getVnfConfigurableProperties() { - return vnfConfigurableProperties; - } - - public void setVnfConfigurableProperties(Map vnfConfigurableProperties) { - this.vnfConfigurableProperties = vnfConfigurableProperties; - } - - public Map getMetadata() { - return Metadata; - } - - public void setMetadata(Map metadata) { - Metadata = metadata; - } - - public Map getExtensions() { - return Extensions; - } - - public void setExtensions(Map extensions) { - Extensions = extensions; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java b/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java deleted file mode 100644 index 266e5ee..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (C) 2018 CMCC All rights reserved. - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.io.ByteArrayOutputStream; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * NS Create Input Parameter For VFC Adapter
- *

- *

- * - * @version ONAP Amsterdam Release 2017/1/7 - */ -public class NSResourceInputParameter { - - private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class); - - private NsOperationKey nsOperationKey; - - private String nsServiceName; - - private String nsServiceDescription; - - private String nsServiceModelUUID; - - private NsParameters nsParameters; - - private NsScaleParameters nsScaleParameters; - - - /** - * @return Returns the nsServiceName. - */ - public String getNsServiceName() { - return nsServiceName; - } - - - /** - * @param nsServiceName The nsServiceName to set. - */ - public void setNsServiceName(String nsServiceName) { - this.nsServiceName = nsServiceName; - } - - - /** - * @return Returns the nsServiceDescription. - */ - public String getNsServiceDescription() { - return nsServiceDescription; - } - - - /** - * @param nsServiceDescription The nsServiceDescription to set. - */ - public void setNsServiceDescription(String nsServiceDescription) { - this.nsServiceDescription = nsServiceDescription; - } - - /** - * @return Returns the nsParameters. - */ - public NsParameters getNsParameters() { - return nsParameters; - } - - /** - * @param nsParameters The nsParameters to set. - */ - public void setNsParameters(NsParameters nsParameters) { - this.nsParameters = nsParameters; - } - - public NsOperationKey getNsOperationKey() { - return nsOperationKey; - } - - public void setNsOperationKey(NsOperationKey nsOperationKey) { - this.nsOperationKey = nsOperationKey; - } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - } catch (Exception e) { - logger.debug("Exception:", e); - } - return jsonString; - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - logger.debug("Exception:", e); - return ""; - } - } - - public NsScaleParameters getNsScaleParameters() { - return nsScaleParameters; - } - - public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { - this.nsScaleParameters = nsScaleParameters; - } - - - public String getNsServiceModelUUID() { - return nsServiceModelUUID; - } - - - public void setNsServiceModelUUID(String nsServiceModelUUID) { - this.nsServiceModelUUID = nsServiceModelUUID; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java deleted file mode 100644 index a6e3963..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class NfpInfo { - @NotNull - private String id; - private String nfpdId; - private String nfpName; - private String description; - @NotNull - private List nscpHandle; - private int totalCp; - @NotNull - private NfpRule nfpRule; - - @NotNull - private enum nfpState { - ENABLED, DISABLED - }; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getNfpdId() { - return nfpdId; - } - - public void setNfpdId(String nfpdId) { - this.nfpdId = nfpdId; - } - - public String getNfpName() { - return nfpName; - } - - public void setNfpName(String nfpName) { - this.nfpName = nfpName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getNscpHandle() { - return nscpHandle; - } - - public void setNscpHandle(List nscpHandle) { - this.nscpHandle = nscpHandle; - } - - public int getTotalCp() { - return totalCp; - } - - public void setTotalCp(int totalCp) { - this.totalCp = totalCp; - } - - public NfpRule getNfpRule() { - return nfpRule; - } - - public void setNfpRule(NfpRule nfpRule) { - this.nfpRule = nfpRule; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java b/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java deleted file mode 100644 index b4f684a..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class NfpRule { - private String etherDestinationAddress; - private String etherSourceAddress; - - private enum etherType { - IPV4, IPV6 - }; - - private List vlanTag; - - private enum protocol { - TCP, UDP, ICMP - } - - private String dscp; - private PortRange sourcePortRange; - private PortRange destinationPortRange; - private String sourceIpAddressPrefix; - private String destinationIpAddressPrefix; - private List extendedCriteria; - - public String getEtherDestinationAddress() { - return etherDestinationAddress; - } - - public void setEtherDestinationAddress(String etherDestinationAddress) { - this.etherDestinationAddress = etherDestinationAddress; - } - - public String getEtherSourceAddress() { - return etherSourceAddress; - } - - public void setEtherSourceAddress(String etherSourceAddress) { - this.etherSourceAddress = etherSourceAddress; - } - - public List getVlanTag() { - return vlanTag; - } - - public void setVlanTag(List vlanTag) { - this.vlanTag = vlanTag; - } - - public String getDscp() { - return dscp; - } - - public void setDscp(String dscp) { - this.dscp = dscp; - } - - public PortRange getSourcePortRange() { - return sourcePortRange; - } - - public void setSourcePortRange(PortRange sourcePortRange) { - this.sourcePortRange = sourcePortRange; - } - - public PortRange getDestinationPortRange() { - return destinationPortRange; - } - - public void setDestinationPortRange(PortRange destinationPortRange) { - this.destinationPortRange = destinationPortRange; - } - - public String getSourceIpAddressPrefix() { - return sourceIpAddressPrefix; - } - - public void setSourceIpAddressPrefix(String sourceIpAddressPrefix) { - this.sourceIpAddressPrefix = sourceIpAddressPrefix; - } - - public String getDestinationIpAddressPrefix() { - return destinationIpAddressPrefix; - } - - public void setDestinationIpAddressPrefix(String destinationIpAddressPrefix) { - this.destinationIpAddressPrefix = destinationIpAddressPrefix; - } - - public List getExtendedCriteria() { - return extendedCriteria; - } - - public void setExtendedCriteria(List extendedCriteria) { - this.extendedCriteria = extendedCriteria; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java b/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java deleted file mode 100644 index 326488f..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class NsCpHandle { - private String vnfInstanceId; - private String vnfExtCpInstanceId; - private String pnfInfoId; - private String pnfExtCpInstanceId; - private String nsInstanceId; - private String nsSapInstanceId; - - public String getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(String vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getVnfExtCpInstanceId() { - return vnfExtCpInstanceId; - } - - public void setVnfExtCpInstanceId(String vnfExtCpInstanceId) { - this.vnfExtCpInstanceId = vnfExtCpInstanceId; - } - - public String getPnfInfoId() { - return pnfInfoId; - } - - public void setPnfInfoId(String pnfInfoId) { - this.pnfInfoId = pnfInfoId; - } - - public String getPnfExtCpInstanceId() { - return pnfExtCpInstanceId; - } - - public void setPnfExtCpInstanceId(String pnfExtCpInstanceId) { - this.pnfExtCpInstanceId = pnfExtCpInstanceId; - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - public String getNsSapInstanceId() { - return nsSapInstanceId; - } - - public void setNsSapInstanceId(String nsSapInstanceId) { - this.nsSapInstanceId = nsSapInstanceId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java b/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java deleted file mode 100644 index 63358cb..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - * Network Service Request
- *

- *

- * - * @author - * @version ONAP Amsterdam Sep 2, 2016 - */ -public class NsCreateReq { - - CustomerModel context; - - String csarId; - - String nsName; - - String description; - - - /** - * @return Returns the context. - */ - public CustomerModel getContext() { - return context; - } - - - - /** - * @param context The context to set. - */ - public void setContext(CustomerModel context) { - this.context = context; - } - - - /** - * @return Returns the csarId. - */ - public String getCsarId() { - return csarId; - } - - - /** - * @param csarId The csarId to set. - */ - public void setCsarId(String csarId) { - this.csarId = csarId; - } - - /** - * @return Returns the nsName. - */ - public String getNsName() { - return nsName; - } - - /** - * @param nsName The nsName to set. - */ - public void setNsName(String nsName) { - this.nsName = nsName; - } - - /** - * @return Returns the description. - */ - public String getDescription() { - return description; - } - - /** - * @param description The description to set. - */ - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java b/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java deleted file mode 100644 index d2d4b4e..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class NsInstance { - @NotNull - private String id; - @NotNull - private String nsInstanceName; - @NotNull - private String nsInstanceDescription; - @NotNull - private String nsdId; - @NotNull - private String nsdInfoId; - private String flavourId; - private List vnfInstance; - private List pnfInfo; - private List virtualLinkInfo; - private List vnffgInfo; - private List sapInfo; - private List nestedNsInstanceId; - - @NotNull - private enum nsState { - NOT_INSTANTIATED, INSTANTIATED - }; - - private List nsScaleStatus; - private List additionalAffinityOrAntiAffinityRule; - @NotNull - private NsInstanceLinks _links; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getNsInstanceName() { - return nsInstanceName; - } - - public void setNsInstanceName(String nsInstanceName) { - this.nsInstanceName = nsInstanceName; - } - - public String getNsInstanceDescription() { - return nsInstanceDescription; - } - - public void setNsInstanceDescription(String nsInstanceDescription) { - this.nsInstanceDescription = nsInstanceDescription; - } - - public String getNsdId() { - return nsdId; - } - - public void setNsdId(String nsdId) { - this.nsdId = nsdId; - } - - public String getNsdInfoId() { - return nsdInfoId; - } - - public void setNsdInfoId(String nsdInfoId) { - this.nsdInfoId = nsdInfoId; - } - - public String getFlavourId() { - return flavourId; - } - - public void setFlavourId(String flavourId) { - this.flavourId = flavourId; - } - - public List getVnfInstance() { - return vnfInstance; - } - - public void setVnfInstance(List vnfInstance) { - this.vnfInstance = vnfInstance; - } - - public List getPnfInfo() { - return pnfInfo; - } - - public void setPnfInfo(List pnfInfo) { - this.pnfInfo = pnfInfo; - } - - public List getVirtualLinkInfo() { - return virtualLinkInfo; - } - - public void setVirtualLinkInfo(List virtualLinkInfo) { - this.virtualLinkInfo = virtualLinkInfo; - } - - public List getVnffgInfo() { - return vnffgInfo; - } - - public void setVnffgInfo(List vnffgInfo) { - this.vnffgInfo = vnffgInfo; - } - - public List getSapInfo() { - return sapInfo; - } - - public void setSapInfo(List sapInfo) { - this.sapInfo = sapInfo; - } - - public List getNestedNsInstanceId() { - return nestedNsInstanceId; - } - - public void setNestedNsInstanceId(List nestedNsInstanceId) { - this.nestedNsInstanceId = nestedNsInstanceId; - } - - public List getNsScaleStatus() { - return nsScaleStatus; - } - - public void setNsScaleStatus(List nsScaleStatus) { - this.nsScaleStatus = nsScaleStatus; - } - - public List getAdditionalAffinityOrAntiAffinityRule() { - return additionalAffinityOrAntiAffinityRule; - } - - public void setAdditionalAffinityOrAntiAffinityRule( - List additionalAffinityOrAntiAffinityRule) { - this.additionalAffinityOrAntiAffinityRule = additionalAffinityOrAntiAffinityRule; - } - - public NsInstanceLinks get_links() { - return _links; - } - - public void set_links(NsInstanceLinks _links) { - this._links = _links; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java b/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java deleted file mode 100644 index 08b3c63..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class NsInstanceLinks { - @NotNull - private Link self; - private List nestedNsInstances; - private Link instantiate; - private Link terminate; - private Link update; - private Link scale; - private Link heal; - - public Link getSelf() { - return self; - } - - public void setSelf(Link self) { - this.self = self; - } - - public List getNestedNsInstances() { - return nestedNsInstances; - } - - public void setNestedNsInstances(List nestedNsInstances) { - this.nestedNsInstances = nestedNsInstances; - } - - public Link getInstantiate() { - return instantiate; - } - - public void setInstantiate(Link instantiate) { - this.instantiate = instantiate; - } - - public Link getTerminate() { - return terminate; - } - - public void setTerminate(Link terminate) { - this.terminate = terminate; - } - - public Link getUpdate() { - return update; - } - - public void setUpdate(Link update) { - this.update = update; - } - - public Link getScale() { - return scale; - } - - public void setScale(Link scale) { - this.scale = scale; - } - - public Link getHeal() { - return heal; - } - - public void setHeal(Link heal) { - this.heal = heal; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java b/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java deleted file mode 100644 index 4281026..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - *
- *

- *

- * request model for instatiate - * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class NsInstantiateReq extends NsParameters { - - String nsInstanceId; - - /** - * @return Returns the nsInstanceId. - */ - public String getNsInstanceId() { - return nsInstanceId; - } - - /** - * @param nsInstanceId The nsInstanceId to set. - */ - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java b/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java deleted file mode 100644 index 559b1f7..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java +++ /dev/null @@ -1,125 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.onap.so.adapters.vfc.constant.CommonConstant; - -public class NsLcmOpOcc { - private String id; - private CommonConstant.operationState operationState; - private String statusEnteredTime; - private String nsInstanceId; - private CommonConstant.lcmOperationType lcmOperationType; - private String startTime; - private Boolean isAutomaticInvocation; - private String operationParams; - private Boolean isCancelPending; - private CommonConstant.cancelMode cancelMode; - private ProblemDetails error; - private Links links; - - public CommonConstant.lcmOperationType getLcmOperationType() { - return lcmOperationType; - } - - public void setLcmOperationType(CommonConstant.lcmOperationType lcmOperationType) { - this.lcmOperationType = lcmOperationType; - } - - public CommonConstant.cancelMode getCancelMode() { - return cancelMode; - } - - public void setCancelMode(CommonConstant.cancelMode cancelMode) { - this.cancelMode = cancelMode; - } - - public CommonConstant.operationState getOperationState() { - return operationState; - } - - public void setOperationState(CommonConstant.operationState operationState) { - this.operationState = operationState; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getStatusEnteredTime() { - return statusEnteredTime; - } - - public void setStatusEnteredTime(String statusEnteredTime) { - this.statusEnteredTime = statusEnteredTime; - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public Boolean getAutomaticInvocation() { - return isAutomaticInvocation; - } - - public void setAutomaticInvocation(Boolean automaticInvocation) { - isAutomaticInvocation = automaticInvocation; - } - - public String getOperationParams() { - return operationParams; - } - - public void setOperationParams(String operationParams) { - this.operationParams = operationParams; - } - - public Boolean getCancelPending() { - return isCancelPending; - } - - public void setCancelPending(Boolean cancelPending) { - isCancelPending = cancelPending; - } - - public ProblemDetails getError() { - return error; - } - - public void setError(ProblemDetails error) { - this.error = error; - } - - public Links getLinks() { - return links; - } - - public void setLinks(Links links) { - this.links = links; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java deleted file mode 100644 index 2dff432..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class NsLinkPortInfo { - @NotNull - private String id; - @NotNull - private ResourceHandle resourceHandle; - private NsCpHandle nsCpHandle; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ResourceHandle getResourceHandle() { - return resourceHandle; - } - - public void setResourceHandle(ResourceHandle resourceHandle) { - this.resourceHandle = resourceHandle; - } - - public NsCpHandle getNsCpHandle() { - return nsCpHandle; - } - - public void setNsCpHandle(NsCpHandle nsCpHandle) { - this.nsCpHandle = nsCpHandle; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java b/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java deleted file mode 100644 index 2088d68..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - * The operation key object for NS
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-09-15 - */ -public class NsOperationKey { - - /** - * The subscriber id - */ - private String globalSubscriberId; - - /** - * The serviceType - */ - private String serviceType; - - /** - * The service ID - */ - private String serviceId; - - /** - * The Operation ID - */ - private String operationId; - - /** - * the NS template uuid - */ - private String nodeTemplateUUID; - - /** - * @return Returns the globalSubscriberId. - */ - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - /** - * @param globalSubscriberId The globalSubscriberId to set. - */ - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - /** - * @return Returns the serviceType. - */ - public String getServiceType() { - return serviceType; - } - - /** - * @param serviceType The serviceType to set. - */ - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - /** - *
- * - * @return - * @since ONAP Amsterdam Release - */ - public String getServiceId() { - return serviceId; - } - - /** - *
- * - * @param serviceId - * @since ONAP Amsterdam Release - */ - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - /** - *
- * - * @return - * @since ONAP Amsterdam Release - */ - public String getOperationId() { - return operationId; - } - - /** - *
- * - * @param operationId - * @since ONAP Amsterdam Release - */ - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - /** - * @return Returns the nodeTemplateUUID. - */ - public String getNodeTemplateUUID() { - return nodeTemplateUUID; - } - - /** - * @param nodeTemplateUUID The nodeTemplateUUID to set. - */ - public void setNodeTemplateUUID(String nodeTemplateUUID) { - this.nodeTemplateUUID = nodeTemplateUUID; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java b/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java deleted file mode 100644 index e82ee2a..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class NsParameters { - - private List locationConstraints; - - private Map additionalParamForNs = new HashMap<>(); - - /** - * @return Returns the locationConstraints. - */ - public List getLocationConstraints() { - return locationConstraints; - } - - /** - * @param locationConstraints The locationConstraints to set. - */ - public void setLocationConstraints(List locationConstraints) { - this.locationConstraints = locationConstraints; - } - - - /** - * @return Returns the additionalParamForNs. - */ - public Map getAdditionalParamForNs() { - return additionalParamForNs; - } - - - /** - * @param additionalParamForNs The additionalParamForNs to set. - */ - public void setAdditionalParamForNs(Map additionalParamForNs) { - this.additionalParamForNs = additionalParamForNs; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java b/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java deleted file mode 100644 index a7e72ef..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -/** - *
- *

- *

- * response model of query operation status - * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class NsProgressStatus { - - String jobId; - - ResponseDescriptor responseDescriptor; - - List responseHistoryList; - - /** - * @return Returns the jobId. - */ - public String getJobId() { - return jobId; - } - - /** - * @param jobId The jobId to set. - */ - public void setJobId(String jobId) { - this.jobId = jobId; - } - - /** - * @return Returns the responseDescriptor. - */ - public ResponseDescriptor getResponseDescriptor() { - return responseDescriptor; - } - - /** - * @param responseDescriptor The responseDescriptor to set. - */ - public void setResponseDescriptor(ResponseDescriptor responseDescriptor) { - this.responseDescriptor = responseDescriptor; - } - - /** - * @return Returns the responseHistoryList. - */ - public List getResponseHistoryList() { - return responseHistoryList; - } - - /** - * @param responseHistoryList The responseHistoryList to set. - */ - public void setResponseHistoryList(List responseHistoryList) { - this.responseHistoryList = responseHistoryList; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java deleted file mode 100644 index 59acf56..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class NsScaleInfo { - @NotNull - private String nsScalingAspectId; - @NotNull - private String nsScaleLevelId; - - public String getNsScalingAspectId() { - return nsScalingAspectId; - } - - public void setNsScalingAspectId(String nsScalingAspectId) { - this.nsScalingAspectId = nsScalingAspectId; - } - - public String getNsScaleLevelId() { - return nsScaleLevelId; - } - - public void setNsScaleLevelId(String nsScaleLevelId) { - this.nsScaleLevelId = nsScaleLevelId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java b/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java deleted file mode 100644 index 6d089c0..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-26 - */ -public class NsScaleParameters { - - private List scaleNsByStepsData; - - private String scaleType; - - /** - * @return Returns the scaleNsByStepsData. - */ - public List getScaleNsByStepsData() { - return scaleNsByStepsData; - } - - /** - * @param scaleNsByStepsData The scaleNsByStepsData to set. - */ - public void setScaleNsByStepsData(List scaleNsByStepsData) { - this.scaleNsByStepsData = scaleNsByStepsData; - } - - /** - * @return Returns the scale Type. - */ - public String getScaleType() { - return scaleType; - } - - /** - * @param scaleType The scaleType to set. - */ - public void setScaleType(String scaleType) { - this.scaleType = scaleType; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java b/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java deleted file mode 100644 index 79ed02c..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -/** - *
- *

- *

- * request model for scale - * - * @author - * @version ONAP Amsterdam Release 2017-9-26 - */ -public class NsScaleReq extends NsScaleParameters { - - String nsInstanceId; - - /** - * @return Returns the nsInstanceId. - */ - public String getNsInstanceId() { - return nsInstanceId; - } - - /** - * @param nsInstanceId The nsInstanceId to set. - */ - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java deleted file mode 100644 index ed2debd..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class NsVirtualLinkInfo { - @NotNull - private String id; - @NotNull - private String nsVirtualLinkDescId; - @NotNull - private List resourceHandle; - private List linkPort; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getNsVirtualLinkDescId() { - return nsVirtualLinkDescId; - } - - public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) { - this.nsVirtualLinkDescId = nsVirtualLinkDescId; - } - - public List getResourceHandle() { - return resourceHandle; - } - - public void setResourceHandle(List resourceHandle) { - this.resourceHandle = resourceHandle; - } - - public List getLinkPort() { - return linkPort; - } - - public void setLinkPort(List linkPort) { - this.linkPort = linkPort; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java b/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java deleted file mode 100644 index b7324e5..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java +++ /dev/null @@ -1,35 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.Map; - -public class ParamsForVnf { - private String vnfProfileId; - private Map additionalParams; - - public String getVnfProfileId() { - return vnfProfileId; - } - - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - public Map getAdditionalParams() { - return additionalParams; - } - - public void setAdditionalParams(Map additionalParams) { - this.additionalParams = additionalParams; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java b/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java deleted file mode 100644 index d5d091f..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java +++ /dev/null @@ -1,44 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class PnfExtCpData { - private String cpInstanceI16; - private String cpdId; - private List cpProtocolData; - - public String getCpInstanceI16() { - return cpInstanceI16; - } - - public void setCpInstanceI16(String cpInstanceI16) { - this.cpInstanceI16 = cpInstanceI16; - } - - public String getCpdId() { - return cpdId; - } - - public void setCpdId(String cpdId) { - this.cpdId = cpdId; - } - - public List getCpProtocolData() { - return cpProtocolData; - } - - public void setCpProtocolData(List cpProtocolData) { - this.cpProtocolData = cpProtocolData; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java deleted file mode 100644 index 402cb83..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class PnfExtCpInfo { - @NotNull - private String cpInstanceId; - @NotNull - private String cpdId; - @NotNull - private List cpProtocolData; - - public String getCpInstanceI16() { - return cpInstanceId; - } - - public void setCpInstanceI16(String cpInstanceI16) { - this.cpInstanceId = cpInstanceI16; - } - - public String getCpdId() { - return cpdId; - } - - public void setCpdId(String cpdId) { - this.cpdId = cpdId; - } - - public List getCpProtocolData() { - return cpProtocolData; - } - - public void setCpProtocolData(List cpProtocolData) { - this.cpProtocolData = cpProtocolData; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java deleted file mode 100644 index a1cc11b..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class PnfInfo { - - @NotNull - private String pnfId; - @NotNull - private String pnfName; - @NotNull - private String pnfdId; - @NotNull - private String pnfdInfoId; - @NotNull - private String pnfProfileId; - private List cpData; - - /*** - * - * @return id of pnf - */ - public String getPnfId() { - return pnfId; - } - - public void setPnfId(String pnfId) { - this.pnfId = pnfId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getPnfdId() { - return pnfdId; - } - - public void setPnfdId(String pnfdId) { - this.pnfdId = pnfdId; - } - - public String getPnfProfileId() { - return pnfProfileId; - } - - public void setPnfProfileId(String pnfProfileId) { - this.pnfProfileId = pnfProfileId; - } - - public List getCpData() { - return cpData; - } - - public void setCpData(List cpData) { - this.cpData = cpData; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java b/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java deleted file mode 100644 index 8318a8c..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class PortRange { - @NotNull - private int lowerPort; - @NotNull - private int upperPort; - - public int getLowerPort() { - return lowerPort; - } - - public void setLowerPort(int lowerPort) { - this.lowerPort = lowerPort; - } - - public int getUpperPort() { - return upperPort; - } - - public void setUpperPort(int upperPort) { - this.upperPort = upperPort; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java b/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java deleted file mode 100644 index efaa5de..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java +++ /dev/null @@ -1,62 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class ProblemDetails { - private String type; - private String title; - private int status; - private String detail; - 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 int getStatus() { - return status; - } - - public void setStatus(int 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/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java b/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java deleted file mode 100644 index 062a6aa..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java +++ /dev/null @@ -1,71 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class ResourceChanges { - private List affectedVnfs; - private List affectedPnfs; - private List affectedVls; - private List affectedVnffgs; - private List affectedNss; - private List affectedSaps; - - public List getAffectedVnfs() { - return affectedVnfs; - } - - public void setAffectedVnfs(List affectedVnfs) { - this.affectedVnfs = affectedVnfs; - } - - public List getAffectedPnfs() { - return affectedPnfs; - } - - public void setAffectedPnfs(List affectedPnfs) { - this.affectedPnfs = affectedPnfs; - } - - public List getAffectedVls() { - return affectedVls; - } - - public void setAffectedVls(List affectedVls) { - this.affectedVls = affectedVls; - } - - public List getAffectedVnffgs() { - return affectedVnffgs; - } - - public void setAffectedVnffgs(List affectedVnffgs) { - this.affectedVnffgs = affectedVnffgs; - } - - public List getAffectedNss() { - return affectedNss; - } - - public void setAffectedNss(List affectedNss) { - this.affectedNss = affectedNss; - } - - public List getAffectedSaps() { - return affectedSaps; - } - - public void setAffectedSaps(List affectedSaps) { - this.affectedSaps = affectedSaps; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java b/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java deleted file mode 100644 index fbfecaa..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java +++ /dev/null @@ -1,51 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class ResourceHandle { - private String vimId; - private String resourceProviderId; - private String resourceId; - private String vimLevelResourceType; - - 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 getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - public String getVimLevelResourceType() { - return vimLevelResourceType; - } - - public void setVimLevelResourceType(String vimLevelResourceType) { - this.vimLevelResourceType = vimLevelResourceType; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java b/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java deleted file mode 100644 index 3ea51c1..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - *
- *

- *

- * response model of query operation status - * - * @author - * @version SDNO 0.5 September 3, 2016 - */ -public class ResponseDescriptor { - - String status; - - String progress; - - String statusDescription; - - Integer errorCode; - - Integer responseId; - - /** - * @return Returns the status. - */ - public String getStatus() { - return status; - } - - /** - * @param status The status to set. - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return Returns the progress. - */ - public String getProgress() { - return progress; - } - - /** - * @param progress The progress to set. - */ - public void setProgress(String progress) { - this.progress = progress; - } - - /** - * @return Returns the statusDescription. - */ - public String getStatusDescription() { - return statusDescription; - } - - /** - * @param statusDescription The statusDescription to set. - */ - public void setStatusDescription(String statusDescription) { - this.statusDescription = statusDescription; - } - - /** - * @return Returns the errorCode. - */ - public Integer getErrorCode() { - return errorCode; - } - - /** - * @param errorCode The errorCode to set. - */ - public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - } - - /** - * @return Returns the responseId. - */ - public Integer getResponseId() { - return responseId; - } - - /** - * @param responseId The responseId to set. - */ - public void setResponseId(Integer responseId) { - this.responseId = responseId; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java b/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java deleted file mode 100644 index 27c9a89..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.Map; - -/** - * The Unified Restful Reponse Class
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-09-06 - */ -public class RestfulResponse { - - // the response content - private String responseContent; - - // the response status - private int status; - - // the response header - private Map respHeaderMap; - - public RestfulResponse() { - this.status = -1; - - this.respHeaderMap = null; - } - - public int getStatus() { - return this.status; - } - - public void setStatus(int status) { - this.status = status; - } - - public Map getRespHeaderMap() { - return this.respHeaderMap; - } - - public void setRespHeaderMap(Map header) { - this.respHeaderMap = header; - } - - public int getRespHeaderInt(String key) { - if (this.respHeaderMap != null) { - String result = this.respHeaderMap.get(key); - if (result != null) { - return Integer.parseInt(result); - } - } - return -1; - } - - public long getRespHeaderLong(String key) { - if (this.respHeaderMap != null) { - String result = this.respHeaderMap.get(key); - if (result != null) { - return Long.parseLong(result); - } - } - return -1L; - } - - public String getRespHeaderStr(String key) { - if (this.respHeaderMap != null) { - return this.respHeaderMap.get(key); - } - return null; - } - - public String getResponseContent() { - return this.responseContent; - } - - public void setResponseContent(String responseString) { - this.responseContent = responseString; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/SapData.java b/src/main/java/org/onap/so/adapters/vfc/model/SapData.java deleted file mode 100644 index d8e96e2..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/SapData.java +++ /dev/null @@ -1,56 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -public class SapData { - private String sapdId; - private String sapName; - private String description; - private List sapProtocolData; - - public String getSapdId() { - return sapdId; - } - - public void setSapdId(String sapdId) { - this.sapdId = sapdId; - } - - public String getSapName() { - return sapName; - } - - public void setSapName(String sapName) { - this.sapName = sapName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getSapProtocolData() { - return sapProtocolData; - } - - public void setSapProtocolData(List sapProtocolData) { - this.sapProtocolData = sapProtocolData; - } - - - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java deleted file mode 100644 index 182aceb..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class SapInfo { - @NotNull - private String id; - @NotNull - private String sapdId; - @NotNull - private String sapName; - @NotNull - private String description; - @NotNull - private List sapProtocolInfo; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSapdId() { - return sapdId; - } - - public void setSapdId(String sapdId) { - this.sapdId = sapdId; - } - - public String getSapName() { - return sapName; - } - - public void setSapName(String sapName) { - this.sapName = sapName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List getSapProtocolInfo() { - return sapProtocolInfo; - } - - public void setSapProtocolInfo(List sapProtocolInfo) { - this.sapProtocolInfo = sapProtocolInfo; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java b/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java deleted file mode 100644 index f9d6274..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 CMCC Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -/** - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-26 - */ -public class ScaleNsByStepsData { - - /** - * scaling Direction - */ - private String scalingDirection; - - /** - * aspect ID - */ - private String aspectId; - - /** - * number of Steps - */ - private Integer numberOfSteps; - - /** - * @return Returns the scalingDirection. - */ - public String getScalingDirection() { - return scalingDirection; - } - - /** - * @param scalingDirection The scalingDirection to set. - */ - public void setScalingDirection(String scalingDirection) { - this.scalingDirection = scalingDirection; - } - - /** - * @return Returns the aspectId. - */ - public String getAspectId() { - return aspectId; - } - - /** - * @param aspectId The aspectId to set. - */ - public void setAspectId(String aspectId) { - this.aspectId = aspectId; - } - - /** - * @return Returns the numberOfSteps. - */ - public Integer getNumberOfSteps() { - return numberOfSteps; - } - - /** - * @param numberOfSteps The numberOfSteps to set. - */ - public void setNumberOfSteps(int numberOfSteps) { - this.numberOfSteps = numberOfSteps; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java b/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java deleted file mode 100644 index bd50827..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.List; - -/** - * aim to wrap List as a new list then be provided for the usage of vfc json - * - * added on 2018/01/30 by Qihui Zhao from CMCC - */ - -public class ScaleNsData { - - private List scaleNsByStepsData; - - /** - * @return Returns the scaleNsByStepsData. - */ - public List getScaleNsByStepsData() { - return scaleNsByStepsData; - } - - /** - * @param scaleNsByStepsData The scaleNsByStepsData to set. - */ - public void setScaleNsByStepsData(List scaleNsByStepsData) { - this.scaleNsByStepsData = scaleNsByStepsData; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java b/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java deleted file mode 100644 index 1939fa4..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 CMCC Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Object totally matches required VFC input json format JsonUtil.marshal will convert this Object to string - * - * added on 2018/01/30 by Qihui Zhao from CMCC - */ - -public class VFCScaleData { - - private String nsInstanceId; - - private String scaleType; - - private List scaleNsData = new ArrayList<>(); - - /** - * @return Returns the nsInstanceId. - */ - public String getNsInstanceId() { - return nsInstanceId; - } - - /** - * @param nsInstanceId The nsInstanceId to set. - */ - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - /** - * @return Returns the scale Type. - */ - public String getScaleType() { - return scaleType; - } - - /** - * @param scaleType The scaleType to set. - */ - public void setScaleType(String scaleType) { - this.scaleType = scaleType; - } - - /** - * @return Returns the scaleNsDate. - */ - public List getScaleNsData() { - return scaleNsData; - } - - /** - * The scaleNsData to set. - */ - public void setScaleNsData(List scaleNsByStepsData) { - ScaleNsData scaleNsDataObj = new ScaleNsData(); - scaleNsDataObj.setScaleNsByStepsData(scaleNsByStepsData); - - this.scaleNsData.add(scaleNsDataObj); - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java b/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java deleted file mode 100644 index 456835b..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.model; - -/** - * - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-10-18 - */ -public class VimLocation { - private String vimId; - - - /** - * @return Returns the vimId. - */ - public String getVimId() { - return vimId; - } - - - /** - * @param vimId The vimId to set. - */ - public void setVimId(String vimId) { - this.vimId = vimId; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java deleted file mode 100644 index ccd6532..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.Map; - -public class VnfInstance { - @NotNull - private String id; - private String vnfInstanceName; - private String vnfInstanceDescription; - @NotNull - private String vnfdId; - @NotNull - private String vnfProvider; - @NotNull - private String vnfProductName; - @NotNull - private String vnfSoftwareVersion; - @NotNull - private String vnfdVersion; - @NotNull - private String vnfPkgId; - private Map vnfConfigurableProperties; - private String vimId; - - private enum instantiationState { - NOT_INSTANTIATED, INSTANTIATED - }; - - private InstantiatedVnfInfo instantiatedVnfInfo; - private Map metadata; - private Map extensions; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - 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 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 getVnfPkgId() { - return vnfPkgId; - } - - public void setVnfPkgId(String vnfPkgId) { - this.vnfPkgId = vnfPkgId; - } - - public Map getVnfConfigurableProperties() { - return vnfConfigurableProperties; - } - - public void setVnfConfigurableProperties(Map vnfConfigurableProperties) { - this.vnfConfigurableProperties = vnfConfigurableProperties; - } - - public String getVimId() { - return vimId; - } - - public void setVimId(String vimId) { - this.vimId = vimId; - } - - public InstantiatedVnfInfo getInstantiatedVnfInfo() { - return instantiatedVnfInfo; - } - - public void setInstantiatedVnfInfo(InstantiatedVnfInfo instantiatedVnfInfo) { - this.instantiatedVnfInfo = instantiatedVnfInfo; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - public Map getExtensions() { - return extensions; - } - - public void setExtensions(Map extensions) { - this.extensions = extensions; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java deleted file mode 100644 index 83345fc..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class VnfInstanceData { - private String vnfInstanceId; - private String vnfProfileId; - - public String getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(String vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getVnfProfileId() { - return vnfProfileId; - } - - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java deleted file mode 100644 index 0b09d06..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class VnfLinkPortInfo { - @NotNull - private String id; - @NotNull - private ResourceHandle resourceHandle; - private String cpInstanceId; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ResourceHandle getResourceHandle() { - return resourceHandle; - } - - public void setResourceHandle(ResourceHandle resourceHandle) { - this.resourceHandle = resourceHandle; - } - - public String getCpInstanceId() { - return cpInstanceId; - } - - public void setCpInstanceId(String cpInstanceId) { - this.cpInstanceId = cpInstanceId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java deleted file mode 100644 index 5db3060..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java +++ /dev/null @@ -1,33 +0,0 @@ -/*** - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -public class VnfLocationConstraint { - private String vnfProfileId; - private LocationConstraint locationConstraints; - - public String getVnfProfileId() { - return vnfProfileId; - } - - public void setVnfProfileId(String vnfProfileId) { - this.vnfProfileId = vnfProfileId; - } - - public LocationConstraint getLocationConstraints() { - return locationConstraints; - } - - public void setLocationConstraints(LocationConstraint locationConstraints) { - this.locationConstraints = locationConstraints; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java deleted file mode 100644 index e702edc..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; - -public class VnfScaleInfo { - @NotNull - private String aspectlId; - @NotNull - private int scaleLevel; - - public String getAspectlId() { - return aspectlId; - } - - public void setAspectlId(String aspectlId) { - this.aspectlId = aspectlId; - } - - public int getScaleLevel() { - return scaleLevel; - } - - public void setScaleLevel(int scaleLevel) { - this.scaleLevel = scaleLevel; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java deleted file mode 100644 index 9f41a38..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; -import java.util.Map; - -public class VnfVirtualLinkResourceInfo { - @NotNull - private String id; - @NotNull - private String virtualLinkDescId; - @NotNull - private ResourceHandle networkResource; - private String reservationId; - private List vnfLinkPorts; - Map metadata; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getVirtualLinkDescId() { - return virtualLinkDescId; - } - - public void setVirtualLinkDescId(String virtualLinkDescId) { - this.virtualLinkDescId = virtualLinkDescId; - } - - public ResourceHandle getNetworkResource() { - return networkResource; - } - - public void setNetworkResource(ResourceHandle networkResource) { - this.networkResource = networkResource; - } - - public String getReservationId() { - return reservationId; - } - - public void setReservationId(String reservationId) { - this.reservationId = reservationId; - } - - public List getVnfLinkPorts() { - return vnfLinkPorts; - } - - public void setVnfLinkPorts(List vnfLinkPorts) { - this.vnfLinkPorts = vnfLinkPorts; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java deleted file mode 100644 index ec629ef..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class VnfcCpInfo { - @NotNull - private String id; - @NotNull - private String cpdId; - private String vnfExtCpId; - private List cpProtocolInfo; - private String vnfLinkPortId; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCpdId() { - return cpdId; - } - - public void setCpdId(String cpdId) { - this.cpdId = cpdId; - } - - public String getVnfExtCpId() { - return vnfExtCpId; - } - - public void setVnfExtCpId(String vnfExtCpId) { - this.vnfExtCpId = vnfExtCpId; - } - - public List getCpProtocolInfo() { - return cpProtocolInfo; - } - - public void setCpProtocolInfo(List cpProtocolInfo) { - this.cpProtocolInfo = cpProtocolInfo; - } - - public String getVnfLinkPortId() { - return vnfLinkPortId; - } - - public void setVnfLinkPortId(String vnfLinkPortId) { - this.vnfLinkPortId = vnfLinkPortId; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java deleted file mode 100644 index 1f7aa67..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; -import java.util.Map; - -public class VnfcResourceInfo { - @NotNull - private String id; - @NotNull - private String vduId; - @NotNull - private ResourceHandle computeResource; - private List storageResourceIds; - private String reservationId; - private List vnfcCpInfo; - private Map metadata; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getVduId() { - return vduId; - } - - public void setVduId(String vduId) { - this.vduId = vduId; - } - - public ResourceHandle getComputeResource() { - return computeResource; - } - - public void setComputeResource(ResourceHandle computeResource) { - this.computeResource = computeResource; - } - - public List getStorageResourceIds() { - return storageResourceIds; - } - - public void setStorageResourceIds(List storageResourceIds) { - this.storageResourceIds = storageResourceIds; - } - - public String getReservationId() { - return reservationId; - } - - public void setReservationId(String reservationId) { - this.reservationId = reservationId; - } - - public List getVnfcCpInfo() { - return vnfcCpInfo; - } - - public void setVnfcCpInfo(List vnfcCpInfo) { - this.vnfcCpInfo = vnfcCpInfo; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java b/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java deleted file mode 100644 index c02d517..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class VnffgInfo { - @NotNull - private String id; - @NotNull - private String vnffgdId; - @NotNull - private List vnfInstanceId; - private String pnfInfoId; - @NotNull - private List nsVirtualLinkInfoId; - @NotNull - private List nsCpHandle; - @NotNull - private List nfpInfo; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getVnffgdId() { - return vnffgdId; - } - - public void setVnffgdId(String vnffgdId) { - this.vnffgdId = vnffgdId; - } - - public List getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(List vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getPnfInfoId() { - return pnfInfoId; - } - - public void setPnfInfoId(String pnfInfoId) { - this.pnfInfoId = pnfInfoId; - } - - public List getNsVirtualLinkInfoId() { - return nsVirtualLinkInfoId; - } - - public void setNsVirtualLinkInfoId(List nsVirtualLinkInfoId) { - this.nsVirtualLinkInfoId = nsVirtualLinkInfoId; - } - - public List getNsCpHandle() { - return nsCpHandle; - } - - public void setNsCpHandle(List nsCpHandle) { - this.nsCpHandle = nsCpHandle; - } - - public List getNfpInfo() { - return nfpInfo; - } - - public void setNfpInfo(List nfpInfo) { - this.nfpInfo = nfpInfo; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java b/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java deleted file mode 100644 index 7f81dfb..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/rest/AaiUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import org.onap.so.adapters.vfc.model.RestfulResponse; - -/** - * Implement class of operating aai database table
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -public class AaiUtil { - - public static RestfulResponse addRelation(String globalSubsriberId, String serviceType, String serviceInstanceId, - String resourceInstanceId) { - // sent rest to aai to add relation for service and ns. - - return null; - } - - public static RestfulResponse removeRelation(String globalSubsriberId, String serviceType, String serviceInstanceId, - String resourceInstanceId) { - // sent rest to aai to remove relation between service an ns. - return null; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java deleted file mode 100644 index 2dcdf11..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; -import org.apache.http.HttpStatus; -import org.springframework.stereotype.Component; - -/** - * Health Check
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -@Path("/") -@Component -public class HealthCheckHandler { - - - private static final String CHECK_HTML = - "Health CheckApplication ready"; - - public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build(); - - @HEAD - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck(@QueryParam("requestId") String requestId) { - return HEALTH_CHECK_RESPONSE; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java deleted file mode 100644 index 5a89c04..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java +++ /dev/null @@ -1,265 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.NsOperationKey; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.util.JsonUtil; -import org.onap.so.adapters.vfc.util.ValidateUtil; -import org.onap.so.db.request.beans.InstanceNfvoMapping; -import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * The rest class for VF-c Adapter
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -@Component -@Path("/v1/vfcadapter") -public class VfcAdapterRest { - - private static final Logger logger = LoggerFactory.getLogger(VfcAdapterRest.class); - private static final String REQUEST_DEBUG_MSG = "body from request is {}"; - private static final String APPLICATION_EXCEPTION = "ApplicationException: "; - @Autowired - private VfcManagerSol005 vfcManagerSol005; - - @Autowired - private VfcManager driverMgr; - @Autowired - private InstanceNfvoMappingRepository instanceNfvoMappingRepository; - - public VfcAdapterRest() { - - } - - /** - * Create a NS
- * - * @param data http request - * @return - * @since ONAP Amsterdam Release - */ - @POST - @Path("/ns") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response createNfvoNs(String data) { - try { - ValidateUtil.assertObjectNotNull(data); - logger.debug(REQUEST_DEBUG_MSG + data); - NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); - RestfulResponse rsp; - if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) { - rsp = vfcManagerSol005.createNs(nsInput); - } else { - rsp = driverMgr.createNs(nsInput); - } - - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - /** - * Delete NS instance
- * - * @param data The http request - * @param nsInstanceId The NS instance id - * @return response - * @since ONAP Amsterdam Release - */ - @DELETE - @Path("/ns/{nsInstanceId}") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response deleteNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { - try { - - ValidateUtil.assertObjectNotNull(data); - logger.debug(REQUEST_DEBUG_MSG + data); - NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); - RestfulResponse rsp; - InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); - if (instanceNfvoMapping != null) { - rsp = vfcManagerSol005.deleteNs(nsOperationKey, nsInstanceId); - } else { - rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); - } - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - /** - * Query Operation job status
- * - * @param data The Http Request - * @param jobId The job id - * @return - * @since ONAP Amsterdam Release - */ - @POST - @Path("/jobs/{jobId}") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) { - try { - ValidateUtil.assertObjectNotNull(data); - logger.debug(REQUEST_DEBUG_MSG + data); - NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); - RestfulResponse rsp; - InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId); - if (instanceNfvoMapping != null) { - rsp = vfcManagerSol005.getNsProgress(nsOperationKey, jobId); - } else { - rsp = driverMgr.getNsProgress(nsOperationKey, jobId); - } - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - /** - * Instantiate NS instance
- * - * @param data The http request - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - @POST - @Path("/ns/{nsInstanceId}/instantiate") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { - try { - ValidateUtil.assertObjectNotNull(data); - logger.debug(REQUEST_DEBUG_MSG + data); - NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); - RestfulResponse rsp; - if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) { - rsp = vfcManagerSol005.instantiateNs(nsInstanceId, nsInput); - } else { - rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); - } - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - /** - * Terminate NS instance
- * - * @param data The http request - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - @POST - @Path("/ns/{nsInstanceId}/terminate") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { - try { - ValidateUtil.assertObjectNotNull(data); - logger.debug(REQUEST_DEBUG_MSG + data); - NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); - RestfulResponse rsp; - InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); - if (instanceNfvoMapping != null) { - rsp = vfcManagerSol005.terminateNs(nsOperationKey, nsInstanceId); - } else { - rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); - } - - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - /** - * Scale NS instance
- * - * @param servletReq The http request - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - @POST - @Path("/ns/{nsInstanceId}/scale") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - public Response scaleNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { - try { - ValidateUtil.assertObjectNotNull(data); - logger.debug("Scale Ns Request Received.Body from request is {}" + data); - NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); - RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput); - return buildResponse(rsp); - } catch (ApplicationException e) { - logger.debug(APPLICATION_EXCEPTION, e); - return e.buildErrorResponse(); - } - } - - - /** - * build response from restful response
- * - * @param rsp general response object - * @return - * @since ONAP Amsterdam Release - */ - private Response buildResponse(RestfulResponse rsp) { - return Response.status(rsp.getStatus()).entity(rsp.getResponseContent()).build(); - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java b/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java deleted file mode 100644 index b817b5b..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java +++ /dev/null @@ -1,492 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import java.util.HashMap; -import java.util.Map; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import org.onap.so.adapters.vfc.constant.CommonConstant.Step; -import org.onap.so.adapters.vfc.constant.DriverExceptionID; -import org.onap.so.adapters.vfc.constant.HttpCode; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.so.adapters.vfc.model.CustomerModel; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.NsCreateReq; -import org.onap.so.adapters.vfc.model.NsInstantiateReq; -import org.onap.so.adapters.vfc.model.NsOperationKey; -import org.onap.so.adapters.vfc.model.NsParameters; -import org.onap.so.adapters.vfc.model.NsProgressStatus; -import org.onap.so.adapters.vfc.model.NsScaleParameters; -import org.onap.so.adapters.vfc.model.ResponseDescriptor; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.model.VFCScaleData; -import org.onap.so.adapters.vfc.util.JsonUtil; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.adapters.vfc.util.ValidateUtil; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.onap.so.requestsdb.RequestsDbConstant; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; -import org.springframework.data.domain.Example; -import org.springframework.stereotype.Component; - -/** - * VF-C Manager
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -@Component -@Primary -public class VfcManager { - - private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class); - - /** - * nfvo url map - */ - private Map nfvoUrlMap; - - @Autowired - private ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Autowired - private RestfulUtil restfulUtil; - - - public VfcManager() { - nfvoUrlMap = new HashMap<>(); - nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL); - nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL); - nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL); - nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL); - nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL); - nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL); - } - - /** - * create network service
- * - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { - - // Step1: get service template by node type - String csarId = segInput.getNsServiceModelUUID(); - // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" - LOGGER.info("serviceTemplateId is {}, id is {}", csarId, csarId); - - LOGGER.info("create ns -> begin"); - // Step2: Prepare url and method type - String url = getUrl(null, CommonConstant.Step.CREATE); - String methodType = CommonConstant.MethodType.POST; - - // Step3: Prepare restful parameters and options - NsCreateReq oRequest = new NsCreateReq(); - oRequest.setCsarId(csarId); - oRequest.setNsName(segInput.getNsServiceName()); - oRequest.setDescription(segInput.getNsServiceDescription()); - CustomerModel context = new CustomerModel(); - context.setGlobalCustomerId(segInput.getNsOperationKey().getGlobalSubscriberId()); - context.setServiceType(segInput.getNsOperationKey().getServiceType()); - oRequest.setContext(context); - String createReq = JsonUtil.marshal(oRequest); - - // Step4: Call NFVO or SDNO lcm to create ns - RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq); - ValidateUtil.assertObjectNotNull(createRsp); - LOGGER.info("create ns response status is : {}", createRsp.getStatus()); - LOGGER.info("create ns response content is : {}", createRsp.getResponseContent()); - - // Step 5: save resource operation information - ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - status = resourceOperationStatusRepository.save(status); - if (!HttpCode.isSucess(createRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to create ns"); - status.setProgress("40"); - status.setStatusDescription("NS is created"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(createRsp.getStatus())); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); - } - @SuppressWarnings("unchecked") - Map rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); - String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID); - if (ValidateUtil.isStrEmpty(nsInstanceId)) { - LOGGER.error("Invalid instanceId from create operation"); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); - } - LOGGER.info("create ns -> end"); - LOGGER.info("save segment and operaton info -> begin"); - // Step 6: add relation between service and NS - AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(), - segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(), - nsInstanceId); - LOGGER.info("save segment and operation info -> end"); - return createRsp; - } - - /** - * delete network service
- * - * @param nsOperationKey The operation key of the NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { - LOGGER.info("delete ns -> begin"); - // Step1: prepare url and methodType - String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); - String methodType = CommonConstant.MethodType.DELETE; - - // Step2: prepare restful parameters and options - RestfulResponse deleteRsp = restfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(deleteRsp); - LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus()); - LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent()); - LOGGER.info("delete ns -> end"); - - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - if (!HttpCode.isSucess(deleteRsp.getStatus())) { - LOGGER.error("fail to delete ns"); - - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(deleteRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS); - } - - // Step3: remove relation info between service and ns - AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(), - nsOperationKey.getServiceId(), nsInstanceId); - LOGGER.info("delete segment information -> end"); - - // Step4: update service segment operation status - status.setStatus(RequestsDbConstant.Status.FINISHED); - status.setErrorCode(String.valueOf(deleteRsp.getStatus())); - status.setProgress("100"); - status.setStatusDescription("VFC resource deletion finished"); - resourceOperationStatusRepository.save(status); - LOGGER.info("update segment operaton status for delete -> end"); - - return deleteRsp; - - } - - /** - * instantiate network service
- * - * @param nsInstanceId The NS instance id - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) - throws ApplicationException { - // Call the NFVO or SDNO service to instantiate service - LOGGER.info("instantiate ns -> begin"); - - // Step1: Prepare restful parameters and options - NsInstantiateReq oRequest = new NsInstantiateReq(); - oRequest.setNsInstanceId(nsInstanceId); - NsParameters nsParameters = segInput.getNsParameters(); - oRequest.setLocationConstraints(nsParameters.getLocationConstraints()); - oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs()); - String instReq = JsonUtil.marshal(oRequest); - // Step2: prepare url and - String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); - String methodType = CommonConstant.MethodType.POST; - - RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq); - ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - ValidateUtil.assertObjectNotNull(instRsp); - if (!HttpCode.isSucess(instRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to instantiate ns"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(instRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } - LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); - LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent()); - ValidateUtil.assertObjectNotNull(instRsp.getResponseContent()); - @SuppressWarnings("unchecked") - Map rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class); - String jobId = rsp.get(CommonConstant.JOB_ID); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from instantiate operation"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(instRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); - } - LOGGER.info("instantiate ns -> end"); - // Step 3: update segment operation job id - LOGGER.info("update resource operation status job id -> begin"); - status.setJobId(jobId); - status.setProgress("100"); - status.setStatusDescription("NS initiation completed."); - resourceOperationStatusRepository.save(status); - LOGGER.info("update segment operation job id -> end"); - - return instRsp; - } - - /** - * terminate network service
- * - * @param nsOperationKey The operation key for NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { - // Step1: save segment operation info for delete process - LOGGER.info("save segment operation for delete process"); - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - resourceOperationStatusRepository.save(status); - - LOGGER.info("terminate ns -> begin"); - // Step2: prepare url and method type - String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); - String methodType = CommonConstant.MethodType.POST; - - // Step3: prepare restful parameters and options - Map reqBody = new HashMap<>(); - reqBody.put("nsInstanceId", nsInstanceId); - reqBody.put("terminationType", "graceful"); - reqBody.put("gracefulTerminationTimeout", "60"); - - // Step4: Call the NFVO or SDNO service to terminate service - RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody)); - ValidateUtil.assertObjectNotNull(terminateRsp); - LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus()); - LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent()); - // Step 3: update segment operation - if (!HttpCode.isSucess(terminateRsp.getStatus())) { - LOGGER.error("fail to instantiate ns"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(terminateRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } - @SuppressWarnings("unchecked") - Map rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class); - String jobId = rsp.get(CommonConstant.JOB_ID); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from terminate operation"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(terminateRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION); - } - LOGGER.info("terminate ns -> end"); - - LOGGER.info("update segment job id -> begin"); - status.setProgress("60"); - status.setStatusDescription("NS is termination completed"); - status.setJobId(jobId); - resourceOperationStatusRepository.save(status); - LOGGER.info("update segment job id -> end"); - - return terminateRsp; - } - - /** - * get ns progress by job Id
- * - * @param nsOperationKey The OperationKey for NS resource - * @param jobId the job id - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { - - ValidateUtil.assertObjectNotNull(jobId); - // Step 1: query the current resource operation status - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - status = resourceOperationStatusRepository.findOne(Example.of(status)) - .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); - // Step 2: start query - LOGGER.info("query ns status -> begin"); - String url = getUrl(jobId, CommonConstant.Step.QUERY); - String methodType = CommonConstant.MethodType.GET; - // prepare restful parameters and options - RestfulResponse rsp = restfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(rsp); - LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); - LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); - // Step 3:check the response staus - if (!HttpCode.isSucess(rsp.getStatus())) { - LOGGER.info("fail to query job status"); - status.setErrorCode(String.valueOf(rsp.getStatus())); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - // Step 4: Process Network Service Instantiate Response - NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class); - ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor(); - // Step 5: update segment operation progress - - status.setProgress(rspDesc.getProgress()); - status.setStatusDescription(rspDesc.getStatusDescription()); - resourceOperationStatusRepository.save(status); - - // Step 6: update segment operation status - if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress()) - && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) { - LOGGER.info("job result is succeeded, operType is {}", status.getOperType()); - status.setErrorCode(String.valueOf(rsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - - if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(status.getOperType()) - || "createInstance".equalsIgnoreCase(status.getOperType())) { - status.setStatus(RequestsDbConstant.Status.FINISHED); - } - resourceOperationStatusRepository.save(status); - } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) { - LOGGER.error("job result is failed, operType is {}", status.getOperType()); - status.setErrorCode(String.valueOf(rsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED); - status.setStatus(RequestsDbConstant.Status.ERROR); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); - } else { - LOGGER.error("unexcepted response status"); - } - LOGGER.info("query ns status -> end"); - - return rsp; - } - - /** - * Scale NS instance
- * - * @param nsInstanceId The NS instance id - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Amsterdam Release - */ - public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput) throws ApplicationException { - // Call the NFVO to scale service - LOGGER.info("scale ns -> begin"); - - // Step1: Prepare restful parameters and options - VFCScaleData oRequest = new VFCScaleData(); - oRequest.setNsInstanceId(nsInstanceId); - NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters(); - oRequest.setScaleType(nsScaleParameters.getScaleType()); - oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData()); - String scaleReq = JsonUtil.marshal(oRequest); - - // Step2: prepare url and method type - String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE); - String methodType = CommonConstant.MethodType.POST; - LOGGER.info("scale ns request is {}", scaleReq); - // Step3: Call NFVO lcm to scale ns - RestfulResponse scaleRsp = restfulUtil.send(url, methodType, scaleReq); - - ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status)) - .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); - ValidateUtil.assertObjectNotNull(scaleRsp); - if (!HttpCode.isSucess(scaleRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to scale ns"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); - resourceOperationStatusRepository.save(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS); - } - LOGGER.info("scale ns response status is {}", scaleRsp.getStatus()); - LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent()); - - ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent()); - @SuppressWarnings("unchecked") - Map rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class); - String jobId = rsp.get(CommonConstant.JOB_ID); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from scale operation"); - nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR); - nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus())); - nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED); - resourceOperationStatusRepository.save(nsOperInfo); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION); - } - - LOGGER.info("update resource operation status job id -> begin"); - // Step 4: update segment operation job id - nsOperInfo.setJobId(jobId); - resourceOperationStatusRepository.save(nsOperInfo); - LOGGER.info("update segment operation job id -> end"); - LOGGER.info("scale ns -> end"); - - return scaleRsp; - } - - /** - * get url for the operation
- * - * @param variable variable should be put in the url - * @param step step of the operation (terminate,query,delete) - * @return - * @since ONAP Amsterdam Release - */ - private String getUrl(String variable, String step) { - - String url; - String originalUrl; - originalUrl = nfvoUrlMap.get(step); - url = String.format(originalUrl, variable); - return url; - - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java b/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java deleted file mode 100644 index 9033bec..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java +++ /dev/null @@ -1,620 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.rest; - -import java.time.LocalDateTime; -import java.util.*; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import org.onap.so.adapters.vfc.constant.CommonConstant.Step; -import org.onap.so.adapters.vfc.constant.DriverExceptionID; -import org.onap.so.adapters.vfc.constant.HttpCode; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.so.adapters.vfc.model.*; -import org.onap.so.adapters.vfc.util.JsonUtil; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.adapters.vfc.util.ValidateUtil; -import org.onap.so.db.request.beans.InstanceNfvoMapping; -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; -import org.onap.so.db.request.data.repository.OperationStatusRepository; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.onap.so.requestsdb.RequestsDbConstant; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; -import org.springframework.data.domain.Example; -import org.springframework.stereotype.Component; - -/** - * VF-C Manager
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -@Component -@Primary -public class VfcManagerSol005 { - - private static final Logger LOGGER = LoggerFactory.getLogger(VfcManagerSol005.class); - - /** - * nfvo url map - */ - private Map nfvoUrlMap; - - @Autowired - private ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Autowired - private RestfulUtil restfulUtil; - - @Autowired - private OperationStatusRepository operationStatusRepository; - - @Autowired - private InstanceNfvoMappingRepository instanceNfvoMappingRepository; - - private InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping(); - - public VfcManagerSol005() { - nfvoUrlMap = new HashMap<>(); - nfvoUrlMap.put(Step.CREATE, CommonConstant.SOL005_NFVO_CREATE_URL); - nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.SOL005_NFVO_INSTANTIATE_URL); - nfvoUrlMap.put(Step.TERMINATE, CommonConstant.SOL005_NFVO_TERMINATE_URL); - nfvoUrlMap.put(Step.DELETE, CommonConstant.SOL005_NFVO_DELETE_URL); - nfvoUrlMap.put(Step.QUERY, CommonConstant.SOL005_NFVO_QUERY_URL); - nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL); - } - - /** - * create network service
- * - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Dubilin Release - */ - public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException { - - Map nfvoDetails; - // Step1: get service template by node type - String nsdId = segInput.getNsServiceModelUUID(); - // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id" - LOGGER.info("serviceTemplateId is {}, id is {}", nsdId, nsdId); - - - LOGGER.info("SOL005 create ns -> begin"); - // Step2: Prepare url and method type - String url = getUrl(null, CommonConstant.Step.CREATE); - String methodType = CommonConstant.MethodType.POST; - - // Step3: Prepare restful parameters and options - CreateNsRequest createNsRequest = new CreateNsRequest(); - createNsRequest.setNsDescription(segInput.getNsServiceDescription()); - createNsRequest.setNsdId(segInput.getNsServiceModelUUID()); - createNsRequest.setNsName(segInput.getNsServiceName()); - - String createReq = JsonUtil.marshal(createNsRequest); - RestfulResponse aaiRestfulResponse = null; - NsParameters nsParameters = segInput.getNsParameters(); - if (nsParameters.getAdditionalParamForNs().containsKey("orchestrator")) { - if (nsParameters.getAdditionalParamForNs().get("orchestrator") != null) { - String nfvo = nsParameters.getAdditionalParamForNs().get("nfvo").toString(); - aaiRestfulResponse = restfulUtil.getNfvoFromAAI(nfvo); - nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class); - url = nfvoDetails.get("url") + nfvoDetails.get("api-root") + url; - - } - } else { - LOGGER.error("Nfvo not present in AAI"); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); - } - - - // Prepare request header for createNs request. - Map requestHeader = new HashMap<>(); - requestHeader.put("GLOBALCUSTOMERID", segInput.getNsOperationKey().getGlobalSubscriberId()); - requestHeader.put("SERVICETYPE", segInput.getNsOperationKey().getServiceType()); - - // Step4: Call NFVO or SDNO lcm to create ns - LOGGER.info("Request Payload for CreateNs: " + createReq); - - RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq, requestHeader); - ValidateUtil.assertObjectNotNull(createRsp); - LOGGER.info("create ns response status is : {}", createRsp.getStatus()); - LOGGER.info("create ns response content is : {}", createRsp.getResponseContent()); - - // Step 5: save resource operation information - ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - status = resourceOperationStatusRepository.save(status); - if (!HttpCode.isSucess(createRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to create ns"); - status.setProgress("40"); - status.setStatusDescription("NS not created"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(createRsp.getStatus())); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS); - } - // TODO: Capture all the content of the response. Currently fetching ID value alone. - // Should be converted into the NsInstance.class - @SuppressWarnings("unchecked") - Map rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class); - String nsInstanceId = rsp.get(CommonConstant.SOL005_NS_INSTANCE_ID); - if (ValidateUtil.isStrEmpty(nsInstanceId)) { - LOGGER.error("Invalid instanceId from create operation"); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION); - } - - nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class); - instanceNfvoMapping.setInstanceId(nsInstanceId); - instanceNfvoMapping.setPassword(nfvoDetails.get("password")); - instanceNfvoMapping.setUsername(nfvoDetails.get("userName")); - instanceNfvoMapping.setNfvoName(nfvoDetails.get("nfvoId")); - instanceNfvoMapping.setEndpoint(nfvoDetails.get("url")); - instanceNfvoMapping.setApiRoot(nfvoDetails.get("api-root")); - instanceNfvoMappingRepository.save(instanceNfvoMapping); - LOGGER.info("create ns -> end"); - LOGGER.info("save segment and operaton info -> begin"); - // Step 6: add relation between service and NS - AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(), - segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(), - nsInstanceId); - LOGGER.info("save segment and operation info -> end"); - return createRsp; - } - - /** - * delete network service
- * - * @param nsOperationKey The operation key of the NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Dublin Release - */ - public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { - LOGGER.info("SOL005 delete ns -> begin"); - // Step1: prepare url and methodType - String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE); - String methodType = CommonConstant.MethodType.DELETE; - - // Step2: prepare restful parameters and options - RestfulResponse deleteRsp = restfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(deleteRsp); - LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus()); - LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent()); - LOGGER.info("delete ns -> end"); - - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - if (!HttpCode.isSucess(deleteRsp.getStatus())) { - LOGGER.error("fail to delete ns"); - - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(deleteRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS); - } - - // Step3: remove relation info between service and ns - AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(), - nsOperationKey.getServiceId(), nsInstanceId); - LOGGER.info("delete segment information -> end"); - - // Step4: update service segment operation status - status.setStatus(RequestsDbConstant.Status.FINISHED); - status.setErrorCode(String.valueOf(deleteRsp.getStatus())); - status.setProgress("100"); - status.setStatusDescription("VFC resource deletion finished"); - resourceOperationStatusRepository.save(status); - LOGGER.info("update segment operaton status for delete -> end"); - - return deleteRsp; - - } - - /** - * instantiate network service
- * - * @param nsInstanceId The NS instance id - * @param segInput input parameters for current node from http request - * @return - * @since ONAP Dublin Release - */ - public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) - throws ApplicationException { - // Call the NFVO or SDNO service to instantiate service - LOGGER.info("SOL005 instantiate ns -> begin"); - - // Step1: Prepare restful parameters and options - InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest(); - - NsInstantiateReq oRequest = new NsInstantiateReq(); - oRequest.setNsInstanceId(nsInstanceId); - NsParameters nsParameters = segInput.getNsParameters(); - - ArrayList vnfLocationConstraints = new ArrayList(); - for (LocationConstraint locationConstraint : nsParameters.getLocationConstraints()) { - VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint(); - vnfLocationConstraint.setVnfProfileId(locationConstraint.getVnfProfileId()); - vnfLocationConstraint.setLocationConstraints(null); - vnfLocationConstraints.add(vnfLocationConstraint); - - } - instantiateNsRequest.setAditionalParamsForNs(nsParameters.getAdditionalParamForNs()); - // Setting FlavourID which is a mandatory paramater to default - // as UUI is not sending this parameter to so - instantiateNsRequest.setNsFlavourId("default"); - String instReq = JsonUtil.marshal(instantiateNsRequest); - LOGGER.info("Request Payload for InstantiateNs: " + instReq); - // Step2: prepare url and - String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); - String methodType = CommonConstant.MethodType.POST; - instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); - - if (instanceNfvoMapping != null) { - - url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; - - } else { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - - } - // Step3: prepare restful parameters and options - Map reqBody = new HashMap<>(); - reqBody.put("terminationTime", LocalDateTime.now().toString()); - RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq); - ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), - segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - ValidateUtil.assertObjectNotNull(instRsp); - if (!HttpCode.isSucess(instRsp.getStatus())) { - LOGGER.error("update segment operation status : fail to instantiate ns"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(instRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } - LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); - LOGGER.info("response payload is {}", instRsp.getResponseContent()); - String jobId = null; - if (instRsp.getStatus() == 202) { - String jobUri = instRsp.getRespHeaderStr(CommonConstant.JOB_URI); - LOGGER.info("JOB URI" + jobUri); - jobId = jobUri.split("/")[4]; - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from instantiate operation"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(instRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); - } - - } else if (instRsp.getStatus() > 400 && instRsp.getStatus() < 600) { - LOGGER.error("ERROR while executing instantiateNs request"); - ProblemDetails problemDetails = JsonUtil.unMarshal(instRsp.getResponseContent(), ProblemDetails.class); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(instRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + problemDetails.getDetail()); - resourceOperationStatusRepository.save(status); - if (instRsp.getStatus() == 406) { - throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } else if (instRsp.getStatus() == 400) { - throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } else if (instRsp.getStatus() == 404) { - throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } else if (instRsp.getStatus() == 409) { - LOGGER.error("The operation cannot be executed currently,\n" - + "due to a conflict with the state of the resource"); - throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } else if (instRsp.getStatus() == 500) { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } else { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.FAIL_TO_INSTANTIATE_NS); - } - - } - LOGGER.info("Job id is " + jobId); - LOGGER.info("Nfvo Details" + instanceNfvoMapping.toString()); - LOGGER.info("instantiate ns -> end"); - // Step 3: update segment operation job id - LOGGER.info("update resource operation status job id -> begin"); - status.setJobId(jobId); - status.setProgress("100"); - status.setStatusDescription("NS initiation completed."); - resourceOperationStatusRepository.save(status); - instanceNfvoMapping.setJobId(jobId); - instanceNfvoMappingRepository.save(instanceNfvoMapping); - LOGGER.info("update segment operation job id -> end" + instanceNfvoMapping.toString()); - return instRsp; - } - - /** - * terminate network service
- * - * @param nsOperationKey The operation key for NS resource - * @param nsInstanceId The NS instance id - * @return - * @since ONAP Dublin Release - */ - public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException { - // Step1: save segment operation info for delete process - LOGGER.info("save segment operation for delete process"); - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - resourceOperationStatusRepository.save(status); - - LOGGER.info("SOL005 terminate ns -> begin"); - // Step2: prepare url and method type - String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE); - String methodType = CommonConstant.MethodType.POST; - - instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId); - - if (instanceNfvoMapping != null) { - - url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; - - } else { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } - // Step3: prepare restful parameters and options - Map reqBody = new HashMap<>(); - reqBody.put("terminationTime", LocalDateTime.now().toString()); - - // Step4: Call the NFVO or SDNO service to terminate service - LOGGER.info("request body for terminate NS" + JsonUtil.marshal(reqBody)); - RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody)); - ValidateUtil.assertObjectNotNull(terminateRsp); - LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus()); - LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent()); - // Step 3: update segment operation - if (!HttpCode.isSucess(terminateRsp.getStatus())) { - LOGGER.error("fail to terminate ns"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(terminateRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } - // @SuppressWarnings("unchecked") - String jobId = null; - Map rsp = new HashMap<>(); - if (terminateRsp.getStatus() == 202) { - String jobUri = terminateRsp.getRespHeaderStr(CommonConstant.JOB_URI); - jobId = jobUri.split("/")[4]; - jobId.split("/"); - if (ValidateUtil.isStrEmpty(jobId)) { - LOGGER.error("Invalid jobId from instantiate operation"); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(terminateRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, - DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); - } - rsp.put(CommonConstant.JOB_ID, jobId); - LOGGER.info("terminate ns -> end"); - LOGGER.info("update segment job id -> begin"); - status.setProgress("60"); - status.setStatusDescription("NS is termination completed"); - status.setJobId(jobId); - resourceOperationStatusRepository.save(status); - LOGGER.info("update segment job id -> end"); - } else if (terminateRsp.getStatus() > 400 && terminateRsp.getStatus() < 600) { - LOGGER.error("ERROR while executing instantiateNs request"); - ProblemDetails problemDetails = JsonUtil.unMarshal(terminateRsp.getResponseContent(), ProblemDetails.class); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setErrorCode(String.valueOf(terminateRsp.getStatus())); - status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED + problemDetails.getDetail()); - resourceOperationStatusRepository.save(status); - if (terminateRsp.getStatus() == 406) { - throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } else if (terminateRsp.getStatus() == 400) { - throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } else if (terminateRsp.getStatus() == 404) { - throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } else if (terminateRsp.getStatus() == 409) { - LOGGER.error("The operation cannot be executed currently,\n" - + "due to a conflict with the state of the resource"); - throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } else if (terminateRsp.getStatus() == 500) { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } else { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS); - } - - } - instanceNfvoMapping.setJobId(jobId); - instanceNfvoMappingRepository.save(instanceNfvoMapping); - terminateRsp.setResponseContent(rsp.toString()); - return terminateRsp; - } - - /** - * get ns progress by job Id
- * - * @param nsOperationKey The OperationKey for NS resource - * @param jobId the job id - * @return - * @since ONAP Dublin Release - */ - public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException { - - ValidateUtil.assertObjectNotNull(jobId); - // Step 1: query the current resource operation status - ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), - nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - // status = resourceOperationStatusRepository.findOne(Example.of(status)) - // .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status")); - - // Get NFVO details - instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId); - - // Step 2: start query - LOGGER.info("SOL005 query ns status -> begin"); - String url = getUrl(jobId, CommonConstant.Step.QUERY); - String methodType = CommonConstant.MethodType.GET; - if (instanceNfvoMapping != null) { - - url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url; - - } else { - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - - // prepare restful parameters and options - RestfulResponse rsp = restfulUtil.send(url, methodType, ""); - ValidateUtil.assertObjectNotNull(rsp); - LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); - LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); - // Step 3:check the response staus - if (!HttpCode.isSucess(rsp.getStatus())) { - LOGGER.info("fail to query job status"); - ProblemDetails problemDetails = JsonUtil.unMarshal(rsp.getResponseContent(), ProblemDetails.class); - status.setErrorCode(String.valueOf(rsp.getStatus())); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED + problemDetails.getDetail()); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - // Step 4: Process Network Service Instantiate Response - NsLcmOpOcc nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsLcmOpOcc.class); - if (CommonConstant.operationState.FAILED.equals(nsProgress.getOperationState())) { - LOGGER.info("NS instantiate fails"); - status.setErrorCode(String.valueOf(rsp.getStatus())); - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setStatusDescription( - CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + nsProgress.getError().getDetail()); - resourceOperationStatusRepository.save(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS); - } - // Step 5: update segment operation progress - - if (nsProgress.getOperationState().equals(CommonConstant.operationState.PROCESSING)) { - status.setProgress("40"); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - status.setStatusDescription("NS operation is in progress"); - resourceOperationStatusRepository.save(status); - updateOperationStatusBasedOnResourceStatus(status); - } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.PARTIALLY_COMPLETED)) { - status.setProgress("60"); - status.setStatus(RequestsDbConstant.Status.PROCESSING); - status.setStatusDescription("NS operation is partially completed"); - resourceOperationStatusRepository.save(status); - } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.COMPLETED)) { - status.setStatus(RequestsDbConstant.Status.FINISHED); - status.setProgress("100"); - status.setStatusDescription("NS operation is Completed"); - resourceOperationStatusRepository.save(status); - updateOperationStatusBasedOnResourceStatus(status); - - } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED) - || nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED_TEMP)) { - status.setStatus(RequestsDbConstant.Status.ERROR); - status.setProgress("0"); - status.setStatusDescription("NS operation Failed"); - resourceOperationStatusRepository.save(status); - updateOperationStatusBasedOnResourceStatus(status); - throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); - } else { - LOGGER.error("unexcepted response status"); - - } - return rsp; - } - - /** - * get url for the operation
- * - * @param variable variable should be put in the url - * @param step step of the operation (terminate,query,delete) - * @return - * @since ONAP Dublin Release - */ - private String getUrl(String variable, String step) { - - String url; - String originalUrl; - originalUrl = nfvoUrlMap.get(step); - url = String.format(originalUrl, variable); - return url; - - } - - private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) { - String serviceId = operStatus.getServiceId(); - String operationId = operStatus.getOperationId(); - - LOGGER.debug("Request database - update Operation Status Based On Resource Operation Status with service Id: " - + "{}, operationId: {}", serviceId, operationId); - - List lstResourceStatus = - resourceOperationStatusRepository.findByServiceIdAndOperationId(serviceId, operationId); - if (lstResourceStatus == null) { - LOGGER.error("Unable to retrieve resourceOperStatus Object by ServiceId: {} operationId: {}", serviceId, - operationId); - return; - } - - // count the total progress - int resourceCount = lstResourceStatus.size(); - int progress = 0; - boolean isFinished = true; - for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) { - progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount; - if (RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatu.getStatus())) { - isFinished = false; - } - } - - OperationStatus serviceOperStatus = - operationStatusRepository.findOneByServiceIdAndOperationId(serviceId, operationId); - if (serviceOperStatus == null) { - String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId - + " operationId: " + operationId; - LOGGER.error(error); - - serviceOperStatus = new OperationStatus(); - serviceOperStatus.setOperationId(operationId); - serviceOperStatus.setServiceId(serviceId); - } - - progress = progress > 100 ? 100 : progress; - serviceOperStatus.setProgress(String.valueOf(progress)); - serviceOperStatus.setOperationContent(operStatus.getStatusDescription()); - // if current resource failed. service failed. - if (RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) { - serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR); - serviceOperStatus.setReason(operStatus.getStatusDescription()); - } else if (isFinished) { - // if finished - serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED); - serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED); - } - - operationStatusRepository.save(serviceOperStatus); - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java deleted file mode 100644 index 04109bd..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.util; - -import java.io.IOException; -import org.onap.so.logger.LoggingAnchor; -import org.onap.so.adapters.vfc.constant.HttpCode; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.logger.MessageEnum; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Interface for json analyzing.
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -public class JsonUtil { - - /** - * Log service - */ - private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class); - - /** - * Mapper. - */ - private static final ObjectMapper MAPPER = new ObjectMapper(); - private static final String UNMARSHAL_FAIL_MSG = "fail to unMarshal json"; - static { - MAPPER.setConfig(MAPPER.getDeserializationConfig().without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); - MAPPER.setSerializationInclusion(Include.NON_NULL); - } - - /** - * Constructor
- *

- *

- * - * @since ONAP Amsterdam Release 2017-9-6 - */ - private JsonUtil() { - - } - - /** - * Parse the string in form of json.
- * - * @param jsonstr json string. - * @param type that convert json string to - * @return model object - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static T unMarshal(String jsonstr, Class type) throws ApplicationException { - try { - return MAPPER.readValue(jsonstr, type); - } catch (IOException e) { - logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e); - throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); - } - } - - /** - * Parse the string in form of json.
- * - * @param jsonstr json string. - * @param type that convert json string to - * @return model object - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static T unMarshal(String jsonstr, TypeReference type) throws ApplicationException { - try { - return MAPPER.readValue(jsonstr, type); - } catch (IOException e) { - logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e); - throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); - } - } - - /** - * Convert object to json string.
- * - * @param srcObj data object - * @return json string - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static String marshal(Object srcObj) throws ApplicationException { - try { - return MAPPER.writeValueAsString(srcObj); - } catch (IOException e) { - logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcessError.getValue(), "fail to marshal json", e); - throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!"); - } - } - - /** - * Get mapper.
- * - * @return mapper - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static ObjectMapper getMapper() { - return MAPPER; - } -} diff --git a/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java deleted file mode 100644 index 54a2a98..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ /dev/null @@ -1,393 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018. - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.util; - -import java.net.HttpURLConnection; -import java.net.SocketTimeoutException; -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.logger.LoggingAnchor; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.conn.ConnectTimeoutException; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.logger.MessageEnum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -/** - *
- *

- *

- * utility to invoke restclient - * - * @author - * @version ONAP Amsterdam Release 2017-9-6 - */ -@Component -public class RestfulUtil { - - /** - * Log service - */ - private static final Logger logger = LoggerFactory.getLogger(RestfulUtil.class); - - private static final int DEFAULT_TIME_OUT = 60000; - - private static final String ONAP_IP = "ONAP_IP"; - - private static final String DEFAULT_MSB_IP = "127.0.0.1"; - - private static final Integer DEFAULT_MSB_PORT = 80; - - private static final String VFC_ADAPTER = "VFC Adapter"; - - @Autowired - private Environment env; - - @Autowired - private HttpClient client; - - public String getMsbHost() { - // MSB_IP will be set as ONAP_IP environment parameter in install flow. - String msbIp = System.getenv().get(ONAP_IP); - // if ONAP IP is not set. get it from config file. - if (null == msbIp || msbIp.isEmpty()) { - msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP); - } - Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT); - - String msbEndpoint = UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString(); - logger.debug("msbEndpoint in vfc adapter: {}", msbEndpoint); - - return msbEndpoint; - } - - private RestfulUtil() { - - } - - - public RestfulResponse send(String msbUrl, String methodType, String content, Map requestHeader) { - // String msbUrl = getMsbHost() + url; - logger.debug("Begin to sent message " + methodType + ": " + msbUrl); - - HttpRequestBase method = null; - HttpResponse httpResponse = null; - - try { - int timeout = DEFAULT_TIME_OUT; - - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout).build(); - - HttpClient client = HttpClientBuilder.create().build(); - - if ("POST".equalsIgnoreCase(methodType)) { - HttpPost httpPost = new HttpPost(msbUrl); - httpPost.setConfig(requestConfig); - for (String key : requestHeader.keySet()) { - httpPost.setHeader(key, requestHeader.get(key)); - } - httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPost; - } else if ("PUT".equalsIgnoreCase(methodType)) { - HttpPut httpPut = new HttpPut(msbUrl); - httpPut.setConfig(requestConfig); - httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPut; - } else if ("GET".equalsIgnoreCase(methodType)) { - HttpGet httpGet = new HttpGet(msbUrl); - httpGet.setConfig(requestConfig); - method = httpGet; - } else if ("DELETE".equalsIgnoreCase(methodType)) { - HttpDelete httpDelete = new HttpDelete(msbUrl); - httpDelete.setConfig(requestConfig); - method = httpDelete; - } - - // now VFC have no auth - // String userCredentials = - // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, - // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - // String authorization = "Basic " + - // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - // method.setHeader("Authorization", authorization); - - httpResponse = client.execute(method); - Map responseHeader = new HashMap<>(); - String responseContent = null; - if (httpResponse.getEntity() != null) { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - Header[] httpResponseAllHeaders = httpResponse.getAllHeaders(); - for (Header header : httpResponseAllHeaders) { - responseHeader.put(header.getName(), header.getValue()); - - } - } - - int statusCode = httpResponse.getStatusLine().getStatusCode(); - String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); - - logger.debug("VFC Response: {} {}", statusCode, - statusMessage + (responseContent == null ? "" : System.lineSeparator() + responseContent)); - - if (httpResponse.getStatusLine().getStatusCode() >= 300) { - String errMsg = "VFC returned " + statusCode + " " + statusMessage; - logError(errMsg); - return createResponse(statusCode, errMsg); - } - - httpResponse = null; - - if (null != method) { - method.reset(); - } else { - logger.debug("method is NULL:"); - } - - method = null; - return createResponse(statusCode, responseContent, responseHeader); - - } catch (SocketTimeoutException | ConnectTimeoutException e) { - String errMsg = "Request to VFC timed out"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); - - } catch (Exception e) { - String errMsg = "Error processing request to VFC"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); - - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - } catch (Exception e) { - logger.debug("Exception :", e); - } - } - - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - logger.debug("Exception :", e); - } - } - } - } - - public RestfulResponse send(String msbUrl, String methodType, String content) { - if (!msbUrl.contains("http")) { - msbUrl = getMsbHost() + msbUrl; - } - // String msbUrl = getMsbHost() + url; - logger.debug("Begin to sent message " + methodType + ": " + msbUrl); - - HttpRequestBase method = null; - HttpResponse httpResponse = null; - - try { - int timeout = DEFAULT_TIME_OUT; - - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout).build(); - - if ("POST".equalsIgnoreCase(methodType)) { - HttpPost httpPost = new HttpPost(msbUrl); - httpPost.setConfig(requestConfig); - httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPost; - } else if ("PUT".equalsIgnoreCase(methodType)) { - HttpPut httpPut = new HttpPut(msbUrl); - httpPut.setConfig(requestConfig); - httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPut; - } else if ("GET".equalsIgnoreCase(methodType)) { - HttpGet httpGet = new HttpGet(msbUrl); - httpGet.setConfig(requestConfig); - method = httpGet; - } else if ("DELETE".equalsIgnoreCase(methodType)) { - HttpDelete httpDelete = new HttpDelete(msbUrl); - httpDelete.setConfig(requestConfig); - method = httpDelete; - } - - // now VFC have no auth - // String userCredentials = - // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, - // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - // String authorization = "Basic " + - // DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - // method.setHeader("Authorization", authorization); - - httpResponse = client.execute(method); - Map responseHeader = new HashMap<>(); - String responseContent = null; - if (httpResponse.getEntity() != null) { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - Header[] httpResponseAllHeaders = httpResponse.getAllHeaders(); - for (Header header : httpResponseAllHeaders) { - responseHeader.put(header.getName(), header.getValue()); - - } - } - - int statusCode = httpResponse.getStatusLine().getStatusCode(); - String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); - - logger.debug("VFC Response: " + statusCode + " " + statusMessage - + (responseContent == null ? "" : System.lineSeparator() + responseContent)); - - if (httpResponse.getStatusLine().getStatusCode() >= 300) { - String errMsg = "VFC returned " + statusCode + " " + statusMessage; - logError(errMsg); - return createResponse(statusCode, errMsg); - } - - httpResponse = null; - - if (null != method) { - method.reset(); - } else { - logger.debug("method is NULL:"); - } - - method = null; - return createResponse(statusCode, responseContent, responseHeader); - - } catch (SocketTimeoutException | ConnectTimeoutException e) { - String errMsg = "Request to VFC timed out"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); - - } catch (Exception e) { - String errMsg = "Error processing request to VFC"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); - - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - } catch (Exception e) { - logger.debug("Exception :", e); - } - } - - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - logger.debug("Exception :", e); - } - } - } - } - - public RestfulResponse getNfvoFromAAI(String nfvo) { - HttpRequestBase method = null; - HttpResponse httpResponse = null; - String endPoint = getMsbHost() + "/api/aai-esr-server/v1/nfvos/" + nfvo; - logger.info("Endpoint URL" + endPoint); - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(DEFAULT_TIME_OUT) - .setConnectTimeout(DEFAULT_TIME_OUT).setConnectionRequestTimeout(DEFAULT_TIME_OUT).build(); - HttpClient client = HttpClientBuilder.create().build(); - HttpGet httpGet = new HttpGet(endPoint); - httpGet.setConfig(requestConfig); - String encoding = Base64.getEncoder().encodeToString(("AAI:AAI").getBytes()); - httpGet.setHeader("Authorization", "Basic " + encoding); - method = httpGet; - String responseContent = null; - Map responseHeader = null; - try { - httpResponse = client.execute(method); - if (httpResponse.getEntity() != null) { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - } - - int statusCode = httpResponse.getStatusLine().getStatusCode(); - String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); - - logger.debug("AAI Response: " + statusCode + " " + statusMessage - + (responseContent == null ? "" : System.lineSeparator() + responseContent)); - - if (httpResponse.getStatusLine().getStatusCode() >= 300) { - String errMsg = "AAI returned " + statusCode + " " + statusMessage; - logError(errMsg); - return createResponse(statusCode, errMsg); - } - } catch (Exception e) { - String errMsg = "Error processing request to AAI"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg); - } - return createResponse(200, responseContent); - } - - private static void logError(String errMsg, Throwable t) { - logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, - ErrorCode.AvailabilityError.getValue(), errMsg, t); - } - - private static void logError(String errMsg) { - logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, - ErrorCode.AvailabilityError.toString(), errMsg); - } - - private static RestfulResponse createResponse(int statusCode, String content) { - RestfulResponse rsp = new RestfulResponse(); - rsp.setStatus(statusCode); - rsp.setResponseContent(content); - return rsp; - } - - private static RestfulResponse createResponse(int statusCode, String content, Map responseHeader) { - RestfulResponse rsp = new RestfulResponse(); - rsp.setStatus(statusCode); - rsp.setRespHeaderMap(responseHeader); - rsp.setResponseContent(content); - return rsp; - } - -} diff --git a/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java b/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java deleted file mode 100644 index f56f5af..0000000 --- a/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.util; - -import org.onap.so.adapters.vfc.constant.HttpCode; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ValidateUtil { - - /** - * Log server. - */ - private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class); - - /** - * Constructor
- *

- *

- * - * @since ONAP Amsterdam Release 2017-9-6 - */ - private ValidateUtil() { - - } - - /** - * Assert String parameter.
- * - * @param paramValue parameter data - * @param paramName parameter name - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static void assertStringNotNull(String paramValue, String paramName) throws ApplicationException { - if (null != paramValue && !paramValue.isEmpty()) { - return; - } - - LOGGER.error(paramName + ": Parameter is null or empty."); - throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter."); - } - - /** - * Assert object is null.
- * - * @param object data object - * @since ONAP Amsterdam Release 2017-9-6 - */ - public static void assertObjectNotNull(Object object) throws ApplicationException { - if (null == object) { - LOGGER.error("Object is null."); - throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null."); - } - - } - - /** - *
- * - * @param str - * @return - * @since ONAP Amsterdam Release - */ - public static boolean isStrEmpty(String str) { - return null == str || str.isEmpty(); - } -} diff --git a/src/main/resources/application-aaf.yaml b/src/main/resources/application-aaf.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/application-basic.yaml b/src/main/resources/application-basic.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml deleted file mode 100644 index 4a500b3..0000000 --- a/src/main/resources/application.yaml +++ /dev/null @@ -1,37 +0,0 @@ - -server: - port: 8080 - tomcat: - max-threads: 50 - -mso: - site-name: unknown - logPath: ./logs/vfc/ - -spring: - datasource: - jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb - username: ${DB_USERNAME} - password: ${DB_PASSWORD} - driver-class-name: org.mariadb.jdbc.Driver - jpa: - show-sql: false - hibernate: - dialect: org.hibernate.dialect.MySQL5Dialect - ddl-auto: validate - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable-lazy-load-no-trans: true - -#Actuator -management: - endpoints: - web: - base-path: /manage - exposure: - include: "*" - metrics: - se-global-registry: false - export: - prometheus: - enabled: true # Whether exporting of metrics to Prometheus is enabled. - step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file diff --git a/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java b/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java deleted file mode 100644 index c0305f1..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ============LICENSE_START======================================================= ONAP : SO - * ================================================================================ Copyright (C) 2018 TechMahindra - * ================================================================================ Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.exceptions; - -import static org.junit.Assert.*; -import org.junit.Test; - -public class ApplicationExceptionTest { - private ApplicationException application = new ApplicationException(500, null); - - @Test - public void testApplicationException() { - application.setErrorCode(500); - application.setErrorMsg("ErrorMsg"); - assertEquals(application.getErrorCode(), 500); - assertEquals(application.getErrorMsg(), "ErrorMsg"); - } - - @Test - public void testbuildErrorResponse() { - assert (application.buildErrorResponse() != null); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java deleted file mode 100644 index 1fedac9..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class AddPnfDataTest { - AddPnfData pnfData = new AddPnfData(); - - @Test - public void getPnfId() { - pnfData.getPnfId(); - } - - - @Test - public void setPnfId() { - pnfData.setPnfId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfName() { - pnfData.getPnfName(); - } - - @Test - public void setPnfName() { - pnfData.setPnfName("Router"); - } - - @Test - public void getPnfdId() { - pnfData.getPnfdId(); - } - - @Test - public void setPnfdId() { - pnfData.setPnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfProfileId() { - pnfData.getPnfProfileId(); - } - - @Test - public void setPnfProfileId() { - pnfData.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpData() { - pnfData.getCpData(); - } - - @Test - public void setCpData() { - pnfData.setCpData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(PnfExtCpData pnfExtCpData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public PnfExtCpData get(int index) { - return null; - } - - @Override - public PnfExtCpData set(int index, PnfExtCpData element) { - return null; - } - - @Override - public void add(int index, PnfExtCpData element) { - - } - - @Override - public PnfExtCpData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java deleted file mode 100644 index 9444efd..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AddressRangeTest { - AddressRange addressRange = new AddressRange(); - - @Test - public void getMinAddress() { - addressRange.getMinAddress(); - } - - @Test - public void setMinAddress() { - addressRange.setMinAddress("192.168.10.10"); - } - - @Test - public void getMaxAddress() { - addressRange.getMaxAddress(); - } - - @Test - public void setMaxAddress() { - addressRange.setMaxAddress("192.168.10.10"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java deleted file mode 100644 index 06c52e2..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedNsTest { - - AffectedNs affectedNs = new AffectedNs(); - - @Test - public void getNsInstanceId() { - affectedNs.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() { - affectedNs.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsdId() { - affectedNs.getNsdId(); - } - - @Test - public void setNsdId() { - affectedNs.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java deleted file mode 100644 index beecbe0..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedPnfTest { - AffectedPnf affectedPnf = new AffectedPnf(); - - @Test - public void getPnfid() { - affectedPnf.getPnfid(); - } - - @Test - public void setPnfid() { - affectedPnf.setPnfid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfdid() { - affectedPnf.getPnfdid(); - } - - @Test - public void setPnfdid() { - affectedPnf.setPnfdid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfProfileId() { - affectedPnf.getPnfProfileId(); - } - - @Test - public void setPnfProfileId() { - affectedPnf.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getPnfName() { - affectedPnf.getPnfName(); - } - - @Test - public void setPnfName() { - affectedPnf.setPnfName("Router"); - } - - @Test - public void getCpInstanceId() { - affectedPnf.getCpInstanceId(); - } - - @Test - public void setCpInstanceId() { - affectedPnf.setCpInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java deleted file mode 100644 index b96fe32..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedSapTest { - AffectedSap affectedSap = new AffectedSap(); - - @Test - public void getSapInstanceId() { - affectedSap.getSapInstanceId(); - } - - @Test - public void setSapInstanceId() { - affectedSap.setSapInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapdId() { - affectedSap.getSapdId(); - } - - @Test - public void setSapdId() { - affectedSap.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapName() { - affectedSap.getSapName(); - } - - @Test - public void setSapName() { - affectedSap.setSapName("Dummy SAP"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java deleted file mode 100644 index dbc6d08..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVirtualLinkTest { - AffectedVirtualLink affectedVirtualLink = new AffectedVirtualLink(); - - @Test - public void getNsVirtualLinkInstanceId() { - affectedVirtualLink.getNsVirtualLinkInstanceId(); - } - - @Test - public void setNsVirtualLinkInstanceId() { - affectedVirtualLink.setNsVirtualLinkInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsVirtualLinkDescId() { - affectedVirtualLink.getNsVirtualLinkDescId(); - } - - @Test - public void setNsVirtualLinkDescId() { - affectedVirtualLink.setNsVirtualLinkDescId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVlProfileId() { - affectedVirtualLink.getVlProfileId(); - } - - @Test - public void setVlProfileId() { - affectedVirtualLink.setVlProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java deleted file mode 100644 index 810f32d..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVnfTest { - AffectedVnf affectedVnf = new AffectedVnf(); - - @Test - public void getVnfInstanceId() { - affectedVnf.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - affectedVnf.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfdId() { - affectedVnf.getVnfdId(); - } - - @Test - public void setVnfdId() { - affectedVnf.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - affectedVnf.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - affectedVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfName() { - affectedVnf.getVnfName(); - } - - @Test - public void setVnfName() { - affectedVnf.setVnfName("Dummy Vnf Name"); - } - - @Test - public void getChangedInfo() { - affectedVnf.getChangedInfo(); - } - - @Test - public void setChangedInfo() { - affectedVnf.setChangedInfo(new ChangedInfo()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java deleted file mode 100644 index 0d56701..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class AffectedVnffgTest { - AffectedVnffg affectedVnffg = new AffectedVnffg(); - - @Test - public void getVnffgInstanceId() { - affectedVnffg.getVnffgInstanceId(); - } - - @Test - public void setVnffgInstanceId() { - affectedVnffg.setVnffgInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnffgdId() { - affectedVnffg.getVnffgdId(); - } - - @Test - public void setVnffgdId() { - affectedVnffg.setVnffgdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java b/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java deleted file mode 100644 index 99a40e4..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class AffinityOrAntiAffinityRuleTest { - AffinityOrAntiAffinityRule affinityOrAntiAffinityRule = new AffinityOrAntiAffinityRule(); - - @Test - public void getVnfdId() { - affinityOrAntiAffinityRule.getVnfdId(); - } - - @Test - public void setVnfdId() { - affinityOrAntiAffinityRule.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - affinityOrAntiAffinityRule.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - affinityOrAntiAffinityRule.setVnfProfileId(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getVnfInstanceId() { - affinityOrAntiAffinityRule.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - affinityOrAntiAffinityRule.setVnfInstanceId(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java deleted file mode 100644 index 41077fb..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ChangedInfoTest { - ChangedInfo changedInfo = new ChangedInfo(); - - @Test - public void getChangedVnfInfo() { - changedInfo.getChangedVnfInfo(); - } - - @Test - public void setChangedVnfInfo() { - changedInfo.setChangedVnfInfo(new ModifyVnfInfoData()); - } - - @Test - public void getChangedExtConnectivity() { - changedInfo.getChangedExtConnectivity(); - } - - @Test - public void setChangedExtConnectivity() { - changedInfo.setChangedExtConnectivity(new ExtVirtualLinkInfo()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java b/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java deleted file mode 100644 index e9c011b..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CivicAddressElementTest { - CivicAddressElement civicAddressElement = new CivicAddressElement(); - - @Test - public void getCaType() { - civicAddressElement.getCaType(); - } - - @Test - public void setCaType() { - civicAddressElement.setCaType(12); - } - - @Test - public void getCaValue() { - civicAddressElement.getCaValue(); - } - - @Test - public void setCaValue() { - civicAddressElement.setCaValue("Dummy Ca value"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java deleted file mode 100644 index e47d02c..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CpProtocolDataTest { - CpProtocolData cpProtocolData = new CpProtocolData(); - - @Test - public void getLayerProtocol() { - cpProtocolData.getLayerProtocol(); - } - - @Test - public void setLayerProtocol() { - cpProtocolData.setLayerProtocol("BGP"); - } - - @Test - public void getIpOverEthernet() { - cpProtocolData.getIpOverEthernet(); - } - - @Test - public void setIpOverEthernet() { - cpProtocolData.setIpOverEthernet(new IpOverEthernetAddressData()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java b/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java deleted file mode 100644 index a2a6ae4..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class CreateNsRequestTest { - CreateNsRequest createNsRequest = new CreateNsRequest(); - - @Test - public void getNsdId() { - createNsRequest.getNsdId(); - } - - @Test - public void setNsdId() { - createNsRequest.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getNsDescription() { - createNsRequest.getNsDescription(); - } - - @Test - public void setNsDescription() { - createNsRequest.setNsDescription("Dummy description"); - } - - @Test - public void getNsName() { - createNsRequest.getNsName(); - } - - @Test - public void setNsName() { - createNsRequest.setNsName("Dummy Name"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java b/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java deleted file mode 100644 index 548d8b3..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class CustomerModelTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - CustomerModel customerModel = new CustomerModel(); - - @Test - public void getGlobalCustomerId() throws Exception { - customerModel.getGlobalCustomerId(); - } - - @Test - public void setGlobalCustomerId() throws Exception { - customerModel.setGlobalCustomerId("test"); - } - - @Test - public void getServiceType() throws Exception { - customerModel.getServiceType(); - } - - @Test - public void setServiceType() throws Exception { - customerModel.setServiceType("service"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java deleted file mode 100644 index 92cec88..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExtLinkPortInfoTest { - - ExtLinkPortInfo extLinkPortInfo = new ExtLinkPortInfo(); - - @Test - public void getId() { - extLinkPortInfo.getId(); - } - - @Test - public void setId() { - extLinkPortInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceHandle() { - extLinkPortInfo.getResourceHandle(); - } - - @Test - public void setResourceHandle() { - extLinkPortInfo.setResourceHandle(new ResourceHandle()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java deleted file mode 100644 index c455b36..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExtVirtualLinkInfoTest { - ExtVirtualLinkInfo extVirtualLinkInfo = new ExtVirtualLinkInfo(); - - @Test - public void getId() { - extVirtualLinkInfo.getId(); - } - - @Test - public void setId() { - extVirtualLinkInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceHandle() { - extVirtualLinkInfo.getResourceHandle(); - } - - @Test - public void setResourceHandle() { - extVirtualLinkInfo.setResourceHandle(new ResourceHandle()); - } - - @Test - public void getExtLinkPorts() { - extVirtualLinkInfo.getExtLinkPorts(); - } - - @Test - public void setExtLinkPorts() { - extVirtualLinkInfo.setExtLinkPorts(new ExtLinkPortInfo()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java b/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java deleted file mode 100644 index f27b041..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class InstantiateNsRequestTest { - InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest(); - - @Test - public void getNsFlavourId() { - instantiateNsRequest.getNsFlavourId(); - } - - @Test - public void setNsFlavourId() { - instantiateNsRequest.setNsFlavourId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapData() { - instantiateNsRequest.getSapData(); - } - - @Test - public void setSapData() { - instantiateNsRequest.setSapData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(SapData sapData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public SapData get(int index) { - return null; - } - - @Override - public SapData set(int index, SapData element) { - return null; - } - - @Override - public void add(int index, SapData element) { - - } - - @Override - public SapData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAddpnfData() { - instantiateNsRequest.getAddpnfData(); - } - - @Test - public void setAddpnfData() { - instantiateNsRequest.setAddpnfData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AddPnfData addPnfData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AddPnfData get(int index) { - return null; - } - - @Override - public AddPnfData set(int index, AddPnfData element) { - return null; - } - - @Override - public void add(int index, AddPnfData element) { - - } - - @Override - public AddPnfData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getVnfInstanceData() { - instantiateNsRequest.getVnfInstanceData(); - } - - @Test - public void setVnfInstanceData() { - instantiateNsRequest.setVnfInstanceData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(VnfInstanceData vnfInstanceData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public VnfInstanceData get(int index) { - return null; - } - - @Override - public VnfInstanceData set(int index, VnfInstanceData element) { - return null; - } - - @Override - public void add(int index, VnfInstanceData element) { - - } - - @Override - public VnfInstanceData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getNestedNsInstanceId() { - instantiateNsRequest.getNestedNsInstanceId(); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java b/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java deleted file mode 100644 index edf6346..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class IpAddressesTest { - IpAddresses ipAddresses = new IpAddresses(); - - @Test - public void getType() { - ipAddresses.getType(); - } - - @Test - public void setType() { - ipAddresses.setType("Dummy Type"); - } - - @Test - public void getFixedAddresses() { - ipAddresses.getFixedAddresses(); - } - - @Test - public void setFixedAddresses() { - ipAddresses.setFixedAddresses(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(String s) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public String get(int index) { - return null; - } - - @Override - public String set(int index, String element) { - return null; - } - - @Override - public void add(int index, String element) { - - } - - @Override - public String remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getNumDynamicAddresses() { - ipAddresses.getNumDynamicAddresses(); - } - - @Test - public void setNumDynamicAddresses() { - ipAddresses.setNumDynamicAddresses(5); - } - - @Test - public void getAddressRange() { - ipAddresses.getAddressRange(); - } - - @Test - public void setAddressRange() { - ipAddresses.setAddressRange(new AddressRange()); - } - - @Test - public void getSubnetId() { - ipAddresses.getSubnetId(); - } - - @Test - public void setSubnetId() { - ipAddresses.setSubnetId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java deleted file mode 100644 index 0088cdc..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class IpOverEthernetAddressDataTest { - IpOverEthernetAddressData ipOverEthernetAddressData = new IpOverEthernetAddressData(); - - @Test - public void getMacAddress() { - ipOverEthernetAddressData.getMacAddress(); - } - - @Test - public void setMacAddress() { - ipOverEthernetAddressData.setMacAddress("4e:86:9f:62:c1:bf"); - } - - @Test - public void getIpAddresses() { - ipOverEthernetAddressData.getIpAddresses(); - } - - @Test - public void setIpAddresses() { - ipOverEthernetAddressData.setIpAddresses(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(IpAddresses ipAddresses) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public IpAddresses get(int index) { - return null; - } - - @Override - public IpAddresses set(int index, IpAddresses element) { - return null; - } - - @Override - public void add(int index, IpAddresses element) { - - } - - @Override - public IpAddresses remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java b/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java deleted file mode 100644 index e447c85..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LinkTest { - Link link = new Link(); - - @Test - public void getHref() { - link.getHref(); - } - - @Test - public void setHref() { - link.setHref("dummy href"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java b/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java deleted file mode 100644 index aef87c4..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LinksTest { - Links links = new Links(); - - @Test - public void getSelf() { - links.getSelf(); - } - - @Test - public void setSelf() { - links.setSelf(new Link()); - } - - @Test - public void getNsInstance() { - links.getNsInstance(); - } - - @Test - public void setNsInstance() { - links.setNsInstance(new Link()); - } - - @Test - public void getCancel() { - links.getCancel(); - } - - @Test - public void setCancel() { - links.setCancel(new Link()); - } - - @Test - public void getRetry() { - links.getRetry(); - } - - @Test - public void setRetry() { - links.setRetry(new Link()); - } - - @Test - public void getRollback() { - links.getRollback(); - } - - @Test - public void setRollback() { - links.setRollback(new Link()); - } - - @Test - public void getContinues() { - links.getContinues(); - } - - @Test - public void setContinues() { - links.setContinues(new Link()); - } - - @Test - public void getFail() { - links.getFail(); - } - - @Test - public void setFail() { - links.setFail(new Link()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java b/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java deleted file mode 100644 index 2b21746..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class LocationConstraintTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - LocationConstraint locationConstraint = new LocationConstraint(); - - @Test - public void getVnfProfileId() throws Exception { - locationConstraint.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() throws Exception { - locationConstraint.setVnfProfileId("profileID"); - } - - @Test - public void getLocationConstraints() throws Exception { - locationConstraint.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() throws Exception { - locationConstraint.setLocationConstraints(new VimLocation()); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java b/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java deleted file mode 100644 index e68b12a..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class LocationConstraintsTest { - LocationConstraints locationConstraints = new LocationConstraints(); - - @Test - public void getCountryCode() { - locationConstraints.getCountryCode(); - } - - @Test - public void setCountryCode() { - locationConstraints.setCountryCode("IND"); - - } - - @Test - public void getCivicAddressElement() { - locationConstraints.getCivicAddressElement(); - } - - @Test - public void setCivicAddressElement() { - locationConstraints.setCivicAddressElement(new CivicAddressElement()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java deleted file mode 100644 index c300923..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; -import static org.junit.Assert.*; - -public class ModifyVnfInfoDataTest { - ModifyVnfInfoData modifyVnfInfoData = new ModifyVnfInfoData(); - - @Test - public void getVnfInstanceId() { - modifyVnfInfoData.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - modifyVnfInfoData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfInstanceName() { - modifyVnfInfoData.getVnfInstanceName(); - } - - @Test - public void setVnfInstanceName() { - modifyVnfInfoData.setVnfInstanceName("Dummy vnfInstanceName"); - } - - @Test - public void getVnfInstanceDescription() { - modifyVnfInfoData.getVnfInstanceDescription(); - } - - @Test - public void setVnfInstanceDescription() { - modifyVnfInfoData.setVnfInstanceDescription("Dummy vnfInstanceDescription"); - } - - @Test - public void getVnfPkgId() { - modifyVnfInfoData.getVnfPkgId(); - } - - @Test - public void setVnfPkgId() { - modifyVnfInfoData.setVnfPkgId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfConfigurableProperties() { - modifyVnfInfoData.getVnfConfigurableProperties(); - } - - @Test - public void setVnfConfigurableProperties() { - modifyVnfInfoData.setVnfConfigurableProperties(new HashMap<>()); - } - - @Test - public void getMetadata() { - modifyVnfInfoData.getMetadata(); - } - - @Test - public void setMetadata() { - modifyVnfInfoData.setMetadata(new HashMap<>()); - } - - @Test - public void getExtensions() { - modifyVnfInfoData.getExtensions(); - } - - @Test - public void setExtensions() { - modifyVnfInfoData.setExtensions(new HashMap<>()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java deleted file mode 100644 index 082d4e6..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NSResourceInputParameterTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); - - @Test - public void getNsServiceName() throws Exception { - nsResourceInputParameter.getNsServiceName(); - } - - @Test - public void setNsServiceName() throws Exception { - nsResourceInputParameter.setNsServiceName("service"); - } - - @Test - public void getNsServiceDescription() throws Exception { - nsResourceInputParameter.getNsServiceDescription(); - } - - @Test - public void setNsServiceDescription() throws Exception { - nsResourceInputParameter.setNsServiceDescription("desc"); - } - - @Test - public void getNsParameters() throws Exception { - nsResourceInputParameter.getNsParameters(); - } - - @Test - public void setNsParameters() throws Exception { - nsResourceInputParameter.setNsParameters(new NsParameters()); - } - - @Test - public void getNsOperationKey() throws Exception { - nsResourceInputParameter.getNsOperationKey(); - } - - @Test - public void setNsOperationKey() throws Exception { - nsResourceInputParameter.setNsOperationKey(new NsOperationKey()); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java deleted file mode 100644 index c2e6b58..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsCreateReqTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsCreateReq nsCreateReq = new NsCreateReq(); - - @Test - public void getContext() throws Exception { - nsCreateReq.getContext(); - } - - @Test - public void setContext() throws Exception { - nsCreateReq.setContext(new CustomerModel()); - } - - @Test - public void getCsarId() throws Exception { - nsCreateReq.getCsarId(); - } - - @Test - public void setCsarId() throws Exception { - nsCreateReq.setCsarId("csarid"); - } - - @Test - public void getNsName() throws Exception { - nsCreateReq.getNsName(); - } - - @Test - public void setNsName() throws Exception { - nsCreateReq.setNsName("nsname"); - } - - @Test - public void getDescription() throws Exception { - nsCreateReq.getDescription(); - } - - @Test - public void setDescription() throws Exception { - nsCreateReq.setDescription("desc"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java deleted file mode 100644 index 70e54a1..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsInstantiateReqTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsInstantiateReq nsInstantiateReq = new NsInstantiateReq(); - - @Test - public void getNsInstanceId() throws Exception { - nsInstantiateReq.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() throws Exception { - nsInstantiateReq.setNsInstanceId("test"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java deleted file mode 100644 index f5d485a..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import java.time.LocalDateTime; -import java.util.Date; -import static org.junit.Assert.*; - -public class NsLcmOpOccTest { - NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc(); - - @Test - public void getLcmOperationType() { - nsLcmOpOcc.getLcmOperationType(); - } - - @Test - public void setLcmOperationType() { - nsLcmOpOcc.setLcmOperationType(CommonConstant.lcmOperationType.INSTANTIATE); - } - - @Test - public void getCancelMode() { - nsLcmOpOcc.getCancelMode(); - } - - @Test - public void setCancelMode() { - nsLcmOpOcc.setCancelMode(CommonConstant.cancelMode.GRACEFUL); - } - - @Test - public void getOperationState() { - nsLcmOpOcc.getOperationState(); - } - - @Test - public void setOperationState() { - nsLcmOpOcc.setOperationState(CommonConstant.operationState.COMPLETED); - } - - @Test - public void getId() { - nsLcmOpOcc.getId(); - } - - @Test - public void setId() { - nsLcmOpOcc.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getStatusEnteredTime() { - nsLcmOpOcc.getStatusEnteredTime(); - } - - @Test - public void setStatusEnteredTime() { - nsLcmOpOcc.setStatusEnteredTime(LocalDateTime.now().toString()); - } - - @Test - public void getNsInstanceId() { - nsLcmOpOcc.getNsInstanceId(); - } - - @Test - public void setNsInstanceId() { - nsLcmOpOcc.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getStartTime() { - nsLcmOpOcc.getStartTime(); - } - - @Test - public void setStartTime() { - nsLcmOpOcc.setStartTime(LocalDateTime.now().toString()); - } - - @Test - public void getAutomaticInvocation() { - nsLcmOpOcc.getAutomaticInvocation(); - } - - @Test - public void setAutomaticInvocation() { - nsLcmOpOcc.setAutomaticInvocation(true); - } - - @Test - public void getOperationParams() { - nsLcmOpOcc.getOperationParams(); - } - - @Test - public void setOperationParams() { - nsLcmOpOcc.setOperationParams("Dummy operationParams"); - } - - @Test - public void getCancelPending() { - nsLcmOpOcc.getCancelPending(); - } - - @Test - public void setCancelPending() { - nsLcmOpOcc.setCancelPending(true); - } - - @Test - public void getError() { - nsLcmOpOcc.getError(); - } - - @Test - public void setError() { - nsLcmOpOcc.setError(new ProblemDetails()); - } - - @Test - public void getLinks() { - nsLcmOpOcc.getLinks(); - } - - @Test - public void setLinks() { - nsLcmOpOcc.setLinks(new Links()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java deleted file mode 100644 index a8939f8..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class NsOperationKeyTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsOperationKey nsOperationKey = new NsOperationKey(); - - @Test - public void getGlobalSubscriberId() throws Exception { - nsOperationKey.getGlobalSubscriberId(); - } - - @Test - public void setGlobalSubscriberId() throws Exception { - nsOperationKey.setGlobalSubscriberId("subscriberid"); - } - - @Test - public void getServiceType() throws Exception { - nsOperationKey.getServiceType(); - } - - @Test - public void setServiceType() throws Exception { - nsOperationKey.setServiceType("servicetype"); - } - - @Test - public void getServiceId() throws Exception { - nsOperationKey.getServiceId(); - } - - @Test - public void setServiceId() throws Exception { - nsOperationKey.setServiceId("serviceid"); - } - - @Test - public void getOperationId() throws Exception { - nsOperationKey.getOperationId(); - } - - @Test - public void setOperationId() throws Exception { - nsOperationKey.setOperationId("test"); - } - - @Test - public void getNodeTemplateUUID() throws Exception { - nsOperationKey.getNodeTemplateUUID(); - } - - @Test - public void setNodeTemplateUUID() throws Exception { - nsOperationKey.setNodeTemplateUUID("nodeTemplateid"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java deleted file mode 100644 index 45c46ed..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collections; -import java.util.HashMap; - -public class NsParametersTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsParameters nsParameters = new NsParameters(); - - @Test - public void getLocationConstraints() throws Exception { - nsParameters.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() throws Exception { - nsParameters.setLocationConstraints(Collections.emptyList()); - } - - @Test - public void getAdditionalParamForNs() throws Exception { - nsParameters.getAdditionalParamForNs(); - } - - @Test - public void setAdditionalParamForNs() throws Exception { - nsParameters.setAdditionalParamForNs(new HashMap<>()); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java b/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java deleted file mode 100644 index b1040ef..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Arrays; - -public class NsProgressStatusTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - NsProgressStatus nsProgressStatus = new NsProgressStatus(); - - @Test - public void getJobId() throws Exception { - nsProgressStatus.getJobId(); - } - - @Test - public void setJobId() throws Exception { - nsProgressStatus.setJobId("jobid"); - } - - @Test - public void getResponseDescriptor() throws Exception { - nsProgressStatus.getResponseDescriptor(); - } - - @Test - public void setResponseDescriptor() throws Exception { - nsProgressStatus.setResponseDescriptor(new ResponseDescriptor()); - } - - @Test - public void getResponseHistoryList() throws Exception { - nsProgressStatus.getResponseHistoryList(); - } - - @Test - public void setResponseHistoryList() throws Exception { - nsProgressStatus.setResponseHistoryList(Arrays.asList(new ResponseDescriptor())); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java deleted file mode 100644 index e0455b0..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; -import static org.junit.Assert.*; - -public class ParamsForVnfTest { - - ParamsForVnf paramsForVnf = new ParamsForVnf(); - - @Test - public void getVnfProfileId() { - paramsForVnf.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - paramsForVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getAdditionalParams() { - paramsForVnf.getAdditionalParams(); - } - - @Test - public void setAdditionalParams() { - paramsForVnf.setAdditionalParams(new HashMap<>()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java deleted file mode 100644 index c586c7e..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class PnfExtCpDataTest { - PnfExtCpData pnfExtCpData = new PnfExtCpData(); - - @Test - public void getCpInstanceI16() { - pnfExtCpData.getCpInstanceI16(); - } - - @Test - public void setCpInstanceI16() { - pnfExtCpData.setCpInstanceI16("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpdId() { - pnfExtCpData.getCpdId(); - } - - @Test - public void setCpdId() { - pnfExtCpData.setCpdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getCpProtocolData() { - pnfExtCpData.getCpProtocolData(); - } - - @Test - public void setCpProtocolData() { - pnfExtCpData.setCpProtocolData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(CpProtocolData cpProtocolData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public CpProtocolData get(int index) { - return null; - } - - @Override - public CpProtocolData set(int index, CpProtocolData element) { - return null; - } - - @Override - public void add(int index, CpProtocolData element) { - - } - - @Override - public CpProtocolData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java deleted file mode 100644 index ddea6cc..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ProblemDetailsTest { - ProblemDetails problemDetails = new ProblemDetails(); - - @Test - public void getType() { - problemDetails.getType(); - } - - @Test - public void setType() { - problemDetails.setType("Dummy Type"); - } - - @Test - public void getTitle() { - problemDetails.getTitle(); - } - - @Test - public void setTitle() { - problemDetails.setTitle("Dummy Title"); - } - - @Test - public void getStatus() { - problemDetails.getStatus(); - } - - @Test - public void setStatus() { - problemDetails.setStatus(200); - } - - @Test - public void getDetail() { - problemDetails.getDetail(); - } - - @Test - public void setDetail() { - problemDetails.setTitle("Dummy Title"); - } - - @Test - public void getInstance() { - problemDetails.getInstance(); - } - - @Test - public void setInstance() { - problemDetails.setInstance("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java deleted file mode 100644 index 9c4a029..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class ResourceChangesTest { - ResourceChanges resourceChanges = new ResourceChanges(); - - @Test - public void getAffectedVnfs() { - resourceChanges.getAffectedVnfs(); - } - - @Test - public void setAffectedVnfs() { - resourceChanges.setAffectedVnfs(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVnf affectedVnf) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVnf get(int index) { - return null; - } - - @Override - public AffectedVnf set(int index, AffectedVnf element) { - return null; - } - - @Override - public void add(int index, AffectedVnf element) { - - } - - @Override - public AffectedVnf remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedPnfs() { - resourceChanges.getAffectedPnfs(); - } - - @Test - public void setAffectedPnfs() { - resourceChanges.setAffectedPnfs(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedPnf affectedPnf) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedPnf get(int index) { - return null; - } - - @Override - public AffectedPnf set(int index, AffectedPnf element) { - return null; - } - - @Override - public void add(int index, AffectedPnf element) { - - } - - @Override - public AffectedPnf remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedVls() { - resourceChanges.getAffectedVls(); - } - - @Test - public void setAffectedVls() { - resourceChanges.setAffectedVls(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVirtualLink affectedVirtualLink) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVirtualLink get(int index) { - return null; - } - - @Override - public AffectedVirtualLink set(int index, AffectedVirtualLink element) { - return null; - } - - @Override - public void add(int index, AffectedVirtualLink element) { - - } - - @Override - public AffectedVirtualLink remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedVnffgs() { - resourceChanges.getAffectedVnffgs(); - } - - @Test - public void setAffectedVnffgs() { - resourceChanges.setAffectedVnffgs(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedVnffg affectedVnffg) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedVnffg get(int index) { - return null; - } - - @Override - public AffectedVnffg set(int index, AffectedVnffg element) { - return null; - } - - @Override - public void add(int index, AffectedVnffg element) { - - } - - @Override - public AffectedVnffg remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedNss() { - resourceChanges.getAffectedNss(); - } - - @Test - public void setAffectedNss() { - resourceChanges.setAffectedNss(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedNs affectedNs) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedNs get(int index) { - return null; - } - - @Override - public AffectedNs set(int index, AffectedNs element) { - return null; - } - - @Override - public void add(int index, AffectedNs element) { - - } - - @Override - public AffectedNs remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } - - @Test - public void getAffectedSaps() { - resourceChanges.getAffectedSaps(); - } - - @Test - public void setAffectedSaps() { - resourceChanges.setAffectedSaps(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(AffectedSap affectedSap) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public AffectedSap get(int index) { - return null; - } - - @Override - public AffectedSap set(int index, AffectedSap element) { - return null; - } - - @Override - public void add(int index, AffectedSap element) { - - } - - @Override - public AffectedSap remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java deleted file mode 100644 index 6390c5a..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ResourceHandleTest { - ResourceHandle resourceHandle = new ResourceHandle(); - - @Test - public void getVimId() { - resourceHandle.getVimId(); - } - - @Test - public void setVimId() { - resourceHandle.setVimId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceProviderId() { - resourceHandle.getResourceProviderId(); - } - - @Test - public void setResourceProviderId() { - resourceHandle.setResourceProviderId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getResourceId() { - resourceHandle.getResourceId(); - } - - @Test - public void setResourceId() { - resourceHandle.setResourceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVimLevelResourceType() { - resourceHandle.getVimLevelResourceType(); - } - - @Test - public void setVimLevelResourceType() { - resourceHandle.setVimLevelResourceType("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java b/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java deleted file mode 100644 index 3f2f735..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class ResponseDescriptorTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - ResponseDescriptor responseDescriptor = new ResponseDescriptor(); - - @Test - public void getStatus() throws Exception { - responseDescriptor.getStatus(); - } - - @Test - public void setStatus() throws Exception { - responseDescriptor.setStatus("test"); - } - - @Test - public void getProgress() throws Exception { - responseDescriptor.getProgress(); - } - - @Test - public void setProgress() throws Exception { - responseDescriptor.setProgress("10"); - } - - @Test - public void getStatusDescription() throws Exception { - responseDescriptor.getStatusDescription(); - } - - @Test - public void setStatusDescription() throws Exception { - responseDescriptor.setStatusDescription("test"); - } - - @Test - public void getErrorCode() throws Exception { - responseDescriptor.getErrorCode(); - } - - @Test - public void setErrorCode() throws Exception { - responseDescriptor.setErrorCode(-1); - } - - @Test - public void getResponseId() throws Exception { - responseDescriptor.getResponseId(); - } - - @Test - public void setResponseId() throws Exception { - responseDescriptor.setResponseId(1); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java b/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java deleted file mode 100644 index 64f8da6..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.HashMap; - -public class RestfulResponseTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - RestfulResponse restfulResponse = new RestfulResponse(); - - @Test - public void getStatus() throws Exception { - restfulResponse.getStatus(); - } - - @Test - public void setStatus() throws Exception { - restfulResponse.setStatus(1); - } - - @Test - public void getRespHeaderMap() throws Exception { - restfulResponse.getRespHeaderMap(); - } - - @Test - public void setRespHeaderMap() throws Exception { - restfulResponse.setRespHeaderMap(new HashMap<>()); - } - - @Test - public void getRespHeaderInt() throws Exception { - restfulResponse.getRespHeaderInt("1"); - } - - @Test - public void getRespHeaderLong() throws Exception { - restfulResponse.getRespHeaderLong("1"); - } - - @Test - public void getRespHeaderStr() throws Exception { - restfulResponse.getRespHeaderStr("test"); - } - - @Test - public void getResponseContent() throws Exception { - restfulResponse.getResponseContent(); - } - - @Test - public void setResponseContent() throws Exception { - restfulResponse.setResponseContent("responseString"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java deleted file mode 100644 index 2a45599..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import static org.junit.Assert.*; - -public class SapDataTest { - - SapData sapData = new SapData(); - - @Test - public void getSapdId() { - sapData.getSapdId(); - } - - @Test - public void setSapdId() { - sapData.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getSapName() { - sapData.getSapName(); - } - - @Test - public void setSapName() { - sapData.setSapName("Dummy SapName"); - } - - @Test - public void getDescription() { - sapData.getDescription(); - } - - @Test - public void setDescription() { - sapData.setDescription("Dummy Description"); - } - - @Test - public void getSapProtocolData() { - sapData.getSapProtocolData(); - } - - @Test - public void setSapProtocolData() { - sapData.setSapProtocolData(new List() { - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public T[] toArray(T[] a) { - return null; - } - - @Override - public boolean add(CpProtocolData cpProtocolData) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean containsAll(Collection c) { - return false; - } - - @Override - public boolean addAll(Collection c) { - return false; - } - - @Override - public boolean addAll(int index, Collection c) { - return false; - } - - @Override - public boolean removeAll(Collection c) { - return false; - } - - @Override - public boolean retainAll(Collection c) { - return false; - } - - @Override - public void clear() { - - } - - @Override - public CpProtocolData get(int index) { - return null; - } - - @Override - public CpProtocolData set(int index, CpProtocolData element) { - return null; - } - - @Override - public void add(int index, CpProtocolData element) { - - } - - @Override - public CpProtocolData remove(int index) { - return null; - } - - @Override - public int indexOf(Object o) { - return 0; - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - return null; - } - - @Override - public ListIterator listIterator(int index) { - return null; - } - - @Override - public List subList(int fromIndex, int toIndex) { - return null; - } - }); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java b/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java deleted file mode 100644 index 85d3a13..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java +++ /dev/null @@ -1,39 +0,0 @@ - -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */package org.onap.so.adapters.vfc.model; - -import org.junit.Test; - -public class VimLocationTest { - // TODO: following test case is done for coverage - // later it should be modified for proper test. - VimLocation vimLocation = new VimLocation(); - - @Test - public void getVimId() throws Exception { - vimLocation.getVimId(); - } - - @Test - public void setVimId() throws Exception { - vimLocation.setVimId("vimid"); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java b/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java deleted file mode 100644 index b9bdfe3..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class VnfInstanceDataTest { - VnfInstanceData vnfInstanceData = new VnfInstanceData(); - - @Test - public void getVnfInstanceId() { - vnfInstanceData.getVnfInstanceId(); - } - - @Test - public void setVnfInstanceId() { - vnfInstanceData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getVnfProfileId() { - vnfInstanceData.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - vnfInstanceData.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java b/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java deleted file mode 100644 index b8f9b8e..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.model; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class VnfLocationConstraintTest { - VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint(); - - @Test - public void getVnfProfileId() { - vnfLocationConstraint.getVnfProfileId(); - } - - @Test - public void setVnfProfileId() { - vnfLocationConstraint.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d"); - } - - @Test - public void getLocationConstraints() { - vnfLocationConstraint.getLocationConstraints(); - } - - @Test - public void setLocationConstraints() { - vnfLocationConstraint.setLocationConstraints(new LocationConstraint()); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java b/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java deleted file mode 100644 index feb40f7..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/rest/EmbeddedMariaDbConfig.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import ch.vorburger.exec.ManagedProcessException; -import ch.vorburger.mariadb4j.DBConfigurationBuilder; -import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; - -@Configuration -@Profile({"test"}) -@EnableTransactionManagement -@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory", - transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"}) -public class EmbeddedMariaDbConfig { - - @Bean - MariaDB4jSpringService mariaDB4jSpringService() { - return new MariaDB4jSpringService(); - } - - @Primary - @Bean(name = "requestDataSource") - @ConfigurationProperties(prefix = "spring.datasource") - DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, - @Value("${mariaDB4j.databaseName}") String databaseName, - @Value("${spring.datasource.username}") String datasourceUsername, - @Value("${spring.datasource.password}") String datasourcePassword, - @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { - // Create our database with default root user and no password - mariaDB4jSpringService.getDB().createDB(databaseName); - - DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); - - return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) - .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); - } - - @Primary - @Bean(name = "requestEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, - @Qualifier("requestDataSource") DataSource dataSource) { - return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB") - .build(); - } - - @Primary - @Bean(name = "requestTransactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) { - return new JpaTransactionManager(entityManagerFactory); - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java b/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java deleted file mode 100644 index fe2bd0b..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import static org.junit.Assert.*; -import javax.ws.rs.core.Response; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.vfc.MSOVfcApplication; -import org.springframework.boot.configurationprocessor.json.JSONException; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSOVfcApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class HealthCheckHandlerTest { - - @LocalServerPort - private int port; - - TestRestTemplate restTemplate = new TestRestTemplate(); - - HttpHeaders headers = new HttpHeaders(); - - - @Test - public void testHealthcheck() throws JSONException { - - HttpEntity entity = new HttpEntity(null, headers); - - ResponseEntity response = - restTemplate.exchange(createURLWithPort("manage/health"), HttpMethod.GET, entity, String.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } - - private String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java b/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java deleted file mode 100644 index 15dc744..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2019 Verizon. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.onap.so.adapters.vfc.rest; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.onap.so.adapters.vfc.exceptions.ApplicationException; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.NsOperationKey; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.util.JsonUtil; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.db.request.beans.InstanceNfvoMapping; -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository; -import org.onap.so.db.request.data.repository.OperationStatusRepository; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.springframework.test.context.junit4.SpringRunner; -import java.io.File; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.when; - -@RunWith(SpringRunner.class) -public class VfcManagerSol005Test { - @InjectMocks - VfcManagerSol005 vfcManagerSol005; - - @Mock - InstanceNfvoMappingRepository instanceNfvoMappingRepository; - - @Mock - ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Mock - OperationStatusRepository operationStatusRepository; - - @Mock - RestfulUtil restfulUtil; - - OperationStatus operationStatus = new OperationStatus(); - - InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping(); - RestfulResponse restfulResponse = new RestfulResponse(); - RestfulResponse vfcrestfulResponse = new RestfulResponse(); - NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - NsOperationKey nsOperationKey = new NsOperationKey(); - - @Test - public void createNs() throws ApplicationException, Exception { - restfulResponse.setStatus(200); - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - file = new File(classLoader.getResource("json/aainfvoResponse.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - restfulResponse.setResponseContent(content); - // restfulResponse.setResponseContent("{\"nfvoId\":\"6ee79fe2-9579-475a-9bb9-20cf4358a19e\",\"name\":\"external_nfvo\",\"api-root\":\"xyz\",\"vendor\":\"vz\",\"version\":\"v1.0\",\"url\":\"http://sample.com/\",\"userName\":\"admin\",\"password\":\"sacjnasnc\"}"); - file = new File(classLoader.getResource("json/createNsSol005Response.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(content); - // vfcrestfulResponse.setResponseContent("{\"_links\": {\"heal\": {\"href\": \"\"}, \"instantiate\": {\"href\": - // \"\"}, \"nestedNsInstances\": {\"href\": \"\"}, \"scale\": {\"href\": \"\"}, \"self\": {\"href\": \"\"}, - // \"terminate\": {\"href\": \"\"}, \"update\": {\"href\": \"\"}}, \"additionalAffinityOrAntiAffiniityRule\": - // [{\"Scope\": \"\", \"affinityOrAntiAffiinty\": \"\", \"vnfInstanceId\": [], \"vnfProfileId\": [], \"vnfdId\": - // []}], \"flavourId\": \"\", \"id\": \"c9f0a95e-dea0-4698-96e5-5a79bc5a233d\", \"nestedNsInstanceId\": [], - // \"nsInstanceDescription\": \"\", \"nsInstanceName\": \"\", \"nsScaleStatus\": [{\"nsScaleLevelId\": \"\", - // \"nsScalingAspectId\": \"\"}], \"nsState\": \"\", \"nsdId\": \"\", \"nsdInfoId\": \"\", \"pnfInfo\": - // [{\"cpInfo\": [{\"cpInstanceId\": \"\", \"cpProtocolData\": {\"ipOverEthernet\": {\"ipAddresses\": - // {\"addressRange\": {\"maxAddress\": \"\", \"minAddress\": \"\"}, \"fixedAddresses\": \"\", - // \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": \"\"}, \"macAddress\": {}}, \"layerProtocol\": - // \"IP_OVER_ETHERNET\"}, \"cpdId\": \"\"}], \"pnfId\": \"\", \"pnfName\": \"\", \"pnfProfileId\": \"\", - // \"pnfdId\": \"\", \"pnfdInfoId\": \"\"}], \"sapInfo\": [{\"description\": \"\", \"id\": \"\", \"sapName\": - // \"\", \"sapProtocolInfo\": {\"ipOverEthernet\": {\"ipAddresses\": {\"addressRange\": {\"maxAddress\": \"\", - // \"minAddress\": \"\"}, \"fixedAddresses\": \"\", \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": - // \"\"}, \"macAddress\": \"\"}, \"layerProtocol\": \"IP_OVER_ETHERNET\"}, \"sapdId\": \"\"}], - // \"virtualLinkInfo\": [{\"id\": \"\", \"linkPort\": [{\"id\": \"\", \"resourceHandle\": {\"resourceId\": \"\", - // \"resourceProviderId\": \"\", \"vimId\": \"\", \"vimLevelResourceType\": \"\"}}], \"nsVirtualLinkDescId\": - // \"\", \"resourceHandle\": [{\"resourceId\": \"\", \"resourceProviderId\": \"\", \"vimId\": \"\", - // \"vimLevelResourceType\": \"\"}]}], \"vnfInstance\": [{\"vnfInstanceId\": \"\", \"vnfProfileId\": \"\"}], - // \"vnffgInfo\": [{\"id\": \"\", \"nfpInfo\": [{\"description\": \"\", \"id\": \"\", \"nfpName\": \"\", - // \"nfpRule\": {\"destinationIpAddressPrefix\": \"\", \"destinationPortRange\": \"\", \"dscp\": \"\", - // \"etherDestinationAddress\": \"\", \"etherSourceAddress\": \"\", \"etherType\": \"\", \"extendedCriteria\": - // [{\"length\": 1, \"startingPoint\": 1, \"value\": \"\"}], \"protocol\": \"\", \"sourceIpAddressPrefix\": - // \"\", \"sourcePortRange\": \"\", \"vlanTag\": []}, \"nfpState\": \"\", \"nfpdId\": \"\", \"nscpHandle\": - // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", - // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"totalCp\": 1}], \"nsCpHandle\": - // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\", - // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"nsVirtualLinkInfoId\": [], \"pnfInfoId\": [], - // \"vnfInstanceId\": [], \"vnffgdId\": \"\"}]}"); - - resourceOperationStatus.setStatus("processing"); - resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - resourceOperationStatus - .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); - when(restfulUtil.getNfvoFromAAI("b1bb0ce7-2222-4fa7-95ed-4840d70a1101")).thenReturn(restfulResponse); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())) - .thenReturn(vfcrestfulResponse); - when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); - vfcManagerSol005.createNs(nsResourceInputParameter); - - } - - @Test - public void terminateNs() throws Exception { - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - Map header = new HashMap<>(); - header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(null); - vfcrestfulResponse.setRespHeaderMap(header); - when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - vfcManagerSol005.terminateNs(nsResourceInputParameter.getNsOperationKey(), nsInstanceId); - } - - @Test - public void getNsProgress() throws Exception { - String jobId = "12204a12-7da2-4ddf-8c2f-992a1a1acebf"; - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - instanceNfvoMapping.setJobId(jobId); - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - operationStatus.setProgress("40"); - operationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - operationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - ResourceOperationStatus resourceOperationStatus = - new ResourceOperationStatus(nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId(), - nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - file = new File(classLoader.getResource("json/lcmOperRsp.json").getFile()); - content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(content); - List resourceOperationStatuses = new ArrayList<>(); - resourceOperationStatuses.add(resourceOperationStatus); - when(instanceNfvoMappingRepository.findOneByJobId(jobId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - when(operationStatusRepository.findOneByServiceIdAndOperationId( - nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(operationStatus); - when(resourceOperationStatusRepository.findByServiceIdAndOperationId( - nsResourceInputParameter.getNsOperationKey().getServiceId(), - nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(resourceOperationStatuses); - when(operationStatusRepository.save(operationStatus)).thenReturn(operationStatus); - vfcManagerSol005.getNsProgress(nsResourceInputParameter.getNsOperationKey(), jobId); - - } - - @Test - public void instantiateNs() throws Exception { - String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - resourceOperationStatus.setStatus("processing"); - resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - resourceOperationStatus - .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - Map header = new HashMap<>(); - header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(null); - vfcrestfulResponse.setRespHeaderMap(header); - when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); - when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); - vfcManagerSol005.instantiateNs(nsInstanceId, nsResourceInputParameter); - - } - - @Test - public void deleteNs() throws Exception { - String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d"; - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - File file = new File(classLoader.getResource("json/createNsReq.json").getFile()); - String content = new String(Files.readAllBytes(file.toPath())).replace("\n", ""); - nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class); - instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101"); - instanceNfvoMapping.setPassword("sacjnasnc"); - instanceNfvoMapping.setUsername("admin"); - instanceNfvoMapping.setNfvoName("external_nfvo"); - instanceNfvoMapping.setEndpoint("http://sample.com/"); - instanceNfvoMapping.setApiRoot("xyz"); - nsOperationKey.setServiceId("1"); - resourceOperationStatus.setStatus("processing"); - resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId()); - resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId()); - resourceOperationStatus - .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID()); - Map header = new HashMap<>(); - header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf"); - vfcrestfulResponse.setStatus(202); - vfcrestfulResponse.setResponseContent(null); - vfcrestfulResponse.setRespHeaderMap(header); - when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping); - when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) - .thenReturn(vfcrestfulResponse); - when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus); - when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping); - vfcManagerSol005.deleteNs(nsOperationKey, nsInstanceId); - - } -} diff --git a/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java b/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java deleted file mode 100644 index 08fe618..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (c) 2019 Samsung. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.rest; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.vfc.constant.CommonConstant; -import org.onap.so.adapters.vfc.model.NSResourceInputParameter; -import org.onap.so.adapters.vfc.model.NsOperationKey; -import org.onap.so.adapters.vfc.model.NsParameters; -import org.onap.so.adapters.vfc.model.NsScaleParameters; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.onap.so.adapters.vfc.util.RestfulUtil; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.springframework.http.HttpStatus; -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class VfcManagerTest { - - @Mock - private ResourceOperationStatusRepository resourceOperationStatusRepository; - - @Mock - private RestfulUtil restfulUtil; - - @InjectMocks - @Spy - private VfcManager vfcManager; - - @Test - public void createNs() throws Exception { - - NSResourceInputParameter segInput = new NSResourceInputParameter(); - segInput.setNsOperationKey(new NsOperationKey()); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - RestfulResponse response = vfcManager.createNs(segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void deleteNs() throws Exception { - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.NS_INSTANCE_ID + "\": \"someNsInstanceId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - NsOperationKey nsOperationKey = new NsOperationKey(); - - RestfulResponse response = vfcManager.deleteNs(nsOperationKey, "someNsInstanceId"); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void instantiateNs() throws Exception { - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - NsParameters nsParameters = new NsParameters(); - NSResourceInputParameter segInput = new NSResourceInputParameter(); - segInput.setNsParameters(nsParameters); - segInput.setNsOperationKey(new NsOperationKey()); - - RestfulResponse response = vfcManager.instantiateNs("someNsInstanceId", segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - - @Test - public void terminateNs() throws Exception { - - NsOperationKey nsOperationKey = new NsOperationKey(); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - RestfulResponse response = vfcManager.terminateNs(nsOperationKey, "someNsInstanceId"); - assertEquals(HttpStatus.OK.value(), response.getStatus()); - } - - @Test - public void getNsProgress() throws Exception { - - NsOperationKey nsOperationKey = new NsOperationKey(); - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - restfulResponse.setResponseContent( - "{\"" + CommonConstant.JOB_ID + "\": \"someJobId\", " + "\"responseDescriptor\" : {}}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - when(resourceOperationStatusRepository.findOne(any())) - .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); - - RestfulResponse response = vfcManager.getNsProgress(nsOperationKey, "someJobId"); - assertEquals(HttpStatus.OK.value(), response.getStatus()); - } - - @Test - public void scaleNs() throws Exception { - - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus(); - NSResourceInputParameter segInput = new NSResourceInputParameter(); - NsScaleParameters nsScaleParameters = new NsScaleParameters(); - segInput.setNsScaleParameters(nsScaleParameters); - - RestfulResponse restfulResponse = new RestfulResponse(); - restfulResponse.setStatus(HttpStatus.OK.value()); - segInput.setNsOperationKey(new NsOperationKey()); - restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); - when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); - - when(resourceOperationStatusRepository.findOne(any())) - .thenReturn(java.util.Optional.ofNullable(resourceOperationStatus)); - - RestfulResponse response = vfcManager.scaleNs("someNsInstanceId", segInput); - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - } - -} diff --git a/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java deleted file mode 100644 index a3a3fd2..0000000 --- a/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java +++ /dev/null @@ -1,209 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (c) 2019 Samsung. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vfc.util; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.Header; -import org.apache.http.message.BasicHeader; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpClient; -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.HttpPut; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.vfc.model.RestfulResponse; -import org.springframework.http.HttpStatus; -import javax.ws.rs.HttpMethod; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class RestfulUtilTest { - - @InjectMocks - @Spy - private RestfulUtil restfulUtil; - - @Mock - private HttpClient client; - - private HttpEntity httpEntity; - private HttpResponse httpResponse; - private StatusLine statusLine; - private Header httpResponseHeader; - - @Before - public void setUp() { - httpEntity = mock(HttpEntity.class); - httpResponse = mock(HttpResponse.class); - statusLine = mock(StatusLine.class); - httpResponseHeader = mock(Header.class); - } - - private void sendInit() throws IOException { - - Header[] headerList = new BasicHeader[2]; - headerList[0] = new BasicHeader("Content-Type", "application/json"); - headerList[1] = new BasicHeader("cache-control", "no-cache"); - doReturn("https://testHost/").when(restfulUtil).getMsbHost(); - - when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value()); - when(httpResponse.getStatusLine()).thenReturn(statusLine); - when(httpResponse.getEntity()).thenReturn(httpEntity); - when(httpResponse.getAllHeaders()).thenReturn(headerList); - } - - @Test - public void sendGet() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("GET").getBytes()); - when(client.execute(any(HttpGet.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.GET, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("GET", restfulResponse.getResponseContent()); - - Map requestHeader = new HashMap<>(); - requestHeader.put("a", "b"); - RestfulResponse restfulResponse1 = - restfulUtil.send("test", HttpMethod.GET, "some request content", requestHeader); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); - - } - - @Test - public void sendPost() throws Exception { - - sendInit(); - - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("POST").getBytes()); - when(client.execute(any(HttpPost.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.POST, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("POST", restfulResponse.getResponseContent()); - - Map requestHeader = new HashMap<>(); - requestHeader.put("a", "b"); - RestfulResponse restfulResponse1 = - restfulUtil.send("test", HttpMethod.POST, "some request content", requestHeader); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); - - } - - @Test - public void sendPut() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("PUT").getBytes()); - when(client.execute(any(HttpPut.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.PUT, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("PUT", restfulResponse.getResponseContent()); - - Map requestHeader = new HashMap<>(); - requestHeader.put("a", "b"); - RestfulResponse restfulResponse1 = - restfulUtil.send("test", HttpMethod.PUT, "some request content", requestHeader); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); - - } - - @Test - public void sendDelete() throws Exception { - - sendInit(); - - ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("DELETE").getBytes()); - when(client.execute(any(HttpDelete.class))).thenReturn(httpResponse); - when(httpEntity.getContent()).thenReturn(responseStream); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.DELETE, "some request content"); - - assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); - assertEquals("DELETE", restfulResponse.getResponseContent()); - - Map requestHeader = new HashMap<>(); - requestHeader.put("a", "b"); - RestfulResponse restfulResponse1 = - restfulUtil.send("test", HttpMethod.DELETE, "some request content", requestHeader); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); - - } - - @Test - public void sendOptions() throws Exception { - - doReturn("https://testHost/").when(restfulUtil).getMsbHost(); - - RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.OPTIONS, "some request content"); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus()); - assertEquals("Error processing request to VFC", restfulResponse.getResponseContent()); - - Map requestHeader = new HashMap<>(); - requestHeader.put("a", "b"); - RestfulResponse restfulResponse1 = - restfulUtil.send("test", HttpMethod.OPTIONS, "some request content", requestHeader); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse1.getStatus()); - } - - @Test - public void getNfvoFromAAITest() throws Exception { - - doReturn("https://testHost/").when(restfulUtil).getMsbHost(); - - RestfulResponse restfulResponse = restfulUtil.getNfvoFromAAI("test"); - - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus()); - } -} diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml deleted file mode 100644 index b43d382..0000000 --- a/src/test/resources/application-test.yaml +++ /dev/null @@ -1,64 +0,0 @@ - -server: - port: 8080 - tomcat: - max-threads: 50 -ssl-enable: false -mso: - adapters: - requestDb: - auth: Basic YnBlbDptc28tZGItMTUwNyE= - endpoint: http://localhost:8081 - logPath: logs - site-name: localSite - infra-requests: - archived: - period: 1 -spring: - datasource: - jdbc-url: jdbc:mariadb://localhost:3307/requestdb - username: root - password: password - driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never - jpa: - generate-ddl: false - show-sql: false - hibernate: - ddl-auto: validate - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable-lazy-load-no-trans: true - database-platform: org.hibernate.dialect.MySQL5InnoDBDialect - security: - usercredentials: - - - username: test - password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' - role: BPEL-Client -mariaDB4j: - dataDir: - port: 3307 - databaseName: requestdb - -#Actuator -management: - endpoints: - web: - base-path: /manage - server: - servlet: - context-path: /manage - metrics: - se-global-registry: false - export: - prometheus: - enabled: true # Whether exporting of metrics to Prometheus is enabled. - step: 1m # Step size (i.e. reporting frequency) to use. - - -flyway: - baseline-on-migrate: false - url: jdbc:mariadb://localhost:3307/requestdb - user: root - password: password diff --git a/src/test/resources/json/LICENSE.txt b/src/test/resources/json/LICENSE.txt deleted file mode 100644 index bc40e66..0000000 --- a/src/test/resources/json/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ \ No newline at end of file diff --git a/src/test/resources/json/aainfvoResponse.json b/src/test/resources/json/aainfvoResponse.json deleted file mode 100644 index 35047a9..0000000 --- a/src/test/resources/json/aainfvoResponse.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "nfvoId":"6ee79fe2-9579-475a-9bb9-20cf4358a19e", - "name":"external_nfvo", - "api-root":"xyz", - "vendor":"vz", - "version":"v1.0", - "url":"http://sample.com/", - "userName":"admin", - "password":"sacjnasnc" -} \ No newline at end of file diff --git a/src/test/resources/json/createNsReq.json b/src/test/resources/json/createNsReq.json deleted file mode 100644 index aec8ae8..0000000 --- a/src/test/resources/json/createNsReq.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "nsServiceName":"vcpe_e2e_vnf_test2", - "nsServiceDescription":"null", - "nsServiceModelUUID":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", - "nsOperationKey":{ - "globalSubscriberId":"Demonstration", - "serviceType":"vCPE", - "serviceId":"996fadbb-e806-4a19-b0e5-3454ad6ac29e", - "operationId":"1f1dd6b2-b027-4008-a9df-3b6c8274fb24", - "nodeTemplateUUID":"4d3a835c-29c8-4a63-83a4-50de5f7ffe16" - }, - "nsParameters":{ - "locationConstraints":[ - { - "locationConstraints":{ - "vimId":"CloudOwner_regionOne" - }, - "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101" - }, - { - "locationConstraints":{ - "vimId":"CloudOwner_regionOne" - }, - "vnfProfileId":"0408f076-e6c0-4c82-9940-272fddbb82de" - }, - { - "locationConstraints":{ - "vimId":"CloudOwner_regionOne" - }, - "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1100" - }, - { - "locationConstraints":{ - "vimId":"CloudOwner_regionOne" - }, - "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1102" - }, - { - "locationConstraints":{ - "vimId":"CloudOwner_regionOne" - }, - "vnfProfileId":"3fca3543-07f5-492f-812c-ed462e4f94f4" - } - ], - "additionalParamForNs":{ - "orchestrator":"", - "nfvo":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101", - "nf_naming":"true", - "multi_stage_design":"false", - "availability_zone_max_count":"1", - "xyz":"123", - "nsd0_providing_service_invariant_uuid":"12204a12-7da2-4ddf-8c2f-992a1a1acebf", - "nsd0_providing_service_uuid":"5791dbeb-19d4-43e8-bf44-5b327ccf6bca" - } - } -} diff --git a/src/test/resources/json/createNsRsp.json b/src/test/resources/json/createNsRsp.json deleted file mode 100644 index ccd1d66..0000000 --- a/src/test/resources/json/createNsRsp.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nsInstanceId": "9b9f02c0-298b-458a-bc9c-be3692e4f354" -} \ No newline at end of file diff --git a/src/test/resources/json/createNsSol005Response.json b/src/test/resources/json/createNsSol005Response.json deleted file mode 100644 index 938969a..0000000 --- a/src/test/resources/json/createNsSol005Response.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "_links":{ - "heal":{ - "href":"" - }, - "instantiate":{ - "href":"" - }, - "nestedNsInstances":{ - "href":"" - }, - "scale":{ - "href":"" - }, - "self":{ - "href":"" - }, - "terminate":{ - "href":"" - }, - "update":{ - "href":"" - } - }, - "additionalAffinityOrAntiAffiniityRule":[ - { - "Scope":"", - "affinityOrAntiAffiinty":"", - "vnfInstanceId":[ - - ], - "vnfProfileId":[ - - ], - "vnfdId":[ - - ] - } - ], - "flavourId":"", - "id":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", - "nestedNsInstanceId":[ - - ], - "nsInstanceDescription":"", - "nsInstanceName":"", - "nsScaleStatus":[ - { - "nsScaleLevelId":"", - "nsScalingAspectId":"" - } - ], - "nsState":"", - "nsdId":"", - "nsdInfoId":"", - "pnfInfo":[ - { - "cpInfo":[ - { - "cpInstanceId":"", - "cpProtocolData":{ - "ipOverEthernet":{ - "ipAddresses":{ - "addressRange":{ - "maxAddress":"", - "minAddress":"" - }, - "fixedAddresses":"", - "numDynamicAddresses":1, - "subnetId":"", - "type":"" - }, - "macAddress":{ - - } - }, - "layerProtocol":"IP_OVER_ETHERNET" - }, - "cpdId":"" - } - ], - "pnfId":"", - "pnfName":"", - "pnfProfileId":"", - "pnfdId":"", - "pnfdInfoId":"" - } - ], - "sapInfo":[ - { - "description":"", - "id":"", - "sapName":"", - "sapProtocolInfo":{ - "ipOverEthernet":{ - "ipAddresses":{ - "addressRange":{ - "maxAddress":"", - "minAddress":"" - }, - "fixedAddresses":"", - "numDynamicAddresses":1, - "subnetId":"", - "type":"" - }, - "macAddress":"" - }, - "layerProtocol":"IP_OVER_ETHERNET" - }, - "sapdId":"" - } - ], - "virtualLinkInfo":[ - { - "id":"", - "linkPort":[ - { - "id":"", - "resourceHandle":{ - "resourceId":"", - "resourceProviderId":"", - "vimId":"", - "vimLevelResourceType":"" - } - } - ], - "nsVirtualLinkDescId":"", - "resourceHandle":[ - { - "resourceId":"", - "resourceProviderId":"", - "vimId":"", - "vimLevelResourceType":"" - } - ] - } - ], - "vnfInstance":[ - { - "vnfInstanceId":"", - "vnfProfileId":"" - } - ], - "vnffgInfo":[ - { - "id":"", - "nfpInfo":[ - { - "description":"", - "id":"", - "nfpName":"", - "nfpRule":{ - "destinationIpAddressPrefix":"", - "destinationPortRange":"", - "dscp":"", - "etherDestinationAddress":"", - "etherSourceAddress":"", - "etherType":"", - "extendedCriteria":[ - { - "length":1, - "startingPoint":1, - "value":"" - } - ], - "protocol":"", - "sourceIpAddressPrefix":"", - "sourcePortRange":"", - "vlanTag":[ - - ] - }, - "nfpState":"", - "nfpdId":"", - "nscpHandle":[ - { - "nsInstanceId":"", - "nsSapInstanceId":"", - "pnfExtCpInstanceId":"", - "pnfInfoId":"", - "vnfExtCpInstanceId":"", - "vnfInstanceId":"" - } - ], - "totalCp":1 - } - ], - "nsCpHandle":[ - { - "nsInstanceId":"", - "nsSapInstanceId":"", - "pnfExtCpInstanceId":"", - "pnfInfoId":"", - "vnfExtCpInstanceId":"", - "vnfInstanceId":"" - } - ], - "nsVirtualLinkInfoId":[ - - ], - "pnfInfoId":[ - - ], - "vnfInstanceId":[ - - ], - "vnffgdId":"" - } - ] -} \ No newline at end of file diff --git a/src/test/resources/json/deleteNsReq.json b/src/test/resources/json/deleteNsReq.json deleted file mode 100644 index ac095e6..0000000 --- a/src/test/resources/json/deleteNsReq.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", - "serviceType":"service", - "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", - "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", - "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" -} \ No newline at end of file diff --git a/src/test/resources/json/instantiateNsReq.json b/src/test/resources/json/instantiateNsReq.json deleted file mode 100644 index 047c810..0000000 --- a/src/test/resources/json/instantiateNsReq.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "nsServiceName":"vIMS", - "nsServiceDescription":"vIMS NS", - "nsOperationKey":{ - "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", - "serviceType":"service", - "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", - "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", - "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" - }, - "nsParameters":{ - "locationConstraints":[ - { - "vnfProfileId":"zte-CSCF-1.0", - "locationConstraints":{ - "vimId":"1" - } - } - ], - "additionalParamForNs":{ - "externalDataNetworkName":"Flow_out_net", - "m6000_mng_ip":"192.168.20.2", - "externalCompanyFtpDataNetworkName":"Flow_out_net", - "externalPluginManageNetworkName":"plugin_net_2014", - "externalManageNetworkName":"mng_net_2017", - "sfc_data_network":"sfc_data_net_2016", - "NatIpRange":"210.1.1.10-210.1.1.20", - "location":"4050083f-465f-4838-af1e-47a545222ad0", - "sdncontroller":"9b9f02c0-298b-458a-bc9c-be3692e4f35e" - } - } -} \ No newline at end of file diff --git a/src/test/resources/json/instantiateNsRsp.json b/src/test/resources/json/instantiateNsRsp.json deleted file mode 100644 index 51e4d01..0000000 --- a/src/test/resources/json/instantiateNsRsp.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "jobId":"1" -} \ No newline at end of file diff --git a/src/test/resources/json/lcmOperRsp.json b/src/test/resources/json/lcmOperRsp.json deleted file mode 100644 index 111afc1..0000000 --- a/src/test/resources/json/lcmOperRsp.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id":"12204a12-7da2-4ddf-8c2f-992a1a1acebf", - "lcmOperationType":"INSTANTIATE", - "nsInstanceId":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d", - "operationState":"PROCESSING", - "statusEnteredTime":"Time" -} \ No newline at end of file diff --git a/src/test/resources/json/queryJobReq.json b/src/test/resources/json/queryJobReq.json deleted file mode 100644 index ac095e6..0000000 --- a/src/test/resources/json/queryJobReq.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", - "serviceType":"service", - "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", - "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", - "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" -} \ No newline at end of file diff --git a/src/test/resources/json/queryJobRsp.json b/src/test/resources/json/queryJobRsp.json deleted file mode 100644 index 9238b47..0000000 --- a/src/test/resources/json/queryJobRsp.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "jobId": "1", - "responseDescriptor": { - "progress": "100", - "status": "finished", - "statusDescription": "OMC VMs are decommissioned in VIM", - "errorCode": "", - "responseId": "22" - } -} \ No newline at end of file diff --git a/src/test/resources/json/terminateNsReq.json b/src/test/resources/json/terminateNsReq.json deleted file mode 100644 index ac095e6..0000000 --- a/src/test/resources/json/terminateNsReq.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350", - "serviceType":"service", - "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351", - "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352", - "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353" -} \ No newline at end of file diff --git a/src/test/resources/json/terminateNsRsp.json b/src/test/resources/json/terminateNsRsp.json deleted file mode 100644 index 51e4d01..0000000 --- a/src/test/resources/json/terminateNsRsp.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "jobId":"1" -} \ No newline at end of file diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml deleted file mode 100644 index c2e0098..0000000 --- a/src/test/resources/logback-test.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/version.properties b/version.properties index 013f1ac..0ac1b46 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=8 -patch=1 +patch=0 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg