From ea09975fe2b46b1f7a66324ed7b8cc9535f9409d Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 29 Aug 2017 17:57:42 -0400 Subject: Prune adaptors moved to ccsdk Replace code moved to CCSDK with README.md files redirecting developers to the proper CCSDK repository Change-Id: I7f9eeeecdbefcf51d8d61c52658a90f4da73a026 Issue-ID: CCSDK-59 Signed-off-by: Dan Timoney --- README.md | 9 +- aai-service/README.md | 3 + aai-service/features/pom.xml | 155 --- .../features/src/main/resources/features.xml | 46 - aai-service/installer/pom.xml | 144 --- .../src/assembly/assemble_installer_zip.xml | 59 -- .../src/assembly/assemble_mvnrepo_zip.xml | 49 - .../src/main/resources/scripts/install-feature.sh | 40 - aai-service/pom.xml | 44 - .../src/main/java/META-INF/sun-jaxb.episode | 376 -------- .../sdnc/sli/aai/AAIExecutorInterface.java | 30 - .../sdnc/sli/aai/AAIServiceActivator.java | 239 ----- .../sdnc/sli/aai/AAIServiceException.java | 77 -- .../openecomp/sdnc/sli/aai/AAITrinityService.java | 38 - .../openecomp/sdnc/sli/aai/CustomQueryRequest.java | 134 --- .../org/openecomp/sdnc/sli/aai/EchoRequest.java | 93 -- .../org/openecomp/sdnc/sli/aai/PathRequest.java | 88 -- .../org/openecomp/sdnc/sli/aai/UpdateRequest.java | 105 -- .../org/openecomp/sdnc/sli/aai/data/AAIDatum.java | 26 - .../openecomp/sdnc/sli/aai/data/EchoResponse.java | 76 -- .../openecomp/sdnc/sli/aai/data/ErrorResponse.java | 78 -- .../openecomp/sdnc/sli/aai/data/RequestError.java | 78 -- .../sdnc/sli/aai/data/ResourceVersion.java | 28 - .../sdnc/sli/aai/data/ResponseMessage.java | 122 --- .../sdnc/sli/aai/data/ResponseMessages.java | 78 -- .../sdnc/sli/aai/data/ServiceException.java | 126 --- .../org/openecomp/sdnc/sli/aai/data/Variables.java | 78 -- .../sdnc/sli/aai/data/notify/KeyDatum.java | 99 -- .../sdnc/sli/aai/data/notify/NotifyEvent.java | 170 ---- .../openecomp/sdnc/sli/aai/data/v1507/Flavor.java | 122 --- .../openecomp/sdnc/sli/aai/data/v1507/Host.java | 122 --- .../openecomp/sdnc/sli/aai/data/v1507/Image.java | 237 ----- .../sdnc/sli/aai/data/v1507/IpAddress.java | 168 ---- .../sdnc/sli/aai/data/v1507/Relationship.java | 147 --- .../sdnc/sli/aai/data/v1507/RelationshipDatum.java | 124 --- .../sdnc/sli/aai/data/v1507/RelationshipList.java | 101 -- .../openecomp/sdnc/sli/aai/data/v1507/VServer.java | 262 ----- .../sli/aai/query/FormattedQueryRequestData.java | 83 -- .../sli/aai/query/FormattedQueryResultList.java | 59 -- .../sdnc/sli/aai/query/InstanceFilters.java | 78 -- .../openecomp/sdnc/sli/aai/query/NamedQuery.java | 76 -- .../sdnc/sli/aai/query/NamedQueryData.java | 101 -- .../sdnc/sli/aai/query/QueryParameters.java | 76 -- .../org/openecomp/sdnc/sli/aai/update/Action.java | 101 -- .../openecomp/sdnc/sli/aai/update/ActionDatum.java | 99 -- .../org/openecomp/sdnc/sli/aai/update/Update.java | 124 --- .../sdnc/sli/aai/update/UpdateNodeKey.java | 99 -- example-settings.xml | 163 ---- jenkins-settings.xml | 168 ---- mdsal-resource/README.md | 3 + mdsal-resource/features/pom.xml | 134 --- .../features/src/main/resources/features.xml | 38 - mdsal-resource/installer/pom.xml | 138 --- .../src/assembly/assemble_installer_zip.xml | 59 -- .../src/assembly/assemble_mvnrepo_zip.xml | 49 - .../src/main/resources/scripts/install-feature.sh | 40 - mdsal-resource/pom.xml | 46 - mdsal-resource/provider/pom.xml | 122 --- .../sdnc/sli/resource/mdsal/ConfigResource.java | 151 --- .../sli/resource/mdsal/MdsalResourceActivator.java | 106 -- .../sli/resource/mdsal/OperationalResource.java | 151 --- .../sdnc/sli/resource/mdsal/RestService.java | 213 ---- .../src/main/resources/IPV4_ADDRESS_POOL.csv | 9 - .../provider/src/main/resources/VLAN_ID_POOL.csv | 22 - .../provider/src/main/resources/crtables.sql | 70 -- .../src/main/resources/svclogic.properties | 26 - pom.xml | 125 +-- resource-assignment/README.md | 3 + resource-assignment/features/pom.xml | 133 --- .../features/src/main/resources/features.xml | 40 - resource-assignment/installer/pom.xml | 138 --- .../src/assembly/assemble_installer_zip.xml | 59 -- .../src/assembly/assemble_mvnrepo_zip.xml | 49 - .../src/main/resources/scripts/install-feature.sh | 40 - resource-assignment/pom.xml | 43 - resource-assignment/provider/pom.xml | 115 --- .../org/openecomp/sdnc/lock/comp/LockHelper.java | 35 - .../openecomp/sdnc/lock/comp/LockHelperImpl.java | 166 ---- .../sdnc/lock/comp/ResourceLockedException.java | 41 - .../sdnc/lock/comp/SynchronizedFunction.java | 56 -- .../openecomp/sdnc/lock/dao/ResourceLockDao.java | 43 - .../sdnc/lock/dao/ResourceLockDaoImpl.java | 115 --- .../org/openecomp/sdnc/lock/data/ResourceLock.java | 34 - .../org/openecomp/sdnc/ra/ReleaseRequestType.java | 45 - .../org/openecomp/sdnc/ra/ReserveRequestType.java | 43 - .../org/openecomp/sdnc/ra/ResourceAllocator.java | 1016 -------------------- .../sdnc/ra/alloc/AffinityAllocationRule.java | 68 -- .../openecomp/sdnc/ra/alloc/DbAllocationRule.java | 155 --- .../sdnc/ra/alloc/ServingSiteAllocationRule.java | 80 -- .../openecomp/sdnc/ra/alloc/VrfAllocationRule.java | 111 --- .../sdnc/ra/check/AnyVrfPresentCheck.java | 74 -- .../openecomp/sdnc/ra/check/ExcludeVpeCheck.java | 57 -- .../openecomp/sdnc/ra/check/HubWithRgCheck.java | 107 --- .../org/openecomp/sdnc/ra/check/OneMVrfCheck.java | 100 -- .../openecomp/sdnc/ra/check/ProvStatusCheck.java | 49 - .../openecomp/sdnc/ra/check/VlanSpeedCheck.java | 50 - .../org/openecomp/sdnc/ra/check/VpeLockCheck.java | 111 --- .../org/openecomp/sdnc/ra/comp/AllocationRule.java | 37 - .../sdnc/ra/comp/EndPointAllocationDefinition.java | 60 -- .../openecomp/sdnc/ra/comp/EndPointAllocator.java | 35 - .../sdnc/ra/comp/EndPointAllocatorImpl.java | 214 ----- .../org/openecomp/sdnc/ra/comp/EndPointData.java | 33 - .../org/openecomp/sdnc/ra/comp/EquipmentCheck.java | 35 - .../org/openecomp/sdnc/ra/comp/PreferenceRule.java | 30 - .../org/openecomp/sdnc/ra/comp/ServiceData.java | 36 - .../sdnc/ra/equip/comp/EquipmentReader.java | 32 - .../org/openecomp/sdnc/ra/equip/dao/ServerDao.java | 30 - .../openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java | 64 -- .../openecomp/sdnc/ra/equip/dao/VpePortDao.java | 32 - .../sdnc/ra/equip/dao/VpePortDaoImpl.java | 81 -- .../openecomp/sdnc/ra/equip/dao/VplspePortDao.java | 30 - .../sdnc/ra/equip/dao/VplspePortDaoImpl.java | 70 -- .../sdnc/ra/equip/data/EquipmentData.java | 31 - .../sdnc/ra/equip/data/EquipmentLevel.java | 26 - .../openecomp/sdnc/ra/pref/AffinityLinkPref.java | 85 -- .../openecomp/sdnc/ra/pref/EvcExistingVrfPref.java | 60 -- .../openecomp/sdnc/ra/reader/AicSiteReader.java | 49 - .../sdnc/ra/reader/UplinkCircuitReader.java | 54 -- .../org/openecomp/sdnc/ra/reader/VnfReader.java | 49 - .../openecomp/sdnc/ra/reader/VpePortReader.java | 70 -- .../ra/rule/comp/AllocationRequestBuilder.java | 42 - .../ra/rule/comp/AllocationRequestBuilderImpl.java | 172 ---- .../sdnc/ra/rule/dao/MaxPortSpeedDao.java | 28 - .../sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java | 85 -- .../sdnc/ra/rule/dao/MaxServerSpeedDao.java | 28 - .../sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java | 86 -- .../openecomp/sdnc/ra/rule/dao/ParameterDao.java | 27 - .../sdnc/ra/rule/dao/ParameterDaoImpl.java | 57 -- .../openecomp/sdnc/ra/rule/dao/RangeRuleDao.java | 32 - .../sdnc/ra/rule/dao/RangeRuleDaoImpl.java | 70 -- .../sdnc/ra/rule/dao/ResourceRuleDao.java | 38 - .../sdnc/ra/rule/dao/ResourceRuleDaoImpl.java | 117 --- .../org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java | 27 - .../openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java | 48 - .../org/openecomp/sdnc/ra/rule/data/RangeRule.java | 33 - .../openecomp/sdnc/ra/rule/data/ResourceRule.java | 39 - .../sdnc/ra/rule/data/ResourceThreshold.java | 28 - .../sdnc/ra/rule/data/ThresholdStatus.java | 32 - .../sdnc/ra/service/dao/ServiceResourceDao.java | 38 - .../ra/service/dao/ServiceResourceDaoImpl.java | 110 --- .../sdnc/ra/service/data/ServiceResource.java | 32 - .../sdnc/ra/service/data/ServiceStatus.java | 27 - .../openecomp/sdnc/rm/comp/AllocationFunction.java | 330 ------- .../openecomp/sdnc/rm/comp/ReleaseFunction.java | 88 -- .../org/openecomp/sdnc/rm/comp/ResourceLoader.java | 39 - .../openecomp/sdnc/rm/comp/ResourceManager.java | 41 - .../sdnc/rm/comp/ResourceManagerImpl.java | 128 --- .../org/openecomp/sdnc/rm/dao/ResourceDao.java | 39 - .../openecomp/sdnc/rm/dao/jdbc/AllocationItem.java | 37 - .../sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java | 35 - .../rm/dao/jdbc/AllocationItemJdbcDaoImpl.java | 126 --- .../org/openecomp/sdnc/rm/dao/jdbc/Resource.java | 32 - .../sdnc/rm/dao/jdbc/ResourceDaoImpl.java | 370 ------- .../sdnc/rm/dao/jdbc/ResourceJdbcDao.java | 39 - .../sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 144 --- .../openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java | 33 - .../sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java | 36 - .../sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java | 112 --- .../openecomp/sdnc/rm/data/AllocationAction.java | 26 - .../org/openecomp/sdnc/rm/data/AllocationItem.java | 36 - .../openecomp/sdnc/rm/data/AllocationOutcome.java | 28 - .../openecomp/sdnc/rm/data/AllocationRequest.java | 35 - .../openecomp/sdnc/rm/data/AllocationStatus.java | 27 - .../org/openecomp/sdnc/rm/data/InitAction.java | 36 - .../sdnc/rm/data/LabelAllocationItem.java | 27 - .../sdnc/rm/data/LabelAllocationOutcome.java | 28 - .../sdnc/rm/data/LabelAllocationRequest.java | 29 - .../org/openecomp/sdnc/rm/data/LabelResource.java | 30 - .../sdnc/rm/data/LimitAllocationItem.java | 27 - .../sdnc/rm/data/LimitAllocationOutcome.java | 29 - .../sdnc/rm/data/LimitAllocationRequest.java | 31 - .../org/openecomp/sdnc/rm/data/LimitResource.java | 27 - .../sdnc/rm/data/MultiAssetAllocationOutcome.java | 30 - .../sdnc/rm/data/MultiAssetAllocationRequest.java | 32 - .../rm/data/MultiResourceAllocationOutcome.java | 29 - .../rm/data/MultiResourceAllocationRequest.java | 30 - .../sdnc/rm/data/RangeAllocationItem.java | 29 - .../sdnc/rm/data/RangeAllocationOutcome.java | 30 - .../sdnc/rm/data/RangeAllocationRequest.java | 36 - .../org/openecomp/sdnc/rm/data/RangeResource.java | 29 - .../java/org/openecomp/sdnc/rm/data/Resource.java | 32 - .../org/openecomp/sdnc/rm/data/ResourceKey.java | 50 - .../org/openecomp/sdnc/rm/data/ResourceLoad.java | 32 - .../org/openecomp/sdnc/rm/data/ResourceType.java | 26 - .../java/org/openecomp/sdnc/rm/util/LabelUtil.java | 95 -- .../java/org/openecomp/sdnc/rm/util/LimitUtil.java | 334 ------- .../java/org/openecomp/sdnc/rm/util/RangeUtil.java | 110 --- .../org/openecomp/sdnc/rm/util/ResourceUtil.java | 49 - .../sdnc/util/db/CachedDataSourceWrap.java | 122 --- .../org/openecomp/sdnc/util/db/ConnectionWrap.java | 338 ------- .../org/openecomp/sdnc/util/db/DataSourceWrap.java | 98 -- .../sdnc/util/expr/ExpressionEvaluator.java | 207 ---- .../org/openecomp/sdnc/util/speed/SpeedUtil.java | 41 - .../java/org/openecomp/sdnc/util/str/StrUtil.java | 305 ------ .../java/org/openecomp/sdnc/util/vrf/VpnParam.java | 30 - .../java/org/openecomp/sdnc/util/vrf/VrfUtil.java | 76 -- .../spring/resource-assignment-context.xml | 296 ------ .../spring/resource-assignment-osgi-context.xml | 39 - .../main/resources/resource-allocator.properties | 26 - .../main/resources/sql/001_resource_rule_ddl.sql | 32 - .../main/resources/sql/002_max_port_speed_ddl.sql | 29 - .../resources/sql/003_max_server_speed_ddl.sql | 28 - .../jtest/org/openecomp/sdnc/ra/DataSetup.java | 261 ----- .../org/openecomp/sdnc/ra/TestIsAvailable.java | 424 -------- .../jtest/org/openecomp/sdnc/ra/TestQuery.java | 85 -- .../jtest/org/openecomp/sdnc/ra/TestRelease.java | 430 --------- .../jtest/org/openecomp/sdnc/ra/TestReserve.java | 681 ------------- .../jtest/org/openecomp/sdnc/ra/TestReserve2.java | 77 -- .../jtest/org/openecomp/sdnc/rm/DataSetup.java | 106 -- .../jtest/util/org/openecomp/sdnc/ra/TestDb.java | 37 - .../util/org/openecomp/sdnc/ra/TestTable.java | 84 -- .../provider/src/test/resources/homing-req.json | 46 - .../provider/src/test/resources/log4j.properties | 26 - .../provider/src/test/resources/param.txt | 44 - .../provider/src/test/resources/sql/data.sql | 120 --- .../provider/src/test/resources/sql/schema.sql | 201 ---- .../src/test/resources/svc-topology-req.json | 195 ---- .../provider/src/test/resources/test-context.xml | 297 ------ sql-resource/README.md | 3 + sql-resource/features/pom.xml | 134 --- .../features/src/main/resources/features.xml | 39 - sql-resource/installer/pom.xml | 138 --- .../src/assembly/assemble_installer_zip.xml | 59 -- .../src/assembly/assemble_mvnrepo_zip.xml | 49 - .../src/main/resources/scripts/install-feature.sh | 40 - sql-resource/pom.xml | 43 - sql-resource/provider/pom.xml | 105 -- .../sdnc/sli/resource/sql/SqlResource.java | 515 ---------- .../sli/resource/sql/SqlResourceActivator.java | 96 -- .../src/main/resources/svclogic.properties | 34 - .../sdnc/sli/resource/sql/SqlResourceTest.java | 218 ----- .../provider/src/test/resources/delete.tests | 2 - .../provider/src/test/resources/query.tests | 5 - .../provider/src/test/resources/save.tests | 13 - .../src/test/resources/simplelogger.properties | 22 - .../src/test/resources/svclogic.properties | 34 - version.properties | 4 +- 237 files changed, 31 insertions(+), 21636 deletions(-) mode change 100755 => 100644 aai-service/README.md delete mode 100755 aai-service/features/pom.xml delete mode 100644 aai-service/features/src/main/resources/features.xml delete mode 100755 aai-service/installer/pom.xml delete mode 100644 aai-service/installer/src/assembly/assemble_installer_zip.xml delete mode 100644 aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml delete mode 100644 aai-service/installer/src/main/resources/scripts/install-feature.sh delete mode 100755 aai-service/pom.xml delete mode 100755 aai-service/provider/src/main/java/META-INF/sun-jaxb.episode delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIExecutorInterface.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceException.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAITrinityService.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/EchoRequest.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PathRequest.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/UpdateRequest.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/AAIDatum.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/EchoResponse.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ErrorResponse.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/RequestError.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResourceVersion.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessage.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessages.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ServiceException.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/Variables.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/KeyDatum.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/NotifyEvent.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Flavor.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Host.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Image.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/IpAddress.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Relationship.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipDatum.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipList.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/VServer.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryResultList.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilters.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQuery.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/QueryParameters.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Action.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/ActionDatum.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Update.java delete mode 100644 aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/UpdateNodeKey.java delete mode 100644 example-settings.xml delete mode 100644 jenkins-settings.xml create mode 100644 mdsal-resource/README.md delete mode 100755 mdsal-resource/features/pom.xml delete mode 100644 mdsal-resource/features/src/main/resources/features.xml delete mode 100755 mdsal-resource/installer/pom.xml delete mode 100644 mdsal-resource/installer/src/assembly/assemble_installer_zip.xml delete mode 100644 mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml delete mode 100644 mdsal-resource/installer/src/main/resources/scripts/install-feature.sh delete mode 100755 mdsal-resource/pom.xml delete mode 100755 mdsal-resource/provider/pom.xml delete mode 100644 mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java delete mode 100644 mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java delete mode 100644 mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java delete mode 100644 mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java delete mode 100755 mdsal-resource/provider/src/main/resources/IPV4_ADDRESS_POOL.csv delete mode 100755 mdsal-resource/provider/src/main/resources/VLAN_ID_POOL.csv delete mode 100644 mdsal-resource/provider/src/main/resources/crtables.sql delete mode 100644 mdsal-resource/provider/src/main/resources/svclogic.properties create mode 100644 resource-assignment/README.md delete mode 100755 resource-assignment/features/pom.xml delete mode 100644 resource-assignment/features/src/main/resources/features.xml delete mode 100755 resource-assignment/installer/pom.xml delete mode 100644 resource-assignment/installer/src/assembly/assemble_installer_zip.xml delete mode 100644 resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml delete mode 100644 resource-assignment/installer/src/main/resources/scripts/install-feature.sh delete mode 100755 resource-assignment/pom.xml delete mode 100755 resource-assignment/provider/pom.xml delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java delete mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java delete mode 100644 resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml delete mode 100644 resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml delete mode 100644 resource-assignment/provider/src/main/resources/resource-allocator.properties delete mode 100644 resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql delete mode 100644 resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql delete mode 100644 resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java delete mode 100644 resource-assignment/provider/src/test/resources/homing-req.json delete mode 100644 resource-assignment/provider/src/test/resources/log4j.properties delete mode 100755 resource-assignment/provider/src/test/resources/param.txt delete mode 100644 resource-assignment/provider/src/test/resources/sql/data.sql delete mode 100644 resource-assignment/provider/src/test/resources/sql/schema.sql delete mode 100644 resource-assignment/provider/src/test/resources/svc-topology-req.json delete mode 100644 resource-assignment/provider/src/test/resources/test-context.xml create mode 100644 sql-resource/README.md delete mode 100755 sql-resource/features/pom.xml delete mode 100644 sql-resource/features/src/main/resources/features.xml delete mode 100755 sql-resource/installer/pom.xml delete mode 100644 sql-resource/installer/src/assembly/assemble_installer_zip.xml delete mode 100644 sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml delete mode 100644 sql-resource/installer/src/main/resources/scripts/install-feature.sh delete mode 100755 sql-resource/pom.xml delete mode 100755 sql-resource/provider/pom.xml delete mode 100644 sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResource.java delete mode 100644 sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java delete mode 100644 sql-resource/provider/src/main/resources/svclogic.properties delete mode 100644 sql-resource/provider/src/test/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceTest.java delete mode 100755 sql-resource/provider/src/test/resources/delete.tests delete mode 100755 sql-resource/provider/src/test/resources/query.tests delete mode 100755 sql-resource/provider/src/test/resources/save.tests delete mode 100644 sql-resource/provider/src/test/resources/simplelogger.properties delete mode 100644 sql-resource/provider/src/test/resources/svclogic.properties diff --git a/README.md b/README.md index c1e7af9..fe8d371 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ -This source repository contains the code for the SDN Controller adaptors. -To compile this code: - -1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains references to the OpenECOMP repositories and OpenDaylight repositories. See example-settings.xml for an example. - -2. To compile, run "mvn clean install". +The seed code that was formerly in the sdnc/adaptors repository has been +refactored for ONAP Amsterdam and moved to the CCSDK project, to +the repository sli/adaptors. diff --git a/aai-service/README.md b/aai-service/README.md old mode 100755 new mode 100644 index e69de29..d1be773 --- a/aai-service/README.md +++ b/aai-service/README.md @@ -0,0 +1,3 @@ +AAI-SERVICE HAS MOVED TO CCSDK! + +The new location for aai-service is ccsdk/sli/adaptors/aai-service diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml deleted file mode 100755 index af5bfa0..0000000 --- a/aai-service/features/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - 4.0.0 - - aai-service - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - aai-service-features - AAI Interface Service - Features - - jar - - - - - - org.openecomp.sdnc.adaptors - aai-service-provider - ${project.version} - - - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml - - runtime - - - - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - - - - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - - - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - - - com.sun.jersey - jersey-client - 1.17 - - - com.sun.jersey - jersey-core - 1.17 - - - commons-lang - commons-lang - 2.6 - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-core - - - - - - - true - src/main/resources - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - - resources - - generate-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - - diff --git a/aai-service/features/src/main/resources/features.xml b/aai-service/features/src/main/resources/features.xml deleted file mode 100644 index 226338f..0000000 --- a/aai-service/features/src/main/resources/features.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features - - - - odl-mdsal-broker - sdnc-sli - mvn:org.openecomp.sdnc.adaptors/aai-service-provider/${project.version} - mvn:com.sun.jersey/jersey-client/${jersey.client.version} - mvn:com.sun.jersey/jersey-core/${jersey.version} - mvn:org.apache.httpcomponents/httpcore-osgi/${apache.httpcomponents.version} - mvn:org.apache.httpcomponents/httpclient-osgi/${apache.httpcomponents.version} - mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version} - mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version} - mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version} - mvn:commons-lang/commons-lang/${commons.lang.version} - mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version} - - - diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml deleted file mode 100755 index cb4d397..0000000 --- a/aai-service/installer/pom.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - 4.0.0 - - aai-service - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - aai-service-installer - AAI Adaptor - Karaf Installer - pom - - - sdnc-aai-service - sdnc-aai-service - mvn:org.openecomp.sdnc.adaptors/aai-service-features/${project.version}/xml/features - false - - - - - - org.openecomp.sdnc.adaptors - aai-service-features - ${project.version} - features - xml - - - * - * - - - - - - org.openecomp.sdnc.adaptors - aai-service-provider - ${project.version} - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${jvnet.jaxb2.version} - - - - - - - - maven-assembly-plugin - 2.6 - - - maven-repo-zip - - single - - package - - false - stage/${application.name}-${project.version} - - src/assembly/assemble_mvnrepo_zip.xml - - false - - - - installer-zip - - single - - package - - true - ${application.name}-${project.version}-installer - - src/assembly/assemble_installer_zip.xml - - false - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - - copy-dependencies - - prepare-package - - false - ${project.build.directory}/assembly/system - false - true - true - true - false - false - org.openecomp.sdnc,org.jvnet.jaxb2_commons - sli-common,sli-provider,dblib-provider,dblib-common - provided - - - - - - maven-resources-plugin - 2.6 - - - copy-version - - copy-resources - - validate - - ${basedir}/target/stage - - - src/main/resources/scripts - - install-feature.sh - - true - - - - - - - - - - - - diff --git a/aai-service/installer/src/assembly/assemble_installer_zip.xml b/aai-service/installer/src/assembly/assemble_installer_zip.xml deleted file mode 100644 index 10b53b9..0000000 --- a/aai-service/installer/src/assembly/assemble_installer_zip.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - installer_zip - - zip - - - - false - - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - - - - - diff --git a/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml b/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml deleted file mode 100644 index 6542ce0..0000000 --- a/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - mvnrepo_zip - - zip - - - - false - - - - target/assembly/ - . - - - - - - - - diff --git a/aai-service/installer/src/main/resources/scripts/install-feature.sh b/aai-service/installer/src/main/resources/scripts/install-feature.sh deleted file mode 100644 index 6e8620e..0000000 --- a/aai-service/installer/src/main/resources/scripts/install-feature.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} -ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} -ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} -INSTALLERDIR=$(dirname $0) - -REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip - -if [ -f ${REPOZIP} ] -then - unzip -d ${ODL_HOME} ${REPOZIP} -else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 -fi - -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/aai-service/pom.xml b/aai-service/pom.xml deleted file mode 100755 index f81b4f1..0000000 --- a/aai-service/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - org.openecomp.sdnc.adaptors - sdnc-adaptors - 1.1.2-SNAPSHOT - - - 4.0.0 - pom - org.openecomp.sdnc.adaptors - aai-service - - - AAI Interface Service - The AAI Interface service exposes an interface to AAI as an OSGi service - - 1.1.2-SNAPSHOT - - - - - org.openecomp.sdnc.adaptors - aai-service-features - features - ${project.version} - xml - - - - org.openecomp.sdnc.adaptors - aai-service-provider - ${project.version} - - - - - - - provider - features - installer - - diff --git a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode b/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode deleted file mode 100755 index f14c7d4..0000000 --- a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIExecutorInterface.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIExecutorInterface.java deleted file mode 100644 index d0266c3..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIExecutorInterface.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -public interface AAIExecutorInterface { - public Object get(AAIRequest request) throws AAIServiceException; - public Object post(AAIRequest request) throws AAIServiceException; - public Boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException; - public Object query(AAIRequest request, Class clas) throws AAIServiceException; - public Boolean patch(AAIRequest request, String resourceVersion) throws AAIServiceException; -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java deleted file mode 100644 index d38cf1f..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashSet; -import java.util.Properties; -import java.util.Set; - -import org.openecomp.sdnc.sli.ConfigurationException; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIServiceActivator implements BundleActivator { - - private static final String DEFAULT_CONFIG_FILE_NAME = "aaiclient.config"; - private static final String DEFAULT_PROPERTY_FILE_NAME = "aaiclient.properties"; - private static final String DEFAULT_KEYWORD = "default"; - - private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - - private static final String BVC_PROPERTY_FILE = "/opt/bvc/controller/configuration/aaiclient.properties"; - private static final String DEFAULT_SDNC_PROPERTY_FILE = "/opt/sdnc/data/properties/aaiclient.properties"; - - private Set registrationSet = new HashSet(); - - private static final Logger LOG = LoggerFactory.getLogger(AAIServiceActivator.class); - - @Override - public void start(BundleContext ctx) throws Exception { - - System.setProperty("aaiclient.runtime", "OSGI"); - - String sdnConfigDirectory = System.getenv(SDNC_CONFIG_DIR); - - // check SDNC CONFIG DIR system property - if(sdnConfigDirectory == null ) { - LOG.error("System property SDNC_CONFIG_DIR is not defined."); - LOG.info("Defaulting SDNC_CONFIG_DIR to '/opt/sdnc/data/properties/'"); - sdnConfigDirectory = "/opt/sdnc/data/properties/"; - } - - LOG.debug("Configuration directory used : " + sdnConfigDirectory); - - // check existance of properties directory - File configDirectory = new File(sdnConfigDirectory); - if(!configDirectory.exists() || !configDirectory.isDirectory()){ - LOG.error("System property SDNC_CONFIG_DIR = '" + sdnConfigDirectory + "' does not point to a valid directory. AAIService will not be initialized."); - return; - } - - Properties properties = new Properties(); - InputStream input = null; - - // find aaiclient config file - File[] files = findFiles(configDirectory, DEFAULT_CONFIG_FILE_NAME); - - // read the aai config data - if(files != null && files.length > 0) { - LOG.debug("AAIService config file exists and it is named :" + files[0].getAbsolutePath() ); - try { - input = new FileInputStream(files[0]); - properties.load(input); - LOG.debug("Loaded AAI Client properties from " + files[0].getAbsolutePath()); - } catch (IOException exc) { - LOG.warn("Problem loading AAI Client properties from " + files[0].getAbsolutePath(), exc); - } finally { - if(input != null ) { - try { - input.close(); - } catch(Exception exc) { - // ignore - } - } - int size = properties.keySet().size() ; - if(size == 0) { - LOG.debug(files[0].getAbsolutePath() + " contained no entries. Adding the default entry"); - properties.put(DEFAULT_KEYWORD, DEFAULT_PROPERTY_FILE_NAME); - } - } - } else { - LOG.debug("No configuration entries were found. Adding the default entry"); - properties.put(DEFAULT_KEYWORD, DEFAULT_PROPERTY_FILE_NAME); - } - - Set entrySet = properties. stringPropertyNames(); - String value = null; - - // initialize AAI Service for each aai client property files - for(String entry : entrySet) { - value = properties.getProperty(entry); - if(value != null && !value.isEmpty()) { - - final String fileName = value; - - File[] propertyFileList = findFiles(configDirectory, fileName); - - for(File propertiesFile : propertyFileList) { - LOG.info(propertiesFile.getName()); - // Advertise AAI resource adaptor - AAIClient impl = null; - switch(entry) { - case DEFAULT_KEYWORD: - impl = new AAIService(propertiesFile.toURI().toURL()); - break; - case "trinity": - impl = new AAITrinityService(propertiesFile.toURI().toURL()); - break; - default: - LOG.error("Invalid configuration keyword '"+entry+"' detected in aaiclient.config. Aborting initialization"); - continue; - } - String regName = impl.getClass().getName(); - - LOG.debug("Registering AAIService service "+regName); - ServiceRegistration registration = ctx.registerService(regName, impl, null); - registrationSet.add(registration); - - } - } - } - } - -// @Override - @Deprecated - public void start1(BundleContext ctx) throws Exception { - - String sdnConfigDirectory = System.getenv(SDNC_CONFIG_DIR); - String propertiesPath = null; - - if (sdnConfigDirectory == null || sdnConfigDirectory.isEmpty()) { - String filename = DEFAULT_SDNC_PROPERTY_FILE; - File file = new File(filename); - if(file != null && file.exists()) { - propertiesPath = filename; - LOG.info("Using property file (1): " + propertiesPath); - } else { - filename = BVC_PROPERTY_FILE; - file = new File(filename); - if(file != null && file.exists()) { - propertiesPath = filename; - LOG.info("Using property file (1): " + propertiesPath); - } else { - throw new ConfigurationException("Cannot find config file - "+filename+" and "+SDNC_CONFIG_DIR+" is unset"); - } - } - } else { - propertiesPath = sdnConfigDirectory + "/aaiclient.properties"; - LOG.info("Environment variable " + SDNC_CONFIG_DIR + " set, - calculated path " + propertiesPath); - } - - File propFile = new File(propertiesPath); - if(!propFile.exists()) { - String filename = DEFAULT_SDNC_PROPERTY_FILE; - File file = new File(filename); - if(file != null && file.exists()) { - propertiesPath = filename; - LOG.info("Using property file (1): " + propertiesPath); - } else { - filename = BVC_PROPERTY_FILE; - file = new File(filename); - if(file != null && file.exists()) { - propertiesPath = filename; - LOG.info("Using property file (1): " + propertiesPath); - } else { - LOG.error("AnAI Service Property file " + propertiesPath + "does not exist."); - throw new ConfigurationException("Cannot find config file - "+propertiesPath+" and " + SDNC_CONFIG_DIR + " is unset."); - } - } - } - - // Advertise AAI resource adaptor - AAIClient impl = new AAIService(propFile.toURI().toURL()); - String regName = impl.getClass().getName(); - - LOG.debug("Registering AAIService service "+regName); - ServiceRegistration registration = ctx.registerService(regName, impl, null); - registrationSet.add(registration); - } - - @Override - public void stop(BundleContext ctx) throws Exception { - - Set localRegistrationSet = new HashSet(); - localRegistrationSet.addAll(registrationSet); - - for(ServiceRegistration registration : localRegistrationSet) { - if (registration != null) { - try { - AAIService aaiService = (AAIService)ctx.getService(registration.getReference()); - registration.unregister(); - registrationSet.remove(registration); - if(aaiService != null) { - aaiService.cleanUp(); - } - } catch(Exception exc) { - if(LOG.isDebugEnabled()) - LOG.debug(exc.getMessage()); - } - } - } - } - - private File[] findFiles(File configDirectory, final String filter) { - File[] files = configDirectory.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.equalsIgnoreCase(filter); - } - }); - - return files; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceException.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceException.java deleted file mode 100644 index 0a4d516..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceException.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import org.openecomp.sdnc.sli.aai.data.ErrorResponse; - -public class AAIServiceException extends Exception { - - /** - * - */ - private static final long serialVersionUID = -9039257722542999522L; - - protected ErrorResponse errorResponse = null; - protected int returnCode = -1; - - public AAIServiceException() { - - } - - public AAIServiceException(String message) { - super(message); - } - - public AAIServiceException(Throwable cause) { - super(cause); - } - - public AAIServiceException(String message, Throwable cause) { - super(message, cause); - } - - public AAIServiceException(String message, Throwable cause, - boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public AAIServiceException(int returnCode, ErrorResponse errorresponse) { - this.errorResponse = errorresponse; - this.returnCode = returnCode; - } - - public ErrorResponse getErrorResponse() { - return errorResponse; - } - - public int getReturnCode() { - return returnCode; - } - - public String getMessage() { - if(errorResponse != null) { - return errorResponse.getRequestError().getServiceException().getText(); - } else { - return super.getMessage(); - } - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAITrinityService.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAITrinityService.java deleted file mode 100644 index be5ad08..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAITrinityService.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.net.URL; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAITrinityService extends AAIService { - - private static final Logger LOG = LoggerFactory.getLogger(AAITrinityService.class); - - public AAITrinityService(URL propURL) { - super(propURL); - LOG.info("Entered AAITrinityService.ctor"); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java deleted file mode 100644 index 7980895..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java +++ /dev/null @@ -1,134 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; -import org.openecomp.sdnc.sli.aai.query.FormattedQueryRequestData; -import org.openecomp.sdnc.sli.aai.query.FormattedQueryResultList; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class CustomQueryRequest extends AAIRequest { - - public static final String GENERIC_SEARCH_PATH = "org.openecomp.sdnc.sli.aai.query.generic"; - - private final String generic_search_path; - - public static final String FORMAT = "format"; - - - public CustomQueryRequest() { - String tmp_generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH); - tmp_generic_search_path = tmp_generic_search_path.split("search")[0]; - generic_search_path = tmp_generic_search_path +"query"; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+generic_search_path; - - request_url = processPathData(request_url, requestProperties); - - String formatQuery = requestProperties.getProperty(FORMAT); - - if(formatQuery != null) { - request_url = request_url +"?format="+formatQuery; - } - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - FormattedQueryRequestData tenant = (FormattedQueryRequestData)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - - @Override - public String[] getArgsList() { - String[] args = {FORMAT}; - return args; - } - - - @Override - public Class getModelClass() { - return FormattedQueryRequestData.class; - } - - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - - String key = FORMAT; - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{identifier}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); - - return request_url; - } - - public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException { - if(jsonData == null) { - return null; - } - - AAIDatum response = null; - ObjectMapper mapper = getObjectMapper(); - response = mapper.readValue(jsonData, FormattedQueryResultList.class); - return response; - } - - protected boolean expectsDataFromPUTRequest() { - return true; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/EchoRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/EchoRequest.java deleted file mode 100644 index 0d9e2a7..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/EchoRequest.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; -import org.openecomp.sdnc.sli.aai.data.EchoResponse; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class EchoRequest extends AAIRequest { - - - - private final String echo_path; - - public EchoRequest() { - echo_path = "/aai/util/echo"; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+echo_path; - - if(resourceVersion != null) { - request_url = request_url +"?resource-version="+resourceVersion; - } - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - EchoResponse tenant = (EchoResponse)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - - @Override - public String[] getArgsList() { - String[] args = {}; - return args; - } - - - @Override - public Class getModelClass() { - return EchoResponse.class; - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PathRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PathRequest.java deleted file mode 100644 index bfde37d..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PathRequest.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class PathRequest extends AAIRequest { - - private final Class classType; - - public static final String RESOURCE_PATH = "resource-path"; - - public PathRequest(Class type) { - classType = (Class)type; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri + "{resource-path}"; - - String encoded_vnf = requestProperties.getProperty(RESOURCE_PATH); - request_url = request_url.replace("{resource-path}", encoded_vnf) ; - - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - String json_text = null; - try { - json_text = mapper.writeValueAsString(classType); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {RESOURCE_PATH}; - return args; - } - - @Override - public Class getModelClass() { - return classType; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/UpdateRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/UpdateRequest.java deleted file mode 100644 index 062a51b..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/UpdateRequest.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; -import java.util.Properties; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class UpdateRequest extends AAIRequest { - - private AAIRequest request; - private Map params; - - public UpdateRequest(AAIRequest request, Map parms) { - this.request = request; - this.params = parms; - } - - @Override - public URL getRequestUrl(String method, String resourceVersion) - throws UnsupportedEncodingException, MalformedURLException { - return request.getRequestUrl(method, resourceVersion); - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return request.getRequestQueryUrl(method); - } - - @Override - public String toJSONString() { - ObjectMapper mapper = AAIService.getObjectMapper(); - String json = null; - - try { - json = mapper.writeValueAsString(params); - } catch (JsonProcessingException e) { - LOG.error("Could not convert parameters of " + request.getRequestObject().getClass().getName(), e); - } - - return json; - } - - @Override - public String[] getArgsList() { - return request.getArgsList(); - } - - @Override - public Class getModelClass() { - return request.getModelClass(); - } - - @Override - public void addRequestProperty(String key, String value) { - request.requestProperties.put(key, value); - } - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - -// if(request != null) { -// Class clazz = request.getClass(); -// Method function = null; -// try { -// function = clazz.getMethod("processPathData", request_url.getClass(), requestProperties.getClass()); -// request_url = (String) function.invoke(null, request_url, requestProperties); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - -// request.processPathData(request_url, requestProperties); - return request_url; - } - - public void processRequestPathValues(Map nameValues) { - request.processRequestPathValues(nameValues); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/AAIDatum.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/AAIDatum.java deleted file mode 100644 index d06753c..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/AAIDatum.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -public interface AAIDatum { - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/EchoResponse.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/EchoResponse.java deleted file mode 100644 index 6978d97..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/EchoResponse.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "responseMessages" -}) -public class EchoResponse implements AAIDatum { - - @JsonProperty("responseMessages") - private ResponseMessages responseMessages; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The responseMessages - */ - @JsonProperty("responseMessages") - public ResponseMessages getResponseMessages() { - return responseMessages; - } - - /** - * - * @param responseMessages - * The responseMessages - */ - @JsonProperty("responseMessages") - public void setResponseMessages(ResponseMessages responseMessages) { - this.responseMessages = responseMessages; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ErrorResponse.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ErrorResponse.java deleted file mode 100644 index 61232db..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ErrorResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Generated; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "requestError" -}) -public class ErrorResponse { - - @JsonProperty("requestError") - private RequestError requestError; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The requestError - */ - @JsonProperty("requestError") - public RequestError getRequestError() { - return requestError; - } - - /** - * - * @param requestError - * The requestError - */ - @JsonProperty("requestError") - public void setRequestError(RequestError requestError) { - this.requestError = requestError; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/RequestError.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/RequestError.java deleted file mode 100644 index b947d19..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/RequestError.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Generated; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "serviceException" -}) -public class RequestError { - - @JsonProperty("serviceException") - private ServiceException serviceException; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The serviceException - */ - @JsonProperty("serviceException") - public ServiceException getServiceException() { - return serviceException; - } - - /** - * - * @param serviceException - * The serviceException - */ - @JsonProperty("serviceException") - public void setServiceException(ServiceException serviceException) { - this.serviceException = serviceException; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResourceVersion.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResourceVersion.java deleted file mode 100644 index 194dc1e..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResourceVersion.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -public interface ResourceVersion { - - public String getResourceVersion(); - public void setResourceVersion(String resourceVersion); -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessage.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessage.java deleted file mode 100644 index d4dfb48..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessage.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "messageId", - "text", - "variables" -}) -public class ResponseMessage { - - @JsonProperty("messageId") - private String messageId; - @JsonProperty("text") - private String text; - @JsonProperty("variables") - private Variables variables; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The messageId - */ - @JsonProperty("messageId") - public String getMessageId() { - return messageId; - } - - /** - * - * @param messageId - * The messageId - */ - @JsonProperty("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * - * @return - * The text - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * - * @param text - * The text - */ - @JsonProperty("text") - public void setText(String text) { - this.text = text; - } - - /** - * - * @return - * The variables - */ - @JsonProperty("variables") - public Variables getVariables() { - return variables; - } - - /** - * - * @param variables - * The variables - */ - @JsonProperty("variables") - public void setVariables(Variables variables) { - this.variables = variables; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessages.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessages.java deleted file mode 100644 index 18dc2ba..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ResponseMessages.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "responseMessage" -}) -public class ResponseMessages { - - @JsonProperty("responseMessage") - private List responseMessage = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The responseMessage - */ - @JsonProperty("responseMessage") - public List getResponseMessage() { - return responseMessage; - } - - /** - * - * @param responseMessage - * The responseMessage - */ - @JsonProperty("responseMessage") - public void setResponseMessage(List responseMessage) { - this.responseMessage = responseMessage; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ServiceException.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ServiceException.java deleted file mode 100644 index 17786b1..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/ServiceException.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Generated; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "messageId", - "text", - "variables" -}) -public class ServiceException { - - @JsonProperty("messageId") - private String messageId; - @JsonProperty("text") - private String text; - @JsonProperty("variables") - private List variables = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The messageId - */ - @JsonProperty("messageId") - public String getMessageId() { - return messageId; - } - - /** - * - * @param messageId - * The messageId - */ - @JsonProperty("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * - * @return - * The text - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * - * @param text - * The text - */ - @JsonProperty("text") - public void setText(String text) { - this.text = text; - } - - /** - * - * @return - * The variables - */ - @JsonProperty("variables") - public List getVariables() { - return variables; - } - - /** - * - * @param variables - * The variables - */ - @JsonProperty("variables") - public void setVariables(List variables) { - this.variables = variables; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/Variables.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/Variables.java deleted file mode 100644 index 4d32023..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/Variables.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "variable" -}) -public class Variables { - - @JsonProperty("variable") - private List variable = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The variable - */ - @JsonProperty("variable") - public List getVariable() { - return variable; - } - - /** - * - * @param variable - * The variable - */ - @JsonProperty("variable") - public void setVariable(List variable) { - this.variable = variable; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/KeyDatum.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/KeyDatum.java deleted file mode 100644 index afcfdf0..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/KeyDatum.java +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.notify; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "key-name", - "key-value" -}) -public class KeyDatum { - - @JsonProperty("key-name") - private String keyName; - @JsonProperty("key-value") - private String keyValue; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The keyName - */ - @JsonProperty("key-name") - public String getKeyName() { - return keyName; - } - - /** - * - * @param keyName - * The key-name - */ - @JsonProperty("key-name") - public void setKeyName(String keyName) { - this.keyName = keyName; - } - - /** - * - * @return - * The keyValue - */ - @JsonProperty("key-value") - public String getKeyValue() { - return keyValue; - } - - /** - * - * @param keyValue - * The key-value - */ - @JsonProperty("key-value") - public void setKeyValue(String keyValue) { - this.keyValue = keyValue; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/NotifyEvent.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/NotifyEvent.java deleted file mode 100644 index c307322..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/notify/NotifyEvent.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.notify; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "event-id", - "event-trigger", - "key-data", - "node-type", - "selflink" -}) -public class NotifyEvent { - - @JsonProperty("event-id") - private String eventId; - @JsonProperty("event-trigger") - private String eventTrigger; - @JsonProperty("key-data") - private List keyData = new ArrayList(); - @JsonProperty("node-type") - private String nodeType; - @JsonProperty("selflink") - private String selflink; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The eventId - */ - @JsonProperty("event-id") - public String getEventId() { - return eventId; - } - - /** - * - * @param eventId - * The event-id - */ - @JsonProperty("event-id") - public void setEventId(String eventId) { - this.eventId = eventId; - } - - /** - * - * @return - * The eventTrigger - */ - @JsonProperty("event-trigger") - public String getEventTrigger() { - return eventTrigger; - } - - /** - * - * @param eventTrigger - * The event-trigger - */ - @JsonProperty("event-trigger") - public void setEventTrigger(String eventTrigger) { - this.eventTrigger = eventTrigger; - } - - /** - * - * @return - * The keyData - */ - @JsonProperty("key-data") - public List getKeyData() { - return keyData; - } - - /** - * - * @param keyData - * The key-data - */ - @JsonProperty("key-data") - public void setKeyData(List keyData) { - this.keyData = keyData; - } - - /** - * - * @return - * The nodeType - */ - @JsonProperty("node-type") - public String getNodeType() { - return nodeType; - } - - /** - * - * @param nodeType - * The node-type - */ - @JsonProperty("node-type") - public void setNodeType(String nodeType) { - this.nodeType = nodeType; - } - - /** - * - * @return - * The selflink - */ - @JsonProperty("selflink") - public String getSelflink() { - return selflink; - } - - /** - * - * @param selflink - * The selflink - */ - @JsonProperty("selflink") - public void setSelflink(String selflink) { - this.selflink = selflink; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Flavor.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Flavor.java deleted file mode 100644 index fe32b88..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Flavor.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "flavorId", - "flavorName", - "flavorLink" -}) -public class Flavor { - - @JsonProperty("flavorId") - private String flavorId; - @JsonProperty("flavorName") - private String flavorName; - @JsonProperty("flavorLink") - private String flavorLink; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The flavorId - */ - @JsonProperty("flavorId") - public String getFlavorId() { - return flavorId; - } - - /** - * - * @param flavorId - * The flavorId - */ - @JsonProperty("flavorId") - public void setFlavorId(String flavorId) { - this.flavorId = flavorId; - } - - /** - * - * @return - * The flavorName - */ - @JsonProperty("flavorName") - public String getFlavorName() { - return flavorName; - } - - /** - * - * @param flavorName - * The flavorName - */ - @JsonProperty("flavorName") - public void setFlavorName(String flavorName) { - this.flavorName = flavorName; - } - - /** - * - * @return - * The flavorLink - */ - @JsonProperty("flavorLink") - public String getFlavorLink() { - return flavorLink; - } - - /** - * - * @param flavorLink - * The flavorLink - */ - @JsonProperty("flavorLink") - public void setFlavorLink(String flavorLink) { - this.flavorLink = flavorLink; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Host.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Host.java deleted file mode 100644 index 6b0c180..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Host.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "hostId", - "hostname", - "hostLoc" -}) -public class Host { - - @JsonProperty("hostId") - private String hostId; - @JsonProperty("hostname") - private String hostname; - @JsonProperty("hostLoc") - private String hostLoc; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The hostId - */ - @JsonProperty("hostId") - public String getHostId() { - return hostId; - } - - /** - * - * @param hostId - * The hostId - */ - @JsonProperty("hostId") - public void setHostId(String hostId) { - this.hostId = hostId; - } - - /** - * - * @return - * The hostname - */ - @JsonProperty("hostname") - public String getHostname() { - return hostname; - } - - /** - * - * @param hostname - * The hostname - */ - @JsonProperty("hostname") - public void setHostname(String hostname) { - this.hostname = hostname; - } - - /** - * - * @return - * The hostLoc - */ - @JsonProperty("hostLoc") - public String getHostLoc() { - return hostLoc; - } - - /** - * - * @param hostLoc - * The hostLoc - */ - @JsonProperty("hostLoc") - public void setHostLoc(String hostLoc) { - this.hostLoc = hostLoc; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Image.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Image.java deleted file mode 100644 index b222e02..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Image.java +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "imageId", - "imageName", - "osType", - "osVersion", - "application", - "applicationVersion", - "applicationVendor", - "imageLink" -}) -public class Image { - - @JsonProperty("imageId") - private String imageId; - @JsonProperty("imageName") - private String imageName; - @JsonProperty("osType") - private String osType; - @JsonProperty("osVersion") - private String osVersion; - @JsonProperty("application") - private String application; - @JsonProperty("applicationVersion") - private String applicationVersion; - @JsonProperty("applicationVendor") - private String applicationVendor; - @JsonProperty("imageLink") - private String imageLink; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The imageId - */ - @JsonProperty("imageId") - public String getImageId() { - return imageId; - } - - /** - * - * @param imageId - * The imageId - */ - @JsonProperty("imageId") - public void setImageId(String imageId) { - this.imageId = imageId; - } - - /** - * - * @return - * The imageName - */ - @JsonProperty("imageName") - public String getImageName() { - return imageName; - } - - /** - * - * @param imageName - * The imageName - */ - @JsonProperty("imageName") - public void setImageName(String imageName) { - this.imageName = imageName; - } - - /** - * - * @return - * The osType - */ - @JsonProperty("osType") - public String getOsType() { - return osType; - } - - /** - * - * @param osType - * The osType - */ - @JsonProperty("osType") - public void setOsType(String osType) { - this.osType = osType; - } - - /** - * - * @return - * The osVersion - */ - @JsonProperty("osVersion") - public String getOsVersion() { - return osVersion; - } - - /** - * - * @param osVersion - * The osVersion - */ - @JsonProperty("osVersion") - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - /** - * - * @return - * The application - */ - @JsonProperty("application") - public String getApplication() { - return application; - } - - /** - * - * @param application - * The application - */ - @JsonProperty("application") - public void setApplication(String application) { - this.application = application; - } - - /** - * - * @return - * The applicationVersion - */ - @JsonProperty("applicationVersion") - public String getApplicationVersion() { - return applicationVersion; - } - - /** - * - * @param applicationVersion - * The applicationVersion - */ - @JsonProperty("applicationVersion") - public void setApplicationVersion(String applicationVersion) { - this.applicationVersion = applicationVersion; - } - - /** - * - * @return - * The applicationVendor - */ - @JsonProperty("applicationVendor") - public String getApplicationVendor() { - return applicationVendor; - } - - /** - * - * @param applicationVendor - * The applicationVendor - */ - @JsonProperty("applicationVendor") - public void setApplicationVendor(String applicationVendor) { - this.applicationVendor = applicationVendor; - } - - /** - * - * @return - * The imageLink - */ - @JsonProperty("imageLink") - public String getImageLink() { - return imageLink; - } - - /** - * - * @param imageLink - * The imageLink - */ - @JsonProperty("imageLink") - public void setImageLink(String imageLink) { - this.imageLink = imageLink; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/IpAddress.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/IpAddress.java deleted file mode 100644 index beec43f..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/IpAddress.java +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "addrId", - "addr", - "version", - "type", - "networkName" -}) -public class IpAddress { - - @JsonProperty("addrId") - private String addrId; - @JsonProperty("addr") - private String addr; - @JsonProperty("version") - private String version; - @JsonProperty("type") - private String type; - @JsonProperty("networkName") - private String networkName; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The addrId - */ - @JsonProperty("addrId") - public String getAddrId() { - return addrId; - } - - /** - * - * @param addrId - * The addrId - */ - @JsonProperty("addrId") - public void setAddrId(String addrId) { - this.addrId = addrId; - } - - /** - * - * @return - * The addr - */ - @JsonProperty("addr") - public String getAddr() { - return addr; - } - - /** - * - * @param addr - * The addr - */ - @JsonProperty("addr") - public void setAddr(String addr) { - this.addr = addr; - } - - /** - * - * @return - * The version - */ - @JsonProperty("version") - public String getVersion() { - return version; - } - - /** - * - * @param version - * The version - */ - @JsonProperty("version") - public void setVersion(String version) { - this.version = version; - } - - /** - * - * @return - * The type - */ - @JsonProperty("type") - public String getType() { - return type; - } - - /** - * - * @param type - * The type - */ - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - /** - * - * @return - * The networkName - */ - @JsonProperty("networkName") - public String getNetworkName() { - return networkName; - } - - /** - * - * @param networkName - * The networkName - */ - @JsonProperty("networkName") - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Relationship.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Relationship.java deleted file mode 100644 index 052e330..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/Relationship.java +++ /dev/null @@ -1,147 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "relatedTo", - "relatedLink", - "relationshipData", - "any" -}) -public class Relationship { - - @JsonProperty("relatedTo") - private String relatedTo; - @JsonProperty("relatedLink") - private String relatedLink; - @JsonProperty("relationshipData") - private List relationshipData = new ArrayList(); - @JsonProperty("any") - private List any = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The relatedTo - */ - @JsonProperty("relatedTo") - public String getRelatedTo() { - return relatedTo; - } - - /** - * - * @param relatedTo - * The relatedTo - */ - @JsonProperty("relatedTo") - public void setRelatedTo(String relatedTo) { - this.relatedTo = relatedTo; - } - - /** - * - * @return - * The relatedLink - */ - @JsonProperty("relatedLink") - public String getRelatedLink() { - return relatedLink; - } - - /** - * - * @param relatedLink - * The relatedLink - */ - @JsonProperty("relatedLink") - public void setRelatedLink(String relatedLink) { - this.relatedLink = relatedLink; - } - - /** - * - * @return - * The relationshipData - */ - @JsonProperty("relationshipData") - public List getRelationshipData() { - return relationshipData; - } - - /** - * - * @param relationshipData - * The relationshipData - */ - @JsonProperty("relationshipData") - public void setRelationshipData(List relationshipData) { - this.relationshipData = relationshipData; - } - - /** - * - * @return - * The any - */ - @JsonProperty("any") - public List getAny() { - return any; - } - - /** - * - * @param any - * The any - */ - @JsonProperty("any") - public void setAny(List any) { - this.any = any; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipDatum.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipDatum.java deleted file mode 100644 index b2d42ff..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipDatum.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "relationshipKey", - "relationshipValue", - "any" -}) -public class RelationshipDatum { - - @JsonProperty("relationshipKey") - private String relationshipKey; - @JsonProperty("relationshipValue") - private String relationshipValue; - @JsonProperty("any") - private List any = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The relationshipKey - */ - @JsonProperty("relationshipKey") - public String getRelationshipKey() { - return relationshipKey; - } - - /** - * - * @param relationshipKey - * The relationshipKey - */ - @JsonProperty("relationshipKey") - public void setRelationshipKey(String relationshipKey) { - this.relationshipKey = relationshipKey; - } - - /** - * - * @return - * The relationshipValue - */ - @JsonProperty("relationshipValue") - public String getRelationshipValue() { - return relationshipValue; - } - - /** - * - * @param relationshipValue - * The relationshipValue - */ - @JsonProperty("relationshipValue") - public void setRelationshipValue(String relationshipValue) { - this.relationshipValue = relationshipValue; - } - - /** - * - * @return - * The any - */ - @JsonProperty("any") - public List getAny() { - return any; - } - - /** - * - * @param any - * The any - */ - @JsonProperty("any") - public void setAny(List any) { - this.any = any; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipList.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipList.java deleted file mode 100644 index 5f2ca6c..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/RelationshipList.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "relationship", - "any" -}) -public class RelationshipList { - - @JsonProperty("relationship") - private List relationship = new ArrayList(); - @JsonProperty("any") - private List any = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The relationship - */ - @JsonProperty("relationship") - public List getRelationship() { - return relationship; - } - - /** - * - * @param relationship - * The relationship - */ - @JsonProperty("relationship") - public void setRelationship(List relationship) { - this.relationship = relationship; - } - - /** - * - * @return - * The any - */ - @JsonProperty("any") - public List getAny() { - return any; - } - - /** - * - * @param any - * The any - */ - @JsonProperty("any") - public void setAny(List any) { - this.any = any; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/VServer.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/VServer.java deleted file mode 100644 index 2ca10d4..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/v1507/VServer.java +++ /dev/null @@ -1,262 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.data.v1507; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "vmId", - "vmName", - "vmName2", - "host", - "image", - "flavor", - "ipAddresses", - "vserverLink", - "relationshipList" -}) -public class VServer { - - @JsonProperty("vmId") - private String vmId; - @JsonProperty("vmName") - private String vmName; - @JsonProperty("vmName2") - private String vmName2; - @JsonProperty("host") - private Host host; - @JsonProperty("image") - private Image image; - @JsonProperty("flavor") - private Flavor flavor; - @JsonProperty("ipAddresses") - private List ipAddresses = new ArrayList(); - @JsonProperty("vserverLink") - private String vserverLink; - @JsonProperty("relationshipList") - private RelationshipList relationshipList; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The vmId - */ - @JsonProperty("vmId") - public String getVmId() { - return vmId; - } - - /** - * - * @param vmId - * The vmId - */ - @JsonProperty("vmId") - public void setVmId(String vmId) { - this.vmId = vmId; - } - - /** - * - * @return - * The vmName - */ - @JsonProperty("vmName") - public String getVmName() { - return vmName; - } - - /** - * - * @param vmName - * The vmName - */ - @JsonProperty("vmName") - public void setVmName(String vmName) { - this.vmName = vmName; - } - - /** - * - * @return - * The vmName2 - */ - @JsonProperty("vmName2") - public String getVmName2() { - return vmName2; - } - - /** - * - * @param vmName2 - * The vmName2 - */ - @JsonProperty("vmName2") - public void setVmName2(String vmName2) { - this.vmName2 = vmName2; - } - - /** - * - * @return - * The host - */ - @JsonProperty("host") - public Host getHost() { - return host; - } - - /** - * - * @param host - * The host - */ - @JsonProperty("host") - public void setHost(Host host) { - this.host = host; - } - - /** - * - * @return - * The image - */ - @JsonProperty("image") - public Image getImage() { - return image; - } - - /** - * - * @param image - * The image - */ - @JsonProperty("image") - public void setImage(Image image) { - this.image = image; - } - - /** - * - * @return - * The flavor - */ - @JsonProperty("flavor") - public Flavor getFlavor() { - return flavor; - } - - /** - * - * @param flavor - * The flavor - */ - @JsonProperty("flavor") - public void setFlavor(Flavor flavor) { - this.flavor = flavor; - } - - /** - * - * @return - * The ipAddresses - */ - @JsonProperty("ipAddresses") - public List getIpAddresses() { - return ipAddresses; - } - - /** - * - * @param ipAddresses - * The ipAddresses - */ - @JsonProperty("ipAddresses") - public void setIpAddresses(List ipAddresses) { - this.ipAddresses = ipAddresses; - } - - /** - * - * @return - * The vserverLink - */ - @JsonProperty("vserverLink") - public String getVserverLink() { - return vserverLink; - } - - /** - * - * @param vserverLink - * The vserverLink - */ - @JsonProperty("vserverLink") - public void setVserverLink(String vserverLink) { - this.vserverLink = vserverLink; - } - - /** - * - * @return - * The relationshipList - */ - @JsonProperty("relationshipList") - public RelationshipList getRelationshipList() { - return relationshipList; - } - - /** - * - * @param relationshipList - * The relationshipList - */ - @JsonProperty("relationshipList") - public void setRelationshipList(RelationshipList relationshipList) { - this.relationshipList = relationshipList; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java deleted file mode 100644 index 1a281af..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.annotation.JsonProperty; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "start", - "query" -}) -@XmlRootElement(name = "query-request") -public class FormattedQueryRequestData implements AAIDatum { - - @JsonProperty("start") - protected List start; - - @JsonProperty("query") - private String query; - - @JsonProperty("start") - public List getStart () - { - return start; - } - - @JsonProperty("start") - public void setStart (List start) - { - this.start = start; - } - - @JsonProperty("query") - public String getQuery () - { - return query; - } - - @JsonProperty("query") - public void setQuery (String query) - { - this.query = query; - } - - @Override - public String toString() - { - return " [start = "+start+", query = "+query+"]"; - } - - public String getResourceVersion() { - return null; - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryResultList.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryResultList.java deleted file mode 100644 index 10e37a6..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryResultList.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "results" -}) -@XmlRootElement(name = "result-list") -public class FormattedQueryResultList implements AAIDatum { - - @XmlElement(name = "results") - private List results; - @XmlElement(name = "results") - public List getResults () - { - return results; - } - @XmlElement(name = "results") - public void setResults (List results) - { - this.results = results; - } - - @Override - public String toString() - { - return "ClassPojo [results = "+results+"]"; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilters.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilters.java deleted file mode 100644 index 3706ace..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilters.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "instance-filter" -}) -public class InstanceFilters { - - @JsonProperty("instance-filter") - private List instanceFilter = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The instanceFilter - */ - @JsonProperty("instance-filter") - public List getInstanceFilter() { - return instanceFilter; - } - - /** - * - * @param instanceFilter - * The instance-filter - */ - @JsonProperty("instance-filter") - public void setInstanceFilter(List instanceFilter) { - this.instanceFilter = instanceFilter; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQuery.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQuery.java deleted file mode 100644 index 3c9c6e6..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQuery.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "named-query-uuid" -}) -public class NamedQuery { - - @JsonProperty("named-query-uuid") - private String namedQueryUuid; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The namedQueryUuid - */ - @JsonProperty("named-query-uuid") - public String getNamedQueryUuid() { - return namedQueryUuid; - } - - /** - * - * @param namedQueryUuid - * The named-query-uuid - */ - @JsonProperty("named-query-uuid") - public void setNamedQueryUuid(String namedQueryUuid) { - this.namedQueryUuid = namedQueryUuid; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java deleted file mode 100644 index 0140656..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "query-parameters", - "instance-filters" -}) -public class NamedQueryData implements AAIDatum { - - @JsonProperty("query-parameters") - private QueryParameters queryParameters; - @JsonProperty("instance-filters") - private InstanceFilters instanceFilters; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The queryParameters - */ - @JsonProperty("query-parameters") - public QueryParameters getQueryParameters() { - return queryParameters; - } - - /** - * - * @param queryParameters - * The query-parameters - */ - @JsonProperty("query-parameters") - public void setQueryParameters(QueryParameters queryParameters) { - this.queryParameters = queryParameters; - } - - /** - * - * @return - * The instanceFilters - */ - @JsonProperty("instance-filters") - public InstanceFilters getInstanceFilters() { - return instanceFilters; - } - - /** - * - * @param instanceFilters - * The instance-filters - */ - @JsonProperty("instance-filters") - public void setInstanceFilters(InstanceFilters instanceFilters) { - this.instanceFilters = instanceFilters; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/QueryParameters.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/QueryParameters.java deleted file mode 100644 index d428880..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/QueryParameters.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.query; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "named-query" -}) -public class QueryParameters { - - @JsonProperty("named-query") - private NamedQuery namedQuery; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The namedQuery - */ - @JsonProperty("named-query") - public NamedQuery getNamedQuery() { - return namedQuery; - } - - /** - * - * @param namedQuery - * The named-query - */ - @JsonProperty("named-query") - public void setNamedQuery(NamedQuery namedQuery) { - this.namedQuery = namedQuery; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Action.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Action.java deleted file mode 100644 index 00e7849..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Action.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.update; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "action-data", - "action-type" -}) -public class Action { - - @JsonProperty("action-data") - private List actionData = new ArrayList(); - @JsonProperty("action-type") - private String actionType; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The actionData - */ - @JsonProperty("action-data") - public List getActionData() { - return actionData; - } - - /** - * - * @param actionData - * The action-data - */ - @JsonProperty("action-data") - public void setActionData(List actionData) { - this.actionData = actionData; - } - - /** - * - * @return - * The actionType - */ - @JsonProperty("action-type") - public String getActionType() { - return actionType; - } - - /** - * - * @param actionType - * The action-type - */ - @JsonProperty("action-type") - public void setActionType(String actionType) { - this.actionType = actionType; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/ActionDatum.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/ActionDatum.java deleted file mode 100644 index a70101e..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/ActionDatum.java +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.update; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "property-name", - "property-value" -}) -public class ActionDatum { - - @JsonProperty("property-name") - private String propertyName; - @JsonProperty("property-value") - private String propertyValue; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The propertyName - */ - @JsonProperty("property-name") - public String getPropertyName() { - return propertyName; - } - - /** - * - * @param propertyName - * The property-name - */ - @JsonProperty("property-name") - public void setPropertyName(String propertyName) { - this.propertyName = propertyName; - } - - /** - * - * @return - * The propertyValue - */ - @JsonProperty("property-value") - public String getPropertyValue() { - return propertyValue; - } - - /** - * - * @param propertyValue - * The property-value - */ - @JsonProperty("property-value") - public void setPropertyValue(String propertyValue) { - this.propertyValue = propertyValue; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Update.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Update.java deleted file mode 100644 index 15bb87f..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/Update.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.update; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "update-node-type", - "update-node-key", - "action" -}) -public class Update { - - @JsonProperty("update-node-type") - private String updateNodeType; - @JsonProperty("action") - private List action = new ArrayList(); - @JsonProperty("update-node-key") - private List updateNodeKey = new ArrayList(); - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The updateNodeType - */ - @JsonProperty("update-node-type") - public String getUpdateNodeType() { - return updateNodeType; - } - - /** - * - * @param updateNodeType - * The update-node-type - */ - @JsonProperty("update-node-type") - public void setUpdateNodeType(String updateNodeType) { - this.updateNodeType = updateNodeType; - } - - /** - * - * @return - * The action - */ - @JsonProperty("action") - public List getAction() { - return action; - } - - /** - * - * @param action - * The action - */ - @JsonProperty("action") - public void setAction(List action) { - this.action = action; - } - - /** - * - * @return - * The updateNodeKey - */ - @JsonProperty("update-node-key") - public List getUpdateNodeKey() { - return updateNodeKey; - } - - /** - * - * @param updateNodeKey - * The update-node-key - */ - @JsonProperty("update-node-key") - public void setUpdateNodeKey(List updateNodeKey) { - this.updateNodeKey = updateNodeKey; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/UpdateNodeKey.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/UpdateNodeKey.java deleted file mode 100644 index 8aa3eab..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/update/UpdateNodeKey.java +++ /dev/null @@ -1,99 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.aai.update; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "key-name", - "key-value" -}) -public class UpdateNodeKey { - - @JsonProperty("key-name") - private String keyName; - @JsonProperty("key-value") - private String keyValue; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - /** - * - * @return - * The keyName - */ - @JsonProperty("key-name") - public String getKeyName() { - return keyName; - } - - /** - * - * @param keyName - * The key-name - */ - @JsonProperty("key-name") - public void setKeyName(String keyName) { - this.keyName = keyName; - } - - /** - * - * @return - * The keyValue - */ - @JsonProperty("key-value") - public String getKeyValue() { - return keyValue; - } - - /** - * - * @param keyValue - * The key-value - */ - @JsonProperty("key-value") - public void setKeyValue(String keyValue) { - this.keyValue = keyValue; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/example-settings.xml b/example-settings.xml deleted file mode 100644 index 2e7ce64..0000000 --- a/example-settings.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - openecomp-release - - - openecomp-release - openecomp-release - https://ecomp-nexus:8443/repository/maven-releases/ - - true - never - - - false - - - - - - openecomp-release - openecomp-release - https://ecomp-nexus:8443/repository/maven-releases/ - - true - never - - - false - - - - - - - openecomp-snapshots - - - openecomp-snapshot - openecomp-snapshot - https://ecomp-nexus:8443/repository/maven-snapshots/ - - false - - - true - - - - - - openecomp-snapshot - openecomp-snapshot - https://ecomp-nexus:8443/repository/maven-snapshots/ - - false - - - true - - - - - - opendaylight-release - - - opendaylight-mirror - opendaylight-mirror - https://nexus.opendaylight.org/content/repositories/public/ - - true - never - - - false - - - - - - opendaylight-mirror - opendaylight-mirror - https://nexus.opendaylight.org/content/repositories/public/ - - true - never - - - false - - - - - - - opendaylight-snapshots - - - opendaylight-snapshot - opendaylight-snapshot - https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - - false - - - true - - - - - - opendaylight-snapshot - opendaylight-snapshot - https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - - false - - - true - - - - - - - - openecomp-release - openecomp-snapshots - opendaylight-release - opendaylight-snapshots - - - - - nexus - USERNAME - PASSWORD - - - openecomp-release - USERNAME - PASSWORD - - - openecomp-snapshot - USERNAME - PASSWORD - - - diff --git a/jenkins-settings.xml b/jenkins-settings.xml deleted file mode 100644 index 344994f..0000000 --- a/jenkins-settings.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - openecomp-release - - - openecomp-release - openecomp-release - https://ecomp-nexus:8443/repository/maven-releases/ - - true - never - - - false - - - - - - openecomp-release - openecomp-release - https://ecomp-nexus:8443/repository/maven-releases/ - - true - never - - - false - - - - - - - openecomp-snapshots - - - openecomp-snapshot - openecomp-snapshot - https://ecomp-nexus:8443/repository/maven-snapshots/ - - false - - - true - - - - - - openecomp-snapshot - openecomp-snapshot - https://ecomp-nexus:8443/repository/maven-snapshots/ - - false - - - true - - - - - - opendaylight-release - - - opendaylight-mirror - opendaylight-mirror - https://nexus.opendaylight.org/content/repositories/public/ - - true - never - - - false - - - - - - opendaylight-mirror - opendaylight-mirror - https://nexus.opendaylight.org/content/repositories/public/ - - true - never - - - false - - - - - - - opendaylight-snapshots - - - opendaylight-snapshot - opendaylight-snapshot - https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - - false - - - true - - - - - - opendaylight-snapshot - opendaylight-snapshot - https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - - false - - - true - - - - - - - - openecomp-release - openecomp-snapshots - opendaylight-release - opendaylight-snapshots - - - - - nexus - ${ecomp.nexus.user} - ${ecomp.nexus.password} - - - openecomp-release - ${ecomp.nexus.user} - ${ecomp.nexus.password} - - - openecomp-snapshot - ${ecomp.nexus.user} - ${ecomp.nexus.password} - - - sdnc-javadoc - ${ecomp.nexus.user} - ${ecomp.nexus.password} - - - diff --git a/mdsal-resource/README.md b/mdsal-resource/README.md new file mode 100644 index 0000000..1044e66 --- /dev/null +++ b/mdsal-resource/README.md @@ -0,0 +1,3 @@ +MDSAL-RESOURCE HAS MOVED TO CCSDK! + +The new location for mdsal-resource is ccsdk/sli/adaptors/mdsal-resource diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml deleted file mode 100755 index 3029dc5..0000000 --- a/mdsal-resource/features/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - - mdsal-resource - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - mdsal-resource-features - MD-SAL Resource Adaptor - Features - - jar - - - - - - org.openecomp.sdnc.adaptors - mdsal-resource-provider - ${project.version} - - - - commons-lang - commons-lang - 2.6 - compile - - - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml - - runtime - - - - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - - - - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - - - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - - - - - - true - src/main/resources - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - - resources - - generate-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - - diff --git a/mdsal-resource/features/src/main/resources/features.xml b/mdsal-resource/features/src/main/resources/features.xml deleted file mode 100644 index 001ca18..0000000 --- a/mdsal-resource/features/src/main/resources/features.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features - - - - - odl-mdsal-broker - sdnc-sli - mvn:org.openecomp.sdnc.adaptors/mdsal-resource-provider/${project.version} - - - diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml deleted file mode 100755 index d65912d..0000000 --- a/mdsal-resource/installer/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - 4.0.0 - - mdsal-resource - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - mdsal-resource-installer - MDSAL Resource - Karaf Installer - pom - - - sdnc-mdsal-resource - sdnc-mdsal-resource - mvn:org.openecomp.sdnc.adaptors/mdsal-resource-features/${project.version}/xml/features - false - - - - - - org.openecomp.sdnc.adaptors - mdsal-resource-features - ${project.version} - features - xml - - - * - * - - - - - - org.openecomp.sdnc.adaptors - mdsal-resource-provider - ${project.version} - - - - - - - - maven-assembly-plugin - 2.6 - - - maven-repo-zip - - single - - package - - false - stage/${application.name}-${project.version} - - src/assembly/assemble_mvnrepo_zip.xml - - false - - - - installer-zip - - single - - package - - true - ${application.name}-${project.version}-installer - - src/assembly/assemble_installer_zip.xml - - false - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - - copy-dependencies - - prepare-package - - false - ${project.build.directory}/assembly/system - false - true - true - true - false - false - org.openecomp.sdnc - sli-common,sli-provider,dblib-provider - provided - - - - - - maven-resources-plugin - 2.6 - - - copy-version - - copy-resources - - validate - - ${basedir}/target/stage - - - src/main/resources/scripts - - install-feature.sh - - true - - - - - - - - - - - - diff --git a/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml b/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml deleted file mode 100644 index 10b53b9..0000000 --- a/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - installer_zip - - zip - - - - false - - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - - - - - diff --git a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml deleted file mode 100644 index 6542ce0..0000000 --- a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - mvnrepo_zip - - zip - - - - false - - - - target/assembly/ - . - - - - - - - - diff --git a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh deleted file mode 100644 index 6e8620e..0000000 --- a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} -ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} -ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} -INSTALLERDIR=$(dirname $0) - -REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip - -if [ -f ${REPOZIP} ] -then - unzip -d ${ODL_HOME} ${REPOZIP} -else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 -fi - -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml deleted file mode 100755 index b74c454..0000000 --- a/mdsal-resource/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - org.openecomp.sdnc.adaptors - sdnc-adaptors - 1.1.2-SNAPSHOT - - - 4.0.0 - pom - org.openecomp.sdnc.adaptors - mdsal-resource - - - MD-SAL Resource Adaptor - The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - - 1.1.2-SNAPSHOT - - - - - - org.openecomp.sdnc.adaptors - mdsal-resource-features - features - xml - ${project.version} - - - - org.openecomp.sdnc.adaptors - mdsal-resource-provider - ${project.version} - - - - - - - - provider - features - installer - - diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml deleted file mode 100755 index dfffa19..0000000 --- a/mdsal-resource/provider/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - 4.0.0 - - org.openecomp.sdnc.adaptors - mdsal-resource - 1.1.2-SNAPSHOT - - mdsal-resource-provider - bundle - MD-SAL Resource Adaptor - Provider - http://maven.apache.org - - UTF-8 - - - - - junit - junit - 3.8.1 - test - - - org.openecomp.sdnc.core - sli-common - ${sdnctl.sli.version} - compile - - - org.openecomp.sdnc.core - sli-provider - ${sdnctl.sli.version} - compile - - - equinoxSDK381 - org.eclipse.osgi - ${equinox.osgi.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - commons-codec - commons-codec - ${commons.codec.version} - - - - - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.openecomp.sdnc.sli.resource.mdsal - org.openecomp.sdnc.sli.resource.mdsal.MdsalResourceActivator - org.openecomp.sdnc.sli.resource.mdsal - org.openecomp.sdnc.sli.*,org.osgi.framework.*,org.slf4j.*,com.mysql.jdbc.* - - * - true - - - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - com.brocade.developer - - - providermodule-plugin - - - [1.2.0.100-SNAPSHOT,) - - - process - - - - - - - - - - - - - - diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java deleted file mode 100644 index 4f5b7f0..0000000 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.mdsal; - -import java.util.Map; - -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; - -public class ConfigResource implements SvcLogicResource { - - private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); - - private RestService restService; - - public ConfigResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) - { - restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); - } - - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - return(query(resource, false, null, key, prefix, null, null)); - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - - return(query(resource, false, null, key, prefix, null, null)); - - } - - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { - - - String module = resource; - StringBuffer restQuery = new StringBuffer(); - - String[] keyParts = key.split("/"); - - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { - - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } - - String restQueryStr = restQuery.toString(); - if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || - (restQueryStr.startsWith("\"") && restQueryStr.endsWith("\""))) { - restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); - } - - String urlString = "restconf/config/" + module + ":" + restQueryStr; - - LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - - Document results = restService.get(urlString); - - - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { - - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } - - } - - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, - SvcLogicContext ctx) throws SvcLogicException { - - - return(QueryStatus.SUCCESS); - - } - - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, - Map arg3, String arg4, SvcLogicContext arg5) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus notify(String resource, String action, String key, - SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } - - - public QueryStatus update(String resource, String key, - Map parms, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return(QueryStatus.SUCCESS); - } - - - -} diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java deleted file mode 100644 index 0780426..0000000 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.mdsal; - -import java.io.File; -import java.io.FileInputStream; -import java.util.LinkedList; -import java.util.Properties; - -import org.openecomp.sdnc.sli.ConfigurationException; -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MdsalResourceActivator implements BundleActivator { - - - - private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - - public LinkedList registrations = new LinkedList(); - - private static final Logger LOG = LoggerFactory - .getLogger(MdsalResourceActivator.class); - - @Override - public void start(BundleContext ctx) throws Exception { - - // Read properties - Properties props = new Properties(); - - String propDir = System.getenv(SDNC_CONFIG_DIR); - if (propDir == null) { - - propDir = "/opt/sdnc/data/properties"; - } - String propPath = propDir + "/mdsal-resource.properties"; - - - File propFile = new File(propPath); - - if (!propFile.exists()) { - - throw new ConfigurationException( - "Missing configuration properties file : " - + propFile); - } - try { - - props.load(new FileInputStream(propFile)); - } catch (Exception e) { - throw new ConfigurationException( - "Could not load properties file " + propPath, e); - - } - - String sdncUser = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-user", "admin"); - String sdncPasswd = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-passwd", "admin"); - String sdncHost = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-host", "localhost"); - String sdncProtocol = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-protocol", "https"); - String sdncPort = props.getProperty("org.openecomp.sdnc.sli.resource.mdsal.sdnc-port", "8443"); - - // Advertise MD-SAL resource adaptors - SvcLogicResource impl = new ConfigResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); - - LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); - registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); - - impl = new OperationalResource(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd); - - LOG.debug("Registering MdsalResource service "+impl.getClass().getName()); - registrations.add(ctx.registerService(impl.getClass().getName(), impl, null)); - } - - @Override - public void stop(BundleContext ctx) throws Exception { - - for (ServiceRegistration registration : registrations) - { - registration.unregister(); - } - } - -} diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java deleted file mode 100644 index 4d7b287..0000000 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.mdsal; - -import java.util.Map; - -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; - -public class OperationalResource implements SvcLogicResource { - - private static final Logger LOG = LoggerFactory.getLogger(OperationalResource.class); - - private RestService restService; - - public OperationalResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) - { - restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); - - - } - - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - return(query(resource, false, null, key, prefix, null, null)); - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException - { - - return(query(resource, false, null, key, prefix, null, null)); - - } - - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { - - - String module = resource; - StringBuffer restQuery = new StringBuffer(); - - String[] keyParts = key.split("/"); - - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { - - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } - - String restQueryStr = restQuery.toString(); - if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || - (restQueryStr.startsWith("\"") && restQueryStr.endsWith("\""))) { - restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); - } - - String urlString = "restconf/operational/" + module + ":" + restQueryStr; - - LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - - Document results = restService.get(urlString); - - - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { - - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } - - } - - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, - SvcLogicContext ctx) throws SvcLogicException { - - - return(QueryStatus.SUCCESS); - - } - - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus save(String arg0, boolean arg1, boolean localOnly, String arg2, - Map arg3, String arg4, SvcLogicContext arg5) - throws SvcLogicException { - // TODO Auto-generated method stub - return(QueryStatus.SUCCESS); - } - - @Override - public QueryStatus notify(String resource, String action, String key, - SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } - - public QueryStatus update(String resource, String key, - Map parms, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return(QueryStatus.SUCCESS); - } - - -} diff --git a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java b/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java deleted file mode 100644 index a8e78c0..0000000 --- a/mdsal-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.mdsal; - -import java.io.BufferedReader; - -import java.io.ByteArrayInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.Authenticator; -import java.net.HttpURLConnection; -import java.net.PasswordAuthentication; -import java.net.URL; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.apache.commons.codec.binary.Base64; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; - - - - -public class RestService { - - private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); - - public enum PayloadType { - XML, - JSON - } - - private class SdncAuthenticator extends Authenticator { - - private String user; - private String passwd; - - SdncAuthenticator(String user, String passwd) { - this.user = user; - this.passwd = passwd; - } - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(user, passwd.toCharArray()); - } - - } - - private String user; - private String passwd; - private PayloadType payloadType; - - private String protocol; - private String host; - private String port; - - public RestService(String protocol, String host, String port, String user, String passwd, PayloadType payloadType) { - this.protocol = protocol; - this.host = host; - this.port = port; - this.user = user; - this.passwd = passwd; - this.payloadType = payloadType; - } - - private HttpURLConnection getRestConnection(String urlString, String method) throws IOException - { - - URL sdncUrl = new URL(urlString); - Authenticator.setDefault(new SdncAuthenticator(user, passwd)); - - HttpURLConnection conn = (HttpURLConnection) sdncUrl.openConnection(); - - String authStr = user+":"+passwd; - String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); - - conn.addRequestProperty("Authentication", "Basic "+encodedAuthStr); - - conn.setRequestMethod(method); - - if (payloadType == PayloadType.XML) { - conn.setRequestProperty("Content-Type", "application/xml"); - conn.setRequestProperty("Accept", "application/xml"); - } else { - - conn.setRequestProperty("Content-Type", "application/json"); - conn.setRequestProperty("Accept", "application/json"); - } - - conn.setDoInput(true); - conn.setDoOutput(true); - conn.setUseCaches(false); - - return(conn); - - } - - - private Document send(String urlString, byte[] msgBytes, String method) { - Document response = null; - String fullUrl = protocol + "://" + host + ":" + port + "/" + urlString; - LOG.info("Sending REST "+method +" to "+fullUrl); - - if (msgBytes != null) { - LOG.info("Message body:\n"+msgBytes); - } - - try { - HttpURLConnection conn = getRestConnection(fullUrl, method); - - if (conn instanceof HttpsURLConnection) { - HostnameVerifier hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier); - } - - // Write message - if (msgBytes != null) { - conn.setRequestProperty("Content-Length", ""+msgBytes.length); - DataOutputStream outStr = new DataOutputStream(conn.getOutputStream()); - outStr.write(msgBytes); - outStr.close(); - } else { - conn.setRequestProperty("Content-Length", "0"); - } - - - // Read response - BufferedReader respRdr; - - LOG.info("Response: "+conn.getResponseCode()+" "+conn.getResponseMessage()); - - - if (conn.getResponseCode() < 300) { - - respRdr = new BufferedReader(new InputStreamReader(conn.getInputStream())); - } else { - respRdr = new BufferedReader(new InputStreamReader(conn.getErrorStream())); - } - - StringBuffer respBuff = new StringBuffer(); - - String respLn; - - while ((respLn = respRdr.readLine()) != null) { - respBuff.append(respLn+"\n"); - } - respRdr.close(); - - String respString = respBuff.toString(); - - LOG.info("Response body :\n"+respString); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - - response = db.parse(new ByteArrayInputStream(respString.getBytes())); - - } catch (Exception e) { - - LOG.error("Caught exception executing REST command", e); - } - - return (response); - } - - - public Document get(String urlString) { - return(send(urlString, null, "GET")); - } - - public Document delete(String urlString) { - return(send(urlString, null, "DELETE")); - } - - public Document post(String urlString, byte[] msgBytes) { - return(send(urlString, msgBytes, "POST")); - } - - public Document put(String urlString, byte[] msgBytes) { - return(send(urlString, msgBytes, "PUT")); - } -} diff --git a/mdsal-resource/provider/src/main/resources/IPV4_ADDRESS_POOL.csv b/mdsal-resource/provider/src/main/resources/IPV4_ADDRESS_POOL.csv deleted file mode 100755 index 30ce117..0000000 --- a/mdsal-resource/provider/src/main/resources/IPV4_ADDRESS_POOL.csv +++ /dev/null @@ -1,9 +0,0 @@ -"192.168.1.2","OAM","AVAILABLE" -"192.168.1.3","OAM","AVAILABLE" -"192.168.1.4","OAM","AVAILABLE" -"192.168.1.5","OAM","AVAILABLE" -"192.168.1.6","OAM","AVAILABLE" -"192.168.1.7","OAM","AVAILABLE" -"192.168.1.8","OAM","AVAILABLE" -"192.168.1.9","OAM","AVAILABLE" -"192.168.1.10","OAM","AVAILABLE" diff --git a/mdsal-resource/provider/src/main/resources/VLAN_ID_POOL.csv b/mdsal-resource/provider/src/main/resources/VLAN_ID_POOL.csv deleted file mode 100755 index 6c4b0f7..0000000 --- a/mdsal-resource/provider/src/main/resources/VLAN_ID_POOL.csv +++ /dev/null @@ -1,22 +0,0 @@ -"1100","IPAG","AVAILABLE",NULL -"1101","IPAG","AVAILABLE",NULL -"1102","IPAG","AVAILABLE",NULL -"1103","IPAG","AVAILABLE",NULL -"1104","IPAG","AVAILABLE",NULL -"1105","IPAG","AVAILABLE",NULL -"1106","IPAG","AVAILABLE",NULL -"1107","IPAG","AVAILABLE",NULL -"1108","IPAG","AVAILABLE",NULL -"1109","IPAG","AVAILABLE",NULL -"1110","IPAG","AVAILABLE",NULL -"1200","VPE","AVAILABLE",NULL -"1201","VPE","AVAILABLE",NULL -"1202","VPE","AVAILABLE",NULL -"1203","VPE","AVAILABLE",NULL -"1204","VPE","AVAILABLE",NULL -"1205","VPE","AVAILABLE",NULL -"1206","VPE","AVAILABLE",NULL -"1207","VPE","AVAILABLE",NULL -"1208","VPE","AVAILABLE",NULL -"1209","VPE","AVAILABLE",NULL -"1210","VPE","AVAILABLE",NULL diff --git a/mdsal-resource/provider/src/main/resources/crtables.sql b/mdsal-resource/provider/src/main/resources/crtables.sql deleted file mode 100644 index 08398bd..0000000 --- a/mdsal-resource/provider/src/main/resources/crtables.sql +++ /dev/null @@ -1,70 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -CREATE TABLE sdnctl.VNF ( -vnf_id varchar(80) NOT NULL, -vnf_name varchar(80) NOT NULL, -vnf_type varchar(10) NOT NULL, -orchestration_status varchar(20), -heat_stack_id varchar(80), -mso_catalog_key varchar(80), -availability_zone varchar(80), -aic_site_id varchar(80), -oam_ipv4_address varchar(20), -CONSTRAINT P_VNF PRIMARY KEY(vnf_id)); - -CREATE TABLE sdnctl.VNF_NETWORK_CONNECTION ( -connection_uuid varchar(80) NOT NULL, -vnf_id varchar(80) NOT NULL, -connection_id varchar(80), -connection_type varchar(20), -neutron_network_id varchar(80), -neutron_network_name varchar(80), -orchestration_status varchar(20), -switch_id varchar(40), -heat_stack_id varchar(80), -mso_catalog_key varchar(80), -provider_network varchar(80), -port_group_id varchar(80), -port_group_name varchar(80), -CONSTRAINT P_NETWORK_CONNECTION PRIMARY KEY(connection_uuid)); - -CREATE TABLE sdnctl.VNF_NETWORK_CONNECTION_VLAN ( -vlan_uuid varchar(80) NOT NULL, -vlan_id numeric(4) NOT NULL, -vlan_type varchar(5) NOT NULL, -connection_uuid varchar(80), -CONSTRAINT P_VNF_NETWORK_CONNECTION_VLAN PRIMARY KEY(vlan_uuid)); - -CREATE TABLE sdnctl.VLAN_ID_POOL ( -vlan_id numeric(4) NOT NULL, -universe varchar(40) NOT NULL, -status varchar(40) NOT NULL, -vlan_uuid varchar(80), -CONSTRAINT P_VLAN_ID_POOL PRIMARY KEY(vlan_id,universe)); - -CREATE TABLE sdnctl.IPV4_ADDRESS_POOL ( -ipv4_addr varchar(20) NOT NULL, -universe varchar(40) NOT NULL, -status varchar(40) NOT NULL, -CONSTRAINT P_IPV4_ADDRESS_POOL PRIMARY KEY(ipv4_addr, universe)); - - diff --git a/mdsal-resource/provider/src/main/resources/svclogic.properties b/mdsal-resource/provider/src/main/resources/svclogic.properties deleted file mode 100644 index 3821a0a..0000000 --- a/mdsal-resource/provider/src/main/resources/svclogic.properties +++ /dev/null @@ -1,26 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -org.openecomp.sdnc.sli.dbtype = jdbc -org.openecomp.sdnc.sli.jdbc.url = jdbc:mysql://dbhost:3306/sdnctl -org.openecomp.sdnc.sli.jdbc.database = sdnctl -org.openecomp.sdnc.sli.jdbc.user = sdnctl -org.openecomp.sdnc.sli.jdbc.password = gamma diff --git a/pom.xml b/pom.xml index 7f016b7..c1c43db 100755 --- a/pom.xml +++ b/pom.xml @@ -1,119 +1,22 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - org.openecomp.sdnc.core - root-boron-sr1 - 1.1.0 - - 4.0.0 - pom - org.openecomp.sdnc.adaptors - sdnc-adaptors + 4.0.0 + pom + org.openecomp.sdnc.adaptors + sdnc-adaptors + 1.2.0-SNAPSHOT - SDN-C Adaptors - https://wiki.openecomp.org - The SDN-C core components contains the SLI, dblib and root pom - - - - JIRA - https://jira.openecomp.org/ - - - - - scm:git:ssh://git@${openecomp.git.host}/sdnc-adaptors.git - scm:git:ssh://${openecomp.git.host}:${openecomp.git.port}/${openecomp.git.project}/sdnc-adaptors.git - ${openecomp.git.protocol}://${openecomp.git.host}/projects/${openecomp.git.project}/repos/sdnc-adaptors/browse - - - - Jenkins - https://jenkins.openecomp.org/ - - - - - sdnc-javadoc - dav:https://${openecomp.nexus.host}/content/sites/site/org/onap/sdnc/adaptors/${project.artifactId}/${project.version} - - - - - - blackduck - - - blackduck-scan - - - - - - com.blackducksoftware.integration - hub-maven-plugin - 1.4.0 - false - - ${project.name} - ${project.basedir} - - - - create-bdio-file - package - - createHubOutput - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.17 - - true - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - https://${openecomp.nexus.host} - ${openecomp.nexus.staging.profile-id} - ${openecomp.nexus.staging.server-id} - - - - - - - aai-service - mdsal-resource - resource-assignment - sql-resource - - - OpenECOMP - - 1.1.2-SNAPSHOT + SDN-C Adaptors + https://wiki.openecomp.org + The SDN-C core components contains the SLI, dblib and root pom + + org.onap.oparent + oparent + 1.0.0-SNAPSHOT + diff --git a/resource-assignment/README.md b/resource-assignment/README.md new file mode 100644 index 0000000..28621c4 --- /dev/null +++ b/resource-assignment/README.md @@ -0,0 +1,3 @@ +RESOURCE-ASSIGNMENT HAS MOVED TO CCSDK! + +The new location for resource-assignment is ccsdk/sli/adaptors/resource-assignment diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml deleted file mode 100755 index 4e9dcf5..0000000 --- a/resource-assignment/features/pom.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - 4.0.0 - - resource-assignment - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - resource-assignment-features - Resource Assignment Adaptor - Features - - jar - - - - - - org.openecomp.sdnc.adaptors - resource-assignment-provider - ${project.version} - - - - commons-lang - commons-lang - 2.6 - compile - - - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml - - runtime - - - - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - - - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - - - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - - - - - - true - src/main/resources - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - - resources - - generate-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - - diff --git a/resource-assignment/features/src/main/resources/features.xml b/resource-assignment/features/src/main/resources/features.xml deleted file mode 100644 index 57ef718..0000000 --- a/resource-assignment/features/src/main/resources/features.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features - - - sdnc-sli - sdnc-dblib - spring - spring-jdbc - spring-dm - mvn:org.openecomp.sdnc.adaptors/resource-assignment-provider/${project.version} - mvn:mysql/mysql-connector-java/${mysql.connector.version} - - - diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml deleted file mode 100755 index db04f6f..0000000 --- a/resource-assignment/installer/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - 4.0.0 - - resource-assignment - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - resource-assignment-installer - Resource allocator- Karaf Installer - pom - - - sdnc-resource-assignment - sdnc-resource-assignment - mvn:org.openecomp.sdnc.adaptors/resource-assignment-features/${project.version}/xml/features - false - - - - - - org.openecomp.sdnc.adaptors - resource-assignment-features - ${project.version} - features - xml - - - * - * - - - - - - org.openecomp.sdnc.adaptors - resource-assignment-provider - ${project.version} - - - - - - - - maven-assembly-plugin - 2.6 - - - maven-repo-zip - - single - - package - - false - stage/${application.name}-${project.version} - - src/assembly/assemble_mvnrepo_zip.xml - - false - - - - installer-zip - - single - - package - - true - ${application.name}-${project.version}-installer - - src/assembly/assemble_installer_zip.xml - - false - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - - copy-dependencies - - prepare-package - - false - ${project.build.directory}/assembly/system - false - true - true - true - false - false - org.openecomp.sdnc - sli-common,sli-provider,dblib-provider - provided - - - - - - maven-resources-plugin - 2.6 - - - copy-version - - copy-resources - - validate - - ${basedir}/target/stage - - - src/main/resources/scripts - - install-feature.sh - - true - - - - - - - - - - - - diff --git a/resource-assignment/installer/src/assembly/assemble_installer_zip.xml b/resource-assignment/installer/src/assembly/assemble_installer_zip.xml deleted file mode 100644 index 10b53b9..0000000 --- a/resource-assignment/installer/src/assembly/assemble_installer_zip.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - installer_zip - - zip - - - - false - - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - - - - - diff --git a/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml b/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml deleted file mode 100644 index 6542ce0..0000000 --- a/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - mvnrepo_zip - - zip - - - - false - - - - target/assembly/ - . - - - - - - - - diff --git a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh deleted file mode 100644 index 6e8620e..0000000 --- a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} -ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} -ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} -INSTALLERDIR=$(dirname $0) - -REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip - -if [ -f ${REPOZIP} ] -then - unzip -d ${ODL_HOME} ${REPOZIP} -else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 -fi - -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml deleted file mode 100755 index 21ce650..0000000 --- a/resource-assignment/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - org.openecomp.sdnc.adaptors - sdnc-adaptors - 1.1.2-SNAPSHOT - - - 4.0.0 - pom - org.openecomp.sdnc.adaptors - resource-assignment - 1.1.2-SNAPSHOT - - - Resource Assignment Adaptor - The resource assignment adaptor allows service logic to check and allocate network capacity - - - - - org.openecomp.sdnc.adaptors - resource-assignment-features - features - xml - ${project.version} - - - - org.openecomp.sdnc.adaptors - resource-assignment-provider - ${project.version} - - - - - - provider - features - installer - - - diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml deleted file mode 100755 index 97fd908..0000000 --- a/resource-assignment/provider/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - 4.0.0 - - org.openecomp.sdnc.adaptors - resource-assignment - 1.1.2-SNAPSHOT - - resource-assignment-provider - bundle - Resource Assignment Adaptor - Provider - http://maven.apache.org - - UTF-8 - - - - junit - junit - test - ${junit.version} - - - org.springframework - spring-test - ${spring.version} - test - - - com.h2database - h2 - ${h2database.version} - test - - - org.openecomp.sdnc.core - sli-common - ${sdnctl.sli.version} - compile - - - org.openecomp.sdnc.core - sli-provider - ${sdnctl.sli.version} - compile - - - org.openecomp.sdnc.core - dblib-provider - ${sdnctl.dblib.version} - runtime - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - mysql - mysql-connector-java - ${mysql.connector.version} - jar - runtime - - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - - - - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.openecomp.sdnc.ra - org.openecomp.sdnc.ra - *,org.openecomp.sdnc.sli.resource.dblib,org.openecomp.sdnc.sli.*,org.osgi.framework.*,org.slf4j.*,com.mysql.jdbc.* - - true - - - - - - - - - - - - diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java deleted file mode 100644 index 034b2bc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.comp; - -import java.util.Collection; - -public interface LockHelper { - - void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */); - - void unlock(String resourceName, boolean force); - - void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */); - - void unlock(Collection resourceNameList, boolean force); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java deleted file mode 100644 index 5474995..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.comp; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import org.openecomp.sdnc.lock.dao.ResourceLockDao; -import org.openecomp.sdnc.lock.data.ResourceLock; - -public class LockHelperImpl implements LockHelper { - - private ResourceLockDao resourceLockDao; - private int retryCount = 10; - private int lockWait = 5; // Seconds - - @Override - public void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */) { - lock(Collections.singleton(resourceName), lockRequester, lockTimeout); - } - - @Override - public void unlock(String resourceName, boolean force) { - unlock(Collections.singleton(resourceName), force); - } - - @Override - public void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */) { - for (int i = 0; true; i++) { - try { - tryLock(resourceNameList, lockRequester, lockTimeout); - return; - } catch (ResourceLockedException e) { - if (i > retryCount) - throw e; - try { - Thread.sleep(lockWait * 1000); - } catch (InterruptedException ex) { - } - } - } - } - - @Override - public void unlock(Collection lockNames, boolean force) { - if (lockNames == null || lockNames.size() == 0) - return; - - resourceLockDao.lockTable(); - - try { - for (String name : lockNames) { - ResourceLock l = resourceLockDao.getByResourceName(name); - if (l != null) - if (force || l.lockCount == 1) - resourceLockDao.delete(l.id); - else - resourceLockDao.decrementLockCount(l.id); - } - } finally { - resourceLockDao.unlockTable(); - } - } - - public void tryLock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */) { - if (resourceNameList == null || resourceNameList.size() == 0) - return; - - lockRequester = generateLockRequester(lockRequester, 100); - - resourceLockDao.lockTable(); - - try { - // First check if all requested records are available to lock - - Date now = new Date(); - - List dbLockList = new ArrayList(); - List insertLockNameList = new ArrayList(); - for (String name : resourceNameList) { - ResourceLock l = resourceLockDao.getByResourceName(name); - - boolean canLock = - l == null || now.getTime() > l.expirationTime.getTime() || lockRequester != null && - lockRequester.equals(l.lockHolder) || l.lockCount <= 0; - if (!canLock) - throw new ResourceLockedException(l.resourceName, l.lockHolder, lockRequester); - - if (l != null) - dbLockList.add(l); - else - insertLockNameList.add(name); - } - - // Update the lock info in DB - for (ResourceLock l : dbLockList) - resourceLockDao.update(l.id, now, new Date(now.getTime() + lockTimeout * 1000), l.lockCount + 1); - - // Insert records for those that are not yet there - for (String lockName : insertLockNameList) { - ResourceLock l = new ResourceLock(); - l.resourceName = lockName; - l.lockHolder = lockRequester; - l.lockTime = now; - l.expirationTime = new Date(now.getTime() + lockTimeout * 1000); - l.lockCount = 1; - resourceLockDao.add(l); - } - } finally { - resourceLockDao.unlockTable(); - } - } - - private static String generateLockRequester(String name, int maxLength) { - if (name == null) - name = ""; - int l1 = name.length(); - String tname = Thread.currentThread().getName(); - int l2 = tname.length(); - if (l1 + l2 + 1 > maxLength) { - int maxl1 = maxLength / 2; - if (l1 > maxl1) { - name = name.substring(0, maxl1); - l1 = maxl1; - } - int maxl2 = maxLength - l1 - 1; - if (l2 > maxl2) - tname = tname.substring(0, 6) + "..." + tname.substring(l2 - maxl2 + 9); - } - return tname + '-' + name; - } - - public void setResourceLockDao(ResourceLockDao resourceLockDao) { - this.resourceLockDao = resourceLockDao; - } - - public void setRetryCount(int retryCount) { - this.retryCount = retryCount; - } - - public void setLockWait(int lockWait /* Seconds */) { - this.lockWait = lockWait; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java deleted file mode 100644 index ededa31..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.comp; - -public class ResourceLockedException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - private String lockName, lockHolder, lockRequester; - - public ResourceLockedException(String lockName, String lockHolder, String lockRequester) { - this.lockName = lockName; - this.lockHolder = lockHolder; - this.lockRequester = lockRequester; - } - - @Override - public String getMessage() { - return "Failed to lock [" + lockName + "] for [" + lockRequester + "]. Currently locked by [" + lockHolder + - "]."; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java deleted file mode 100644 index 194c7e2..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.comp; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -public abstract class SynchronizedFunction { - - private Set synchset; - private String lockRequester; - private int lockTimeout; // Seconds - private LockHelper lockHelper; - - protected SynchronizedFunction(LockHelper lockHelper, Collection synchset, int lockTimeout) { - this.lockHelper = lockHelper; - this.synchset = new HashSet(synchset); - this.lockRequester = generateLockRequester(); - this.lockTimeout = lockTimeout; - } - - protected abstract void _exec(); - - public void exec() { - lockHelper.lock(synchset, lockRequester, lockTimeout); - try { - _exec(); - } finally { - lockHelper.unlock(synchset, true); - } - } - - private static String generateLockRequester() { - return "SynchronizedFunction-" + (int) (Math.random() * 1000000); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java deleted file mode 100644 index 22d13ff..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.dao; - -import java.util.Date; - -import org.openecomp.sdnc.lock.data.ResourceLock; - -public interface ResourceLockDao { - - void lockTable(); - - void unlockTable(); - - void add(ResourceLock l); - - void update(long id, Date lockTime, Date expirationTime, int lockCount); - - ResourceLock getByResourceName(String resourceName); - - void delete(long id); - - void decrementLockCount(long id); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java deleted file mode 100644 index d35353d..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Date; -import java.util.List; - -import org.openecomp.sdnc.lock.data.ResourceLock; -import org.openecomp.sdnc.util.db.CachedDataSourceWrap; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class ResourceLockDaoImpl implements ResourceLockDao { - - private static final Logger log = LoggerFactory.getLogger(ResourceLockDaoImpl.class); - - private JdbcTemplate jdbcTemplate; - private boolean testing = false; - - @Override - public void lockTable() { - if (!testing) { - jdbcTemplate.update("LOCK TABLES RESOURCE_LOCK WRITE"); - log.info("Table RESOURCE_LOCK locked."); - } - } - - @Override - public void unlockTable() { - if (!testing) { - jdbcTemplate.update("UNLOCK TABLES"); - log.info("Table RESOURCE_LOCK unlocked."); - - CachedDataSourceWrap ds = (CachedDataSourceWrap) jdbcTemplate.getDataSource(); - ds.releaseConnection(); - } - } - - @Override - public void add(ResourceLock l) { - jdbcTemplate.update( - "INSERT INTO RESOURCE_LOCK (resource_name, lock_holder, lock_count, lock_time, expiration_time)\n" + - "VALUES (?, ?, ?, ?, ?)", - new Object[] { l.resourceName, l.lockHolder, l.lockCount, l.lockTime, l.expirationTime }); - } - - @Override - public void update(long id, Date lockTime, Date expirationTime, int lockCount) { - jdbcTemplate.update( - "UPDATE RESOURCE_LOCK SET lock_time = ?, expiration_time = ?, lock_count = ? WHERE resource_lock_id = ?", - new Object[] { lockTime, expirationTime, lockCount, id }); - } - - @Override - public ResourceLock getByResourceName(String resourceName) { - List ll = jdbcTemplate.query("SELECT * FROM RESOURCE_LOCK WHERE resource_name = ?", - new Object[] { resourceName }, new RowMapper() { - - @Override - public ResourceLock mapRow(ResultSet rs, int rowNum) throws SQLException { - ResourceLock rl = new ResourceLock(); - rl.id = rs.getLong("resource_lock_id"); - rl.resourceName = rs.getString("resource_name"); - rl.lockHolder = rs.getString("lock_holder"); - rl.lockCount = rs.getInt("lock_count"); - rl.lockTime = rs.getTimestamp("lock_time"); - rl.expirationTime = rs.getTimestamp("expiration_time"); - return rl; - } - }); - return ll != null && !ll.isEmpty() ? ll.get(0) : null; - } - - @Override - public void delete(long id) { - jdbcTemplate.update("DELETE FROM RESOURCE_LOCK WHERE resource_lock_id = ?", new Object[] { id }); - } - - @Override - public void decrementLockCount(long id) { - jdbcTemplate.update("UPDATE RESOURCE_LOCK SET lock_count = lock_count - 1 WHERE resource_lock_id = ?", - new Object[] { id }); - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - public void setTesting(boolean testing) { - this.testing = testing; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java deleted file mode 100644 index 4707583..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.lock.data; - -import java.util.Date; - -public class ResourceLock { - - public long id; - public String resourceName; - public String lockHolder; - public int lockCount; - public Date lockTime; - public Date expirationTime; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java deleted file mode 100644 index b9a95dd..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra; - -public enum ReleaseRequestType { - Cancel, Activate, Disconnect; - - public static ReleaseRequestType convert(Object o) { - if (o == null) - return null; - String s = o.toString(); - s = s.trim(); - if (s.length() == 0) - return null; - - if (s.equalsIgnoreCase("Cancel")) - return Cancel; - if (s.equalsIgnoreCase("Activate")) - return Activate; - if (s.equalsIgnoreCase("Disconnect")) - return Disconnect; - - throw new IllegalArgumentException("Invalid request-type: " + s + - ". Supported values are Cancel, Activate, Disconnect."); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java deleted file mode 100644 index da14f30..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra; - -public enum ReserveRequestType { - New, Change; - - public static ReserveRequestType convert(Object o) { - if (o == null) - return null; - String s = o.toString(); - s = s.trim(); - if (s.length() == 0) - return null; - - if (s.equalsIgnoreCase("New")) - return New; - if (s.equalsIgnoreCase("Change")) - return Change; - - throw new IllegalArgumentException("Invalid request-type: " + s + - ". Supported values are New, Change."); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java deleted file mode 100644 index e5612c7..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java +++ /dev/null @@ -1,1016 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EndPointAllocator; -import org.openecomp.sdnc.ra.comp.EndPointData; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.dao.ServerDao; -import org.openecomp.sdnc.ra.equip.dao.VpePortDao; -import org.openecomp.sdnc.ra.equip.dao.VplspePortDao; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; -import org.openecomp.sdnc.ra.rule.comp.AllocationRequestBuilder; -import org.openecomp.sdnc.ra.rule.dao.MaxPortSpeedDao; -import org.openecomp.sdnc.ra.rule.dao.MaxServerSpeedDao; -import org.openecomp.sdnc.ra.rule.dao.ParameterDao; -import org.openecomp.sdnc.ra.rule.data.ThresholdStatus; -import org.openecomp.sdnc.ra.service.dao.ServiceResourceDao; -import org.openecomp.sdnc.ra.service.data.ServiceResource; -import org.openecomp.sdnc.ra.service.data.ServiceStatus; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.AllocationOutcome; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.AllocationStatus; -import org.openecomp.sdnc.rm.data.LimitAllocationOutcome; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationOutcome; -import org.openecomp.sdnc.rm.data.RangeAllocationItem; -import org.openecomp.sdnc.rm.data.RangeResource; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.util.speed.SpeedUtil; -import org.openecomp.sdnc.util.str.StrUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ResourceAllocator implements SvcLogicResource { - - private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); - - public ResourceAllocator() { - log.info("ResourceAllocator created."); - } - - private ServerDao serverDao; - private VpePortDao vpePortDao; - private VplspePortDao vplspePortDao; - private MaxPortSpeedDao maxPortSpeedDao; - private MaxServerSpeedDao maxServerSpeedDao; - private ServiceResourceDao serviceResourceDao; - private ParameterDao parameterDao; - - private AllocationRequestBuilder allocationRequestBuilder; - private ResourceManager resourceManager; - private SpeedUtil speedUtil; - - private EndPointAllocator endPointAllocator; - - @Override - public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) - throws SvcLogicException { - return (QueryStatus.SUCCESS); - } - - @Override - public QueryStatus update( - String resource, - String key, - Map parms, - String prefix, - SvcLogicContext ctx) throws SvcLogicException { - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus delete(String arg0, String arg1, SvcLogicContext arg2) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus save( - String arg0, - boolean arg1, - boolean arg2, - String arg3, - Map arg4, - String arg5, - SvcLogicContext arg6) throws SvcLogicException { - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - String serviceModel = ctx.getAttribute("tmp.resource-allocator.service-model"); - if (serviceModel != null && serviceModel.trim().length() > 0) - return allocateResources(serviceModel, ctx, true, prefix); - return allocateResourcesL3SDN(ctx, true, prefix); - } - - @Override - public QueryStatus query( - String resource, - boolean localOnly, - String select, - String key, - String prefix, - String orderBy, - SvcLogicContext ctx) throws SvcLogicException { - - prefix = prefix == null ? "" : prefix + '.'; - - if (!resource.equals("NetworkCapacity")) { - log.info("resource: " + resource); - log.info("key: " + key); - - Resource r = resourceManager.getResource(resource, key); - if (r == null) - return QueryStatus.NOT_FOUND; - - if (r instanceof LimitResource) { - ctx.setAttribute(prefix + "used", String.valueOf(((LimitResource) r).used)); - - log.info("Added context attr: " + prefix + "used: " + String.valueOf(((LimitResource) r).used)); - } - - return QueryStatus.SUCCESS; - } - - log.info("key: " + key); - log.info("prefix: " + prefix); - - if (key == null) - return QueryStatus.SUCCESS; - - if (key.startsWith("'") && key.endsWith("'")) - key = key.substring(1, key.length() - 1); - - String endPointPosition = "VPE-Cust"; - - String resourceUnionId = key + '/' + endPointPosition; - List rlist = resourceManager.getResourceUnion(resourceUnionId); - - log.info("Resources found for " + resourceUnionId + ": " + rlist.size()); - - String assetId = null; - for (Resource r : rlist) { - log.info("Resource: " + r.resourceKey.resourceName); - - if (r instanceof RangeResource) { - RangeResource rr = (RangeResource) r; - for (AllocationItem ai : r.allocationItems) - if (ai.resourceUnionId.equals(resourceUnionId)) { - RangeAllocationItem rai = (RangeAllocationItem) ai; - ctx.setAttribute(prefix + r.resourceKey.resourceName, String.valueOf(rai.used.first())); - - log.info("Added context attr: " + prefix + r.resourceKey.resourceName + ": " + - String.valueOf(rr.used.first())); - - assetId = r.resourceKey.assetId; - String vpeName = assetId; - int i1 = assetId.indexOf('/'); - if (i1 > 0) - vpeName = assetId.substring(0, i1); - ctx.setAttribute(prefix + "vpe-name", vpeName); - - log.info("Added context attr: " + prefix + "vpe-name: " + vpeName); - } - } - } - - String affinityLink = "1"; - if (assetId != null) { - for (Resource r : rlist) { - if (r instanceof LimitResource) { - LimitResource ll = (LimitResource) r; - if (ll.resourceKey.assetId.startsWith(assetId + '-')) { - int i1 = ll.resourceKey.assetId.lastIndexOf('-'); - affinityLink = ll.resourceKey.assetId.substring(i1 + 1); - break; - } - } - } - } - - ctx.setAttribute(prefix + "affinity-link", affinityLink); - - log.info("Added context attr: " + prefix + "affinity-link: " + affinityLink); - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - String serviceModel = ctx.getAttribute("tmp.resource-allocator.service-model"); - if (serviceModel != null && serviceModel.trim().length() > 0) - return allocateResources(serviceModel, ctx, false, prefix); - return allocateResourcesL3SDN(ctx, false, prefix); - } - - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - String serviceInstanceId = ctx.getAttribute("tmp.resource-allocator.service-instance-id"); - if (serviceInstanceId == null) - throw new SvcLogicException("tmp.resource-allocator.service-instance-id is required in ResourceAllocator"); - - String requestTypeStr = ctx.getAttribute("tmp.resource-allocator.request-type"); - if (requestTypeStr == null) - throw new SvcLogicException("tmp.resource-allocator.request-type is required in ResourceAllocator"); - - ReleaseRequestType requestType = null; - try { - requestType = ReleaseRequestType.convert(requestTypeStr); - } catch (IllegalArgumentException e) { - throw new SvcLogicException("Invalid tmp.resource-allocator.request-type: " + requestTypeStr + - ". Supported values are Cancel, Activate, Disconnect."); - } - - log.info("Starting release: " + requestType + " for: " + serviceInstanceId); - - ServiceResource activeServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Active); - ServiceResource pendingServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Pending); - - log.info("Active ServiceResource: "); - StrUtil.info(log, activeServiceResource); - log.info("Pending ServiceResource: "); - StrUtil.info(log, pendingServiceResource); - - if (requestType == ReleaseRequestType.Cancel) { - if (pendingServiceResource != null) { - log.info("Releasing pending resources: " + pendingServiceResource.resourceSetId); - - resourceManager.releaseResourceSet(pendingServiceResource.resourceSetId); - serviceResourceDao.deleteServiceResource(serviceInstanceId, ServiceStatus.Pending); - } else { - log.info("Pending record not found for service instance: " + serviceInstanceId + ". Nothing to do."); - } - - } else if (requestType == ReleaseRequestType.Activate) { - if (pendingServiceResource != null) { - if (activeServiceResource != null) { - log.info("Releasing active resources: " + activeServiceResource.resourceSetId); - - resourceManager.releaseResourceSet(activeServiceResource.resourceSetId); - serviceResourceDao.deleteServiceResource(serviceInstanceId, ServiceStatus.Active); - } - - log.info("Updating the status of the pending record to active."); - - serviceResourceDao.updateServiceStatus(serviceInstanceId, ServiceStatus.Pending, ServiceStatus.Active); - } else { - log.info("Pending record not found for service instance: " + serviceInstanceId + ". Nothing to do."); - } - - } else if (requestType == ReleaseRequestType.Disconnect) { - if (pendingServiceResource != null) { - log.info("Releasing pending resources: " + pendingServiceResource.resourceSetId); - - resourceManager.releaseResourceSet(pendingServiceResource.resourceSetId); - serviceResourceDao.deleteServiceResource(serviceInstanceId, ServiceStatus.Pending); - } - if (activeServiceResource != null) { - log.info("Releasing active resources: " + activeServiceResource.resourceSetId); - - resourceManager.releaseResourceSet(activeServiceResource.resourceSetId); - serviceResourceDao.deleteServiceResource(serviceInstanceId, ServiceStatus.Active); - } - } - - return QueryStatus.SUCCESS; - } - - private QueryStatus allocateResourcesL3SDN(SvcLogicContext ctx, boolean checkOnly, String prefix) - throws SvcLogicException { - prefix = prefix == null ? "" : prefix + '.'; - - String aicSiteId = getAicSiteId(ctx); - Map service = getServiceData(ctx); - - String requestTypeStr = ctx.getAttribute("tmp.resource-allocator.request-type"); - if (requestTypeStr == null) - requestTypeStr = "New"; - - ReserveRequestType requestType = null; - try { - requestType = ReserveRequestType.convert(requestTypeStr); - } catch (IllegalArgumentException e) { - throw new SvcLogicException("Invalid tmp.resource-allocator.request-type: " + requestTypeStr + - ". Supported values are New, Change."); - } - - String serviceInstanceId = String.valueOf(service.get("service-instance-id")); - - ServiceResource activeServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Active); - ServiceResource pendingServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Pending); - - log.info("Active ServiceResource: "); - StrUtil.info(log, activeServiceResource); - log.info("Pending ServiceResource: "); - StrUtil.info(log, pendingServiceResource); - - ServiceResource sr = new ServiceResource(); - sr.serviceInstanceId = serviceInstanceId; - sr.serviceStatus = ServiceStatus.Pending; - sr.serviceChangeNumber = 1; - if (pendingServiceResource != null) - sr.serviceChangeNumber = pendingServiceResource.serviceChangeNumber + 1; - else if (activeServiceResource != null) - sr.serviceChangeNumber = activeServiceResource.serviceChangeNumber + 1; - sr.resourceSetId = serviceInstanceId + "/" + sr.serviceChangeNumber; - sr.resourceUnionId = serviceInstanceId; - - log.info("New ServiceResource: "); - StrUtil.info(log, sr); - - List> vpePortData = vpePortDao.getVpePortData(aicSiteId); - List> vplspePortData = vplspePortDao.getVplspePortData(aicSiteId); - List> serverData = serverDao.getServerData(aicSiteId); - - vpePortData = orderVpe(vpePortData); - - long maxAvailableSpeedVpePort = 0; - boolean vpePortFound = false; - - for (Map vpe : vpePortData) { - String vpeId = String.valueOf(vpe.get("vpe-id")); - String interfaceName = String.valueOf(vpe.get("physical-interface-name")); - String portId = vpeId + "/" + interfaceName; - - log.info("Checking VPE port: " + portId); - - String provStatus = String.valueOf(vpe.get("provisioning-status")); - if (!provStatus.equals("PROV")) { - log.info("Skipping port " + portId + ": Provisioning status is not PROV."); - continue; - } - - String imageFile = String.valueOf(vpe.get("image-file-name")); - String endPointPosition = "VPE-Cust"; - long maxPortSpeed = maxPortSpeedDao.getMaxPortSpeed(imageFile, endPointPosition, interfaceName); - vpe.put("max-port-speed", maxPortSpeed); - - EquipmentData ed = new EquipmentData(); - ed.data = vpe; - ed.equipmentId = portId; - ed.equipmentLevel = EquipmentLevel.Port; - - ServiceData sd = new ServiceData(); - sd.data = service; - sd.serviceModel = "L3SDN"; - sd.endPointPosition = endPointPosition; - sd.resourceUnionId = sr.resourceUnionId; - sd.resourceSetId = sr.resourceSetId; - - StrUtil.info(log, ed); - StrUtil.info(log, sd); - - AllocationRequest ar = allocationRequestBuilder.buildAllocationRequest(sd, ed, checkOnly, - requestType == ReserveRequestType.Change); - AllocationOutcome ao = resourceManager.allocateResources(ar); - - if (ao.status == AllocationStatus.Success) { - - // Assign affinity link - if (!checkOnly) { - List affinityLinkIdList = new ArrayList<>(); - affinityLinkIdList.add("0"); - affinityLinkIdList.add("1"); - affinityLinkIdList.add("2"); - affinityLinkIdList.add("3"); - - String preferedAffinityLinkId = "0"; - long lowestAssignedBw = Long.MAX_VALUE; - for (String affinityLinkId : affinityLinkIdList) { - long used = 0; - String assetId = ed.equipmentId + "-" + affinityLinkId; - Resource r = resourceManager.getResource("Bandwidth", assetId); - if (r != null) { - LimitResource ll = (LimitResource) r; - used = ll.used; - } - if (used < lowestAssignedBw) { - lowestAssignedBw = used; - preferedAffinityLinkId = affinityLinkId; - } - log.info("Assigned bandwidth on affinity link: " + assetId + ": " + used); - } - - log.info("Prefered affinity link for " + ed.equipmentId + ": " + preferedAffinityLinkId); - - ctx.setAttribute(prefix + "affinity-link", preferedAffinityLinkId); - - LimitAllocationRequest ar1 = new LimitAllocationRequest(); - ar1.resourceSetId = sd.resourceSetId; - ar1.resourceUnionId = sd.resourceUnionId; - ar1.resourceShareGroupList = null; - ar1.resourceName = "Bandwidth"; - ar1.assetId = ed.equipmentId + "-" + preferedAffinityLinkId; - ar1.missingResourceAction = AllocationAction.Succeed_Allocate; - ar1.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar1.replace = true; - ar1.strict = false; - ar1.checkLimit = Long.MAX_VALUE; - ar1.checkCount = 0; - ar1.allocateCount = (Long) sd.data.get("service-speed-kbps"); - - resourceManager.allocateResources(ar1); - } - - ctx.setAttribute(prefix + "vpe-name", vpeId); - - vpePortFound = true; - break; - } - - if (ao instanceof LimitAllocationOutcome) { - LimitAllocationOutcome lao = (LimitAllocationOutcome) ao; - long available = lao.limit - lao.used; - if (available > maxAvailableSpeedVpePort) - maxAvailableSpeedVpePort = available; - } - } - - long maxAvailableSpeedVplspePort = 0; - boolean vplspePortFound = false; - - for (Map vplspe : vplspePortData) { - String vplspeId = String.valueOf(vplspe.get("vplspe-id")); - String interfaceName = String.valueOf(vplspe.get("physical-interface-name")); - String portId = vplspeId + "/" + interfaceName; - - log.info("Checking VPLSPE port: " + portId); - - String provStatus = String.valueOf(vplspe.get("provisioning-status")); - if (!provStatus.equals("PROV")) { - log.info("Skipping port " + portId + ": Provisioning status is not PROV."); - continue; - } - - long physicalSpeed = (Long) vplspe.get("physical-interface-speed"); - String physicalSpeedUnit = String.valueOf(vplspe.get("physical-interface-speed-unit")); - long maxPortSpeed = speedUtil.convertToKbps(physicalSpeed, physicalSpeedUnit); - vplspe.put("max-port-speed", maxPortSpeed); - - EquipmentData ed = new EquipmentData(); - ed.data = vplspe; - ed.equipmentId = portId; - ed.equipmentLevel = EquipmentLevel.Port; - - ServiceData sd = new ServiceData(); - sd.data = service; - sd.serviceModel = "L3SDN"; - sd.endPointPosition = "IPAG-TOA"; - sd.resourceUnionId = sr.resourceUnionId; - sd.resourceSetId = sr.resourceSetId; - - StrUtil.info(log, ed); - StrUtil.info(log, sd); - - AllocationRequest ar = allocationRequestBuilder.buildAllocationRequest(sd, ed, checkOnly, - requestType == ReserveRequestType.Change); - AllocationOutcome ao = resourceManager.allocateResources(ar); - - if (ao.status == AllocationStatus.Success) { - vplspePortFound = true; - break; - } - - if (ao instanceof LimitAllocationOutcome) { - LimitAllocationOutcome lao = (LimitAllocationOutcome) ao; - long available = lao.limit - lao.used; - if (available > maxAvailableSpeedVplspePort) - maxAvailableSpeedVplspePort = available; - } - } - - long maxAvailableSpeedServer = 0; - boolean serverFound = false; - - for (Map server : serverData) { - String serverId = String.valueOf(server.get("server-id")); - String serverModel = String.valueOf(server.get("server-model")); - - log.info("Checking Server: " + serverId); - - String endPointPosition = "VCE-Cust"; - - int serverCount = (Integer) server.get("server-count"); - if (serverCount == 0) - serverCount = 1; - String ratioString = parameterDao.getParameter("homing.pserver.sparing.ratio"); - if (ratioString == null || ratioString.length() == 0) - ratioString = "1:1"; - int primaryServerCount = calculatePrimaryServerCount(serverCount, ratioString); - server.put("number-primary-servers", primaryServerCount); - - int evcCount = getEvcCountOnServer(serverId); - int evcCountPerServer = (evcCount + primaryServerCount - 1) / primaryServerCount; - long maxServerSpeed = maxServerSpeedDao.getMaxServerSpeed(serverModel, evcCountPerServer); - server.put("max-server-speed", maxServerSpeed); - server.put("evc-count", evcCount); - server.put("evc-count-per-server", evcCountPerServer); - - EquipmentData ed = new EquipmentData(); - ed.data = server; - ed.equipmentId = serverId; - ed.equipmentLevel = EquipmentLevel.Server; - - ServiceData sd = new ServiceData(); - sd.data = service; - sd.serviceModel = "L3SDN"; - sd.endPointPosition = endPointPosition; - sd.resourceUnionId = sr.resourceUnionId; - sd.resourceSetId = sr.resourceSetId; - - StrUtil.info(log, ed); - StrUtil.info(log, sd); - - AllocationRequest ar = allocationRequestBuilder.buildAllocationRequest(sd, ed, checkOnly, - requestType == ReserveRequestType.Change); - AllocationOutcome ao = resourceManager.allocateResources(ar); - - if (ao.status == AllocationStatus.Success) { - serverFound = true; - - if (ao instanceof MultiResourceAllocationOutcome) { - MultiResourceAllocationOutcome mrao = (MultiResourceAllocationOutcome) ao; - for (AllocationOutcome ao1 : mrao.allocationOutcomeList) { - if (ao1 instanceof LimitAllocationOutcome) { - LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1; - if (lao.request.resourceName.equals("Bandwidth")) { - ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao); - setThresholdData(ctx, th, sd, ed); - } - } - } - } - - break; - } - - if (ao instanceof MultiResourceAllocationOutcome) { - MultiResourceAllocationOutcome mrao = (MultiResourceAllocationOutcome) ao; - for (AllocationOutcome ao1 : mrao.allocationOutcomeList) { - if (ao1 instanceof LimitAllocationOutcome) { - LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1; - if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Bandwidth")) { - long available = lao.limit - lao.used; - if (available > maxAvailableSpeedServer) - maxAvailableSpeedServer = available; - } - if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Connection")) { - maxAvailableSpeedServer = 0; - break; - } - - ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao); - setThresholdData(ctx, th, sd, ed); - } - } - } - } - - if (vpePortFound && vplspePortFound && serverFound) { - if (!checkOnly) { - if (pendingServiceResource == null) { - log.info("Adding the pending service resource record to DB."); - serviceResourceDao.addServiceResource(sr); - } else { - log.info("Releasing previously allocated resources for resource set id: " + - pendingServiceResource.resourceSetId); - resourceManager.releaseResourceSet(pendingServiceResource.resourceSetId); - - log.info("Updating the pending service resource record in DB with service change number: " + - sr.serviceChangeNumber); - serviceResourceDao.updateServiceResource(sr); - } - } - - return QueryStatus.SUCCESS; - } - - log.info("Releasing allocated resources (if any) for resource set id: " + sr.resourceSetId); - resourceManager.releaseResourceSet(sr.resourceSetId); - - long maxAvailableSpeed = Long.MAX_VALUE; - if (!vpePortFound && maxAvailableSpeedVpePort < maxAvailableSpeed) - maxAvailableSpeed = maxAvailableSpeedVpePort; - if (!vplspePortFound && maxAvailableSpeedVplspePort < maxAvailableSpeed) - maxAvailableSpeed = maxAvailableSpeedVplspePort; - if (!serverFound && maxAvailableSpeedServer < maxAvailableSpeed) - maxAvailableSpeed = maxAvailableSpeedServer; - - setOutputContext(ctx, maxAvailableSpeed, "kbps"); - return QueryStatus.NOT_FOUND; - } - - private List> orderVpe(List> vpePortData) { - for (Map vpe : vpePortData) { - String vpeId = String.valueOf(vpe.get("vpe-id")); - String interfaceName = String.valueOf(vpe.get("physical-interface-name")); - String portId = vpeId + "/" + interfaceName; - Resource r = resourceManager.getResource("Bandwidth", portId); - long used = 0; - if (r != null) { - LimitResource ll = (LimitResource) r; - used = ll.used; - } - vpe.put("used-bandwidth", used); - - log.info("Used bandwidth on VPE: " + vpeId + ": " + used); - } - - Collections.sort(vpePortData, new Comparator>() { - - @Override - public int compare(Map o1, Map o2) { - long used1 = (Long) o1.get("used-bandwidth"); - long used2 = (Long) o2.get("used-bandwidth"); - if (used1 < used2) - return -1; - if (used1 > used2) - return 1; - return 0; - } - }); - - return vpePortData; - } - - private void setThresholdData(SvcLogicContext ctx, ThresholdStatus th, ServiceData sd, EquipmentData ed) { - if (th == null) - return; - - String pp = "tmp.resource-allocator-output.threshold-notification-list.threshold-hotification[0]."; - ctx.setAttribute("tmp.resource-allocator-output.threshold-notification-list.threshold-hotification_length", - "1"); - ctx.setAttribute(pp + "message", th.resourceThreshold.message); - ctx.setAttribute(pp + "resource-rule.service-model", th.resourceRule.serviceModel); - ctx.setAttribute(pp + "resource-rule.endpoint-position", th.resourceRule.endPointPosition); - ctx.setAttribute(pp + "resource-rule.resource-name", th.resourceRule.resourceName); - ctx.setAttribute(pp + "resource-rule.equipment-level", th.resourceRule.equipmentLevel); - ctx.setAttribute(pp + "resource-rule.soft-limit-expression", th.resourceRule.softLimitExpression); - ctx.setAttribute(pp + "resource-rule.hard-limit-expression", th.resourceRule.hardLimitExpression); - ctx.setAttribute(pp + "resource-state.used", String.valueOf(th.used)); - ctx.setAttribute(pp + "resource-state.limit-value", String.valueOf(th.limitValue)); - ctx.setAttribute(pp + "resource-state.threshold-value", String.valueOf(th.thresholdValue)); - ctx.setAttribute(pp + "resource-state.last-added", String.valueOf(th.lastAdded)); - ctx.setAttribute(pp + "equipment-data.equipment-id", ed.equipmentId); - for (String edKey : ed.data.keySet()) - ctx.setAttribute(pp + "equipment-data." + edKey, String.valueOf(ed.data.get(edKey))); - } - - private QueryStatus allocateResources(String serviceModel, SvcLogicContext ctx, boolean checkOnly, String prefix) - throws SvcLogicException { - prefix = prefix == null ? "" : prefix + '.'; - - Map service = getServiceData(ctx); - Map ec = getEquipConstraints(ctx); - - String requestTypeStr = ctx.getAttribute("tmp.resource-allocator.request-type"); - if (requestTypeStr == null) - requestTypeStr = "New"; - - ReserveRequestType requestType = null; - try { - requestType = ReserveRequestType.convert(requestTypeStr); - } catch (IllegalArgumentException e) { - throw new SvcLogicException("Invalid tmp.resource-allocator.request-type: " + requestTypeStr + - ". Supported values are New, Change."); - } - - String serviceInstanceId = String.valueOf(service.get("service-instance-id")); - - log.info("Starting reserve: " + requestType + ", service-instance-id: " + serviceInstanceId); - - ServiceResource activeServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Active); - ServiceResource pendingServiceResource = - serviceResourceDao.getServiceResource(serviceInstanceId, ServiceStatus.Pending); - - log.info("Active ServiceResource: "); - StrUtil.info(log, activeServiceResource); - log.info("Pending ServiceResource: "); - StrUtil.info(log, pendingServiceResource); - - int changeNumber = 1; - if (pendingServiceResource != null) - changeNumber = pendingServiceResource.serviceChangeNumber + 1; - else if (activeServiceResource != null) - changeNumber = activeServiceResource.serviceChangeNumber + 1; - - ServiceData sd = new ServiceData(); - sd.data = service; - sd.serviceModel = serviceModel; - sd.endPointPosition = (String) service.get("end-point-position"); - sd.resourceShareGroup = (String) service.get("resource-share-group"); - sd.resourceName = (String) service.get("resource-name"); - sd.serviceInstanceId = serviceInstanceId; - - StrUtil.info(log, sd); - - List epList = endPointAllocator.allocateEndPoints(sd, ec, checkOnly, - requestType == ReserveRequestType.Change, changeNumber); - - if (epList != null && !epList.isEmpty()) { - if (!checkOnly) { - EndPointData ep = epList.get(0); - - if (sd.resourceName == null) { - ServiceResource sr = new ServiceResource(); - sr.serviceInstanceId = serviceInstanceId; - sr.serviceStatus = ServiceStatus.Pending; - sr.serviceChangeNumber = changeNumber; - sr.resourceSetId = ep.resourceSetId; - sr.resourceUnionId = ep.resourceUnionId; - - log.info("New ServiceResource: "); - StrUtil.info(log, sr); - - if (pendingServiceResource == null) { - log.info("Adding the pending service resource record to DB."); - serviceResourceDao.addServiceResource(sr); - } else { - log.info("Releasing previously allocated resources for resource set id: " + - pendingServiceResource.resourceSetId); - resourceManager.releaseResourceSet(pendingServiceResource.resourceSetId); - - log.info("Updating the pending service resource record in DB with service change number: " + - sr.serviceChangeNumber); - serviceResourceDao.updateServiceResource(sr); - } - } - - for (EndPointData ep1 : epList) - if (ep1.data != null && !ep1.data.isEmpty()) - for (String key : ep1.data.keySet()) { - String value = String.valueOf(ep1.data.get(key)); - ctx.setAttribute(prefix + key, value); - - log.info("Added context attr: " + prefix + key + ": " + value); - } - } - - return QueryStatus.SUCCESS; - } - - log.info("Capacity not found for EVC: " + serviceInstanceId); - - return QueryStatus.NOT_FOUND; - } - - private int getEvcCountOnServer(String serverId) { - LimitResource l = (LimitResource) resourceManager.getResource("Connection", serverId); - if (l != null) - return (int) l.used; - return 0; - } - - private String getAicSiteId(SvcLogicContext ctx) throws SvcLogicException { - String aicSiteId = ctx.getAttribute("tmp.resource-allocator.aic-site-id"); - if (aicSiteId == null) - throw new SvcLogicException("tmp.resource-allocator.aic-site-id is required in ResourceAllocator"); - return aicSiteId; - } - - private Map getServiceData(SvcLogicContext ctx) throws SvcLogicException { - Map sd = new HashMap(); - - String endPointPosition = ctx.getAttribute("tmp.resource-allocator.end-point-position"); - if (endPointPosition != null && endPointPosition.trim().length() > 0) - sd.put("end-point-position", endPointPosition.trim()); - - String resourceName = ctx.getAttribute("tmp.resource-allocator.resource-name"); - if (resourceName != null && resourceName.trim().length() > 0) - sd.put("resource-name", resourceName.trim()); - - String resourceShareGroup = ctx.getAttribute("tmp.resource-allocator.resource-share-group"); - if (resourceShareGroup != null && resourceShareGroup.trim().length() > 0) - sd.put("resource-share-group", resourceShareGroup.trim()); - - String serviceInstanceId = ctx.getAttribute("tmp.resource-allocator.service-instance-id"); - if (serviceInstanceId == null) - serviceInstanceId = "checkServiceInstance"; - sd.put("service-instance-id", serviceInstanceId); - - String speedStr = ctx.getAttribute("tmp.resource-allocator.speed"); - if (speedStr != null && speedStr.trim().length() > 0) { - long speed = 0; - try { - speed = Long.parseLong(speedStr); - } catch (NumberFormatException e) { - throw new SvcLogicException("Invalid tmp.resource-allocator.speed. Must be a number."); - } - String unit = ctx.getAttribute("tmp.resource-allocator.speed-unit"); - if (unit == null || unit.trim().length() == 0) - throw new SvcLogicException("tmp.resource-allocator.speed-unit is required in ResourceAllocator"); - long serviceSpeedKbps = speedUtil.convertToKbps(speed, unit); - - sd.put("service-speed-kbps", serviceSpeedKbps); - } - - String vpnId = ctx.getAttribute("tmp.resource-allocator.vpn-id"); - if (vpnId != null && vpnId.trim().length() > 0) - sd.put("vpn-id", vpnId.trim()); - - String vpnIdList = ctx.getAttribute("tmp.resource-allocator.vpn-id-list"); - if (vpnIdList != null && vpnIdList.trim().length() > 0) - sd.put("vpn-id-list", vpnIdList.trim()); - - String vrfName = ctx.getAttribute("tmp.resource-allocator.vrf-name"); - if (vrfName != null && vrfName.trim().length() > 0) - sd.put("vrf-name", vrfName.trim()); - - String vrfNameList = ctx.getAttribute("tmp.resource-allocator.vrf-name-list"); - if (vrfNameList != null && vrfNameList.trim().length() > 0) - sd.put("vrf-name-list", vrfNameList.trim()); - - String v4multicast = ctx.getAttribute("tmp.resource-allocator.v4-multicast"); - if (v4multicast != null && v4multicast.trim().length() > 0) - sd.put("v4-multicast", v4multicast.trim()); - - String v6multicast = ctx.getAttribute("tmp.resource-allocator.v6-multicast"); - if (v6multicast != null && v6multicast.trim().length() > 0) - sd.put("v6-multicast", v6multicast.trim()); - - String v4ServingSite = ctx.getAttribute("tmp.resource-allocator.v4-serving-site"); - if (v4ServingSite != null && v4ServingSite.trim().length() > 0) - sd.put("v4-serving-site", v4ServingSite.trim()); - - String v6ServingSite = ctx.getAttribute("tmp.resource-allocator.v6-serving-site"); - if (v6ServingSite != null && v6ServingSite.trim().length() > 0) - sd.put("v6-serving-site", v6ServingSite.trim()); - - return sd; - } - - private Map getEquipConstraints(SvcLogicContext ctx) throws SvcLogicException { - Map mm = new HashMap(); - - String vrfRequired = ctx.getAttribute("tmp.resource-allocator.vrf-required"); - if (vrfRequired != null && vrfRequired.trim().length() > 0) - mm.put("vrf-required", vrfRequired.trim()); - - String clli = ctx.getAttribute("tmp.resource-allocator.clli"); - if (clli == null || clli.trim().length() == 0) - clli = ctx.getAttribute("tmp.resource-allocator.aic-site-id"); - if (clli != null) { - mm.put("clli", clli.trim()); - mm.put("aic-site-id", clli.trim()); - } - - String vpeName = ctx.getAttribute("tmp.resource-allocator.vpe-name"); - if (vpeName != null && vpeName.trim().length() > 0) - mm.put("vpe-name", vpeName.trim()); - - String vnfName = ctx.getAttribute("tmp.resource-allocator.device-name"); - if (vnfName != null && vnfName.trim().length() > 0) - mm.put("vnf-name", vnfName.trim()); - - String excludeVpeList = ctx.getAttribute("tmp.resource-allocator.exclude-vpe-list"); - if (excludeVpeList != null && excludeVpeList.trim().length() > 0) - mm.put("exclude-vpe-list", excludeVpeList.trim()); - - String uplinkCircuitCountStr = - ctx.getAttribute("tmp.resource-allocator.uplink-circuit-list.uplink-circuit_length"); - if (uplinkCircuitCountStr != null) { - long uplinkCircuitCount = 0; - try { - uplinkCircuitCount = Long.parseLong(uplinkCircuitCountStr); - } catch (NumberFormatException e) { - throw new SvcLogicException( - "Invalid tmp.resource-allocator.uplink-circuit-list.uplink-circuit_length. Must be a number."); - } - List> uplinkCircuitList = new ArrayList<>(); - for (int i = 0; i < uplinkCircuitCount; i++) { - String uplinkCircuitId = ctx.getAttribute( - "tmp.resource-allocator.uplink-circuit-list.uplink-circuit[" + i + "].uplink-circuit-id"); - String uplinkCircuitBandwidthStr = - ctx.getAttribute("tmp.resource-allocator.uplink-circuit-list.uplink-circuit[" + i + - "].uplink-circuit-bandwidth"); - String uplinkCircuitBandwidthUnit = - ctx.getAttribute("tmp.resource-allocator.uplink-circuit-list.uplink-circuit[" + i + - "].uplink-circuit-bandwidth-unit"); - - long uplinkCircuitBandwidth = 0; - try { - uplinkCircuitBandwidth = Long.parseLong(uplinkCircuitBandwidthStr); - } catch (NumberFormatException e) { - throw new SvcLogicException("Invalid tmp.resource-allocator.uplink-circuit-list.uplink-circuit[" + - i + "].uplink-circuit-id. Must be a number."); - } - - long uplinkCircuitBandwidthKbps = - speedUtil.convertToKbps(uplinkCircuitBandwidth, uplinkCircuitBandwidthUnit); - - Map uplinkCircuit = new HashMap(); - uplinkCircuit.put("uplink-circuit-id", uplinkCircuitId); - uplinkCircuit.put("uplink-circuit-bandwidth", uplinkCircuitBandwidthKbps); - uplinkCircuitList.add(uplinkCircuit); - } - mm.put("uplink-circuit-list", uplinkCircuitList); - } - - return mm; - } - - private void setOutputContext(SvcLogicContext ctx, long maxAvailableSpeed, String unit) { - ctx.setAttribute("tmp.resource-allocator-output.max-available-speed", String.valueOf(maxAvailableSpeed)); - ctx.setAttribute("tmp.resource-allocator-output.speed-unit", unit); - } - - private int calculatePrimaryServerCount(int serverCount, String ratioString) throws SvcLogicException { - String[] ss = ratioString.split(":"); - if (ss.length != 2) - throw new SvcLogicException("Invalid value for homing.pserver.sparing.ratio: " + ratioString); - - int n = 1, m = 1; - try { - n = Integer.parseInt(ss[0]); - m = Integer.parseInt(ss[1]); - } catch (Exception e) { - throw new SvcLogicException("Invalid value for homing.pserver.sparing.ratio: " + ratioString); - } - - return (serverCount - 1) * n / (n + m) + 1; - } - - public void setServerDao(ServerDao serverDao) { - this.serverDao = serverDao; - } - - public void setVpePortDao(VpePortDao vpePortDao) { - this.vpePortDao = vpePortDao; - } - - public void setVplspePortDao(VplspePortDao vplspePortDao) { - this.vplspePortDao = vplspePortDao; - } - - public void setMaxPortSpeedDao(MaxPortSpeedDao maxPortSpeedDao) { - this.maxPortSpeedDao = maxPortSpeedDao; - } - - public void setMaxServerSpeedDao(MaxServerSpeedDao maxServerSpeedDao) { - this.maxServerSpeedDao = maxServerSpeedDao; - } - - public void setAllocationRequestBuilder(AllocationRequestBuilder allocationRequestBuilder) { - this.allocationRequestBuilder = allocationRequestBuilder; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } - - public void setSpeedUtil(SpeedUtil speedUtil) { - this.speedUtil = speedUtil; - } - - public void setServiceResourceDao(ServiceResourceDao serviceResourceDao) { - this.serviceResourceDao = serviceResourceDao; - } - - public void setEndPointAllocator(EndPointAllocator endPointAllocator) { - this.endPointAllocator = endPointAllocator; - } - - public void setParameterDao(ParameterDao parameterDao) { - this.parameterDao = parameterDao; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java deleted file mode 100644 index 1bf1de8..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.alloc; - -import org.openecomp.sdnc.ra.comp.AllocationRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AffinityAllocationRule implements AllocationRule { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(AffinityAllocationRule.class); - - @Override - public AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - String affinityLink = (String) equipmentData.data.get("affinity-link"); - if (affinityLink == null) - affinityLink = "1"; - - long serviceSpeed = (Long) serviceData.data.get("service-speed-kbps"); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.resourceSetId = resourceSetId; - ar.resourceUnionId = resourceUnionId; - ar.resourceShareGroupList = null; - ar.resourceName = "Bandwidth"; - ar.assetId = equipmentData.equipmentId + "-" + affinityLink; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.strict = false; - ar.checkLimit = Long.MAX_VALUE; - ar.checkCount = 0; - ar.allocateCount = serviceSpeed; - return ar; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java deleted file mode 100644 index b0eae0b..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.alloc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.openecomp.sdnc.ra.comp.AllocationRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.rule.dao.RangeRuleDao; -import org.openecomp.sdnc.ra.rule.dao.ResourceRuleDao; -import org.openecomp.sdnc.ra.rule.data.RangeRule; -import org.openecomp.sdnc.ra.rule.data.ResourceRule; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationRequest; -import org.openecomp.sdnc.rm.data.RangeAllocationRequest; -import org.openecomp.sdnc.util.expr.ExpressionEvaluator; -import org.openecomp.sdnc.util.str.StrUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DbAllocationRule implements AllocationRule { - - private static final Logger log = LoggerFactory.getLogger(DbAllocationRule.class); - - private ResourceRuleDao resourceRuleDao; - private RangeRuleDao rangeRuleDao; - - @Override - public AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - List resourceRuleList = resourceRuleDao.getResourceRules(serviceData.serviceModel, - endPointPosition, equipmentData.equipmentLevel); - List rangeRuleList = - rangeRuleDao.getRangeRules(serviceData.serviceModel, endPointPosition, equipmentData.equipmentLevel); - - List arlist = new ArrayList(); - - for (ResourceRule rr : resourceRuleList) { - if (serviceData.resourceName != null && !serviceData.resourceName.equals(rr.resourceName)) - continue; - AllocationRequest ar1 = buildAllocationRequest(rr, resourceUnionId, resourceSetId, serviceData, - equipmentData, checkOnly, change); - arlist.add(ar1); - } - for (RangeRule rr : rangeRuleList) { - if (serviceData.resourceName != null && !serviceData.resourceName.equals(rr.rangeName)) - continue; - AllocationRequest ar1 = buildAllocationRequest(rr, resourceUnionId, resourceSetId, serviceData, - equipmentData, checkOnly, change); - arlist.add(ar1); - } - - if (arlist.isEmpty()) - return null; - - if (arlist.size() == 1) - return arlist.get(0); - - MultiResourceAllocationRequest ar = new MultiResourceAllocationRequest(); - ar.stopOnFirstFailure = false; - ar.allocationRequestList = arlist; - return ar; - } - - private AllocationRequest buildAllocationRequest( - ResourceRule resourceRule, - String resourceUnionId, - String resourceSetId, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - StrUtil.info(log, resourceRule); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.resourceSetId = resourceSetId; - ar.resourceUnionId = resourceUnionId; - ar.resourceName = resourceRule.resourceName; - if (serviceData.resourceShareGroup != null) - ar.resourceShareGroupList = Collections.singleton(serviceData.resourceShareGroup); - ar.assetId = equipmentData.equipmentId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.strict = false; - ar.checkLimit = ExpressionEvaluator.evalLong( - change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, equipmentData.data);; - ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, serviceData.data); - ar.allocateCount = checkOnly ? 0 : ar.checkCount; - return ar; - } - - private AllocationRequest buildAllocationRequest( - RangeRule rangeRule, - String resourceUnionId, - String resourceSetId, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - StrUtil.info(log, rangeRule); - - RangeAllocationRequest ar = new RangeAllocationRequest(); - ar.resourceSetId = resourceSetId; - ar.resourceUnionId = resourceUnionId; - ar.resourceName = rangeRule.rangeName; - ar.assetId = equipmentData.equipmentId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.check = true; - ar.allocate = !checkOnly; - ar.checkMin = rangeRule.minValue; - ar.checkMax = rangeRule.maxValue; - return ar; - } - - public void setResourceRuleDao(ResourceRuleDao resourceRuleDao) { - this.resourceRuleDao = resourceRuleDao; - } - - public void setRangeRuleDao(RangeRuleDao rangeRuleDao) { - this.rangeRuleDao = rangeRuleDao; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java deleted file mode 100644 index 88b8557..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.alloc; - -import org.openecomp.sdnc.ra.comp.AllocationRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.util.vrf.VpnParam; -import org.openecomp.sdnc.util.vrf.VrfUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ServingSiteAllocationRule implements AllocationRule { - - private static final Logger log = LoggerFactory.getLogger(ServingSiteAllocationRule.class); - - @Override - public AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return null; - - log.info("vrfName: " + vrfName); - - String v4ServingSiteStr = (String) serviceData.data.get("v4-serving-site"); - String v6ServingSiteStr = (String) serviceData.data.get("v6-serving-site"); - boolean v4ServingSite = v4ServingSiteStr != null && - (v4ServingSiteStr.equalsIgnoreCase("Y") || v4ServingSiteStr.equalsIgnoreCase("true")); - boolean v6ServingSite = v6ServingSiteStr != null && - (v6ServingSiteStr.equalsIgnoreCase("Y") || v6ServingSiteStr.equalsIgnoreCase("true")); - if (!v4ServingSite && !v6ServingSite) - return null; - - VpnParam vpnp = VrfUtil.parseVrfInstanceName(vrfName); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.resourceSetId = resourceSetId; - ar.resourceUnionId = resourceUnionId; - ar.resourceName = "ServingSite"; - ar.assetId = equipmentData.equipmentId + "-" + vpnp.vpnId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.strict = false; - ar.checkLimit = 1; - ar.checkCount = 1; - ar.allocateCount = 1; - - return ar; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java deleted file mode 100644 index b9feee1..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.alloc; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; - -import org.openecomp.sdnc.ra.comp.AllocationRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class VrfAllocationRule implements AllocationRule { - - private static final Logger log = LoggerFactory.getLogger(VrfAllocationRule.class); - - @Override - public AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return null; - - log.info("vrfName: " + vrfName); - - Set resourceShareGroupList = new HashSet<>(); - resourceShareGroupList.add(vrfName); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.resourceSetId = resourceSetId; - ar.resourceUnionId = resourceUnionId; - ar.resourceShareGroupList = resourceShareGroupList; - ar.resourceName = "VRF"; - ar.assetId = equipmentData.equipmentId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.strict = false; - ar.checkLimit = 999999999; - ar.checkCount = 1; - ar.allocateCount = 1; - - String v4MulticastStr = (String) serviceData.data.get("v4-multicast"); - String v6MulticastStr = (String) serviceData.data.get("v6-multicast"); - boolean v4Multicast = v4MulticastStr != null && - (v4MulticastStr.equalsIgnoreCase("Y") || v4MulticastStr.equalsIgnoreCase("true")); - boolean v6Multicast = v6MulticastStr != null && - (v6MulticastStr.equalsIgnoreCase("Y") || v6MulticastStr.equalsIgnoreCase("true")); - if (v4Multicast || v6Multicast) { - LimitAllocationRequest ar2 = new LimitAllocationRequest(); - ar2.resourceSetId = resourceSetId; - ar2.resourceUnionId = resourceUnionId; - ar2.resourceShareGroupList = resourceShareGroupList; - ar2.resourceName = "MVRF"; - ar2.assetId = equipmentData.equipmentId; - ar2.missingResourceAction = AllocationAction.Succeed_Allocate; - ar2.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar2.replace = true; - ar2.strict = false; - ar2.checkLimit = 999999999; - ar2.checkCount = 1; - ar2.allocateCount = 1; - - MultiResourceAllocationRequest mar = new MultiResourceAllocationRequest(); - mar.resourceSetId = resourceSetId; - mar.resourceUnionId = resourceUnionId; - mar.resourceShareGroupList = resourceShareGroupList; - mar.assetId = equipmentData.equipmentId; - mar.missingResourceAction = AllocationAction.Succeed_Allocate; - mar.expiredResourceAction = AllocationAction.Succeed_Allocate; - mar.allocationRequestList = new ArrayList<>(); - mar.allocationRequestList.add(ar); - mar.allocationRequestList.add(ar2); - - return mar; - } - - return ar; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java deleted file mode 100644 index 5060ce4..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AnyVrfPresentCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(AnyVrfPresentCheck.class); - - private ResourceManager resourceManager; - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String vrfNameListStr = (String) serviceData.data.get("vrf-name-list"); - if (vrfNameListStr == null) - vrfNameListStr = (String) serviceData.data.get("vrf-name"); - if (vrfNameListStr == null) - return true; - - String vrfRequiredStr = (String) equipmentConstraints.get("vrf-required"); - if (vrfRequiredStr == null || !vrfRequiredStr.equalsIgnoreCase("true")) - return true; - - String[] vrfNameList = vrfNameListStr.split(","); - - Resource r = resourceManager.getResource("VRF", equipData.equipmentId); - if (r != null && r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) - for (String vrfName : vrfNameList) - if (ai.resourceShareGroupList.contains(vrfName)) - return true; - - log.info("Skipping VPE " + equipData.equipmentId + - ": Existing VRF is required, but there is no existing VRF on the VPE for any of the requested VPNs."); - return false; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java deleted file mode 100644 index a1182bb..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ExcludeVpeCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(ExcludeVpeCheck.class); - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String excludeVpeListStr = (String) equipmentConstraints.get("exclude-vpe-list"); - if (excludeVpeListStr == null) - return true; - - String vpeName = (String) equipData.data.get("vpe-id"); - - String[] excludeVpeList = excludeVpeListStr.split(","); - for (String excludeVpe : excludeVpeList) - if (excludeVpe.equals(vpeName)) { - log.info("Skipping VPE " + equipData.equipmentId + ": Present in the exclude VPE list."); - return false; - } - - return true; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java deleted file mode 100644 index 3d9f996..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.util.vrf.VpnParam; -import org.openecomp.sdnc.util.vrf.VrfUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class HubWithRgCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(HubWithRgCheck.class); - - private ResourceManager resourceManager; - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return true; - - // Check if this is HUB. If not, this check is not applicable - VpnParam vpnp = VrfUtil.parseVrfInstanceName(vrfName); - if (vpnp.siteType == null || !vpnp.siteType.equals("HUB")) - return true; - - boolean rgPresent = vpnp.routeGroupName != null; - - // First check if a new VRF would be required. If not, we are good - Resource r = resourceManager.getResource("VRF", equipData.equipmentId); - if (r != null && r.allocationItems != null) { - for (AllocationItem ai : r.allocationItems) - if (ai.resourceShareGroupList.contains(vrfName)) - return true; - - String resourceUnionId = serviceData.serviceInstanceId + '/' + serviceData.endPointPosition; - - // Check if there is already another HUB VRF with RG presence that does not match the requested - for (AllocationItem ai : r.allocationItems) { - - // Skip the allocation item for the current service instance, if there, in case it is a change order - if (ai.resourceUnionId.equals(resourceUnionId)) - continue; - - if (ai.resourceShareGroupList != null && ai.resourceShareGroupList.size() > 0) { - String vrfName2 = ai.resourceShareGroupList.iterator().next(); - VpnParam vpnp2 = VrfUtil.parseVrfInstanceName(vrfName2); - - if (vpnp2.siteType == null || !vpnp2.siteType.equals("HUB")) - continue; - - boolean rgPresent2 = vpnp2.routeGroupName != null; - - if (rgPresent && !rgPresent2) { - log.info("Skipping VPE " + equipData.equipmentId + - ": This request requires new HUB with RG VRF, " + - "but there is already another HUB VRF with no RG: " + vrfName2 + "."); - return false; - } - if (!rgPresent && rgPresent2) { - log.info("Skipping VPE " + equipData.equipmentId + - ": This request requires new HUB VRF with no RG, " + - "but there is already another HUB with RG VRF: " + vrfName2 + "."); - return false; - } - } - } - } - - return true; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java deleted file mode 100644 index d456531..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.util.vrf.VpnParam; -import org.openecomp.sdnc.util.vrf.VrfUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OneMVrfCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(OneMVrfCheck.class); - - private ResourceManager resourceManager; - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return true; - - String v4MulticastStr = (String) serviceData.data.get("v4-multicast"); - String v6MulticastStr = (String) serviceData.data.get("v6-multicast"); - boolean v4Multicast = v4MulticastStr != null && - (v4MulticastStr.equalsIgnoreCase("Y") || v4MulticastStr.equalsIgnoreCase("true")); - boolean v6Multicast = v6MulticastStr != null && - (v6MulticastStr.equalsIgnoreCase("Y") || v6MulticastStr.equalsIgnoreCase("true")); - if (!v4Multicast && !v6Multicast) - return true; - - // First check if a new VRF would be required. If not, we are good - Resource r = resourceManager.getResource("VRF", equipData.equipmentId); - if (r != null && r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) - if (ai.resourceShareGroupList.contains(vrfName)) - return true; - - String resourceUnionId = serviceData.serviceInstanceId + '/' + serviceData.endPointPosition; - - // Check if there is already another multicast VRF for the same VPN - VpnParam vpnp = VrfUtil.parseVrfInstanceName(vrfName); - r = resourceManager.getResource("MVRF", equipData.equipmentId); - if (r != null && r.allocationItems != null) { - for (AllocationItem ai : r.allocationItems) { - - // Skip the allocation item for the current service instance, if there, in case it is a change order - if (ai.resourceUnionId.equals(resourceUnionId)) - continue; - - if (ai.resourceShareGroupList != null && ai.resourceShareGroupList.size() > 0) { - String vrfName2 = ai.resourceShareGroupList.iterator().next(); - VpnParam vpnp2 = VrfUtil.parseVrfInstanceName(vrfName2); - if (vpnp.vpnId.equals(vpnp2.vpnId)) { - log.info("Skipping VPE " + equipData.equipmentId + - ": This request requires new multicast VRF, " + - "but there is already another multicast VRF for the same VPN: " + vrfName2 + "."); - return false; - } - } - } - } - - return true; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java deleted file mode 100644 index d5c57ad..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ProvStatusCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(ProvStatusCheck.class); - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String provStatus = (String) equipData.data.get("provisioning-status"); - if (provStatus == null || !provStatus.equals("PROV")) { - log.info("Skipping VPE " + equipData.equipmentId + ": Not in PROV status."); - return false; - } - return true; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java deleted file mode 100644 index 223d1f4..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class VlanSpeedCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(VlanSpeedCheck.class); - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String vpeName = (String) equipData.data.get("vpe-id"); - Long serviceSpeed = (Long) serviceData.data.get("service-speed-kbps"); - if (serviceSpeed != null && serviceSpeed > 0 && serviceSpeed < 1000) { - log.info("Skipping VPE " + vpeName + ": Service speed < 1Mbps is not supported."); - return false; - } - return true; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java deleted file mode 100644 index 039a26f..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.check; - -import java.util.Map; - -import org.openecomp.sdnc.ra.comp.EquipmentCheck; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.rule.dao.VpeLockDao; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class VpeLockCheck implements EquipmentCheck { - - private static final Logger log = LoggerFactory.getLogger(VpeLockCheck.class); - - private VpeLockDao vpeLockDao; - private ResourceManager resourceManager; - - @Override - public boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return true; - - String vpeName = (String) equipData.data.get("vpe-id"); - String vpeLock = vpeLockDao.getVpeLock(vpeName); - if (vpeLock == null) - return true; - - if (vpeLock.equals("vpe-total-lock")) { - log.info("Skipping VPE " + vpeName + ": There is a " + vpeLock + " on it."); - return false; - } - - if (vpeLock.equals("vpe-vrf-lock") && requiresNewVrf(equipData.equipmentId, vrfName)) { - log.info("Skipping VPE " + vpeName + ": There is a " + vpeLock + - " on it and it requires a new VRF for VPN: " + vrfName + "."); - return false; - } - - if (vpeLock.equals("vpe-mvrf-lock") && requiresNewMVrf(equipData.equipmentId, vrfName)) { - log.info("Skipping VPE " + vpeName + ": There is a " + vpeLock + - " on it and it requires a new multicast VRF for VPN: " + vrfName + "."); - return false; - } - - return true; - } - - boolean requiresNewVrf(String equipmentId, String vrfName) { - Resource r = resourceManager.getResource("VRF", equipmentId); - if (r == null || r.allocationItems == null) - return true; - - for (AllocationItem ai : r.allocationItems) { - if (ai.resourceShareGroupList.contains(vrfName)) - return false; - } - - return true; - } - - boolean requiresNewMVrf(String equipmentId, String vrfName) { - Resource r = resourceManager.getResource("MVRF", equipmentId); - if (r == null || r.allocationItems == null) - return true; - - for (AllocationItem ai : r.allocationItems) { - if (ai.resourceShareGroupList.contains(vrfName)) - return false; - } - - return true; - } - - public void setVpeLockDao(VpeLockDao vpeLockDao) { - this.vpeLockDao = vpeLockDao; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java deleted file mode 100644 index c7e06dc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.data.AllocationRequest; - -public interface AllocationRule { - - AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java deleted file mode 100644 index a5bc17e..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.List; - -import org.openecomp.sdnc.ra.equip.comp.EquipmentReader; - -public class EndPointAllocationDefinition { - - public String serviceModel; - public String endPointPosition; - public EquipmentReader equipmentReader; - public List equipmentCheckList; - public List preferenceRuleList; - public List allocationRuleList; - - public void setServiceModel(String serviceModel) { - this.serviceModel = serviceModel; - } - - public void setEndPointPosition(String endPointPosition) { - this.endPointPosition = endPointPosition; - } - - public void setEquipmentReader(EquipmentReader equipmentReader) { - this.equipmentReader = equipmentReader; - } - - public void setEquipmentCheckList(List equipmentCheckList) { - this.equipmentCheckList = equipmentCheckList; - } - - public void setPreferenceRuleList(List preferenceRuleList) { - this.preferenceRuleList = preferenceRuleList; - } - - public void setAllocationRuleList(List allocationRuleList) { - this.allocationRuleList = allocationRuleList; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java deleted file mode 100644 index 6cea51c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.List; -import java.util.Map; - -public interface EndPointAllocator { - - List allocateEndPoints( - ServiceData serviceData, - Map equipmentConstraints, - boolean checkOnly, - boolean change, - int changeNumber); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java deleted file mode 100644 index ce5bb2a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.NotImplementedException; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.AllocationOutcome; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.AllocationStatus; -import org.openecomp.sdnc.rm.data.LimitAllocationItem; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.RangeAllocationItem; -import org.openecomp.sdnc.rm.data.RangeResource; -import org.openecomp.sdnc.rm.data.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class EndPointAllocatorImpl implements EndPointAllocator { - - private static final Logger log = LoggerFactory.getLogger(EndPointAllocatorImpl.class); - - private Map> endPointAllocationDefinitionMap; - - private ResourceManager resourceManager; - - @Override - public List allocateEndPoints( - ServiceData serviceData, - Map equipmentConstraints, - boolean checkOnly, - boolean change, - int changeNumber) { - List defList = endPointAllocationDefinitionMap.get(serviceData.serviceModel); - if (defList == null) - throw new NotImplementedException("Service model: " + serviceData.serviceModel + " not supported"); - - List epList = new ArrayList<>(); - for (EndPointAllocationDefinition def : defList) { - if (serviceData.endPointPosition != null && !serviceData.endPointPosition.equals(def.endPointPosition)) - continue; - - log.info( - "Starting allocation of end point: " + def.endPointPosition + ": " + serviceData.serviceInstanceId); - - String resourceUnionId = serviceData.serviceInstanceId + '/' + def.endPointPosition; - String resourceSetId = resourceUnionId + '/' + changeNumber; - - String equipmentId = (String) equipmentConstraints.get("equipment-id"); - if (equipmentId == null) { - EndPointData epExisting = readEndPoint(resourceUnionId, resourceSetId); - if (epExisting != null && epExisting.equipmentId != null) { - equipmentConstraints.put("equipment-id", epExisting.equipmentId); - - log.info("Trying assignment on the current equipment: " + epExisting.equipmentId); - } - } - - List equipList = def.equipmentReader.readEquipment(equipmentConstraints); - if (equipList == null || equipList.isEmpty()) { - log.info("Equipment not found for " + def.endPointPosition); - break; - } - - if (def.equipmentCheckList != null) { - for (EquipmentCheck filter : def.equipmentCheckList) { - List newEquipList = new ArrayList<>(); - for (EquipmentData equipData : equipList) - if (filter.checkEquipment(def.endPointPosition, serviceData, equipData, equipmentConstraints)) - newEquipList.add(equipData); - equipList = newEquipList; - } - if (equipList.isEmpty()) { - log.info("No equipment meets the requiremets for the service for: " + def.endPointPosition); - break; - } - } - - if (equipList.size() > 1 && def.preferenceRuleList != null && !def.preferenceRuleList.isEmpty()) { - - List prefEquipList = new ArrayList<>(); - for (EquipmentData equipData : equipList) { - PrefEquipment prefEquip = new PrefEquipment(); - prefEquip.equipData = equipData; - prefEquip.prefNumbers = new long[def.preferenceRuleList.size()]; - prefEquipList.add(prefEquip); - - int i = 0; - for (PreferenceRule prefRule : def.preferenceRuleList) - prefEquip.prefNumbers[i++] = - prefRule.assignOrderNumber(def.endPointPosition, serviceData, equipData); - } - - Collections.sort(prefEquipList); - - equipList = new ArrayList<>(); - for (PrefEquipment prefEquip : prefEquipList) - equipList.add(prefEquip.equipData); - } - - for (EquipmentData equipData : equipList) { - boolean allgood = true; - if (def.allocationRuleList != null) - for (AllocationRule allocationRule : def.allocationRuleList) { - AllocationRequest ar = allocationRule.buildAllocationRequest(resourceUnionId, resourceSetId, - def.endPointPosition, serviceData, equipData, checkOnly, change); - if (ar != null) { - AllocationOutcome ao = resourceManager.allocateResources(ar); - if (ao.status != AllocationStatus.Success) { - allgood = false; - break; - } - } - } - if (allgood) { - EndPointData ep = readEndPoint(resourceUnionId, resourceSetId); - epList.add(ep); - break; - } - } - } - - return epList; - } - - private EndPointData readEndPoint(String resourceUnionId, String resourceSetId) { - EndPointData ep = new EndPointData(); - ep.resourceUnionId = resourceUnionId; - ep.resourceSetId = resourceSetId; - - int i1 = resourceUnionId.indexOf('/'); - if (i1 > 0) - ep.endPointPosition = resourceUnionId.substring(i1 + 1); - - ep.data = new HashMap<>(); - - List rlist = resourceManager.getResourceUnion(resourceUnionId); - for (Resource r : rlist) { - if (r instanceof RangeResource) { - RangeResource rr = (RangeResource) r; - for (AllocationItem ai : r.allocationItems) - if (ai.resourceUnionId.equals(resourceUnionId)) { - RangeAllocationItem rai = (RangeAllocationItem) ai; - ep.data.put(ep.endPointPosition + '.' + rr.resourceKey.resourceName, rai.used.first()); - } - } - if (r instanceof LimitResource) { - LimitResource rr = (LimitResource) r; - for (AllocationItem ai : r.allocationItems) - if (ai.resourceUnionId.equals(resourceUnionId)) { - LimitAllocationItem rai = (LimitAllocationItem) ai; - ep.data.put(ep.endPointPosition + '.' + rr.resourceKey.resourceName + ".allocated", rai.used); - ep.data.put(ep.endPointPosition + '.' + rr.resourceKey.resourceName + ".used", rr.used); - ep.data.put(ep.endPointPosition + '.' + rr.resourceKey.resourceName + ".assetId", - r.resourceKey.assetId); - } - } - } - - return ep; - } - - private static class PrefEquipment implements Comparable { - - public long[] prefNumbers; - public EquipmentData equipData; - - @Override - public int compareTo(PrefEquipment o) { - for (int i = 0; i < prefNumbers.length; i++) { - if (prefNumbers[i] < o.prefNumbers[i]) - return -1; - if (prefNumbers[i] > o.prefNumbers[i]) - return 1; - } - return 0; - } - } - - public void setEndPointAllocationDefinitionMap( - Map> endPointAllocationDefinitionMap) { - this.endPointAllocationDefinitionMap = endPointAllocationDefinitionMap; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java deleted file mode 100644 index a5452fe..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.Map; - -public class EndPointData { - - public String resourceSetId; - public String resourceUnionId; - public String endPointPosition; - public String equipmentId; - public Map data; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java deleted file mode 100644 index 1bfde01..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.data.EquipmentData; - -public interface EquipmentCheck { - - boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java deleted file mode 100644 index 246cc80..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import org.openecomp.sdnc.ra.equip.data.EquipmentData; - -public interface PreferenceRule { - - // Smaller order number is preferred - int assignOrderNumber(String endPointPosition, ServiceData serviceData, EquipmentData equipData); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java deleted file mode 100644 index 0a4dc9a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.comp; - -import java.util.Map; - -public class ServiceData { - - public String serviceModel; - public String serviceInstanceId; - public String resourceSetId; - public String resourceUnionId; - public String resourceShareGroup; - public String endPointPosition; - public String resourceName; - public Map data; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java deleted file mode 100644 index d61434b..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.comp; - -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.data.EquipmentData; - -public interface EquipmentReader { - - List readEquipment(Map equipmentConstraints); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java deleted file mode 100644 index 63f4542..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.util.List; -import java.util.Map; - -public interface ServerDao { - - List> getServerData(String aicSiteId); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java deleted file mode 100644 index 07f8912..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; - -public class ServerDaoImpl implements ServerDao { - - private static final Logger log = LoggerFactory.getLogger(ServerDaoImpl.class); - - private static final String GET_SERVER_COUNT_SQL = "SELECT count(*) FROM PSERVER WHERE aic_site_id = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public List> getServerData(String aicSiteId) { - List> ll = new ArrayList>(); - Map sd = new HashMap(); - sd.put("aic-site-id", aicSiteId); - sd.put("server-id", aicSiteId + "/Server1"); - sd.put("server-model", "Unknown"); - sd.put("server-count", getServerCount(aicSiteId)); - ll.add(sd); - return ll; - } - - private int getServerCount(String aicSiteId) { - int n = jdbcTemplate.queryForInt(GET_SERVER_COUNT_SQL, aicSiteId); - - log.info("Number of servers in " + aicSiteId + ": " + n); - - return n; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java deleted file mode 100644 index 53f0914..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.util.List; -import java.util.Map; - -public interface VpePortDao { - - List> getVpePortData(String aicSiteId); - - List> getVpePortData(String aicSiteId, String vpeName); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java deleted file mode 100644 index 8c774bf..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class VpePortDaoImpl implements VpePortDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VpePortDaoImpl.class); - - private static final String GET_SQL = "SELECT * FROM VPE_POOL WHERE aic_site_id = ?"; - private static final String GET2_SQL = "SELECT * FROM VPE_POOL WHERE vpe_name = ?"; - private static final String GET3_SQL = - "SELECT * FROM VPE_POOL WHERE substring(aic_site_id, 1, 8) = substring(?, 1, 8)"; - - private JdbcTemplate jdbcTemplate; - - @Override - public List> getVpePortData(String aicSiteId) { - return jdbcTemplate.query(GET_SQL, new Object[] { aicSiteId }, new VpePortRowMapper()); - } - - @Override - public List> getVpePortData(String aicSiteId, String vpeName) { - String sql = vpeName != null ? GET2_SQL : GET3_SQL; - Object[] param = new Object[] { vpeName != null ? vpeName : aicSiteId }; - - return jdbcTemplate.query(sql, param, new VpePortRowMapper()); - } - - private static class VpePortRowMapper implements RowMapper> { - - @Override - public Map mapRow(ResultSet rs, int rowNum) throws SQLException { - Map mm = new HashMap(); - mm.put("vpe-id", rs.getString("vpe_name")); - mm.put("aic-site-id", rs.getString("aic_site_id")); - mm.put("availability-zone", rs.getString("availability_zone")); - mm.put("image-file-name", rs.getString("image_filename")); - mm.put("vendor", rs.getString("vendor")); - mm.put("provisioning-status", rs.getString("provisioning_status")); - mm.put("physical-interface-name", rs.getString("physical_intf_name")); - mm.put("physical-interface-speed", rs.getLong("physical_intf_speed")); - mm.put("physical-interface-speed-unit", rs.getString("physical_intf_units")); - return mm; - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java deleted file mode 100644 index 392e6b6..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.util.List; -import java.util.Map; - -public interface VplspePortDao { - - List> getVplspePortData(String aicSiteId); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java deleted file mode 100644 index 349828c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class VplspePortDaoImpl implements VplspePortDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VplspePortDaoImpl.class); - - private static final String GET_SQL = "SELECT * FROM VPLSPE_POOL WHERE aic_site_id = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public List> getVplspePortData(String aicSiteId) { - List> ll = - jdbcTemplate.query(GET_SQL, new Object[] { aicSiteId }, new RowMapper>() { - - @Override - public Map mapRow(ResultSet rs, int rowNum) throws SQLException { - Map mm = new HashMap(); - mm.put("vplspe-id", rs.getString("vplspe_name")); - mm.put("aic-site-id", rs.getString("aic_site_id")); - mm.put("availability-zone", rs.getString("availability_zone")); - mm.put("image-file-name", rs.getString("image_filename")); - mm.put("vendor", rs.getString("vendor")); - mm.put("provisioning-status", rs.getString("provisioning_status")); - mm.put("physical-interface-name", rs.getString("physical_intf_name")); - mm.put("physical-interface-speed", rs.getLong("physical_intf_speed")); - mm.put("physical-interface-speed-unit", rs.getString("physical_intf_units")); - return mm; - } - }); - return ll; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java deleted file mode 100644 index 7347b7b..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.data; - -import java.util.Map; - -public class EquipmentData { - - public String equipmentId; - public EquipmentLevel equipmentLevel; - public Map data; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java deleted file mode 100644 index c69a6a5..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.equip.data; - -public enum EquipmentLevel { - Port, Device, Server, Site -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java deleted file mode 100644 index f4b12fc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.pref; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.sdnc.ra.comp.PreferenceRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AffinityLinkPref implements PreferenceRule { - - private static final Logger log = LoggerFactory.getLogger(AffinityLinkPref.class); - - private ResourceManager resourceManager; - private List affinityLinkIdList; - - public AffinityLinkPref() { - // Set default values for affinity link ids (can be overridden by the spring config) - affinityLinkIdList = new ArrayList<>(); - affinityLinkIdList.add("1"); - affinityLinkIdList.add("2"); - } - - @Override - public int assignOrderNumber(String endPointPosition, ServiceData serviceData, EquipmentData equipData) { - - // This class does not really assign order number, but instead sets the affinity link with the lowest - // assigned bandwidth in the equipment data - - String preferedAffinityLinkId = "1"; - long lowestAssignedBw = Long.MAX_VALUE; - for (String affinityLinkId : affinityLinkIdList) { - String assetId = equipData.equipmentId + "-" + affinityLinkId; - Resource r = resourceManager.getResource("Bandwidth", assetId); - if (r != null) { - LimitResource ll = (LimitResource) r; - if (ll.used < lowestAssignedBw) { - lowestAssignedBw = ll.used; - preferedAffinityLinkId = affinityLinkId; - } - log.info("Assigned bandwidth on affinity link: " + assetId + ": " + ll.used); - } - } - - equipData.data.put("affinity-link", preferedAffinityLinkId); - - log.info("Prefered affinity link for " + equipData.equipmentId + ": " + preferedAffinityLinkId); - - return 0; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } - - public void setAffinityLinkIdList(List affinityLinkIdList) { - this.affinityLinkIdList = affinityLinkIdList; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java deleted file mode 100644 index 1e92529..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.pref; - -import org.openecomp.sdnc.ra.comp.PreferenceRule; -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.rm.comp.ResourceManager; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class EvcExistingVrfPref implements PreferenceRule { - - private static final Logger log = LoggerFactory.getLogger(EvcExistingVrfPref.class); - - private ResourceManager resourceManager; - - @Override - public int assignOrderNumber(String endPointPosition, ServiceData serviceData, EquipmentData equipData) { - String vrfName = (String) serviceData.data.get("vrf-name"); - if (vrfName == null) - return 0; - - Resource r = resourceManager.getResource("VRF", equipData.equipmentId); - if (r != null && r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) - if (ai.resourceShareGroupList.contains(vrfName)) { - log.info("VRF for VPN: " + vrfName + " found on VPE: " + equipData.equipmentId); - return 1; - } - - log.info("VRF for VPN: " + vrfName + " NOT found on VPE: " + equipData.equipmentId); - return 2; - } - - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java deleted file mode 100644 index 932992a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.reader; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.comp.EquipmentReader; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; - -public class AicSiteReader implements EquipmentReader { - - @Override - public List readEquipment(Map equipmentConstraints) { - String aicSiteId = (String) equipmentConstraints.get("aic-site-id"); - - EquipmentData equipData = new EquipmentData(); - equipData.equipmentLevel = EquipmentLevel.Site; - equipData.equipmentId = aicSiteId; - equipData.data = new HashMap(); - - List equipList = new ArrayList<>(); - equipList.add(equipData); - - return equipList; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java deleted file mode 100644 index d8f2706..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.reader; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.comp.EquipmentReader; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; - -public class UplinkCircuitReader implements EquipmentReader { - - @SuppressWarnings("unchecked") - @Override - public List readEquipment(Map equipmentConstraints) { - List equipList = new ArrayList<>(); - - List> uplinkCircuitList = - (List>) equipmentConstraints.get("uplink-circuit-list"); - if (uplinkCircuitList == null || uplinkCircuitList.isEmpty()) - return equipList; - - for (Map uplinkCircuit : uplinkCircuitList) { - EquipmentData equipData = new EquipmentData(); - equipData.equipmentLevel = EquipmentLevel.Device; - equipData.equipmentId = (String) uplinkCircuit.get("uplink-circuit-id"); - equipData.data = uplinkCircuit; - equipList.add(equipData); - } - - return equipList; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java deleted file mode 100644 index b7236b2..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.reader; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.comp.EquipmentReader; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; - -public class VnfReader implements EquipmentReader { - - @Override - public List readEquipment(Map equipmentConstraints) { - String vnfName = (String) equipmentConstraints.get("vnf-name"); - - EquipmentData equipData = new EquipmentData(); - equipData.equipmentLevel = EquipmentLevel.Device; - equipData.equipmentId = vnfName; - equipData.data = new HashMap(); - - List equipList = new ArrayList<>(); - equipList.add(equipData); - - return equipList; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java deleted file mode 100644 index 1e180f4..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.reader; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdnc.ra.equip.comp.EquipmentReader; -import org.openecomp.sdnc.ra.equip.dao.VpePortDao; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; - -public class VpePortReader implements EquipmentReader { - - private VpePortDao vpePortDao; - - @Override - public List readEquipment(Map equipmentConstraints) { - String clli = (String) equipmentConstraints.get("clli"); - String vpeName = (String) equipmentConstraints.get("vpe-name"); - if (vpeName == null) { - String equipmentId = (String) equipmentConstraints.get("equipment-id"); - if (equipmentId != null) { - int i1 = equipmentId.indexOf('/'); - if (i1 > 0) - equipmentId = equipmentId.substring(0, i1); - vpeName = equipmentId; - } - } - - List> vpeDataList = vpePortDao.getVpePortData(clli, vpeName); - - List equipList = new ArrayList<>(); - for (Map vpeData : vpeDataList) { - EquipmentData equipData = new EquipmentData(); - equipData.equipmentLevel = EquipmentLevel.Port; - equipData.equipmentId = - (String) vpeData.get("vpe-id") + '/' + (String) vpeData.get("physical-interface-name"); - equipData.data = vpeData; - - equipList.add(equipData); - } - - return equipList; - } - - public void setVpePortDao(VpePortDao vpePortDao) { - this.vpePortDao = vpePortDao; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java deleted file mode 100644 index d8389bf..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.comp; - -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.rule.data.ThresholdStatus; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationOutcome; - -public interface AllocationRequestBuilder { - - AllocationRequest buildAllocationRequest( - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change); - - ThresholdStatus getThresholdStatus( - ServiceData serviceData, - EquipmentData equipmentData, - LimitAllocationOutcome limitAllocationOutcome); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java deleted file mode 100644 index e78fd02..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.comp; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.sdnc.ra.comp.ServiceData; -import org.openecomp.sdnc.ra.equip.data.EquipmentData; -import org.openecomp.sdnc.ra.rule.dao.RangeRuleDao; -import org.openecomp.sdnc.ra.rule.dao.ResourceRuleDao; -import org.openecomp.sdnc.ra.rule.data.RangeRule; -import org.openecomp.sdnc.ra.rule.data.ResourceRule; -import org.openecomp.sdnc.ra.rule.data.ResourceThreshold; -import org.openecomp.sdnc.ra.rule.data.ThresholdStatus; -import org.openecomp.sdnc.rm.data.AllocationAction; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.LimitAllocationOutcome; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationRequest; -import org.openecomp.sdnc.rm.data.RangeAllocationRequest; -import org.openecomp.sdnc.util.expr.ExpressionEvaluator; -import org.openecomp.sdnc.util.str.StrUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AllocationRequestBuilderImpl implements AllocationRequestBuilder { - - private static final Logger log = LoggerFactory.getLogger(AllocationRequestBuilderImpl.class); - - private ResourceRuleDao resourceRuleDao; - private RangeRuleDao rangeRuleDao; - - @Override - public AllocationRequest buildAllocationRequest( - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - List resourceRuleList = resourceRuleDao.getResourceRules(serviceData.serviceModel, - serviceData.endPointPosition, equipmentData.equipmentLevel); - List rangeRuleList = rangeRuleDao.getRangeRules(serviceData.serviceModel, - serviceData.endPointPosition, equipmentData.equipmentLevel); - if (resourceRuleList.isEmpty() && rangeRuleList.isEmpty()) - return null; - if (resourceRuleList.size() == 1 && rangeRuleList.isEmpty()) - return buildAllocationRequest(resourceRuleList.get(0), serviceData, equipmentData, checkOnly, change); - - if (resourceRuleList.isEmpty() && rangeRuleList.size() == 1) - return buildAllocationRequest(rangeRuleList.get(0), serviceData, equipmentData, checkOnly, change); - - MultiResourceAllocationRequest ar = new MultiResourceAllocationRequest(); - ar.stopOnFirstFailure = false; - ar.allocationRequestList = new ArrayList(); - for (ResourceRule rr : resourceRuleList) { - AllocationRequest ar1 = buildAllocationRequest(rr, serviceData, equipmentData, checkOnly, change); - ar.allocationRequestList.add(ar1); - } - for (RangeRule rr : rangeRuleList) { - AllocationRequest ar1 = buildAllocationRequest(rr, serviceData, equipmentData, checkOnly, change); - ar.allocationRequestList.add(ar1); - } - return ar; - } - - private AllocationRequest buildAllocationRequest( - ResourceRule resourceRule, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - StrUtil.info(log, resourceRule); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.resourceSetId = serviceData.resourceSetId; - ar.resourceUnionId = serviceData.resourceUnionId; - ar.resourceName = resourceRule.resourceName; - ar.assetId = equipmentData.equipmentId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.strict = false; - ar.checkLimit = ExpressionEvaluator.evalLong( - change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, equipmentData.data); - ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, serviceData.data); - ar.allocateCount = checkOnly ? 0 : ar.checkCount; - return ar; - } - - private AllocationRequest buildAllocationRequest( - RangeRule rangeRule, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change) { - StrUtil.info(log, rangeRule); - - RangeAllocationRequest ar = new RangeAllocationRequest(); - ar.resourceSetId = serviceData.resourceSetId; - ar.resourceUnionId = serviceData.resourceUnionId; - ar.resourceName = rangeRule.rangeName; - ar.assetId = equipmentData.equipmentId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = true; - ar.check = true; - ar.allocate = !checkOnly; - ar.checkMin = rangeRule.minValue; - ar.checkMax = rangeRule.maxValue; - return ar; - } - - @Override - public ThresholdStatus getThresholdStatus( - ServiceData serviceData, - EquipmentData equipmentData, - LimitAllocationOutcome limitAllocationOutcome) { - ResourceRule rr = resourceRuleDao.getResourceRule(serviceData.serviceModel, serviceData.endPointPosition, - equipmentData.equipmentLevel, limitAllocationOutcome.request.resourceName); - if (rr == null || rr.thresholdList == null || rr.thresholdList.isEmpty()) - return null; - - ThresholdStatus thresholdStatus = null; - long maxThresholdValue = 0; - for (ResourceThreshold th : rr.thresholdList) { - long thresholdValue = ExpressionEvaluator.evalLong(th.expression, equipmentData.data); - - if (thresholdValue > maxThresholdValue) { - maxThresholdValue = thresholdValue; - - if (limitAllocationOutcome.used >= thresholdValue) { - thresholdStatus = new ThresholdStatus(); - thresholdStatus.resourceRule = rr; - thresholdStatus.resourceThreshold = th; - thresholdStatus.limitValue = limitAllocationOutcome.limit; - thresholdStatus.thresholdValue = thresholdValue; - thresholdStatus.used = limitAllocationOutcome.used; - thresholdStatus.lastAdded = limitAllocationOutcome.allocatedCount; - } - } - } - - return thresholdStatus; - } - - public void setResourceRuleDao(ResourceRuleDao resourceRuleDao) { - this.resourceRuleDao = resourceRuleDao; - } - - public void setRangeRuleDao(RangeRuleDao rangeRuleDao) { - this.rangeRuleDao = rangeRuleDao; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java deleted file mode 100644 index 11fd974..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -public interface MaxPortSpeedDao { - - // Returns max speed in kbps - long getMaxPortSpeed(String imageFile, String endPointPosition, String interfaceName); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java deleted file mode 100644 index 7b2cd7f..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.openecomp.sdnc.util.speed.SpeedUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class MaxPortSpeedDaoImpl implements MaxPortSpeedDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(MaxPortSpeedDaoImpl.class); - - private final static String GET_SQL = - "SELECT * FROM MAX_PORT_SPEED WHERE image_file_name = ? AND end_point_position = ? AND interface_name = ?"; - - private JdbcTemplate jdbcTemplate; - private long defaultMaxPortSpeed = 5000000; - private SpeedUtil speedUtil; - - @Override - public long getMaxPortSpeed(String imageFile, String endPointPosition, String interfaceName) { - List maxPortSpeedList = - jdbcTemplate.query(GET_SQL, new Object[] { imageFile, endPointPosition, interfaceName }, - new RowMapper() { - - @Override - public MaxPortSpeed mapRow(ResultSet rs, int rowNum) throws SQLException { - MaxPortSpeed mps = new MaxPortSpeed(); - mps.maxSpeed = rs.getLong("max_speed"); - mps.unit = rs.getString("unit"); - return mps; - } - }); - - if (maxPortSpeedList.isEmpty()) - return defaultMaxPortSpeed; - - MaxPortSpeed mps = maxPortSpeedList.get(0); - return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); - } - - private static class MaxPortSpeed { - - public long maxSpeed; - public String unit; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - public void setDefaultMaxPortSpeed(long defaultMaxPortSpeed) { - this.defaultMaxPortSpeed = defaultMaxPortSpeed; - } - - public void setSpeedUtil(SpeedUtil speedUtil) { - this.speedUtil = speedUtil; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java deleted file mode 100644 index 2dad56e..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -public interface MaxServerSpeedDao { - - // Returns max speed in kbps - long getMaxServerSpeed(String serverModel, int evcCount); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java deleted file mode 100644 index 4e7d1bc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.openecomp.sdnc.util.speed.SpeedUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class MaxServerSpeedDaoImpl implements MaxServerSpeedDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(MaxServerSpeedDaoImpl.class); - - private final static String GET_SQL = - "SELECT * FROM MAX_SERVER_SPEED\n" + - "WHERE (server_model = ? OR server_model = 'ALL') AND evc_count >= ?\n" + - "ORDER BY evc_count"; - - private JdbcTemplate jdbcTemplate; - private long defaultMaxServerSpeed = 1600000; - private SpeedUtil speedUtil; - - @Override - public long getMaxServerSpeed(String serverModel, int evcCount) { - List maxServerSpeedList = - jdbcTemplate.query(GET_SQL, new Object[] { serverModel, evcCount }, new RowMapper() { - - @Override - public MaxServerSpeed mapRow(ResultSet rs, int rowNum) throws SQLException { - MaxServerSpeed mps = new MaxServerSpeed(); - mps.maxSpeed = rs.getLong("max_speed"); - mps.unit = rs.getString("unit"); - return mps; - } - }); - - if (maxServerSpeedList.isEmpty()) - return defaultMaxServerSpeed; - - MaxServerSpeed mps = maxServerSpeedList.get(0); - return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); - } - - private static class MaxServerSpeed { - - public long maxSpeed; - public String unit; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - public void setDefaultMaxServerSpeed(long defaultMaxServerSpeed) { - this.defaultMaxServerSpeed = defaultMaxServerSpeed; - } - - public void setSpeedUtil(SpeedUtil speedUtil) { - this.speedUtil = speedUtil; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java deleted file mode 100644 index 5911c8c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -public interface ParameterDao { - - String getParameter(String name); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java deleted file mode 100644 index fc1cfa1..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; - -public class ParameterDaoImpl implements ParameterDao { - - private static final Logger log = LoggerFactory.getLogger(ParameterDaoImpl.class); - - private final static String GET_SQL = "SELECT * FROM PARAMETERS WHERE name = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public String getParameter(String name) { - List> ll = jdbcTemplate.queryForList(GET_SQL, name); - - if (ll == null || ll.isEmpty()) { - log.info("Parameter: " + name + " not found in DB"); - return null; - } - - String v = (String) ll.get(0).get("value"); - log.info("Parameter from DB: " + name + "='" + v + "'"); - - return v; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java deleted file mode 100644 index 29094b6..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.util.List; - -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; -import org.openecomp.sdnc.ra.rule.data.RangeRule; - -public interface RangeRuleDao { - - List getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java deleted file mode 100644 index e82494d..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; -import org.openecomp.sdnc.ra.rule.data.RangeRule; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class RangeRuleDaoImpl implements RangeRuleDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(RangeRuleDaoImpl.class); - - private static final String GET_SQL = - "SELECT * FROM RANGE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public List getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel) { - List rangeRuleList = - jdbcTemplate.query(GET_SQL, new Object[] { serviceModel, endPointPosition, equipLevel.toString() }, - new RowMapper() { - - @Override - public RangeRule mapRow(ResultSet rs, int rowNum) throws SQLException { - RangeRule rl = new RangeRule(); - rl.id = rs.getLong("range_rule_id"); - rl.rangeName = rs.getString("range_name"); - rl.serviceModel = rs.getString("service_model"); - rl.endPointPosition = rs.getString("end_point_position"); - rl.equipmentLevel = rs.getString("equipment_level"); - rl.minValue = rs.getInt("min_value"); - rl.maxValue = rs.getInt("max_value"); - return rl; - } - }); - return rangeRuleList; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java deleted file mode 100644 index dd6ee36..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.util.List; - -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; -import org.openecomp.sdnc.ra.rule.data.ResourceRule; - -public interface ResourceRuleDao { - - List getResourceRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); - - ResourceRule getResourceRule( - String serviceModel, - String endPointPosition, - EquipmentLevel equipLevel, - String resourceName); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java deleted file mode 100644 index 9b30688..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; -import org.openecomp.sdnc.ra.rule.data.ResourceRule; -import org.openecomp.sdnc.ra.rule.data.ResourceThreshold; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class ResourceRuleDaoImpl implements ResourceRuleDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ResourceRuleDaoImpl.class); - - private static final String GET1_SQL = - "SELECT * FROM RESOURCE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ?"; - private static final String GET2_SQL = - "SELECT * FROM RESOURCE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ? AND resource_name = ?"; - private static final String THRESHOLD_SQL = "SELECT * FROM RESOURCE_THRESHOLD WHERE resource_rule_id = ?"; - - private JdbcTemplate jdbcTemplate; - ResourceRuleRowMapper resourceRuleRowMapper = new ResourceRuleRowMapper(); - ResourceThresholdRowMapper resourceThresholdRowMapper = new ResourceThresholdRowMapper(); - - @Override - public List getResourceRules( - String serviceModel, - String endPointPosition, - EquipmentLevel equipLevel) { - List resourceRuleList = jdbcTemplate.query(GET1_SQL, - new Object[] { serviceModel, endPointPosition, equipLevel.toString() }, resourceRuleRowMapper); - - for (ResourceRule rr : resourceRuleList) - rr.thresholdList = jdbcTemplate.query(THRESHOLD_SQL, new Object[] { rr.id }, resourceThresholdRowMapper); - - return resourceRuleList; - } - - @Override - public ResourceRule getResourceRule( - String serviceModel, - String endPointPosition, - EquipmentLevel equipLevel, - String resourceName) { - List resourceRuleList = jdbcTemplate.query(GET2_SQL, - new Object[] { serviceModel, endPointPosition, equipLevel.toString(), resourceName }, - resourceRuleRowMapper); - - if (resourceRuleList == null || resourceRuleList.isEmpty()) - return null; - - ResourceRule rr = resourceRuleList.get(0); - rr.thresholdList = jdbcTemplate.query(THRESHOLD_SQL, new Object[] { rr.id }, resourceThresholdRowMapper); - - return rr; - } - - private static class ResourceRuleRowMapper implements RowMapper { - - @Override - public ResourceRule mapRow(ResultSet rs, int rowNum) throws SQLException { - ResourceRule rl = new ResourceRule(); - rl.id = rs.getLong("resource_rule_id"); - rl.resourceName = rs.getString("resource_name"); - rl.serviceModel = rs.getString("service_model"); - rl.endPointPosition = rs.getString("end_point_position"); - rl.serviceExpression = rs.getString("service_expression"); - rl.equipmentLevel = rs.getString("equipment_level"); - rl.equipmentExpression = rs.getString("equipment_expression"); - rl.allocationExpression = rs.getString("allocation_expression"); - rl.softLimitExpression = rs.getString("soft_limit_expression"); - rl.hardLimitExpression = rs.getString("hard_limit_expression"); - return rl; - } - } - - private static class ResourceThresholdRowMapper implements RowMapper { - - @Override - public ResourceThreshold mapRow(ResultSet rs, int rowNum) throws SQLException { - ResourceThreshold th = new ResourceThreshold(); - th.expression = rs.getString("threshold_expression"); - th.message = rs.getString("threshold_message"); - return th; - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java deleted file mode 100644 index 2ff38b1..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -public interface VpeLockDao { - - String getVpeLock(String vpeName); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java deleted file mode 100644 index 1984235..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.dao; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; - -public class VpeLockDaoImpl implements VpeLockDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VpeLockDaoImpl.class); - - private final static String GET_SQL = "SELECT vpn_lock FROM VPE_LOCK WHERE vpe_name = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public String getVpeLock(String vpeName) { - List ll = jdbcTemplate.queryForList(GET_SQL, String.class, vpeName); - return ll != null && !ll.isEmpty() ? ll.get(0) : null; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java deleted file mode 100644 index d16c0ea..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.data; - -public class RangeRule { - - public long id; - public String rangeName; - public String serviceModel; - public String endPointPosition; - public String equipmentLevel; - public int minValue; - public int maxValue; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java deleted file mode 100644 index 88090cc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.data; - -import java.util.List; - -public class ResourceRule { - - public long id; - public String resourceName; - public String serviceModel; - public String endPointPosition; - public String serviceExpression; - public String equipmentLevel; - public String equipmentExpression; - public String allocationExpression; - public String softLimitExpression; - public String hardLimitExpression; - public List thresholdList; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java deleted file mode 100644 index b4d6a5a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.data; - -public class ResourceThreshold { - - public String expression; - public String message; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java deleted file mode 100644 index bb4ff38..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.rule.data; - -public class ThresholdStatus { - - public ResourceRule resourceRule; - public ResourceThreshold resourceThreshold; - public long limitValue; - public long thresholdValue; - public long used; - public long lastAdded; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java deleted file mode 100644 index d57199a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.service.dao; - -import org.openecomp.sdnc.ra.service.data.ServiceResource; -import org.openecomp.sdnc.ra.service.data.ServiceStatus; - -public interface ServiceResourceDao { - - ServiceResource getServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); - - void addServiceResource(ServiceResource serviceResource); - - void updateServiceResource(ServiceResource serviceResource); - - void deleteServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); - - void updateServiceStatus(String serviceInstanceId, ServiceStatus serviceStatus, ServiceStatus newServiceStatus); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java deleted file mode 100644 index 207bfc2..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.service.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.openecomp.sdnc.ra.service.data.ServiceResource; -import org.openecomp.sdnc.ra.service.data.ServiceStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; - -public class ServiceResourceDaoImpl implements ServiceResourceDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ServiceResourceDaoImpl.class); - - private static final String GET_SQL = - "SELECT * FROM SERVICE_RESOURCE WHERE service_instance_id = ? AND service_status = ?"; - - private static final String ADD_SQL = "INSERT INTO SERVICE_RESOURCE (\n" - + " service_instance_id, service_status, service_change_number, resource_set_id, resource_union_id)\n" - + "VALUES (?, ?, ?, ?, ?)"; - - private static final String UPDATE_SQL = - "UPDATE SERVICE_RESOURCE SET service_change_number = ?, resource_set_id = ?\n" - + "WHERE service_instance_id = ? AND service_status = ?"; - - private static final String DELETE_SQL = - "DELETE FROM SERVICE_RESOURCE WHERE service_instance_id = ? AND service_status = ?"; - - private static final String UPDATE_STATUS_SQL = - "UPDATE SERVICE_RESOURCE SET service_status = ? WHERE service_instance_id = ? AND service_status = ?"; - - private JdbcTemplate jdbcTemplate; - - @Override - public ServiceResource getServiceResource(final String serviceInstanceId, final ServiceStatus serviceStatus) { - List serviceResourceList = - jdbcTemplate.query(GET_SQL, new Object[] { serviceInstanceId, serviceStatus.toString() }, - new RowMapper() { - - @Override - public ServiceResource mapRow(ResultSet rs, int rowNum) throws SQLException { - ServiceResource sr = new ServiceResource(); - sr.id = rs.getLong("service_resource_id"); - sr.serviceInstanceId = serviceInstanceId; - sr.serviceStatus = serviceStatus; - sr.serviceChangeNumber = rs.getInt("service_change_number"); - sr.resourceSetId = rs.getString("resource_set_id"); - sr.resourceUnionId = rs.getString("resource_union_id"); - return sr; - } - }); - if (serviceResourceList.isEmpty()) - return null; - return serviceResourceList.get(0); - } - - @Override - public void addServiceResource(ServiceResource serviceResource) { - jdbcTemplate.update(ADD_SQL, serviceResource.serviceInstanceId, serviceResource.serviceStatus.toString(), - serviceResource.serviceChangeNumber, serviceResource.resourceSetId, serviceResource.resourceUnionId); - } - - @Override - public void updateServiceResource(ServiceResource serviceResource) { - jdbcTemplate.update(UPDATE_SQL, serviceResource.serviceChangeNumber, serviceResource.resourceSetId, - serviceResource.serviceInstanceId, serviceResource.serviceStatus.toString()); - } - - @Override - public void deleteServiceResource(String serviceInstanceId, ServiceStatus serviceStatus) { - jdbcTemplate.update(DELETE_SQL, serviceInstanceId, serviceStatus.toString()); - } - - @Override - public void updateServiceStatus( - String serviceInstanceId, - ServiceStatus serviceStatus, - ServiceStatus newServiceStatus) { - jdbcTemplate.update(UPDATE_STATUS_SQL, newServiceStatus.toString(), serviceInstanceId, serviceStatus.toString()); - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java deleted file mode 100644 index f8c7465..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.service.data; - -public class ServiceResource { - - public long id; - public String serviceInstanceId; - public ServiceStatus serviceStatus; - public int serviceChangeNumber; - public String resourceSetId; - public String resourceUnionId; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java deleted file mode 100644 index af73e1c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.ra.service.data; - -public enum ServiceStatus { - - Active, Pending -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java deleted file mode 100644 index 110d7e0..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java +++ /dev/null @@ -1,330 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.comp; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.openecomp.sdnc.lock.comp.LockHelper; -import org.openecomp.sdnc.lock.comp.ResourceLockedException; -import org.openecomp.sdnc.lock.comp.SynchronizedFunction; -import org.openecomp.sdnc.rm.dao.ResourceDao; -import org.openecomp.sdnc.rm.data.AllocationOutcome; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.AllocationStatus; -import org.openecomp.sdnc.rm.data.LabelAllocationOutcome; -import org.openecomp.sdnc.rm.data.LabelAllocationRequest; -import org.openecomp.sdnc.rm.data.LabelResource; -import org.openecomp.sdnc.rm.data.LimitAllocationOutcome; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.MultiAssetAllocationOutcome; -import org.openecomp.sdnc.rm.data.MultiAssetAllocationRequest; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationOutcome; -import org.openecomp.sdnc.rm.data.MultiResourceAllocationRequest; -import org.openecomp.sdnc.rm.data.RangeAllocationOutcome; -import org.openecomp.sdnc.rm.data.RangeAllocationRequest; -import org.openecomp.sdnc.rm.data.RangeResource; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.rm.data.ResourceKey; -import org.openecomp.sdnc.rm.data.ResourceType; -import org.openecomp.sdnc.rm.util.LabelUtil; -import org.openecomp.sdnc.rm.util.LimitUtil; -import org.openecomp.sdnc.rm.util.RangeUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -class AllocationFunction extends SynchronizedFunction { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(AllocationFunction.class); - - private ResourceDao resourceDao; - - private String applicationId; - private AllocationRequest request; - private AllocationOutcome outcome; - - private List updateList = new ArrayList(); - - public AllocationFunction(LockHelper lockHelper, ResourceDao resourceDao, String applicationId, - AllocationRequest request, int lockTimeout) { - super(lockHelper, getLockNames(request), lockTimeout); - this.applicationId = applicationId; - this.resourceDao = resourceDao; - this.request = request; - } - - private static Collection getLockNames(AllocationRequest request) { - Set lockResourceNames = new HashSet(); - addLockNames(lockResourceNames, request); - return lockResourceNames; - } - - private static void addLockNames(Set lockResourceNames, AllocationRequest request) { - if (request instanceof MultiAssetAllocationRequest) { - MultiAssetAllocationRequest req = (MultiAssetAllocationRequest) request; - if (req.assetIdList != null) - lockResourceNames.addAll(req.assetIdList); - } else if (request instanceof MultiResourceAllocationRequest) { - MultiResourceAllocationRequest req = (MultiResourceAllocationRequest) request; - if (req.allocationRequestList != null) - for (AllocationRequest request1 : req.allocationRequestList) - addLockNames(lockResourceNames, request1); - } else if (request.assetId != null) - lockResourceNames.add(request.assetId); - } - - @Override - public void _exec() throws ResourceLockedException { - outcome = allocate(request); - if (outcome.status == AllocationStatus.Success) - for (Resource r : updateList) - resourceDao.saveResource(r); - } - - private AllocationOutcome allocate(AllocationRequest allocationRequest) throws ResourceLockedException { - if (allocationRequest instanceof MultiAssetAllocationRequest) - return allocateMultiAsset((MultiAssetAllocationRequest) allocationRequest); - if (allocationRequest instanceof MultiResourceAllocationRequest) - return allocateMultiResource((MultiResourceAllocationRequest) allocationRequest); - if (allocationRequest instanceof LimitAllocationRequest) - return allocateLimit((LimitAllocationRequest) allocationRequest); - if (allocationRequest instanceof LabelAllocationRequest) - return allocateLabel((LabelAllocationRequest) allocationRequest); - if (allocationRequest instanceof RangeAllocationRequest) - return allocateRange((RangeAllocationRequest) allocationRequest); - return null; - } - - private MultiAssetAllocationOutcome allocateMultiAsset(MultiAssetAllocationRequest req) { - // TODO Auto-generated method stub - return null; - } - - private MultiResourceAllocationOutcome allocateMultiResource(MultiResourceAllocationRequest req) { - MultiResourceAllocationOutcome out = new MultiResourceAllocationOutcome(); - out.request = req; - out.allocationOutcomeList = new ArrayList(); - out.status = AllocationStatus.Success; - - if (req.allocationRequestList != null) - for (AllocationRequest req1 : req.allocationRequestList) { - AllocationOutcome out1 = allocate(req1); - out.allocationOutcomeList.add(out1); - if (out1.status != AllocationStatus.Success) - out.status = AllocationStatus.Failure; - } - - return out; - } - - private LimitAllocationOutcome allocateLimit(LimitAllocationRequest req) { - LimitAllocationOutcome out = new LimitAllocationOutcome(); - out.request = req; - - Resource r = resourceDao.getResource(req.assetId, req.resourceName); - if (r == null) { - r = new LimitResource(); - r.resourceKey = new ResourceKey(); - r.resourceKey.assetId = req.assetId; - r.resourceKey.resourceName = req.resourceName; - r.resourceType = ResourceType.Limit; - } else { - if (r.resourceType != ResourceType.Limit) { - out.status = AllocationStatus.ResourceNotFound; - return out; - } - LimitUtil.recalculate((LimitResource) r); - } - - LimitResource l = (LimitResource) r; - if (LimitUtil.checkLimit(l, req)) { - out.status = AllocationStatus.Success; - if (req.allocateCount > 0) { - out.allocatedCount = LimitUtil.allocateLimit(l, req, applicationId); - updateList.add(l); - } - } else - out.status = AllocationStatus.Failure; - - out.used = l.used; - out.limit = req.checkLimit; - - return out; - } - - private LabelAllocationOutcome allocateLabel(LabelAllocationRequest req) { - LabelAllocationOutcome out = new LabelAllocationOutcome(); - - out.request = req; - - Resource r = resourceDao.getResource(req.assetId, req.resourceName); - if (r == null) { - r = new LabelResource(); - r.resourceKey = new ResourceKey(); - r.resourceKey.assetId = req.assetId; - r.resourceKey.resourceName = req.resourceName; - r.resourceType = ResourceType.Label; - } else { - if (r.resourceType != ResourceType.Label) { - out.status = AllocationStatus.ResourceNotFound; - return out; - } - LabelUtil.recalculate((LabelResource) r); - } - - LabelResource l = (LabelResource) r; - if (LabelUtil.checkLabel(l, req)) { - out.status = AllocationStatus.Success; - out.currentLabel = l.label; - if (req.allocate) { - out.allocatedLabel = LabelUtil.allocateLabel(l, req, applicationId); - updateList.add(l); - } - } else - out.status = AllocationStatus.Failure; - - return out; - } - - private RangeAllocationOutcome allocateRange(RangeAllocationRequest req) { - RangeAllocationOutcome out = new RangeAllocationOutcome(); - - out.request = req; - - Resource r = resourceDao.getResource(req.assetId, req.resourceName); - if (r == null) { - r = new RangeResource(); - r.resourceKey = new ResourceKey(); - r.resourceKey.assetId = req.assetId; - r.resourceKey.resourceName = req.resourceName; - r.resourceType = ResourceType.Range; - } else { - if (r.resourceType != ResourceType.Range) { - out.status = AllocationStatus.ResourceNotFound; - return out; - } - RangeUtil.recalculate((RangeResource) r); - } - - RangeResource rr = (RangeResource) r; - SortedSet foundNumbers = null; - if (!req.check) { - out.status = AllocationStatus.Success; - foundNumbers = req.requestedNumbers; - } else { - if (req.requestedNumbers != null && req.requestedNumbers.size() > 0) { - foundNumbers = req.requestedNumbers; - out.status = AllocationStatus.Success; - for (int n : foundNumbers) - if (!RangeUtil.checkRange(rr, req, n)) { - out.status = AllocationStatus.Failure; - break; - } - } else { - foundNumbers = new TreeSet(); - int foundCount = 0; - - // First try to reuse the numbers already taken by the same resource union - SortedSet uu = RangeUtil.getUsed(rr, req.resourceUnionId); - if (uu != null && !uu.isEmpty()) { - if (uu.size() >= req.requestedCount) { - // Just take the first req.requestedCount numbers from uu - Iterator i = uu.iterator(); - while (foundCount < req.requestedCount) { - foundNumbers.add(i.next()); - foundCount++; - } - } else { - // Additional numbers are requested. Try to find them starting from - // the minimum we have in uu (the first element) towards the min - // parameter, and then starting from the maximum in uu (the last - // element) towards the max parameter. - // NOTE: In case of request for sequential numbers, the parameters - // alignBlockSize and alignModulus are ignored. It would be harder - // to take them into account, and currently it is not needed. - - int uumin = uu.first() - 1; - int uumax = uu.last() + 1; - foundNumbers.addAll(uu); - foundCount = uu.size(); - for (int n = uumin; foundCount < req.requestedCount && n >= req.checkMin; n--) { - if (RangeUtil.checkRange(rr, req, n)) { - foundNumbers.add(n); - foundCount++; - } else if (req.sequential) - break; - } - for (int n = uumax; foundCount < req.requestedCount && n <= req.checkMax; n++) { - if (RangeUtil.checkRange(rr, req, n)) { - foundNumbers.add(n); - foundCount++; - } else if (req.sequential) - break; - } - - // If we could not find enough numbers trying to reuse currently - // allocated, reset foundNumbers and foundCount, continue with - // the normal allocation of new numbers. - if (foundCount < req.requestedCount) { - foundNumbers = new TreeSet(); - foundCount = 0; - } - } - } - - for (int n = req.checkMin; foundCount < req.requestedCount && n <= req.checkMax; n++) - if (RangeUtil.checkRange(rr, req, n)) { - foundNumbers.add(n); - foundCount++; - } else if (req.sequential) - foundCount = 0; - - out.status = foundCount == req.requestedCount ? AllocationStatus.Success : AllocationStatus.Failure; - } - } - - if (out.status == AllocationStatus.Success) { - out.allocated = foundNumbers; - if (req.allocate) { - RangeUtil.allocateRange(rr, out.allocated, req, applicationId); - updateList.add(rr); - } - } else - out.allocated = new TreeSet(); - - out.used = rr.used; - - return out; - } - - public AllocationOutcome getAllocationOutcome() { - return outcome; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java deleted file mode 100644 index 59d5fc8..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.comp; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.openecomp.sdnc.lock.comp.LockHelper; -import org.openecomp.sdnc.lock.comp.ResourceLockedException; -import org.openecomp.sdnc.lock.comp.SynchronizedFunction; -import org.openecomp.sdnc.rm.dao.ResourceDao; -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.rm.util.ResourceUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -class ReleaseFunction extends SynchronizedFunction { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ReleaseFunction.class); - - private ResourceDao resourceDao; - - private String resourceSetId, resourceUnionId; - - public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, String resourceSetId, - String resourceUnionId, Collection lockNames, int lockTimeout) { - super(lockHelper, lockNames, lockTimeout); - this.resourceDao = resourceDao; - this.resourceSetId = resourceSetId; - this.resourceUnionId = resourceUnionId; - } - - @Override - public void _exec() throws ResourceLockedException { - List resourceList = - resourceSetId != null - ? resourceDao.getResourceSet(resourceSetId) : resourceDao.getResourceUnion(resourceUnionId); - for (Resource r : resourceList) { - boolean updated = false; - if (r.allocationItems != null) { - Iterator i = r.allocationItems.iterator(); - while (i.hasNext()) { - AllocationItem ai = i.next(); - if (resourceSetId != null) { - if (resourceSetId.equals(ai.resourceSetId)) { - i.remove(); - updated = true; - } - - } else if (resourceUnionId != null) { - - if (resourceUnionId.equals(ai.resourceUnionId)) { - i.remove(); - updated = true; - } - - } - } - } - if (updated) { - ResourceUtil.recalculate(r); - resourceDao.saveResource(r); - } - } - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java deleted file mode 100644 index 89dee34..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.comp; - -import java.util.Collection; - -import org.openecomp.sdnc.rm.data.Resource; - -public interface ResourceLoader { - - void loadResource(String applicationId, Resource resource, boolean force); - - void loadResources(String applicationId, Collection resourceList, boolean force); - - void loadResourcesForAsset(String applicationId, String assetId, Collection resourceList, boolean force); - - void deleteResource(String applicationId, String assetId, String resourceName); - - void deleteResourcesForAsset(String applicationId, String assetId); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java deleted file mode 100644 index 3d02c91..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.comp; - -import java.util.List; - -import org.openecomp.sdnc.rm.data.AllocationOutcome; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.Resource; - -public interface ResourceManager { - - Resource getResource(String resourceName, String assetId); - - List getResourceUnion(String resourceUnionId); - - AllocationOutcome allocateResources(AllocationRequest allocationRequest); - - void releaseResourceSet(String resourceSetId); - - void releaseResourceUnion(String resourceUnionId); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java deleted file mode 100644 index 8809570..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.comp; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.openecomp.sdnc.lock.comp.LockHelper; -import org.openecomp.sdnc.rm.dao.ResourceDao; -import org.openecomp.sdnc.rm.data.AllocationOutcome; -import org.openecomp.sdnc.rm.data.AllocationRequest; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.rm.util.ResourceUtil; -import org.openecomp.sdnc.util.str.StrUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ResourceManagerImpl implements ResourceManager { - - private static final Logger log = LoggerFactory.getLogger(ResourceManagerImpl.class); - - private LockHelper lockHelper; - private ResourceDao resourceDao; - - private String applicationId; - private int lockTimeout = 10 * 60; // Default 10 min - - public ResourceManagerImpl() { - log.info("ResourceManager created."); - } - - @Override - public Resource getResource(String resourceName, String assetId) { - Resource r = resourceDao.getResource(assetId, resourceName); - ResourceUtil.recalculate(r); - return r; - } - - @Override - public List getResourceUnion(String resourceUnionId) { - List rlist = resourceDao.getResourceUnion(resourceUnionId); - for (Resource r : rlist) - ResourceUtil.recalculate(r); - return rlist; - } - - @Override - public AllocationOutcome allocateResources(AllocationRequest allocationRequest) { - if (allocationRequest == null) - throw new IllegalArgumentException("allocateResources called with null argument"); - - AllocationFunction allocationFunction = - new AllocationFunction(lockHelper, resourceDao, applicationId, allocationRequest, lockTimeout); - allocationFunction.exec(); - AllocationOutcome allocationOutcome = allocationFunction.getAllocationOutcome(); - - StrUtil.info(log, allocationOutcome); - - return allocationOutcome; - } - - @Override - public void releaseResourceSet(String resourceSetId) { - List resourceList = resourceDao.getResourceSet(resourceSetId); - if (resourceList == null || resourceList.isEmpty()) - return; - - Set lockNames = getLockNames(resourceList); - ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, lockNames, lockTimeout); - releaseFunction.exec(); - } - - @Override - public void releaseResourceUnion(String resourceUnionId) { - List resourceList = resourceDao.getResourceUnion(resourceUnionId); - if (resourceList == null || resourceList.isEmpty()) - return; - - Set lockNames = getLockNames(resourceList); - ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, null, resourceUnionId, lockNames, lockTimeout); - releaseFunction.exec(); - } - - private Set getLockNames(List resourceList) { - Set lockNames = new HashSet(); - for (Resource r : resourceList) - lockNames.add(r.resourceKey.assetId); - return lockNames; - } - - public void setResourceDao(ResourceDao resourceDao) { - this.resourceDao = resourceDao; - } - - public void setLockTimeout(int lockTimeout) { - this.lockTimeout = lockTimeout; - } - - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - public void setLockHelper(LockHelper lockHelper) { - this.lockHelper = lockHelper; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java deleted file mode 100644 index 14f1754..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao; - -import java.util.List; - -import org.openecomp.sdnc.rm.data.Resource; - -public interface ResourceDao { - - Resource getResource(String assetId, String resourceName); - - void saveResource(Resource resource); - - void deleteResource(String assetId, String resourceName); - - List getResourceSet(String resourceSetId); - - List getResourceUnion(String resourceUnionId); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java deleted file mode 100644 index 761decc..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.Date; - -public class AllocationItem { - - public long id; - public long resourceId; - public String applicationId; - public String resourceSetId, resourceUnionId; - public String resourceShareGroupList; - public long ltUsed; - public String llLabel; - public String rrUsed; - public Date allocationTime; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java deleted file mode 100644 index e852c19..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.List; - -public interface AllocationItemJdbcDao { - - void add(AllocationItem ai); - - List getAllocationItems(long resourceId); - - void update(AllocationItem ai); - - void delete(long id); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java deleted file mode 100644 index 63cb21a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.Collections; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.PreparedStatementCreator; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.support.GeneratedKeyHolder; -import org.springframework.jdbc.support.KeyHolder; - -public class AllocationItemJdbcDaoImpl implements AllocationItemJdbcDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ResourceJdbcDaoImpl.class); - - private static final String INSERT_SQL = "INSERT INTO ALLOCATION_ITEM (\n" - + " resource_id, application_id, resource_set_id, resource_union_id, resource_share_group_list,\n" - + " lt_used, ll_label, rr_used, allocation_time)\nVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; - - private static final String UPDATE_SQL = "UPDATE ALLOCATION_ITEM SET\n" - + " resource_share_group_list = ?, lt_used = ?, ll_label = ?, rr_used = ?, allocation_time = ?\n" - + "WHERE allocation_item_id = ?"; - - private static final String DELETE_SQL = "DELETE FROM ALLOCATION_ITEM WHERE allocation_item_id = ?"; - - private static final String GET_SQL = "SELECT * FROM ALLOCATION_ITEM WHERE resource_id = ?"; - - private JdbcTemplate jdbcTemplate; - private AllocationItemRowMapper allocationItemRowMapper = new AllocationItemRowMapper(); - - @Override - public void add(final AllocationItem ai) { - PreparedStatementCreator psc = new PreparedStatementCreator() { - - @Override - public PreparedStatement createPreparedStatement(Connection dbc) throws SQLException { - PreparedStatement ps = dbc.prepareStatement(INSERT_SQL, new String[] { "allocation_item_id" }); - ps.setLong(1, ai.resourceId); - ps.setString(2, ai.applicationId); - ps.setString(3, ai.resourceSetId); - ps.setString(4, ai.resourceUnionId); - ps.setString(5, ai.resourceShareGroupList); - ps.setLong(6, ai.ltUsed); - ps.setString(7, ai.llLabel); - ps.setString(8, ai.rrUsed); - ps.setTimestamp(9, new Timestamp(ai.allocationTime.getTime())); - return ps; - } - }; - KeyHolder keyHolder = new GeneratedKeyHolder(); - jdbcTemplate.update(psc, keyHolder); - ai.id = keyHolder.getKey().longValue(); - } - - @Override - public void update(AllocationItem ai) { - Long ltUsed = ai.ltUsed <= 0 ? null : ai.ltUsed; - jdbcTemplate.update(UPDATE_SQL, ai.resourceShareGroupList, ltUsed, ai.llLabel, ai.rrUsed, ai.allocationTime, - ai.id); - } - - @Override - public void delete(long id) { - jdbcTemplate.update(DELETE_SQL, id); - } - - @Override - public List getAllocationItems(long resourceId) { - if (resourceId <= 0) - return Collections.emptyList(); - - return jdbcTemplate.query(GET_SQL, new Object[] { resourceId }, allocationItemRowMapper); - } - - private static class AllocationItemRowMapper implements RowMapper { - - @Override - public AllocationItem mapRow(ResultSet rs, int n) throws SQLException { - AllocationItem ai = new AllocationItem(); - ai.id = rs.getLong("allocation_item_id"); - ai.resourceId = rs.getLong("resource_id"); - ai.applicationId = rs.getString("application_id"); - ai.resourceSetId = rs.getString("resource_set_id"); - ai.resourceUnionId = rs.getString("resource_union_id"); - ai.resourceShareGroupList = rs.getString("resource_share_group_list"); - ai.ltUsed = rs.getLong("lt_used"); - ai.llLabel = rs.getString("ll_label"); - ai.rrUsed = rs.getString("rr_used"); - ai.allocationTime = rs.getTimestamp("allocation_time"); - return ai; - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java deleted file mode 100644 index 68e5165..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -public class Resource { - - public long id; - public String assetId, name, type; - public long ltUsed; - public String llLabel; - public int llReferenceCount; - public String rrUsed; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java deleted file mode 100644 index 98d0f57..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java +++ /dev/null @@ -1,370 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import org.openecomp.sdnc.rm.dao.ResourceDao; -import org.openecomp.sdnc.rm.data.LabelAllocationItem; -import org.openecomp.sdnc.rm.data.LabelResource; -import org.openecomp.sdnc.rm.data.LimitAllocationItem; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.RangeAllocationItem; -import org.openecomp.sdnc.rm.data.RangeResource; -import org.openecomp.sdnc.rm.data.ResourceKey; -import org.openecomp.sdnc.rm.data.ResourceType; -import org.openecomp.sdnc.util.str.StrUtil; - -public class ResourceDaoImpl implements ResourceDao { - - private ResourceJdbcDao resourceJdbcDao; - private ResourceLoadJdbcDao resourceLoadJdbcDao; - private AllocationItemJdbcDao allocationItemJdbcDao; - - @Override - public org.openecomp.sdnc.rm.data.Resource getResource(String assetId, String resourceName) { - Resource rEntity = resourceJdbcDao.getResource(assetId, resourceName); - org.openecomp.sdnc.rm.data.Resource r = createResource(rEntity); - - if (r != null) { - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); - for (AllocationItem aiEntity : aiEntityList) { - org.openecomp.sdnc.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); - r.allocationItems.add(ai); - } - - List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); - for (ResourceLoad rlEntity : rlEntityList) { - org.openecomp.sdnc.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } - } - - return r; - } - - @Override - public void saveResource(org.openecomp.sdnc.rm.data.Resource resource) { - if (resource == null) - return; - - org.openecomp.sdnc.rm.dao.jdbc.Resource resourceEntity = - resourceJdbcDao.getResource(resource.resourceKey.assetId, resource.resourceKey.resourceName); - if (resourceEntity == null) { - resourceEntity = createResourceEntity(resource); - resourceJdbcDao.add(resourceEntity); - if (resource.allocationItems != null) - for (org.openecomp.sdnc.rm.data.AllocationItem ai : resource.allocationItems) { - AllocationItem aiEntity = createAllocationItemEntity(resourceEntity.id, ai); - allocationItemJdbcDao.add(aiEntity); - } - if (resource.resourceLoadList != null) - for (org.openecomp.sdnc.rm.data.ResourceLoad rl : resource.resourceLoadList) { - ResourceLoad rlEntity = createResourceLoadEntity(resourceEntity.id, rl); - resourceLoadJdbcDao.add(rlEntity); - } - } else { - updateResourceEntity(resourceEntity, resource); - resourceJdbcDao.update(resourceEntity); - - List oldAiEntityList = allocationItemJdbcDao.getAllocationItems(resourceEntity.id); - if (resource.allocationItems != null) - for (org.openecomp.sdnc.rm.data.AllocationItem newai : resource.allocationItems) { - AllocationItem foundAiEntity = null; - for (AllocationItem oldAiEntity : oldAiEntityList) - if (oldAiEntity.resourceSetId.equals(newai.resourceSetId)) { - foundAiEntity = oldAiEntity; - break; - } - if (foundAiEntity != null) { - updateAllocationItemEntity(foundAiEntity, newai); - allocationItemJdbcDao.update(foundAiEntity); - } else { - AllocationItem newAiEntity = createAllocationItemEntity(resourceEntity.id, newai); - allocationItemJdbcDao.add(newAiEntity); - } - } - for (AllocationItem oldAiEntity : oldAiEntityList) { - boolean found = false; - if (resource.allocationItems != null) - for (org.openecomp.sdnc.rm.data.AllocationItem newai : resource.allocationItems) - if (oldAiEntity.resourceSetId.equals(newai.resourceSetId)) { - found = true; - break; - } - if (!found) - allocationItemJdbcDao.delete(oldAiEntity.id); - } - - List oldRlEntityList = resourceLoadJdbcDao.getResourceLoads(resourceEntity.id); - if (resource.resourceLoadList != null) - for (org.openecomp.sdnc.rm.data.ResourceLoad newrl : resource.resourceLoadList) { - ResourceLoad foundRlEntity = null; - for (ResourceLoad oldRlEntity : oldRlEntityList) - if (oldRlEntity.applicationId.equals(newrl.applicationId)) { - foundRlEntity = oldRlEntity; - break; - } - if (foundRlEntity != null) { - updateResourceLoadEntity(foundRlEntity, newrl); - resourceLoadJdbcDao.update(foundRlEntity); - } else { - ResourceLoad newRlEntity = createResourceLoadEntity(resourceEntity.id, newrl); - resourceLoadJdbcDao.add(newRlEntity); - } - } - for (ResourceLoad oldRlEntity : oldRlEntityList) { - boolean found = false; - if (resource.resourceLoadList != null) - for (org.openecomp.sdnc.rm.data.ResourceLoad newrl : resource.resourceLoadList) - if (oldRlEntity.applicationId.equals(newrl.applicationId)) { - found = true; - break; - } - if (!found) - resourceLoadJdbcDao.delete(oldRlEntity.id); - } - } - } - - @Override - public void deleteResource(String assetId, String resourceName) { - org.openecomp.sdnc.rm.dao.jdbc.Resource resourceEntity = resourceJdbcDao.getResource(assetId, resourceName); - if (resourceEntity != null) - resourceJdbcDao.delete(resourceEntity.id); - } - - @Override - public List getResourceSet(String resourceSetId) { - List rEntityList = resourceJdbcDao.getResourceSet(resourceSetId); - List rlist = new ArrayList(); - for (Resource rEntity : rEntityList) { - org.openecomp.sdnc.rm.data.Resource r = createResource(rEntity); - rlist.add(r); - - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); - for (AllocationItem aiEntity : aiEntityList) { - org.openecomp.sdnc.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); - r.allocationItems.add(ai); - } - - List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); - for (ResourceLoad rlEntity : rlEntityList) { - org.openecomp.sdnc.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } - } - return rlist; - } - - @Override - public List getResourceUnion(String resourceUnionId) { - List rEntityList = resourceJdbcDao.getResourceUnion(resourceUnionId); - List rlist = new ArrayList(); - for (Resource rEntity : rEntityList) { - org.openecomp.sdnc.rm.data.Resource r = createResource(rEntity); - rlist.add(r); - - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); - for (AllocationItem aiEntity : aiEntityList) { - org.openecomp.sdnc.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); - r.allocationItems.add(ai); - } - - List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); - for (ResourceLoad rlEntity : rlEntityList) { - org.openecomp.sdnc.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } - } - return rlist; - } - - private Resource createResourceEntity(org.openecomp.sdnc.rm.data.Resource resource) { - Resource resourceEntity = new Resource(); - resourceEntity.assetId = resource.resourceKey.assetId; - resourceEntity.name = resource.resourceKey.resourceName; - resourceEntity.type = resource.resourceType.toString(); - if (resource.resourceType == ResourceType.Limit) - resourceEntity.ltUsed = ((LimitResource) resource).used; - else if (resource.resourceType == ResourceType.Label) { - resourceEntity.llLabel = ((LabelResource) resource).label; - resourceEntity.llReferenceCount = ((LabelResource) resource).referenceCount; - } else if (resource.resourceType == ResourceType.Range) - resourceEntity.rrUsed = StrUtil.listInt(((RangeResource) resource).used); - - return resourceEntity; - } - - private ResourceLoad createResourceLoadEntity(long resourceId, org.openecomp.sdnc.rm.data.ResourceLoad rl) { - ResourceLoad rlEntity = new ResourceLoad(); - rlEntity.resourceId = resourceId; - rlEntity.applicationId = rl.applicationId; - rlEntity.loadTime = rl.resourceLoadTime; - rlEntity.expirationTime = rl.resourceExpirationTime; - return rlEntity; - } - - private void updateResourceLoadEntity(ResourceLoad rlEntity, org.openecomp.sdnc.rm.data.ResourceLoad rl) { - rlEntity.loadTime = rl.resourceLoadTime; - rlEntity.expirationTime = rl.resourceExpirationTime; - } - - private AllocationItem createAllocationItemEntity(long resourceId, org.openecomp.sdnc.rm.data.AllocationItem ai) { - AllocationItem aiEntity = new AllocationItem(); - aiEntity.resourceId = resourceId; - aiEntity.resourceSetId = ai.resourceSetId; - aiEntity.resourceUnionId = ai.resourceUnionId; - aiEntity.resourceShareGroupList = StrUtil.listStr(ai.resourceShareGroupList); - aiEntity.applicationId = ai.applicationId; - aiEntity.allocationTime = ai.allocationTime; - if (ai.resourceType == ResourceType.Limit) - aiEntity.ltUsed = ((LimitAllocationItem) ai).used; - else if (ai.resourceType == ResourceType.Label) - aiEntity.llLabel = ((LabelAllocationItem) ai).label; - else if (ai.resourceType == ResourceType.Range) - aiEntity.rrUsed = StrUtil.listInt(((RangeAllocationItem) ai).used); - return aiEntity; - } - - private void updateAllocationItemEntity(AllocationItem aiEntity, org.openecomp.sdnc.rm.data.AllocationItem ai) { - aiEntity.resourceShareGroupList = StrUtil.listStr(ai.resourceShareGroupList); - aiEntity.allocationTime = ai.allocationTime; - if (ai.resourceType == ResourceType.Limit) - aiEntity.ltUsed = ((LimitAllocationItem) ai).used; - else if (ai.resourceType == ResourceType.Label) - aiEntity.llLabel = ((LabelAllocationItem) ai).label; - else if (ai.resourceType == ResourceType.Range) - aiEntity.rrUsed = StrUtil.listInt(((RangeAllocationItem) ai).used); - } - - private void updateResourceEntity(Resource resourceEntity, org.openecomp.sdnc.rm.data.Resource resource) { - if (resource.resourceType == ResourceType.Limit) - resourceEntity.ltUsed = ((LimitResource) resource).used; - else if (resource.resourceType == ResourceType.Label) { - resourceEntity.llLabel = ((LabelResource) resource).label; - resourceEntity.llReferenceCount = ((LabelResource) resource).referenceCount; - } else if (resource.resourceType == ResourceType.Range) - resourceEntity.rrUsed = StrUtil.listInt(((RangeResource) resource).used); - } - - private org.openecomp.sdnc.rm.data.Resource createResource(Resource resourceEntity) { - if (resourceEntity == null) - return null; - - org.openecomp.sdnc.rm.data.Resource r = null; - ResourceType type = ResourceType.valueOf(resourceEntity.type); - if (type == ResourceType.Limit) { - LimitResource l = new LimitResource(); - l.used = resourceEntity.ltUsed; - r = l; - } else if (type == ResourceType.Label) { - LabelResource l = new LabelResource(); - l.label = resourceEntity.llLabel; - l.referenceCount = resourceEntity.llReferenceCount; - r = l; - } else if (type == ResourceType.Range) { - RangeResource rr = new RangeResource(); - rr.used = - StrUtil.listInt(resourceEntity.rrUsed, "Invalid data found in DB in for Resource Id: " + - resourceEntity.id + ": RESOURCE.RR_USED: " + resourceEntity.rrUsed); - r = rr; - } - - r.resourceType = type; - r.resourceKey = new ResourceKey(); - r.resourceKey.assetId = resourceEntity.assetId; - r.resourceKey.resourceName = resourceEntity.name; - - return r; - } - - private org.openecomp.sdnc.rm.data.AllocationItem createAllocationItem( - org.openecomp.sdnc.rm.data.Resource r, - AllocationItem aiEntity) { - if (r == null || aiEntity == null) - return null; - - org.openecomp.sdnc.rm.data.AllocationItem ai = null; - if (r.resourceType == ResourceType.Limit) { - LimitAllocationItem lai = new LimitAllocationItem(); - lai.used = aiEntity.ltUsed; - ai = lai; - } else if (r.resourceType == ResourceType.Label) { - LabelAllocationItem lai = new LabelAllocationItem(); - lai.label = aiEntity.llLabel; - ai = lai; - } else if (r.resourceType == ResourceType.Range) { - RangeAllocationItem rai = new RangeAllocationItem(); - rai.used = - StrUtil.listInt(aiEntity.rrUsed, "Invalid data found in DB in for Allocation Item Id: " + - aiEntity.id + ": ALLOCATION_ITEM.RR_USED: " + aiEntity.rrUsed); - ai = rai; - } - - ai.resourceType = r.resourceType; - ai.resourceKey = r.resourceKey; - ai.resourceSetId = aiEntity.resourceSetId; - ai.resourceUnionId = aiEntity.resourceUnionId; - if (aiEntity.resourceShareGroupList != null) - ai.resourceShareGroupList = new HashSet(StrUtil.listStr(aiEntity.resourceShareGroupList)); - ai.applicationId = aiEntity.applicationId; - ai.allocationTime = aiEntity.allocationTime; - - return ai; - } - - private org.openecomp.sdnc.rm.data.ResourceLoad createResourceLoad( - org.openecomp.sdnc.rm.data.Resource r, - ResourceLoad rlEntity) { - if (rlEntity == null) - return null; - - org.openecomp.sdnc.rm.data.ResourceLoad rl = new org.openecomp.sdnc.rm.data.ResourceLoad(); - rl.resourceKey = r.resourceKey; - rl.applicationId = rlEntity.applicationId; - rl.resourceLoadTime = rlEntity.loadTime; - rl.resourceExpirationTime = rlEntity.expirationTime; - - return rl; - } - - public void setResourceJdbcDao(ResourceJdbcDao resourceJdbcDao) { - this.resourceJdbcDao = resourceJdbcDao; - } - - public void setResourceLoadJdbcDao(ResourceLoadJdbcDao resourceLoadJdbcDao) { - this.resourceLoadJdbcDao = resourceLoadJdbcDao; - } - - public void setAllocationItemJdbcDao(AllocationItemJdbcDao allocationItemJdbcDao) { - this.allocationItemJdbcDao = allocationItemJdbcDao; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java deleted file mode 100644 index b250bb4..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.List; - -public interface ResourceJdbcDao { - - Resource getResource(String assetId, String resourceName); - - List getResourceSet(String resourceSetId); - - List getResourceUnion(String resourceUnionId); - - void add(Resource r); - - void delete(long id); - - void update(Resource r); -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java deleted file mode 100644 index 1902d23..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java +++ /dev/null @@ -1,144 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Collections; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.PreparedStatementCreator; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.support.GeneratedKeyHolder; -import org.springframework.jdbc.support.KeyHolder; - -public class ResourceJdbcDaoImpl implements ResourceJdbcDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ResourceJdbcDaoImpl.class); - - private static final String RESOURCE_SQL = "SELECT * FROM RESOURCE WHERE asset_id = ? AND resource_name = ?"; - - private static final String RESOURCE_SET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" - + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_set_id = ?)"; - - private static final String RESOURCE_UNION_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" - + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?)"; - - private static final String INSERT_SQL = "INSERT INTO RESOURCE (\n" - + " asset_id, resource_name, resource_type, lt_used, ll_label, ll_reference_count, rr_used)\n" - + "VALUES (?, ?, ?, ?, ?, ?, ?)"; - - private static final String UPDATE_SQL = "UPDATE RESOURCE SET\n" - + " lt_used = ?, ll_label = ?, ll_reference_count = ?, rr_used = ?\nWHERE resource_id = ?"; - - private static final String DELETE_SQL = "DELETE FROM RESOURCE WHERE resource_id = ?"; - - private JdbcTemplate jdbcTemplate; - private ResourceRowMapper resourceRowMapper = new ResourceRowMapper(); - - @Override - public Resource getResource(String assetId, String resourceName) { - if (assetId == null || assetId.trim().length() == 0 || resourceName == null || - resourceName.trim().length() == 0) - return null; - - List ll = jdbcTemplate.query(RESOURCE_SQL, new Object[] { assetId, resourceName }, resourceRowMapper); - return ll.isEmpty() ? null : ll.get(0); - } - - @Override - public List getResourceSet(String resourceSetId) { - if (resourceSetId == null) - return Collections.emptyList(); - - return jdbcTemplate.query(RESOURCE_SET_SQL, new Object[] { resourceSetId }, resourceRowMapper); - } - - @Override - public List getResourceUnion(String resourceUnionId) { - if (resourceUnionId == null) - return Collections.emptyList(); - - return jdbcTemplate.query(RESOURCE_UNION_SQL, new Object[] { resourceUnionId }, resourceRowMapper); - } - - @Override - public void add(final Resource r) { - PreparedStatementCreator psc = new PreparedStatementCreator() { - - @Override - public PreparedStatement createPreparedStatement(Connection dbc) throws SQLException { - PreparedStatement ps = dbc.prepareStatement(INSERT_SQL, new String[] { "resource_id" }); - ps.setString(1, r.assetId); - ps.setString(2, r.name); - ps.setString(3, r.type); - ps.setLong(4, r.ltUsed); - ps.setString(5, r.llLabel); - ps.setInt(6, r.llReferenceCount); - ps.setString(7, r.rrUsed); - return ps; - } - }; - KeyHolder keyHolder = new GeneratedKeyHolder(); - jdbcTemplate.update(psc, keyHolder); - r.id = keyHolder.getKey().longValue(); - } - - @Override - public void update(Resource r) { - Long ltUsed = r.ltUsed <= 0 ? null : r.ltUsed; - Integer llRefCount = r.llReferenceCount <= 0 ? null : r.llReferenceCount; - jdbcTemplate.update(UPDATE_SQL, ltUsed, r.llLabel, llRefCount, r.rrUsed, r.id); - } - - @Override - public void delete(long id) { - jdbcTemplate.update(DELETE_SQL, id); - } - - private static class ResourceRowMapper implements RowMapper { - - @Override - public Resource mapRow(ResultSet rs, int arg1) throws SQLException { - Resource r = new Resource(); - r.id = rs.getLong("resource_id"); - r.assetId = rs.getString("asset_id"); - r.name = rs.getString("resource_name"); - r.type = rs.getString("resource_type"); - r.ltUsed = rs.getLong("lt_used"); - r.llLabel = rs.getString("ll_label"); - r.llReferenceCount = rs.getInt("ll_reference_count"); - r.rrUsed = rs.getString("rr_used"); - return r; - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java deleted file mode 100644 index d4753fb..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.Date; - -public class ResourceLoad { - - public long id; - public long resourceId; - public String applicationId; - public Date loadTime; - public Date expirationTime; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java deleted file mode 100644 index 0024801..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.util.List; - -public interface ResourceLoadJdbcDao { - - void add(ResourceLoad rl); - - List getResourceLoads(long resourceId); - - void update(ResourceLoad rl); - - void delete(long id); - -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java deleted file mode 100644 index 5ee1526..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.dao.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.Collections; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.PreparedStatementCreator; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.support.GeneratedKeyHolder; -import org.springframework.jdbc.support.KeyHolder; - -public class ResourceLoadJdbcDaoImpl implements ResourceLoadJdbcDao { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ResourceJdbcDaoImpl.class); - - private static final String INSERT_SQL = "INSERT INTO RESOURCE_LOAD (\n" - + " resource_id, application_id, resource_load_time, resource_expiration_time)\nVALUES (?, ?, ?, ?)"; - - private static final String UPDATE_SQL = "UPDATE RESOURCE_LOAD SET\n" - + " resource_load_time = ?, resource_expiration_time = ?\nWHERE resource_id = ?"; - - private static final String DELETE_SQL = "DELETE FROM RESOURCE_LOAD WHERE resource_load_id = ?"; - - private static final String GET_SQL = "SELECT * FROM RESOURCE_LOAD WHERE resource_id = ?"; - - private JdbcTemplate jdbcTemplate; - private ResourceLoadRowMapper resourceLoadRowMapper = new ResourceLoadRowMapper(); - - @Override - public void add(final ResourceLoad rl) { - PreparedStatementCreator psc = new PreparedStatementCreator() { - - @Override - public PreparedStatement createPreparedStatement(Connection dbc) throws SQLException { - PreparedStatement ps = dbc.prepareStatement(INSERT_SQL, new String[] { "resource_load_id" }); - ps.setLong(1, rl.resourceId); - ps.setString(2, rl.applicationId); - ps.setTimestamp(3, new Timestamp(rl.loadTime.getTime())); - ps.setTimestamp(4, new Timestamp(rl.expirationTime.getTime())); - return ps; - } - }; - KeyHolder keyHolder = new GeneratedKeyHolder(); - jdbcTemplate.update(psc, keyHolder); - rl.id = keyHolder.getKey().longValue(); - } - - @Override - public void update(ResourceLoad rl) { - jdbcTemplate.update(UPDATE_SQL, rl.loadTime, rl.expirationTime, rl.id); - } - - @Override - public void delete(long id) { - jdbcTemplate.update(DELETE_SQL, id); - } - - @Override - public List getResourceLoads(long resourceId) { - if (resourceId <= 0) - return Collections.emptyList(); - - return jdbcTemplate.query(GET_SQL, new Object[] { resourceId }, resourceLoadRowMapper); - } - - private static class ResourceLoadRowMapper implements RowMapper { - - @Override - public ResourceLoad mapRow(ResultSet rs, int n) throws SQLException { - ResourceLoad rl = new ResourceLoad(); - rl.id = rs.getLong("allocation_item_id"); - rl.resourceId = rs.getLong("resource_id"); - rl.applicationId = rs.getString("application_id"); - rl.loadTime = rs.getTimestamp("resource_load_time"); - rl.expirationTime = rs.getTimestamp("resource_expiration_time"); - return rl; - } - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java deleted file mode 100644 index 78decea..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public enum AllocationAction { - Fail, Succeed_DoNothing, Succeed_Allocate -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java deleted file mode 100644 index c058859..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.Date; -import java.util.Set; - -public abstract class AllocationItem { - - public ResourceKey resourceKey; - public ResourceType resourceType; - public String resourceSetId; - public String resourceUnionId; - public Set resourceShareGroupList; - public String applicationId; - public Date allocationTime; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java deleted file mode 100644 index 31447f3..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class AllocationOutcome { - - public AllocationStatus status = null; - public AllocationRequest request = null; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java deleted file mode 100644 index bd8d29d..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.Set; - -public class AllocationRequest { - - public String resourceUnionId = null; - public String resourceSetId = null; - public Set resourceShareGroupList = null; - public String resourceName = null; - public String assetId = null; - public AllocationAction missingResourceAction = AllocationAction.Succeed_Allocate; - public AllocationAction expiredResourceAction = AllocationAction.Succeed_Allocate; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java deleted file mode 100644 index c3ee5e0..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public enum AllocationStatus { - - Success, Failure, NotTried, ResourceNotFound, ResourceExpired -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java deleted file mode 100644 index 8190fb3..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public enum InitAction { - CheckInit("Initialize if needed"), ForceInit("Always Initialize"), NoInit("No initialization"); - - private String str; - - private InitAction(String str) { - this.str = str; - } - - public String getInitActionStr() { - return str; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java deleted file mode 100644 index 7419ade..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LabelAllocationItem extends AllocationItem { - - public String label; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java deleted file mode 100644 index c3606bb..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LabelAllocationOutcome extends AllocationOutcome { - - public String allocatedLabel = null; - public String currentLabel = null; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java deleted file mode 100644 index aac8ca5..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LabelAllocationRequest extends AllocationRequest { - - public String label = null; - public boolean check = false; - public boolean allocate = false; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java deleted file mode 100644 index b6706e2..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LabelResource extends Resource { - - public static final String BLOCKED = "__BLOCKED__"; - - public String label; - public int referenceCount; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java deleted file mode 100644 index bf6b042..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LimitAllocationItem extends AllocationItem { - - public long used; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java deleted file mode 100644 index b16a3fd..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LimitAllocationOutcome extends AllocationOutcome { - - public long allocatedCount = 0; - public long used = 0; - public long limit = 0; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java deleted file mode 100644 index 256e974..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LimitAllocationRequest extends AllocationRequest { - - public long checkCount = 0; - public long allocateCount = 0; - public long checkLimit = -1; - public boolean replace = false; - public boolean strict = false; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java deleted file mode 100644 index e557e70..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class LimitResource extends Resource { - - public long used = 0; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java deleted file mode 100644 index 8f922e7..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.List; - -public class MultiAssetAllocationOutcome extends AllocationOutcome { - - public List goodAssetIdList; - public List allocationOutcomeList; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java deleted file mode 100644 index e30583c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.List; - -public class MultiAssetAllocationRequest extends AllocationRequest { - - public List assetIdList = null; - public AllocationRequest allocationRequest = null; - public int requestedCount = 0; - public boolean sequential = false; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java deleted file mode 100644 index 4dabd25..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.List; - -public class MultiResourceAllocationOutcome extends AllocationOutcome { - - public List allocationOutcomeList; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java deleted file mode 100644 index 526756b..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.List; - -public class MultiResourceAllocationRequest extends AllocationRequest { - - public List allocationRequestList = null; - public boolean stopOnFirstFailure = true; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java deleted file mode 100644 index 9a5f134..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.SortedSet; - -public class RangeAllocationItem extends AllocationItem { - - public SortedSet used; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java deleted file mode 100644 index 9452b14..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.SortedSet; - -public class RangeAllocationOutcome extends AllocationOutcome { - - public SortedSet allocated = null; - public SortedSet used = null; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java deleted file mode 100644 index 0341a08..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.SortedSet; - -public class RangeAllocationRequest extends AllocationRequest { - - public int checkMin = 0; - public int checkMax = 0; - public boolean check = false; - public boolean allocate = false; - public boolean replace = false; - public SortedSet requestedNumbers = null; - public int requestedCount = 1; - public boolean sequential = false; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java deleted file mode 100644 index 7101d9d..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.SortedSet; - -public class RangeResource extends Resource { - - public SortedSet used; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java deleted file mode 100644 index f70611c..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.Collection; - -public abstract class Resource { - - public ResourceKey resourceKey; - public ResourceType resourceType; - public Collection allocationItems; - public Collection resourceLoadList; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java deleted file mode 100644 index 05c7aa9..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public class ResourceKey { - - public String assetId; - public String resourceName; - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || !(o instanceof ResourceKey)) - return false; - ResourceKey rk = (ResourceKey) o; - if (assetId == null || resourceName == null) - return false; - return assetId.equals(rk.assetId) && resourceName.equals(rk.resourceName); - } - - @Override - public int hashCode() { - return (int) ((long) System.identityHashCode(assetId) + (long) System.identityHashCode(resourceName)); - } - - @Override - public String toString() { - return "(" + assetId + ", " + resourceName + ")"; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java deleted file mode 100644 index 54088d1..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -import java.util.Date; - -public class ResourceLoad { - - public ResourceKey resourceKey; - public String applicationId; - public Date resourceLoadTime; - public Date resourceExpirationTime; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java deleted file mode 100644 index 3f87f97..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.data; - -public enum ResourceType { - Limit, Label, Range -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java deleted file mode 100644 index 558ef73..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.util; - -import java.util.ArrayList; -import java.util.Date; - -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.LabelAllocationItem; -import org.openecomp.sdnc.rm.data.LabelAllocationRequest; -import org.openecomp.sdnc.rm.data.LabelResource; -import org.openecomp.sdnc.rm.data.ResourceKey; -import org.openecomp.sdnc.rm.data.ResourceType; - -public class LabelUtil { - - public static boolean checkLabel(LabelResource l, LabelAllocationRequest req) { - if (req.check && req.label != null && l.allocationItems != null && !l.allocationItems.isEmpty()) { - for (AllocationItem ai : l.allocationItems) { - LabelAllocationItem lai = (LabelAllocationItem) ai; - if (!eq(req.resourceUnionId, lai.resourceUnionId) && !eq(req.label, lai.label)) - return false; - } - } - return true; - } - - public static String allocateLabel(LabelResource l, LabelAllocationRequest req, String applicationId) { - if (!req.allocate) - return null; - - LabelAllocationItem lai = (LabelAllocationItem) ResourceUtil.getAllocationItem(l, req.resourceSetId); - if (lai == null) { - lai = new LabelAllocationItem(); - lai.resourceType = ResourceType.Label; - lai.resourceKey = new ResourceKey(); - lai.resourceKey.assetId = req.assetId; - lai.resourceKey.resourceName = req.resourceName; - lai.applicationId = applicationId; - lai.resourceSetId = req.resourceSetId; - lai.resourceUnionId = req.resourceUnionId; - lai.resourceShareGroupList = req.resourceShareGroupList; - - if (l.allocationItems == null) - l.allocationItems = new ArrayList(); - l.allocationItems.add(lai); - } - - lai.label = req.label; - lai.allocationTime = new Date(); - - recalculate(l); - - return lai.label; - } - - public static void recalculate(LabelResource l) { - l.label = null; - l.referenceCount = 0; - if (l.allocationItems != null) - for (AllocationItem ai : l.allocationItems) { - LabelAllocationItem lai = (LabelAllocationItem) ai; - if (lai.label != null) { - l.referenceCount++; - if (l.label == null) - l.label = lai.label; - else if (!l.label.equals(lai.label)) - l.label = "__BLOCKED__"; - } - } - } - - private static boolean eq(Object o1, Object o2) { - return o1 == null ? o2 == null : o1.equals(o2); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java deleted file mode 100644 index d793e3f..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java +++ /dev/null @@ -1,334 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.util; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.LimitAllocationItem; -import org.openecomp.sdnc.rm.data.LimitAllocationRequest; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.ResourceKey; -import org.openecomp.sdnc.rm.data.ResourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LimitUtil { - - private static final Logger log = LoggerFactory.getLogger(LimitUtil.class); - - public static boolean checkLimit(LimitResource l, LimitAllocationRequest req) { - if (req.checkCount <= 0) - return true; - - long checkCount = req.checkCount; - long currentUsage = 0; - if (req.resourceSetId != null) { - LimitAllocationItem lai = (LimitAllocationItem) ResourceUtil.getAllocationItem(l, req.resourceSetId); - if (lai != null) - currentUsage = lai.used; - } - if (!req.replace) - checkCount += currentUsage; - - long used = calculateLimitUsage(l, 0, null, null); - long wouldUse = calculateLimitUsage(l, checkCount, req.resourceUnionId, req.resourceShareGroupList); - - // If usage is not increasing by this request, only check the limit if - // strictCheck is true. - if (wouldUse <= used && !req.strict) - return true; - - return wouldUse <= req.checkLimit; - } - - private static long calculateLimitUsage( - LimitResource l, - long checkCount, - String resourceUnionId, - Set resourceShareGroupList) { - if ((l.allocationItems == null || l.allocationItems.isEmpty()) && - (resourceUnionId == null || resourceUnionId.length() == 0)) - return 0; - - long t1 = System.currentTimeMillis(); - boolean logit = false; - String rn = "Resource: " + l.resourceKey.resourceName + " - " + l.resourceKey.assetId; - - // In order to best utilize the resource, we need to take not the sum of all allocation items, but - // instead the maximum usage that could happen at any moment of time (given not all allocation items are active - // at the same time), also taking into account possible resource sharing. - // Thus we need to find all combinations of allocation items that can be active at the same time (allocation - // items with the same first union cannot be active at the same time), compute the usage for each (again, - // taking into account resource sharing), and take the maximum. - // - // Example: - // Let's have the following allocation items: - // ai1: sdid1, vrf1 - usage 5 - // ai2: sdid2, vrf1 - usage 10 - // ai3: sdid3, vrf2 - usage 15 - // ai4: sdid1, vrf3 - usage 20 - // ai5: sdid3, vrf1 - usage 25 - // The following combinations of active allocation items are possible: - // 1) ai1, ai2, ai3 - // 2) ai1, ai2, ai5 - // 3) ai2, ai3, ai4 - // 4) ai2, ai3, ai5 - // Here is how we calculate the usage for combination 1: - // ai1 and ai2 contain the same resource union vrf1, so they share the resource - we take the max of usage, - // so we have: - // max(5, 10) + 15 = 25 - // Similarly, we calculate the usage of the other combinations: - // 2) max(5, 10, 25) = 25 - // 3) 10 + 15 + 20 = 45 - // 4) max(10, 25) + 15 = 40 - // So, the result in this case is: - // max(25, 25, 45, 40) = 45 - // - // We might have a problem with this approach, if we have a lot of combinations. Assuming we have at most 2 - // allocation items with the same resource union (sdid), the number of combinations would be - // 2 ^ n - // where n is the number of allocation items that have the same resource union (sdid). That would be - // the number of change orders currently in progress. - // - // Here is one optimization that we can do: - // If we have allocation items that have all resource unions the same, we don't need to generate combinations - // with each of them, we can just take the one of them with the maximum usage, as it is clear that the others - // will not lead to a bigger usage. - // For example, if we had the following allocation items: - // ai1: sdid1, vrf1 - usage 10 - // ai2: sdid1, vrf1 - usage 20 - // We only need to take the combinations with ai2, as they will always lead to bigger usage than the remaining - // combinations with ai1. - - // First, group the allocation items by the first resource union, using the LimitUsage structure - int regularChangeCount = 0; - Map> limitUsageMap = new HashMap>(); - if (l.allocationItems != null) - for (AllocationItem ai : l.allocationItems) { - LimitAllocationItem lai = (LimitAllocationItem) ai; - boolean regularChange = - addLimitUsage(limitUsageMap, lai.resourceUnionId, lai.resourceShareGroupList, lai.used); - if (regularChange) - regularChangeCount++; - } - if (checkCount > 0 && resourceUnionId != null) { - boolean regularChange = addLimitUsage(limitUsageMap, resourceUnionId, resourceShareGroupList, checkCount); - if (regularChange) - regularChangeCount++; - } - - // Generate all the combinations, containing one LimitUsage object for each firstResourceUnion - int significantChangeCount = 0; - List> allCombinations = new ArrayList>(); - for (String firstResourceUnion : limitUsageMap.keySet()) { - List limitUsageList = limitUsageMap.get(firstResourceUnion); - if (limitUsageList.size() > 1) - significantChangeCount++; - if (allCombinations.isEmpty()) { - for (LimitUsage limitUsage : limitUsageList) { - List newCombination = new ArrayList(); - newCombination.add(limitUsage); - allCombinations.add(newCombination); - } - } else { - if (limitUsageList.size() == 1) { - // No new combinations are generated - just add this one to all combinations we have until now - for (List combination : allCombinations) - combination.add(limitUsageList.get(0)); - } else { - // We have to duplicate each of the current combinations for each element of limitUsageList - List> newAllCombinations = new ArrayList>(); - for (List combination : allCombinations) - for (LimitUsage limitUsage : limitUsageList) { - List newCombination = new ArrayList(combination); - newCombination.add(limitUsage); - newAllCombinations.add(newCombination); - } - allCombinations = newAllCombinations; - } - } - } - - // Now, go through all combinations and calculate its usage, get the maximum - long maxUsage = 0; - for (List combination : allCombinations) { - long usage = calculateUsage(combination); - if (usage > maxUsage) - maxUsage = usage; - } - - long t2 = System.currentTimeMillis(); - if (logit) { - log.debug(rn + ": Calculating usage completed:"); - log.debug(rn + ": Regular changes: " + regularChangeCount); - log.debug(rn + ": Significant changes: " + significantChangeCount); - log.debug(rn + ": Combinations: " + allCombinations.size()); - log.debug(rn + ": Usage: " + maxUsage); - log.debug(rn + ": Time: " + (t2 - t1)); - } - - return maxUsage; - } - - private static boolean addLimitUsage( - Map> limitUsageMap, - String resourceUnionId, - Set resourceShareGroupList, - long used) { - List limitUsageList = limitUsageMap.get(resourceUnionId); - if (limitUsageList == null) { - limitUsageList = new ArrayList(); - limitUsageMap.put(resourceUnionId, limitUsageList); - } - // See if we already have the same shareResourceUnionSet in the list. In such case just update the usage - // to the bigger value. - LimitUsage limitUsage = null; - for (LimitUsage limitUsage1 : limitUsageList) { - if ((limitUsage1.resourceShareGroupList == null || limitUsage1.resourceShareGroupList.isEmpty()) && - (resourceShareGroupList == null || resourceShareGroupList.isEmpty())) { - limitUsage = limitUsage1; - break; - } - if (limitUsage1.resourceShareGroupList != null && - limitUsage1.resourceShareGroupList.equals(resourceShareGroupList)) { - limitUsage = limitUsage1; - break; - } - } - if (limitUsage != null) { - if (limitUsage.usage < used) - limitUsage.usage = used; - return true; - } - - limitUsage = new LimitUsage(); - limitUsage.resourceUnion = resourceUnionId; - limitUsage.resourceShareGroupList = resourceShareGroupList; - limitUsage.usage = used; - limitUsageList.add(limitUsage); - return false; - } - - private static class LimitUsage { - - @SuppressWarnings("unused") - public String resourceUnion; - public Set resourceShareGroupList; - public long usage; - } - - private static boolean hasCommonSharedResource(LimitUsage limitUsage1, LimitUsage limitUsage2) { - if (limitUsage1.resourceShareGroupList == null || limitUsage1.resourceShareGroupList.isEmpty()) - return false; - if (limitUsage2.resourceShareGroupList == null || limitUsage2.resourceShareGroupList.isEmpty()) - return false; - - for (String resourceUnion : limitUsage1.resourceShareGroupList) - if (limitUsage2.resourceShareGroupList.contains(resourceUnion)) - return true; - - return false; - } - - private static long calculateUsage(List combination) { - // All LimitUsage objects that have a common value in their sharedResourceUnionSet reuse the resource, so - // split the combination in sets that have common value. Then the usage of each set will be the maximum of - // the usages of the LimitUsage objects in the set. The usage of the combination will be the sum of the usages - // of all sets. - List> sharedSets = new ArrayList>(); - for (LimitUsage limitUsage : combination) { - // See if we can put limitUsage in any of the existing sets - is it has a common resource union with - // any of the LimitUsage objects in a set. - boolean found = false; - for (List sharedSet : sharedSets) { - for (LimitUsage limitUsage1 : sharedSet) { - if (hasCommonSharedResource(limitUsage, limitUsage1)) { - found = true; - break; - } - } - if (found) { - sharedSet.add(limitUsage); - break; - } - } - if (!found) { - // Start a new set - List newSharedSet = new ArrayList(); - newSharedSet.add(limitUsage); - sharedSets.add(newSharedSet); - } - } - - long sum = 0; - for (List sharedSet : sharedSets) { - float max = 0; - for (LimitUsage limitUsage : sharedSet) - if (max < limitUsage.usage) - max = limitUsage.usage; - sum += max; - } - - return sum; - } - - public static long allocateLimit(LimitResource l, LimitAllocationRequest req, String applicationId) { - if (req.allocateCount <= 0) - return 0; - long uu = l.used; - - LimitAllocationItem lai = (LimitAllocationItem) ResourceUtil.getAllocationItem(l, req.resourceSetId); - if (lai == null) { - lai = new LimitAllocationItem(); - lai.resourceType = ResourceType.Limit; - lai.resourceKey = new ResourceKey(); - lai.resourceKey.assetId = req.assetId; - lai.resourceKey.resourceName = req.resourceName; - lai.applicationId = applicationId; - lai.resourceSetId = req.resourceSetId; - lai.resourceUnionId = req.resourceUnionId; - lai.resourceShareGroupList = req.resourceShareGroupList; - lai.used = req.allocateCount; - - if (l.allocationItems == null) - l.allocationItems = new ArrayList(); - l.allocationItems.add(lai); - } else - lai.used = req.replace ? req.allocateCount : lai.used + req.allocateCount; - - lai.allocationTime = new Date(); - - recalculate(l); - - return l.used - uu; - } - - public static void recalculate(LimitResource l) { - l.used = calculateLimitUsage(l, 0, null, null); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java deleted file mode 100644 index bd244af..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.util; - -import java.util.ArrayList; -import java.util.Date; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.RangeAllocationItem; -import org.openecomp.sdnc.rm.data.RangeAllocationRequest; -import org.openecomp.sdnc.rm.data.RangeResource; -import org.openecomp.sdnc.rm.data.ResourceKey; -import org.openecomp.sdnc.rm.data.ResourceType; - -public class RangeUtil { - - public static void recalculate(RangeResource r) { - r.used = new TreeSet(); - if (r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) { - RangeAllocationItem rai = (RangeAllocationItem) ai; - if (rai.used != null) - r.used.addAll(rai.used); - } - } - - public static boolean checkRange(RangeResource r, RangeAllocationRequest req, int num) { - if (num < req.checkMin || num > req.checkMax) - return false; - - if (r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) { - RangeAllocationItem rai = (RangeAllocationItem) ai; - if (!eq(req.resourceUnionId, rai.resourceUnionId) && rai.used != null && rai.used.contains(num)) - return false; - } - - return true; - } - - private static boolean eq(Object o1, Object o2) { - return o1 == null ? o2 == null : o1.equals(o2); - } - - public static SortedSet getUsed(RangeResource r, String resourceUnionId) { - SortedSet used = new TreeSet(); - if (r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) { - RangeAllocationItem rai = (RangeAllocationItem) ai; - if (eq(resourceUnionId, rai.resourceUnionId) && rai.used != null) - used.addAll(rai.used); - } - return used; - } - - public static void allocateRange( - RangeResource rr, - SortedSet requestedNumbers, - RangeAllocationRequest req, - String applicationId) { - if (!req.allocate) - return; - - RangeAllocationItem rai = (RangeAllocationItem) ResourceUtil.getAllocationItem(rr, req.resourceSetId); - if (rai == null) { - rai = new RangeAllocationItem(); - rai.resourceType = ResourceType.Range; - rai.resourceKey = new ResourceKey(); - rai.resourceKey.assetId = req.assetId; - rai.resourceKey.resourceName = req.resourceName; - rai.applicationId = applicationId; - rai.resourceSetId = req.resourceSetId; - rai.resourceUnionId = req.resourceUnionId; - rai.resourceShareGroupList = req.resourceShareGroupList; - rai.used = requestedNumbers; - - if (rr.allocationItems == null) - rr.allocationItems = new ArrayList(); - rr.allocationItems.add(rai); - } else if (req.replace) - rai.used = requestedNumbers; - else - rai.used.addAll(requestedNumbers); - - rai.allocationTime = new Date(); - - recalculate(rr); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java deleted file mode 100644 index a0dd6da..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.rm.util; - -import org.openecomp.sdnc.rm.data.AllocationItem; -import org.openecomp.sdnc.rm.data.LabelResource; -import org.openecomp.sdnc.rm.data.LimitResource; -import org.openecomp.sdnc.rm.data.Resource; -import org.openecomp.sdnc.rm.data.ResourceType; - -public class ResourceUtil { - - public static AllocationItem getAllocationItem(Resource r, String resourceSetId) { - if (r.allocationItems != null) - for (AllocationItem ai : r.allocationItems) - if (ai.resourceSetId != null && ai.resourceSetId.equals(resourceSetId)) - return ai; - return null; - } - - public static void recalculate(Resource r) { - if (r == null) - return; - - if (r.resourceType == ResourceType.Limit) - LimitUtil.recalculate((LimitResource) r); - else if (r.resourceType == ResourceType.Label) - LabelUtil.recalculate((LabelResource) r); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java deleted file mode 100644 index a42f11b..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.db; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; - -import javax.sql.DataSource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CachedDataSourceWrap implements DataSource { - - private static final Logger log = LoggerFactory.getLogger(CachedDataSourceWrap.class); - - private ThreadLocal con = new ThreadLocal<>(); - - private DataSource dataSource; - - @Override - public PrintWriter getLogWriter() throws SQLException { - return dataSource.getLogWriter(); - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - dataSource.setLogWriter(out); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - dataSource.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return dataSource.getLoginTimeout(); - } - - @Override - public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { - return dataSource.getParentLogger(); - } - - @Override - public T unwrap(Class iface) throws SQLException { - return dataSource.unwrap(iface); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return dataSource.isWrapperFor(iface); - } - - @Override - public Connection getConnection() throws SQLException { - if (con.get() == null) { - Connection c = dataSource.getConnection(); - ConnectionWrap cc = new ConnectionWrap(c); - con.set(cc); - - log.info("Got new DB connection: " + c); - } else - log.info("Using thread DB connection: " + con.get().getCon()); - - return con.get(); - } - - @Override - public Connection getConnection(String username, String password) throws SQLException { - if (con.get() == null) { - Connection c = dataSource.getConnection(username, password); - ConnectionWrap cc = new ConnectionWrap(c); - con.set(cc); - - log.info("Got new DB connection: " + c); - } else - log.info("Using thread DB connection: " + con.get().getCon()); - - return con.get(); - } - - public void releaseConnection() { - if (con.get() != null) { - try { - con.get().realClose(); - - log.info("DB Connection released: " + con.get().getCon()); - } catch (SQLException e) { - log.warn("Failed to release DB connection", e); - } finally { - con.remove(); - } - } - } - - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java deleted file mode 100644 index 1720ef6..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.db; - -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.SQLClientInfoException; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Executor; - -public class ConnectionWrap implements Connection { - - private Connection cc; - - public ConnectionWrap(Connection cc) { - super(); - this.cc = cc; - } - - public Connection getCon() { - return cc; - } - - public void realClose() throws SQLException { - cc.close(); - } - - @Override - public T unwrap(Class iface) throws SQLException { - return cc.unwrap(iface); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return cc.isWrapperFor(iface); - } - - @Override - public Statement createStatement() throws SQLException { - return cc.createStatement(); - } - - @Override - public PreparedStatement prepareStatement(String sql) throws SQLException { - return cc.prepareStatement(sql); - } - - @Override - public CallableStatement prepareCall(String sql) throws SQLException { - return cc.prepareCall(sql); - } - - @Override - public String nativeSQL(String sql) throws SQLException { - return cc.nativeSQL(sql); - } - - @Override - public void setAutoCommit(boolean autoCommit) throws SQLException { - cc.setAutoCommit(autoCommit); - } - - @Override - public boolean getAutoCommit() throws SQLException { - return cc.getAutoCommit(); - } - - @Override - public void commit() throws SQLException { - cc.commit(); - } - - @Override - public void rollback() throws SQLException { - cc.rollback(); - } - - @Override - public void close() throws SQLException { - } - - @Override - public boolean isClosed() throws SQLException { - return cc.isClosed(); - } - - @Override - public DatabaseMetaData getMetaData() throws SQLException { - return cc.getMetaData(); - } - - @Override - public void setReadOnly(boolean readOnly) throws SQLException { - cc.setReadOnly(readOnly); - } - - @Override - public boolean isReadOnly() throws SQLException { - return cc.isReadOnly(); - } - - @Override - public void setCatalog(String catalog) throws SQLException { - cc.setCatalog(catalog); - } - - @Override - public String getCatalog() throws SQLException { - return cc.getCatalog(); - } - - @Override - public void setTransactionIsolation(int level) throws SQLException { - cc.setTransactionIsolation(level); - } - - @Override - public int getTransactionIsolation() throws SQLException { - return cc.getTransactionIsolation(); - } - - @Override - public SQLWarning getWarnings() throws SQLException { - return cc.getWarnings(); - } - - @Override - public void clearWarnings() throws SQLException { - cc.clearWarnings(); - } - - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - return cc.createStatement(resultSetType, resultSetConcurrency); - } - - @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) - throws SQLException { - return cc.prepareStatement(sql, resultSetType, resultSetConcurrency); - } - - @Override - public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { - return cc.prepareCall(sql, resultSetType, resultSetConcurrency); - } - - @Override - public Map> getTypeMap() throws SQLException { - return cc.getTypeMap(); - } - - @Override - public void setTypeMap(Map> map) throws SQLException { - cc.setTypeMap(map); - } - - @Override - public void setHoldability(int holdability) throws SQLException { - cc.setHoldability(holdability); - } - - @Override - public int getHoldability() throws SQLException { - return cc.getHoldability(); - } - - @Override - public Savepoint setSavepoint() throws SQLException { - return cc.setSavepoint(); - } - - @Override - public Savepoint setSavepoint(String name) throws SQLException { - return cc.setSavepoint(name); - } - - @Override - public void rollback(Savepoint savepoint) throws SQLException { - cc.rollback(savepoint); - } - - @Override - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - cc.releaseSavepoint(savepoint); - } - - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return cc.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); - } - - @Override - public PreparedStatement prepareStatement( - String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - return cc.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - @Override - public CallableStatement prepareCall( - String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - return cc.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); - } - - @Override - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { - return cc.prepareStatement(sql, autoGeneratedKeys); - } - - @Override - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { - return cc.prepareStatement(sql, columnIndexes); - } - - @Override - public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { - return cc.prepareStatement(sql, columnNames); - } - - @Override - public Clob createClob() throws SQLException { - return cc.createClob(); - } - - @Override - public Blob createBlob() throws SQLException { - return cc.createBlob(); - } - - @Override - public NClob createNClob() throws SQLException { - return cc.createNClob(); - } - - @Override - public SQLXML createSQLXML() throws SQLException { - return cc.createSQLXML(); - } - - @Override - public boolean isValid(int timeout) throws SQLException { - return cc.isValid(timeout); - } - - @Override - public void setClientInfo(String name, String value) throws SQLClientInfoException { - cc.setClientInfo(name, value); - } - - @Override - public void setClientInfo(Properties properties) throws SQLClientInfoException { - cc.setClientInfo(properties); - } - - @Override - public String getClientInfo(String name) throws SQLException { - return cc.getClientInfo(name); - } - - @Override - public Properties getClientInfo() throws SQLException { - return cc.getClientInfo(); - } - - @Override - public Array createArrayOf(String typeName, Object[] elements) throws SQLException { - return cc.createArrayOf(typeName, elements); - } - - @Override - public Struct createStruct(String typeName, Object[] attributes) throws SQLException { - return cc.createStruct(typeName, attributes); - } - - @Override - public void setSchema(String schema) throws SQLException { - cc.setSchema(schema); - } - - @Override - public String getSchema() throws SQLException { - return cc.getSchema(); - } - - @Override - public void abort(Executor executor) throws SQLException { - cc.abort(executor); - } - - @Override - public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { - cc.setNetworkTimeout(executor, milliseconds); - } - - @Override - public int getNetworkTimeout() throws SQLException { - return cc.getNetworkTimeout(); - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java deleted file mode 100644 index d2ecea5..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.db; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; - -import javax.sql.DataSource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataSourceWrap implements DataSource { - - private static final Logger log = LoggerFactory.getLogger(DataSourceWrap.class); - - private DataSource dataSource; - - @Override - public PrintWriter getLogWriter() throws SQLException { - return dataSource.getLogWriter(); - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - dataSource.setLogWriter(out); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - dataSource.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return dataSource.getLoginTimeout(); - } - - @Override - public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { - return dataSource.getParentLogger(); - } - - @Override - public T unwrap(Class iface) throws SQLException { - return dataSource.unwrap(iface); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return dataSource.isWrapperFor(iface); - } - - @Override - public Connection getConnection() throws SQLException { - Connection c = dataSource.getConnection(); - - log.debug("getConnection: " + c.getClass().getName()); - - c.setAutoCommit(true); - return c; - } - - @Override - public Connection getConnection(String username, String password) throws SQLException { - Connection c = dataSource.getConnection(username, password); - - log.debug("getConnection: " + c.getClass().getName()); - - c.setAutoCommit(true); - return c; - } - - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java deleted file mode 100644 index dfb7d87..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java +++ /dev/null @@ -1,207 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.expr; - -import java.util.Map; - -public class ExpressionEvaluator { - - public static long evalLong(String expr, Map vars) { - return (long) evalFloat(expr, vars); - } - - public static float evalFloat(String expr, Map vars) { - expr = expr.trim(); - int sl = expr.length(); - if (sl == 0) - throw new IllegalArgumentException("Cannot interpret empty string."); - - // Remove parentheses if any - if (expr.charAt(0) == '(' && expr.charAt(sl - 1) == ')') - return evalFloat(expr.substring(1, sl - 1), vars); - - // Look for operators in the order of least priority - String[] sss = findOperator(expr, "-", true); - if (sss != null) - return evalFloat(sss[0], vars) - evalFloat(sss[1], vars); - - sss = findOperator(expr, "+", true); - if (sss != null) - return evalFloat(sss[0], vars) + evalFloat(sss[1], vars); - - sss = findOperator(expr, "/", true); - if (sss != null) - return evalFloat(sss[0], vars) / evalFloat(sss[1], vars); - - sss = findOperator(expr, "*", true); - if (sss != null) - return evalFloat(sss[0], vars) * evalFloat(sss[1], vars); - - // Check if expr is a number - try { - return Float.valueOf(expr); - } catch (Exception e) { - } - - // Must be a variable - Object v = vars.get(expr); - if (v != null) { - if (v instanceof Float) - return (Float) v; - if (v instanceof Long) - return (Long) v; - if (v instanceof Integer) - return (Integer) v; - } - return 0; - } - - public static boolean evalBoolean(String expr, Map vars) { - expr = expr.trim(); - int sl = expr.length(); - if (sl == 0) - throw new IllegalArgumentException("Cannot interpret empty string."); - - if (expr.equalsIgnoreCase("true")) - return true; - - if (expr.equalsIgnoreCase("false")) - return false; - - // Remove parentheses if any - if (expr.charAt(0) == '(' && expr.charAt(sl - 1) == ')') - return evalBoolean(expr.substring(1, sl - 1), vars); - - // Look for operators in the order of least priority - String[] sss = findOperator(expr, "or", true); - if (sss != null) - return evalBoolean(sss[0], vars) || evalBoolean(sss[1], vars); - - sss = findOperator(expr, "and", true); - if (sss != null) - return evalBoolean(sss[0], vars) && evalBoolean(sss[1], vars); - - sss = findOperator(expr, "not", true); - if (sss != null) - return !evalBoolean(sss[1], vars); - - sss = findOperator(expr, "!=", false); - if (sss == null) - sss = findOperator(expr, "<>", false); - if (sss != null) - return evalLong(sss[0], vars) != evalLong(sss[1], vars); - - sss = findOperator(expr, "==", false); - if (sss == null) - sss = findOperator(expr, "=", false); - if (sss != null) - return evalLong(sss[0], vars) == evalLong(sss[1], vars); - - sss = findOperator(expr, ">=", false); - if (sss != null) - return evalLong(sss[0], vars) >= evalLong(sss[1], vars); - - sss = findOperator(expr, ">", false); - if (sss != null) - return evalLong(sss[0], vars) > evalLong(sss[1], vars); - - sss = findOperator(expr, "<=", false); - if (sss != null) - return evalLong(sss[0], vars) <= evalLong(sss[1], vars); - - sss = findOperator(expr, "<", false); - if (sss != null) - return evalLong(sss[0], vars) < evalLong(sss[1], vars); - - throw new IllegalArgumentException("Cannot interpret '" + expr + "': Invalid expression."); - } - - private static String[] findOperator(String s, String op, boolean delimiterRequired) { - int opl = op.length(); - int sl = s.length(); - String delimiters = " \0\t\r\n()"; - int pcount = 0, qcount = 0; - for (int i = 0; i < sl; i++) { - char c = s.charAt(i); - if (c == '(' && qcount == 0) - pcount++; - else if (c == ')' && qcount == 0) { - pcount--; - if (pcount < 0) - throw new IllegalArgumentException("Cannot interpret '" + s + "': Parentheses do not match."); - } else if (c == '\'') - qcount = (qcount + 1) % 2; - else if (i <= sl - opl && pcount == 0 && qcount == 0) { - String ss = s.substring(i, i + opl); - if (ss.equalsIgnoreCase(op)) { - boolean found = true; - if (delimiterRequired) { - // Check for delimiter before and after to make sure it is not part of another word - char chbefore = '\0'; - if (i > 0) - chbefore = s.charAt(i - 1); - char chafter = '\0'; - if (i < sl - opl) - chafter = s.charAt(i + opl); - found = delimiters.indexOf(chbefore) >= 0 && delimiters.indexOf(chafter) >= 0; - } - if (found) { - // We've found the operator, split the string - String[] sss = new String[2]; - sss[0] = s.substring(0, i); - sss[1] = s.substring(i + opl); - return sss; - } - } - } - } - if (pcount > 0) - throw new IllegalArgumentException("Cannot interpret '" + s + "': Parentheses do not match."); - if (qcount > 0) - throw new IllegalArgumentException("Cannot interpret '" + s + "': No closing '."); - return null; - } - - private static Object parseObject(String s) { - s = s.trim(); - int sl = s.length(); - if (sl == 0) - throw new IllegalArgumentException("Cannot interpret empty string."); - if (s.equalsIgnoreCase("null")) - return null; - if (s.charAt(0) == '\'') { - if (sl < 2 || s.charAt(sl - 1) != '\'') - throw new IllegalArgumentException("Cannot interpret '" + s + "': No closing '."); - return s.substring(1, sl - 1); - } - // Not in quotes - must be a number - try { - return Long.valueOf(s); - } catch (Exception e) { - } - try { - return Double.valueOf(s); - } catch (Exception e) { - throw new IllegalArgumentException("Cannot interpret '" + s + "': Invalid number."); - } - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java deleted file mode 100644 index 8f15288..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.speed; - -public class SpeedUtil { - - private long unitFactor = 1000; - - public long convertToKbps(long maxSpeed, String unit) { - if (unit.equalsIgnoreCase("kbps")) - return maxSpeed; - if (unit.equalsIgnoreCase("Mbps")) - return maxSpeed * unitFactor; - if (unit.equalsIgnoreCase("Gbps")) - return maxSpeed * unitFactor * unitFactor; - return 0; - } - - public void setUnitFactor(long unitFactor) { - this.unitFactor = unitFactor; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java deleted file mode 100644 index 783289a..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java +++ /dev/null @@ -1,305 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.str; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StrUtil { - - private static final Logger log = LoggerFactory.getLogger(StrUtil.class); - - public static final String INDENT_STR = " "; - - public static void indent(StringBuilder ss, int ind) { - for (int i = 0; i < ind; i++) - ss.append(INDENT_STR); - } - - public static void info(Logger log, Object o) { - if (log.isInfoEnabled()) { - StringBuilder ss = new StringBuilder(); - struct(ss, o); - log.info(ss.toString()); - } - } - - public static void debug(Logger log, Object o) { - if (log.isDebugEnabled()) { - StringBuilder ss = new StringBuilder(); - struct(ss, o); - log.debug(ss.toString()); - } - } - - public static void struct(StringBuilder ss, Object o) { - struct(ss, o, 0); - } - - public static void struct(StringBuilder ss, Object o, int ind) { - if (o == null) { - ss.append("null"); - return; - } - - if (isSimple(o)) { - ss.append(o); - return; - } - - Class cls = o.getClass(); - - if (cls.isEnum()) { - ss.append(o); - return; - } - - if (cls.isArray()) { - int n = Array.getLength(o); - if (n == 0) { - ss.append("[]"); - return; - } - - Object o1 = Array.get(o, 0); - if (isSimple(o1)) { - ss.append('[').append(o1); - for (int i = 1; i < n; i++) { - o1 = Array.get(o, i); - ss.append(", ").append(o1); - } - ss.append(']'); - return; - } - - ss.append('\n'); - indent(ss, ind + 1); - ss.append('['); - struct(ss, o1, ind + 1); - for (int i = 1; i < n; i++) { - o1 = Array.get(o, i); - struct(ss, o1, ind + 1); - } - ss.append('\n'); - indent(ss, ind + 1); - ss.append(']'); - return; - } - - if (o instanceof Collection) { - Collection ll = (Collection) o; - - int n = ll.size(); - if (n == 0) { - ss.append("[]"); - return; - } - - Iterator ii = ll.iterator(); - Object o1 = ii.next(); - if (isSimple(o1)) { - ss.append('[').append(o1); - while (ii.hasNext()) { - o1 = ii.next(); - ss.append(", ").append(o1); - } - ss.append(']'); - return; - } - - ss.append('\n'); - indent(ss, ind + 1); - ss.append('['); - struct(ss, o1, ind + 1); - while (ii.hasNext()) { - o1 = ii.next(); - struct(ss, o1, ind + 1); - } - ss.append('\n'); - indent(ss, ind + 1); - ss.append(']'); - return; - - } - - if (o instanceof Map) { - Map mm = (Map) o; - - int n = mm.size(); - if (n == 0) { - ss.append("{}"); - return; - } - - ss.append('{'); - - for (Object k : mm.keySet()) { - ss.append('\n'); - indent(ss, ind + 1); - ss.append(k).append(": "); - - Object o1 = mm.get(k); - struct(ss, o1, ind + 2); - } - - ss.append('\n'); - indent(ss, ind); - ss.append('}'); - - return; - } - - Field[] fields = cls.getFields(); - - if (fields.length == 0) { - ss.append(o); - return; - } - - ss.append('\n'); - indent(ss, ind + 1); - ss.append('<').append(cls.getSimpleName()).append("> {"); - for (Field f : fields) { - ss.append('\n'); - indent(ss, ind + 2); - ss.append(f.getName()).append(": "); - Object v = null; - try { - v = f.get(o); - } catch (IllegalAccessException e) { - v = "*** Cannot obtain value *** : " + e.getMessage(); - } - struct(ss, v, ind + 2); - } - ss.append('\n'); - indent(ss, ind + 1); - ss.append('}'); - } - - public static SortedSet listInt(String ss, String warning) { - if (ss == null || ss.length() == 0) - return null; - - SortedSet ll = new TreeSet(); - String[] str = ss.split(","); - for (String s : str) { - try { - int i1 = s.indexOf('-'); - int start, end; - if (i1 > 0) { - String s1 = s.substring(0, i1); - String s2 = s.substring(i1 + 1); - start = Integer.parseInt(s1); - end = Integer.parseInt(s2); - } else - start = end = Integer.parseInt(s); - for (int i = start; i <= end; i++) - ll.add(i); - } catch (NumberFormatException e) { - // Skip this - bad data in DB - log.warn(warning + " [" + s + "].", e); - } - } - return ll; - } - - public static String listInt(SortedSet ll) { - if (ll == null || ll.size() == 0) - return null; - - StringBuilder sb = new StringBuilder(2000); - Iterator i = ll.iterator(); - int n = i.next(); - int start = n; - int end = n; - boolean first = true; - while (i.hasNext()) { - n = i.next(); - if (n != end + 1) { - if (!first) - sb.append(','); - first = false; - - if (start == end) - sb.append(start); - else if (start == end - 1) - sb.append(start).append(',').append(end); - else - sb.append(start).append('-').append(end); - - start = n; - } - end = n; - } - - if (!first) - sb.append(','); - - if (start == end) - sb.append(start); - else if (start == end - 1) - sb.append(start).append(',').append(end); - else - sb.append(start).append('-').append(end); - - return sb.toString(); - } - - public static List listStr(String s) { - if (s == null || s.length() == 0) - return null; - String[] ss = s.split(","); - return Arrays.asList(ss); - } - - public static String listStr(Collection ll) { - if (ll == null || ll.isEmpty()) - return null; - StringBuilder ss = new StringBuilder(1000); - Iterator i = ll.iterator(); - ss.append(i.next()); - while (i.hasNext()) - ss.append(',').append(i.next()); - return ss.toString(); - } - - private static boolean isSimple(Object o) { - if (o == null) - return true; - - if (o instanceof Number || o instanceof String || o instanceof Boolean || o instanceof Date) - return true; - - return false; - } -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java deleted file mode 100644 index 57e8005..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.vrf; - -public class VpnParam { - - public String vpnId; - public String siteType; - public String spokeServiceInstanceId; - public String routeGroupName; -} diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java deleted file mode 100644 index a04b3ff..0000000 --- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.util.vrf; - -public class VrfUtil { - - public static String createVrfInstanceName( - String serviceInstanceId, - String vpnId, - String siteType, - String routeGroup) { - if (vpnId == null || vpnId.trim().length() == 0) - return null; - - String ss = "VPN-" + vpnId; - if (siteType != null && siteType.equalsIgnoreCase("hub")) - ss += "-HUB"; - if (siteType != null && siteType.equalsIgnoreCase("spoke")) - ss += "-SP-" + serviceInstanceId; - if (routeGroup != null && routeGroup.trim().length() > 0) - ss += "-RG-" + routeGroup; - - return ss; - } - - public static VpnParam parseVrfInstanceName(String vrfInstanceName) { - VpnParam vpnParam = new VpnParam(); - - int i1 = vrfInstanceName.indexOf("-HUB"); - if (i1 > 0) - vpnParam.siteType = "HUB"; - - int i2 = vrfInstanceName.indexOf("-SP-"); - if (i2 > 0) - vpnParam.siteType = "SPOKE"; - - int i3 = vrfInstanceName.indexOf("-RG-"); - if (i3 > 0) - vpnParam.routeGroupName = vrfInstanceName.substring(i3 + 4); - - int i4 = vrfInstanceName.length(); - if (i1 > 0) - i4 = i1; - else if (i2 > 0) - i4 = i2; - else if (i3 > 0) - i4 = i3; - vpnParam.vpnId = vrfInstanceName.substring(4, i4); - - if (i2 > 0 && i3 < 0) - vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4); - if (i2 > 0 && i3 > 0) - vpnParam.spokeServiceInstanceId = vrfInstanceName.substring(i2 + 4, i3); - - return vpnParam; - } -} diff --git a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml b/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml deleted file mode 100644 index 487b782..0000000 --- a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml b/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml deleted file mode 100644 index 70b7aa8..0000000 --- a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - javax.sql.DataSource - org.openecomp.sdnc.sli.resource.dblib.DbLibService - - - - - - diff --git a/resource-assignment/provider/src/main/resources/resource-allocator.properties b/resource-assignment/provider/src/main/resources/resource-allocator.properties deleted file mode 100644 index 3821a0a..0000000 --- a/resource-assignment/provider/src/main/resources/resource-allocator.properties +++ /dev/null @@ -1,26 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -org.openecomp.sdnc.sli.dbtype = jdbc -org.openecomp.sdnc.sli.jdbc.url = jdbc:mysql://dbhost:3306/sdnctl -org.openecomp.sdnc.sli.jdbc.database = sdnctl -org.openecomp.sdnc.sli.jdbc.user = sdnctl -org.openecomp.sdnc.sli.jdbc.password = gamma diff --git a/resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql b/resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql deleted file mode 100644 index a57878d..0000000 --- a/resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql +++ /dev/null @@ -1,32 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -CREATE TABLE resource_rule ( - resource_rule_id SERIAL PRIMARY KEY, - resource_name VARCHAR(50) NOT NULL, - end_point_position VARCHAR(50) NOT NULL, - service_expression VARCHAR(2000) NOT NULL, - equipment_level VARCHAR(50) NOT NULL, - equipment_expression VARCHAR(2000) NOT NULL, - allocation_expression VARCHAR(2000) NOT NULL, - soft_limit_expression VARCHAR(2000) NOT NULL, - hard_limit_expression VARCHAR(2000) NOT NULL -); diff --git a/resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql b/resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql deleted file mode 100644 index ea6a45e..0000000 --- a/resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql +++ /dev/null @@ -1,29 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -CREATE TABLE max_port_speed ( - max_port_speed_id SERIAL PRIMARY KEY, - image_file_name VARCHAR(50) NOT NULL, - end_point_position VARCHAR(50) NOT NULL, - interface_name VARCHAR(100) NOT NULL, - max_speed BIGINT NOT NULL, - unit VARCHAR(10) NOT NULL -); diff --git a/resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql b/resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql deleted file mode 100644 index 4e99fc4..0000000 --- a/resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql +++ /dev/null @@ -1,28 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -CREATE TABLE max_server_speed ( - max_server_speed_id SERIAL PRIMARY KEY, - server_model VARCHAR(50) NOT NULL, - evc_count SMALLINT NOT NULL, - max_speed BIGINT NOT NULL, - unit VARCHAR(10) NOT NULL -); diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java deleted file mode 100644 index 25109a2..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import java.util.Date; - -import jtest.util.org.openecomp.sdnc.ra.TestDb; -import jtest.util.org.openecomp.sdnc.ra.TestTable; - -public class DataSetup { - - private TestDb testDb; - - private TestTable vpePool = null; - private TestTable vplspePool = null; - private TestTable pserver = null; - private TestTable serviceResource = null; - private TestTable resource = null; - private TestTable allocationItem = null; - - private static final String[] VPE_POOL_COLUMNS = { - "vpe_name", "ipv4_oam_address", "loopback0_ipv4_address", "provisioning_status", "aic_site_id", - "availability_zone", "vlan_id_outer", "vendor", "physical_intf_name", "physical_intf_speed", - "physical_intf_units", "vpe_uuid", "vpe_id", "image_filename" }; - - private static final String[] VPLSPE_POOL_COLUMNS = { - "vplspe_name", "aic_site_id", "availability_zone", "physical_intf_name", "physical_intf_speed", - "physical_intf_units", "loopback0_ipv4_address", "vlan_id_outer", "vplspe_uuid", "image_filename", - "provisioning_status", "vendor" }; - - private static final String[] PSERVER_COLUMNS = { - "hostname", "ptnii_equip_name", "number_of_cpus", "disk_in_gigabytes", "ram_in_megabytes", "equip_type", - "equip_vendor", "equip_model", "fqdn", "pserver_selflink", "ipv4_oam_address", "serial_number", - "pserver_id", "internet_topology", "aic_site_id", "in_maint", "pserver_name2", "purpose" }; - - private static final String[] SERVICE_RESOURCE_COLUMNS = { - "service_instance_id", "service_status", "service_change_number", "resource_set_id", "resource_union_id" }; - - private static final String[] RESOURCE_COLUMNS = { "asset_id", "resource_name", "resource_type", "lt_used" }; - - private static final String[] ALLOCATION_ITEM_COLUMNS = { - "resource_id", "application_id", "resource_set_id", "resource_union_id", "resource_share_group_list", - "lt_used", "allocation_time" }; - - private void initTables() { - if (vpePool == null) - vpePool = testDb.table("VPE_POOL", "vpe_name", VPE_POOL_COLUMNS); - if (vplspePool == null) - vplspePool = testDb.table("VPLSPE_POOL", "vplspe_name", VPLSPE_POOL_COLUMNS); - if (pserver == null) - pserver = testDb.table("PSERVER", "hostname", PSERVER_COLUMNS); - if (serviceResource == null) - serviceResource = testDb.table("SERVICE_RESOURCE", "service_resource_id", SERVICE_RESOURCE_COLUMNS); - if (resource == null) - resource = testDb.table("RESOURCE", "resource_id", RESOURCE_COLUMNS); - if (allocationItem == null) - allocationItem = testDb.table("ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - } - - public void cleanup() { - initTables(); - vpePool.delete("true"); - vplspePool.delete("true"); - pserver.delete("true"); - serviceResource.delete("true"); - allocationItem.delete("true"); - resource.delete("true"); - } - - public void setupVpePort( - String aicSiteId, - String vpeId, - String interfaceName, - String provStatus, - String imageFileName) { - initTables(); - vpePool.add(vpeId, "127.0.0.1", "107.134.152.139", provStatus, aicSiteId, "mtanj-esx-az01", "3501", - "JUNIPER", interfaceName, "1", "GBPS", "vpe002", "VPESAT-auttx200me6", imageFileName); - } - - public void setupVplspePort( - String aicSiteId, - String vplspeId, - String interfaceName, - String provStatus, - String imageFileName) { - initTables(); - vplspePool.add(vplspeId, aicSiteId, "mtanj-esx-az01", interfaceName, "100", "GBPS", "192.168.119.32", "3501", - "vpls002", imageFileName, provStatus, "JUNIPER"); - } - - public void setupPserver(String hostname, String aicSiteId) { - initTables(); - pserver.add(hostname, hostname + "srv1", 4, 1000, 16000, "equip_type", "equip_vendor", "equip_model", "fqdn", - "pserver_selflink", "123.123.123.123", "serial_number", "pserver_id", "internet_topology", aicSiteId, - "N", hostname, "purpose"); - } - - public void setupService( - String serviceInstanceId, - String status, - int changeNumber, - long speedKbps, - String vpeId, - String vplspeId, - String serverId) { - initTables(); - - String resourceSetId = serviceInstanceId + "/" + changeNumber; - String resourceUnionId = serviceInstanceId; - - serviceResource.add(serviceInstanceId, status, changeNumber, resourceSetId, resourceUnionId); - - Long rid = resource.getId("asset_id = '" + vpeId + "/ae0' AND resource_name = 'Bandwidth'"); - if (rid == null) { - resource.add(vpeId + "/ae0", "Bandwidth", "Limit", 1); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, speedKbps, new Date()); - - rid = resource.getId("asset_id = '" + vplspeId + "' AND resource_name = 'Bandwidth'"); - if (rid == null) { - resource.add(vplspeId, "Bandwidth", "Limit", 1); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, speedKbps, new Date()); - - rid = resource.getId("asset_id = '" + serverId + "' AND resource_name = 'Bandwidth'"); - if (rid == null) { - resource.add(serverId, "Bandwidth", "Limit", 1); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, speedKbps, new Date()); - - rid = resource.getId("asset_id = '" + serverId + "' AND resource_name = 'Connection'"); - if (rid == null) { - resource.add(serverId, "Connection", "Limit", 1); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, 1, new Date()); - } - - public boolean serviceNotInDb(String serviceInstanceId, String status, Integer changeNumber) { - String where = "service_instance_id = '" + serviceInstanceId + "'"; - if (status != null) - where += " AND service_status = '" + status + "'"; - if (changeNumber != null) - where += " AND service_change_number = " + changeNumber; - - if (serviceResource.exists(where)) - return false; - - where = "resource_union_id = '" + serviceInstanceId + "'"; - if (changeNumber != null) - where += " AND resource_set_id = '" + serviceInstanceId + "/" + changeNumber + "'"; - - if (allocationItem.exists(where)) - return false; - - return true; - } - - public boolean serviceCorrectInDb(String serviceInstanceId, String status, int changeNumber, long speedKbps) { - String where = "service_instance_id = '" + serviceInstanceId + "' AND service_status = '" + status + - "' AND service_change_number = " + changeNumber; - if (!serviceResource.exists(where)) - return false; - - where = "resource_union_id = '" + serviceInstanceId + "' AND resource_set_id = '" + serviceInstanceId + "/" + - changeNumber + "' AND lt_used = " + speedKbps; - if (!allocationItem.exists(where)) - return false; - - return true; - } - - public boolean serviceCorrectInDb( - String vpeId, - String aicSiteId, - String serviceInstanceId, - String status, - int changeNumber, - long speedKbps) { - - String where = "service_instance_id = '" + serviceInstanceId + "' AND service_status = '" + status + - "' AND service_change_number = " + changeNumber; - if (!serviceResource.exists(where)) - return false; - - Long vpebwrid = resource.getId("asset_id = '" + vpeId + "/ae0' AND resource_name = 'Bandwidth'"); - if (vpebwrid == null) - return false; - - where = "resource_id = " + vpebwrid + " AND resource_union_id = '" + serviceInstanceId + - "' AND resource_set_id = '" + serviceInstanceId + "/" + changeNumber + "' AND lt_used = " + speedKbps; - if (!allocationItem.exists(where)) - return false; - - Long srvbwrid = resource.getId("asset_id = '" + aicSiteId + "/Server1' AND resource_name = 'Bandwidth'"); - if (srvbwrid == null) - return false; - - where = "resource_id = " + srvbwrid + " AND resource_union_id = '" + serviceInstanceId + - "' AND resource_set_id = '" + serviceInstanceId + "/" + changeNumber + "' AND lt_used = " + speedKbps; - if (!allocationItem.exists(where)) - return false; - - Long srvconrid = resource.getId("asset_id = '" + aicSiteId + "/Server1' AND resource_name = 'Connection'"); - if (srvconrid == null) - return false; - - where = "resource_id = " + srvconrid + " AND resource_union_id = '" + serviceInstanceId + - "' AND resource_set_id = '" + serviceInstanceId + "/" + changeNumber + "' AND lt_used = 1"; - if (!allocationItem.exists(where)) - return false; - - return true; - } - - public boolean serviceCorrectInDb( - String serviceInstanceId, - String endPointPosition, - String status, - int changeNumber, - long speedKbps) { - String where = "service_instance_id = '" + serviceInstanceId + "' AND service_status = '" + status + - "' AND service_change_number = " + changeNumber; - if (!serviceResource.exists(where)) - return false; - - where = "resource_union_id = '" + serviceInstanceId + "/" + endPointPosition + "' AND resource_set_id = '" + - serviceInstanceId + "/" + endPointPosition + "/" + changeNumber + "' AND lt_used = " + speedKbps; - if (!allocationItem.exists(where)) - return false; - - return true; - } - - public void setTestDb(TestDb testDb) { - this.testDb = testDb; - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java deleted file mode 100644 index 2c8fe84..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java +++ /dev/null @@ -1,424 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.openecomp.sdnc.ra.ResourceAllocator; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestIsAvailable { - - private static final Logger log = LoggerFactory.getLogger(TestIsAvailable.class); - - @Autowired(required = true) - private ResourceAllocator resourceAllocator; - - @Autowired(required = true) - private DataSetup dataSetup; - - @Test - public void test001() throws Exception { - String t = "001"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test successful response - all resources available"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test002() throws Exception { - String t = "002"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - request very big number that is above the limits"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("960000")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test003() throws Exception { - String t = "003"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - PROV check for VPE"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "---", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("0")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test004() throws Exception { - String t = "004"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - PROV check for VPLSPE"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "---", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("0")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test005() throws Exception { - String t = "005"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - VPE not found in DB"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("0")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test006() throws Exception { - String t = "006"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - VPLSPE not found in DB"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("0")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test007() throws Exception { - String t = "007"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - test max available speed calculation"); - - String service1 = "isAvailable" + t + "/service1"; - String existingService1 = "isAvailable" + t + "/existing-service1"; - String existingService2 = "isAvailable" + t + "/existing-service2"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv127", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(existingService1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", - "MTSNJA4LCP1/Server1"); - dataSetup.setupService(existingService2, "Active", 3, 100000, "mtanjrsv127", "mtsnj303vr1", - "MTSNJA4LCP1/Server1"); - dataSetup.setupService(existingService2, "Pending", 4, 500000, "mtanjrsv127", "mtsnj303vr1", - "MTSNJA4LCP1/Server1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("260000")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test008() throws Exception { - String t = "008"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test capacity not found - test server limit depending on number of connections"); - - String service1 = "isAvailable" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv127", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - for (int i = 1; i <= 13; i++) - dataSetup.setupService("isAvailable" + t + "/existing-service" + i, "Active", 2, 20000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - String maxAvailableSpeed = ctx.getAttribute("tmp.resource-allocator-output.max-available-speed"); - String speedUnit = ctx.getAttribute("tmp.resource-allocator-output.speed-unit"); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + maxAvailableSpeed); - log.info(" tmp.resource-allocator-output.speed-unit: " + speedUnit); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(maxAvailableSpeed.equals("340000")); - Assert.assertTrue(speedUnit.equals("kbps")); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test009() throws Exception { - String t = "009"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test successful response - no service instance id in input - all resources available"); - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - } - - @Test - public void test010() throws Exception { - String t = "010"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test input validations - no aic-site-id in input"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - - try { - resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "tmp.resource-allocator.aic-site-id is required in ResourceAllocator")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test011() throws Exception { - String t = "011"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test input validations - no speed in input"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - try { - resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals("tmp.resource-allocator.speed is required in ResourceAllocator")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test012() throws Exception { - String t = "012"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test input validations - speed not a number in input"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.speed", "nnnnn"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - try { - resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals("Invalid tmp.resource-allocator.speed. Must be a number.")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test013() throws Exception { - String t = "013"; - log.info("============== isAvailable " + t + " ================================"); - log.info("=== Test input validations - speed-unit missing in input"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - try { - resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "tmp.resource-allocator.speed-unit is required in ResourceAllocator")); - return; - } - Assert.fail("SvcLogicException expected"); - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java deleted file mode 100644 index 78438a7..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.openecomp.sdnc.ra.ResourceAllocator; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestQuery { - - private static final Logger log = LoggerFactory.getLogger(TestQuery.class); - - @Autowired(required = true) - private ResourceAllocator resourceAllocator; - - @Autowired(required = true) - private DataSetup dataSetup; - - @Test - public void test001() throws Exception { - String t = "001"; - log.info("============== query " + t + " ================================"); - log.info("=== Test reading assigned resources (subinterface-id, vlan-id-inner)"); - - String service1 = "ICOREPVC" + t + "-1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-model", "L3AVPN-EVC"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - ctx.setAttribute("tmp.resource-allocator.vpn-id", "123"); - ctx.setAttribute("tmp.resource-allocator.vrf-required", "false"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "VPE-Cust", "Pending", 1, 300000)); - - st = resourceAllocator.query("NetworkCapacity", true, null, service1, "end-point", null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertEquals(ctx.getAttribute("end-point.subinterface-id"), "100"); - Assert.assertEquals(ctx.getAttribute("end-point.vlan-id-inner"), "2"); - Assert.assertEquals(ctx.getAttribute("end-point.vpe-name"), "mtanjrsv126"); - Assert.assertEquals(ctx.getAttribute("end-point.affinity-link"), "1"); - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java deleted file mode 100644 index 329d65e..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java +++ /dev/null @@ -1,430 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.openecomp.sdnc.ra.ResourceAllocator; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestRelease { - - private static final Logger log = LoggerFactory.getLogger(TestRelease.class); - - @Autowired(required = true) - private ResourceAllocator resourceAllocator; - - @Autowired(required = true) - private DataSetup dataSetup; - - @Test - public void test001() throws Exception { - String t = "001"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - cancel - new start"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Pending", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test002() throws Exception { - String t = "002"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - cancel - change"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 400000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 3, 400000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } - - @Test - public void test003() throws Exception { - String t = "003"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - cancel - active there, but no pending - should do nothing and return success"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } - - @Test - public void test004() throws Exception { - String t = "004"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - cancel - nothing in DB - should return success"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test005() throws Exception { - String t = "005"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - activate - new start"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Pending", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Activate"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } - - @Test - public void test006() throws Exception { - String t = "006"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - actovate - change"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 400000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 3, 400000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Activate"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 3, 400000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 2)); - } - - @Test - public void test007() throws Exception { - String t = "007"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - activate - active there, but no pending - should do nothing and return success"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Activate"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } - - @Test - public void test008() throws Exception { - String t = "008"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - activate - nothing in DB - should return success"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Activate"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test009() throws Exception { - String t = "009"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - disconnect - only pending in DB"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Pending", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Disconnect"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test010() throws Exception { - String t = "010"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - disconnect - only active in DB"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Disconnect"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test011() throws Exception { - String t = "011"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - disconnect - both active and pending in DB"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 400000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Pending", 3, 400000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Disconnect"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test012() throws Exception { - String t = "012"; - log.info("============== release " + t + " ================================"); - log.info("=== Test release - disconnect - nothing in DB - should return success"); - - String service1 = "release" + t + "/service1"; - - dataSetup.cleanup(); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Disconnect"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test013() throws Exception { - String t = "013"; - log.info("============== release " + t + " ================================"); - log.info("=== Test input validations - request-type missing in input"); - - String service1 = "release" + t + "/service1"; - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - try { - resourceAllocator.release("NetworkCapacity", null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "tmp.resource-allocator.request-type is required in ResourceAllocator")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test014() throws Exception { - String t = "014"; - log.info("============== release " + t + " ================================"); - log.info("=== Test input validations - invalid request-type in input"); - - String service1 = "release" + t + "/service1"; - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "xxxxx"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - - try { - resourceAllocator.release("NetworkCapacity", null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "Invalid tmp.resource-allocator.request-type: xxxxx. Supported values are Cancel, Activate, Disconnect.")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test015() throws Exception { - String t = "015"; - log.info("============== release " + t + " ================================"); - log.info("=== Test input validations - missing service-instance-id in input"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - - try { - resourceAllocator.release("NetworkCapacity", null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "tmp.resource-allocator.service-instance-id is required in ResourceAllocator")); - return; - } - Assert.fail("SvcLogicException expected"); - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java deleted file mode 100644 index 6d464de..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java +++ /dev/null @@ -1,681 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.openecomp.sdnc.ra.ResourceAllocator; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestReserve { - - private static final Logger log = LoggerFactory.getLogger(TestReserve.class); - - @Autowired(required = true) - private ResourceAllocator resourceAllocator; - - @Autowired(required = true) - private DataSetup dataSetup; - - @Test - public void test001() throws Exception { - String t = "001"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupPserver("server1", "MTSNJA4LCP1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 1, 300000)); - } - - @Test - public void test002() throws Exception { - String t = "002"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start supp - all resources available"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Pending", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - // ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - Default is New - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "400"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 400000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 2)); - } - - @Test - public void test003() throws Exception { - String t = "003"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - change - all resources available"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "400"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 400000)); - } - - @Test - public void test004() throws Exception { - String t = "004"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - change supp - all resources available"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 400000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 400000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "500"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 4, 500000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } - - @Test - public void test005() throws Exception { - String t = "005"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - change - check that hard limits are applied, not soft for change"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "1200000"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "kbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 1200000)); - } - - @Test - public void test006() throws Exception { - String t = "006"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test capacity not found - new start"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Gbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test007() throws Exception { - String t = "007"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test capacity not found - new start supp"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Pending", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "2000"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 2, 200000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } - - @Test - public void test008() throws Exception { - String t = "008"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test capacity not found - change"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "2000"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } - - @Test - public void test009() throws Exception { - String t = "009"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test capacity not found - change supp"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupService(service1, "Active", 2, 200000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 400000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 400000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "2000"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 400000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 4)); - } - - @Test - public void test010() throws Exception { - String t = "010"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test border condition - connection limit - new start - adding connection " + - "when we are on the limit should fail"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - for (int i = 1; i <= 40; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - for (int i = 1; i <= 40; i += 4) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Pending", 3, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "1"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } - - @Test - public void test011() throws Exception { - String t = "011"; - log.info("============== reserve " + t + " ================================"); - log.info( - "=== Test border condition - connection limit - new start supp should succeed as no new connection being added"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - for (int i = 1; i <= 39; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - for (int i = 1; i <= 39; i += 4) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Pending", 3, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - dataSetup.setupService(service1, "Pending", 2, 1000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 2, 1000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "5"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 5000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 2)); - } - - @Test - public void test012() throws Exception { - String t = "012"; - log.info("============== reserve " + t + " ================================"); - log.info( - "=== Test border condition - connection limit - change should succeed as no new connection being added"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - for (int i = 1; i <= 39; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - for (int i = 1; i <= 39; i += 4) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Pending", 3, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - dataSetup.setupService(service1, "Active", 2, 1000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 1000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "5"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 1000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 5000)); - } - - @Test - public void test013() throws Exception { - String t = "013"; - log.info("============== reserve " + t + " ================================"); - log.info( - "=== Test border condition - connection limit - change supp should succeed as no new connection being added"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - for (int i = 1; i <= 39; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - for (int i = 1; i <= 39; i += 4) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Pending", 3, 1000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - dataSetup.setupService(service1, "Active", 2, 1000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 5000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 1000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 5000)); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Change"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "10"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 1000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 4, 10000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } - - @Test - public void test014() throws Exception { - String t = "014"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test input validations - invalid request-type in input"); - - String service1 = "reserve" + t + "/service1"; - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "xxxxx"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "10"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - try { - resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - } catch (SvcLogicException e) { - Assert.assertTrue(e.getMessage().equals( - "Invalid tmp.resource-allocator.request-type: xxxxx. Supported values are New, Change.")); - return; - } - Assert.fail("SvcLogicException expected"); - } - - @Test - public void test015() throws Exception { - String t = "015"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test server bw limit depends on number of servers - limit is 960Mbps for 1 server, 1920 for 2"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupPserver("server1", "MTSNJA4LCP1"); - dataSetup.setupPserver("server2", "MTSNJA4LCP1"); - dataSetup.setupPserver("server3", "MTSNJA4LCP1"); - dataSetup.setupPserver("server4", "MTSNJA4LCP1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "1200"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 1, 1200000)); - } - - @Test - public void test016() throws Exception { - String t = "016"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test resource threshold output"); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupPserver("server1", "MTSNJA4LCP1"); - dataSetup.setupPserver("server2", "MTSNJA4LCP1"); - dataSetup.setupPserver("server3", "MTSNJA4LCP1"); - dataSetup.setupPserver("server4", "MTSNJA4LCP1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "1605"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - for (String key : ctx.getAttributeKeySet()) - if (key.startsWith("tmp.resource-allocator-output")) - log.info(" " + key + ": " + ctx.getAttribute(key)); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 1, 1605000)); - } - - @Test - public void test017() throws Exception { - String t = "017"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test if evc_count lookup in MAX_SERVER_SPEED depends on the number of primary servers."); - log.info("=== For 10 existing EVC, it should take the first row, not the second (see data.sql)."); - log.info("=== Applied limit should be 1920Mbps, not 1680Mbps."); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupPserver("server1", "MTSNJA4LCP1"); - dataSetup.setupPserver("server2", "MTSNJA4LCP1"); - dataSetup.setupPserver("server3", "MTSNJA4LCP1"); - dataSetup.setupPserver("server4", "MTSNJA4LCP1"); - - for (int i = 1; i <= 10; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 100000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "800"); // 10*100Mbps existing + 800 = 1800 - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 1, 800000)); - } - - @Test - public void test018() throws Exception { - String t = "018"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test if evc_count lookup in MAX_SERVER_SPEED depends on the number of primary servers."); - log.info("=== For 11 existing EVC, it should take the second row (see data.sql)."); - log.info("=== Applied limit should be 1680Mbps. We have 11*100 + 700, so this should fail."); - - String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - dataSetup.setupVplspePort("MTSNJA4LCP1", "mtsnj303vr1", "xe-0/0/2", "PROV", null); - dataSetup.setupPserver("server1", "MTSNJA4LCP1"); - dataSetup.setupPserver("server2", "MTSNJA4LCP1"); - dataSetup.setupPserver("server3", "MTSNJA4LCP1"); - dataSetup.setupPserver("server4", "MTSNJA4LCP1"); - - for (int i = 1; i <= 11; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 100000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "700"); // 11*100Mbps existing + 700 = 1800 - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - log.info("Result: " + st); - log.info(" tmp.resource-allocator-output.max-available-speed: " + - ctx.getAttribute("tmp.resource-allocator-output.max-available-speed")); - log.info(" tmp.resource-allocator-output.speed-unit: " + - ctx.getAttribute("tmp.resource-allocator-output.speed-unit")); - - log.info("Result: " + st); - - Assert.assertTrue(st == QueryStatus.NOT_FOUND); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java deleted file mode 100644 index 0daf610..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.ra; - -import org.junit.Assert; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.openecomp.sdnc.ra.ResourceAllocator; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestReserve2 { - - private static final Logger log = LoggerFactory.getLogger(TestReserve2.class); - - @Autowired(required = true) - private ResourceAllocator resourceAllocator; - - @Autowired(required = true) - private DataSetup dataSetup; - - @Test - public void test001() throws Exception { - String t = "001"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - String service1 = "ICOREPVC" + t + "-1"; - - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "New"); - ctx.setAttribute("tmp.resource-allocator.service-model", "L3AVPN-EVC"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); - ctx.setAttribute("tmp.resource-allocator.speed", "300"); - ctx.setAttribute("tmp.resource-allocator.speed-unit", "Mbps"); - ctx.setAttribute("tmp.resource-allocator.aic-site-id", "MTSNJA4LCP1"); - ctx.setAttribute("tmp.resource-allocator.vpn-id", "123"); - ctx.setAttribute("tmp.resource-allocator.vrf-required", "false"); - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "VPE-Cust", "Pending", 1, 300000)); - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java deleted file mode 100644 index ea6ca3e..0000000 --- a/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.org.openecomp.sdnc.rm; - -import java.util.Date; - -import jtest.util.org.openecomp.sdnc.ra.TestDb; -import jtest.util.org.openecomp.sdnc.ra.TestTable; - -public class DataSetup { - - private TestDb testDb; - - private TestTable resource = null; - private TestTable allocationItem = null; - - private static final String[] RESOURCE_COLUMNS = - { "asset_id", "resource_name", "resource_type", "lt_used", "ll_label", "ll_reference_count", "rr_used" }; - - private static final String[] ALLOCATION_ITEM_COLUMNS = { - "resource_id", "application_id", "resource_set_id", "resource_union_id", "resource_share_group_list", - "lt_used", "ll_label", "rr_used", "allocation_time" }; - - private void initTables() { - if (resource == null) - resource = testDb.table("RESOURCE", "resource_id", RESOURCE_COLUMNS); - if (allocationItem == null) - allocationItem = testDb.table("ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - } - - public void cleanup() { - allocationItem.delete("true"); - resource.delete("true"); - } - - public void setupLimitItem( - String resourceName, - String assetId, - String resourceSetId, - String resourceUnionId, - long used) { - initTables(); - - Long rid = resource.getId("asset_id = '" + assetId + "' AND resource_name = '" + resourceName + "'"); - if (rid == null) { - resource.add(assetId, resourceName, "Limit", 1, null, null, null); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, used, null, null, new Date()); - } - - public void setupRangeItem( - String resourceName, - String assetId, - String resourceSetId, - String resourceUnionId, - String used) { - initTables(); - - Long rid = resource.getId("asset_id = '" + assetId + "' AND resource_name = '" + resourceName + "'"); - if (rid == null) { - resource.add(assetId, resourceName, "Range", null, null, null, used); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, null, null, used, new Date()); - } - - public void setupLabelItem( - String resourceName, - String assetId, - String resourceSetId, - String resourceUnionId, - String label) { - initTables(); - - Long rid = resource.getId("asset_id = '" + assetId + "' AND resource_name = '" + resourceName + "'"); - if (rid == null) { - resource.add(assetId, resourceName, "Label", null, label, 1, null); - rid = resource.getLastId(); - } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, null, label, null, new Date()); - } - - public void setTestDb(TestDb testDb) { - this.testDb = testDb; - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java b/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java deleted file mode 100644 index 91852e3..0000000 --- a/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.util.org.openecomp.sdnc.ra; - -import org.springframework.jdbc.core.JdbcTemplate; - -public class TestDb { - - private JdbcTemplate jdbcTemplate; - - public TestTable table(String tableName, String idName, String... columnList) { - return new TestTable(jdbcTemplate, tableName, idName, columnList); - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } -} diff --git a/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java b/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java deleted file mode 100644 index 7e8e05a..0000000 --- a/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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 jtest.util.org.openecomp.sdnc.ra; - -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.support.rowset.SqlRowSet; - -public class TestTable { - - private String tableName; - private String[] columnList; - private String idName; - - private String insertSql; - - private JdbcTemplate jdbcTemplate; - - public TestTable(JdbcTemplate jdbcTemplate, String tableName, String idName, String... columnList) { - this.jdbcTemplate = jdbcTemplate; - this.tableName = tableName; - this.idName = idName; - this.columnList = columnList; - createInsertSql(); - } - - private void createInsertSql() { - StringBuilder ss = new StringBuilder(); - ss.append("INSERT INTO ").append(tableName).append(" ("); - for (String s : columnList) - ss.append(s).append(", "); - ss.setLength(ss.length() - 2); - ss.append(") VALUES ("); - for (int i = 0; i < columnList.length; i++) - ss.append("?, "); - ss.setLength(ss.length() - 2); - ss.append(")"); - insertSql = ss.toString(); - } - - public void add(Object... values) { - jdbcTemplate.update(insertSql, values); - } - - public long getLastId() { - return jdbcTemplate.queryForObject("SELECT max(" + idName + ") FROM " + tableName, Long.class); - } - - public Long getId(String where) { - String selectSql = "SELECT " + idName + " FROM " + tableName + " WHERE " + where; - SqlRowSet rs = jdbcTemplate.queryForRowSet(selectSql); - if (rs.first()) - return rs.getLong(idName); - return null; - } - - public boolean exists(String where) { - String selectSql = "SELECT * FROM " + tableName + " WHERE " + where; - SqlRowSet rs = jdbcTemplate.queryForRowSet(selectSql); - return rs.first(); - } - - public void delete(String where) { - jdbcTemplate.update("DELETE FROM " + tableName + " WHERE " + where); - } -} diff --git a/resource-assignment/provider/src/test/resources/homing-req.json b/resource-assignment/provider/src/test/resources/homing-req.json deleted file mode 100644 index 48ec701..0000000 --- a/resource-assignment/provider/src/test/resources/homing-req.json +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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========================================================= - */ - -{ - "input":{ - "sdnc-homing-header":{ - "svc-request-id":"omx-123", - "svc-action":"homing" - }, - "request-information":{ - "request-id":"mso-1234", - "request-action":"GetAicNodesRequest", - "source":"OMX", - "list-length":1 - }, - "homing-request-information":{ - "service-type":"SDN-ETHERNET-INTERNET", - "global-customer-id":"custid-123", - "customer-location":{ - "lata":332 - } - }, - "homing-other-information":{ - "bandwidth-value":150, - "bandwidth-units":"Mbps" - } - } -} diff --git a/resource-assignment/provider/src/test/resources/log4j.properties b/resource-assignment/provider/src/test/resources/log4j.properties deleted file mode 100644 index 8fe7587..0000000 --- a/resource-assignment/provider/src/test/resources/log4j.properties +++ /dev/null @@ -1,26 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -log4j.rootLogger=INFO, A1 -log4j.appender.A1=org.apache.log4j.ConsoleAppender -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %5p %t %X{UUID} %c{3}:%L - %m%n -log4j.logger.org.hibernate=INFO diff --git a/resource-assignment/provider/src/test/resources/param.txt b/resource-assignment/provider/src/test/resources/param.txt deleted file mode 100755 index d1aac47..0000000 --- a/resource-assignment/provider/src/test/resources/param.txt +++ /dev/null @@ -1,44 +0,0 @@ -isAvailable: - Input in ctx: - tmp.resource-allocator.aic-site-id - tmp.resource-allocator.speed - tmp.resource-allocator.speed-unit - Output in ctx: - tmp.resource-allocator.max-available-speed - tmp.resource-allocator.speed-unit - Return: - SUCCESS – capacity available - NOT_FOUND – capacity not available - Error message in: error-message, error-code - FAILURE – the check has failed (data error, code defect, etc) - Error message in: error-message, error-code - -Reserve: - Input in ctx: - tmp.resource-allocator.aic-site-id - tmp.resource-allocator.speed - tmp.resource-allocator.speed-unit - tmp.resource-allocator.service-instance-id - tmp.resource-allocator.request-type { New, Change } - Output in ctx: - tmp.resource-allocator-output.max-available-speed - tmp.resource-allocator-output.speed-unit - Return: - SUCCESS – capacity available - NOT_FOUND – capacity not available - Error message in: error-message, error-code - FAILURE – the check has failed (data error, code defect, etc) - Error message in: error-message, error-code - -Release: - Input in ctx: - tmp.resource-allocator.service-instance-id - tmp.resource-allocator.request-type { Activate, Cancel, Disconnect } - Return: - SUCCESS – capacity available - FAILURE – the check has failed (data error, code defect, etc) - Error message in: error-message, error-code - - -Plugin name: org.openecomp.sdnc.ra.ResourceAllocator -Resource: NetworkCapacity diff --git a/resource-assignment/provider/src/test/resources/sql/data.sql b/resource-assignment/provider/src/test/resources/sql/data.sql deleted file mode 100644 index a2a59ea..0000000 --- a/resource-assignment/provider/src/test/resources/sql/data.sql +++ /dev/null @@ -1,120 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, equipment_level, equipment_expression, - allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Bandwidth', 'L3SDN', 'IPAG-TOA', 'true', 'Port', 'true', - 'service-speed-kbps', '0.5 * max-port-speed', '0.9 * max-port-speed'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, equipment_level, equipment_expression, - allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Bandwidth', 'L3SDN', 'VCE-Cust', 'true', 'Server', 'true', - 'service-speed-kbps', '0.6 * max-server-speed * number-primary-servers', 'max-server-speed * number-primary-servers'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, equipment_level, - equipment_expression, allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Connection', 'L3SDN', 'VCE-Cust', 'true', 'Server', - 'true', '1', '40', '40'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, equipment_level, equipment_expression, - allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Bandwidth', 'L3SDN', 'VPE-Cust', 'true', 'Port', 'true', - 'service-speed-kbps', '0.5 * max-port-speed', '0.9 * max-port-speed'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, - equipment_level, equipment_expression, allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Bandwidth', 'L3AVPN-EVC', 'VPE-Cust', 'true', 'Port', 'true', 'service-speed-kbps', '8000000', '8000000'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, - equipment_level, equipment_expression, allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Connection', 'L3AVPN-EVC', 'VPE-Cust', 'true', 'Port', 'true', '1', '200', '200'); - -INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, - equipment_level, equipment_expression, allocation_expression, soft_limit_expression, hard_limit_expression) -VALUES ( - 'Bandwidth', 'L3AVPN-PORT', 'VPE-Cust', 'true', 'Port', 'true', 'service-speed-kbps', '8000000', '8000000'); - -insert into RESOURCE_THRESHOLD ( - resource_rule_id, threshold_expression, threshold_message) -values ( - (select resource_rule_id from RESOURCE_RULE where resource_name = 'Bandwidth' and equipment_level = 'Server'), - '0.5 * max-server-speed * number-primary-servers', - 'The provisioned access bandwidth is at or exceeds 50% of the total server capacity.'); - -insert into RESOURCE_THRESHOLD ( - resource_rule_id, threshold_expression, threshold_message) -values ( - (select resource_rule_id from RESOURCE_RULE where resource_name = 'Bandwidth' and equipment_level = 'Server'), - '0.7 * max-server-speed * number-primary-servers', - 'The provisioned access bandwidth is at or exceeds 70% of the total server capacity.'); - -INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, max_value) -VALUES ( - 'subinterface-id', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 100, 3999); - -INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, max_value) -VALUES ( - 'vlan-id-inner', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 2, 4091); - -INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, max_value) -VALUES ( - 'bundle-id', 'L3AVPN-PORT', 'VPE-Cust', 'Port', 1, 99999); - -INSERT INTO MAX_PORT_SPEED ( - image_file_name, end_point_position, interface_name, max_speed, unit) -VALUES ( - 'JUNIPER_VPE_IMAGE_FILENAME', 'VPE-Cust', 'ae0', 5000, 'Mpbs'); - -INSERT INTO MAX_SERVER_SPEED (server_model, evc_count, max_speed, unit, description) -VALUES ('ALL', 5, 1600, 'Mbps', 'Max speed, when there are <=5 EVC on server'); - -INSERT INTO MAX_SERVER_SPEED (server_model, evc_count, max_speed, unit, description) -VALUES ('ALL', 10, 1400, 'Mbps', 'Max speed, when there are 6 to 10 (including 10) EVC on server'); - -INSERT INTO MAX_SERVER_SPEED (server_model, evc_count, max_speed, unit, description) -VALUES ('ALL', 15, 1000, 'Mbps', 'Max speed, when there are 11 to 15 (including 15) EVC on server'); - -INSERT INTO MAX_SERVER_SPEED (server_model, evc_count, max_speed, unit, description) -VALUES ('ALL', 20, 700, 'Mbps', 'Max speed, when there are 16 to 20 (including 20) EVC on server'); - -INSERT INTO MAX_SERVER_SPEED (server_model, evc_count, max_speed, unit, description) -VALUES ('ALL', 10000, 500, 'Mbps', 'Max speed, when there are 21 or more EVC on server'); - -INSERT INTO PARAMETERS (name, value, category, memo) -VALUES ('homing.pserver.sparing.ratio', '1:1', 'homing', - 'Ratio of primary to backup servers within any of the AIC sites. Used in RA to calculate the max allowed bw in an AIC site.'); - diff --git a/resource-assignment/provider/src/test/resources/sql/schema.sql b/resource-assignment/provider/src/test/resources/sql/schema.sql deleted file mode 100644 index f9084e1..0000000 --- a/resource-assignment/provider/src/test/resources/sql/schema.sql +++ /dev/null @@ -1,201 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- openECOMP : SDN-C --- ================================================================================ --- 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========================================================= ---- - -CREATE TABLE RESOURCE_LOCK ( - resource_lock_id SERIAL PRIMARY KEY, - resource_name VARCHAR(50) NOT NULL UNIQUE, - lock_holder VARCHAR(100) NOT NULL, - lock_count SMALLINT NOT NULL, - lock_time DATETIME NOT NULL, - expiration_time DATETIME NOT NULL -); - -CREATE TABLE RESOURCE ( - resource_id SERIAL PRIMARY KEY, - asset_id VARCHAR(50) NOT NULL, - resource_name VARCHAR(50) NOT NULL, - resource_type VARCHAR(10) NOT NULL, - lt_used BIGINT, - ll_label VARCHAR(50), - ll_reference_count SMALLINT, - rr_used VARCHAR(4000) -); - -ALTER TABLE RESOURCE ADD CONSTRAINT c1_resource CHECK (resource_type IN ('Limit', 'Label', 'Range')); -CREATE UNIQUE INDEX ak1_resource ON RESOURCE (asset_id, resource_name); - -CREATE TABLE RESOURCE_LOAD ( - resource_load_id SERIAL PRIMARY KEY, - resource_id BIGINT NOT NULL REFERENCES resource (resource_id), - application_id VARCHAR(20) NOT NULL, - resource_load_time DATETIME NOT NULL, - resource_expiration_time DATETIME -); - -CREATE INDEX i1_resource_load ON RESOURCE_LOAD (resource_id); -CREATE UNIQUE INDEX ak1_resource_load ON RESOURCE_LOAD (resource_id, application_id); - -CREATE TABLE ALLOCATION_ITEM ( - allocation_item_id SERIAL PRIMARY KEY, - resource_id BIGINT NOT NULL REFERENCES resource (resource_id), - application_id VARCHAR(50) NOT NULL, - resource_set_id VARCHAR(50) NOT NULL, - resource_union_id VARCHAR(50) NOT NULL, - resource_share_group_list VARCHAR(200), - lt_used BIGINT, - ll_label VARCHAR(50), - rr_used VARCHAR(200), - allocation_time DATETIME NOT NULL -); - -CREATE INDEX i1_allocation_item ON allocation_item (resource_id); -CREATE UNIQUE INDEX ak1_allocation_item ON allocation_item (resource_id, resource_set_id); - -CREATE TABLE RESOURCE_RULE ( - resource_rule_id SERIAL PRIMARY KEY, - resource_name VARCHAR(50) NOT NULL, - service_model VARCHAR(50) NOT NULL, - end_point_position VARCHAR(50) NOT NULL, - service_expression VARCHAR(2000) NOT NULL, - equipment_level VARCHAR(50) NOT NULL, - equipment_expression VARCHAR(2000) NOT NULL, - allocation_expression VARCHAR(2000) NOT NULL, - soft_limit_expression VARCHAR(2000) NOT NULL, - hard_limit_expression VARCHAR(2000) NOT NULL -); - -CREATE TABLE RESOURCE_THRESHOLD ( - resource_threshold_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, - resource_rule_id bigint(20) NOT NULL, - threshold_expression varchar(2000) NOT NULL, - threshold_message varchar(2000) NOT NULL, - PRIMARY KEY (resource_threshold_id) -); - -CREATE TABLE RANGE_RULE ( - range_rule_id SERIAL PRIMARY KEY, - range_name VARCHAR(50) NOT NULL, - service_model VARCHAR(50) NOT NULL, - end_point_position VARCHAR(50) NOT NULL, - equipment_level VARCHAR(50) NOT NULL, - min_value INT NOT NULL, - max_value INT NOT NULL -); - -CREATE TABLE MAX_PORT_SPEED ( - max_port_speed_id SERIAL PRIMARY KEY, - image_file_name VARCHAR(50) NOT NULL, - end_point_position VARCHAR(50) NOT NULL, - interface_name VARCHAR(100) NOT NULL, - max_speed BIGINT NOT NULL, - unit VARCHAR(10) NOT NULL -); - -CREATE TABLE MAX_SERVER_SPEED ( - max_server_speed_id SERIAL PRIMARY KEY, - server_model VARCHAR(50) NOT NULL, - evc_count SMALLINT NOT NULL, - max_speed BIGINT NOT NULL, - unit VARCHAR(10) NOT NULL, - description VARCHAR(500) -); - -CREATE TABLE SERVICE_RESOURCE ( - service_resource_id SERIAL PRIMARY KEY, - service_instance_id VARCHAR(80) NOT NULL, - service_status VARCHAR(10) NOT NULL, - service_change_number SMALLINT NOT NULL, - resource_set_id VARCHAR(100) NOT NULL, - resource_union_id VARCHAR(100) NOT NULL, -); - -ALTER TABLE SERVICE_RESOURCE ADD CONSTRAINT C1_SERVICE_RESOURCE CHECK (service_status IN ('Active', 'Pending')); -CREATE INDEX i1_service_resource ON SERVICE_RESOURCE (service_instance_id); -CREATE UNIQUE INDEX ak1_service_resource ON SERVICE_RESOURCE (service_instance_id, service_change_number); - -CREATE TABLE VPE_POOL ( - vpe_name VARCHAR(20) NOT NULL, - ipv4_oam_address VARCHAR(20) NOT NULL, - loopback0_ipv4_address VARCHAR(20) NOT NULL, - provisioning_status VARCHAR(10) NOT NULL, - aic_site_id VARCHAR(100) NOT NULL, - availability_zone VARCHAR(100) NOT NULL, - vlan_id_outer VARCHAR(20) NOT NULL, - vendor VARCHAR(20) NOT NULL, - physical_intf_name VARCHAR(40) NOT NULL, - physical_intf_speed VARCHAR(20) NOT NULL, - physical_intf_units VARCHAR(20) NOT NULL, - vpe_uuid VARCHAR(80) DEFAULT NULL, - vpe_id VARCHAR(80) DEFAULT NULL, - image_filename VARCHAR(100) DEFAULT NULL, - PRIMARY KEY (aic_site_id, vpe_name, availability_zone) -); - -CREATE TABLE VPLSPE_POOL ( - vplspe_name varchar(20) NOT NULL, - aic_site_id varchar(100) NOT NULL, - availability_zone varchar(100) NOT NULL, - physical_intf_name varchar(40) NOT NULL, - physical_intf_speed varchar(20) NOT NULL, - physical_intf_units varchar(20) NOT NULL, - loopback0_ipv4_address varchar(20) NOT NULL, - vlan_id_outer varchar(20) NOT NULL, - vplspe_uuid varchar(80) DEFAULT NULL, - image_filename varchar(100) DEFAULT NULL, - provisioning_status varchar(10) DEFAULT NULL, - vendor varchar(20) DEFAULT NULL, - PRIMARY KEY (vplspe_name, aic_site_id, availability_zone, physical_intf_name) -); - -CREATE TABLE VPE_LOCK ( - vpe_name varchar(20) NOT NULL, - vpn_lock varchar(20) NOT NULL, - PRIMARY KEY (vpe_name) -); - -CREATE TABLE PARAMETERS ( - name varchar(100) PRIMARY KEY, - value varchar(24) NOT NULL, - category varchar(24) NOT NULL, - memo varchar(128) -); - -CREATE TABLE PSERVER ( - hostname varchar(255) NOT NULL, - ptnii_equip_name varchar(255), - number_of_cpus varchar(255), - disk_in_gigabytes varchar(255), - ram_in_megabytes varchar(255), - equip_type varchar(255), - equip_vendor varchar(255), - equip_model varchar(255), - fqdn varchar(255), - pserver_selflink varchar(255), - ipv4_oam_address varchar(15), - serial_number varchar(255), - pserver_id varchar(255), - internet_topology varchar(40), - aic_site_id varchar(100), - in_maint varchar(5), - pserver_name2 varchar(255), - purpose varchar(255), - PRIMARY KEY (hostname) -); diff --git a/resource-assignment/provider/src/test/resources/svc-topology-req.json b/resource-assignment/provider/src/test/resources/svc-topology-req.json deleted file mode 100644 index ab8afb6..0000000 --- a/resource-assignment/provider/src/test/resources/svc-topology-req.json +++ /dev/null @@ -1,195 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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========================================================= - */ - -{ - "input":{ - "sdnc-request-header":{ - "svc-request-id":"omx-123", - "svc-action":"assign" - }, - "sdnc-topology-additional-data":{ - "svc-vnf-type":"vce" - }, - "request-information":{ - "request-id":"mso-1234", - "request-action":"Layer3ServiceActivateRequest", - "source":"OMX" - }, - "service-information":{ - "service-type":"SDN-ETHERNET-INTERNET", - "service-instance-id":"service-instance-123", - "subscriber-name":"ssb-subscriber" - }, - "l2-homing-information":{ - "evc-name":"EVC-123", - "topology":"PointToPoint", - "preferred-aic-clli":"ATLNGATL001" - } - "internet-evc-access-information":{ - "internet-evc-speed-value":"150", - "internet-evc-speed-units":"Mbps", - "ip-version":"v6" - } - "vr-lan":{ - "routing-protocol":"none", - { - "v6-vr-lan-prefix":"string", - "v6-public-lan-prefixes":{ - "t-provided-v6-lan-public-prefixes":[ - { - "v6-lan-public-prefix-length":"integer", - "v6-lan-public-prefix":"string", - "request-index":"integer" - } - ] - }, - "v6-vr-lan-prefix-length":"integer", - "v4-vr-lan-prefix-length":"integer", - "firewall-lite":{ - "v6-firewall-packet-filters":[ - { - "v6-firewall-prefix-length":"integer", - "udp-port-list":[ - { - "port-number":"integer" - } - ], - "tcp-port-list":[ - { - "port-number":"integer" - } - ], - "v6-firewall-prefix":"string" - } - ], - "v4-firewall-packet-filters":[ - { - "v4-firewall-prefix-length":"integer", - "udp-port-list":[ - { - "port-number":"integer" - } - ], - "tcp-port-list":[ - { - "port-number":"integer" - } - ], - "v4-firewall-prefix":"string" - } - ] - }, - "v6-vce-wan-address":"string", - "v4-public-lan-prefixes":{ - "t-provided-v4-lan-public-prefixes":[ - { - "v4-lan-public-prefix":"string", - "v4-lan-public-prefix-length":"integer", - "request-index":"integer" - } - ] - }, - "pat":{ - "v4-pat-default-pool-prefix-length":"integer", - "v4-pat-pools":[ - { - "v4-pat-pool-next-hop-address":"string", - "v4-pat-pool-prefix-length":"integer", - "v4-pat-pool-prefix":"string" - } - ], - "v4-pat-default-pool-prefix":"string" - }, - "v4-vce-loopback-address":"string", - "v4-vr-lan-prefix":"string", - "dhcp":{ - "v4-dhcp-pools":[ - { - "v4-dhcp-relay-next-hop-address":"string", - "excluded-v4-addresses":[ - { - "excluded-v4-address":"string" - } - ], - "v4-dhcp-pool-prefix":"string", - "v4-dhcp-relay-gateway-address":"string", - "v4-dhcp-pool-prefix-length":"integer" - } - ], - "excluded-v4-dhcp-addresses-from-default-pool":[ - { - "excluded-v4-address":"string" - } - ], - "v6-dhcp-pools":[ - { - "v6-dhcp-relay-gateway-address":"string", - "excluded-v6-addresses":[ - { - "excluded-v6-address":"string" - } - ], - "v6-dhcp-pool-prefix-length":"integer", - "v6-dhcp-relay-next-hop-address":"string", - "v6-dhcp-pool-prefix":"string" - } - ], - "v6-dhcp-default-pool-prefix":"string", - "v6-dhcp-default-pool-prefix-length":"integer", - "v4-dhcp-default-pool-prefix":"string", - "excluded-v6-dhcp-addresses-from-default-pool":[ - { - "excluded-v6-address":"string" - } - ], - "v4-dhcp-default-pool-prefix-length":"integer" - }, - "nat":{ - "v4-nat-mapping-entries":[ - { - "v4-nat-external":"string", - "v4-nat-next-hop-address":"string", - "v4-nat-internal":"string" - } - ] - }, - "static-routes":{ - "v6-static-routes":[ - { - "v6-static-route-prefix-length":"integer", - "v6-next-hop-address":"string", - "v6-static-route-prefix":"string" - } - ], - "v4-static-routes":[ - { - "v4-static-route-prefix-length":"integer", - "v4-static-route-prefix":"string", - "v4-next-hop-address":"string" - } - ] - } - } - - } - - } -} diff --git a/resource-assignment/provider/src/test/resources/test-context.xml b/resource-assignment/provider/src/test/resources/test-context.xml deleted file mode 100644 index 65a2cbb..0000000 --- a/resource-assignment/provider/src/test/resources/test-context.xml +++ /dev/null @@ -1,297 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sql-resource/README.md b/sql-resource/README.md new file mode 100644 index 0000000..177fa18 --- /dev/null +++ b/sql-resource/README.md @@ -0,0 +1,3 @@ +SQL-RESOURCE HAS MOVED TO CCSDK! + +The new location for sql-resource is ccsdk/sli/adaptors/sql-resource diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml deleted file mode 100755 index b1c03bb..0000000 --- a/sql-resource/features/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - - sql-resource - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - sql-resource-features - Sql Resource Adaptor - Features - - jar - - - - - - org.openecomp.sdnc.adaptors - sql-resource-provider - ${project.version} - - - - commons-lang - commons-lang - 2.6 - compile - - - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml - - runtime - - - - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - - - - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - - - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - - - - - - true - src/main/resources - - - - - org.apache.maven.plugins - maven-resources-plugin - - - filter - - resources - - generate-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${features.file} - xml - features - - - - - - - - - diff --git a/sql-resource/features/src/main/resources/features.xml b/sql-resource/features/src/main/resources/features.xml deleted file mode 100644 index 7d26ecf..0000000 --- a/sql-resource/features/src/main/resources/features.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features - - - - - odl-mdsal-broker - sdnc-sli - sdnc-dblib - mvn:org.openecomp.sdnc.adaptors/sql-resource-provider/${project.version} - - - diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml deleted file mode 100755 index a62011c..0000000 --- a/sql-resource/installer/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - 4.0.0 - - sql-resource - org.openecomp.sdnc.adaptors - 1.1.2-SNAPSHOT - - sql-resource-installer - SQL Resource - Karaf Installer - pom - - - sdnc-sql-resource - sdnc-sql-resource - mvn:org.openecomp.sdnc.adaptors/sql-resource-features/${project.version}/xml/features - false - - - - - - org.openecomp.sdnc.adaptors - sql-resource-features - ${project.version} - features - xml - - - * - * - - - - - - org.openecomp.sdnc.adaptors - sql-resource-provider - ${project.version} - - - - - - - - maven-assembly-plugin - 2.6 - - - maven-repo-zip - - single - - package - - false - stage/${application.name}-${project.version} - - src/assembly/assemble_mvnrepo_zip.xml - - false - - - - installer-zip - - single - - package - - true - ${application.name}-${project.version}-installer - - src/assembly/assemble_installer_zip.xml - - false - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - - copy-dependencies - - prepare-package - - false - ${project.build.directory}/assembly/system - false - true - true - true - false - false - org.openecomp.sdnc - sli-common,sli-provider,dblib-provider - provided - - - - - - maven-resources-plugin - 2.6 - - - copy-version - - copy-resources - - validate - - ${basedir}/target/stage - - - src/main/resources/scripts - - install-feature.sh - - true - - - - - - - - - - - - diff --git a/sql-resource/installer/src/assembly/assemble_installer_zip.xml b/sql-resource/installer/src/assembly/assemble_installer_zip.xml deleted file mode 100644 index 10b53b9..0000000 --- a/sql-resource/installer/src/assembly/assemble_installer_zip.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - installer_zip - - zip - - - - false - - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - - - - - diff --git a/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml b/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml deleted file mode 100644 index 6542ce0..0000000 --- a/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - mvnrepo_zip - - zip - - - - false - - - - target/assembly/ - . - - - - - - - - diff --git a/sql-resource/installer/src/main/resources/scripts/install-feature.sh b/sql-resource/installer/src/main/resources/scripts/install-feature.sh deleted file mode 100644 index 6e8620e..0000000 --- a/sql-resource/installer/src/main/resources/scripts/install-feature.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} -ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} -ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} -INSTALLERDIR=$(dirname $0) - -REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip - -if [ -f ${REPOZIP} ] -then - unzip -d ${ODL_HOME} ${REPOZIP} -else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 -fi - -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} -${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml deleted file mode 100755 index 3116481..0000000 --- a/sql-resource/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - org.openecomp.sdnc.adaptors - sdnc-adaptors - 1.1.2-SNAPSHOT - - - 4.0.0 - pom - org.openecomp.sdnc.adaptors - sql-resource - - - Sql Resource Adaptor - The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements - - 1.1.2-SNAPSHOT - - - - - org.openecomp.sdnc.adaptors - sql-resource-features - features - xml - ${project.version} - - - - org.openecomp.sdnc.adaptors - sql-resource-provider - ${project.version} - - - - - - provider - features - installer - - diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml deleted file mode 100755 index 81bd465..0000000 --- a/sql-resource/provider/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - 4.0.0 - - org.openecomp.sdnc.adaptors - sql-resource - 1.1.2-SNAPSHOT - - sql-resource-provider - bundle - Sql Resource Adaptor - Provider - http://maven.apache.org - - UTF-8 - - - - junit - junit - ${junit.version} - test - - - org.openecomp.sdnc.core - sli-common - ${sdnctl.sli.version} - compile - - - org.openecomp.sdnc.core - sli-provider - ${sdnctl.sli.version} - compile - - - equinoxSDK381 - org.eclipse.osgi - ${equinox.osgi.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-simple - ${slf4j.version} - compile - - - org.openecomp.sdnc.core - dblib-provider - ${sdnctl.dblib.version} - - - - - - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.openecomp.sdnc.sli.resource.sql - org.openecomp.sdnc.sli.resource.sql.SqlResourceActivator - org.openecomp.sdnc.sli.resource.sql - * - * - - - - - - - - - - - diff --git a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResource.java b/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResource.java deleted file mode 100644 index 2abf5ab..0000000 --- a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResource.java +++ /dev/null @@ -1,515 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.sql; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Map; -import java.util.Map.Entry; - -import javax.sql.rowset.CachedRowSet; - -import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicException; -import org.openecomp.sdnc.sli.SvcLogicJavaPlugin; -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager; -import org.openecomp.sdnc.sli.resource.dblib.DbLibService; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin { - - private static final Logger LOG = LoggerFactory.getLogger(SqlResource.class); - - private static final String DBLIB_SERVICE = "org.openecomp.sdnc.sli.resource.dblib.DBResourceManager"; - - private static String CRYPT_KEY = ""; - - public SqlResource() { - } - - // For sql-resource, is-available is the same as exists - @Override - public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - - return (exists(resource, key, prefix, ctx)); - - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - - DbLibService dblibSvc = getDbLibService(); - if (dblibSvc == null) { - return (QueryStatus.FAILURE); - } - - String theStmt = resolveCtxVars(key, ctx); - - try { - CachedRowSet results = dblibSvc.getData(theStmt, null, null); - - if (!results.next()) { - return (QueryStatus.NOT_FOUND); - } - - int numRows = results.getInt(1); - - if (numRows > 0) { - return (QueryStatus.SUCCESS); - } else { - return (QueryStatus.NOT_FOUND); - } - } catch (Exception e) { - LOG.error("Caught SQL exception", e); - return (QueryStatus.FAILURE); - } - } - - // @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, - String orderBy, SvcLogicContext ctx) throws SvcLogicException { - - DbLibService dblibSvc = getDbLibService(); - - if (dblibSvc == null) { - return (QueryStatus.FAILURE); - } - - String sqlQuery = resolveCtxVars(key, ctx); - - try { - - CachedRowSet results = dblibSvc.getData(sqlQuery, null, null); - - QueryStatus retval = QueryStatus.SUCCESS; - - if (!results.next()) { - retval = QueryStatus.NOT_FOUND; - LOG.debug("No data found"); - } else { - saveCachedRowSetToCtx(results, ctx, prefix, dblibSvc); - } - return (retval); - } catch (Exception e) { - LOG.error("Caught SQL exception", e); - return (QueryStatus.FAILURE); - } - } - - public void saveCachedRowSetToCtx(CachedRowSet results, SvcLogicContext ctx, String prefix, DbLibService dblibSvc) - throws SQLException { - if (ctx != null) { - if ((prefix != null) && prefix.endsWith("[]")) { - // Return an array. - String pfx = prefix.substring(0, prefix.length() - 2); - int idx = 0; - do { - ResultSetMetaData rsMeta = results.getMetaData(); - int numCols = rsMeta.getColumnCount(); - - for (int i = 0; i < numCols; i++) { - String colValue = null; - String tableName = rsMeta.getTableName(i + 1); - if (rsMeta.getColumnType(i + 1) == java.sql.Types.VARBINARY) { - colValue = decryptColumn(tableName, rsMeta.getColumnName(i + 1), results.getBytes(i + 1), - dblibSvc); - } else { - colValue = results.getString(i + 1); - } - LOG.debug("Setting " + pfx + "[" + idx + "]." - + rsMeta.getColumnLabel(i + 1).replaceAll("_", "-") + " = " + colValue); - ctx.setAttribute(pfx + "[" + idx + "]." + rsMeta.getColumnLabel(i + 1).replaceAll("_", "-"), - colValue); - } - idx++; - } while (results.next()); - LOG.debug("Setting " + pfx + "_length = " + idx); - ctx.setAttribute(pfx + "_length", "" + idx); - } else { - ResultSetMetaData rsMeta = results.getMetaData(); - int numCols = rsMeta.getColumnCount(); - - for (int i = 0; i < numCols; i++) { - String colValue = null; - String tableName = rsMeta.getTableName(i + 1); - if ("VARBINARY".equalsIgnoreCase(rsMeta.getColumnTypeName(i + 1))) { - colValue = decryptColumn(tableName, rsMeta.getColumnName(i + 1), results.getBytes(i + 1), - dblibSvc); - } else { - colValue = results.getString(i + 1); - } - if (prefix != null) { - LOG.debug("Setting " + prefix + "." + rsMeta.getColumnLabel(i + 1).replaceAll("_", "-") + " = " - + colValue); - ctx.setAttribute(prefix + "." + rsMeta.getColumnLabel(i + 1).replaceAll("_", "-"), colValue); - } else { - LOG.debug("Setting " + rsMeta.getColumnLabel(i + 1).replaceAll("_", "-") + " = " + colValue); - ctx.setAttribute(rsMeta.getColumnLabel(i + 1).replaceAll("_", "-"), colValue); - } - } - } - } - } - - // reserve is no-op - @Override - public QueryStatus reserve(String resource, String select, String key, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - return (QueryStatus.SUCCESS); - } - - // release is no-op - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return (QueryStatus.SUCCESS); - } - - private QueryStatus executeSqlWrite(String key, SvcLogicContext ctx) throws SvcLogicException { - QueryStatus retval = QueryStatus.SUCCESS; - - DbLibService dblibSvc = getDbLibService(); - - if (dblibSvc == null) { - return (QueryStatus.FAILURE); - } - - String sqlStmt = resolveCtxVars(key, ctx); - - LOG.debug("key = [" + key + "]; sqlStmt = [" + sqlStmt + "]"); - try { - - if (!dblibSvc.writeData(sqlStmt, null, null)) { - retval = QueryStatus.FAILURE; - } - } catch (Exception e) { - LOG.error("Caught SQL exception", e); - retval = QueryStatus.FAILURE; - } - - return (retval); - - } - - private String resolveCtxVars(String key, SvcLogicContext ctx) { - if (key == null) { - return (null); - } - - if (key.startsWith("'") && key.endsWith("'")) { - key = key.substring(1, key.length() - 1); - LOG.debug("Stripped outer single quotes - key is now [" + key + "]"); - } - - String[] keyTerms = key.split("\\s+"); - - StringBuffer sqlBuffer = new StringBuffer(); - - for (int i = 0; i < keyTerms.length; i++) { - sqlBuffer.append(resolveTerm(keyTerms[i], ctx)); - sqlBuffer.append(" "); - } - - return (sqlBuffer.toString()); - } - - private String resolveTerm(String term, SvcLogicContext ctx) { - if (term == null) { - return (null); - } - - LOG.trace("resolveTerm: term is " + term); - - if (term.startsWith("$") && (ctx != null)) { - // Resolve any index variables. - term = resolveCtxVariable(term.substring(1), ctx); - // Escape single quote - if (term != null) { - term = term.replaceAll("'", "''"); - } - return ("'" + term + "'"); - } else { - return (term); - } - - } - - private String resolveCtxVariable(String ctxVarName, SvcLogicContext ctx) { - - if (ctxVarName.indexOf('[') == -1) { - // Ctx variable contains no arrays - if ("CRYPT_KEY".equals(ctxVarName)) { - // Handle crypt key as special case. If it's set as a context - // variable, use it. Otherwise, use - // configured crypt key. - String cryptKey = ctx.getAttribute(ctxVarName); - if ((cryptKey != null) && (cryptKey.length() > 0)) { - return (cryptKey); - } else { - return (CRYPT_KEY); - } - } - return (ctx.getAttribute(ctxVarName)); - } - - // Resolve any array references - StringBuffer sbuff = new StringBuffer(); - String[] ctxVarParts = ctxVarName.split("\\["); - sbuff.append(ctxVarParts[0]); - for (int i = 1; i < ctxVarParts.length; i++) { - if (ctxVarParts[i].startsWith("$")) { - int endBracketLoc = ctxVarParts[i].indexOf("]"); - if (endBracketLoc == -1) { - // Missing end bracket ... give up parsing - LOG.warn("Variable reference " + ctxVarName + " seems to be missing a ']'"); - return (ctx.getAttribute(ctxVarName)); - } - - String idxVarName = ctxVarParts[i].substring(1, endBracketLoc); - String remainder = ctxVarParts[i].substring(endBracketLoc); - - sbuff.append("["); - sbuff.append(ctx.getAttribute(idxVarName)); - sbuff.append(remainder); - - } else { - // Index is not a variable reference - sbuff.append("["); - sbuff.append(ctxVarParts[i]); - } - } - - return (ctx.getAttribute(sbuff.toString())); - } - - @Override - public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map parms, - String prefix, SvcLogicContext ctx) throws SvcLogicException { - return (executeSqlWrite(key, ctx)); - } - - private DbLibService getDbLibService() { - // Try to get dblib as an OSGI service - DbLibService dblibSvc = null; - BundleContext bctx = null; - ServiceReference sref = null; - - Bundle bundle = FrameworkUtil.getBundle(SqlResource.class); - - if (bundle != null) { - bctx = bundle.getBundleContext(); - } - - if (bctx != null) { - sref = bctx.getServiceReference(DBLIB_SERVICE); - } - - if (sref == null) { - LOG.warn("Could not find service reference for DBLIB service (" + DBLIB_SERVICE + ")"); - } else { - dblibSvc = (DbLibService) bctx.getService(sref); - if (dblibSvc == null) { - LOG.warn("Could not find service reference for DBLIB service (" + DBLIB_SERVICE + ")"); - } - } - - if (dblibSvc == null) { - // Must not be running in an OSGI container. See if you can load it - // as a - // a POJO then. - try { - dblibSvc = DBResourceManager.create(System.getProperties()); - } catch (Exception e) { - LOG.error("Caught exception trying to create dblib service", e); - } - - if (dblibSvc == null) { - LOG.warn("Could not create new DBResourceManager"); - } - } - - return (dblibSvc); - } - - @Override - public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) - throws SvcLogicException { - if (LOG.isDebugEnabled()) { - LOG.debug("SqlResource.notify called with resource=" + resource + ", action=" + action); - } - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return (executeSqlWrite(key, ctx)); - } - - public QueryStatus update(String resource, String key, Map parms, String prefix, - SvcLogicContext ctx) throws SvcLogicException { - return (executeSqlWrite(key, ctx)); - } - - private String decryptColumn(String tableName, String colName, byte[] colValue, DbLibService dblibSvc) { - String strValue = new String(colValue); - - if (StringUtils.isAsciiPrintable(strValue)) { - - // If printable, not encrypted - return (strValue); - } else { - PreparedStatement stmt = null; - Connection conn = null; - ResultSet results = null; - try { - // CachedRowSet results = - // dblibSvc.getData("SELECT - // CAST(AES_DECRYPT('"+strValue+"','"+CRYPT_KEY+"') AS CHAR(50)) - // FROM DUAL", - // null, null); - conn = ((DBResourceManager) dblibSvc).getConnection(); - - stmt = conn.prepareStatement("SELECT CAST(AES_DECRYPT(?, ?) AS CHAR(50)) FROM DUAL"); - - stmt.setBytes(1, colValue); - stmt.setString(2, getCryptKey()); - - results = stmt.executeQuery(); - - if ((results != null) && results.next()) { - strValue = results.getString(1); - LOG.debug("Decrypted value is " + strValue); - } else { - LOG.warn("Cannot decrypt " + tableName + "." + colName); - } - } catch (Exception e) { - LOG.error("Caught exception trying to decrypt " + tableName + "." + colName, e); - } finally { - try { - if (results != null) { - results.close(); - results = null; - } - } catch (Exception exc) { - - } - - try { - if (stmt != null) { - stmt.close(); - stmt = null; - } - } catch (Exception exc) { - - } - - try { - if (conn != null) { - conn.close(); - conn = null; - } - } catch (Exception exc) { - - } - - } - } - return (strValue); - } - - public static String getCryptKey() { - return (CRYPT_KEY); - } - - public static String setCryptKey(String key) { - CRYPT_KEY = key; - return (CRYPT_KEY); - } - - public String parameterizedQuery(Map parameters, SvcLogicContext ctx) throws SvcLogicException { - DbLibService dblibSvc = getDbLibService(); - String prefix = parameters.get("prefix"); - String query = parameters.get("query"); - - ArrayList arguments = new ArrayList(); - for (Entry a : parameters.entrySet()) { - if (a.getKey().startsWith("param")) { - arguments.add(a.getValue()); - } - } - - try { - if (dblibSvc == null) { - return mapQueryStatus(QueryStatus.FAILURE); - } - if (query.contains("count") || query.contains("COUNT")) { - CachedRowSet results = dblibSvc.getData(query, arguments, null); - - if (!results.next()) { - return mapQueryStatus(QueryStatus.FAILURE); - } - - int numRows = results.getInt(1); - ctx.setAttribute(prefix + ".count", String.valueOf(numRows)); - if (numRows > 0) { - return "true"; - } else { - return "false"; - } - } else if (query.startsWith("select") || query.startsWith("SELECT")) { - CachedRowSet results = dblibSvc.getData(query, arguments, null); - if (!results.next()) { - return mapQueryStatus(QueryStatus.NOT_FOUND); - } else { - saveCachedRowSetToCtx(results, ctx, prefix, dblibSvc); - } - } else { - if (!dblibSvc.writeData(query, arguments, null)) { - return mapQueryStatus(QueryStatus.FAILURE); - } - } - return mapQueryStatus(QueryStatus.SUCCESS); - } catch (SQLException e) { - LOG.error("Caught SQL exception", e); - return mapQueryStatus(QueryStatus.FAILURE); - } - } - - protected String mapQueryStatus(QueryStatus status) { - String str = status.toString(); - str = str.toLowerCase(); - str = str.replaceAll("_", "-"); - return str; - } -} diff --git a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java b/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java deleted file mode 100644 index 03d7e10..0000000 --- a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.sql; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; - -import org.openecomp.sdnc.sli.SvcLogicResource; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SqlResourceActivator implements BundleActivator { - - private static final String SQLRESOURCE_PROP_PATH = "/sql-resource.properties"; - - private ServiceRegistration registration = null; - - private static final Logger LOG = LoggerFactory - .getLogger(SqlResourceActivator.class); - - @Override - public void start(BundleContext ctx) throws Exception { - - String cfgDir = System.getenv("SDNC_CONFIG_DIR"); - - if ((cfgDir == null) || (cfgDir.length() == 0)) { - cfgDir = "/opt/sdnc/data/properties"; - LOG.warn("SDNC_CONFIG_DIR unset - defaulting to "+cfgDir); - } - - String cryptKey = ""; - - File sqlResourcePropFile = new File(cfgDir+SQLRESOURCE_PROP_PATH); - Properties sqlResourceProps = new Properties(); - if (sqlResourcePropFile.exists()) { - try { - - sqlResourceProps.load(new FileInputStream(sqlResourcePropFile)); - - cryptKey = sqlResourceProps.getProperty("org.openecomp.sdnc.resource.sql.cryptkey"); - } catch (Exception e) { - LOG.warn( - "Could not load properties file " + sqlResourcePropFile.getAbsolutePath(), e); - } - } else { - LOG.warn("Cannot read "+sqlResourcePropFile.getAbsolutePath()+" to find encryption key - using default"); - } - - SqlResource.setCryptKey(cryptKey); - - // Advertise Sql resource adaptor - SvcLogicResource impl = new SqlResource(); - String regName = impl.getClass().getName(); - - if (registration == null) - { - LOG.debug("Registering SqlResource service "+regName); - registration =ctx.registerService(regName, impl, null); - } - - } - - @Override - public void stop(BundleContext ctx) throws Exception { - - if (registration != null) - { - registration.unregister(); - registration = null; - } - } - -} diff --git a/sql-resource/provider/src/main/resources/svclogic.properties b/sql-resource/provider/src/main/resources/svclogic.properties deleted file mode 100644 index 347adc3..0000000 --- a/sql-resource/provider/src/main/resources/svclogic.properties +++ /dev/null @@ -1,34 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -org.openecomp.sdnc.sli.dbtype=jdbc -org.openecomp.sdnc.sli.jdbc.hosts=sdnctldb01,sdnctldb02 -org.openecomp.sdnc.sli.jdbc.url=jdbc:mysql://DBHOST:3306/sdnctl -org.openecomp.sdnc.sli.jdbc.database=sdnctl -org.openecomp.sdnc.sli.jdbc.user=sdnctl -org.openecomp.sdnc.sli.jdbc.password=gamma -org.openecomp.sdnc.sli.jdbc.connection.name=sdnctldb01 - -org.openecomp.sdnc.sli.jdbc.connection.timeout=50 -org.openecomp.sdnc.sli.jdbc.request.timeout=100 -org.openecomp.sdnc.sli.jdbc.limit.init=10 -org.openecomp.sdnc.sli.jdbc.limit.min=10 -org.openecomp.sdnc.sli.jdbc.limit.max=20 diff --git a/sql-resource/provider/src/test/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceTest.java b/sql-resource/provider/src/test/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceTest.java deleted file mode 100644 index b93a833..0000000 --- a/sql-resource/provider/src/test/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * 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.openecomp.sdnc.sli.resource.sql; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Enumeration; -import java.util.Properties; - -import org.openecomp.sdnc.sli.SvcLogicContext; -import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import junit.framework.TestCase; - -public class SqlResourceTest extends TestCase { - - private static final Logger LOG = LoggerFactory - .getLogger(SqlResourceTest.class); - - - public void testExists() { - - - Properties props = new Properties(); - InputStream propStr = getClass().getResourceAsStream("/svclogic.properties"); - if (propStr == null) { - fail("src/test/resources/svclogic.properties missing"); - } - - try { - props.load(propStr); - propStr.close(); - } catch (Exception e) { - e.printStackTrace(); - fail("Could not initialize properties"); - } - - // Add properties to global properties - - Enumeration propNames = props.keys(); - - while (propNames.hasMoreElements()) { - String propName = (String) propNames.nextElement(); - - System.setProperty(propName, props.getProperty(propName)); - } - - SqlResource sqlResource = new SqlResource(); - - - - InputStream testStr = getClass().getResourceAsStream("/save.tests"); - BufferedReader testsReader = new BufferedReader(new InputStreamReader(testStr)); - SvcLogicContext ctx = new SvcLogicContext(); - - try { - String testExpr = null; - - int testNum = 0; - while ((testExpr = testsReader.readLine()) != null) { - testExpr = testExpr.trim(); - - if (testExpr.startsWith("#")) { - testExpr = testExpr.substring(1).trim(); - String[] nameValue = testExpr.split("="); - String name = nameValue[0].trim(); - String value = nameValue[1].trim(); - - LOG.info("Setting context attribute " + name + " = " - + value); - ctx.setAttribute(name, value); - - } else { - - testNum++; - String sqlStmt = testExpr; - QueryStatus status = sqlResource.save("SQL", true, false, sqlStmt, null, "savetest"+testNum, ctx); - - switch (status) { - case SUCCESS: - LOG.info("Found data for query [" + sqlStmt + "]"); - break; - case NOT_FOUND: - LOG.info("Did not data for query [" + sqlStmt + "]"); - break; - default: - fail("Failure executing query [" + sqlStmt + "]"); - - } - } - } - - } catch (Exception e) { - e.printStackTrace(); - fail("Caught exception running tests"); - } - - - testStr = getClass().getResourceAsStream("/query.tests"); - testsReader = new BufferedReader(new InputStreamReader(testStr)); - - try { - String testExpr = null; - - int testNum = 0; - while ((testExpr = testsReader.readLine()) != null) { - testExpr = testExpr.trim(); - if (testExpr.startsWith("#")) { - testExpr = testExpr.substring(1).trim(); - String[] nameValue = testExpr.split("="); - String name = nameValue[0].trim(); - String value = nameValue[1].trim(); - - LOG.info("Setting context attribute " + name + " = " - + value); - ctx.setAttribute(name, value); - - } else { - - testNum++; - - String sqlStmt = testExpr; - QueryStatus status = sqlResource.query("SQL", false, null, - sqlStmt, "querytest" + testNum, null, ctx); - - switch (status) { - case SUCCESS: - LOG.info("Found data for query [" + sqlStmt + "]"); - break; - case NOT_FOUND: - LOG.info("Did not data for query [" + sqlStmt + "]"); - break; - default: - fail("Failure executing query [" + sqlStmt + "]"); - - } - } - } - - } catch (Exception e) { - e.printStackTrace(); - fail("Caught exception running tests"); - } - - - testStr = getClass().getResourceAsStream("/delete.tests"); - testsReader = new BufferedReader(new InputStreamReader(testStr)); - - try { - String testExpr = null; - - int testNum = 0; - while ((testExpr = testsReader.readLine()) != null) { - testExpr = testExpr.trim(); - if (testExpr.startsWith("#")) { - testExpr = testExpr.substring(1).trim(); - String[] nameValue = testExpr.split("="); - String name = nameValue[0].trim(); - String value = nameValue[1].trim(); - - LOG.info("Setting context attribute " + name + " = " - + value); - ctx.setAttribute(name, value); - - } else { - - testNum++; - - String sqlStmt = testExpr; - QueryStatus status = sqlResource.delete("SQL", sqlStmt, ctx); - - switch (status) { - case SUCCESS: - LOG.info("Found data for query [" + sqlStmt + "]"); - break; - case NOT_FOUND: - LOG.info("Did not data for query [" + sqlStmt + "]"); - break; - default: - fail("Failure executing query [" + sqlStmt + "]"); - - } - } - } - - } catch (Exception e) { - e.printStackTrace(); - fail("Caught exception running tests"); - } - - for (String attrName : ctx.getAttributeKeySet()) { - LOG.info("ctx.getAttribute("+attrName+") = "+ctx.getAttribute(attrName)); - } - } - -} diff --git a/sql-resource/provider/src/test/resources/delete.tests b/sql-resource/provider/src/test/resources/delete.tests deleted file mode 100755 index a60a3bc..0000000 --- a/sql-resource/provider/src/test/resources/delete.tests +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE SQLRESOURCE_ORDER; -DROP TABLE SQLRESOURCE_ORDER_ITEM; diff --git a/sql-resource/provider/src/test/resources/query.tests b/sql-resource/provider/src/test/resources/query.tests deleted file mode 100755 index ec05c22..0000000 --- a/sql-resource/provider/src/test/resources/query.tests +++ /dev/null @@ -1,5 +0,0 @@ -# max-price = 100 -SELECT * FROM SQLRESOURCE_ORDER where placed_on < now(); -SELECT SQLRESOURCE_ORDER.order_number, clli, service, price FROM SQLRESOURCE_ORDER, SQLRESOURCE_ORDER_ITEM where SQLRESOURCE_ORDER.order_number = SQLRESOURCE_ORDER_ITEM.order_number and price > $max-price ; -SELECT SQLRESOURCE_ORDER.order_number, clli, service, price FROM SQLRESOURCE_ORDER, SQLRESOURCE_ORDER_ITEM where SQLRESOURCE_ORDER.order_number = SQLRESOURCE_ORDER_ITEM.order_number and price < $max-price ; -SELECT SQLRESOURCE_ORDER.order_number AS ordernum, clli, service, price FROM SQLRESOURCE_ORDER, SQLRESOURCE_ORDER_ITEM where SQLRESOURCE_ORDER.order_number = SQLRESOURCE_ORDER_ITEM.order_number and price < $max-price ; diff --git a/sql-resource/provider/src/test/resources/save.tests b/sql-resource/provider/src/test/resources/save.tests deleted file mode 100755 index e2c4221..0000000 --- a/sql-resource/provider/src/test/resources/save.tests +++ /dev/null @@ -1,13 +0,0 @@ -# order-number = 1234 -# zero = 0 -# item[0].clli = MTJNJA14 -# item[0].service = NoD -# item[0].price = 1000000 -# item[1].clli = MTJNJA14 -# item[1].service = Pizza -# item[1].price = 10 -CREATE TABLE IF NOT EXISTS SQLRESOURCE_ORDER (order_number VARCHAR(40), placed_on TIMESTAMP); -CREATE TABLE IF NOT EXISTS SQLRESOURCE_ORDER_ITEM (order_number VARCHAR(40), clli VARCHAR(40), service VARCHAR(40), price INTEGER(4)); -INSERT INTO SQLRESOURCE_ORDER VALUES ( $order-number , now()); -INSERT INTO SQLRESOURCE_ORDER_ITEM VALUES( $order-number , $item[$zero].clli , $item[0].service , $item[0].price ); -INSERT INTO SQLRESOURCE_ORDER_ITEM VALUES( $order-number , $item[1].clli , $item[1].service , $item[1].price ); diff --git a/sql-resource/provider/src/test/resources/simplelogger.properties b/sql-resource/provider/src/test/resources/simplelogger.properties deleted file mode 100644 index 96a105c..0000000 --- a/sql-resource/provider/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,22 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -org.slf4j.simpleLogger.defaultLogLevel=debug diff --git a/sql-resource/provider/src/test/resources/svclogic.properties b/sql-resource/provider/src/test/resources/svclogic.properties deleted file mode 100644 index fb2eb2e..0000000 --- a/sql-resource/provider/src/test/resources/svclogic.properties +++ /dev/null @@ -1,34 +0,0 @@ -### -# ============LICENSE_START======================================================= -# openECOMP : SDN-C -# ================================================================================ -# 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========================================================= -### - -org.openecomp.sdnc.sli.dbtype=jdbc -org.openecomp.sdnc.sli.jdbc.hosts=localhost -org.openecomp.sdnc.sli.jdbc.url=jdbc:mysql://DBHOST:3306/sdnctl -org.openecomp.sdnc.sli.jdbc.database=sdnctl -org.openecomp.sdnc.sli.jdbc.user=sdnctl -org.openecomp.sdnc.sli.jdbc.password=gamma -org.openecomp.sdnc.sli.jdbc.connection.name=sdnctldb01 - -org.openecomp.sdnc.sli.jdbc.connection.timeout=50 -org.openecomp.sdnc.sli.jdbc.request.timeout=100 -org.openecomp.sdnc.sli.jdbc.limit.init=10 -org.openecomp.sdnc.sli.jdbc.limit.min=10 -org.openecomp.sdnc.sli.jdbc.limit.max=20 diff --git a/version.properties b/version.properties index fa08454..9bf927d 100644 --- a/version.properties +++ b/version.properties @@ -4,8 +4,8 @@ # because they are used in Jenkins, whose plug-in doesn't support release_name=1 -sprint_number=1 -feature_revision=2 +sprint_number=2 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg