From 5363b2782d906a6c6067eb840392f959ed4dfe4b Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 18 Jul 2017 20:23:07 -0400 Subject: [CCSDK-6] Populate seed code Add seed code for sli/adaptors repository Update code to use org.onap.ccsdk.sli.core Change-Id: I477c7a24f2cc1fed8fb0975fe9f33733411c27f9 Signed-off-by: Dan Timoney --- resource-assignment/.gitignore | 34 + resource-assignment/.sonar/checkstyle.xml | 1 + resource-assignment/.sonar/pmd.xml | 67 ++ 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 ++++++ 153 files changed, 13513 insertions(+) create mode 100755 resource-assignment/.gitignore create mode 100755 resource-assignment/.sonar/checkstyle.xml create mode 100755 resource-assignment/.sonar/pmd.xml create mode 100755 resource-assignment/features/pom.xml create mode 100644 resource-assignment/features/src/main/resources/features.xml create mode 100755 resource-assignment/installer/pom.xml create mode 100644 resource-assignment/installer/src/assembly/assemble_installer_zip.xml create mode 100644 resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 resource-assignment/installer/src/main/resources/scripts/install-feature.sh create mode 100755 resource-assignment/pom.xml create mode 100755 resource-assignment/provider/pom.xml create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java create mode 100644 resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java create mode 100644 resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml create mode 100644 resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml create mode 100644 resource-assignment/provider/src/main/resources/resource-allocator.properties create mode 100644 resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql create mode 100644 resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql create mode 100644 resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java create mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java create mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java create mode 100644 resource-assignment/provider/src/test/resources/homing-req.json create mode 100644 resource-assignment/provider/src/test/resources/log4j.properties create mode 100755 resource-assignment/provider/src/test/resources/param.txt create mode 100644 resource-assignment/provider/src/test/resources/sql/data.sql create mode 100644 resource-assignment/provider/src/test/resources/sql/schema.sql create mode 100644 resource-assignment/provider/src/test/resources/svc-topology-req.json create mode 100644 resource-assignment/provider/src/test/resources/test-context.xml (limited to 'resource-assignment') diff --git a/resource-assignment/.gitignore b/resource-assignment/.gitignore new file mode 100755 index 000000000..b73caf31e --- /dev/null +++ b/resource-assignment/.gitignore @@ -0,0 +1,34 @@ +#####standard .git ignore entries##### + +## IDE Specific Files ## +org.eclipse.core.resources.prefs +.classpath +.project +.settings +.idea +.externalToolBuilders +maven-eclipse.xml +workspace + +## Compilation Files ## +*.class +**/target +target +target-ide +MANIFEST.MF + +## Misc Ignores (OS specific etc) ## +bin/ +dist +*~ +*.ipr +*.iml +*.iws +classes +out/ +.DS_STORE +.metadata + +## Folders which contain auto generated source code ## +yang-gen-config +yang-gen-sal diff --git a/resource-assignment/.sonar/checkstyle.xml b/resource-assignment/.sonar/checkstyle.xml new file mode 100755 index 000000000..3fa231535 --- /dev/null +++ b/resource-assignment/.sonar/checkstyle.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resource-assignment/.sonar/pmd.xml b/resource-assignment/.sonar/pmd.xml new file mode 100755 index 000000000..80343b3bd --- /dev/null +++ b/resource-assignment/.sonar/pmd.xml @@ -0,0 +1,67 @@ + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 2 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 5 + + + 2 + + + 3 + + + 3 + + + diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml new file mode 100755 index 000000000..73cea0809 --- /dev/null +++ b/resource-assignment/features/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + + resource-assignment + org.openecomp.sdnc.adaptors + 0.0.1-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 new file mode 100644 index 000000000..01c55789a --- /dev/null +++ b/resource-assignment/features/src/main/resources/features.xml @@ -0,0 +1,40 @@ + + + + + + + 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 new file mode 100755 index 000000000..81dcfbb21 --- /dev/null +++ b/resource-assignment/installer/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + + resource-assignment + org.openecomp.sdnc.adaptors + 0.0.1-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 new file mode 100644 index 000000000..e278872a1 --- /dev/null +++ b/resource-assignment/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ + + + + + + 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 new file mode 100644 index 000000000..1edacdb6d --- /dev/null +++ b/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,49 @@ + + + + + + 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 new file mode 100644 index 000000000..9a47d2225 --- /dev/null +++ b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 ONAP 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 new file mode 100755 index 000000000..a650d46f7 --- /dev/null +++ b/resource-assignment/pom.xml @@ -0,0 +1,43 @@ + + + + org.openecomp.sdnc.adaptors + sdnc-adaptors + 0.0.1-SNAPSHOT + + + 4.0.0 + pom + org.openecomp.sdnc.adaptors + resource-assignment + 0.0.1-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 new file mode 100755 index 000000000..9a17589ca --- /dev/null +++ b/resource-assignment/provider/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + org.openecomp.sdnc.adaptors + resource-assignment + 0.0.1-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.onap.ccsdk.sli.core + sli-common + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.core + sli-provider + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.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 new file mode 100644 index 000000000..acdce65ec --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..306fc162d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..8e3142cc0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a76fca11c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..014765dfb --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f4819b837 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..561fd82a4 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..52104ec5f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d9964331e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ae281cf1f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java @@ -0,0 +1,1016 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +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.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 new file mode 100644 index 000000000..b77df92a7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a066378ac --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..cb36a8bef --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f23f1e985 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..aee761c7e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..25571fb2d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..6c2b4c591 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..56fd535e7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..baed60eb5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..4644a14a7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..3b350b419 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..0877933b6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..21e49c3a1 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..645c953c0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..1af81434d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java @@ -0,0 +1,214 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..e425e373f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..fcca4f7c2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..acaf10d9e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..0d29e54f7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a380594ba --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..44873873b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..e1bc2a5a8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..4a0f6b8c0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d25fe9c4c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..879a233d7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..bad646414 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d485224b0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..44ae593a0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..09af2081d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..abef0a24e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..4040b0b44 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..0adf6d122 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..7039370a0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..360f7806f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..44e4c53a6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..dbc0d8be9 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a56b78809 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ea0bd7715 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..4bd17f1dd --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..c34281797 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..509a034ae --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..2cafb2806 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..798a23037 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..dec05ece4 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..31ce9e6ab --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..819a01cd8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..eb41792d9 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..eb6cef3bd --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ed76f6b16 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..c4d55f921 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..7be4067e0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..5f772ef18 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..811118cb4 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..6432e80d7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..65d4488ee --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceResource.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..32f473d3d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..3a9340916 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java @@ -0,0 +1,330 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f546954ff --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..aea0b0a3c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..7a3ce0343 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..b9d5a0995 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f499801c6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..eb5f39885 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..30f9d26a4 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..1d88261c2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ca66964ce --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..32c8f4d7f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java @@ -0,0 +1,370 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..645c377e7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..5e529f70e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..5c810b1d0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..9a337a83d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..854b66965 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..c791d4272 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f4cabf96e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..20ecf051e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d54475ff6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a18077a13 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..8b9dfaa32 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/InitAction.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..e456542cf --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d0cb2c527 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..2b6ce0338 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..54bfb852e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..270220a8a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f1c13c083 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..787715bb0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..cad0ba232 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..bf9bbbfaa --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..da1a96d73 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..9deca6c2b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..9e48a31e5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..229c8e449 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..8b35d9f04 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..0732613d3 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..99a2b207a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..b04f71050 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..b303b07fd --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..06970cbcc --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..1d8b9c4c8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..bbaa3a378 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..457995604 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java @@ -0,0 +1,334 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..af828314e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..7afe7b5db --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..8918ce0cb --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..1927fdb9c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java @@ -0,0 +1,338 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d729e127d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ff15d770b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..8a0b006bf --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..02857e105 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java @@ -0,0 +1,305 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..a9d69507a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..d5a691bb8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..b123944d3 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000..bec30ce11 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml @@ -0,0 +1,39 @@ + + + + + + + + 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 new file mode 100644 index 000000000..1a2cf0c78 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/resource-allocator.properties @@ -0,0 +1,26 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ea60c62dc --- /dev/null +++ b/resource-assignment/provider/src/main/resources/sql/001_resource_rule_ddl.sql @@ -0,0 +1,32 @@ +--- +-- ============LICENSE_START======================================================= +-- openECOMP : SDN-C +-- ================================================================================ +-- Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..2aa66ac80 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/sql/002_max_port_speed_ddl.sql @@ -0,0 +1,29 @@ +--- +-- ============LICENSE_START======================================================= +-- openECOMP : SDN-C +-- ================================================================================ +-- Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..671117e7d --- /dev/null +++ b/resource-assignment/provider/src/main/resources/sql/003_max_server_speed_ddl.sql @@ -0,0 +1,28 @@ +--- +-- ============LICENSE_START======================================================= +-- openECOMP : SDN-C +-- ================================================================================ +-- Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..f74eeee5f --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java @@ -0,0 +1,261 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..7d57eba31 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java @@ -0,0 +1,424 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.ra.ResourceAllocator; +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 new file mode 100644 index 000000000..e69003a39 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.ra.ResourceAllocator; +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 new file mode 100644 index 000000000..f2ee50fc5 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java @@ -0,0 +1,430 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.ra.ResourceAllocator; +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 new file mode 100644 index 000000000..08c673587 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java @@ -0,0 +1,681 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.ra.ResourceAllocator; +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 new file mode 100644 index 000000000..a92cbc5aa --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.openecomp.sdnc.ra.ResourceAllocator; +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 new file mode 100644 index 000000000..55824b00c --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ec7c2abfe --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..64288d96a --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..48ec701a7 --- /dev/null +++ b/resource-assignment/provider/src/test/resources/homing-req.json @@ -0,0 +1,46 @@ +/*- + * ============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 new file mode 100644 index 000000000..6d6e30ff2 --- /dev/null +++ b/resource-assignment/provider/src/test/resources/log4j.properties @@ -0,0 +1,26 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 ONAP 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 new file mode 100755 index 000000000..d1aac4777 --- /dev/null +++ b/resource-assignment/provider/src/test/resources/param.txt @@ -0,0 +1,44 @@ +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 new file mode 100644 index 000000000..2214bce79 --- /dev/null +++ b/resource-assignment/provider/src/test/resources/sql/data.sql @@ -0,0 +1,120 @@ +--- +-- ============LICENSE_START======================================================= +-- openECOMP : SDN-C +-- ================================================================================ +-- Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..e650337e0 --- /dev/null +++ b/resource-assignment/provider/src/test/resources/sql/schema.sql @@ -0,0 +1,201 @@ +--- +-- ============LICENSE_START======================================================= +-- openECOMP : SDN-C +-- ================================================================================ +-- Copyright (C) 2017 ONAP 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 new file mode 100644 index 000000000..ab8afb66f --- /dev/null +++ b/resource-assignment/provider/src/test/resources/svc-topology-req.json @@ -0,0 +1,195 @@ +/*- + * ============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 new file mode 100644 index 000000000..89aea439e --- /dev/null +++ b/resource-assignment/provider/src/test/resources/test-context.xml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg From 16508ffde287f481791ae0b9c071f60a331c680d Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 1 Aug 2017 15:19:07 -0400 Subject: Fix groupIds Updated groupId to org.onap.ccsdk.sli.adaptors to allow clean Nexus deploy Issue: CCSDK-14 Change-Id: I228978572b2f574e95caa4ff2f40fdbfdcc330ad Signed-off-by: Dan Timoney --- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 10 +++++----- aai-service/pom.xml | 8 ++++---- aai-service/provider/pom.xml | 2 +- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 10 +++++----- mdsal-resource/pom.xml | 8 ++++---- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 10 +++++----- resource-assignment/pom.xml | 8 ++++---- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 10 +++++----- sql-resource/pom.xml | 8 ++++---- sql-resource/provider/pom.xml | 2 +- 17 files changed, 49 insertions(+), 49 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 3127bd9c7..207113664 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -3,7 +3,7 @@ 4.0.0 aai-service - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT aai-service-features @@ -15,7 +15,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service-provider ${project.version} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 2973348b5..6668eca0a 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -3,7 +3,7 @@ 4.0.0 aai-service - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT aai-service-installer @@ -13,14 +13,14 @@ sdnc-aai-service sdnc-aai-service - mvn:org.openecomp.sdnc.adaptors/aai-service-features/${project.version}/xml/features + mvn:org.onap.ccsdk.sli.adaptors/aai-service-features/${project.version}/xml/features false - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service-features ${project.version} features @@ -34,7 +34,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service-provider ${project.version} @@ -104,7 +104,7 @@ true false false - org.openecomp.sdnc,org.jvnet.jaxb2_commons + org.onap.ccsdk,org.jvnet.jaxb2_commons sli-common,sli-provider,dblib-provider,dblib-common provided diff --git a/aai-service/pom.xml b/aai-service/pom.xml index cc028b02d..e4561d8b1 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -2,14 +2,14 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sdnc-adaptors 0.0.1-SNAPSHOT 4.0.0 pom - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service @@ -21,7 +21,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service-features features ${project.version} @@ -29,7 +29,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service-provider ${project.version} diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index d6d72f203..a9aa98d74 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors aai-service 0.0.1-SNAPSHOT diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 3848f1a62..fbad6e210 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -3,7 +3,7 @@ 4.0.0 mdsal-resource - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT mdsal-resource-features @@ -15,7 +15,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource-provider ${project.version} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 322a8daae..0e52c1306 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -3,7 +3,7 @@ 4.0.0 mdsal-resource - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT mdsal-resource-installer @@ -13,14 +13,14 @@ sdnc-mdsal-resource sdnc-mdsal-resource - mvn:org.openecomp.sdnc.adaptors/mdsal-resource-features/${project.version}/xml/features + mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features false - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource-features ${project.version} features @@ -34,7 +34,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource-provider ${project.version} @@ -98,7 +98,7 @@ true false false - org.openecomp.sdnc + org.onap.ccsdk sli-common,sli-provider,dblib-provider provided diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index f4cdfc7e3..4501edd14 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -1,14 +1,14 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sdnc-adaptors 0.0.1-SNAPSHOT 4.0.0 pom - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource @@ -21,7 +21,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource-features features xml @@ -29,7 +29,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource-provider ${project.version} diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index f41bf9c78..0092f6996 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors mdsal-resource 0.0.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 141f33616..a50a21429 100755 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 pom - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sdnc-adaptors SDN-C Adaptors diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 73cea0809..9e718e7a9 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -3,7 +3,7 @@ 4.0.0 resource-assignment - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT resource-assignment-features @@ -15,7 +15,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment-provider ${project.version} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 81dcfbb21..900f0444f 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -3,7 +3,7 @@ 4.0.0 resource-assignment - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT resource-assignment-installer @@ -13,14 +13,14 @@ sdnc-resource-assignment sdnc-resource-assignment - mvn:org.openecomp.sdnc.adaptors/resource-assignment-features/${project.version}/xml/features + mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-features/${project.version}/xml/features false - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment-features ${project.version} features @@ -34,7 +34,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment-provider ${project.version} @@ -98,7 +98,7 @@ true false false - org.openecomp.sdnc + org.onap.ccsdk sli-common,sli-provider,dblib-provider provided diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index a650d46f7..e0e140f20 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -1,14 +1,14 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sdnc-adaptors 0.0.1-SNAPSHOT 4.0.0 pom - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment 0.0.1-SNAPSHOT @@ -19,7 +19,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment-features features xml @@ -27,7 +27,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment-provider ${project.version} diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 9a17589ca..f6d7fede7 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors resource-assignment 0.0.1-SNAPSHOT diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 1f75be2f4..4b32a9f0b 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -3,7 +3,7 @@ 4.0.0 sql-resource - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT sql-resource-features @@ -15,7 +15,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource-provider ${project.version} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 932047773..fa27cfe56 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -3,7 +3,7 @@ 4.0.0 sql-resource - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors 0.0.1-SNAPSHOT sql-resource-installer @@ -13,14 +13,14 @@ sdnc-sql-resource sdnc-sql-resource - mvn:org.openecomp.sdnc.adaptors/sql-resource-features/${project.version}/xml/features + mvn:org.onap.ccsdk.sli.adaptors/sql-resource-features/${project.version}/xml/features false - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource-features ${project.version} features @@ -34,7 +34,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource-provider ${project.version} @@ -98,7 +98,7 @@ true false false - org.openecomp.sdnc + org.onap.ccsdk sli-common,sli-provider,dblib-provider provided diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index a8d8ae696..a3376c1ca 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -1,14 +1,14 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sdnc-adaptors 0.0.1-SNAPSHOT 4.0.0 pom - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource @@ -20,7 +20,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource-features features xml @@ -28,7 +28,7 @@ - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource-provider ${project.version} diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index fd773af21..195a10e61 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.openecomp.sdnc.adaptors + org.onap.ccsdk.sli.adaptors sql-resource 0.0.1-SNAPSHOT -- cgit 1.2.3-korg From 806052bf4df8bd023cfb391794bc5937f2624716 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Wed, 2 Aug 2017 15:09:24 -0700 Subject: Convert tabs to spaces Per Java Code Style Guide: https://wiki.onap.org/display/DW/Java+code+style Converting tabs to 4 spaces. Issue-Id: SDNC-25 Change-Id: I99ce6c244df72f805b52d0d66403d8b76d9929ae Signed-off-by: Marcus G K Williams --- aai-service/features/pom.xml | 276 +-- .../features/src/main/resources/features.xml | 22 +- aai-service/installer/pom.xml | 262 +-- .../src/assembly/assemble_installer_zip.xml | 60 +- .../src/assembly/assemble_mvnrepo_zip.xml | 40 +- .../src/main/resources/scripts/install-feature.sh | 6 +- mdsal-resource/features/pom.xml | 234 +-- .../features/src/main/resources/features.xml | 2 +- mdsal-resource/installer/pom.xml | 252 +-- .../src/assembly/assemble_installer_zip.xml | 60 +- .../src/assembly/assemble_mvnrepo_zip.xml | 40 +- .../src/main/resources/scripts/install-feature.sh | 6 +- mdsal-resource/pom.xml | 24 +- mdsal-resource/provider/pom.xml | 220 +-- .../sdnc/sli/resource/mdsal/ConfigResource.java | 160 +- .../sli/resource/mdsal/MdsalResourceActivator.java | 90 +- .../sli/resource/mdsal/OperationalResource.java | 150 +- .../sdnc/sli/resource/mdsal/RestService.java | 326 ++-- .../provider/src/main/resources/crtables.sql | 2 +- .../src/main/resources/svclogic.properties | 2 +- pom.xml | 228 +-- resource-assignment/features/pom.xml | 234 +-- .../features/src/main/resources/features.xml | 2 +- resource-assignment/installer/pom.xml | 252 +-- .../src/assembly/assemble_installer_zip.xml | 60 +- .../src/assembly/assemble_mvnrepo_zip.xml | 40 +- .../src/main/resources/scripts/install-feature.sh | 8 +- resource-assignment/pom.xml | 32 +- resource-assignment/provider/pom.xml | 214 ++- .../org/openecomp/sdnc/lock/comp/LockHelper.java | 10 +- .../openecomp/sdnc/lock/comp/LockHelperImpl.java | 264 +-- .../sdnc/lock/comp/ResourceLockedException.java | 26 +- .../sdnc/lock/comp/SynchronizedFunction.java | 54 +- .../openecomp/sdnc/lock/dao/ResourceLockDao.java | 16 +- .../sdnc/lock/dao/ResourceLockDaoImpl.java | 156 +- .../org/openecomp/sdnc/lock/data/ResourceLock.java | 14 +- .../org/openecomp/sdnc/ra/ReleaseRequestType.java | 36 +- .../org/openecomp/sdnc/ra/ReserveRequestType.java | 32 +- .../org/openecomp/sdnc/ra/ResourceAllocator.java | 1892 ++++++++++---------- .../sdnc/ra/alloc/AffinityAllocationRule.java | 62 +- .../openecomp/sdnc/ra/alloc/DbAllocationRule.java | 218 +-- .../sdnc/ra/alloc/ServingSiteAllocationRule.java | 76 +- .../openecomp/sdnc/ra/alloc/VrfAllocationRule.java | 128 +- .../sdnc/ra/check/AnyVrfPresentCheck.java | 62 +- .../openecomp/sdnc/ra/check/ExcludeVpeCheck.java | 48 +- .../openecomp/sdnc/ra/check/HubWithRgCheck.java | 138 +- .../org/openecomp/sdnc/ra/check/OneMVrfCheck.java | 104 +- .../openecomp/sdnc/ra/check/ProvStatusCheck.java | 30 +- .../openecomp/sdnc/ra/check/VlanSpeedCheck.java | 32 +- .../org/openecomp/sdnc/ra/check/VpeLockCheck.java | 148 +- .../org/openecomp/sdnc/ra/comp/AllocationRule.java | 18 +- .../sdnc/ra/comp/EndPointAllocationDefinition.java | 50 +- .../openecomp/sdnc/ra/comp/EndPointAllocator.java | 14 +- .../sdnc/ra/comp/EndPointAllocatorImpl.java | 336 ++-- .../org/openecomp/sdnc/ra/comp/EndPointData.java | 12 +- .../org/openecomp/sdnc/ra/comp/EquipmentCheck.java | 12 +- .../org/openecomp/sdnc/ra/comp/PreferenceRule.java | 6 +- .../org/openecomp/sdnc/ra/comp/ServiceData.java | 18 +- .../sdnc/ra/equip/comp/EquipmentReader.java | 4 +- .../org/openecomp/sdnc/ra/equip/dao/ServerDao.java | 4 +- .../openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java | 46 +- .../openecomp/sdnc/ra/equip/dao/VpePortDao.java | 6 +- .../sdnc/ra/equip/dao/VpePortDaoImpl.java | 74 +- .../openecomp/sdnc/ra/equip/dao/VplspePortDao.java | 4 +- .../sdnc/ra/equip/dao/VplspePortDaoImpl.java | 58 +- .../sdnc/ra/equip/data/EquipmentData.java | 8 +- .../sdnc/ra/equip/data/EquipmentLevel.java | 4 +- .../openecomp/sdnc/ra/pref/AffinityLinkPref.java | 76 +- .../openecomp/sdnc/ra/pref/EvcExistingVrfPref.java | 42 +- .../openecomp/sdnc/ra/reader/AicSiteReader.java | 24 +- .../sdnc/ra/reader/UplinkCircuitReader.java | 42 +- .../org/openecomp/sdnc/ra/reader/VnfReader.java | 24 +- .../openecomp/sdnc/ra/reader/VpePortReader.java | 60 +- .../ra/rule/comp/AllocationRequestBuilder.java | 20 +- .../ra/rule/comp/AllocationRequestBuilderImpl.java | 250 +-- .../sdnc/ra/rule/dao/MaxPortSpeedDao.java | 6 +- .../sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java | 78 +- .../sdnc/ra/rule/dao/MaxServerSpeedDao.java | 6 +- .../sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java | 80 +- .../openecomp/sdnc/ra/rule/dao/ParameterDao.java | 4 +- .../sdnc/ra/rule/dao/ParameterDaoImpl.java | 36 +- .../openecomp/sdnc/ra/rule/dao/RangeRuleDao.java | 4 +- .../sdnc/ra/rule/dao/RangeRuleDaoImpl.java | 58 +- .../sdnc/ra/rule/dao/ResourceRuleDao.java | 14 +- .../sdnc/ra/rule/dao/ResourceRuleDaoImpl.java | 160 +- .../org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java | 4 +- .../openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java | 26 +- .../org/openecomp/sdnc/ra/rule/data/RangeRule.java | 16 +- .../openecomp/sdnc/ra/rule/data/ResourceRule.java | 24 +- .../sdnc/ra/rule/data/ResourceThreshold.java | 6 +- .../sdnc/ra/rule/data/ThresholdStatus.java | 14 +- .../sdnc/ra/service/dao/ServiceResourceDao.java | 12 +- .../ra/service/dao/ServiceResourceDaoImpl.java | 148 +- .../sdnc/ra/service/data/ServiceResource.java | 14 +- .../sdnc/ra/service/data/ServiceStatus.java | 4 +- .../openecomp/sdnc/rm/comp/AllocationFunction.java | 534 +++--- .../openecomp/sdnc/rm/comp/ReleaseFunction.java | 84 +- .../org/openecomp/sdnc/rm/comp/ResourceLoader.java | 12 +- .../openecomp/sdnc/rm/comp/ResourceManager.java | 12 +- .../sdnc/rm/comp/ResourceManagerImpl.java | 178 +- .../org/openecomp/sdnc/rm/dao/ResourceDao.java | 12 +- .../openecomp/sdnc/rm/dao/jdbc/AllocationItem.java | 20 +- .../sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java | 10 +- .../rm/dao/jdbc/AllocationItemJdbcDaoImpl.java | 170 +- .../org/openecomp/sdnc/rm/dao/jdbc/Resource.java | 14 +- .../sdnc/rm/dao/jdbc/ResourceDaoImpl.java | 660 +++---- .../sdnc/rm/dao/jdbc/ResourceJdbcDao.java | 14 +- .../sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 206 +-- .../openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java | 12 +- .../sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java | 10 +- .../sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java | 142 +- .../openecomp/sdnc/rm/data/AllocationAction.java | 4 +- .../org/openecomp/sdnc/rm/data/AllocationItem.java | 16 +- .../openecomp/sdnc/rm/data/AllocationOutcome.java | 6 +- .../openecomp/sdnc/rm/data/AllocationRequest.java | 16 +- .../openecomp/sdnc/rm/data/AllocationStatus.java | 4 +- .../org/openecomp/sdnc/rm/data/InitAction.java | 18 +- .../sdnc/rm/data/LabelAllocationItem.java | 4 +- .../sdnc/rm/data/LabelAllocationOutcome.java | 6 +- .../sdnc/rm/data/LabelAllocationRequest.java | 8 +- .../org/openecomp/sdnc/rm/data/LabelResource.java | 8 +- .../sdnc/rm/data/LimitAllocationItem.java | 4 +- .../sdnc/rm/data/LimitAllocationOutcome.java | 8 +- .../sdnc/rm/data/LimitAllocationRequest.java | 12 +- .../org/openecomp/sdnc/rm/data/LimitResource.java | 4 +- .../sdnc/rm/data/MultiAssetAllocationOutcome.java | 6 +- .../sdnc/rm/data/MultiAssetAllocationRequest.java | 10 +- .../rm/data/MultiResourceAllocationOutcome.java | 4 +- .../rm/data/MultiResourceAllocationRequest.java | 6 +- .../sdnc/rm/data/RangeAllocationItem.java | 4 +- .../sdnc/rm/data/RangeAllocationOutcome.java | 6 +- .../sdnc/rm/data/RangeAllocationRequest.java | 18 +- .../org/openecomp/sdnc/rm/data/RangeResource.java | 4 +- .../java/org/openecomp/sdnc/rm/data/Resource.java | 10 +- .../org/openecomp/sdnc/rm/data/ResourceKey.java | 44 +- .../org/openecomp/sdnc/rm/data/ResourceLoad.java | 10 +- .../org/openecomp/sdnc/rm/data/ResourceType.java | 4 +- .../java/org/openecomp/sdnc/rm/util/LabelUtil.java | 104 +- .../java/org/openecomp/sdnc/rm/util/LimitUtil.java | 586 +++--- .../java/org/openecomp/sdnc/rm/util/RangeUtil.java | 126 +- .../org/openecomp/sdnc/rm/util/ResourceUtil.java | 32 +- .../sdnc/util/db/CachedDataSourceWrap.java | 174 +- .../org/openecomp/sdnc/util/db/ConnectionWrap.java | 588 +++--- .../org/openecomp/sdnc/util/db/DataSourceWrap.java | 96 +- .../sdnc/util/expr/ExpressionEvaluator.java | 360 ++-- .../org/openecomp/sdnc/util/speed/SpeedUtil.java | 28 +- .../java/org/openecomp/sdnc/util/str/StrUtil.java | 532 +++--- .../java/org/openecomp/sdnc/util/vrf/VpnParam.java | 10 +- .../java/org/openecomp/sdnc/util/vrf/VrfUtil.java | 84 +- .../spring/resource-assignment-context.xml | 518 +++--- .../spring/resource-assignment-osgi-context.xml | 20 +- .../main/resources/sql/001_resource_rule_ddl.sql | 20 +- .../main/resources/sql/002_max_port_speed_ddl.sql | 14 +- .../resources/sql/003_max_server_speed_ddl.sql | 12 +- .../jtest/org/openecomp/sdnc/ra/DataSetup.java | 462 ++--- .../org/openecomp/sdnc/ra/TestIsAvailable.java | 708 ++++---- .../jtest/org/openecomp/sdnc/ra/TestQuery.java | 66 +- .../jtest/org/openecomp/sdnc/ra/TestRelease.java | 574 +++--- .../jtest/org/openecomp/sdnc/ra/TestReserve.java | 1272 ++++++------- .../jtest/org/openecomp/sdnc/ra/TestReserve2.java | 54 +- .../jtest/org/openecomp/sdnc/rm/DataSetup.java | 152 +- .../jtest/util/org/openecomp/sdnc/ra/TestDb.java | 16 +- .../util/org/openecomp/sdnc/ra/TestTable.java | 94 +- .../provider/src/test/resources/homing-req.json | 48 +- .../provider/src/test/resources/log4j.properties | 2 +- .../provider/src/test/resources/sql/data.sql | 40 +- .../provider/src/test/resources/sql/schema.sql | 192 +- .../provider/src/test/resources/test-context.xml | 546 +++--- 168 files changed, 9315 insertions(+), 9325 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 207113664..9259d6cd1 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -1,155 +1,155 @@ - 4.0.0 - - aai-service - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - aai-service-features - AAI Interface Service - Features + 4.0.0 + + aai-service + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + aai-service-features + AAI Interface Service - Features - jar + jar - + - - org.onap.ccsdk.sli.adaptors - aai-service-provider - ${project.version} - + + org.onap.ccsdk.sli.adaptors + aai-service-provider + ${project.version} + - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml + + org.opendaylight.mdsal + features-mdsal + ${odl.mdsal.features.version} + features + xml - runtime - + runtime + - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - + + + org.opendaylight.odlparent + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + zip + - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - + + + org.opendaylight.odlparent + features-test + ${odl.commons.opendaylight.version} + test + - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - + + 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 - - + + 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 - - - - - - - - + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + + org.opendaylight.controller + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + + + org.opendaylight.yangtools:features-test + + + + --> + + 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 index 2f3ac734d..23ab99764 100644 --- a/aai-service/features/src/main/resources/features.xml +++ b/aai-service/features/src/main/resources/features.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,15 +32,15 @@ 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} - + 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 index 6668eca0a..91db2ca8b 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -1,144 +1,144 @@ - 4.0.0 - - aai-service - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - aai-service-installer - AAI Adaptor - Karaf Installer - pom + 4.0.0 + + aai-service + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + aai-service-installer + AAI Adaptor - Karaf Installer + pom - - sdnc-aai-service - sdnc-aai-service - mvn:org.onap.ccsdk.sli.adaptors/aai-service-features/${project.version}/xml/features - false - + + sdnc-aai-service + sdnc-aai-service + mvn:org.onap.ccsdk.sli.adaptors/aai-service-features/${project.version}/xml/features + false + - + - - org.onap.ccsdk.sli.adaptors - aai-service-features - ${project.version} - features - xml - - - * - * - - - + + org.onap.ccsdk.sli.adaptors + aai-service-features + ${project.version} + features + xml + + + * + * + + + - - org.onap.ccsdk.sli.adaptors - aai-service-provider - ${project.version} - + + org.onap.ccsdk.sli.adaptors + aai-service-provider + ${project.version} + - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${jvnet.jaxb2.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.onap.ccsdk,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 - - - - + + + + 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.onap.ccsdk,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 index e278872a1..5f32ff4ce 100644 --- a/aai-service/installer/src/assembly/assemble_installer_zip.xml +++ b/aai-service/installer/src/assembly/assemble_installer_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,37 +22,37 @@ - installer_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + installer_zip + + zip + - - false + + false - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - + + + 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 index 1edacdb6d..6b7d23f89 100644 --- a/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,27 +22,27 @@ - mvnrepo_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + mvnrepo_zip + + zip + - - false + + false - - - target/assembly/ - . - - - - + + + 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 index 9a47d2225..214dbbe7e 100644 --- a/aai-service/installer/src/main/resources/scripts/install-feature.sh +++ b/aai-service/installer/src/main/resources/scripts/install-feature.sh @@ -30,10 +30,10 @@ REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip if [ -f ${REPOZIP} ] then - unzip -d ${ODL_HOME} ${REPOZIP} + unzip -d ${ODL_HOME} ${REPOZIP} else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 fi ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index fbad6e210..140810ff9 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -1,134 +1,134 @@ - 4.0.0 - - mdsal-resource - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - mdsal-resource-features - MD-SAL Resource Adaptor - Features + 4.0.0 + + mdsal-resource + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + mdsal-resource-features + MD-SAL Resource Adaptor - Features - jar + jar - + - - org.onap.ccsdk.sli.adaptors - mdsal-resource-provider - ${project.version} - + + org.onap.ccsdk.sli.adaptors + mdsal-resource-provider + ${project.version} + - - commons-lang - commons-lang - 2.6 - compile - + + commons-lang + commons-lang + 2.6 + compile + - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml + + org.opendaylight.mdsal + features-mdsal + ${odl.mdsal.features.version} + features + xml - runtime - + runtime + - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - + + + org.opendaylight.odlparent + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + zip + - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - + + + org.opendaylight.odlparent + features-test + ${odl.commons.opendaylight.version} + test + - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - + + 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 - - - - - - - - + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + + org.opendaylight.controller + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + + + org.opendaylight.yangtools:features-test + + + + --> + + 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 index 5f4a954b4..6ed0b1ebe 100644 --- a/mdsal-resource/features/src/main/resources/features.xml +++ b/mdsal-resource/features/src/main/resources/features.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 0e52c1306..d636f8d91 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -1,138 +1,138 @@ - 4.0.0 - - mdsal-resource - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - mdsal-resource-installer - MDSAL Resource - Karaf Installer - pom + 4.0.0 + + mdsal-resource + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + mdsal-resource-installer + MDSAL Resource - Karaf Installer + pom - - sdnc-mdsal-resource - sdnc-mdsal-resource - mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features - false - + + sdnc-mdsal-resource + sdnc-mdsal-resource + mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features + false + - + - - org.onap.ccsdk.sli.adaptors - mdsal-resource-features - ${project.version} - features - xml - - - * - * - - - + + org.onap.ccsdk.sli.adaptors + mdsal-resource-features + ${project.version} + features + xml + + + * + * + + + - - org.onap.ccsdk.sli.adaptors - mdsal-resource-provider - ${project.version} - + + org.onap.ccsdk.sli.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.onap.ccsdk - 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 - - - - + + + + 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.onap.ccsdk + 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 index e278872a1..5f32ff4ce 100644 --- a/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml +++ b/mdsal-resource/installer/src/assembly/assemble_installer_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,37 +22,37 @@ - installer_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + installer_zip + + zip + - - false + + false - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - + + + 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 index 1edacdb6d..6b7d23f89 100644 --- a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,27 +22,27 @@ - mvnrepo_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + mvnrepo_zip + + zip + - - false + + false - - - target/assembly/ - . - - - - + + + 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 index 9a47d2225..214dbbe7e 100644 --- a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh +++ b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh @@ -30,10 +30,10 @@ REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip if [ -f ${REPOZIP} ] then - unzip -d ${ODL_HOME} ${REPOZIP} + unzip -d ${ODL_HOME} ${REPOZIP} else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 fi ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 4501edd14..a6f68b434 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -1,21 +1,21 @@ - - org.onap.ccsdk.sli.adaptors - sdnc-adaptors - 0.0.1-SNAPSHOT - + + org.onap.ccsdk.sli.adaptors + sdnc-adaptors + 0.0.1-SNAPSHOT + - 4.0.0 - pom - org.onap.ccsdk.sli.adaptors - mdsal-resource + 4.0.0 + pom + org.onap.ccsdk.sli.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 + MD-SAL Resource Adaptor + The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - 0.0.1-SNAPSHOT + 0.0.1-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 0092f6996..92dada640 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -1,122 +1,122 @@ - 4.0.0 - - org.onap.ccsdk.sli.adaptors - mdsal-resource - 0.0.1-SNAPSHOT - - mdsal-resource-provider - bundle - MD-SAL Resource Adaptor - Provider - http://maven.apache.org - - UTF-8 - - + 4.0.0 + + org.onap.ccsdk.sli.adaptors + mdsal-resource + 0.0.1-SNAPSHOT + + mdsal-resource-provider + bundle + MD-SAL Resource Adaptor - Provider + http://maven.apache.org + + UTF-8 + + - - junit - junit - 3.8.1 - test - - - org.onap.ccsdk.sli.core - sli-common - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.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} - + + junit + junit + 3.8.1 + test + + + org.onap.ccsdk.sli.core + sli-common + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.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.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 - - - - - - - - - - - - - + + + + + + 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 index ed0ed0638..4a89ad8f6 100644 --- 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 @@ -33,118 +33,118 @@ import org.w3c.dom.Document; public class ConfigResource implements SvcLogicResource { - private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); + private static final Logger LOG = LoggerFactory.getLogger(ConfigResource.class); - private RestService restService; + 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); - } + 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 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 - { + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { - return(query(resource, false, null, key, prefix, null, null)); + 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 { + @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 module = resource; + StringBuffer restQuery = new StringBuffer(); - String[] keyParts = key.split("/"); + String[] keyParts = key.split("/"); - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { + for (String keyPart : keyParts) { + if (restQuery.length() > 0) { + restQuery.append("/"); + } + if (keyPart.startsWith("$")) { - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } + 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 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; + String urlString = "restconf/config/" + module + ":" + restQueryStr; LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - Document results = restService.get(urlString); + Document results = restService.get(urlString); - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { + if (results == null) { + return(QueryStatus.NOT_FOUND); + } else { - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } + 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 { + @Override + public QueryStatus reserve(String resource, String select, String key, String prefix, + SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); + return(QueryStatus.SUCCESS); - } + } - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + 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 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 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); - } + @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); - } + 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 index ea0bab263..9be03e9d4 100644 --- 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 @@ -38,69 +38,69 @@ public class MdsalResourceActivator implements BundleActivator { - private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - public LinkedList registrations = new LinkedList(); + public LinkedList registrations = new LinkedList(); - private static final Logger LOG = LoggerFactory - .getLogger(MdsalResourceActivator.class); + private static final Logger LOG = LoggerFactory + .getLogger(MdsalResourceActivator.class); - @Override - public void start(BundleContext ctx) throws Exception { + @Override + public void start(BundleContext ctx) throws Exception { - // Read properties - Properties props = new Properties(); + // Read properties + Properties props = new Properties(); - String propDir = System.getenv(SDNC_CONFIG_DIR); - if (propDir == null) { + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { - propDir = "/opt/sdnc/data/properties"; - } - String propPath = propDir + "/mdsal-resource.properties"; + propDir = "/opt/sdnc/data/properties"; + } + String propPath = propDir + "/mdsal-resource.properties"; - File propFile = new File(propPath); + File propFile = new File(propPath); - if (!propFile.exists()) { + if (!propFile.exists()) { - throw new ConfigurationException( - "Missing configuration properties file : " - + propFile); - } - try { + 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); + 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"); + 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); + // 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)); + 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); + 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)); - } + 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 { + @Override + public void stop(BundleContext ctx) throws Exception { - for (ServiceRegistration registration : registrations) - { - registration.unregister(); - } - } + 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 index 32323e3b1..9374d2ab4 100644 --- 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 @@ -33,52 +33,52 @@ import org.w3c.dom.Document; public class OperationalResource implements SvcLogicResource { - private static final Logger LOG = LoggerFactory.getLogger(OperationalResource.class); + private static final Logger LOG = LoggerFactory.getLogger(OperationalResource.class); - private RestService restService; + 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); + 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 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 - { + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException + { - return(query(resource, false, null, key, prefix, null, null)); + 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 { + @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 module = resource; + StringBuffer restQuery = new StringBuffer(); - String[] keyParts = key.split("/"); + String[] keyParts = key.split("/"); - for (String keyPart : keyParts) { - if (restQuery.length() > 0) { - restQuery.append("/"); - } - if (keyPart.startsWith("$")) { + for (String keyPart : keyParts) { + if (restQuery.length() > 0) { + restQuery.append("/"); + } + if (keyPart.startsWith("$")) { - restQuery.append(ctx.resolve(keyPart.substring(1))); - } else { - restQuery.append(keyPart); - } - } + restQuery.append(ctx.resolve(keyPart.substring(1))); + } else { + restQuery.append(keyPart); + } + } String restQueryStr = restQuery.toString(); if ((restQueryStr.startsWith("'") && restQueryStr.endsWith("'")) || @@ -86,66 +86,66 @@ public class OperationalResource implements SvcLogicResource { restQueryStr = restQueryStr.substring(1, restQueryStr.length()-1); } - String urlString = "restconf/operational/" + module + ":" + restQueryStr; + String urlString = "restconf/operational/" + module + ":" + restQueryStr; LOG.info("Querying resource: " + resource + ". At URL: " + urlString); - Document results = restService.get(urlString); + Document results = restService.get(urlString); - if (results == null) { - return(QueryStatus.NOT_FOUND); - } else { + if (results == null) { + return(QueryStatus.NOT_FOUND); + } else { - if (ctx != null) { - ctx.mergeDocument(prefix, results); - } - return(QueryStatus.SUCCESS); - } + 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 { + @Override + public QueryStatus reserve(String resource, String select, String key, String prefix, + SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); + return(QueryStatus.SUCCESS); - } + } - @Override - public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + @Override + public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - return(QueryStatus.SUCCESS); - } + 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 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 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); - } + @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); - } + 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 index 21d3439d4..a7b77e5bd 100644 --- 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 @@ -46,167 +46,167 @@ 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")); - } + + 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/crtables.sql b/mdsal-resource/provider/src/main/resources/crtables.sql index a5dea5bf0..f8f57166e 100644 --- a/mdsal-resource/provider/src/main/resources/crtables.sql +++ b/mdsal-resource/provider/src/main/resources/crtables.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/mdsal-resource/provider/src/main/resources/svclogic.properties b/mdsal-resource/provider/src/main/resources/svclogic.properties index 1a2cf0c78..e113161e8 100644 --- a/mdsal-resource/provider/src/main/resources/svclogic.properties +++ b/mdsal-resource/provider/src/main/resources/svclogic.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 ONAP Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/pom.xml b/pom.xml index a50a21429..e387445de 100755 --- a/pom.xml +++ b/pom.xml @@ -1,119 +1,119 @@ - - - org.onap.ccsdk.parent - odlparent-boron-sr3 - 0.0.1-SNAPSHOT - - - 4.0.0 - pom - org.onap.ccsdk.sli.adaptors - sdnc-adaptors - - 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 - - 0.0.1-SNAPSHOT + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + + org.onap.ccsdk.parent + odlparent-boron-sr3 + 0.0.1-SNAPSHOT + + + 4.0.0 + pom + org.onap.ccsdk.sli.adaptors + sdnc-adaptors + + 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 + + 0.0.1-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 9e718e7a9..338f7a1d1 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -1,133 +1,133 @@ - 4.0.0 - - resource-assignment - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - resource-assignment-features - Resource Assignment Adaptor - Features + 4.0.0 + + resource-assignment + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + resource-assignment-features + Resource Assignment Adaptor - Features - jar + jar - + - - org.onap.ccsdk.sli.adaptors - resource-assignment-provider - ${project.version} - + + org.onap.ccsdk.sli.adaptors + resource-assignment-provider + ${project.version} + - - commons-lang - commons-lang - 2.6 - compile - + + commons-lang + commons-lang + 2.6 + compile + - - org.opendaylight.mdsal - features-mdsal - ${odl.mdsal.features.version} - features - xml + + org.opendaylight.mdsal + features-mdsal + ${odl.mdsal.features.version} + features + xml - runtime - + runtime + - - - org.opendaylight.odlparent - opendaylight-karaf-empty - ${odl.karaf.empty.distro.version} - zip - + + + org.opendaylight.odlparent + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + zip + - - - org.opendaylight.odlparent - features-test - ${odl.commons.opendaylight.version} - test - + + + org.opendaylight.odlparent + features-test + ${odl.commons.opendaylight.version} + test + - - org.opendaylight.yangtools - features-yangtools - ${odl.yangtools.version} - features - xml - runtime - - + + 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 - - - - - - - - + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + + org.opendaylight.controller + opendaylight-karaf-empty + ${odl.karaf.empty.distro.version} + + + org.opendaylight.yangtools:features-test + + + + --> + + 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 index 01c55789a..2834914ae 100644 --- a/resource-assignment/features/src/main/resources/features.xml +++ b/resource-assignment/features/src/main/resources/features.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 900f0444f..19359dc9f 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -1,138 +1,138 @@ - 4.0.0 - - resource-assignment - org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT - - resource-assignment-installer - Resource allocator- Karaf Installer - pom + 4.0.0 + + resource-assignment + org.onap.ccsdk.sli.adaptors + 0.0.1-SNAPSHOT + + resource-assignment-installer + Resource allocator- Karaf Installer + pom - - sdnc-resource-assignment - sdnc-resource-assignment - mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-features/${project.version}/xml/features - false - + + sdnc-resource-assignment + sdnc-resource-assignment + mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-features/${project.version}/xml/features + false + - + - - org.onap.ccsdk.sli.adaptors - resource-assignment-features - ${project.version} - features - xml - - - * - * - - - + + org.onap.ccsdk.sli.adaptors + resource-assignment-features + ${project.version} + features + xml + + + * + * + + + - - org.onap.ccsdk.sli.adaptors - resource-assignment-provider - ${project.version} - + + org.onap.ccsdk.sli.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.onap.ccsdk - 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 - - - - + + + + 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.onap.ccsdk + 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 index e278872a1..40e2f26a0 100644 --- a/resource-assignment/installer/src/assembly/assemble_installer_zip.xml +++ b/resource-assignment/installer/src/assembly/assemble_installer_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,37 +22,37 @@ - installer_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + installer_zip + + zip + - - false + + false - - - target/stage/ - ${application.name} - 755 - - *.sh - - - - target/stage/ - ${application.name} - 644 - - *.sh - - - + + + 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 index 1edacdb6d..7304fe500 100644 --- a/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -3,7 +3,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,27 +22,27 @@ - mvnrepo_zip - - zip - + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + mvnrepo_zip + + zip + - - false + + false - - - target/assembly/ - . - - - - + + + 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 index 9a47d2225..9b6877185 100644 --- a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh +++ b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh @@ -5,7 +5,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 ONAP Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip if [ -f ${REPOZIP} ] then - unzip -d ${ODL_HOME} ${REPOZIP} + unzip -d ${ODL_HOME} ${REPOZIP} else - echo "ERROR : repo zip ($REPOZIP) not found" - exit 1 + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 fi ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index e0e140f20..5e44d5ffb 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -1,25 +1,25 @@ - - org.onap.ccsdk.sli.adaptors - sdnc-adaptors - 0.0.1-SNAPSHOT - + + org.onap.ccsdk.sli.adaptors + sdnc-adaptors + 0.0.1-SNAPSHOT + - 4.0.0 - pom - org.onap.ccsdk.sli.adaptors - resource-assignment - 0.0.1-SNAPSHOT + 4.0.0 + pom + org.onap.ccsdk.sli.adaptors + resource-assignment + 0.0.1-SNAPSHOT - Resource Assignment Adaptor - The resource assignment adaptor allows service logic to check and allocate network capacity + Resource Assignment Adaptor + The resource assignment adaptor allows service logic to check and allocate network capacity - - - - org.onap.ccsdk.sli.adaptors + + + + org.onap.ccsdk.sli.adaptors resource-assignment-features features xml diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index f6d7fede7..4d801522d 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -1,115 +1,105 @@ - 4.0.0 - - org.onap.ccsdk.sli.adaptors - resource-assignment - 0.0.1-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.onap.ccsdk.sli.core - sli-common - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.core - sli-provider - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.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 - - - - - - - - - - - + 4.0.0 + + org.onap.ccsdk.sli.adaptors + resource-assignment + 0.0.1-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.onap.ccsdk.sli.core + sli-common + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.core + sli-provider + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.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 index acdce65ec..5e179dc48 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ import java.util.Collection; public interface LockHelper { - void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */); + void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */); - void unlock(String resourceName, boolean force); + void unlock(String resourceName, boolean force); - void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */); + void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */); - void unlock(Collection resourceNameList, boolean force); + 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 index 306fc162d..62b88c67a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,135 +32,135 @@ 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; - } + 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 index 8e3142cc0..eb3f33418 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,19 +23,19 @@ package org.openecomp.sdnc.lock.comp; public class ResourceLockedException extends RuntimeException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private String lockName, lockHolder, lockRequester; + private String lockName, lockHolder, lockRequester; - public ResourceLockedException(String lockName, String lockHolder, String lockRequester) { - this.lockName = lockName; - this.lockHolder = lockHolder; - this.lockRequester = 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 + - "]."; - } + @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 index a76fca11c..c3e35b700 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,30 +27,30 @@ 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); - } + 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 index 014765dfb..5ccde824a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,17 +27,17 @@ import org.openecomp.sdnc.lock.data.ResourceLock; public interface ResourceLockDao { - void lockTable(); + void lockTable(); - void unlockTable(); + void unlockTable(); - void add(ResourceLock l); + void add(ResourceLock l); - void update(long id, Date lockTime, Date expirationTime, int lockCount); + void update(long id, Date lockTime, Date expirationTime, int lockCount); - ResourceLock getByResourceName(String resourceName); + ResourceLock getByResourceName(String resourceName); - void delete(long id); + void delete(long id); - void decrementLockCount(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 index f4819b837..9a619763c 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,81 +35,81 @@ 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; - } + 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 index 561fd82a4..4e27fd954 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,10 @@ 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; + 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 index 52104ec5f..0e3754527 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,24 +22,24 @@ package org.openecomp.sdnc.ra; public enum ReleaseRequestType { - Cancel, Activate, Disconnect; + 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; + 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; + 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."); - } + 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 index d9964331e..b0d0a50c4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,22 +22,22 @@ package org.openecomp.sdnc.ra; public enum ReserveRequestType { - New, Change; + 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; + 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; + if (s.equalsIgnoreCase("New")) + return New; + if (s.equalsIgnoreCase("Change")) + return Change; - throw new IllegalArgumentException("Invalid request-type: " + s + - ". Supported values are New, 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 index ae281cf1f..e6a2c80cc 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,949 +68,949 @@ 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; - } + 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 index b77df92a7..7245216f3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,37 +32,37 @@ import org.slf4j.LoggerFactory; public class AffinityAllocationRule implements AllocationRule { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(AffinityAllocationRule.class); + @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"; + @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"); + 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; - } + 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 index a066378ac..847883957 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,112 +44,112 @@ 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; - } + 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 index cb36a8bef..cf1dd8f8e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,47 +34,47 @@ import org.slf4j.LoggerFactory; public class ServingSiteAllocationRule implements AllocationRule { - private static final Logger log = LoggerFactory.getLogger(ServingSiteAllocationRule.class); + 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; + @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); + 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; + 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); + 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; + 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; - } + 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 index f23f1e985..cc4adfb3e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,75 +37,75 @@ import org.slf4j.LoggerFactory; public class VrfAllocationRule implements AllocationRule { - private static final Logger log = LoggerFactory.getLogger(VrfAllocationRule.class); + 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; + @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); + log.info("vrfName: " + vrfName); - Set resourceShareGroupList = new HashSet<>(); - resourceShareGroupList.add(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; + 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; + 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); + 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 mar; + } - return ar; - } + 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 index aee761c7e..fd9ca1e55 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,41 +34,41 @@ import org.slf4j.LoggerFactory; public class AnyVrfPresentCheck implements EquipmentCheck { - private static final Logger log = LoggerFactory.getLogger(AnyVrfPresentCheck.class); + private static final Logger log = LoggerFactory.getLogger(AnyVrfPresentCheck.class); - private ResourceManager resourceManager; + 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; + @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 vrfRequiredStr = (String) equipmentConstraints.get("vrf-required"); + if (vrfRequiredStr == null || !vrfRequiredStr.equalsIgnoreCase("true")) + return true; - String[] vrfNameList = vrfNameListStr.split(","); + 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; + 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; - } + 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; - } + 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 index 25571fb2d..7ceac9020 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,27 +31,27 @@ 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; - } + 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 index 6c2b4c591..79428de84 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,72 +36,72 @@ 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; - } + 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 index 56fd535e7..82e7e01a0 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,65 +36,65 @@ import org.slf4j.LoggerFactory; public class OneMVrfCheck implements EquipmentCheck { - private static final Logger log = LoggerFactory.getLogger(OneMVrfCheck.class); + private static final Logger log = LoggerFactory.getLogger(OneMVrfCheck.class); - private ResourceManager resourceManager; + 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; + @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; + 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; + // 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; + 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) { + // 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; + // 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; - } - } - } - } + 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; - } + return true; + } - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } + 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 index baed60eb5..1ec079f9b 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,19 +31,19 @@ import org.slf4j.LoggerFactory; public class ProvStatusCheck implements EquipmentCheck { - private static final Logger log = LoggerFactory.getLogger(ProvStatusCheck.class); + 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; - } + @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 index 4644a14a7..57b8f0377 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,20 +31,20 @@ import org.slf4j.LoggerFactory; public class VlanSpeedCheck implements EquipmentCheck { - private static final Logger log = LoggerFactory.getLogger(VlanSpeedCheck.class); + 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; - } + @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 index 3b350b419..fe7bd30db 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,77 +35,77 @@ 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; - } + 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 index 0877933b6..260d9d016 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,12 +26,12 @@ 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); + 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 index 21e49c3a1..5a5623c12 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,34 +27,34 @@ 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 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 setServiceModel(String serviceModel) { + this.serviceModel = serviceModel; + } - public void setEndPointPosition(String endPointPosition) { - this.endPointPosition = endPointPosition; - } + public void setEndPointPosition(String endPointPosition) { + this.endPointPosition = endPointPosition; + } - public void setEquipmentReader(EquipmentReader equipmentReader) { - this.equipmentReader = equipmentReader; - } + public void setEquipmentReader(EquipmentReader equipmentReader) { + this.equipmentReader = equipmentReader; + } - public void setEquipmentCheckList(List equipmentCheckList) { - this.equipmentCheckList = equipmentCheckList; - } + public void setEquipmentCheckList(List equipmentCheckList) { + this.equipmentCheckList = equipmentCheckList; + } - public void setPreferenceRuleList(List preferenceRuleList) { - this.preferenceRuleList = preferenceRuleList; - } + public void setPreferenceRuleList(List preferenceRuleList) { + this.preferenceRuleList = preferenceRuleList; + } - public void setAllocationRuleList(List allocationRuleList) { - this.allocationRuleList = allocationRuleList; - } + 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 index 645c953c0..e817d587e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,10 @@ import java.util.Map; public interface EndPointAllocator { - List allocateEndPoints( - ServiceData serviceData, - Map equipmentConstraints, - boolean checkOnly, - boolean change, - int changeNumber); + 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 index 1af81434d..3d11f8e02 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,171 +44,171 @@ 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; - } + 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 index e425e373f..eb030f3e6 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ import java.util.Map; public class EndPointData { - public String resourceSetId; - public String resourceUnionId; - public String endPointPosition; - public String equipmentId; - public Map data; + 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 index fcca4f7c2..ab65b31e4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +27,9 @@ import org.openecomp.sdnc.ra.equip.data.EquipmentData; public interface EquipmentCheck { - boolean checkEquipment( - String endPointPosition, - ServiceData serviceData, - EquipmentData equipData, - Map equipmentConstraints); + 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 index acaf10d9e..d1287633f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,6 @@ import org.openecomp.sdnc.ra.equip.data.EquipmentData; public interface PreferenceRule { - // Smaller order number is preferred - int assignOrderNumber(String endPointPosition, ServiceData serviceData, EquipmentData equipData); + // 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 index 0d29e54f7..685f0988d 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ 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; + 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 index a380594ba..8e3247d11 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,5 +28,5 @@ import org.openecomp.sdnc.ra.equip.data.EquipmentData; public interface EquipmentReader { - List readEquipment(Map equipmentConstraints); + 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 index 44873873b..b90a0856f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,5 +26,5 @@ import java.util.Map; public interface ServerDao { - List> getServerData(String aicSiteId); + 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 index e1bc2a5a8..b0c62e5c5 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,33 +32,33 @@ import org.springframework.jdbc.core.JdbcTemplate; public class ServerDaoImpl implements ServerDao { - private static final Logger log = LoggerFactory.getLogger(ServerDaoImpl.class); + 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 static final String GET_SERVER_COUNT_SQL = "SELECT count(*) FROM PSERVER WHERE aic_site_id = ?"; - private JdbcTemplate jdbcTemplate; + 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; - } + @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); + private int getServerCount(String aicSiteId) { + int n = jdbcTemplate.queryForInt(GET_SERVER_COUNT_SQL, aicSiteId); - log.info("Number of servers in " + aicSiteId + ": " + n); + log.info("Number of servers in " + aicSiteId + ": " + n); - return n; - } + return n; + } - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + 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 index 4a0f6b8c0..052bf9edd 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import java.util.Map; public interface VpePortDao { - List> getVpePortData(String aicSiteId); + List> getVpePortData(String aicSiteId); - List> getVpePortData(String aicSiteId, String vpeName); + 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 index d25fe9c4c..d81e391cb 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,48 +34,48 @@ import org.springframework.jdbc.core.RowMapper; public class VpePortDaoImpl implements VpePortDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VpePortDaoImpl.class); + @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 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; + 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) { + 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 }; + @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()); - } + return jdbcTemplate.query(sql, param, new VpePortRowMapper()); + } - private static class VpePortRowMapper implements RowMapper> { + 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; - } - } + @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; - } + 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 index 879a233d7..dc32280f7 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,5 +26,5 @@ import java.util.Map; public interface VplspePortDao { - List> getVplspePortData(String aicSiteId); + 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 index bad646414..1f3aa8ef3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,37 +34,37 @@ import org.springframework.jdbc.core.RowMapper; public class VplspePortDaoImpl implements VplspePortDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VplspePortDaoImpl.class); + @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 static final String GET_SQL = "SELECT * FROM VPLSPE_POOL WHERE aic_site_id = ?"; - private JdbcTemplate jdbcTemplate; + private JdbcTemplate jdbcTemplate; - @Override - public List> getVplspePortData(String aicSiteId) { - List> ll = - jdbcTemplate.query(GET_SQL, new Object[] { aicSiteId }, new RowMapper>() { + @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; - } + @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; - } + 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 index d485224b0..ae2a4e7ce 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import java.util.Map; public class EquipmentData { - public String equipmentId; - public EquipmentLevel equipmentLevel; - public Map data; + 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 index 44ae593a0..fbf13fb5d 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,5 +22,5 @@ package org.openecomp.sdnc.ra.equip.data; public enum EquipmentLevel { - Port, Device, Server, Site + 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 index 09af2081d..cb3f78ec3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,51 +35,51 @@ import org.slf4j.LoggerFactory; public class AffinityLinkPref implements PreferenceRule { - private static final Logger log = LoggerFactory.getLogger(AffinityLinkPref.class); + private static final Logger log = LoggerFactory.getLogger(AffinityLinkPref.class); - private ResourceManager resourceManager; - private List affinityLinkIdList; + 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"); - } + 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) { + @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 + // 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); - } - } + 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); + equipData.data.put("affinity-link", preferedAffinityLinkId); - log.info("Prefered affinity link for " + equipData.equipmentId + ": " + preferedAffinityLinkId); + log.info("Prefered affinity link for " + equipData.equipmentId + ": " + preferedAffinityLinkId); - return 0; - } + return 0; + } - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } + public void setResourceManager(ResourceManager resourceManager) { + this.resourceManager = resourceManager; + } - public void setAffinityLinkIdList(List affinityLinkIdList) { - this.affinityLinkIdList = affinityLinkIdList; - } + 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 index abef0a24e..93c041ebf 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,29 +32,29 @@ import org.slf4j.LoggerFactory; public class EvcExistingVrfPref implements PreferenceRule { - private static final Logger log = LoggerFactory.getLogger(EvcExistingVrfPref.class); + private static final Logger log = LoggerFactory.getLogger(EvcExistingVrfPref.class); - private ResourceManager resourceManager; + 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; + @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; - } + 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; - } + log.info("VRF for VPN: " + vrfName + " NOT found on VPE: " + equipData.equipmentId); + return 2; + } - public void setResourceManager(ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } + 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 index 4040b0b44..1bf2ead02 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,18 +32,18 @@ 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"); + @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(); + EquipmentData equipData = new EquipmentData(); + equipData.equipmentLevel = EquipmentLevel.Site; + equipData.equipmentId = aicSiteId; + equipData.data = new HashMap(); - List equipList = new ArrayList<>(); - equipList.add(equipData); + List equipList = new ArrayList<>(); + equipList.add(equipData); - return equipList; - } + 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 index 0adf6d122..ad65c379a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,24 +31,24 @@ 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; - } + @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 index 7039370a0..ac53afe52 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,18 +32,18 @@ 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"); + @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(); + EquipmentData equipData = new EquipmentData(); + equipData.equipmentLevel = EquipmentLevel.Device; + equipData.equipmentId = vnfName; + equipData.data = new HashMap(); - List equipList = new ArrayList<>(); - equipList.add(equipData); + List equipList = new ArrayList<>(); + equipList.add(equipData); - return equipList; - } + 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 index 360f7806f..ba497c015 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,39 +32,39 @@ import org.openecomp.sdnc.ra.equip.data.EquipmentLevel; public class VpePortReader implements EquipmentReader { - private VpePortDao vpePortDao; + 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; - } - } + @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> 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; + 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); - } + equipList.add(equipData); + } - return equipList; - } + return equipList; + } - public void setVpePortDao(VpePortDao vpePortDao) { - this.vpePortDao = vpePortDao; - } + 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 index 44e4c53a6..c2d614161 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,14 +29,14 @@ import org.openecomp.sdnc.rm.data.LimitAllocationOutcome; public interface AllocationRequestBuilder { - AllocationRequest buildAllocationRequest( - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change); + AllocationRequest buildAllocationRequest( + ServiceData serviceData, + EquipmentData equipmentData, + boolean checkOnly, + boolean change); - ThresholdStatus getThresholdStatus( - ServiceData serviceData, - EquipmentData equipmentData, - LimitAllocationOutcome limitAllocationOutcome); + 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 index dbc0d8be9..37f9cb81a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,128 +45,128 @@ 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; - } + 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 index a56b78809..af6eca7e9 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ package org.openecomp.sdnc.ra.rule.dao; public interface MaxPortSpeedDao { - // Returns max speed in kbps - long getMaxPortSpeed(String imageFile, String endPointPosition, String interfaceName); + // 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 index ea0bd7715..b0cc7d2cc 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,53 +33,53 @@ import org.springframework.jdbc.core.RowMapper; public class MaxPortSpeedDaoImpl implements MaxPortSpeedDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(MaxPortSpeedDaoImpl.class); + @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 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; + 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 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; - } - }); + @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; + if (maxPortSpeedList.isEmpty()) + return defaultMaxPortSpeed; - MaxPortSpeed mps = maxPortSpeedList.get(0); - return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); - } + MaxPortSpeed mps = maxPortSpeedList.get(0); + return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); + } - private static class MaxPortSpeed { + private static class MaxPortSpeed { - public long maxSpeed; - public String unit; - } + public long maxSpeed; + public String unit; + } - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } - public void setDefaultMaxPortSpeed(long defaultMaxPortSpeed) { - this.defaultMaxPortSpeed = defaultMaxPortSpeed; - } + public void setDefaultMaxPortSpeed(long defaultMaxPortSpeed) { + this.defaultMaxPortSpeed = defaultMaxPortSpeed; + } - public void setSpeedUtil(SpeedUtil speedUtil) { - this.speedUtil = speedUtil; - } + 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 index 4bd17f1dd..dd6ae9c8c 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ package org.openecomp.sdnc.ra.rule.dao; public interface MaxServerSpeedDao { - // Returns max speed in kbps - long getMaxServerSpeed(String serverModel, int evcCount); + // 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 index c34281797..c0be2e6b5 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,54 +33,54 @@ import org.springframework.jdbc.core.RowMapper; public class MaxServerSpeedDaoImpl implements MaxServerSpeedDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(MaxServerSpeedDaoImpl.class); + @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 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; + 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 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; - } - }); + @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; + if (maxServerSpeedList.isEmpty()) + return defaultMaxServerSpeed; - MaxServerSpeed mps = maxServerSpeedList.get(0); - return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); - } + MaxServerSpeed mps = maxServerSpeedList.get(0); + return speedUtil.convertToKbps(mps.maxSpeed, mps.unit); + } - private static class MaxServerSpeed { + private static class MaxServerSpeed { - public long maxSpeed; - public String unit; - } + public long maxSpeed; + public String unit; + } - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } - public void setDefaultMaxServerSpeed(long defaultMaxServerSpeed) { - this.defaultMaxServerSpeed = defaultMaxServerSpeed; - } + public void setDefaultMaxServerSpeed(long defaultMaxServerSpeed) { + this.defaultMaxServerSpeed = defaultMaxServerSpeed; + } - public void setSpeedUtil(SpeedUtil speedUtil) { - this.speedUtil = speedUtil; - } + 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 index 509a034ae..2042ba9cd 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.ra.rule.dao; public interface ParameterDao { - String getParameter(String name); + 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 index 2cafb2806..c2ca99ce8 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,28 +30,28 @@ import org.springframework.jdbc.core.JdbcTemplate; public class ParameterDaoImpl implements ParameterDao { - private static final Logger log = LoggerFactory.getLogger(ParameterDaoImpl.class); + private static final Logger log = LoggerFactory.getLogger(ParameterDaoImpl.class); - private final static String GET_SQL = "SELECT * FROM PARAMETERS WHERE name = ?"; + private final static String GET_SQL = "SELECT * FROM PARAMETERS WHERE name = ?"; - private JdbcTemplate jdbcTemplate; + private JdbcTemplate jdbcTemplate; - @Override - public String getParameter(String name) { - List> ll = jdbcTemplate.queryForList(GET_SQL, name); + @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; - } + 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 + "'"); + String v = (String) ll.get(0).get("value"); + log.info("Parameter from DB: " + name + "='" + v + "'"); - return v; - } + return v; + } - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + 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 index 798a23037..670039f41 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,5 +28,5 @@ import org.openecomp.sdnc.ra.rule.data.RangeRule; public interface RangeRuleDao { - List getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); + 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 index dec05ece4..0880929bd 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,37 +34,37 @@ import org.springframework.jdbc.core.RowMapper; public class RangeRuleDaoImpl implements RangeRuleDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(RangeRuleDaoImpl.class); + @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 static final String GET_SQL = + "SELECT * FROM RANGE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ?"; - private JdbcTemplate jdbcTemplate; + 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 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; - } + @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; - } + 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 index 31ce9e6ab..55b24b61f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,11 @@ import org.openecomp.sdnc.ra.rule.data.ResourceRule; public interface ResourceRuleDao { - List getResourceRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); + List getResourceRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); - ResourceRule getResourceRule( - String serviceModel, - String endPointPosition, - EquipmentLevel equipLevel, - String resourceName); + 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 index 819a01cd8..72793a40f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,83 +35,83 @@ 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; - } + @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 index eb41792d9..6734fb54e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.ra.rule.dao; public interface VpeLockDao { - String getVpeLock(String vpeName); + 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 index eb6cef3bd..d712b8d0f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,20 +29,20 @@ import org.springframework.jdbc.core.JdbcTemplate; public class VpeLockDaoImpl implements VpeLockDao { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(VpeLockDaoImpl.class); + @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 final static String GET_SQL = "SELECT vpn_lock FROM VPE_LOCK WHERE vpe_name = ?"; - private JdbcTemplate jdbcTemplate; + 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; - } + @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; - } + 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 index ed76f6b16..e657e8b47 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,11 @@ 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; + 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 index c4d55f921..ca8ab5407 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,15 @@ 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; + 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 index 7be4067e0..b733a356b 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ package org.openecomp.sdnc.ra.rule.data; public class ResourceThreshold { - public String expression; - public String message; + 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 index 5f772ef18..d9ea21769 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,10 @@ 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; + 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 index 811118cb4..c057d91f7 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,13 +26,13 @@ import org.openecomp.sdnc.ra.service.data.ServiceStatus; public interface ServiceResourceDao { - ServiceResource getServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); + ServiceResource getServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); - void addServiceResource(ServiceResource serviceResource); + void addServiceResource(ServiceResource serviceResource); - void updateServiceResource(ServiceResource serviceResource); + void updateServiceResource(ServiceResource serviceResource); - void deleteServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); + void deleteServiceResource(String serviceInstanceId, ServiceStatus serviceStatus); - void updateServiceStatus(String serviceInstanceId, ServiceStatus serviceStatus, ServiceStatus newServiceStatus); + 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 index 6432e80d7..2b5cc0acb 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,77 +34,77 @@ 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; - } + @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 index 65d4488ee..e17145e5b 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,10 @@ 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; + 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 index 32f473d3d..862c3e443 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.ra.service.data; public enum ServiceStatus { - Active, Pending + 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 index 3a9340916..00cfb1fc4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,270 +61,270 @@ 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; - } + @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 index f546954ff..c8dab080b 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,52 +37,52 @@ import org.slf4j.LoggerFactory; class ReleaseFunction extends SynchronizedFunction { - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(ReleaseFunction.class); + @SuppressWarnings("unused") + private static final Logger log = LoggerFactory.getLogger(ReleaseFunction.class); - private ResourceDao resourceDao; + private ResourceDao resourceDao; - private String resourceSetId, resourceUnionId; + 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; - } + 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; - } + @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) { + } else if (resourceUnionId != null) { - if (resourceUnionId.equals(ai.resourceUnionId)) { - i.remove(); - updated = true; - } + if (resourceUnionId.equals(ai.resourceUnionId)) { + i.remove(); + updated = true; + } - } - } - } - if (updated) { - ResourceUtil.recalculate(r); - resourceDao.saveResource(r); - } - } - } + } + } + } + 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 index aea0b0a3c..d5bb9e471 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,13 +27,13 @@ import org.openecomp.sdnc.rm.data.Resource; public interface ResourceLoader { - void loadResource(String applicationId, Resource resource, boolean force); + void loadResource(String applicationId, Resource resource, boolean force); - void loadResources(String applicationId, Collection resourceList, boolean force); + void loadResources(String applicationId, Collection resourceList, boolean force); - void loadResourcesForAsset(String applicationId, String assetId, Collection resourceList, boolean force); + void loadResourcesForAsset(String applicationId, String assetId, Collection resourceList, boolean force); - void deleteResource(String applicationId, String assetId, String resourceName); + void deleteResource(String applicationId, String assetId, String resourceName); - void deleteResourcesForAsset(String applicationId, String assetId); + 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 index 7a3ce0343..737deb1cc 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,13 @@ import org.openecomp.sdnc.rm.data.Resource; public interface ResourceManager { - Resource getResource(String resourceName, String assetId); + Resource getResource(String resourceName, String assetId); - List getResourceUnion(String resourceUnionId); + List getResourceUnion(String resourceUnionId); - AllocationOutcome allocateResources(AllocationRequest allocationRequest); + AllocationOutcome allocateResources(AllocationRequest allocationRequest); - void releaseResourceSet(String resourceSetId); + void releaseResourceSet(String resourceSetId); - void releaseResourceUnion(String resourceUnionId); + 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 index b9d5a0995..e70e06c23 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,92 +37,92 @@ 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; - } + 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 index f499801c6..a116ef507 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,13 +27,13 @@ import org.openecomp.sdnc.rm.data.Resource; public interface ResourceDao { - Resource getResource(String assetId, String resourceName); + Resource getResource(String assetId, String resourceName); - void saveResource(Resource resource); + void saveResource(Resource resource); - void deleteResource(String assetId, String resourceName); + void deleteResource(String assetId, String resourceName); - List getResourceSet(String resourceSetId); + List getResourceSet(String resourceSetId); - List getResourceUnion(String resourceUnionId); + 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 index eb5f39885..7087c18fb 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,13 +25,13 @@ 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; + 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 index 30f9d26a4..fe6199ea0 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ import java.util.List; public interface AllocationItemJdbcDao { - void add(AllocationItem ai); + void add(AllocationItem ai); - List getAllocationItems(long resourceId); + List getAllocationItems(long resourceId); - void update(AllocationItem ai); + void update(AllocationItem ai); - void delete(long id); + 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 index 1d88261c2..2710f358f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,88 +39,88 @@ 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; - } + @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 index ca66964ce..4bbe2ebd6 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,10 @@ 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; + 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 index 32c8f4d7f..cbae3d20e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,333 +38,333 @@ 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; - } + 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 index 645c377e7..5ed07b256 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,15 @@ import java.util.List; public interface ResourceJdbcDao { - Resource getResource(String assetId, String resourceName); + Resource getResource(String assetId, String resourceName); - List getResourceSet(String resourceSetId); + List getResourceSet(String resourceSetId); - List getResourceUnion(String resourceUnionId); + List getResourceUnion(String resourceUnionId); - void add(Resource r); + void add(Resource r); - void delete(long id); + void delete(long id); - void update(Resource r); + 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 index 5e529f70e..08592819c 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,107 +38,107 @@ 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 + @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; - } + 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 index 5c810b1d0..5b5669248 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ import java.util.Date; public class ResourceLoad { - public long id; - public long resourceId; - public String applicationId; - public Date loadTime; - public Date expirationTime; + 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 index 9a337a83d..ad38372f2 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ import java.util.List; public interface ResourceLoadJdbcDao { - void add(ResourceLoad rl); + void add(ResourceLoad rl); - List getResourceLoads(long resourceId); + List getResourceLoads(long resourceId); - void update(ResourceLoad rl); + void update(ResourceLoad rl); - void delete(long id); + 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 index 854b66965..aa44afae3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,74 +39,74 @@ 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; - } + @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 index c791d4272..4eab7d9d8 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,5 +22,5 @@ package org.openecomp.sdnc.rm.data; public enum AllocationAction { - Fail, Succeed_DoNothing, Succeed_Allocate + 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 index f4cabf96e..4a7ee6a7d 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,11 +26,11 @@ 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; + 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 index 20ecf051e..7283e11c6 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ package org.openecomp.sdnc.rm.data; public class AllocationOutcome { - public AllocationStatus status = null; - public AllocationRequest request = null; + 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 index d54475ff6..d4291167e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,11 @@ 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; + 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 index a18077a13..aa8d1df12 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.rm.data; public enum AllocationStatus { - Success, Failure, NotTried, ResourceNotFound, ResourceExpired + 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 index 8b9dfaa32..d0075bdbd 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,15 +22,15 @@ package org.openecomp.sdnc.rm.data; public enum InitAction { - CheckInit("Initialize if needed"), ForceInit("Always Initialize"), NoInit("No initialization"); + CheckInit("Initialize if needed"), ForceInit("Always Initialize"), NoInit("No initialization"); - private String str; + private String str; - private InitAction(String str) { - this.str = str; - } + private InitAction(String str) { + this.str = str; + } - public String getInitActionStr() { - return 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 index e456542cf..97ee3ba89 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.rm.data; public class LabelAllocationItem extends AllocationItem { - public String label; + 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 index d0cb2c527..c1763ff21 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,6 @@ package org.openecomp.sdnc.rm.data; public class LabelAllocationOutcome extends AllocationOutcome { - public String allocatedLabel = null; - public String currentLabel = null; + 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 index 2b6ce0338..8e509f66d 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.openecomp.sdnc.rm.data; public class LabelAllocationRequest extends AllocationRequest { - public String label = null; - public boolean check = false; - public boolean allocate = false; + 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 index 54bfb852e..d82701928 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ package org.openecomp.sdnc.rm.data; public class LabelResource extends Resource { - public static final String BLOCKED = "__BLOCKED__"; + public static final String BLOCKED = "__BLOCKED__"; - public String label; - public int referenceCount; + 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 index 270220a8a..181172f2f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.rm.data; public class LimitAllocationItem extends AllocationItem { - public long used; + 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 index f1c13c083..ffc119414 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.openecomp.sdnc.rm.data; public class LimitAllocationOutcome extends AllocationOutcome { - public long allocatedCount = 0; - public long used = 0; - public long limit = 0; + 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 index 787715bb0..31c0d1155 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ 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; + 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 index cad0ba232..ad706ee81 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,5 +23,5 @@ package org.openecomp.sdnc.rm.data; public class LimitResource extends Resource { - public long used = 0; + 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 index bf9bbbfaa..dcbac3675 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,6 @@ import java.util.List; public class MultiAssetAllocationOutcome extends AllocationOutcome { - public List goodAssetIdList; - public List allocationOutcomeList; + 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 index da1a96d73..d4dd65ed4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ 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; + 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 index 9deca6c2b..355d50814 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,5 +25,5 @@ import java.util.List; public class MultiResourceAllocationOutcome extends AllocationOutcome { - public List allocationOutcomeList; + 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 index 9e48a31e5..4de9868b3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + *reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,6 @@ import java.util.List; public class MultiResourceAllocationRequest extends AllocationRequest { - public List allocationRequestList = null; - public boolean stopOnFirstFailure = true; + 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 index 229c8e449..4260b4dc3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,5 +25,5 @@ import java.util.SortedSet; public class RangeAllocationItem extends AllocationItem { - public SortedSet used; + 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 index 8b35d9f04..ad14f510a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,6 @@ import java.util.SortedSet; public class RangeAllocationOutcome extends AllocationOutcome { - public SortedSet allocated = null; - public SortedSet used = null; + 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 index 0732613d3..9315535f4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ 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; + 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 index 99a2b207a..4bec30440 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,5 +25,5 @@ import java.util.SortedSet; public class RangeResource extends Resource { - public SortedSet used; + 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 index b04f71050..c462bde37 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ import java.util.Collection; public abstract class Resource { - public ResourceKey resourceKey; - public ResourceType resourceType; - public Collection allocationItems; - public Collection resourceLoadList; + 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 index b303b07fd..765c9251c 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,28 +23,28 @@ package org.openecomp.sdnc.rm.data; public class ResourceKey { - public String assetId; - public String resourceName; + 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 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 int hashCode() { + return (int) ((long) System.identityHashCode(assetId) + (long) System.identityHashCode(resourceName)); + } - @Override - public String toString() { - return "(" + assetId + ", " + 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 index 06970cbcc..f1e96a8bf 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ import java.util.Date; public class ResourceLoad { - public ResourceKey resourceKey; - public String applicationId; - public Date resourceLoadTime; - public Date resourceExpirationTime; + 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 index 1d8b9c4c8..d97cb7d71 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,5 +22,5 @@ package org.openecomp.sdnc.rm.data; public enum ResourceType { - Limit, Label, Range + 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 index bbaa3a378..d15a149f2 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,63 +33,63 @@ 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 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; + 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; + 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); - } + if (l.allocationItems == null) + l.allocationItems = new ArrayList(); + l.allocationItems.add(lai); + } - lai.label = req.label; - lai.allocationTime = new Date(); + lai.label = req.label; + lai.allocationTime = new Date(); - recalculate(l); + recalculate(l); - return lai.label; - } + 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__"; - } - } - } + 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); - } + 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 index 457995604..76c3ef76e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,296 +39,296 @@ 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); - } + 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 index af828314e..27d0e55b3 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,76 +35,76 @@ 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 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; + 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; - } + 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; - } + return true; + } - private static boolean eq(Object o1, Object o2) { - return o1 == null ? o2 == null : o1.equals(o2); - } + 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 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; + 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; + 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); + 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(); + rai.allocationTime = new Date(); - recalculate(rr); - } + 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 index 7afe7b5db..0253204c7 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,21 +29,21 @@ 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 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; + 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); - } + 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 index 8918ce0cb..12ba15867 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,90 +33,90 @@ 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; - } + 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 index 1927fdb9c..11560498b 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,297 +42,297 @@ 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(); - } + 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 index d729e127d..b01b31f9f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,66 +33,66 @@ import org.slf4j.LoggerFactory; public class DataSourceWrap implements DataSource { - private static final Logger log = LoggerFactory.getLogger(DataSourceWrap.class); + private static final Logger log = LoggerFactory.getLogger(DataSourceWrap.class); - private DataSource dataSource; + private DataSource dataSource; - @Override - public PrintWriter getLogWriter() throws SQLException { - return dataSource.getLogWriter(); - } + @Override + public PrintWriter getLogWriter() throws SQLException { + return dataSource.getLogWriter(); + } - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - dataSource.setLogWriter(out); - } + @Override + public void setLogWriter(PrintWriter out) throws SQLException { + dataSource.setLogWriter(out); + } - @Override - public void setLoginTimeout(int seconds) throws SQLException { - dataSource.setLoginTimeout(seconds); - } + @Override + public void setLoginTimeout(int seconds) throws SQLException { + dataSource.setLoginTimeout(seconds); + } - @Override - public int getLoginTimeout() throws SQLException { - return dataSource.getLoginTimeout(); - } + @Override + public int getLoginTimeout() throws SQLException { + return dataSource.getLoginTimeout(); + } - @Override - public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { - return dataSource.getParentLogger(); - } + @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 T unwrap(Class iface) throws SQLException { + return dataSource.unwrap(iface); + } - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return dataSource.isWrapperFor(iface); - } + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + return dataSource.isWrapperFor(iface); + } - @Override - public Connection getConnection() throws SQLException { - Connection c = dataSource.getConnection(); + @Override + public Connection getConnection() throws SQLException { + Connection c = dataSource.getConnection(); - log.debug("getConnection: " + c.getClass().getName()); + log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + c.setAutoCommit(true); + return c; + } - @Override - public Connection getConnection(String username, String password) throws SQLException { - Connection c = dataSource.getConnection(username, password); + @Override + public Connection getConnection(String username, String password) throws SQLException { + Connection c = dataSource.getConnection(username, password); - log.debug("getConnection: " + c.getClass().getName()); + log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + c.setAutoCommit(true); + return c; + } - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } + 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 index ff15d770b..345a6263c 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,183 +25,183 @@ 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."); - } - } + 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 index 8a0b006bf..f382a6393 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,19 +23,19 @@ package org.openecomp.sdnc.util.speed; public class SpeedUtil { - private long unitFactor = 1000; + 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 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; - } + 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 index 02857e105..f7fa81d18 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,269 +37,269 @@ 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; - } + 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 index a9d69507a..a28b0affa 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ package org.openecomp.sdnc.util.vrf; public class VpnParam { - public String vpnId; - public String siteType; - public String spokeServiceInstanceId; - public String routeGroupName; + 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 index d5a691bb8..2b90027c6 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,54 +23,54 @@ 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; + 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; + 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; - } + return ss; + } - public static VpnParam parseVrfInstanceName(String vrfInstanceName) { - VpnParam vpnParam = new VpnParam(); + public static VpnParam parseVrfInstanceName(String vrfInstanceName) { + VpnParam vpnParam = new VpnParam(); - int i1 = vrfInstanceName.indexOf("-HUB"); - if (i1 > 0) - vpnParam.siteType = "HUB"; + int i1 = vrfInstanceName.indexOf("-HUB"); + if (i1 > 0) + vpnParam.siteType = "HUB"; - int i2 = vrfInstanceName.indexOf("-SP-"); - if (i2 > 0) - vpnParam.siteType = "SPOKE"; + 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 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); + 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); + 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; - } + 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 index b123944d3..9bd3fe11e 100644 --- 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 @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,276 +21,276 @@ --> - + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - + - - - + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 index bec30ce11..195e9a66a 100644 --- 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 @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,19 +21,19 @@ --> - - - javax.sql.DataSource - org.openecomp.sdnc.sli.resource.dblib.DbLibService - - + + + javax.sql.DataSource + org.openecomp.sdnc.sli.resource.dblib.DbLibService + + - + 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 index ea60c62dc..d39e24854 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. @@ -20,13 +20,13 @@ --- 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 + 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 index 2aa66ac80..d752eb3a4 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. @@ -20,10 +20,10 @@ --- 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 + 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 index 671117e7d..b33c32a0b 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. @@ -20,9 +20,9 @@ --- 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 + 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 index f74eeee5f..46ac760ad 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,234 +28,234 @@ 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; - } + 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 index 7d57eba31..2c25c3e11 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,384 +41,384 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestIsAvailable { - private static final Logger log = LoggerFactory.getLogger(TestIsAvailable.class); + private static final Logger log = LoggerFactory.getLogger(TestIsAvailable.class); - @Autowired(required = true) - private ResourceAllocator resourceAllocator; + @Autowired(required = true) + private ResourceAllocator resourceAllocator; - @Autowired(required = true) - private DataSetup dataSetup; + @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"); + @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"; + 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); + 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"); + 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); + QueryStatus st = resourceAllocator.isAvailable("NetworkCapacity", null, null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + 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); + 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"); + 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); + 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"); + 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); + 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)); - } + 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"); + @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"; + 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); + 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"); + 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); + 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"); + 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); + 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)); - } + 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"; + @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"); - } + 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 index e69003a39..0d287f2b4 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,46 +40,46 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestQuery { - private static final Logger log = LoggerFactory.getLogger(TestQuery.class); + private static final Logger log = LoggerFactory.getLogger(TestQuery.class); - @Autowired(required = true) - private ResourceAllocator resourceAllocator; + @Autowired(required = true) + private ResourceAllocator resourceAllocator; - @Autowired(required = true) - private DataSetup dataSetup; + @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)"); + @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"; + String service1 = "ICOREPVC" + t + "-1"; - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); + 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"); + 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); + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "VPE-Cust", "Pending", 1, 300000)); + 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); + 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"); - } + 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 index f2ee50fc5..45bd047a7 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,390 +41,390 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestRelease { - private static final Logger log = LoggerFactory.getLogger(TestRelease.class); + private static final Logger log = LoggerFactory.getLogger(TestRelease.class); - @Autowired(required = true) - private ResourceAllocator resourceAllocator; + @Autowired(required = true) + private ResourceAllocator resourceAllocator; - @Autowired(required = true) - private DataSetup dataSetup; + @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"); + @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"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @Test + public void test002() throws Exception { + String t = "002"; + log.info("============== release " + t + " ================================"); + log.info("=== Test release - cancel - change"); - String service1 = "release" + t + "/service1"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 3)); - } + 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"); + @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"; + 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.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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } + 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"); + @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"; + String service1 = "release" + t + "/service1"; - dataSetup.cleanup(); + dataSetup.cleanup(); - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Cancel"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } + 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"); + @Test + public void test006() throws Exception { + String t = "006"; + log.info("============== release " + t + " ================================"); + log.info("=== Test release - actovate - change"); - String service1 = "release" + t + "/service1"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 3, 400000)); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, 2)); - } + 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"); + @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"; + 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.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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "Active", 2, 200000)); - } + 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"); + @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"; + String service1 = "release" + t + "/service1"; - dataSetup.cleanup(); + dataSetup.cleanup(); - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Activate"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + 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.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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + 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"); + 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)); + 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); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + String service1 = "release" + t + "/service1"; - dataSetup.cleanup(); + dataSetup.cleanup(); - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.request-type", "Disconnect"); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", service1); + 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); + QueryStatus st = resourceAllocator.release("NetworkCapacity", null, ctx); - log.info("Result: " + st); + log.info("Result: " + st); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceNotInDb(service1, null, null)); - } + 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"); + @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"; + String service1 = "release" + t + "/service1"; - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.resource-allocator.service-instance-id", 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"); + 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"); - } + 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 index 08c673587..1dff3589e 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,641 +41,641 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestReserve { - private static final Logger log = LoggerFactory.getLogger(TestReserve.class); + private static final Logger log = LoggerFactory.getLogger(TestReserve.class); - @Autowired(required = true) - private ResourceAllocator resourceAllocator; + @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)); - } + @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 index a92cbc5aa..1442f3ca2 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,38 +40,38 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestReserve2 { - private static final Logger log = LoggerFactory.getLogger(TestReserve2.class); + private static final Logger log = LoggerFactory.getLogger(TestReserve2.class); - @Autowired(required = true) - private ResourceAllocator resourceAllocator; + @Autowired(required = true) + private ResourceAllocator resourceAllocator; - @Autowired(required = true) - private DataSetup dataSetup; + @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"); + @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"; + String service1 = "ICOREPVC" + t + "-1"; - dataSetup.cleanup(); - dataSetup.setupVpePort("MTSNJA4LCP1", "mtanjrsv126", "ae0", "PROV", "juniper-vpe-image"); + 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"); + 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); + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb(service1, "VPE-Cust", "Pending", 1, 300000)); - } + 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 index 55824b00c..4ff5bec7f 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,79 +28,79 @@ 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; - } + 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 index ec7c2abfe..ba890c72a 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,13 +25,13 @@ import org.springframework.jdbc.core.JdbcTemplate; public class TestDb { - private JdbcTemplate jdbcTemplate; + private JdbcTemplate jdbcTemplate; - public TestTable table(String tableName, String idName, String... columnList) { - return new TestTable(jdbcTemplate, tableName, idName, columnList); - } + public TestTable table(String tableName, String idName, String... columnList) { + return new TestTable(jdbcTemplate, tableName, idName, columnList); + } - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + 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 index 64288d96a..a57ab4fc1 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 ONAP Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,59 +26,59 @@ import org.springframework.jdbc.support.rowset.SqlRowSet; public class TestTable { - private String tableName; - private String[] columnList; - private String idName; + private String tableName; + private String[] columnList; + private String idName; - private String insertSql; + private String insertSql; - private JdbcTemplate jdbcTemplate; + 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(); - } + 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(); - } + 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 void add(Object... values) { + jdbcTemplate.update(insertSql, values); + } - public long getLastId() { - return jdbcTemplate.queryForObject("SELECT max(" + idName + ") FROM " + tableName, Long.class); - } + 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 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 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); - } + 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 index 48ec701a7..1f061eca1 100644 --- a/resource-assignment/provider/src/test/resources/homing-req.json +++ b/resource-assignment/provider/src/test/resources/homing-req.json @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,27 +20,27 @@ */ { - "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" - } - } + "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 index 6d6e30ff2..b36b7674f 100644 --- a/resource-assignment/provider/src/test/resources/log4j.properties +++ b/resource-assignment/provider/src/test/resources/log4j.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 ONAP Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/resource-assignment/provider/src/test/resources/sql/data.sql b/resource-assignment/provider/src/test/resources/sql/data.sql index 2214bce79..f840a2322 100644 --- a/resource-assignment/provider/src/test/resources/sql/data.sql +++ b/resource-assignment/provider/src/test/resources/sql/data.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. @@ -34,10 +34,10 @@ VALUES ( '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, + 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', + 'Connection', 'L3SDN', 'VCE-Cust', 'true', 'Server', 'true', '1', '40', '40'); INSERT INTO RESOURCE_RULE ( @@ -48,51 +48,51 @@ VALUES ( '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, + 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'); + '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, + 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'); + 'Connection', 'L3AVPN-EVC', 'VPE-Cust', 'true', 'Port', 'true', '1', '200', '200'); INSERT INTO RESOURCE_RULE ( - resource_name, service_model, end_point_position, service_expression, + 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'); + 'Bandwidth', 'L3AVPN-PORT', 'VPE-Cust', 'true', 'Port', 'true', 'service-speed-kbps', '8000000', '8000000'); insert into RESOURCE_THRESHOLD ( - resource_rule_id, threshold_expression, threshold_message) + resource_rule_id, threshold_expression, threshold_message) values ( - (select resource_rule_id from RESOURCE_RULE where resource_name = 'Bandwidth' and equipment_level = 'Server'), + (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) + resource_rule_id, threshold_expression, threshold_message) values ( - (select resource_rule_id from RESOURCE_RULE where resource_name = 'Bandwidth' and equipment_level = 'Server'), + (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) + range_name, service_model, end_point_position, equipment_level, min_value, max_value) VALUES ( - 'subinterface-id', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 100, 3999); + '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) + range_name, service_model, end_point_position, equipment_level, min_value, max_value) VALUES ( - 'vlan-id-inner', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 2, 4091); + '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) + range_name, service_model, end_point_position, equipment_level, min_value, max_value) VALUES ( - 'bundle-id', 'L3AVPN-PORT', 'VPE-Cust', 'Port', 1, 99999); + '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) @@ -116,5 +116,5 @@ VALUES ('ALL', 10000, 500, 'Mbps', 'Max speed, when there are 21 or more EVC on 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.'); + '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 index e650337e0..03b5bfa7d 100644 --- a/resource-assignment/provider/src/test/resources/sql/schema.sql +++ b/resource-assignment/provider/src/test/resources/sql/schema.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 ONAP Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. @@ -20,12 +20,12 @@ --- 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 + 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 ( @@ -70,59 +70,59 @@ 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 + 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) + 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 + 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 + 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) + 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, + 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, ); @@ -132,37 +132,37 @@ 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) + 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) + 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 ( @@ -172,30 +172,30 @@ CREATE TABLE VPE_LOCK ( ); CREATE TABLE PARAMETERS ( - name varchar(100) PRIMARY KEY, - value varchar(24) NOT NULL, - category varchar(24) NOT NULL, - memo varchar(128) + 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) + 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/test-context.xml b/resource-assignment/provider/src/test/resources/test-context.xml index 89aea439e..1d21fa4f6 100644 --- a/resource-assignment/provider/src/test/resources/test-context.xml +++ b/resource-assignment/provider/src/test/resources/test-context.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 ONAP Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,277 +21,277 @@ --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/jdbc + http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.1.xsd + "> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg From 4b4fa3eefbabac17ee5a1beae558c47f9566ceb4 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Mon, 14 Aug 2017 14:54:46 -0400 Subject: Update root pom to Carbon SR1 Update adaptors to compile against Carbon SR1 maven artifacts Change-Id: I74e2710d7206bc3efe403439bb346615de6e3f75 Issue-ID: CCSDK-24 Signed-off-by: Dan Timoney --- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 4 ++-- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 9259d6cd1..b8485035b 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT aai-service-features AAI Interface Service - Features diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 91db2ca8b..03b523d03 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT aai-service-installer AAI Adaptor - Karaf Installer diff --git a/aai-service/pom.xml b/aai-service/pom.xml index e4561d8b1..9c89a1773 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sdnc-adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT 4.0.0 @@ -16,7 +16,7 @@ AAI Interface Service The AAI Interface service exposes an interface to AAI as an OSGi service - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index a9aa98d74..3a81fcedc 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors aai-service - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT aai-service-provider bundle @@ -22,7 +22,7 @@ org.mockito - mockito-all + mockito-core ${mockito.version} test diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 140810ff9..b4e7220d2 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT mdsal-resource-features MD-SAL Resource Adaptor - Features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index d636f8d91..259bc06af 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT mdsal-resource-installer MDSAL Resource - Karaf Installer diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index a6f68b434..eddff3039 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors sdnc-adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ MD-SAL Resource Adaptor The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 92dada640..4ab921a81 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors mdsal-resource - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT mdsal-resource-provider bundle diff --git a/pom.xml b/pom.xml index e387445de..f4e8fcb52 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent - odlparent-boron-sr3 + odlparent-carbon-sr1 0.0.1-SNAPSHOT @@ -113,7 +113,7 @@ OpenECOMP - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 338f7a1d1..2448576e1 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT resource-assignment-features Resource Assignment Adaptor - Features diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 19359dc9f..8915b8d6a 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT resource-assignment-installer Resource allocator- Karaf Installer diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 5e44d5ffb..37889db03 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -3,14 +3,14 @@ org.onap.ccsdk.sli.adaptors sdnc-adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT 4.0.0 pom org.onap.ccsdk.sli.adaptors resource-assignment - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT Resource Assignment Adaptor diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 4d801522d..b36753ab5 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors resource-assignment - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT resource-assignment-provider bundle diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 4b32a9f0b..8c38ece90 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT sql-resource-features Sql Resource Adaptor - Features diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index fa27cfe56..1ff621a07 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT sql-resource-installer SQL Resource - Karaf Installer diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index a3376c1ca..ffec0c427 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors sdnc-adaptors - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ Sql Resource Adaptor The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 195a10e61..a9a634948 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sql-resource - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT sql-resource-provider bundle -- cgit 1.2.3-korg From df8f780fdad167fda692e846641c4fe966b240cb Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 15 Aug 2017 10:04:19 -0400 Subject: Fix license headers Licence headers were accidentally updated incorrectly by previous update. This commit restores the license headers for seed code to the wording from the original seed code Change-Id: If4623dd02a37660a7d7e746363dd83cf9cdb718a Issue-ID: CCSDK-31 Signed-off-by: Dan Timoney --- aai-service/features/src/main/resources/features.xml | 6 +++--- aai-service/installer/src/assembly/assemble_installer_zip.xml | 4 ++-- aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml | 4 ++-- aai-service/installer/src/main/resources/scripts/install-feature.sh | 4 ++-- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java | 4 ++-- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java | 4 ++-- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/CloudRegionRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java | 4 ++-- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/GenericVnfRequest.java | 4 ++-- .../ccsdk/sli/adaptors/aai/L3InterfaceIpv4AddressListRequest.java | 4 ++-- .../ccsdk/sli/adaptors/aai/L3InterfaceIpv6AddressListRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/LInterfaceRequest.java | 4 ++-- .../org/onap/ccsdk/sli/adaptors/aai/LagInterfacePnfRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/PInterfacePnfRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/PInterfaceRequest.java | 4 ++-- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/PhysicalLinkRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequest.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/SubInterfaceRequest.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequest.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/data/AAIDatum.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/EchoResponse.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/ErrorResponse.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/RequestError.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/ResourceVersion.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessage.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/ResponseMessages.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/ServiceException.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/SubInterface.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/data/Variables.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/notify/KeyDatum.java | 4 ++-- .../org/onap/ccsdk/sli/adaptors/aai/data/notify/NotifyEvent.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/v1507/Flavor.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/data/v1507/Host.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/data/v1507/Image.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/v1507/IpAddress.java | 4 ++-- .../org/onap/ccsdk/sli/adaptors/aai/data/v1507/Relationship.java | 4 ++-- .../onap/ccsdk/sli/adaptors/aai/data/v1507/RelationshipDatum.java | 4 ++-- .../onap/ccsdk/sli/adaptors/aai/data/v1507/RelationshipList.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/data/v1507/VServer.java | 4 ++-- .../ccsdk/sli/adaptors/aai/query/FormattedQueryRequestData.java | 4 ++-- .../onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilters.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQuery.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryData.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParameters.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/query/Results.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/update/Action.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/update/ActionDatum.java | 4 ++-- .../main/java/org/onap/ccsdk/sli/adaptors/aai/update/Update.java | 4 ++-- .../java/org/onap/ccsdk/sli/adaptors/aai/update/UpdateNodeKey.java | 4 ++-- aai-service/provider/src/main/resources/aai-path.properties | 4 ++-- .../onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java | 4 ++-- aai-service/provider/src/test/resources/aaiclient.properties | 4 ++-- mdsal-resource/features/src/main/resources/features.xml | 4 ++-- mdsal-resource/installer/src/assembly/assemble_installer_zip.xml | 4 ++-- mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml | 4 ++-- .../installer/src/main/resources/scripts/install-feature.sh | 4 ++-- .../java/org/openecomp/sdnc/sli/resource/mdsal/ConfigResource.java | 4 ++-- .../openecomp/sdnc/sli/resource/mdsal/MdsalResourceActivator.java | 4 ++-- .../org/openecomp/sdnc/sli/resource/mdsal/OperationalResource.java | 4 ++-- .../java/org/openecomp/sdnc/sli/resource/mdsal/RestService.java | 4 ++-- mdsal-resource/provider/src/main/resources/crtables.sql | 4 ++-- mdsal-resource/provider/src/main/resources/svclogic.properties | 4 ++-- resource-assignment/features/src/main/resources/features.xml | 4 ++-- .../installer/src/assembly/assemble_installer_zip.xml | 4 ++-- resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml | 4 ++-- .../installer/src/main/resources/scripts/install-feature.sh | 4 ++-- .../src/main/java/org/openecomp/sdnc/lock/comp/LockHelper.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/lock/comp/LockHelperImpl.java | 4 ++-- .../java/org/openecomp/sdnc/lock/comp/ResourceLockedException.java | 4 ++-- .../java/org/openecomp/sdnc/lock/comp/SynchronizedFunction.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/lock/dao/ResourceLockDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/lock/dao/ResourceLockDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/lock/data/ResourceLock.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/ReleaseRequestType.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/ReserveRequestType.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/ResourceAllocator.java | 4 ++-- .../java/org/openecomp/sdnc/ra/alloc/AffinityAllocationRule.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/alloc/DbAllocationRule.java | 4 ++-- .../java/org/openecomp/sdnc/ra/alloc/ServingSiteAllocationRule.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/alloc/VrfAllocationRule.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/check/AnyVrfPresentCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/ExcludeVpeCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/HubWithRgCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/OneMVrfCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/ProvStatusCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/VlanSpeedCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/check/VpeLockCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/AllocationRule.java | 4 ++-- .../org/openecomp/sdnc/ra/comp/EndPointAllocationDefinition.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/EndPointAllocator.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/comp/EndPointAllocatorImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/EndPointData.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/EquipmentCheck.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/PreferenceRule.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/comp/ServiceData.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/comp/EquipmentReader.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/equip/dao/ServerDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/dao/ServerDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/dao/VpePortDaoImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/dao/VplspePortDao.java | 4 ++-- .../java/org/openecomp/sdnc/ra/equip/dao/VplspePortDaoImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/data/EquipmentData.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/equip/data/EquipmentLevel.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/pref/AffinityLinkPref.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/pref/EvcExistingVrfPref.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/reader/AicSiteReader.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/reader/UplinkCircuitReader.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/reader/VnfReader.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/reader/VpePortReader.java | 4 ++-- .../org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java | 4 ++-- .../openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java | 4 ++-- .../java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java | 4 ++-- .../java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java | 4 ++-- .../java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java | 4 ++-- .../java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java | 4 ++-- .../java/org/openecomp/sdnc/ra/service/dao/ServiceResourceDao.java | 4 ++-- .../org/openecomp/sdnc/ra/service/dao/ServiceResourceDaoImpl.java | 4 ++-- .../java/org/openecomp/sdnc/ra/service/data/ServiceResource.java | 4 ++-- .../main/java/org/openecomp/sdnc/ra/service/data/ServiceStatus.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/comp/AllocationFunction.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/comp/ReleaseFunction.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/comp/ResourceLoader.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/comp/ResourceManager.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/comp/ResourceManagerImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/dao/ResourceDao.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItem.java | 4 ++-- .../java/org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDao.java | 4 ++-- .../org/openecomp/sdnc/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/dao/jdbc/Resource.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceDaoImpl.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDao.java | 4 ++-- .../java/org/openecomp/sdnc/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoad.java | 4 ++-- .../java/org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDao.java | 4 ++-- .../org/openecomp/sdnc/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/AllocationAction.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/AllocationItem.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/AllocationOutcome.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/AllocationRequest.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/AllocationStatus.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/InitAction.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/data/LabelAllocationItem.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/LabelAllocationOutcome.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/LabelAllocationRequest.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/LabelResource.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/data/LimitAllocationItem.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/LimitAllocationOutcome.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/LimitAllocationRequest.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/LimitResource.java | 4 ++-- .../org/openecomp/sdnc/rm/data/MultiAssetAllocationOutcome.java | 4 ++-- .../org/openecomp/sdnc/rm/data/MultiAssetAllocationRequest.java | 4 ++-- .../org/openecomp/sdnc/rm/data/MultiResourceAllocationOutcome.java | 4 ++-- .../org/openecomp/sdnc/rm/data/MultiResourceAllocationRequest.java | 4 ++-- .../main/java/org/openecomp/sdnc/rm/data/RangeAllocationItem.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/RangeAllocationOutcome.java | 4 ++-- .../java/org/openecomp/sdnc/rm/data/RangeAllocationRequest.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/RangeResource.java | 4 ++-- .../provider/src/main/java/org/openecomp/sdnc/rm/data/Resource.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/ResourceKey.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/ResourceLoad.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/data/ResourceType.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/util/LabelUtil.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/util/LimitUtil.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/util/RangeUtil.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/rm/util/ResourceUtil.java | 4 ++-- .../main/java/org/openecomp/sdnc/util/db/CachedDataSourceWrap.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/util/db/ConnectionWrap.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/util/db/DataSourceWrap.java | 4 ++-- .../main/java/org/openecomp/sdnc/util/expr/ExpressionEvaluator.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/util/speed/SpeedUtil.java | 4 ++-- .../provider/src/main/java/org/openecomp/sdnc/util/str/StrUtil.java | 4 ++-- .../src/main/java/org/openecomp/sdnc/util/vrf/VpnParam.java | 4 ++-- .../provider/src/main/java/org/openecomp/sdnc/util/vrf/VrfUtil.java | 4 ++-- .../main/resources/META-INF/spring/resource-assignment-context.xml | 4 ++-- .../resources/META-INF/spring/resource-assignment-osgi-context.xml | 4 ++-- .../provider/src/main/resources/resource-allocator.properties | 4 ++-- .../provider/src/main/resources/sql/001_resource_rule_ddl.sql | 4 ++-- .../provider/src/main/resources/sql/002_max_port_speed_ddl.sql | 4 ++-- .../provider/src/main/resources/sql/003_max_server_speed_ddl.sql | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/DataSetup.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/TestIsAvailable.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/TestQuery.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/TestRelease.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/ra/TestReserve2.java | 4 ++-- .../src/test/java/jtest/org/openecomp/sdnc/rm/DataSetup.java | 4 ++-- .../src/test/java/jtest/util/org/openecomp/sdnc/ra/TestDb.java | 4 ++-- .../src/test/java/jtest/util/org/openecomp/sdnc/ra/TestTable.java | 4 ++-- resource-assignment/provider/src/test/resources/log4j.properties | 4 ++-- resource-assignment/provider/src/test/resources/sql/data.sql | 4 ++-- resource-assignment/provider/src/test/resources/sql/schema.sql | 4 ++-- resource-assignment/provider/src/test/resources/test-context.xml | 4 ++-- sql-resource/features/src/main/resources/features.xml | 4 ++-- sql-resource/installer/src/assembly/assemble_installer_zip.xml | 4 ++-- sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml | 4 ++-- .../installer/src/main/resources/scripts/install-feature.sh | 4 ++-- .../main/java/org/openecomp/sdnc/sli/resource/sql/SqlResource.java | 4 ++-- .../org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java | 4 ++-- sql-resource/provider/src/main/resources/svclogic.properties | 4 ++-- .../java/org/openecomp/sdnc/sli/resource/sql/SqlResourceTest.java | 4 ++-- sql-resource/provider/src/test/resources/simplelogger.properties | 4 ++-- sql-resource/provider/src/test/resources/svclogic.properties | 4 ++-- 231 files changed, 463 insertions(+), 463 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/src/main/resources/features.xml b/aai-service/features/src/main/resources/features.xml index c992710a0..bd3d0bc1d 100644 --- a/aai-service/features/src/main/resources/features.xml +++ b/aai-service/features/src/main/resources/features.xml @@ -1,10 +1,10 @@ true diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java new file mode 100644 index 000000000..d33703df0 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java new file mode 100644 index 000000000..4d9bb27de --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java @@ -0,0 +1,166 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.lock.comp; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDao; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java new file mode 100644 index 000000000..4b90b265e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java @@ -0,0 +1,41 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java new file mode 100644 index 000000000..f4df81b8b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java @@ -0,0 +1,56 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java new file mode 100644 index 000000000..bcabb36d1 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java @@ -0,0 +1,43 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.lock.dao; + +import java.util.Date; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java new file mode 100644 index 000000000..d68317fb7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java @@ -0,0 +1,115 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.lock.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.lock.data.ResourceLock; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/lock/data/ResourceLock.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/data/ResourceLock.java new file mode 100644 index 000000000..cb434e142 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/data/ResourceLock.java @@ -0,0 +1,34 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java new file mode 100644 index 000000000..d3df91c2d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java @@ -0,0 +1,45 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java new file mode 100644 index 000000000..b46b7dede --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java @@ -0,0 +1,43 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java new file mode 100644 index 000000000..d1913b33d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -0,0 +1,1016 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocator; +import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointData; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.dao.ServerDao; +import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDao; +import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VplspePortDao; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; +import org.onap.ccsdk.sli.adaptors.ra.rule.comp.AllocationRequestBuilder; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxPortSpeedDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxServerSpeedDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ParameterDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; +import org.onap.ccsdk.sli.adaptors.ra.service.dao.ServiceResourceDao; +import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; +import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceStatus; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java new file mode 100644 index 000000000..0da7acb79 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java @@ -0,0 +1,68 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.alloc; + +import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java new file mode 100644 index 000000000..a0b698d73 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -0,0 +1,155 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.alloc; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; +import org.onap.ccsdk.sli.adaptors.util.expr.ExpressionEvaluator; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java new file mode 100644 index 000000000..b1c4ac449 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java @@ -0,0 +1,80 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.alloc; + +import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java new file mode 100644 index 000000000..74bfe6634 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java @@ -0,0 +1,111 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.alloc; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java new file mode 100644 index 000000000..6f4de2693 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java @@ -0,0 +1,74 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java new file mode 100644 index 000000000..020c165ab --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java @@ -0,0 +1,57 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java new file mode 100644 index 000000000..22fdeca33 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java @@ -0,0 +1,107 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java new file mode 100644 index 000000000..e54d89cb1 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java @@ -0,0 +1,100 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java new file mode 100644 index 000000000..f851b53b6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java new file mode 100644 index 000000000..28e6278de --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java @@ -0,0 +1,50 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java new file mode 100644 index 000000000..503e1ffc2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java @@ -0,0 +1,111 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.check; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.VpeLockDao; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java new file mode 100644 index 000000000..831cac0c3 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java @@ -0,0 +1,37 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java new file mode 100644 index 000000000..589fafcd6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java @@ -0,0 +1,60 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java new file mode 100644 index 000000000..08713cd76 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java new file mode 100644 index 000000000..0f488bc67 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -0,0 +1,214 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java new file mode 100644 index 000000000..dc1cb0a63 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java @@ -0,0 +1,33 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java new file mode 100644 index 000000000..70f2abde8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java new file mode 100644 index 000000000..ca8a37191 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java new file mode 100644 index 000000000..238ea1d13 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java @@ -0,0 +1,36 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java new file mode 100644 index 000000000..03f96e272 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.equip.comp; + +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; + +public interface EquipmentReader { + + List readEquipment(Map equipmentConstraints); +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java new file mode 100644 index 000000000..f9f7ee3d9 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java new file mode 100644 index 000000000..f51dc1402 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java @@ -0,0 +1,64 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java new file mode 100644 index 000000000..1a86c6f80 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java new file mode 100644 index 000000000..05d2e76d7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java @@ -0,0 +1,81 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java new file mode 100644 index 000000000..20cb83ff2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java new file mode 100644 index 000000000..6c3d368b2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java @@ -0,0 +1,70 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java new file mode 100644 index 000000000..15342a697 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java @@ -0,0 +1,31 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java new file mode 100644 index 000000000..c77e36851 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java @@ -0,0 +1,26 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.equip.data; + +public enum EquipmentLevel { + Port, Device, Server, Site +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java new file mode 100644 index 000000000..0e510ac1a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java @@ -0,0 +1,85 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.pref; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.comp.PreferenceRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java new file mode 100644 index 000000000..559f79689 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java @@ -0,0 +1,60 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.pref; + +import org.onap.ccsdk.sli.adaptors.ra.comp.PreferenceRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java new file mode 100644 index 000000000..1faf254f4 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.reader; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java new file mode 100644 index 000000000..4943c506b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java @@ -0,0 +1,54 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.reader; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java new file mode 100644 index 000000000..d5d3d005f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.reader; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java new file mode 100644 index 000000000..59328f976 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java @@ -0,0 +1,70 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.reader; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; +import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDao; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java new file mode 100644 index 000000000..e4361f1d9 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java @@ -0,0 +1,42 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.comp; + +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java new file mode 100644 index 000000000..ab0ef3b67 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java @@ -0,0 +1,172 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.comp; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDao; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceThreshold; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; +import org.onap.ccsdk.sli.adaptors.util.expr.ExpressionEvaluator; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java new file mode 100644 index 000000000..8adf25113 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java new file mode 100644 index 000000000..481c6f45f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java @@ -0,0 +1,85 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java new file mode 100644 index 000000000..607cc0a3b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java new file mode 100644 index 000000000..445166bb6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java @@ -0,0 +1,86 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java new file mode 100644 index 000000000..724ee199c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +public interface ParameterDao { + + String getParameter(String name); +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java new file mode 100644 index 000000000..eb061f99b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java @@ -0,0 +1,57 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java new file mode 100644 index 000000000..ad1498d06 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java new file mode 100644 index 000000000..29a4aea28 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java @@ -0,0 +1,70 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java new file mode 100644 index 000000000..9d879fbe6 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java @@ -0,0 +1,38 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java new file mode 100644 index 000000000..0e765f385 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java @@ -0,0 +1,117 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; +import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java new file mode 100644 index 000000000..b51cb2e8c --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.dao; + +public interface VpeLockDao { + + String getVpeLock(String vpeName); +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java new file mode 100644 index 000000000..443f50666 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java @@ -0,0 +1,48 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java new file mode 100644 index 000000000..383c28308 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java @@ -0,0 +1,33 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceRule.java new file mode 100644 index 000000000..17e0196b2 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceRule.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceThreshold.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceThreshold.java new file mode 100644 index 000000000..3f07d9f6b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ResourceThreshold.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.rule.data; + +public class ResourceThreshold { + + public String expression; + public String message; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ThresholdStatus.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ThresholdStatus.java new file mode 100644 index 000000000..5bc8d3450 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/ThresholdStatus.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java new file mode 100644 index 000000000..9f923a5c7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java @@ -0,0 +1,38 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.service.dao; + +import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java new file mode 100644 index 000000000..b0e2046f8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java @@ -0,0 +1,110 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.service.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java new file mode 100644 index 000000000..519e79194 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java new file mode 100644 index 000000000..9fd1b37f8 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.service.data; + +public enum ServiceStatus { + + Active, Pending +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java new file mode 100644 index 000000000..bda496a11 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -0,0 +1,330 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; +import org.onap.ccsdk.sli.adaptors.lock.comp.ResourceLockedException; +import org.onap.ccsdk.sli.adaptors.lock.comp.SynchronizedFunction; +import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiAssetAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiAssetAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceKey; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; +import org.onap.ccsdk.sli.adaptors.rm.util.LabelUtil; +import org.onap.ccsdk.sli.adaptors.rm.util.LimitUtil; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java new file mode 100644 index 000000000..c0dec8bb7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java @@ -0,0 +1,88 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.comp; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; +import org.onap.ccsdk.sli.adaptors.lock.comp.ResourceLockedException; +import org.onap.ccsdk.sli.adaptors.lock.comp.SynchronizedFunction; +import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/comp/ResourceLoader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceLoader.java new file mode 100644 index 000000000..2d4df68b5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceLoader.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.comp; + +import java.util.Collection; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java new file mode 100644 index 000000000..8aaa28687 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java @@ -0,0 +1,41 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.comp; + +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java new file mode 100644 index 000000000..2884e989f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -0,0 +1,128 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.comp; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; +import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.rm.util.ResourceUtil; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java new file mode 100644 index 000000000..18d6d45c7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.dao; + +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItem.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItem.java new file mode 100644 index 000000000..25d8bf97e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItem.java @@ -0,0 +1,37 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java new file mode 100644 index 000000000..fab61b39a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java new file mode 100644 index 000000000..354dd4e0b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java @@ -0,0 +1,126 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java new file mode 100644 index 000000000..4b0c82f92 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java new file mode 100644 index 000000000..9ee3cc188 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -0,0 +1,370 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.dao.jdbc; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceKey; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; +import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; + +public class ResourceDaoImpl implements ResourceDao { + + private ResourceJdbcDao resourceJdbcDao; + private ResourceLoadJdbcDao resourceLoadJdbcDao; + private AllocationItemJdbcDao allocationItemJdbcDao; + + @Override + public org.onap.ccsdk.sli.adaptors.rm.data.Resource getResource(String assetId, String resourceName) { + Resource rEntity = resourceJdbcDao.getResource(assetId, resourceName); + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + + if (r != null) { + List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); + r.allocationItems = new ArrayList(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); + r.resourceLoadList.add(rl); + } + } + + return r; + } + + @Override + public void saveResource(org.onap.ccsdk.sli.adaptors.rm.data.Resource resource) { + if (resource == null) + return; + + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai : resource.allocationItems) { + AllocationItem aiEntity = createAllocationItemEntity(resourceEntity.id, ai); + allocationItemJdbcDao.add(aiEntity); + } + if (resource.resourceLoadList != null) + for (org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + rlist.add(r); + + List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); + r.allocationItems = new ArrayList(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + rlist.add(r); + + List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); + r.allocationItems = new ArrayList(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); + r.resourceLoadList.add(rl); + } + } + return rlist; + } + + private Resource createResourceEntity(org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl) { + rlEntity.loadTime = rl.resourceLoadTime; + rlEntity.expirationTime = rl.resourceExpirationTime; + } + + private AllocationItem createAllocationItemEntity(long resourceId, org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.Resource createResource(Resource resourceEntity) { + if (resourceEntity == null) + return null; + + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.AllocationItem createAllocationItem( + org.onap.ccsdk.sli.adaptors.rm.data.Resource r, + AllocationItem aiEntity) { + if (r == null || aiEntity == null) + return null; + + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad createResourceLoad( + org.onap.ccsdk.sli.adaptors.rm.data.Resource r, + ResourceLoad rlEntity) { + if (rlEntity == null) + return null; + + org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = new org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java new file mode 100644 index 000000000..b32f34082 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java new file mode 100644 index 000000000..6d4455e7e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java @@ -0,0 +1,144 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoad.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoad.java new file mode 100644 index 000000000..0f45bbfcb --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoad.java @@ -0,0 +1,33 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDao.java new file mode 100644 index 000000000..789670c4b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDao.java @@ -0,0 +1,36 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java new file mode 100644 index 000000000..632a5fbec --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceLoadJdbcDaoImpl.java @@ -0,0 +1,112 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/AllocationAction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationAction.java new file mode 100644 index 000000000..edc1916b5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationAction.java @@ -0,0 +1,26 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public enum AllocationAction { + Fail, Succeed_DoNothing, Succeed_Allocate +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationItem.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationItem.java new file mode 100644 index 000000000..f8e6a75a1 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationItem.java @@ -0,0 +1,36 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/AllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationOutcome.java new file mode 100644 index 000000000..048f4f4ac --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationOutcome.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public class AllocationOutcome { + + public AllocationStatus status = null; + public AllocationRequest request = null; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java new file mode 100644 index 000000000..25a4fbba9 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/AllocationStatus.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationStatus.java new file mode 100644 index 000000000..bef9a1114 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationStatus.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public enum AllocationStatus { + + Success, Failure, NotTried, ResourceNotFound, ResourceExpired +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/InitAction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/InitAction.java new file mode 100644 index 000000000..f6fc7c9b3 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/InitAction.java @@ -0,0 +1,36 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationItem.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationItem.java new file mode 100644 index 000000000..d41bfd62a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationItem.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public class LabelAllocationItem extends AllocationItem { + + public String label; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationOutcome.java new file mode 100644 index 000000000..9c9f9145d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationOutcome.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationRequest.java new file mode 100644 index 000000000..97751fc01 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelAllocationRequest.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LabelResource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelResource.java new file mode 100644 index 000000000..d09dba267 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LabelResource.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationItem.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationItem.java new file mode 100644 index 000000000..ad1674f7b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationItem.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public class LimitAllocationItem extends AllocationItem { + + public long used; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationOutcome.java new file mode 100644 index 000000000..d635e3605 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationOutcome.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationRequest.java new file mode 100644 index 000000000..06c0e8393 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitAllocationRequest.java @@ -0,0 +1,31 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/LimitResource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitResource.java new file mode 100644 index 000000000..2fd9b6cae --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/LimitResource.java @@ -0,0 +1,27 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public class LimitResource extends Resource { + + public long used = 0; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationOutcome.java new file mode 100644 index 000000000..2d7b11c31 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationOutcome.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationRequest.java new file mode 100644 index 000000000..366201f35 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiAssetAllocationRequest.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationOutcome.java new file mode 100644 index 000000000..f71c247da --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationOutcome.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +import java.util.List; + +public class MultiResourceAllocationOutcome extends AllocationOutcome { + + public List allocationOutcomeList; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationRequest.java new file mode 100644 index 000000000..3244c2340 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/MultiResourceAllocationRequest.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationItem.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationItem.java new file mode 100644 index 000000000..8e62ef653 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationItem.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +import java.util.SortedSet; + +public class RangeAllocationItem extends AllocationItem { + + public SortedSet used; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationOutcome.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationOutcome.java new file mode 100644 index 000000000..3b675c221 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationOutcome.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java new file mode 100644 index 000000000..b42960d9d --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java @@ -0,0 +1,36 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/RangeResource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeResource.java new file mode 100644 index 000000000..c39cb37ea --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeResource.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +import java.util.SortedSet; + +public class RangeResource extends Resource { + + public SortedSet used; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Resource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Resource.java new file mode 100644 index 000000000..59706f4d5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Resource.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/ResourceKey.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceKey.java new file mode 100644 index 000000000..b1f8d5910 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceKey.java @@ -0,0 +1,50 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/ResourceLoad.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceLoad.java new file mode 100644 index 000000000..1ff1962af --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceLoad.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/data/ResourceType.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceType.java new file mode 100644 index 000000000..60896e492 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ResourceType.java @@ -0,0 +1,26 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public enum ResourceType { + Limit, Label, Range +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java new file mode 100644 index 000000000..7cc541dd7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java @@ -0,0 +1,95 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.util; + +import java.util.ArrayList; +import java.util.Date; + +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceKey; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java new file mode 100644 index 000000000..8f284b595 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java @@ -0,0 +1,334 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceKey; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java new file mode 100644 index 000000000..f01d35784 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java @@ -0,0 +1,110 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.util; + +import java.util.ArrayList; +import java.util.Date; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceKey; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java new file mode 100644 index 000000000..ae7c21575 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.util; + +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java new file mode 100644 index 000000000..0e46868bc --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java @@ -0,0 +1,122 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/db/ConnectionWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/ConnectionWrap.java new file mode 100644 index 000000000..7d2554806 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/ConnectionWrap.java @@ -0,0 +1,338 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java new file mode 100644 index 000000000..2aebb83e3 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java @@ -0,0 +1,98 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java new file mode 100644 index 000000000..037b78b77 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java @@ -0,0 +1,207 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java new file mode 100644 index 000000000..1aad8f501 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java @@ -0,0 +1,41 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/str/StrUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java new file mode 100644 index 000000000..ef889f0d5 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java @@ -0,0 +1,305 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java new file mode 100644 index 000000000..11e64ae1a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java new file mode 100644 index 000000000..74025f15b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java @@ -0,0 +1,76 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/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 6eb8156f8..000000000 --- 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 2c7726790..000000000 --- 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 a1ac2fd3a..000000000 --- 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 df0ecd1c0..000000000 --- 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 c256dc27e..000000000 --- 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 fda097ebc..000000000 --- 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 fbcee05e7..000000000 --- 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 9c60a38f2..000000000 --- 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 ddbbeabdc..000000000 --- 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 6fcaf1792..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -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.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 2ada6356c..000000000 --- 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 4db6a7307..000000000 --- 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 f2c0f76d0..000000000 --- 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 109960dcb..000000000 --- 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 103555195..000000000 --- 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 0feb2c75c..000000000 --- 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 01e2695da..000000000 --- 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 64a6c2719..000000000 --- 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 07e0718c4..000000000 --- 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 c6e9b758d..000000000 --- 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 a55bca31d..000000000 --- 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 76f7e3e6b..000000000 --- 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 7c4593d09..000000000 --- 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 325972c9a..000000000 --- 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 e149a94be..000000000 --- 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 eb4ee950c..000000000 --- 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 e637f116e..000000000 --- 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 52d8961a2..000000000 --- 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 80aca0b02..000000000 --- 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 b2424acb5..000000000 --- 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 4126d1533..000000000 --- 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 7847d5b54..000000000 --- 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 b795533d7..000000000 --- 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 90cd6c5a1..000000000 --- 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 974e48bbd..000000000 --- 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 3344355d1..000000000 --- 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 b3f20800e..000000000 --- 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 399862bf6..000000000 --- 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 24cd39970..000000000 --- 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 befb8b7ef..000000000 --- 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 b9b136a82..000000000 --- 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 b2caffcf2..000000000 --- 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 cffd6b11b..000000000 --- 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 ad6fbb79e..000000000 --- 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 2bac62efc..000000000 --- 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 204f7eb3d..000000000 --- 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 cac4ce5d4..000000000 --- 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 805bfa9c6..000000000 --- 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 fcec72f71..000000000 --- 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 9bc18e63d..000000000 --- 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 72de3bdb2..000000000 --- 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 3f0692dba..000000000 --- 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 268c4d634..000000000 --- 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 bc335aa30..000000000 --- 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 5cb9f376d..000000000 --- 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 be3ac5704..000000000 --- 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 d7cb10251..000000000 --- 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 fa57dcdd7..000000000 --- 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 780c62ad4..000000000 --- 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 40b942213..000000000 --- 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 656c7755c..000000000 --- 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 5203a4de0..000000000 --- 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 dea147bd7..000000000 --- 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 903dc825c..000000000 --- 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 45021ac27..000000000 --- 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 adac5207f..000000000 --- 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 9aac5542a..000000000 --- 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 ab6ee3686..000000000 --- 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 d1f567ff0..000000000 --- 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 3f751cb7e..000000000 --- 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 17c994144..000000000 --- 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 e02b40418..000000000 --- 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 2b576ba8b..000000000 --- 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 0cf97d6aa..000000000 --- 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 38e4f1787..000000000 --- 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 d91daae99..000000000 --- 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 0838c35d2..000000000 --- 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 d7e90bf64..000000000 --- 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 69f23e95b..000000000 --- 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 a3d5cce98..000000000 --- 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 9630fd3ef..000000000 --- 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 b697053c3..000000000 --- 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 be6e69487..000000000 --- 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 522a9bd38..000000000 --- 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 4e78a99f7..000000000 --- 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 b6fef4b95..000000000 --- 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 ffdfb2248..000000000 --- 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 ccf843547..000000000 --- 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 61c8f141e..000000000 --- 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 da21cd22d..000000000 --- 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 b5f079005..000000000 --- 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 2e7a7979d..000000000 --- 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 5c2ffc0b4..000000000 --- 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 ee265c487..000000000 --- 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 213283002..000000000 --- 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 4aa973f14..000000000 --- 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 f7a2b949c..000000000 --- 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 47f04a957..000000000 --- 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 b8ebc29d3..000000000 --- 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 60fc2da60..000000000 --- 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 eb0d84164..000000000 --- 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 943c09bfc..000000000 --- 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 83fdef898..000000000 --- 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 e2f61e7d9..000000000 --- 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 0ab656264..000000000 --- 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 c6f3b7281..000000000 --- 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 cea781bcd..000000000 --- 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 6f66830ee..000000000 --- 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 16344e7e6..000000000 --- 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 a34ab0ecd..000000000 --- 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 076e4cc80..000000000 --- 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 9ef78eea7..000000000 --- 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 252e37700..000000000 --- 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 21a0c80d4..000000000 --- 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 40af34bdc..000000000 --- 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 83cc77490..000000000 --- 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 4a26d8c43..000000000 --- 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 fdc3892af..000000000 --- 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 4e262ba9b..000000000 --- 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 4060935ae..000000000 --- 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 index 5dfb08838..473173e76 100644 --- 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 @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,11 +27,11 @@ - + - + @@ -45,17 +45,17 @@ - + - + - + @@ -63,25 +63,25 @@ - + - + - + - + - + @@ -90,61 +90,61 @@ - + - + - + - + - + - + - + - + - + - + + class="org.onap.ccsdk.sli.adaptors.ra.rule.comp.AllocationRequestBuilderImpl"> - + @@ -160,13 +160,13 @@ - + - + @@ -193,7 +193,7 @@ - + @@ -230,67 +230,67 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 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 index 591e5b88e..7fe544378 100644 --- 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 @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ javax.sql.DataSource - org.openecomp.sdnc.sli.resource.dblib.DbLibService + org.onap.ccsdk.sli.adaptors.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 index 887697bdb..72dbcf87c 100644 --- a/resource-assignment/provider/src/main/resources/resource-allocator.properties +++ b/resource-assignment/provider/src/main/resources/resource-allocator.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ # ============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 +org.onap.ccsdk.sli.adaptors.dbtype = jdbc +org.onap.ccsdk.sli.adaptors.jdbc.url = jdbc:mysql://dbhost:3306/sdnctl +org.onap.ccsdk.sli.adaptors.jdbc.database = sdnctl +org.onap.ccsdk.sli.adaptors.jdbc.user = sdnctl +org.onap.ccsdk.sli.adaptors.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 index 8c0b0fb7d..f69b6bcd8 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. 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 index 8d8af4988..bc7babaf1 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. 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 index ca0624a24..e3f18390b 100644 --- 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 @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java new file mode 100644 index 000000000..ba57f626a --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -0,0 +1,261 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra; + +import java.util.Date; + +import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb; +import jtest.util.org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java new file mode 100644 index 000000000..5b9423422 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java @@ -0,0 +1,424 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +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/onap/ccsdk/sli/adaptors/ra/TestQuery.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQuery.java new file mode 100644 index 000000000..435f4aaa5 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQuery.java @@ -0,0 +1,85 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +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/onap/ccsdk/sli/adaptors/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java new file mode 100644 index 000000000..621022545 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java @@ -0,0 +1,430 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +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/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java new file mode 100644 index 000000000..a4ee52547 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -0,0 +1,681 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +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/onap/ccsdk/sli/adaptors/ra/TestReserve2.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve2.java new file mode 100644 index 000000000..7ae169762 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve2.java @@ -0,0 +1,77 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +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/onap/ccsdk/sli/adaptors/rm/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/DataSetup.java new file mode 100644 index 000000000..473a99f4c --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/DataSetup.java @@ -0,0 +1,106 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm; + +import java.util.Date; + +import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb; +import jtest.util.org.onap.ccsdk.sli.adaptors.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/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 8329cd0b7..000000000 --- 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 951b40559..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.ra.ResourceAllocator; -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 3b4898888..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.ra.ResourceAllocator; -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 b72d5079a..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.ra.ResourceAllocator; -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 913f2d16a..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.ra.ResourceAllocator; -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 c4d015891..000000000 --- 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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.openecomp.sdnc.ra.ResourceAllocator; -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 118137ec6..000000000 --- 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 index 7434d939f..6446240dc 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package jtest.util.org.openecomp.sdnc.ra; +package jtest.util.org.onap.ccsdk.sli.adaptors.ra; import org.springframework.jdbc.core.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 index fe854bdd1..cda7302c9 100644 --- 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 @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package jtest.util.org.openecomp.sdnc.ra; +package jtest.util.org.onap.ccsdk.sli.adaptors.ra; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.rowset.SqlRowSet; diff --git a/resource-assignment/provider/src/test/resources/log4j.properties b/resource-assignment/provider/src/test/resources/log4j.properties index 922ce8615..34dcdfb68 100644 --- a/resource-assignment/provider/src/test/resources/log4j.properties +++ b/resource-assignment/provider/src/test/resources/log4j.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/resource-assignment/provider/src/test/resources/param.txt b/resource-assignment/provider/src/test/resources/param.txt index d1aac4777..a20ac909d 100755 --- a/resource-assignment/provider/src/test/resources/param.txt +++ b/resource-assignment/provider/src/test/resources/param.txt @@ -40,5 +40,5 @@ Release: Error message in: error-message, error-code -Plugin name: org.openecomp.sdnc.ra.ResourceAllocator +Plugin name: org.onap.ccsdk.sli.adaptors.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 index 05f9ef4f4..5fd4c7577 100644 --- a/resource-assignment/provider/src/test/resources/sql/data.sql +++ b/resource-assignment/provider/src/test/resources/sql/data.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/resource-assignment/provider/src/test/resources/sql/schema.sql b/resource-assignment/provider/src/test/resources/sql/schema.sql index a61158aa0..40761de42 100644 --- a/resource-assignment/provider/src/test/resources/sql/schema.sql +++ b/resource-assignment/provider/src/test/resources/sql/schema.sql @@ -3,7 +3,7 @@ -- openECOMP : SDN-C -- ================================================================================ -- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. +-- reserved. -- ================================================================================ -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/resource-assignment/provider/src/test/resources/test-context.xml b/resource-assignment/provider/src/test/resources/test-context.xml index 4f7bf4fbf..c3b09a1f5 100644 --- a/resource-assignment/provider/src/test/resources/test-context.xml +++ b/resource-assignment/provider/src/test/resources/test-context.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -49,28 +49,28 @@ - + - + - + - + - + @@ -78,25 +78,25 @@ - + - + - + - + - + @@ -105,60 +105,60 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -174,13 +174,13 @@ - + - + @@ -207,7 +207,7 @@ - + @@ -243,55 +243,55 @@ - + - + - + - + - + - + - + - + - + - + - + - + -- cgit 1.2.3-korg From 3c3e80c786c42381e75a5e72254729a92ab7722c Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Fri, 18 Aug 2017 13:42:02 -0700 Subject: Clean final ecomp references from sli-adaptors Issue-Id: CCSDK-19 Change-Id: I40c0287ebdaeb93fc17370a8692fbac5edf32d08 Signed-off-by: Marcus G K Williams --- .gitignore | 2 +- README.md | 2 +- aai-service/pom.xml | 82 ++++++++++----------- example-settings.xml | 163 ------------------------------------------ jenkins-settings.xml | 168 -------------------------------------------- mdsal-resource/pom.xml | 2 +- pom.xml | 29 ++++---- resource-assignment/pom.xml | 2 +- sql-resource/pom.xml | 2 +- 9 files changed, 61 insertions(+), 391 deletions(-) delete mode 100644 example-settings.xml delete mode 100644 jenkins-settings.xml (limited to 'resource-assignment') diff --git a/.gitignore b/.gitignore index 2932cb920..f7a3d77cd 100755 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,6 @@ provider/src/main/java/META-INF/ provider/src/main/java/inventory/ ## BlackDuck generated file -sdnc-adaptors_bdio.jsonld +ccsdk-adaptors_bdio.jsonld blackDuckHubProjectName.txt blackDuckHubProjectVersionName.txt diff --git a/README.md b/README.md index c1e7af927..c906c67da 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ 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. +1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains references to the ONAP repositories and OpenDaylight repositories. See example-settings.xml for an example. 2. To compile, run "mvn clean install". diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 9c89a1773..857ada4d5 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -1,45 +1,45 @@ - - org.onap.ccsdk.sli.adaptors - sdnc-adaptors - 0.1.0-SNAPSHOT - - - 4.0.0 - pom - org.onap.ccsdk.sli.adaptors - aai-service - - - AAI Interface Service - The AAI Interface service exposes an interface to AAI as an OSGi service - - 0.1.0-SNAPSHOT - - - - - org.onap.ccsdk.sli.adaptors - aai-service-features - features - ${project.version} - xml - - - - org.onap.ccsdk.sli.adaptors - aai-service-provider - ${project.version} - - - - - - - provider - features - installer - + + org.onap.ccsdk.sli.adaptors + ccsdk-adaptors + 0.1.0-SNAPSHOT + + + 4.0.0 + pom + org.onap.ccsdk.sli.adaptors + aai-service + + + AAI Interface Service + The AAI Interface service exposes an interface to AAI as an OSGi service + + 0.1.0-SNAPSHOT + + + + + org.onap.ccsdk.sli.adaptors + aai-service-features + features + ${project.version} + xml + + + + org.onap.ccsdk.sli.adaptors + aai-service-provider + ${project.version} + + + + + + + provider + features + installer + diff --git a/example-settings.xml b/example-settings.xml deleted file mode 100644 index 2e7ce6445..000000000 --- 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 344994f85..000000000 --- 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/pom.xml b/mdsal-resource/pom.xml index eddff3039..ba4b94429 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - sdnc-adaptors + ccsdk-adaptors 0.1.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index f4e8fcb52..5544f1bea 100755 --- a/pom.xml +++ b/pom.xml @@ -11,34 +11,35 @@ 4.0.0 pom org.onap.ccsdk.sli.adaptors - sdnc-adaptors + ccsdk-adaptors - SDN-C Adaptors - https://wiki.openecomp.org - The SDN-C core components contains the SLI, dblib and root pom + CCSDK SLI Adaptors + https://wiki.onap.org + The CCSDK core components contains the SLI, dblib and root pom JIRA - https://jira.openecomp.org/ + https://jira.onap.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 + scm:git:ssh://git@${onap.git.host}/ccsdk/sli/adaptors + scm:git:ssh://${onap.git.host}:${onap.git.port}/ccsdk/sli/adaptors + ${onap.git.protocol}://${onap.git.host}/ccsdk/sli/adaptors + ccsdk-adaptors-${project.version} Jenkins - https://jenkins.openecomp.org/ + https://jenkins.onap.org/ sdnc-javadoc - dav:https://${openecomp.nexus.host}/content/sites/site/org/onap/sdnc/adaptors/${project.artifactId}/${project.version} + dav:https://${onap.nexus.host}/content/sites/site/org/onap/sdnc/adaptors/${project.artifactId}/${project.version} @@ -96,9 +97,9 @@ 1.6.7 true - https://${openecomp.nexus.host} - ${openecomp.nexus.staging.profile-id} - ${openecomp.nexus.staging.server-id} + https://${onap.nexus.host} + ${onap.nexus.staging.profile-id} + ${onap.nexus.staging.server-id} @@ -111,7 +112,7 @@ sql-resource - OpenECOMP + ONAP 0.1.0-SNAPSHOT diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 37889db03..17860829d 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - sdnc-adaptors + ccsdk-adaptors 0.1.0-SNAPSHOT diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index ffec0c427..a84e7e4ee 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - sdnc-adaptors + ccsdk-adaptors 0.1.0-SNAPSHOT -- cgit 1.2.3-korg From 6fbbf0193e7389c80d85c205f1edd9af6ac0e431 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 29 Aug 2017 08:45:58 -0400 Subject: Update artifactId of ccsdk/sli/adaptors pom.xml Update artifactId of top level pom.xml of ccsdk/sli/adaptors to match the repo name (ccsdk-sli-adaptors instead of ccsdk-adaptors). This is not strictly speaking necessary, but will be a helpful convention since there are some repos within ccsdk that have similar names, like ccsdk/sli/plugins and ccsdk/platform/plugins. Update parent artifactId in pom.xml for each module in ccsdk/sli/adaptors Change-Id: Idec7772c406754db6f03cf03a1a338793c2ce636 Issue-ID: CCSDK-70 Signed-off-by: Dan Timoney --- aai-service/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/pom.xml | 2 +- sql-resource/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 857ada4d5..93b286c95 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors - ccsdk-adaptors + ccsdk-sli-adaptors 0.1.0-SNAPSHOT diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index ba4b94429..242a671e3 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - ccsdk-adaptors + ccsdk-sli-adaptors 0.1.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 5544f1bea..f641ef502 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ 4.0.0 pom org.onap.ccsdk.sli.adaptors - ccsdk-adaptors + ccsdk-sli-adaptors CCSDK SLI Adaptors https://wiki.onap.org diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 17860829d..4755f5427 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - ccsdk-adaptors + ccsdk-sli-adaptors 0.1.0-SNAPSHOT diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index a84e7e4ee..c372a7c56 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -2,7 +2,7 @@ org.onap.ccsdk.sli.adaptors - ccsdk-adaptors + ccsdk-sli-adaptors 0.1.0-SNAPSHOT -- cgit 1.2.3-korg From 7703d8d1f66f7a3709f7d44202833cb8fe0e4274 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Fri, 1 Sep 2017 15:41:27 -0700 Subject: Enable surefire unit testing Issue-Id: CCSDK-67 Change-Id: I955938365dd62b2125b73f8a668568e3343db015 Signed-off-by: Marcus G K Williams --- pom.xml | 2 +- .../ccsdk/sli/adaptors/ra/TestIsAvailable.java | 23 +-- .../adaptors/resource/sql/ITCaseSqlResource.java | 218 +++++++++++++++++++++ .../sli/adaptors/resource/sql/SqlResourceTest.java | 218 --------------------- 4 files changed, 221 insertions(+), 240 deletions(-) create mode 100644 sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java delete mode 100644 sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResourceTest.java (limited to 'resource-assignment') diff --git a/pom.xml b/pom.xml index f641ef502..eefdf04e9 100755 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ maven-surefire-plugin 2.17 - true + false diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java index 5b9423422..4dee2d61e 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java @@ -367,25 +367,6 @@ public class TestIsAvailable { 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(); @@ -403,8 +384,8 @@ public class TestIsAvailable { } @Test - public void test013() throws Exception { - String t = "013"; + public void test012() throws Exception { + String t = "012"; log.info("============== isAvailable " + t + " ================================"); log.info("=== Test input validations - speed-unit missing in input"); diff --git a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java new file mode 100644 index 000000000..f0ab60379 --- /dev/null +++ b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java @@ -0,0 +1,218 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.resource.sql; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Enumeration; +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import junit.framework.TestCase; + +public class ITCaseSqlResource extends TestCase { + + private static final Logger LOG = LoggerFactory + .getLogger(ITCaseSqlResource.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/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResourceTest.java b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResourceTest.java deleted file mode 100644 index 2d48ff3f4..000000000 --- a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.resource.sql; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Enumeration; -import java.util.Properties; - -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.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)); - } - } - -} -- cgit 1.2.3-korg From a54af3e7b27bc15d051064ba7990121ac7d27eea Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Wed, 6 Sep 2017 19:14:51 -0400 Subject: Fix resource-assignment dependencies Resource-assignment was not loading due to unresolved dependencies. This turned out to be due to a few issues, addressed by this change: - commons-lang had to be added as a bundle in features.xml - package name for DbLibService in spring config was wrong, preventing spring from initializing properly - DbLibService's package (org.onap.ccsdk.sli.core.dblib) was not detected properly by felix maven plugin and was missing from Import-Package in MANIFEST. Resolved by explicitly adding that package in felix plugin config in provider pom.xml Change-Id: I6ebb82ebae0e96b4ab9592e29f6a7a1d2276aa69 Issue-ID: CCSDK-79 Signed-off-by: Dan Timoney --- resource-assignment/features/src/main/resources/features.xml | 5 +++-- resource-assignment/installer/pom.xml | 2 ++ resource-assignment/provider/pom.xml | 4 +++- .../resources/META-INF/spring/resource-assignment-osgi-context.xml | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/features/src/main/resources/features.xml b/resource-assignment/features/src/main/resources/features.xml index d3362fba2..f4191293d 100644 --- a/resource-assignment/features/src/main/resources/features.xml +++ b/resource-assignment/features/src/main/resources/features.xml @@ -9,9 +9,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,6 +35,7 @@ spring-dm mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version} mvn:mysql/mysql-connector-java/${mysql.connector.version} + mvn:commons-lang/commons-lang/2.6 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 8915b8d6a..8367b03ff 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -15,6 +15,7 @@ sdnc-resource-assignment mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-features/${project.version}/xml/features false + 2.6 @@ -39,6 +40,7 @@ ${project.version} + diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 1b98c628a..89134284c 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -94,9 +94,11 @@ org.onap.ccsdk.sli.adaptors.ra org.onap.ccsdk.sli.adaptors.ra + true + --> + *,org.onap.ccsdk.sli.core.dblib 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 index 7fe544378..be22d8766 100644 --- 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 @@ -9,9 +9,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,7 +30,7 @@ javax.sql.DataSource - org.onap.ccsdk.sli.adaptors.resource.dblib.DbLibService + org.onap.ccsdk.sli.core.dblib.DbLibService -- cgit 1.2.3-korg From af5a763bf7d5ae67629d9298a74474bf791afc4f Mon Sep 17 00:00:00 2001 From: "ramu.n" Date: Fri, 8 Sep 2017 19:55:19 +0530 Subject: Fix few Critical sonar issues Fix few Critical sonar issues in CCSDK SLI Adaptors https://sonar.onap.org/component_issues?id=org.onap.ccsdk.sli.adaptors%3Accsdk-sli-adaptors#resolved=false|severities=CRITICAL Change-Id: Id694401c71e9a5ae2508333f03eab8e87008ccd0 Issue-Id: CCSDK-67 Signed-off-by: Ramu N --- .../adaptors/ra/comp/EndPointAllocatorImpl.java | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 0f488bc67..db30bf62d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,6 +22,7 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -201,6 +202,38 @@ public class EndPointAllocatorImpl implements EndPointAllocator { } return 0; } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (!(object instanceof PrefEquipment)) { + return false; + } + if (!super.equals(object)) { + return false; + } + + PrefEquipment that = (PrefEquipment) object; + if (equipData != null ? !equipData.equals(that.equipData) : that.equipData != null) { + return false; + } + + if (!Arrays.equals(prefNumbers, that.prefNumbers)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (equipData != null ? equipData.hashCode() : 0); + result = 31 * result + Arrays.hashCode(prefNumbers); + return result; + } } public void setEndPointAllocationDefinitionMap( -- cgit 1.2.3-korg From d2d5675af191d2650cf8c627268d2a9afb114a7b Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Tue, 19 Sep 2017 12:10:28 +0530 Subject: Fix Sonar Issue One blocker issue in sli/adapters module *check for null dereferencing Issue-Id: CCSDK-87 Change-Id: I6c2b308bed95069089770cbec7ef728e2a8cc030 Signed-off-by: surya-huawei --- .../onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index 9ee3cc188..7db37fff5 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -298,10 +298,12 @@ public class ResourceDaoImpl implements ResourceDao { r = rr; } - r.resourceType = type; - r.resourceKey = new ResourceKey(); - r.resourceKey.assetId = resourceEntity.assetId; - r.resourceKey.resourceName = resourceEntity.name; + if (r != null) { + r.resourceType = type; + r.resourceKey = new ResourceKey(); + r.resourceKey.assetId = resourceEntity.assetId; + r.resourceKey.resourceName = resourceEntity.name; + } return r; } -- cgit 1.2.3-korg From 4d02e5b32dbce0815010a6bf61624420ab0ff1a3 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 19 Sep 2017 19:06:17 -0400 Subject: Remove mysql references from sli/adaptors Remove mysql references from sli/adaptors repository. Change-Id: I19682626fdb954ce8190d61507eabe0152a6a635 Issue-ID: CCSDK-95 Signed-off-by: Dan Timoney --- pom.xml | 2 +- .../features/src/main/resources/features.xml | 2 +- resource-assignment/provider/pom.xml | 6 ++--- sql-resource/provider/pom.xml | 6 +++++ .../adaptors/resource/sql/ITCaseSqlResource.java | 19 ++++++++++--- .../src/test/resources/svclogic.properties | 31 +++++++++++----------- 6 files changed, 43 insertions(+), 23 deletions(-) (limited to 'resource-assignment') diff --git a/pom.xml b/pom.xml index a219c0d67..341a801c2 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-carbon-sr1 - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT 4.0.0 diff --git a/resource-assignment/features/src/main/resources/features.xml b/resource-assignment/features/src/main/resources/features.xml index f4191293d..ca1126d37 100644 --- a/resource-assignment/features/src/main/resources/features.xml +++ b/resource-assignment/features/src/main/resources/features.xml @@ -34,7 +34,7 @@ spring-jdbc spring-dm mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version} - mvn:mysql/mysql-connector-java/${mysql.connector.version} + mvn:org.mariadb.jdbc/mariadb-java-client/${mariadb.connector.version} mvn:commons-lang/commons-lang/2.6 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 89134284c..741f9fbe2 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -61,9 +61,9 @@ ${slf4j.version} - mysql - mysql-connector-java - ${mysql.connector.version} + org.mariadb.jdbc + mariadb-java-client + ${mariadb.connector.version} jar runtime diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 841561b6d..9a7d2457b 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -20,6 +20,12 @@ ${junit.version} test + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + org.onap.ccsdk.sli.core sli-common diff --git a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java index f0ab60379..e66034ba8 100644 --- a/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java +++ b/sql-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/sql/ITCaseSqlResource.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,6 +32,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; import junit.framework.TestCase; public class ITCaseSqlResource extends TestCase { @@ -40,7 +42,7 @@ public class ITCaseSqlResource extends TestCase { .getLogger(ITCaseSqlResource.class); - public void testExists() { + public void testExists() throws Exception { Properties props = new Properties(); @@ -57,6 +59,17 @@ public class ITCaseSqlResource extends TestCase { fail("Could not initialize properties"); } + + // Start MariaDB4j database + DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); + config.setPort(0); // 0 => autom. detect free port + DB db = DB.newEmbeddedDB(config.build()); + db.start(); + + // Override jdbc URL and database name + props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test"); + props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + // Add properties to global properties Enumeration propNames = props.keys(); diff --git a/sql-resource/provider/src/test/resources/svclogic.properties b/sql-resource/provider/src/test/resources/svclogic.properties index 69c8e2487..6504e1aec 100644 --- a/sql-resource/provider/src/test/resources/svclogic.properties +++ b/sql-resource/provider/src/test/resources/svclogic.properties @@ -8,9 +8,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,17 +18,18 @@ # limitations under the License. # ============LICENSE_END========================================================= ### +org.onap.ccsdk.sli.dbtype=jdbc -org.onap.ccsdk.sli.adaptors.dbtype=jdbc -org.onap.ccsdk.sli.adaptors.jdbc.hosts=localhost -org.onap.ccsdk.sli.adaptors.jdbc.url=jdbc:mysql://DBHOST:3306/sdnctl -org.onap.ccsdk.sli.adaptors.jdbc.database=sdnctl -org.onap.ccsdk.sli.adaptors.jdbc.user=sdnctl -org.onap.ccsdk.sli.adaptors.jdbc.password=gamma -org.onap.ccsdk.sli.adaptors.jdbc.connection.name=sdnctldb01 - -org.onap.ccsdk.sli.adaptors.jdbc.connection.timeout=50 -org.onap.ccsdk.sli.adaptors.jdbc.request.timeout=100 -org.onap.ccsdk.sli.adaptors.jdbc.limit.init=10 -org.onap.ccsdk.sli.adaptors.jdbc.limit.min=10 -org.onap.ccsdk.sli.adaptors.jdbc.limit.max=20 +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver +org.onap.ccsdk.sli.jdbc.database=sdnctl +org.onap.ccsdk.sli.jdbc.user=sdnctl +org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 +org.onap.ccsdk.sli.jdbc.connection.timeout=50 +org.onap.ccsdk.sli.jdbc.request.timeout=100 +org.onap.ccsdk.sli.jdbc.limit.init=10 +org.onap.ccsdk.sli.jdbc.limit.min=10 +org.onap.ccsdk.sli.jdbc.limit.max=20 +org.onap.dblib.connection.recovery=false -- cgit 1.2.3-korg From d1ed09daa141268d0cb830f5060e9463719d1eba Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Wed, 20 Sep 2017 12:22:35 +0530 Subject: Fix Sonar Issue in sli/adaptors module One blocker issue *Checking for a null dereferencing This is to avoid NullPointerException Issue-Id: CCSDK-87 Change-Id: Ie2192636e3ad8dfa9643cac61b3086c3cd33f126 Signed-off-by: surya-huawei --- .../sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index 7db37fff5..58f103655 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -331,14 +331,16 @@ public class ResourceDaoImpl implements ResourceDao { 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; + if (ai!=null) { + 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; } -- cgit 1.2.3-korg From e36b3f21fb653e5a27e76d44daa54f537e39a525 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Thu, 21 Sep 2017 15:00:19 +0530 Subject: Move string literals to left hand side Moving string literals to left-hand side of equals()/equalsIgnore() *This is done to prevent null pointer exception from being raised Issue-Id: CCSDK-87 Change-Id: Ibe9deee4fd48b3037be8708a0e3869d741c9173b Signed-off-by: surya-huawei --- .../org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index d1913b33d..8e7c63ceb 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -149,7 +149,7 @@ public class ResourceAllocator implements SvcLogicResource { prefix = prefix == null ? "" : prefix + '.'; - if (!resource.equals("NetworkCapacity")) { + if (!"NetworkCapacity".equals(resource)) { log.info("resource: " + resource); log.info("key: " + key); @@ -374,7 +374,7 @@ public class ResourceAllocator implements SvcLogicResource { log.info("Checking VPE port: " + portId); String provStatus = String.valueOf(vpe.get("provisioning-status")); - if (!provStatus.equals("PROV")) { + if (!"PROV".equals(provStatus)) { log.info("Skipping port " + portId + ": Provisioning status is not PROV."); continue; } @@ -476,7 +476,7 @@ public class ResourceAllocator implements SvcLogicResource { log.info("Checking VPLSPE port: " + portId); String provStatus = String.valueOf(vplspe.get("provisioning-status")); - if (!provStatus.equals("PROV")) { + if (!"PROV".equals(provStatus)) { log.info("Skipping port " + portId + ": Provisioning status is not PROV."); continue; } @@ -572,7 +572,7 @@ public class ResourceAllocator implements SvcLogicResource { for (AllocationOutcome ao1 : mrao.allocationOutcomeList) { if (ao1 instanceof LimitAllocationOutcome) { LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1; - if (lao.request.resourceName.equals("Bandwidth")) { + if ("Bandwidth".equals(lao.request.resourceName)) { ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao); setThresholdData(ctx, th, sd, ed); } @@ -588,12 +588,12 @@ public class ResourceAllocator implements SvcLogicResource { for (AllocationOutcome ao1 : mrao.allocationOutcomeList) { if (ao1 instanceof LimitAllocationOutcome) { LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1; - if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Bandwidth")) { + if (lao.status == AllocationStatus.Failure && "Bandwidth".equals(lao.request.resourceName)) { long available = lao.limit - lao.used; if (available > maxAvailableSpeedServer) maxAvailableSpeedServer = available; } - if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Connection")) { + if (lao.status == AllocationStatus.Failure && "Connection".equals(lao.request.resourceName)) { maxAvailableSpeedServer = 0; break; } -- cgit 1.2.3-korg From ebe6d0127c2dce4ec0953e2a6fc2e40a27609097 Mon Sep 17 00:00:00 2001 From: Rich Tabedzki Date: Thu, 28 Sep 2017 02:22:20 +0000 Subject: Added Blueprint configuration Changes made: 1. Removed Spring DM configuration for resource-assignment 2. Added blueprint configuration for resource-assignment Change-Id: Ib084b863a6a5ee1283ba3dfb7b61d61619a27c38 Issue-ID: CCSDK-102 Signed-off-by: Rich Tabedzki --- .../adaptors/aai/r1607/R1607AutoGeneratedTest.java | 12 +- .../src/test/resources/aaiclient.properties | 9 +- .../spring/resource-assignment-context.xml | 296 --------------------- .../spring/resource-assignment-osgi-context.xml | 39 --- .../blueprint/resource-assignment-blueprint.xml | 29 ++ .../opendaylight/blueprint/resource-assignment.xml | 126 +++++++++ 6 files changed, 169 insertions(+), 342 deletions(-) mode change 100644 => 100755 aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.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 create mode 100755 resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml create mode 100755 resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml (limited to 'resource-assignment') diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java old mode 100644 new mode 100755 index b0345157c..e0f201230 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,9 +48,8 @@ import org.apache.commons.lang.StringUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; +import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.onap.ccsdk.sli.adaptors.aai.AAIClient; import org.onap.ccsdk.sli.adaptors.aai.AAIDeclarations; import org.onap.ccsdk.sli.adaptors.aai.AAIRequest; @@ -58,6 +57,8 @@ import org.onap.ccsdk.sli.adaptors.aai.AAIService; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; import org.openecomp.aai.inventory.v11.GenericVnf; import org.openecomp.aai.inventory.v11.InventoryResponseItems; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +80,7 @@ public class R1607AutoGeneratedTest { public static void setUp() throws Exception { // super.setUp(); URL url = AAIService.class.getResource(AAIService.AAICLIENT_PROPERTIES); - client = new AAIService(url); +// client = new AAIService(url); LOG.info("\nTaicAAIResourceTest.setUp\n"); } @@ -476,7 +477,8 @@ public class R1607AutoGeneratedTest { } } -static class MySchemaOutputResolver extends SchemaOutputResolver { + + static class MySchemaOutputResolver extends SchemaOutputResolver { public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { File file = new File(suggestedFileName); diff --git a/aai-service/provider/src/test/resources/aaiclient.properties b/aai-service/provider/src/test/resources/aaiclient.properties index e615fc124..c09be3a4b 100755 --- a/aai-service/provider/src/test/resources/aaiclient.properties +++ b/aai-service/provider/src/test/resources/aaiclient.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,8 +40,13 @@ org.onap.ccsdk.sli.adaptors.aai.application=CCSDK # # Configuration file for A&AI Client # -#org.onap.ccsdk.sli.adaptors.aai.uri=https://localhost:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-ext1.test.att.com:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int1.test.att.com:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://mtanjv9aaas40.aic.cip.att.com:8443 org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int2.test.att.com:8443 +# +connection.timeout=60000 +read.timeout=60000 # query org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v11/search/sdn-zone-query 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 473173e76..000000000 --- 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 be22d8766..000000000 --- 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.onap.ccsdk.sli.core.dblib.DbLibService - - - - - - diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml new file mode 100755 index 000000000..162ce736c --- /dev/null +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml new file mode 100755 index 000000000..c1fafdcc0 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg From d0c9e06005c819b53970b72cf73ab814a3719109 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 3 Oct 2017 08:42:05 -0400 Subject: Add unit tests for mdsal-resource Add unit tests for mdsal-resource component. Change-Id: I44ee079d43ee29e4d507abb5fc065188279b1ffe Issue-ID: CCSDK-106 Signed-off-by: Dan Timoney --- mdsal-resource/provider/pom.xml | 13 +++++++++- .../adaptors/resource/mdsal/ConfigResource.java | 8 ++++-- .../resource/mdsal/OperationalResource.java | 8 ++++-- .../resource/mdsal/TestConfigResource.java | 29 ++++++++++++++++++++++ .../resource/mdsal/TestOperationalResource.java | 29 ++++++++++++++++++++++ .../features/src/main/resources/features.xml | 2 +- 6 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java create mode 100644 mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java (limited to 'resource-assignment') diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 5a61d7624..ee0a3dc14 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -53,7 +53,18 @@ commons-codec ${commons.codec.version} - + + org.testng + testng + 6.11 + test + + + org.mockito + mockito-core + ${mockito.version} + test + diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java index 9cade887b..d02530fe6 100644 --- a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,6 +42,10 @@ public class ConfigResource implements SvcLogicResource { restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); } + public ConfigResource(RestService restService) { + this.restService = restService; + } + @Override public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java index 92a7b6be0..63fe8c6ad 100644 --- a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,6 +44,10 @@ public class OperationalResource implements SvcLogicResource { } + public OperationalResource(RestService restService) { + this.restService = restService; + } + @Override public QueryStatus isAvailable(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java new file mode 100644 index 000000000..a8f4d9483 --- /dev/null +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java @@ -0,0 +1,29 @@ +package org.onap.ccsdk.sli.adaptors.resource.mdsal; + +import junit.framework.TestCase; + +import static org.mockito.Mockito.mock; + +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + +public class TestConfigResource extends TestCase { + + public void test() throws Exception { + + RestService restService = mock(RestService.class); + SvcLogicContext ctx = new SvcLogicContext(); + + ConfigResource res = new ConfigResource(restService); + + res.delete("my-resource", null, ctx); + res.notify("my-resource", "action", "key", ctx); + res.query("my-resource", false, "my-select", "mykey", "pfx", null, ctx); + res.release("my-resource", "mykey", ctx); + res.reserve("my-resource", "my-select", "mykey", "pfx", ctx); + res.exists("my-resource", "mykey", "pfx", ctx); + res.isAvailable("my-resource", "mykey", "pfx", ctx); + res.save("resource", false, false, null, null, null, ctx); + res.update("my-resource", "mykey", null, "pfx", ctx); + } + +} diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java new file mode 100644 index 000000000..f5725e971 --- /dev/null +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java @@ -0,0 +1,29 @@ +package org.onap.ccsdk.sli.adaptors.resource.mdsal; + +import static org.mockito.Mockito.mock; + +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + +import junit.framework.TestCase; + +public class TestOperationalResource extends TestCase { + + + public void test() throws Exception { + + RestService restService = mock(RestService.class); + SvcLogicContext ctx = new SvcLogicContext(); + + OperationalResource res = new OperationalResource(restService); + + res.delete("my-resource", null, ctx); + res.notify("my-resource", "action", "key", ctx); + res.query("my-resource", false, "my-select", "mykey", "pfx", null, ctx); + res.release("my-resource", "mykey", ctx); + res.reserve("my-resource", "my-select", "mykey", "pfx", ctx); + res.exists("my-resource", "mykey", "pfx", ctx); + res.isAvailable("my-resource", "mykey", "pfx", ctx); + res.save("resource", false, false, null, null, null, ctx); + res.update("my-resource", "mykey", null, "pfx", ctx); + } +} diff --git a/resource-assignment/features/src/main/resources/features.xml b/resource-assignment/features/src/main/resources/features.xml index ca1126d37..c9161a635 100644 --- a/resource-assignment/features/src/main/resources/features.xml +++ b/resource-assignment/features/src/main/resources/features.xml @@ -33,7 +33,7 @@ spring spring-jdbc spring-dm - mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version} + mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version} mvn:org.mariadb.jdbc/mariadb-java-client/${mariadb.connector.version} mvn:commons-lang/commons-lang/2.6 -- cgit 1.2.3-korg From f80bc74d3e61c6f73a9b764eb6f7f05f8c8fa65a Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 13 Oct 2017 16:00:52 -0400 Subject: Fix resource-assignment blueprints resource-assignment blueprint files contained references to openecomp that should be changed to onap. Change-Id: I1eb27ba8c805e65f67f167df8bf75e609e9b5f9f Issue-ID: CCSDK-120 Signed-off-by: Dan Timoney --- .../blueprint/resource-assignment-blueprint.xml | 6 ++-- .../opendaylight/blueprint/resource-assignment.xml | 36 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml index 162ce736c..c2298af7d 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml @@ -9,9 +9,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,6 @@ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true"> - + diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml index c1fafdcc0..9d3f3e99e 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml @@ -9,9 +9,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,11 +26,11 @@ - + - + @@ -44,11 +44,11 @@ - + - + @@ -56,25 +56,25 @@ - + - + - + - + - + @@ -83,27 +83,27 @@ - + - + - + - - + + - + @@ -118,7 +118,7 @@ - + -- cgit 1.2.3-korg From 50dd7801068958f82094614b8566e59c0cf0fbf0 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 17 Oct 2017 12:00:56 -0400 Subject: Fix resource-assignment blueprint Some entries in resource-assignment blueprint that had been copied from spring blueprint needed to be changed slightly due to differences between Spring and Aries. Change-Id: I196f88f2036f30673bee0f3d23773616f6c1ba1b Issue-ID: CCSDK-120 Signed-off-by: Dan Timoney --- .../org/opendaylight/blueprint/resource-assignment.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml index 9d3f3e99e..6e11c664c 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml @@ -105,17 +105,29 @@ - + - + + + + + + + + + + + + + -- cgit 1.2.3-korg From fac1e9ba4a0198274e0e21abbb7a4c003c470dc1 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 9 Nov 2017 07:16:55 -0500 Subject: Roll to version 0.1.1-SNAPSHOT Roll to next release version Change-Id: I6256aa3e20e6d03edf02ea2f049ca425944dc605 Issue-ID: CCSDK-141 Signed-off-by: Dan Timoney --- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 2 +- version.properties | 2 +- 18 files changed, 22 insertions(+), 22 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index b8485035b..4fbc46b7d 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT aai-service-features AAI Interface Service - Features diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 03b523d03..9e9b060e6 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT aai-service-installer AAI Adaptor - Karaf Installer diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 93b286c95..c1dd0b321 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT 4.0.0 @@ -16,7 +16,7 @@ AAI Interface Service The AAI Interface service exposes an interface to AAI as an OSGi service - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index e17dab86e..4419a69a1 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors aai-service - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT aai-service-provider bundle diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index b4e7220d2..ef1a80660 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT mdsal-resource-features MD-SAL Resource Adaptor - Features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 259bc06af..0bc39591e 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT mdsal-resource-installer MDSAL Resource - Karaf Installer diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 242a671e3..1a31bf36d 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ MD-SAL Resource Adaptor The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 28eab6823..7f349b553 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors mdsal-resource - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT mdsal-resource-provider bundle diff --git a/pom.xml b/pom.xml index 4df795a32..51ae91b77 100755 --- a/pom.xml +++ b/pom.xml @@ -114,7 +114,7 @@ ONAP - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 2448576e1..1677639d5 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT resource-assignment-features Resource Assignment Adaptor - Features diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 8367b03ff..a7134ee12 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT resource-assignment-installer Resource allocator- Karaf Installer diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 4755f5427..14b413e68 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -3,14 +3,14 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT 4.0.0 pom org.onap.ccsdk.sli.adaptors resource-assignment - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT Resource Assignment Adaptor diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 741f9fbe2..7325d38cf 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors resource-assignment - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT resource-assignment-provider bundle diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 8c38ece90..fd0f8d84f 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT sql-resource-features Sql Resource Adaptor - Features diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 1ff621a07..16e1b824b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT sql-resource-installer SQL Resource - Karaf Installer diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index c372a7c56..f1d8a3fbc 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ Sql Resource Adaptor The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 9a7d2457b..33e9986bf 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sql-resource - 0.1.0-SNAPSHOT + 0.1.1-SNAPSHOT sql-resource-provider bundle diff --git a/version.properties b/version.properties index 3d3e5b582..ef1134635 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=1 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 890ad9dd6632cc2c2a125645afeee4724b3598be Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 21 Nov 2017 14:31:45 -0500 Subject: Bump minor version Bump minor version and reset build for Beijing development Change-Id: Ie4e0bc53c1b378d59dc0ec2504cf92a36f8ff04f Issue-ID: CIMAN-120 Signed-off-by: Dan Timoney --- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 2 +- version.properties | 2 +- 18 files changed, 22 insertions(+), 22 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 4fbc46b7d..dea0c9a7f 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT aai-service-features AAI Interface Service - Features diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 9e9b060e6..511d2c89d 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -4,7 +4,7 @@ aai-service org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT aai-service-installer AAI Adaptor - Karaf Installer diff --git a/aai-service/pom.xml b/aai-service/pom.xml index c1dd0b321..340024cac 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT 4.0.0 @@ -16,7 +16,7 @@ AAI Interface Service The AAI Interface service exposes an interface to AAI as an OSGi service - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 4419a69a1..d96d0be1d 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors aai-service - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT aai-service-provider bundle diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index ef1a80660..478ef057c 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT mdsal-resource-features MD-SAL Resource Adaptor - Features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 0bc39591e..9f4027b03 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -4,7 +4,7 @@ mdsal-resource org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT mdsal-resource-installer MDSAL Resource - Karaf Installer diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 1a31bf36d..5d434668c 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ MD-SAL Resource Adaptor The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 7f349b553..0e158ebda 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors mdsal-resource - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT mdsal-resource-provider bundle diff --git a/pom.xml b/pom.xml index 51ae91b77..0a0a765cc 100755 --- a/pom.xml +++ b/pom.xml @@ -114,7 +114,7 @@ ONAP - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 1677639d5..584f1ca50 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT resource-assignment-features Resource Assignment Adaptor - Features diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index a7134ee12..e875e4729 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -4,7 +4,7 @@ resource-assignment org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT resource-assignment-installer Resource allocator- Karaf Installer diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 14b413e68..25a525795 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -3,14 +3,14 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT 4.0.0 pom org.onap.ccsdk.sli.adaptors resource-assignment - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT Resource Assignment Adaptor diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 7325d38cf..309c2a6f1 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors resource-assignment - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT resource-assignment-provider bundle diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index fd0f8d84f..499e3cb7f 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT sql-resource-features Sql Resource Adaptor - Features diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 16e1b824b..505cf409c 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -4,7 +4,7 @@ sql-resource org.onap.ccsdk.sli.adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT sql-resource-installer SQL Resource - Karaf Installer diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index f1d8a3fbc..e660b5661 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -3,7 +3,7 @@ org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ Sql Resource Adaptor The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 33e9986bf..bcf6f0ffe 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sql-resource - 0.1.1-SNAPSHOT + 0.2.0-SNAPSHOT sql-resource-provider bundle diff --git a/version.properties b/version.properties index ebb19b8f6..efb7e63bc 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=2 -feature_revision=1 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 8a3f1ea2bee98d30c74317fd31f83b6ea3ec4734 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 16 Feb 2018 17:12:41 -0500 Subject: Nitrogen port : mdsal/sql Update mdsal-resource and sql-resource to support ODL Nitrogen Change-Id: Id7f7ac2da0de9d034e052ee16ef9c2a765a056bf Issue-ID: CCSDK-176 Signed-off-by: Dan Timoney --- .../features/ccsdk-mdsal-resource/pom.xml | 48 ++++ .../features/features-mdsal-resource/pom.xml | 30 +++ mdsal-resource/features/pom.xml | 137 ++--------- .../features/src/main/resources/features.xml | 38 --- mdsal-resource/installer/pom.xml | 30 +-- .../src/main/resources/scripts/install-feature.sh | 9 +- mdsal-resource/pom.xml | 49 ++-- mdsal-resource/provider/pom.xml | 82 ++----- .../features/ccsdk-resource-assignment/pom.xml | 78 +++++++ .../features/features-resource-assignment/pom.xml | 30 +++ resource-assignment/features/pom.xml | 140 ++--------- .../features/src/main/resources/features.xml | 41 ---- resource-assignment/installer/pom.xml | 44 ++-- .../src/main/resources/scripts/install-feature.sh | 9 +- resource-assignment/pom.xml | 46 ++-- resource-assignment/provider/pom.xml | 49 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 54 +++++ .../features/features-sql-resource/pom.xml | 30 +++ sql-resource/features/pom.xml | 152 ++---------- sql-resource/installer/pom.xml | 258 +++++++++++---------- .../src/main/resources/scripts/install-feature.sh | 9 +- sql-resource/pom.xml | 55 ++--- sql-resource/provider/pom.xml | 161 +++++-------- 23 files changed, 650 insertions(+), 929 deletions(-) create mode 100644 mdsal-resource/features/ccsdk-mdsal-resource/pom.xml create mode 100755 mdsal-resource/features/features-mdsal-resource/pom.xml delete mode 100644 mdsal-resource/features/src/main/resources/features.xml create mode 100644 resource-assignment/features/ccsdk-resource-assignment/pom.xml create mode 100755 resource-assignment/features/features-resource-assignment/pom.xml delete mode 100644 resource-assignment/features/src/main/resources/features.xml create mode 100644 sql-resource/features/ccsdk-sql-resource/pom.xml create mode 100755 sql-resource/features/features-sql-resource/pom.xml (limited to 'resource-assignment') diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml new file mode 100644 index 000000000..6869f16c5 --- /dev/null +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-mdsal-resource + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + + org.opendaylight.controller + odl-mdsal-broker + xml + features + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${project.version} + xml + features + + + + ${project.groupId} + mdsal-resource-provider + ${project.version} + + + + equinoxSDK381 + org.eclipse.osgi + provided + + + diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml new file mode 100755 index 000000000..da7b67d93 --- /dev/null +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + feature-repo-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + features-mdsal-resource + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + + ${project.groupId} + ccsdk-mdsal-resource + ${project.version} + xml + features + + + + diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 478ef057c..f46897baa 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -1,134 +1,23 @@ - + 4.0.0 + - mdsal-resource org.onap.ccsdk.sli.adaptors + mdsal-resource 0.2.0-SNAPSHOT - mdsal-resource-features - MD-SAL Resource Adaptor - Features - - jar - - - - - - org.onap.ccsdk.sli.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 - - + org.onap.ccsdk.sli.adaptors + mdsal-resource-features + 0.2.1-SNAPSHOT + pom - - - - 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 - - - - - - - - + + ccsdk-mdsal-resource + features-mdsal-resource + 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 5a2bae1b2..000000000 --- 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.onap.ccsdk.sli.adaptors/mdsal-resource-provider/${project.version} - - - diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 9f4027b03..934492260 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -1,19 +1,25 @@ - + 4.0.0 + - mdsal-resource - org.onap.ccsdk.sli.adaptors - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors mdsal-resource-installer - MDSAL Resource - Karaf Installer + 0.2.1-SNAPSHOT pom + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + - sdnc-mdsal-resource - sdnc-mdsal-resource - mvn:org.onap.ccsdk.sli.adaptors/mdsal-resource-features/${project.version}/xml/features + ccsdk-mdsal-resource + ${application.name} + mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features false @@ -21,10 +27,10 @@ org.onap.ccsdk.sli.adaptors - mdsal-resource-features + ccsdk-mdsal-resource ${project.version} - features xml + features * @@ -98,8 +104,7 @@ true false false - org.onap.ccsdk - sli-common,sli-provider,dblib-provider + org.onap.ccsdk.sli.adaptors provided @@ -134,5 +139,4 @@ - diff --git a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh index df03392c8..0eab001d5 100644 --- a/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh +++ b/mdsal-resource/installer/src/main/resources/scripts/install-feature.sh @@ -10,9 +10,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,6 @@ 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 @@ -36,5 +35,5 @@ else 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} +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 5d434668c..e823df289 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -1,46 +1,27 @@ - + + 4.0.0 + - org.onap.ccsdk.sli.adaptors - ccsdk-sli-adaptors - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT - 4.0.0 - pom org.onap.ccsdk.sli.adaptors mdsal-resource + 0.2.1-SNAPSHOT + pom - - MD-SAL Resource Adaptor + ccsdk-sli-adaptors :: mdsal-resource The MD-SAL resource adaptor allows service logic to access persistent data from MD-SAL config and operational trees - 0.2.0-SNAPSHOT - - - - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-features - features - xml - ${project.version} - - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-provider - ${project.version} - - - + + provider + features + installer + - - - provider - features - installer - diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 0e158ebda..b690b6f2f 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -1,18 +1,26 @@ - + 4.0.0 + - org.onap.ccsdk.sli.adaptors - mdsal-resource - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + binding-parent + 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors mdsal-resource-provider + 0.2.1-SNAPSHOT bundle - MD-SAL Resource Adaptor - Provider + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} http://maven.apache.org + UTF-8 + @@ -36,7 +44,6 @@ equinoxSDK381 org.eclipse.osgi - ${equinox.osgi.version} org.slf4j @@ -67,67 +74,4 @@ - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.onap.ccsdk.sli.adaptors.resource.mdsal - org.onap.ccsdk.sli.adaptors.resource.mdsal.MdsalResourceActivator - org.onap.ccsdk.sli.adaptors.resource.mdsal - org.onap.ccsdk.sli.adaptors.*,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/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml new file mode 100644 index 000000000..c50cf3ca5 --- /dev/null +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-resource-assignment + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + + + org.opendaylight.controller + odl-mdsal-broker + xml + features + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${project.version} + xml + features + + + + org.onap.ccsdk.sli.core + ccsdk-dblib + ${project.version} + xml + features + + + + ${project.groupId} + resource-assignment-provider + ${project.version} + + + + org.mariadb.jdbc + mariadb-java-client + ${mariadb.connector.version} + jar + runtime + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + equinoxSDK381 + org.eclipse.osgi + provided + + + diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml new file mode 100755 index 000000000..1eace060a --- /dev/null +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + feature-repo-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + features-resource-assignment + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + + + ${project.groupId} + ccsdk-resource-assignment + ${project.version} + xml + features + + + + diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 584f1ca50..530a5bfe8 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -1,133 +1,23 @@ - + 4.0.0 + - resource-assignment - org.onap.ccsdk.sli.adaptors - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT - resource-assignment-features - Resource Assignment Adaptor - Features - - jar - - - - - - org.onap.ccsdk.sli.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 - - + org.onap.ccsdk.sli.adaptors + resource-assignment-features + 0.2.1-SNAPSHOT + pom - - - - 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 - - - - - - - - + + ccsdk-resource-assignment + features-resource-assignment + 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 c9161a635..000000000 --- a/resource-assignment/features/src/main/resources/features.xml +++ /dev/null @@ -1,41 +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.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version} - mvn:org.mariadb.jdbc/mariadb-java-client/${mariadb.connector.version} - mvn:commons-lang/commons-lang/2.6 - - - diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index e875e4729..9b59cfff7 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -1,31 +1,36 @@ - + 4.0.0 + - resource-assignment - org.onap.ccsdk.sli.adaptors - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors resource-assignment-installer - Resource allocator- Karaf Installer + 0.2.1-SNAPSHOT pom + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + - sdnc-resource-assignment - sdnc-resource-assignment - mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-features/${project.version}/xml/features + ccsdk-resource-assignment + ${application.name} + mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features false - 2.6 org.onap.ccsdk.sli.adaptors - resource-assignment-features + ccsdk-resource-assignment ${project.version} - features xml + features * @@ -40,7 +45,21 @@ ${project.version} - + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + @@ -136,5 +155,4 @@ - diff --git a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh index 2aaab4dfa..b631cdca6 100644 --- a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh +++ b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh @@ -10,9 +10,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,6 @@ 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 @@ -36,5 +35,5 @@ else 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} +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 25a525795..299cb69c6 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -1,43 +1,27 @@ - + + 4.0.0 + - org.onap.ccsdk.sli.adaptors - ccsdk-sli-adaptors - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT - 4.0.0 - pom org.onap.ccsdk.sli.adaptors resource-assignment - 0.2.0-SNAPSHOT - + 0.2.1-SNAPSHOT + pom - Resource Assignment Adaptor + ccsdk-sli-adaptors :: resource-assignment The resource assignment adaptor allows service logic to check and allocate network capacity - - - - org.onap.ccsdk.sli.adaptors - resource-assignment-features - features - xml - ${project.version} - + + provider + features + installer + - - org.onap.ccsdk.sli.adaptors - resource-assignment-provider - ${project.version} - - - - - provider - features - installer - - diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 309c2a6f1..771ef0292 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -1,24 +1,32 @@ - + 4.0.0 + - org.onap.ccsdk.sli.adaptors - resource-assignment - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + binding-parent + 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors resource-assignment-provider + 0.2.1-SNAPSHOT bundle - Resource Assignment Adaptor - Provider + + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} http://maven.apache.org + UTF-8 + junit junit - test ${junit.version} + test org.springframework @@ -55,11 +63,7 @@ slf4j-api ${slf4j.version} - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - + org.mariadb.jdbc mariadb-java-client @@ -83,25 +87,6 @@ ${spring.version} - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.onap.ccsdk.sli.adaptors.ra - org.onap.ccsdk.sli.adaptors.ra - - *,org.onap.ccsdk.sli.core.dblib - - - - - + + diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml new file mode 100644 index 000000000..d547eb1d5 --- /dev/null +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-sql-resource + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + + + org.opendaylight.controller + odl-mdsal-broker + xml + features + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${project.version} + xml + features + + + org.onap.ccsdk.sli.core + ccsdk-dblib + ${project.version} + xml + features + + + ${project.groupId} + sql-resource-provider + ${project.version} + + + + equinoxSDK381 + org.eclipse.osgi + provided + + + diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml new file mode 100755 index 000000000..b39a96a09 --- /dev/null +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + feature-repo-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + features-sql-resource + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + + + ${project.groupId} + ccsdk-sql-resource + ${project.version} + xml + features + + + + diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 499e3cb7f..63234a78b 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -1,134 +1,22 @@ - - 4.0.0 - - sql-resource - org.onap.ccsdk.sli.adaptors - 0.2.0-SNAPSHOT - - sql-resource-features - Sql Resource Adaptor - Features - - jar - - - - - - org.onap.ccsdk.sli.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 - - - - - - - - + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + + org.onap.ccsdk.sli.adaptors + sql-resource-features + pom + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + + ccsdk-sql-resource + features-sql-resource + diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 505cf409c..9629ee438 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -1,138 +1,142 @@ - - 4.0.0 - - sql-resource - org.onap.ccsdk.sli.adaptors - 0.2.0-SNAPSHOT - - sql-resource-installer - SQL Resource - Karaf Installer - pom + + 4.0.0 - - sdnc-sql-resource - sdnc-sql-resource - mvn:org.onap.ccsdk.sli.adaptors/sql-resource-features/${project.version}/xml/features - false - + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + - + org.onap.ccsdk.sli.adaptors + sql-resource-installer + 0.2.1-SNAPSHOT + pom - - org.onap.ccsdk.sli.adaptors - sql-resource-features - ${project.version} - features - xml - - - * - * - - - + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - org.onap.ccsdk.sli.adaptors - sql-resource-provider - ${project.version} - + + ccsdk-sql-resource + ${application.name} + mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features + false + - + - - - - 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.onap.ccsdk - 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 - - - - + + org.onap.ccsdk.sli.adaptors + ccsdk-sql-resource + ${project.version} + xml + features + + + * + * + + + - - + + org.onap.ccsdk.sli.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.onap.ccsdk.sli.adaptor + 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/main/resources/scripts/install-feature.sh b/sql-resource/installer/src/main/resources/scripts/install-feature.sh index e986764b9..cee4a4952 100644 --- a/sql-resource/installer/src/main/resources/scripts/install-feature.sh +++ b/sql-resource/installer/src/main/resources/scripts/install-feature.sh @@ -10,9 +10,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,6 @@ 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 @@ -36,5 +35,5 @@ else 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} +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index e660b5661..cad83d18e 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -1,43 +1,26 @@ - - - org.onap.ccsdk.sli.adaptors - ccsdk-sli-adaptors - 0.2.0-SNAPSHOT - + + 4.0.0 - 4.0.0 - pom - org.onap.ccsdk.sli.adaptors - sql-resource + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors + sql-resource + 0.2.1-SNAPSHOT + pom - Sql Resource Adaptor - The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements + ccsdk-sli-adaptors :: sql-resource + The Sql resource adaptor allows service logic to read/write data from a local database using direct SQL statements - 0.2.0-SNAPSHOT + + provider + features + installer + - - - - org.onap.ccsdk.sli.adaptors - sql-resource-features - features - xml - ${project.version} - - - - org.onap.ccsdk.sli.adaptors - sql-resource-provider - ${project.version} - - - - - - provider - features - installer - diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index bcf6f0ffe..7069cf30e 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -1,111 +1,74 @@ - - 4.0.0 - - org.onap.ccsdk.sli.adaptors - sql-resource - 0.2.0-SNAPSHOT - - sql-resource-provider - bundle - Sql Resource Adaptor - Provider - http://maven.apache.org - - UTF-8 - - - - junit - junit - ${junit.version} - test - + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.0.1-SNAPSHOT + + + org.onap.ccsdk.sli.adaptors + sql-resource-provider + 0.2.1-SNAPSHOT + bundle + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + ${junit.version} + test + ch.vorburger.mariaDB4j mariaDB4j 2.2.3 test - - org.onap.ccsdk.sli.core - sli-common - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.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.onap.ccsdk.sli.core - dblib-provider - ${sdnctl.dblib.version} - - - - - - - - - - org.apache.felix - maven-bundle-plugin - ${bundle.plugin.version} - true - - - org.onap.ccsdk.sli.adaptors.resource.sql - org.onap.ccsdk.sli.adaptors.resource.sql.SqlResourceActivator - org.onap.ccsdk.sli.adaptors.resource.sql - * - * - - + + org.onap.ccsdk.sli.core + sli-common + ${sdnctl.sli.version} + compile + + + org.onap.ccsdk.sli.core + sli-provider + ${sdnctl.sli.version} + compile + + + equinoxSDK381 + org.eclipse.osgi + + + org.slf4j + slf4j-api + ${slf4j.version} + - + + org.slf4j + slf4j-simple + ${slf4j.version} + compile + + + org.onap.ccsdk.sli.core + dblib-provider + ${sdnctl.dblib.version} + - + - - -- cgit 1.2.3-korg From f8b426772a61b078bfcb73093571ecd1cda53996 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 27 Feb 2018 13:35:58 -0500 Subject: Remove unnecessary jar from resource-assignment Resource-assignment was re-installing sli/core util package. Change-Id: I98683496c216ae0cdc3d15eb3640fa9c6faa2ed8 Issue-ID: CCSDK-176 Signed-off-by: Dan Timoney --- resource-assignment/installer/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 9b59cfff7..285580b27 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -119,8 +119,7 @@ true false false - org.onap.ccsdk - sli-common,sli-provider,dblib-provider + org.onap.ccsdk.sli.adaptors provided -- cgit 1.2.3-korg From 4caeb14d39a27b653a2341298d2dcd4d7a1e4100 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 2 Mar 2018 13:10:30 -0500 Subject: Fix POM versions Fixed versions in pom.xmls and added empty relativePath tag to parents. Change-Id: Ie7be2d4d3d05e769f6e02f35a3a8e9f928bc62cf Issue-ID: CCSDK-176 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/pom.xml | 3 +++ aai-service/installer/pom.xml | 1 + aai-service/pom.xml | 5 +++-- aai-service/provider/pom.xml | 1 + mdsal-resource/features/pom.xml | 7 ++++--- mdsal-resource/installer/pom.xml | 1 + mdsal-resource/pom.xml | 1 + mdsal-resource/provider/pom.xml | 1 + pom.xml | 2 +- resource-assignment/features/pom.xml | 1 + resource-assignment/installer/pom.xml | 1 + resource-assignment/pom.xml | 1 + resource-assignment/provider/pom.xml | 1 + sql-resource/features/pom.xml | 2 ++ sql-resource/installer/pom.xml | 1 + sql-resource/pom.xml | 1 + sql-resource/provider/pom.xml | 1 + 17 files changed, 25 insertions(+), 6 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 919cb6ad6..fbe91d89f 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -6,9 +6,12 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + + org.onap.ccsdk.sli.adaptors aai-service-features + 0.2.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 1c919c659..cc4d683a9 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -6,6 +6,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 80a53a502..f874ab6fa 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -6,14 +6,15 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors aai-service - 0.2.0-SNAPSHOT + 0.2.1-SNAPSHOT pom - AAI Interface Service + ccsdk-sli-adaptors :: aai-service The AAI Interface service exposes an interface to AAI as an OSGi service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 8eefaf96b..97a12a4ac 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -6,6 +6,7 @@ org.onap.ccsdk.parent binding-parent 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index f46897baa..59d374f0a 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -4,9 +4,10 @@ 4.0.0 - org.onap.ccsdk.sli.adaptors - mdsal-resource - 0.2.0-SNAPSHOT + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 934492260..89f96642c 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index e823df289..264a4fb29 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index b690b6f2f..dd68c6c57 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent binding-parent 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/pom.xml b/pom.xml index 0a0a765cc..bdeefe8ee 100755 --- a/pom.xml +++ b/pom.xml @@ -114,7 +114,7 @@ ONAP - 0.2.0-SNAPSHOT + 0.2.1-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 530a5bfe8..e7839dd46 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 285580b27..f6d9c70c5 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 299cb69c6..9d002c37c 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 771ef0292..aec0d493b 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent binding-parent 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 63234a78b..b9641b8af 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -7,10 +7,12 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors sql-resource-features + 0.2.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 9629ee438..0a295e049 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index cad83d18e..1aa41410f 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent odlparent-lite 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 7069cf30e..c72c9048e 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -7,6 +7,7 @@ org.onap.ccsdk.parent binding-parent 1.0.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors -- cgit 1.2.3-korg From caf1186e23d05f2903410e6521de70aafcccd7b3 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Mon, 19 Mar 2018 10:54:41 -0400 Subject: Add missing libraries Updated resource-assignment feature installer to install dependent libraries if not already installed. Change-Id: If5df396f1428e4ce8f498acfd3621d429b5489a2 Issue-ID: CCSDK-215 Signed-off-by: Timoney, Dan (dt5972) --- resource-assignment/installer/pom.xml | 2 +- .../installer/src/main/resources/scripts/install-feature.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index f6d9c70c5..7df9502a0 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -120,7 +120,7 @@ true false false - org.onap.ccsdk.sli.adaptors + org.onap.ccsdk.sli.core,org.opendaylight provided diff --git a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh index b631cdca6..06f5b7d5e 100644 --- a/resource-assignment/installer/src/main/resources/scripts/install-feature.sh +++ b/resource-assignment/installer/src/main/resources/scripts/install-feature.sh @@ -29,7 +29,7 @@ REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip if [ -f ${REPOZIP} ] then - unzip -d ${ODL_HOME} ${REPOZIP} + unzip -nd ${ODL_HOME} ${REPOZIP} else echo "ERROR : repo zip ($REPOZIP) not found" exit 1 -- cgit 1.2.3-korg From dd8b9956c7f3a10b141e26ccd8b14c79ddb619a9 Mon Sep 17 00:00:00 2001 From: "prakash.e" Date: Thu, 12 Apr 2018 11:43:49 +0530 Subject: Used secure random number generation Issue-ID: CCSDK-184 Change-Id: I00719fb778a6ab7dc964bb1e4710a9014ba51fcd Signed-off-by: prakash.e --- .../org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java index f4df81b8b..9cce17a46 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/SynchronizedFunction.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.adaptors.lock.comp; +import java.security.SecureRandom; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -51,6 +52,7 @@ public abstract class SynchronizedFunction { } private static String generateLockRequester() { - return "SynchronizedFunction-" + (int) (Math.random() * 1000000); + SecureRandom rand = new SecureRandom(); + return "SynchronizedFunction-" + (int) (rand.nextDouble() * 1000000); } } -- cgit 1.2.3-korg From 69c4c5b6100492d3158364699d46a7c80e49ca49 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 20 Apr 2018 14:25:32 -0400 Subject: Fix feature dependency versions Fix single-feature pom.xmls to use version of sli/core artifactsi specified in parent poms, as opposed to project.version, which is incorrect and causes release build to break. Change-Id: Iec00a73b1b4adf9e8fecdb190385bb35ab1fe1c7 Issue-ID: CCSDK-248 Signed-off-by: Timoney, Dan (dt5972) --- .gitignore | 3 +++ aai-service/features/ccsdk-aai-service/pom.xml | 1 - .../ansible-adapter-bundle/debug-logs/EELF/debug.log | 0 .../ansible-adapter-bundle/logs/EELF/application.log | 19 ------------------- .../ansible-adapter-bundle/logs/EELF/audit.log | 0 .../ansible-adapter-bundle/logs/EELF/error.log | 0 .../ansible-adapter-bundle/logs/EELF/metrics.log | 0 .../ansible-adapter-bundle/logs/EELF/performance.log | 0 .../ansible-adapter-bundle/logs/EELF/policy.log | 0 .../ansible-adapter-bundle/logs/EELF/security.log | 0 .../ansible-adapter-bundle/logs/EELF/server.log | 0 mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 1 - .../features/ccsdk-resource-assignment/pom.xml | 3 +-- sql-resource/features/ccsdk-sql-resource/pom.xml | 3 +-- 14 files changed, 5 insertions(+), 25 deletions(-) delete mode 100644 ansible-adapter/ansible-adapter-bundle/debug-logs/EELF/debug.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/application.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/audit.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/error.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/metrics.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/performance.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/policy.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/security.log delete mode 100644 ansible-adapter/ansible-adapter-bundle/logs/EELF/server.log (limited to 'resource-assignment') diff --git a/.gitignore b/.gitignore index f7a3d77cd..3865ebb96 100755 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,9 @@ out/ .metadata provider/src/main/java/META-INF/ provider/src/main/java/inventory/ +logs/ +debug-logs/ +*.log ## BlackDuck generated file ccsdk-adaptors_bdio.jsonld diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 3e1a5059e..1e33927ce 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -27,7 +27,6 @@ org.onap.ccsdk.sli.core ccsdk-sli - ${project.version} xml features diff --git a/ansible-adapter/ansible-adapter-bundle/debug-logs/EELF/debug.log b/ansible-adapter/ansible-adapter-bundle/debug-logs/EELF/debug.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/application.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/application.log deleted file mode 100644 index e42f4053d..000000000 --- a/ansible-adapter/ansible-adapter-bundle/logs/EELF/application.log +++ /dev/null @@ -1,19 +0,0 @@ -2018-04-17 22:38:28,679|||main||||INFO||||||| EELF0005I Searching path "${user.home};etc;../etc" for log configuration file "logback-test.xml" -2018-04-17 22:38:28,682|||main||||INFO||||||| EELF0001I Loading default logging configuration from system resource file "com/att/eelf/logback.xml" -2018-04-17 22:38:28,698|||main||||INFO||||||| Retrieving results from https://192.168.1.1?Id=101&Type=GetLog -2018-04-17 22:38:28,698|||main||||INFO||||||| Querying url = https://192.168.1.1?Id=101&Type=GetLog -2018-04-17 22:38:28,709|||main||||INFO||||||| Request output = {"Results":{"192.168.1.10":{"Id":"101","StatusCode":200,"StatusMessage":"SUCCESS"}},"StatusCode":200,"StatusMessage":"FINISHED"} -2018-04-17 22:38:28,712|||main||||INFO||||||| Got uri -2018-04-17 22:38:28,715|||main||||INFO||||||| Querying url = https://192.168.1.1?Id=100&Type=GetResult -2018-04-17 22:38:28,715|||main||||INFO||||||| Parsing response from Server = {"Results":{"192.168.1.10":{"Id":"100","StatusCode":200,"StatusMessage":"SUCCESS"}},"StatusCode":200,"StatusMessage":"FINISHED"} -2018-04-17 22:38:28,719|||main||||INFO||||||| Received response with code = 200, Message = FINISHED -2018-04-17 22:38:28,719|||main||||INFO||||||| Processing results in response -2018-04-17 22:38:28,719|||main||||INFO||||||| Get JSON dictionary from Results .. -2018-04-17 22:38:28,719|||main||||INFO||||||| Iterating through hosts -2018-04-17 22:38:28,719|||main||||INFO||||||| Processing host = 192.168.1.10 -2018-04-17 22:38:28,719|||main||||INFO||||||| Code = 200, Message = SUCCESS -2018-04-17 22:38:28,720|||main||||INFO||||||| Request response = FINISHED -2018-04-17 22:38:28,720|||main||||INFO||||||| Ansible Request 100 finished with Result = success, Message = FINISHED -2018-04-17 22:38:28,775|||main||||INFO||||||| Updated Payload = {"Id":"cd75d4da-096c-419e-a2c8-3e14362c729c","PlaybookName":"test_playbook.yaml"} -2018-04-17 22:38:28,775|||main||||INFO||||||| Posting request = {"Id":"cd75d4da-096c-419e-a2c8-3e14362c729c","PlaybookName":"test_playbook.yaml"} to url = https://192.168.1.1 -2018-04-17 22:38:28,775|||main||||INFO||||||| Submission of Test successful. diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/audit.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/audit.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/error.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/error.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/metrics.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/metrics.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/performance.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/performance.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/policy.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/policy.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/security.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/security.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/ansible-adapter/ansible-adapter-bundle/logs/EELF/server.log b/ansible-adapter/ansible-adapter-bundle/logs/EELF/server.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 6869f16c5..a6d6c3057 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -28,7 +28,6 @@ org.onap.ccsdk.sli.core ccsdk-sli - ${project.version} xml features diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index c50cf3ca5..568b246a6 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -28,7 +28,6 @@ org.onap.ccsdk.sli.core ccsdk-sli - ${project.version} xml features @@ -36,7 +35,7 @@ org.onap.ccsdk.sli.core ccsdk-dblib - ${project.version} + ${ccsdk.sli.core.version} xml features diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index d547eb1d5..5a20846a5 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -28,14 +28,13 @@ org.onap.ccsdk.sli.core ccsdk-sli - ${project.version} xml features org.onap.ccsdk.sli.core ccsdk-dblib - ${project.version} + ${ccsdk.sli.core.version} xml features -- cgit 1.2.3-korg From c24914c999d25e2775decedb8d8c444c712d9c34 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Sun, 29 Apr 2018 19:06:43 -0400 Subject: Roll versions step 3 : sli/adaptors poms Roll version for next release candidate Change-Id: I8100873602b3a4c4fb9cb19876377d9af32e31ab Issue-ID: CCSDK-257 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 32 files changed, 63 insertions(+), 63 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 1e33927ce..2415b975a 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index fcf7cd3e5..7b010ba0d 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index fbe91d89f..52a36db1b 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index cc4d683a9..c9f48b95f 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index f874ab6fa..e284d044c 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 364a65217..c7f6817d1 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 912ec4715..22ee41297 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 22597a0f7..aa5f96364 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 3bb944216..d90ec09fe 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 235eb6dfb..9df26ffce 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index daac66eab..ecd0d6b7e 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 83fa295e2..79b3b3890 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index a6d6c3057..58f26d753 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index da7b67d93..49a644ea4 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 59d374f0a..b4ae2d19e 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 89f96642c..50b188324 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 264a4fb29..f81e973e2 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index dd68c6c57..b528442be 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index 5eb122425..eed1fd855 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT 4.0.0 @@ -115,7 +115,7 @@ ONAP - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 568b246a6..72cc9ef6d 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 1eace060a..f6a7cf36f 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index e7839dd46..32b423d7d 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 7df9502a0..eda608433 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 9d002c37c..26c95f380 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index aec0d493b..0d62d99eb 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 5a20846a5..9dfe859eb 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index b39a96a09..7a3530689 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index b9641b8af..8bb7d0de0 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 0a295e049..1437a7ff4 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 1aa41410f..3b33d2e9a 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index e9b68be42..208072602 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.2.1-SNAPSHOT + 0.2.2-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index ebb19b8f6..2242188bd 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=2 -feature_revision=1 +feature_revision=2 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 591296a888ee6d659170604cd4d91ea7b58d55d1 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 17 May 2018 18:44:59 -0400 Subject: Publish mdsal-resource OSGi services Added Aries blueprint to advertise OSGi services. Updated to use release 1.0.2 version of CCSDK parent poms. Change-Id: I92fb652b975c4fd59e173c103350934b94d190d3 Issue-ID: CCSDK-289 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/.pydevproject | 5 + ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- .../ccsdk-ansible-adapter/pom.xml | 2 +- .../features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- .../features/ccsdk-mdsal-resource/pom.xml | 2 +- .../features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- .../adaptors/resource/mdsal/ConfigResource.java | 15 ++ .../mdsal/MdsalResourcePropertiesProvider.java | 28 ++++ .../mdsal/MdsalResourcePropertiesProviderImpl.java | 186 +++++++++++++++++++++ .../resource/mdsal/OperationalResource.java | 14 ++ .../src/main/resources/mdsal-resource.properties | 27 +++ .../blueprint/mdsal-resource-blueprint.xml | 49 ++++++ .../features/ccsdk-resource-assignment/pom.xml | 2 +- .../features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- .../features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 37 files changed, 354 insertions(+), 30 deletions(-) create mode 100644 ansible-adapter/.pydevproject create mode 100755 mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProvider.java create mode 100755 mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProviderImpl.java create mode 100644 mdsal-resource/provider/src/main/resources/mdsal-resource.properties create mode 100755 mdsal-resource/provider/src/main/resources/org/opendaylight/blueprint/mdsal-resource-blueprint.xml (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 2415b975a..a8daa7c1b 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 7b010ba0d..13624d146 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 52a36db1b..f1c1cb288 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index c9f48b95f..24b5b2dbd 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index e284d044c..deeb88c3e 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index c7f6817d1..0cbd7c326 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/ansible-adapter/.pydevproject b/ansible-adapter/.pydevproject new file mode 100644 index 000000000..d001f0aea --- /dev/null +++ b/ansible-adapter/.pydevproject @@ -0,0 +1,5 @@ + + +Default +python interpreter + diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index f87606acc..a0f102ec2 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,7 +18,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index aa5f96364..040a3fc0e 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index d90ec09fe..5ea71f8a9 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 9df26ffce..15f1c7304 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.2-SNAPSHOT + 1.0.2 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index ecd0d6b7e..5a914f97a 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 79b3b3890..b3da820c2 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 58f26d753..902e0d14d 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 49a644ea4..40231ed8e 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index b4ae2d19e..11a597714 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 50b188324..a8d92d0b8 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index f81e973e2..1b4e458ad 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index b528442be..84801c036 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java index d02530fe6..66604468e 100644 --- a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResource.java @@ -22,6 +22,7 @@ package org.onap.ccsdk.sli.adaptors.resource.mdsal; import java.util.Map; +import java.util.Properties; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -37,6 +38,20 @@ public class ConfigResource implements SvcLogicResource { private RestService restService; + public ConfigResource(MdsalResourcePropertiesProvider propProvider) { + LOG.info("Loading ConfigResource using property provider"); + Properties props = propProvider.getProperties(); + + String sdncUser = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-user", "admin"); + String sdncPasswd = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-passwd", "admin"); + String sdncHost = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-host", "localhost"); + String sdncProtocol = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-protocol", "https"); + String sdncPort = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-port", "8443"); + + restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); + + } + public ConfigResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) { restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProvider.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProvider.java new file mode 100755 index 000000000..e433a4c13 --- /dev/null +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProvider.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * onap + * ================================================================================ + * Copyright (C) 2016 - 2017 ONAP + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.adaptors.resource.mdsal; + +import java.util.Properties; + +public interface MdsalResourcePropertiesProvider { + + public Properties getProperties(); +} diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProviderImpl.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProviderImpl.java new file mode 100755 index 000000000..e9e006f17 --- /dev/null +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/MdsalResourcePropertiesProviderImpl.java @@ -0,0 +1,186 @@ +/*- + * ============LICENSE_START======================================================= + * onap + * ================================================================================ + * Copyright (C) 2016 - 2017 ONAP + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.adaptors.resource.mdsal; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; +import java.util.Properties; +import java.util.Vector; + +import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.utils.JREFileResolver; +import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; +import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; +import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Responsible for determining the properties file to use and instantiating the + * SqlResource Service. The priority for properties file + * resolution is as follows: + * + *
    + *
  1. A directory identified by the system environment variable + * SDNC_CONFIG_DIR
  2. + *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. + *
  5. A directory identified by the JRE argument + * sql-resource.properties
  6. + *
  7. A sql-resource.properties file located in the karaf root + * directory
  8. + *
+ */ +public class MdsalResourcePropertiesProviderImpl implements MdsalResourcePropertiesProvider { + + private static final Logger LOG = LoggerFactory.getLogger(MdsalResourcePropertiesProviderImpl.class); + + /** + * The name of the properties file for database configuration + */ + private static final String MDSALRESOURCE_PROP_FILE_NAME = "mdsal-resource.properties"; + + /** + * A prioritized list of strategies for resolving sql-resource properties files. + */ + private Vector mdsalResourcePropertiesFileResolvers = new Vector<>(); + + /** + * The configuration properties for the db connection. + */ + private Properties properties; + + /** + * Set up the prioritized list of strategies for resolving dblib properties + * files. + */ + public MdsalResourcePropertiesProviderImpl() { + mdsalResourcePropertiesFileResolvers + .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); + mdsalResourcePropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); + + mdsalResourcePropertiesFileResolvers.add( + new JREFileResolver("Using property file (3) from JRE argument", MdsalResourcePropertiesProviderImpl.class)); + mdsalResourcePropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); + + // determines properties file as according to the priority described in the + // class header comment + final File propertiesFile = determinePropertiesFile(this); + if (propertiesFile != null) { + try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { + properties = new Properties(); + properties.load(fileInputStream); + } catch (final IOException e) { + LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), + new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), + e)); + } + } else { + // Try to read properties as resource + + InputStream propStr = getClass().getResourceAsStream("/" + MDSALRESOURCE_PROP_FILE_NAME); + if (propStr != null) { + properties = new Properties(); + try { + properties.load(propStr); + propStr.close(); + } catch (IOException e) { + properties = null; + } + } + + } + + if (properties == null) { + reportFailure("Missing configuration properties resource(3)", new ConfigurationException( + "Missing configuration properties resource(3): " + MDSALRESOURCE_PROP_FILE_NAME)); + } + } + + /** + * Extract svclogic config properties. + * + * @return the svclogic config properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Reports the method chosen for properties resolution to the + * Logger. + * + * @param message + * Some user friendly message + * @param fileOptional + * The file location of the chosen properties file + * @return the file location of the chosen properties file + */ + private static File reportSuccess(final String message, final Optional fileOptional) { + if (fileOptional.isPresent()) { + final File file = fileOptional.get(); + LOG.info("{} {}", message, file.getPath()); + return file; + } + return null; + } + + /** + * Reports fatal errors. This is the case in which no properties file could be + * found. + * + * @param message + * An appropriate fatal error message + * @param configurationException + * An exception describing what went wrong during resolution + */ + private static void reportFailure(final String message, final ConfigurationException configurationException) { + + LOG.error("{}", message, configurationException); + } + + /** + * Determines the sql-resource properties file to use based on the following priority: + *
    + *
  1. A directory identified by the system environment variable + * SDNC_CONFIG_DIR
  2. + *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. + *
  5. A directory identified by the JRE argument + * mdsal-resource.properties
  6. + *
  7. A sql-resource.properties file located in the karaf root + * directory
  8. + *
+ */ + File determinePropertiesFile(final MdsalResourcePropertiesProviderImpl resourceProvider) { + + for (final PropertiesFileResolver sliPropertiesFileResolver : mdsalResourcePropertiesFileResolvers) { + final Optional fileOptional = sliPropertiesFileResolver.resolveFile(MDSALRESOURCE_PROP_FILE_NAME); + if (fileOptional.isPresent()) { + return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); + } + } + + return null; + } +} diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java index 63fe8c6ad..7cd8a80a7 100644 --- a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java +++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/OperationalResource.java @@ -22,6 +22,7 @@ package org.onap.ccsdk.sli.adaptors.resource.mdsal; import java.util.Map; +import java.util.Properties; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -37,6 +38,19 @@ public class OperationalResource implements SvcLogicResource { private RestService restService; + public OperationalResource(MdsalResourcePropertiesProvider propProvider) { + Properties props = propProvider.getProperties(); + + String sdncUser = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-user", "admin"); + String sdncPasswd = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-passwd", "admin"); + String sdncHost = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-host", "localhost"); + String sdncProtocol = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-protocol", "https"); + String sdncPort = props.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-port", "8443"); + + restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); + + } + public OperationalResource(String sdncProtocol, String sdncHost, String sdncPort, String sdncUser, String sdncPasswd) { restService = new RestService(sdncProtocol, sdncHost, sdncPort, sdncUser, sdncPasswd, RestService.PayloadType.XML); diff --git a/mdsal-resource/provider/src/main/resources/mdsal-resource.properties b/mdsal-resource/provider/src/main/resources/mdsal-resource.properties new file mode 100644 index 000000000..47c8ebf77 --- /dev/null +++ b/mdsal-resource/provider/src/main/resources/mdsal-resource.properties @@ -0,0 +1,27 @@ +### +# ============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.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-user=admin +org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-passwd=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-host=localhost +org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-protocol=http +org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-port=8181 + diff --git a/mdsal-resource/provider/src/main/resources/org/opendaylight/blueprint/mdsal-resource-blueprint.xml b/mdsal-resource/provider/src/main/resources/org/opendaylight/blueprint/mdsal-resource-blueprint.xml new file mode 100755 index 000000000..9c691263c --- /dev/null +++ b/mdsal-resource/provider/src/main/resources/org/opendaylight/blueprint/mdsal-resource-blueprint.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource + + + + + + org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource + + + diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 72cc9ef6d..78523eb57 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index f6a7cf36f..5eda60430 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 32b423d7d..81d7b05c9 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index eda608433..087ed8b93 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 26c95f380..9d91a413f 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 0d62d99eb..058d50eb6 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 9dfe859eb..0431e920a 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 7a3530689..7efb508ac 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 8bb7d0de0..244aac1c3 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 1437a7ff4..504e1f7db 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 3b33d2e9a..c69c9bd87 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 208072602..c1aaa28ea 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.2-SNAPSHOT + 1.0.2 -- cgit 1.2.3-korg From ff7de8e5e0be8edba4d8b03cf539b0a7971155c4 Mon Sep 17 00:00:00 2001 From: "Stilwell, David (stilwelld)" Date: Wed, 23 May 2018 12:37:38 -0400 Subject: Roll to next snapshot version Changed to 0.2.3-SNAPSHOT and updated parent to 1.0.3-SNAPSHOT Change-Id: Ie61b39952f6504db8ae2adf0614aefc243294461 Issue-ID: CCSDK-290 Signed-off-by: Stilwell, David (stilwelld) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 32 files changed, 63 insertions(+), 63 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index a8daa7c1b..b9ba7faff 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 13624d146..043cd8671 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index f1c1cb288..4182b19e7 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 24b5b2dbd..3873060fc 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index deeb88c3e..0fca758c2 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 0cbd7c326..ea207523b 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index a0f102ec2..245cfde7a 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 040a3fc0e..4bf4a2ed8 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 5ea71f8a9..802f6262c 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 15f1c7304..1b43a1b87 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 5a914f97a..728274590 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index b3da820c2..fec5ddc2f 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 902e0d14d..493b1c5d7 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 40231ed8e..26d5d4ce1 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 11a597714..34fa1fbd8 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index a8d92d0b8..cd5e7c354 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 1b4e458ad..ec11227eb 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 84801c036..25a54b67a 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index c2659865e..3308adb18 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 @@ -115,7 +115,7 @@ ONAP - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 78523eb57..b55c9049d 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 5eda60430..3da4fe65a 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 81d7b05c9..d00146e91 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 087ed8b93..d4a6b647b 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 9d91a413f..3177132b2 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 058d50eb6..54679801d 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 0431e920a..c44241cde 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 7efb508ac..76c807cf8 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 244aac1c3..39d4e9c73 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 504e1f7db..f7cde938c 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index c69c9bd87..0bca775a8 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index c1aaa28ea..07a88962b 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.2 + 1.0.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 2242188bd..5d5ee0480 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=2 -feature_revision=2 +feature_revision=3 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 590f1d2011f50ba339bc9374990c56e7ca101f0a Mon Sep 17 00:00:00 2001 From: "Stilwell, David (stilwelld)" Date: Wed, 23 May 2018 17:13:04 -0400 Subject: Update to release version parent 1.0.3 Update parent version to remove -SNAPSHOT (1.0.3) Change-Id: I03d804016c5007cbbdbaca026a0b7006fddc69d8 Issue-ID: CCSDK-290 Signed-off-by: Stilwell, David (stilwelld) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index b9ba7faff..316e29d64 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 043cd8671..da91b26b8 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 4182b19e7..65a8f05e1 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 3873060fc..d984d192c 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 0fca758c2..2e26f5439 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index ea207523b..84bbea228 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 245cfde7a..d799e3a1f 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,7 +18,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 4bf4a2ed8..b18bc1623 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 802f6262c..8aa87080d 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 1b43a1b87..314f97a06 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.3-SNAPSHOT + 1.0.3 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 728274590..4c1325c2d 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index fec5ddc2f..8e9a7a5df 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 493b1c5d7..188412830 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 26d5d4ce1..8078365f0 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 34fa1fbd8..fe9d547cc 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index cd5e7c354..c109aeab0 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index ec11227eb..be8f5d7ce 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 25a54b67a..a4f6fbaf6 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/pom.xml b/pom.xml index 3308adb18..bc1a13b0d 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index b55c9049d..0a8c9989d 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 3da4fe65a..474694cab 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index d00146e91..3c8ff5cb7 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index d4a6b647b..ba13442a5 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 3177132b2..f2176325d 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 54679801d..ea09d8617 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index c44241cde..f572404de 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 76c807cf8..d5e47fa02 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 39d4e9c73..908c61da7 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index f7cde938c..1aabc0e35 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 0bca775a8..1458e10db 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3-SNAPSHOT + 1.0.3 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 07a88962b..c11180214 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.3-SNAPSHOT + 1.0.3 -- cgit 1.2.3-korg From a5f305d60f369c68ce42503f6c3a517560eac24b Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 30 May 2018 17:36:02 -0400 Subject: Roll version to 0.2.4 Roll version to 0.2.4-SNAPSHOT and version 1.0.4-SNAPSHOT of parent Change-Id: I9580fef343410c3bd42caf2a1a05b833fb617541 Issue-ID: CCSDK-291 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 32 files changed, 63 insertions(+), 63 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 316e29d64..479773eed 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index da91b26b8..df5411580 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 65a8f05e1..b8cfa8e3e 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index d984d192c..813b272bc 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 2e26f5439..bf29b148b 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 84bbea228..398caa11f 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index d799e3a1f..8d90968ce 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index b18bc1623..cf57e7978 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 8aa87080d..daac8cbf7 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 314f97a06..f20e36d63 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 4c1325c2d..93d78e2fa 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 8e9a7a5df..335a7d6e5 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 188412830..de808ae3d 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 8078365f0..933331a14 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index fe9d547cc..a107f83b0 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index c109aeab0..ebf5c2c12 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index be8f5d7ce..817b24ffa 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index a4f6fbaf6..bb2ebcdbb 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index bc1a13b0d..7b7468331 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT 4.0.0 @@ -115,7 +115,7 @@ ONAP - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 0a8c9989d..9ea5265c6 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 474694cab..89a024811 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 3c8ff5cb7..8648b2a24 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index ba13442a5..f8bd2fc0a 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index f2176325d..851d80a3d 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index ea09d8617..ccf09f739 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index f572404de..cf0c5daa8 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index d5e47fa02..18aaa2f55 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 908c61da7..1ef1bc7b9 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 1aabc0e35..5798a0f6b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 1458e10db..22f7aa1d2 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index c11180214..258ca0d52 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.3 + 1.0.4-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.2.3-SNAPSHOT + 0.2.4-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 5d5ee0480..de7eeb4b6 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=2 -feature_revision=3 +feature_revision=4 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 665dee8b8e514fabb64f6666361b9e5ab4f46720 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 31 May 2018 14:23:27 -0400 Subject: Use released parent pom Update to use release parent pom version 1.0.4 Change-Id: Ie5aff311743e9b962cfbdd319ba08ae49c3a4380 Issue-ID: CCSDK-291 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 479773eed..c4b4116ff 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index df5411580..947234078 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index b8cfa8e3e..bf241e151 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 813b272bc..b52c497e1 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index bf29b148b..fe3693c4d 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 398caa11f..12ccfdb4d 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 8d90968ce..90c53f495 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,7 +18,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index cf57e7978..6caa634fa 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index daac8cbf7..bf3eca5e7 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index f20e36d63..240975cfb 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.4-SNAPSHOT + 1.0.4 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 93d78e2fa..3a0648904 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 335a7d6e5..87954ddba 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index de808ae3d..407610100 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 933331a14..e00895862 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index a107f83b0..2df4e3320 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index ebf5c2c12..31c99de0c 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 817b24ffa..8b9899d35 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index bb2ebcdbb..842fba5c9 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/pom.xml b/pom.xml index 7b7468331..ee1296a74 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 9ea5265c6..763b8ef0b 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 89a024811..802899081 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 8648b2a24..63c89d520 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index f8bd2fc0a..2849c77db 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 851d80a3d..a20a7543a 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index ccf09f739..8ccbbaeb5 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cf0c5daa8..cc80e36ee 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 18aaa2f55..854d9edb6 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 1ef1bc7b9..6ae0f7552 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 5798a0f6b..e5f0eeb48 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 22f7aa1d2..92413014e 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 258ca0d52..f0419d7a2 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.0.4-SNAPSHOT + 1.0.4 -- cgit 1.2.3-korg From 52a06cedb172a1a446ecfaaaa96bf500a58c8fb5 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 6 Jun 2018 13:56:45 -0400 Subject: Roll version for Casablanca Roll version for Casablanca development start Change-Id: I18e7bbd6dfb2cdcc7bf302411c03ee298ec76be6 Issue-ID: CCSDK-295 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 6 +++--- 32 files changed, 65 insertions(+), 65 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index c4b4116ff..8d36b4c78 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 947234078..3a38d79de 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index bf241e151..63c5e17ca 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index b52c497e1..7e91aa742 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index fe3693c4d..9a9436345 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 12ccfdb4d..30c4098ad 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 90c53f495..497a35f09 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 6caa634fa..232616c8b 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index bf3eca5e7..55a42e9d4 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 240975cfb..a40e70d3a 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 3a0648904..7dcaab5ea 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 87954ddba..fb2b83a95 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 407610100..e7d48ac03 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index e00895862..0b4e7c83c 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 2df4e3320..051bd80c5 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 31c99de0c..86792f44d 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 8b9899d35..003e8bb7a 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 842fba5c9..63370bdf9 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index ee1296a74..a2d2ec2a7 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT 4.0.0 @@ -115,7 +115,7 @@ ONAP - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 763b8ef0b..fdbbf6a88 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 802899081..8b08563cd 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 63c89d520..4ded5a1fa 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 2849c77db..6853619cd 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index a20a7543a..746a44747 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 8ccbbaeb5..4a29b54de 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cc80e36ee..fb01685c8 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 854d9edb6..000f87879 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 6ae0f7552..4a99dc10b 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index e5f0eeb48..7e5efd550 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 92413014e..13c365c37 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index f0419d7a2..312cebc11 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.0.4 + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.2.4-SNAPSHOT + 0.3.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index de7eeb4b6..f9fd33500 100644 --- a/version.properties +++ b/version.properties @@ -4,11 +4,11 @@ # because they are used in Jenkins, whose plug-in doesn't support release_name=0 -sprint_number=2 -feature_revision=4 +sprint_number=3 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version} +release_version=${base_version}-STAGING snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From 7893d08db0ef3fd29d64c9be759325fa18cc21fa Mon Sep 17 00:00:00 2001 From: sb5356 Date: Tue, 15 May 2018 11:58:17 -0400 Subject: [CCSDK-245] RA: Refactor RA to make it generic Resource allocator is cleaned up and refactored so it does not contain any service specific logic. Issue-ID: CCSDK-245 Change-Id: Ib948eb813020fbe7dc779148e412de1e074b300b Signed-off-by: sb5356 --- .../sli/adaptors/lock/comp/LockHelperImpl.java | 82 +- .../sli/adaptors/lock/dao/ResourceLockDao.java | 13 +- .../sli/adaptors/lock/dao/ResourceLockDaoImpl.java | 44 +- .../ccsdk/sli/adaptors/ra/ReleaseRequestType.java | 45 - .../ccsdk/sli/adaptors/ra/ReserveRequestType.java | 43 - .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 1114 +++++-------------- .../adaptors/ra/alloc/AffinityAllocationRule.java | 68 -- .../sli/adaptors/ra/alloc/DbAllocationRule.java | 243 +++-- .../ra/alloc/ServingSiteAllocationRule.java | 80 -- .../sli/adaptors/ra/alloc/VrfAllocationRule.java | 111 -- .../sli/adaptors/ra/check/AnyVrfPresentCheck.java | 74 -- .../sli/adaptors/ra/check/ExcludeVpeCheck.java | 57 - .../sli/adaptors/ra/check/HubWithRgCheck.java | 107 -- .../ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java | 100 -- .../sli/adaptors/ra/check/ProvStatusCheck.java | 49 - .../sli/adaptors/ra/check/VlanSpeedCheck.java | 50 - .../ccsdk/sli/adaptors/ra/check/VpeLockCheck.java | 111 -- .../ccsdk/sli/adaptors/ra/comp/AllocationRule.java | 17 +- .../ra/comp/EndPointAllocationDefinition.java | 60 -- .../sli/adaptors/ra/comp/EndPointAllocator.java | 20 +- .../adaptors/ra/comp/EndPointAllocatorImpl.java | 329 +++--- .../ccsdk/sli/adaptors/ra/comp/EndPointData.java | 33 - .../ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java | 35 - .../ccsdk/sli/adaptors/ra/comp/PreferenceRule.java | 30 - .../ccsdk/sli/adaptors/ra/comp/ResourceData.java | 35 + .../ccsdk/sli/adaptors/ra/comp/ResourceEntity.java | 32 + .../sli/adaptors/ra/comp/ResourceRequest.java | 39 + .../sli/adaptors/ra/comp/ResourceResponse.java | 13 + .../ccsdk/sli/adaptors/ra/comp/ResourceTarget.java | 31 + .../ccsdk/sli/adaptors/ra/comp/ServiceData.java | 36 - .../adaptors/ra/equip/comp/EquipmentReader.java | 32 - .../ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java | 30 - .../sli/adaptors/ra/equip/dao/ServerDaoImpl.java | 64 -- .../sli/adaptors/ra/equip/dao/VpePortDao.java | 32 - .../sli/adaptors/ra/equip/dao/VpePortDaoImpl.java | 81 -- .../sli/adaptors/ra/equip/dao/VplspePortDao.java | 30 - .../adaptors/ra/equip/dao/VplspePortDaoImpl.java | 70 -- .../sli/adaptors/ra/equip/data/EquipmentData.java | 31 - .../sli/adaptors/ra/equip/data/EquipmentLevel.java | 26 - .../sli/adaptors/ra/pref/AffinityLinkPref.java | 85 -- .../sli/adaptors/ra/pref/EvcExistingVrfPref.java | 60 -- .../sli/adaptors/ra/reader/AicSiteReader.java | 49 - .../adaptors/ra/reader/UplinkCircuitReader.java | 54 - .../ccsdk/sli/adaptors/ra/reader/VnfReader.java | 49 - .../sli/adaptors/ra/reader/VpePortReader.java | 70 -- .../ra/rule/comp/AllocationRequestBuilder.java | 42 - .../ra/rule/comp/AllocationRequestBuilderImpl.java | 172 --- .../sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java | 28 - .../adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java | 85 -- .../adaptors/ra/rule/dao/MaxServerSpeedDao.java | 28 - .../ra/rule/dao/MaxServerSpeedDaoImpl.java | 86 -- .../sli/adaptors/ra/rule/dao/ParameterDao.java | 27 - .../sli/adaptors/ra/rule/dao/ParameterDaoImpl.java | 57 - .../sli/adaptors/ra/rule/dao/RangeRuleDao.java | 8 +- .../sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java | 40 +- .../sli/adaptors/ra/rule/dao/ResourceRuleDao.java | 14 +- .../adaptors/ra/rule/dao/ResourceRuleDaoImpl.java | 35 +- .../ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java | 27 - .../sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java | 48 - .../ra/service/dao/ServiceResourceDao.java | 38 - .../ra/service/dao/ServiceResourceDaoImpl.java | 110 -- .../adaptors/ra/service/data/ServiceResource.java | 32 - .../adaptors/ra/service/data/ServiceStatus.java | 27 - .../sli/adaptors/rm/comp/AllocationFunction.java | 113 +- .../sli/adaptors/rm/comp/ResourceManagerImpl.java | 29 +- .../sli/adaptors/rm/data/AllocationRequest.java | 6 +- .../adaptors/rm/data/RangeAllocationRequest.java | 6 +- .../onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java | 28 +- .../onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java | 93 +- .../onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java | 83 +- .../ccsdk/sli/adaptors/rm/util/ResourceUtil.java | 24 +- .../sli/adaptors/util/db/CachedDataSourceWrap.java | 46 +- .../adaptors/util/expr/ExpressionEvaluator.java | 161 ++- .../ccsdk/sli/adaptors/util/speed/SpeedUtil.java | 26 +- .../onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java | 30 - .../onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java | 76 -- .../blueprint/resource-assignment-blueprint.xml | 2 + .../opendaylight/blueprint/resource-assignment.xml | 17 +- .../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 - .../org/onap/ccsdk/sli/adaptors/ra/DataSetup.java | 224 +--- .../ccsdk/sli/adaptors/ra/TestIsAvailable.java | 405 ------- .../onap/ccsdk/sli/adaptors/ra/TestLockHelper.java | 59 + .../org/onap/ccsdk/sli/adaptors/ra/TestQuery.java | 85 -- .../onap/ccsdk/sli/adaptors/ra/TestRelease.java | 430 -------- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 1122 ++++++++++---------- .../onap/ccsdk/sli/adaptors/ra/TestReserve2.java | 77 -- .../org/onap/ccsdk/sli/adaptors/ra/TestDb.java | 37 + .../org/onap/ccsdk/sli/adaptors/ra/TestTable.java | 135 +++ .../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/param.txt | 44 - .../provider/src/test/resources/sql/data.sql | 66 ++ .../src/test/resources/svc-topology-req.json | 195 ---- .../provider/src/test/resources/test-context.xml | 217 +--- 98 files changed, 2147 insertions(+), 6739 deletions(-) delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceEntity.java create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceResponse.java create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceTarget.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java delete mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java 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/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQuery.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve2.java create mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestDb.java create mode 100644 resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestTable.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 100755 resource-assignment/provider/src/test/resources/param.txt delete mode 100644 resource-assignment/provider/src/test/resources/svc-topology-req.json (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java index 4d9bb27de..3a8c730e4 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,12 +26,15 @@ import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.List; - import org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDao; import org.onap.ccsdk.sli.adaptors.lock.data.ResourceLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class LockHelperImpl implements LockHelper { + private static final Logger log = LoggerFactory.getLogger(LockHelperImpl.class); + private ResourceLockDao resourceLockDao; private int retryCount = 10; private int lockWait = 5; // Seconds @@ -51,10 +54,12 @@ public class LockHelperImpl implements LockHelper { for (int i = 0; true; i++) { try { tryLock(resourceNameList, lockRequester, lockTimeout); + log.info("Resources locked: " + resourceNameList); return; } catch (ResourceLockedException e) { - if (i > retryCount) + if (i > retryCount) { throw e; + } try { Thread.sleep(lockWait * 1000); } catch (InterruptedException ex) { @@ -65,58 +70,64 @@ public class LockHelperImpl implements LockHelper { @Override public void unlock(Collection lockNames, boolean force) { - if (lockNames == null || lockNames.size() == 0) + 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) + if (l != null) { + if (force || l.lockCount == 1) { resourceLockDao.delete(l.id); - else + } else { resourceLockDao.decrementLockCount(l.id); + } + } } + + resourceLockDao.commit(); + + log.info("Resources unlocked: " + lockNames); } finally { - resourceLockDao.unlockTable(); + resourceLockDao.rollback(); } } public void tryLock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */) { - if (resourceNameList == null || resourceNameList.size() == 0) + if (resourceNameList == null || resourceNameList.size() == 0) { return; + } lockRequester = generateLockRequester(lockRequester, 100); - resourceLockDao.lockTable(); - - try { - // First check if all requested records are available to lock + // First check if all requested records are available to lock - Date now = new Date(); + Date now = new Date(); - List dbLockList = new ArrayList(); - List insertLockNameList = new ArrayList(); + try { + 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) + 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) + if (l != null) { dbLockList.add(l); - else + } else { insertLockNameList.add(name); + } } // Update the lock info in DB - for (ResourceLock l : dbLockList) + 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) { @@ -126,16 +137,26 @@ public class LockHelperImpl implements LockHelper { l.lockTime = now; l.expirationTime = new Date(now.getTime() + lockTimeout * 1000); l.lockCount = 1; - resourceLockDao.add(l); + + try { + resourceLockDao.add(l); + } catch (Exception e) { + log.info("Failed to insert lock record: " + lockName); + throw new ResourceLockedException(l.resourceName, "unknown", lockRequester); + } } + + resourceLockDao.commit(); + } finally { - resourceLockDao.unlockTable(); + resourceLockDao.rollback(); } } private static String generateLockRequester(String name, int maxLength) { - if (name == null) + if (name == null) { name = ""; + } int l1 = name.length(); String tname = Thread.currentThread().getName(); int l2 = tname.length(); @@ -146,8 +167,9 @@ public class LockHelperImpl implements LockHelper { l1 = maxl1; } int maxl2 = maxLength - l1 - 1; - if (l2 > maxl2) + if (l2 > maxl2) { tname = tname.substring(0, 6) + "..." + tname.substring(l2 - maxl2 + 9); + } } return tname + '-' + name; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java index bcabb36d1..f9d41135c 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,15 +22,10 @@ package org.onap.ccsdk.sli.adaptors.lock.dao; import java.util.Date; - import org.onap.ccsdk.sli.adaptors.lock.data.ResourceLock; public interface ResourceLockDao { - void lockTable(); - - void unlockTable(); - void add(ResourceLock l); void update(long id, Date lockTime, Date expirationTime, int lockCount); @@ -40,4 +35,8 @@ public interface ResourceLockDao { void delete(long id); void decrementLockCount(long id); + + void commit(); + + void rollback(); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java index d68317fb7..485419224 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import java.util.List; - import org.onap.ccsdk.sli.adaptors.lock.data.ResourceLock; import org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap; import org.slf4j.Logger; @@ -35,29 +34,10 @@ import org.springframework.jdbc.core.RowMapper; public class ResourceLockDaoImpl implements ResourceLockDao { + @SuppressWarnings("unused") 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) { @@ -109,7 +89,21 @@ public class ResourceLockDaoImpl implements ResourceLockDao { this.jdbcTemplate = jdbcTemplate; } - public void setTesting(boolean testing) { - this.testing = testing; + @Override + public void commit() { + if (jdbcTemplate.getDataSource() instanceof CachedDataSourceWrap) { + CachedDataSourceWrap ds = (CachedDataSourceWrap) jdbcTemplate.getDataSource(); + ds.commit(); + ds.releaseConnection(); + } + } + + @Override + public void rollback() { + if (jdbcTemplate.getDataSource() instanceof CachedDataSourceWrap) { + CachedDataSourceWrap ds = (CachedDataSourceWrap) jdbcTemplate.getDataSource(); + ds.rollback(); + ds.releaseConnection(); + } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReleaseRequestType.java deleted file mode 100644 index d3df91c2d..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ReserveRequestType.java deleted file mode 100644 index b46b7dede..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 8e7c63ceb..426fd289d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,48 +21,25 @@ package org.onap.ccsdk.sli.adaptors.ra; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; - -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import java.util.Set; import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocator; -import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointData; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.dao.ServerDao; -import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDao; -import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VplspePortDao; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; -import org.onap.ccsdk.sli.adaptors.ra.rule.comp.AllocationRequestBuilder; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxPortSpeedDao; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxServerSpeedDao; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ParameterDao; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; -import org.onap.ccsdk.sli.adaptors.ra.service.dao.ServiceResourceDao; -import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; -import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceStatus; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceData; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceEntity; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceResponse; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; -import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; -import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; -import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; -import org.onap.ccsdk.sli.adaptors.rm.data.Resource; import org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,23 +47,15 @@ public class ResourceAllocator implements SvcLogicResource { private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); - public ResourceAllocator() { - log.info("ResourceAllocator created."); - } + private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; - 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 EndPointAllocator endPointAllocator; private SpeedUtil speedUtil; - private EndPointAllocator endPointAllocator; + public ResourceAllocator() { + log.info("ResourceAllocator created."); + } @Override public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) @@ -95,11 +64,7 @@ public class ResourceAllocator implements SvcLogicResource { } @Override - public QueryStatus update( - String resource, - String key, - Map parms, - String prefix, + public QueryStatus update(String resource, String key, Map parms, String prefix, SvcLogicContext ctx) throws SvcLogicException { return QueryStatus.SUCCESS; @@ -117,13 +82,7 @@ public class ResourceAllocator implements SvcLogicResource { } @Override - public QueryStatus save( - String arg0, - boolean arg1, - boolean arg2, - String arg3, - Map arg4, - String arg5, + public QueryStatus save(String arg0, boolean arg1, boolean arg2, String arg3, Map arg4, String arg5, SvcLogicContext arg6) throws SvcLogicException { return QueryStatus.SUCCESS; } @@ -131,886 +90,355 @@ public class ResourceAllocator implements SvcLogicResource { @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); + return allocateResources(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 (!"NetworkCapacity".equals(resource)) { - 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; + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, + String orderBy, SvcLogicContext ctx) throws SvcLogicException { + + String resourceEntityId = getParam(ctx, + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, false, null); + String resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, false, null); + String resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); + + String resourceTargetId = + getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, false, null); + String resourceTargetType = + getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, false, null); + String resourceName = getParam(ctx, "resource-name", false, null); + + if (resourceEntityId != null && resourceEntityType != null) { + List rdlist = endPointAllocator.getResourcesForEntity(resourceEntityType, resourceEntityId, + resourceEntityVersion); + setResourceDataInContext(ctx, prefix, rdlist); + } else if (resourceTargetId != null && resourceTargetType != null && resourceName != null) { + ResourceData rd = endPointAllocator.getResource(resourceTargetType, resourceTargetId, resourceName); + setResourceDataInContext(ctx, prefix, Collections.singletonList(rd)); } - 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"; + return QueryStatus.SUCCESS; + } - String resourceUnionId = key + '/' + endPointPosition; - List rlist = resourceManager.getResourceUnion(resourceUnionId); + public AllocationStatus query(ResourceEntity sd, ResourceTarget rt, ResourceRequest rr, + List rsList) throws Exception { + + if (sd.resourceEntityId != null && sd.resourceEntityType != null) { + List rdlist = endPointAllocator.getResourcesForEntity(sd.resourceEntityType, + sd.resourceEntityId, sd.resourceEntityVersion); + setResourceDataInResponse(rdlist, rsList); + } else if (rt.resourceTargetId != null && rt.resourceTargetType != null && rr.resourceName != null) { + ResourceData rd = + endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName); + setResourceDataInResponse(Collections.singletonList(rd), rsList); + } - log.info("Resources found for " + resourceUnionId + ": " + rlist.size()); + return AllocationStatus.Success; + } - String assetId = null; - for (Resource r : rlist) { - log.info("Resource: " + r.resourceKey.resourceName); + private void setResourceDataInContext(SvcLogicContext ctx, String prefix, List rdlist) { + prefix = prefix == null ? "" : prefix + '.'; - 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())); + setAttr(ctx, prefix + "resource-list_length", String.valueOf(rdlist.size())); - log.info("Added context attr: " + prefix + r.resourceKey.resourceName + ": " + - String.valueOf(rr.used.first())); + for (int i = 0; i < rdlist.size(); i++) { + ResourceData rd = rdlist.get(i); - 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); + String pp = prefix + "resource-list[" + i + "]."; - log.info("Added context attr: " + prefix + "vpe-name: " + vpeName); - } - } - } + setAttr(ctx, pp + "resource-name", rd.resourceName); + setAttr(ctx, pp + "endpoint-position", rd.endPointPosition); + setAttr(ctx, pp + "resource-target-type", rd.resourceTargetType); + setAttr(ctx, pp + "resource-target-id", rd.resourceTargetId); + // SDNGC-7687 + setAttr(ctx, pp + "resource-target-value", rd.resourceTargetValue); + setAttr(ctx, pp + "status", rd.status); - 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; - } + if (rd.data != null && !rd.data.isEmpty()) { + for (String kk : rd.data.keySet()) { + String value = String.valueOf(rd.data.get(kk)); + setAttr(ctx, pp + kk, value); } } } - - 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); + return allocateResources(ctx, false, prefix); + } + + public AllocationStatus reserve(ResourceEntity sd, ResourceTarget rt, ResourceRequest rr, + List rsList) throws Exception { + return allocateResources(sd, rt, rr, rsList); } @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"); + String resourceEntityId = getParam(ctx, + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + String resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); + String resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, null); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = resourceEntityId; + sd.resourceEntityType = resourceEntityType; + sd.resourceEntityVersion = resourceEntityVersion; - 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); - } + this.release(sd); + } catch (Exception e) { + throw new SvcLogicException(e.getMessage()); } - return QueryStatus.SUCCESS; } - private QueryStatus allocateResourcesL3SDN(SvcLogicContext ctx, boolean checkOnly, String prefix) - throws SvcLogicException { - prefix = prefix == null ? "" : prefix + '.'; + public AllocationStatus release(ResourceEntity sd) throws Exception { - String aicSiteId = getAicSiteId(ctx); - Map service = getServiceData(ctx); + if (sd.resourceEntityVersion != null) { + String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; + log.info("Starting release for: " + resourceSet); - String requestTypeStr = ctx.getAttribute("tmp.resource-allocator.request-type"); - if (requestTypeStr == null) - requestTypeStr = "New"; + resourceManager.releaseResourceSet(resourceSet); + } else { + String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; + log.info("Starting release for: " + resourceUnion); - 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."); + resourceManager.releaseResourceUnion(resourceUnion); } - 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); + return AllocationStatus.Success; - 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); + private QueryStatus allocateResources(SvcLogicContext ctx, boolean checkOnly, String prefix) + throws SvcLogicException { + String serviceModel = getParam(ctx, "service-model", true, null); + String requestType = getParam(ctx, "request-type", false, "New"); - vpePortData = orderVpe(vpePortData); + ResourceEntity sd = getResourceEntityData(ctx); + ResourceTarget rt = getResourceTargetData(ctx); + ResourceRequest rr = getResourceRequest(ctx); - long maxAvailableSpeedVpePort = 0; - boolean vpePortFound = false; + log.info("Starting reserve: " + requestType + ", service-model: " + serviceModel); + StrUtil.info(log, sd); + StrUtil.info(log, rt); + StrUtil.info(log, rr); - 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; + boolean change = requestType.equalsIgnoreCase("change"); - log.info("Checking VPE port: " + portId); + List rlist = endPointAllocator.allocateResources(serviceModel, sd, rt, rr, checkOnly, change); - String provStatus = String.valueOf(vpe.get("provisioning-status")); - if (!"PROV".equals(provStatus)) { - log.info("Skipping port " + portId + ": Provisioning status is not PROV."); - continue; - } + if (rlist != null && !rlist.isEmpty()) { + setResourceDataInContext(ctx, prefix, rlist); - 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); + for (ResourceData rd : rlist) { + if (!rd.status.equals("Success")) { + log.info("Capacity not found for: " + sd.resourceEntityType + "::" + sd.resourceEntityId); + return QueryStatus.NOT_FOUND; } - - 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; } } + return QueryStatus.SUCCESS; + } - long maxAvailableSpeedVplspePort = 0; - boolean vplspePortFound = false; + private AllocationStatus allocateResources(ResourceEntity sd, ResourceTarget rt, ResourceRequest rr, + List rsList) throws Exception { - 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; + String serviceModel = rr.serviceModel; + String requestType = rr.requestType == null ? "New" : rr.requestType; - log.info("Checking VPLSPE port: " + portId); + log.info("Starting reserve: " + requestType + ", service-model: " + serviceModel); + StrUtil.info(log, sd); + StrUtil.info(log, rt); + StrUtil.info(log, rr); - String provStatus = String.valueOf(vplspe.get("provisioning-status")); - if (!"PROV".equals(provStatus)) { - log.info("Skipping port " + portId + ": Provisioning status is not PROV."); - continue; - } + boolean change = requestType.equalsIgnoreCase("change"); - 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; - } + List rlist = endPointAllocator.allocateResources(serviceModel, sd, rt, rr, rr.checkOnly, change); - if (ao instanceof LimitAllocationOutcome) { - LimitAllocationOutcome lao = (LimitAllocationOutcome) ao; - long available = lao.limit - lao.used; - if (available > maxAvailableSpeedVplspePort) - maxAvailableSpeedVplspePort = available; + if (rlist != null && !rlist.isEmpty()) { + setResourceDataInResponse(rlist, rsList); + + for (ResourceData rd : rlist) { + if (!rd.status.equals("Success")) { + log.info("Capacity not found for: " + sd.resourceEntityType + "::" + sd.resourceEntityId); + return AllocationStatus.ResourceNotFound; + } } } - 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 ("Bandwidth".equals(lao.request.resourceName)) { - ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao); - setThresholdData(ctx, th, sd, ed); - } - } + return AllocationStatus.Success; + } + + private void setResourceDataInResponse(List rlist, List rsList) { + for (ResourceData rd : emptyIfNull(rlist)) { + ResourceResponse res = new ResourceResponse(); + res.resourceName = rd.resourceName; + res.endPointPosition = rd.endPointPosition; + res.resourceTargetId = rd.resourceTargetId; + res.resourceTargetType = rd.resourceTargetType; + res.status = rd.status; + if (rd.data != null && !rd.data.isEmpty()) { + for (String kk : rd.data.keySet()) { + if (kk.equalsIgnoreCase("allocated")) { + res.resourceAllocated = String.valueOf(rd.data.get(kk)); } - } - break; - } + if (kk.equalsIgnoreCase("used")) { + res.resourceUsed = String.valueOf(rd.data.get(kk)); + } - 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 && "Bandwidth".equals(lao.request.resourceName)) { - long available = lao.limit - lao.used; - if (available > maxAvailableSpeedServer) - maxAvailableSpeedServer = available; - } - if (lao.status == AllocationStatus.Failure && "Connection".equals(lao.request.resourceName)) { - maxAvailableSpeedServer = 0; - break; - } + if (kk.equalsIgnoreCase("available")) { + res.resourceAvailable = String.valueOf(rd.data.get(kk)); + } - ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao); - setThresholdData(ctx, th, sd, ed); + if (kk.equalsIgnoreCase("limit")) { + res.resourceLimit = String.valueOf(rd.data.get(kk)); } - } - } - } - 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; + rsList.add(res); } - 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; + public static Iterable emptyIfNull(Iterable iterable) { + return iterable == null ? Collections.emptyList() : iterable; } - 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 void setAttr(SvcLogicContext ctx, String name, String value) { + ctx.setAttribute(name, value); + log.info("Added context attr: " + name + ": " + value); } - 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 ResourceEntity getResourceEntityData(SvcLogicContext ctx) throws SvcLogicException { + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = getParam(ctx, + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + sd.resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); + sd.resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); + sd.data = getDataParam(ctx, "reservation-entity-data", "resource-entity-data", "service-data"); + return sd; } - private int getEvcCountOnServer(String serverId) { - LimitResource l = (LimitResource) resourceManager.getResource("Connection", serverId); - if (l != null) - return (int) l.used; - return 0; + private ResourceTarget getResourceTargetData(SvcLogicContext ctx) throws SvcLogicException { + ResourceTarget sd = new ResourceTarget(); + sd.resourceTargetId = getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, true, null); + sd.resourceTargetType = + getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, true, null); + sd.data = getDataParam(ctx, "reservation-target-data", "resource-target-data", "equipment-data"); + return sd; } - 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 ResourceRequest getResourceRequest(SvcLogicContext ctx) throws SvcLogicException { + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = getParam(ctx, "resource-name", false, null); + rr.resourceShareGroup = getParam(ctx, "resource-share-group", false, null); + rr.rangeRequestedNumbers = getParam(ctx, "range-requested-numbers", false, null); + rr.rangeExcludeNumbers = getParam(ctx, "range-exclude-numbers", false, null); + String rangeReverseOrderStr = getParam(ctx, "range-reverse-order", false, "false"); + rr.rangeReverseOrder = Boolean.parseBoolean(rangeReverseOrderStr); + String rangeMinOverrideStr = getParam(ctx, "range-min-override", false, "-1"); + rr.rangeMinOverride = Integer.parseInt(rangeMinOverrideStr); + String rangeMaxOverrideStr = getParam(ctx, "range-max-override", false, "-1"); + rr.rangeMaxOverride = Integer.parseInt(rangeMaxOverrideStr); + String replaceStr = getParam(ctx, "replace", false, "true"); + rr.replace = Boolean.parseBoolean(replaceStr); + rr.applicationId = getParam(ctx, "application-id", false, "SDNC"); + rr.endPointPosition = getParam(ctx, "endpoint-position", false, null); + return rr; } - 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."); + private String getParam(SvcLogicContext ctx, String name, boolean required, String def) throws SvcLogicException { + String v = null; + for (String p : INPUT_PREFIX) { + v = ctx.getAttribute(p + name); + if (v != null && v.trim().length() > 0) { + log.info("Param: " + name + ": " + v.trim()); + return v.trim(); + } } - 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); + if (required) { + throw new SvcLogicException("The following variable is required in DG context: " + name); } - 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; + log.info("Param: " + name + " not supplied. Using default: " + def); + return def; } - 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); + private String getParam(SvcLogicContext ctx, String[] names, boolean required, String def) + throws SvcLogicException { + String v = null; + for (String name : names) { + v = getParam(ctx, name, false, def); + if (v != null) { + return v; } - 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); + if (required) { + throw new SvcLogicException( + "One of the following variable is required in DG context: " + Arrays.deepToString(names)); } - return (serverCount - 1) * n / (n + m) + 1; + log.info("Param: " + names + " not supplied. Using default: " + def); + return def; } - 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; + private Map getDataParam(SvcLogicContext ctx, String... names) { + Map data = new HashMap<>(); + Set ctxNames = ctx.getAttributeKeySet(); + for (String n : ctxNames) { + for (String p : INPUT_PREFIX) { + for (String name : names) { + String pp = p + name + '.'; + if (n.startsWith(pp)) { + String nn = n.substring(pp.length()); + String vv = ctx.getAttribute(n); + data.put(nn, vv); + + log.info("Data param: " + nn + ": " + vv); + + if (ctxNames.contains(n + "-unit")) { + try { + long v = Long.parseLong(vv); + String unit = ctx.getAttribute(n + "-unit"); + long kbps = speedUtil.convertToKbps(v, unit); + long mbps = speedUtil.convertToMbps(v, unit); + data.put(nn + "-kbps", String.valueOf(kbps)); + data.put(nn + "-mbps", String.valueOf(mbps)); + + log.info("Data param: " + nn + "-kbps: " + kbps); + log.info("Data param: " + nn + "-mbps: " + mbps); + + } catch (Exception e) { + log.warn("Invalid number for " + n + ": " + vv); + } + } + } + } + } + } + return data; } 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; + public void setSpeedUtil(SpeedUtil speedUtil) { + this.speedUtil = speedUtil; } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/AffinityAllocationRule.java deleted file mode 100644 index 0da7acb79..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.alloc; - -import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index a0b698d73..e9f6e0d3f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,10 +24,10 @@ package org.onap.ccsdk.sli.adaptors.ra.alloc; import java.util.ArrayList; import java.util.Collections; import java.util.List; - import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceEntity; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDao; import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDao; import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; @@ -44,112 +44,127 @@ 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; - } + private static final Logger log = LoggerFactory.getLogger(DbAllocationRule.class); + + private ResourceRuleDao resourceRuleDao; + private RangeRuleDao rangeRuleDao; + + @Override + public AllocationRequest buildAllocationRequest(String serviceModel, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + List resourceRuleList = resourceRuleDao.getResourceRules(serviceModel, + resourceTarget.resourceTargetType); + List rangeRuleList = rangeRuleDao.getRangeRules(serviceModel, resourceTarget.resourceTargetType); + + List arlist = new ArrayList<>(); + + for (ResourceRule rr : resourceRuleList) { + if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.resourceName)) { + continue; + } + + boolean matches = ExpressionEvaluator.evalBoolean(rr.serviceExpression, resourceEntity.data); + matches = matches && ExpressionEvaluator.evalBoolean(rr.equipmentExpression, resourceTarget.data); + + if (matches) { + AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, + checkOnly, change); + arlist.add(ar1); + } + } + + for (RangeRule rr : rangeRuleList) { + if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.rangeName)) { + continue; + } + if (resourceRequest.endPointPosition != null + && !resourceRequest.endPointPosition.equals(rr.endPointPosition)) { + continue; + } + + AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, + 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, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + StrUtil.info(log, resourceRule); + + LimitAllocationRequest ar = new LimitAllocationRequest(); + ar.applicationId = resourceRequest.applicationId; + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; + ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; + ar.resourceName = resourceRule.resourceName; + if (resourceRequest.resourceShareGroup != null) { + ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); + } + ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; + ar.missingResourceAction = AllocationAction.Succeed_Allocate; + ar.expiredResourceAction = AllocationAction.Succeed_Allocate; + ar.replace = resourceRequest.replace; + ar.strict = false; + ar.checkLimit = ExpressionEvaluator.evalLong( + change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, resourceTarget.data); + ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, resourceEntity.data); + ar.allocateCount = checkOnly ? 0 : ar.checkCount; + return ar; + } + + private AllocationRequest buildAllocationRequest(RangeRule rangeRule, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + StrUtil.info(log, rangeRule); + + RangeAllocationRequest ar = new RangeAllocationRequest(); + ar.applicationId = resourceRequest.applicationId; + if (resourceRequest.endPointPosition != null) { + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + "::" + + resourceRequest.endPointPosition; + ar.endPointPosition = resourceRequest.endPointPosition; + }else + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; + ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; + ar.resourceName = rangeRule.rangeName; + if (resourceRequest.resourceShareGroup != null) { + ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); + } + ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; + ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, + "Invalid value for requested-numbers"); + if (ar.requestedNumbers != null) { + ar.requestedCount = ar.requestedNumbers.size(); + } + ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); + ar.reverseOrder = resourceRequest.rangeReverseOrder; + ar.missingResourceAction = AllocationAction.Succeed_Allocate; + ar.expiredResourceAction = AllocationAction.Succeed_Allocate; + ar.replace = resourceRequest.replace; + ar.check = true; + ar.allocate = !checkOnly; + ar.checkMin = resourceRequest.rangeMinOverride >= 0 ? resourceRequest.rangeMinOverride : rangeRule.minValue; + ar.checkMax = resourceRequest.rangeMaxOverride >= 0 ? resourceRequest.rangeMaxOverride : 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/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/ServingSiteAllocationRule.java deleted file mode 100644 index b1c4ac449..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.alloc; - -import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; -import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/VrfAllocationRule.java deleted file mode 100644 index 74bfe6634..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.alloc; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; - -import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/AnyVrfPresentCheck.java deleted file mode 100644 index 6f4de2693..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ExcludeVpeCheck.java deleted file mode 100644 index 020c165ab..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/HubWithRgCheck.java deleted file mode 100644 index 22fdeca33..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.rm.data.Resource; -import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/OneMVrfCheck.java deleted file mode 100644 index e54d89cb1..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.rm.data.Resource; -import org.onap.ccsdk.sli.adaptors.util.vrf.VpnParam; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/ProvStatusCheck.java deleted file mode 100644 index f851b53b6..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VlanSpeedCheck.java deleted file mode 100644 index 28e6278de..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/check/VpeLockCheck.java deleted file mode 100644 index 503e1ffc2..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.check; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.comp.EquipmentCheck; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.VpeLockDao; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java index 831cac0c3..0e9737419 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationRule.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,17 +21,10 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; public interface AllocationRule { - AllocationRequest buildAllocationRequest( - String resourceUnionId, - String resourceSetId, - String endPointPosition, - ServiceData serviceData, - EquipmentData equipmentData, - boolean checkOnly, - boolean change); + AllocationRequest buildAllocationRequest(String serviceModel, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocationDefinition.java deleted file mode 100644 index 589fafcd6..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.comp; - -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java index 08713cd76..c6461d496 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,14 +22,14 @@ package org.onap.ccsdk.sli.adaptors.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); + List allocateResources(String serviceModel, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change); + + List getResourcesForEntity(String resourceEntityType, String resourceEntityId, + String resourceEntityVersion); + + ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index db30bf62d..e904035b1 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,226 +22,237 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; - -import org.apache.commons.lang.NotImplementedException; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class EndPointAllocatorImpl implements EndPointAllocator { + @SuppressWarnings("unused") 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; - } + private Map> allocationRuleMap; - 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); - } + @Override + public List allocateResources(String serviceModel, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { - Collections.sort(prefEquipList); + List resourceList = new ArrayList<>(); - equipList = new ArrayList<>(); - for (PrefEquipment prefEquip : prefEquipList) - equipList.add(prefEquip.equipData); + if (allocationRuleMap != null) { + List allocationRuleList = allocationRuleMap.get(serviceModel); + if (allocationRuleList == null) { + allocationRuleList = allocationRuleMap.get("DEFAULT"); } - for (EquipmentData equipData : equipList) { + if (allocationRuleList != null) { 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; - } + for (AllocationRule allocationRule : allocationRuleList) { + AllocationRequest ar = allocationRule.buildAllocationRequest(serviceModel, resourceEntity, + resourceTarget, resourceRequest, checkOnly, change); + if (ar != null) { + AllocationOutcome ao = resourceManager.allocateResources(ar); + List rr = getResourceData(ao); + resourceList.addAll(rr); + + if (ao.status != AllocationStatus.Success) { + allgood = false; } } - if (allgood) { - EndPointData ep = readEndPoint(resourceUnionId, resourceSetId); - epList.add(ep); - break; + } + + if (!allgood) { + String resourceSetId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + + "::" + resourceEntity.resourceEntityVersion; + resourceManager.releaseResourceSet(resourceSetId); } } } - return epList; + return resourceList; } - private EndPointData readEndPoint(String resourceUnionId, String resourceSetId) { - EndPointData ep = new EndPointData(); - ep.resourceUnionId = resourceUnionId; - ep.resourceSetId = resourceSetId; + private List getResourceData(AllocationOutcome ao) { + if (ao instanceof MultiResourceAllocationOutcome) { + List rr = new ArrayList<>(); + for (AllocationOutcome ao1 : ((MultiResourceAllocationOutcome) ao).allocationOutcomeList) { + rr.addAll(getResourceData(ao1)); + } + return rr; + } + + ResourceData rd = new ResourceData(); + rd.data = new HashMap<>(); + + AllocationRequest ar = ao.request; + rd.resourceName = ar.resourceName; + rd.endPointPosition = ar.endPointPosition; + int i1 = ar.assetId.indexOf("::"); + if (i1 > 0) { + rd.resourceTargetType = ar.assetId.substring(0, i1); + rd.resourceTargetId = ar.assetId.substring(i1 + 2); + } else { + rd.resourceTargetType = ""; + rd.resourceTargetId = ar.assetId; + } + rd.status = ao.status.toString(); + + if (ao instanceof LimitAllocationOutcome) { + LimitAllocationOutcome lao = (LimitAllocationOutcome) ao; + rd.data.put("allocated", String.valueOf(lao.allocatedCount)); + rd.data.put("used", String.valueOf(lao.used)); + rd.data.put("limit", String.valueOf(lao.limit)); + rd.data.put("available", String.valueOf(lao.limit - lao.used)); + } else if (ao instanceof RangeAllocationOutcome) { + RangeAllocationOutcome rao = (RangeAllocationOutcome) ao; + rd.data.put("allocated", String.valueOf(StrUtil.listInt(rao.allocated))); + rd.data.put("used", String.valueOf(StrUtil.listInt(rao.used))); + } - int i1 = resourceUnionId.indexOf('/'); - if (i1 > 0) - ep.endPointPosition = resourceUnionId.substring(i1 + 1); + return Collections.singletonList(rd); + } - ep.data = new HashMap<>(); + @Override + public List getResourcesForEntity(String resourceEntityType, String resourceEntityId, + String resourceEntityVersion) { + List rdlist = new ArrayList<>(); + String resourceUnionId = resourceEntityType + "::" + resourceEntityId; 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()); + + // Find the needed allocation item: if resourceEntityVersion is specified, use that, + // otherwise, find the latest allocation item + AllocationItem ai = null; + if (resourceEntityVersion != null) { + String resourceSetId = resourceUnionId + "::" + resourceEntityVersion; + for (AllocationItem ai1 : r.allocationItems) { + if (ai1.resourceSetId.equals(resourceSetId)) { + ai = ai1; + break; } - } - 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); + } + } else { + Date aitime = null; + for (AllocationItem ai1 : r.allocationItems) { + if (ai1.resourceUnionId.equals(resourceUnionId)) { + if (aitime == null || ai1.allocationTime.after(aitime)) { + ai = ai1; + aitime = ai1.allocationTime; + } } + } } - } - return ep; - } + if (ai != null) { + ResourceData rd = new ResourceData(); + rdlist.add(rd); + + rd.resourceName = r.resourceKey.resourceName; + int i1 = r.resourceKey.assetId.indexOf("::"); + if (i1 > 0) { + rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); + rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); + + int i2 = r.resourceKey.assetId.lastIndexOf("::"); + if (i2 > i1) { + rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); + } + } else { + rd.resourceTargetType = ""; + rd.resourceTargetId = r.resourceKey.assetId; + } + + rd.data = new HashMap<>(); + + if (ai instanceof RangeAllocationItem) { + RangeAllocationItem rai = (RangeAllocationItem) ai; - private static class PrefEquipment implements Comparable { + String ss = String.valueOf(rai.used); + ss = ss.substring(1, ss.length() - 1); + rd.data.put("allocated", ss); - public long[] prefNumbers; - public EquipmentData equipData; + } else if (ai instanceof LimitAllocationItem) { + LimitAllocationItem lai = (LimitAllocationItem) ai; - @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; + rd.data.put("allocated", String.valueOf(lai.used)); + } } - return 0; } - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (!(object instanceof PrefEquipment)) { - return false; - } - if (!super.equals(object)) { - return false; - } + return rdlist; + } - PrefEquipment that = (PrefEquipment) object; - if (equipData != null ? !equipData.equals(that.equipData) : that.equipData != null) { - return false; + @Override + public ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName) { + ResourceData rd = new ResourceData();; + String assetId = resourceTargetType + "::" + resourceTargetId; + Resource r = resourceManager.getResource(resourceName, assetId); + if (r != null) { + log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); + + rd.resourceName = r.resourceKey.resourceName; + int i1 = r.resourceKey.assetId.indexOf("::"); + if (i1 > 0) { + rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); + rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); + + int i2 = r.resourceKey.assetId.lastIndexOf("::"); + if (i2 > i1) { + rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); + } + } else { + rd.resourceTargetType = ""; + rd.resourceTargetId = r.resourceKey.assetId; } - if (!Arrays.equals(prefNumbers, that.prefNumbers)) { - return false; - } + rd.data = new HashMap<>(); - return true; - } + if (r instanceof RangeResource) { + RangeResource rr = (RangeResource) r; + + log.info("rr.used: " + rr.used); + String ss = String.valueOf(rr.used); + ss = ss.substring(1, ss.length() - 1); + rd.data.put("allocated", ss); - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (equipData != null ? equipData.hashCode() : 0); - result = 31 * result + Arrays.hashCode(prefNumbers); - return result; + } else if (r instanceof LimitResource) { + LimitResource lr = (LimitResource) r; + + log.info("lr.used: " + lr.used); + rd.data.put("allocated", String.valueOf(lr.used)); + } } - } - public void setEndPointAllocationDefinitionMap( - Map> endPointAllocationDefinitionMap) { - this.endPointAllocationDefinitionMap = endPointAllocationDefinitionMap; + return rd; } public void setResourceManager(ResourceManager resourceManager) { this.resourceManager = resourceManager; } + + public void setAllocationRuleMap(Map> allocationRuleMap) { + this.allocationRuleMap = allocationRuleMap; + } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointData.java deleted file mode 100644 index dc1cb0a63..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EquipmentCheck.java deleted file mode 100644 index 70f2abde8..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.comp; - -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/PreferenceRule.java deleted file mode 100644 index ca8a37191..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.comp; - -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java new file mode 100644 index 000000000..a5881b957 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.Map; + +public class ResourceData { + + public String resourceName; + public String resourceTargetId; + public String resourceTargetValue; + public String resourceTargetType; + public String status; + public Map data; + public String endPointPosition; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceEntity.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceEntity.java new file mode 100644 index 000000000..12fb695b7 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceEntity.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.Map; + +public class ResourceEntity { + + public String resourceEntityId; + public String resourceEntityVersion; + public String resourceEntityType; + public Map data; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java new file mode 100644 index 000000000..b5c24fa71 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +public class ResourceRequest { + + public String resourceName; + public String resourceShareGroup; + public String rangeRequestedNumbers; + public String rangeExcludeNumbers; + public boolean rangeReverseOrder; + public int rangeMinOverride; + public int rangeMaxOverride; + public boolean replace; + public String requestType; + public String serviceModel; + public boolean checkOnly; + public String applicationId; + public String endPointPosition; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceResponse.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceResponse.java new file mode 100644 index 000000000..989333c3e --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceResponse.java @@ -0,0 +1,13 @@ +package org.onap.ccsdk.sli.adaptors.ra.comp; + +public class ResourceResponse { + public String resourceName; + public String endPointPosition; + public String resourceTargetType; + public String resourceTargetId; + public String resourceLimit; + public String resourceAvailable; + public String resourceUsed; + public String resourceAllocated; + public String status; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceTarget.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceTarget.java new file mode 100644 index 000000000..95cec330a --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceTarget.java @@ -0,0 +1,31 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.Map; + +public class ResourceTarget { + + public String resourceTargetId; + public String resourceTargetType; + public Map data; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ServiceData.java deleted file mode 100644 index 238ea1d13..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/comp/EquipmentReader.java deleted file mode 100644 index 03f96e272..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.equip.comp; - -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; - -public interface EquipmentReader { - - List readEquipment(Map equipmentConstraints); -} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDao.java deleted file mode 100644 index f9f7ee3d9..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/ServerDaoImpl.java deleted file mode 100644 index f51dc1402..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDao.java deleted file mode 100644 index 1a86c6f80..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VpePortDaoImpl.java deleted file mode 100644 index 05d2e76d7..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDao.java deleted file mode 100644 index 20cb83ff2..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/dao/VplspePortDaoImpl.java deleted file mode 100644 index 6c3d368b2..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentData.java deleted file mode 100644 index 15342a697..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/equip/data/EquipmentLevel.java deleted file mode 100644 index c77e36851..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.equip.data; - -public enum EquipmentLevel { - Port, Device, Server, Site -} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/AffinityLinkPref.java deleted file mode 100644 index 0e510ac1a..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.pref; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.comp.PreferenceRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/pref/EvcExistingVrfPref.java deleted file mode 100644 index 559f79689..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.pref; - -import org.onap.ccsdk.sli.adaptors.ra.comp.PreferenceRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/AicSiteReader.java deleted file mode 100644 index 1faf254f4..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.reader; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/UplinkCircuitReader.java deleted file mode 100644 index 4943c506b..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.reader; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VnfReader.java deleted file mode 100644 index d5d3d005f..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.reader; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/reader/VpePortReader.java deleted file mode 100644 index 59328f976..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.reader; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.ra.equip.comp.EquipmentReader; -import org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDao; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilder.java deleted file mode 100644 index e4361f1d9..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.comp; - -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/comp/AllocationRequestBuilderImpl.java deleted file mode 100644 index ab0ef3b67..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.comp; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.comp.ServiceData; -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentData; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDao; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDao; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceThreshold; -import org.onap.ccsdk.sli.adaptors.ra.rule.data.ThresholdStatus; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; -import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; -import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; -import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; -import org.onap.ccsdk.sli.adaptors.util.expr.ExpressionEvaluator; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDao.java deleted file mode 100644 index 8adf25113..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxPortSpeedDaoImpl.java deleted file mode 100644 index 481c6f45f..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDao.java deleted file mode 100644 index 607cc0a3b..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/MaxServerSpeedDaoImpl.java deleted file mode 100644 index 445166bb6..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDao.java deleted file mode 100644 index 724ee199c..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.dao; - -public interface ParameterDao { - - String getParameter(String name); -} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ParameterDaoImpl.java deleted file mode 100644 index eb061f99b..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java index ad1498d06..a7fcb61f2 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,11 +22,9 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.dao; import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; public interface RangeRuleDao { - List getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); + List getRangeRules(String serviceModel, String equipLevel); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java index 29a4aea28..825261efd 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +24,6 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,30 +35,28 @@ 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 static final String GET_SQL = "SELECT * FROM RANGE_RULE WHERE service_model = ? AND equipment_level = ?"; private JdbcTemplate jdbcTemplate; @Override - public List getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel) { + public List getRangeRules(String serviceModel, String equipLevel) { List rangeRuleList = - jdbcTemplate.query(GET_SQL, new Object[] { serviceModel, endPointPosition, equipLevel.toString() }, - new RowMapper() { + jdbcTemplate.query(GET_SQL, new Object[] {serviceModel, equipLevel}, 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; - } - }); + @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; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java index 9d879fbe6..54fdcbc20 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,11 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.dao; import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; public interface ResourceRuleDao { - List getResourceRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel); + List getResourceRules(String serviceModel, String equipLevel); - ResourceRule getResourceRule( - String serviceModel, - String endPointPosition, - EquipmentLevel equipLevel, - String resourceName); + ResourceRule getResourceRule(String serviceModel, String endPointPosition, String equipLevel, String resourceName); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java index 0e765f385..451dc57cd 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/ResourceRuleDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,8 +24,6 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.equip.data.EquipmentLevel; import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceRule; import org.onap.ccsdk.sli.adaptors.ra.rule.data.ResourceThreshold; import org.slf4j.Logger; @@ -39,7 +37,7 @@ public class ResourceRuleDaoImpl implements ResourceRuleDao { 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 = ?"; + "SELECT * FROM RESOURCE_RULE WHERE service_model = ? 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 = ?"; @@ -49,34 +47,29 @@ public class ResourceRuleDaoImpl implements ResourceRuleDao { 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); + public List getResourceRules(String serviceModel, String equipLevel) { + List resourceRuleList = + jdbcTemplate.query(GET1_SQL, new Object[] {serviceModel, equipLevel}, resourceRuleRowMapper); - for (ResourceRule rr : resourceRuleList) - rr.thresholdList = jdbcTemplate.query(THRESHOLD_SQL, new Object[] { rr.id }, resourceThresholdRowMapper); + 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, + public ResourceRule getResourceRule(String serviceModel, String endPointPosition, String equipLevel, String resourceName) { List resourceRuleList = jdbcTemplate.query(GET2_SQL, - new Object[] { serviceModel, endPointPosition, equipLevel.toString(), resourceName }, - resourceRuleRowMapper); + new Object[] {serviceModel, endPointPosition, equipLevel, resourceName}, resourceRuleRowMapper); - if (resourceRuleList == null || resourceRuleList.isEmpty()) + if (resourceRuleList == null || resourceRuleList.isEmpty()) { return null; + } ResourceRule rr = resourceRuleList.get(0); - rr.thresholdList = jdbcTemplate.query(THRESHOLD_SQL, new Object[] { rr.id }, resourceThresholdRowMapper); + rr.thresholdList = jdbcTemplate.query(THRESHOLD_SQL, new Object[] {rr.id}, resourceThresholdRowMapper); return rr; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDao.java deleted file mode 100644 index b51cb2e8c..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.rule.dao; - -public interface VpeLockDao { - - String getVpeLock(String vpeName); -} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/VpeLockDaoImpl.java deleted file mode 100644 index 443f50666..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDao.java deleted file mode 100644 index 9f923a5c7..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.service.dao; - -import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/dao/ServiceResourceDaoImpl.java deleted file mode 100644 index b0e2046f8..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.service.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import org.onap.ccsdk.sli.adaptors.ra.service.data.ServiceResource; -import org.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceResource.java deleted file mode 100644 index 519e79194..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/service/data/ServiceStatus.java deleted file mode 100644 index 9fd1b37f8..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.ra.service.data; - -public enum ServiceStatus { - - Active, Pending -} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index bda496a11..3544075fe 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,6 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; - import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; import org.onap.ccsdk.sli.adaptors.lock.comp.ResourceLockedException; import org.onap.ccsdk.sli.adaptors.lock.comp.SynchronizedFunction; @@ -66,22 +65,20 @@ class AllocationFunction extends SynchronizedFunction { private ResourceDao resourceDao; - private String applicationId; private AllocationRequest request; private AllocationOutcome outcome; - private List updateList = new ArrayList(); + private List updateList = new ArrayList<>(); - public AllocationFunction(LockHelper lockHelper, ResourceDao resourceDao, String applicationId, - AllocationRequest request, int lockTimeout) { + public AllocationFunction(LockHelper lockHelper, ResourceDao resourceDao, 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(); + Set lockResourceNames = new HashSet<>(); addLockNames(lockResourceNames, request); return lockResourceNames; } @@ -89,36 +86,47 @@ class AllocationFunction extends SynchronizedFunction { private static void addLockNames(Set lockResourceNames, AllocationRequest request) { if (request instanceof MultiAssetAllocationRequest) { MultiAssetAllocationRequest req = (MultiAssetAllocationRequest) request; - if (req.assetIdList != null) + 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) + if (req.allocationRequestList != null) { + for (AllocationRequest request1 : req.allocationRequestList) { addLockNames(lockResourceNames, request1); - } else if (request.assetId != null) + } + } + } 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) + if (outcome.status == AllocationStatus.Success) { + for (Resource r : updateList) { resourceDao.saveResource(r); + } + } } private AllocationOutcome allocate(AllocationRequest allocationRequest) throws ResourceLockedException { - if (allocationRequest instanceof MultiAssetAllocationRequest) + if (allocationRequest instanceof MultiAssetAllocationRequest) { return allocateMultiAsset((MultiAssetAllocationRequest) allocationRequest); - if (allocationRequest instanceof MultiResourceAllocationRequest) + } + if (allocationRequest instanceof MultiResourceAllocationRequest) { return allocateMultiResource((MultiResourceAllocationRequest) allocationRequest); - if (allocationRequest instanceof LimitAllocationRequest) + } + if (allocationRequest instanceof LimitAllocationRequest) { return allocateLimit((LimitAllocationRequest) allocationRequest); - if (allocationRequest instanceof LabelAllocationRequest) + } + if (allocationRequest instanceof LabelAllocationRequest) { return allocateLabel((LabelAllocationRequest) allocationRequest); - if (allocationRequest instanceof RangeAllocationRequest) + } + if (allocationRequest instanceof RangeAllocationRequest) { return allocateRange((RangeAllocationRequest) allocationRequest); + } return null; } @@ -130,16 +138,18 @@ class AllocationFunction extends SynchronizedFunction { private MultiResourceAllocationOutcome allocateMultiResource(MultiResourceAllocationRequest req) { MultiResourceAllocationOutcome out = new MultiResourceAllocationOutcome(); out.request = req; - out.allocationOutcomeList = new ArrayList(); + out.allocationOutcomeList = new ArrayList<>(); out.status = AllocationStatus.Success; - if (req.allocationRequestList != null) + if (req.allocationRequestList != null) { for (AllocationRequest req1 : req.allocationRequestList) { AllocationOutcome out1 = allocate(req1); out.allocationOutcomeList.add(out1); - if (out1.status != AllocationStatus.Success) + if (out1.status != AllocationStatus.Success) { out.status = AllocationStatus.Failure; + } } + } return out; } @@ -167,11 +177,12 @@ class AllocationFunction extends SynchronizedFunction { if (LimitUtil.checkLimit(l, req)) { out.status = AllocationStatus.Success; if (req.allocateCount > 0) { - out.allocatedCount = LimitUtil.allocateLimit(l, req, applicationId); + out.allocatedCount = LimitUtil.allocateLimit(l, req); updateList.add(l); } - } else + } else { out.status = AllocationStatus.Failure; + } out.used = l.used; out.limit = req.checkLimit; @@ -204,11 +215,12 @@ class AllocationFunction extends SynchronizedFunction { out.status = AllocationStatus.Success; out.currentLabel = l.label; if (req.allocate) { - out.allocatedLabel = LabelUtil.allocateLabel(l, req, applicationId); + out.allocatedLabel = LabelUtil.allocateLabel(l, req); updateList.add(l); } - } else + } else { out.status = AllocationStatus.Failure; + } return out; } @@ -242,18 +254,19 @@ class AllocationFunction extends SynchronizedFunction { if (req.requestedNumbers != null && req.requestedNumbers.size() > 0) { foundNumbers = req.requestedNumbers; out.status = AllocationStatus.Success; - for (int n : foundNumbers) + for (int n : foundNumbers) { if (!RangeUtil.checkRange(rr, req, n)) { out.status = AllocationStatus.Failure; break; } + } } else { - foundNumbers = new TreeSet(); + 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 != null && !uu.isEmpty() && req.replace) { if (uu.size() >= req.requestedCount) { // Just take the first req.requestedCount numbers from uu Iterator i = uu.iterator(); @@ -278,33 +291,48 @@ class AllocationFunction extends SynchronizedFunction { if (RangeUtil.checkRange(rr, req, n)) { foundNumbers.add(n); foundCount++; - } else if (req.sequential) + } 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) + } 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(); + 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; + if (req.reverseOrder) { + for (int n = req.checkMax; foundCount < req.requestedCount && n >= req.checkMin; n--) { + if (RangeUtil.checkRange(rr, req, n)) { + foundNumbers.add(n); + foundCount++; + } else if (req.sequential) { + foundCount = 0; + } + } + } else { + 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; } @@ -313,11 +341,12 @@ class AllocationFunction extends SynchronizedFunction { if (out.status == AllocationStatus.Success) { out.allocated = foundNumbers; if (req.allocate) { - RangeUtil.allocateRange(rr, out.allocated, req, applicationId); + RangeUtil.allocateRange(rr, out.allocated, req); updateList.add(rr); } - } else - out.allocated = new TreeSet(); + } else { + out.allocated = new TreeSet<>(); + } out.used = rr.used; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java index 2884e989f..77d8a6819 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.adaptors.rm.comp; import java.util.HashSet; import java.util.List; import java.util.Set; - import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; @@ -42,7 +41,6 @@ public class ResourceManagerImpl implements ResourceManager { private LockHelper lockHelper; private ResourceDao resourceDao; - private String applicationId; private int lockTimeout = 10 * 60; // Default 10 min public ResourceManagerImpl() { @@ -59,18 +57,20 @@ public class ResourceManagerImpl implements ResourceManager { @Override public List getResourceUnion(String resourceUnionId) { List rlist = resourceDao.getResourceUnion(resourceUnionId); - for (Resource r : rlist) + for (Resource r : rlist) { ResourceUtil.recalculate(r); + } return rlist; } @Override public AllocationOutcome allocateResources(AllocationRequest allocationRequest) { - if (allocationRequest == null) + if (allocationRequest == null) { throw new IllegalArgumentException("allocateResources called with null argument"); + } AllocationFunction allocationFunction = - new AllocationFunction(lockHelper, resourceDao, applicationId, allocationRequest, lockTimeout); + new AllocationFunction(lockHelper, resourceDao, allocationRequest, lockTimeout); allocationFunction.exec(); AllocationOutcome allocationOutcome = allocationFunction.getAllocationOutcome(); @@ -82,8 +82,9 @@ public class ResourceManagerImpl implements ResourceManager { @Override public void releaseResourceSet(String resourceSetId) { List resourceList = resourceDao.getResourceSet(resourceSetId); - if (resourceList == null || resourceList.isEmpty()) + if (resourceList == null || resourceList.isEmpty()) { return; + } Set lockNames = getLockNames(resourceList); ReleaseFunction releaseFunction = @@ -94,8 +95,9 @@ public class ResourceManagerImpl implements ResourceManager { @Override public void releaseResourceUnion(String resourceUnionId) { List resourceList = resourceDao.getResourceUnion(resourceUnionId); - if (resourceList == null || resourceList.isEmpty()) + if (resourceList == null || resourceList.isEmpty()) { return; + } Set lockNames = getLockNames(resourceList); ReleaseFunction releaseFunction = @@ -104,9 +106,10 @@ public class ResourceManagerImpl implements ResourceManager { } private Set getLockNames(List resourceList) { - Set lockNames = new HashSet(); - for (Resource r : resourceList) + Set lockNames = new HashSet<>(); + for (Resource r : resourceList) { lockNames.add(r.resourceKey.assetId); + } return lockNames; } @@ -118,10 +121,6 @@ public class ResourceManagerImpl implements ResourceManager { 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/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java index 25a4fbba9..29b493683 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/AllocationRequest.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,6 +25,7 @@ import java.util.Set; public class AllocationRequest { + public String applicationId = null; public String resourceUnionId = null; public String resourceSetId = null; public Set resourceShareGroupList = null; @@ -32,4 +33,5 @@ public class AllocationRequest { public String assetId = null; public AllocationAction missingResourceAction = AllocationAction.Succeed_Allocate; public AllocationAction expiredResourceAction = AllocationAction.Succeed_Allocate; + public String endPointPosition = null; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java index b42960d9d..9581244b3 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,6 +31,8 @@ public class RangeAllocationRequest extends AllocationRequest { public boolean allocate = false; public boolean replace = false; public SortedSet requestedNumbers = null; + public SortedSet excludeNumbers = null; public int requestedCount = 1; public boolean sequential = false; + public boolean reverseOrder = false; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java index 7cc541dd7..a67a50b31 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtil.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,6 @@ package org.onap.ccsdk.sli.adaptors.rm.util; import java.util.ArrayList; import java.util.Date; - import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationRequest; @@ -37,16 +36,18 @@ public class LabelUtil { 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)) + 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) + public static String allocateLabel(LabelResource l, LabelAllocationRequest req) { + if (!req.allocate) { return null; + } LabelAllocationItem lai = (LabelAllocationItem) ResourceUtil.getAllocationItem(l, req.resourceSetId); if (lai == null) { @@ -55,13 +56,14 @@ public class LabelUtil { lai.resourceKey = new ResourceKey(); lai.resourceKey.assetId = req.assetId; lai.resourceKey.resourceName = req.resourceName; - lai.applicationId = applicationId; + lai.applicationId = req.applicationId; lai.resourceSetId = req.resourceSetId; lai.resourceUnionId = req.resourceUnionId; lai.resourceShareGroupList = req.resourceShareGroupList; - if (l.allocationItems == null) - l.allocationItems = new ArrayList(); + if (l.allocationItems == null) { + l.allocationItems = new ArrayList<>(); + } l.allocationItems.add(lai); } @@ -76,17 +78,19 @@ public class LabelUtil { public static void recalculate(LabelResource l) { l.label = null; l.referenceCount = 0; - if (l.allocationItems != null) + if (l.allocationItems != null) { for (AllocationItem ai : l.allocationItems) { LabelAllocationItem lai = (LabelAllocationItem) ai; if (lai.label != null) { l.referenceCount++; - if (l.label == null) + if (l.label == null) { l.label = lai.label; - else if (!l.label.equals(lai.label)) + } else if (!l.label.equals(lai.label)) { l.label = "__BLOCKED__"; + } } } + } } private static boolean eq(Object o1, Object o2) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java index 8f284b595..2e36c9661 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/LimitUtil.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; - import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; @@ -42,26 +41,30 @@ public class LimitUtil { private static final Logger log = LoggerFactory.getLogger(LimitUtil.class); public static boolean checkLimit(LimitResource l, LimitAllocationRequest req) { - if (req.checkCount <= 0) + 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) + if (lai != null) { currentUsage = lai.used; + } } - if (!req.replace) + 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) + if (wouldUse <= used && !req.strict) { return true; + } return wouldUse <= req.checkLimit; } @@ -72,8 +75,9 @@ public class LimitUtil { String resourceUnionId, Set resourceShareGroupList) { if ((l.allocationItems == null || l.allocationItems.isEmpty()) && - (resourceUnionId == null || resourceUnionId.length() == 0)) + (resourceUnionId == null || resourceUnionId.length() == 0)) { return 0; + } long t1 = System.currentTimeMillis(); boolean logit = false; @@ -127,48 +131,54 @@ public class LimitUtil { // 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) + 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) + if (regularChange) { regularChangeCount++; + } } + } if (checkCount > 0 && resourceUnionId != null) { boolean regularChange = addLimitUsage(limitUsageMap, resourceUnionId, resourceShareGroupList, checkCount); - if (regularChange) + if (regularChange) { regularChangeCount++; + } } // Generate all the combinations, containing one LimitUsage object for each firstResourceUnion int significantChangeCount = 0; - List> allCombinations = new ArrayList>(); + List> allCombinations = new ArrayList<>(); for (String firstResourceUnion : limitUsageMap.keySet()) { List limitUsageList = limitUsageMap.get(firstResourceUnion); - if (limitUsageList.size() > 1) + if (limitUsageList.size() > 1) { significantChangeCount++; + } if (allCombinations.isEmpty()) { for (LimitUsage limitUsage : limitUsageList) { - List newCombination = new ArrayList(); + 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) + 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) + List> newAllCombinations = new ArrayList<>(); + for (List combination : allCombinations) { for (LimitUsage limitUsage : limitUsageList) { - List newCombination = new ArrayList(combination); + List newCombination = new ArrayList<>(combination); newCombination.add(limitUsage); newAllCombinations.add(newCombination); } + } allCombinations = newAllCombinations; } } @@ -178,8 +188,9 @@ public class LimitUtil { long maxUsage = 0; for (List combination : allCombinations) { long usage = calculateUsage(combination); - if (usage > maxUsage) + if (usage > maxUsage) { maxUsage = usage; + } } long t2 = System.currentTimeMillis(); @@ -202,7 +213,7 @@ public class LimitUtil { long used) { List limitUsageList = limitUsageMap.get(resourceUnionId); if (limitUsageList == null) { - limitUsageList = new ArrayList(); + 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 @@ -221,8 +232,9 @@ public class LimitUtil { } } if (limitUsage != null) { - if (limitUsage.usage < used) + if (limitUsage.usage < used) { limitUsage.usage = used; + } return true; } @@ -243,14 +255,18 @@ public class LimitUtil { } private static boolean hasCommonSharedResource(LimitUsage limitUsage1, LimitUsage limitUsage2) { - if (limitUsage1.resourceShareGroupList == null || limitUsage1.resourceShareGroupList.isEmpty()) + if (limitUsage1.resourceShareGroupList == null || limitUsage1.resourceShareGroupList.isEmpty()) { return false; - if (limitUsage2.resourceShareGroupList == null || limitUsage2.resourceShareGroupList.isEmpty()) + } + if (limitUsage2.resourceShareGroupList == null || limitUsage2.resourceShareGroupList.isEmpty()) { return false; + } - for (String resourceUnion : limitUsage1.resourceShareGroupList) - if (limitUsage2.resourceShareGroupList.contains(resourceUnion)) + for (String resourceUnion : limitUsage1.resourceShareGroupList) { + if (limitUsage2.resourceShareGroupList.contains(resourceUnion)) { return true; + } + } return false; } @@ -260,7 +276,7 @@ public class LimitUtil { // 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>(); + 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. @@ -279,7 +295,7 @@ public class LimitUtil { } if (!found) { // Start a new set - List newSharedSet = new ArrayList(); + List newSharedSet = new ArrayList<>(); newSharedSet.add(limitUsage); sharedSets.add(newSharedSet); } @@ -288,18 +304,21 @@ public class LimitUtil { long sum = 0; for (List sharedSet : sharedSets) { float max = 0; - for (LimitUsage limitUsage : sharedSet) - if (max < limitUsage.usage) + 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) + public static long allocateLimit(LimitResource l, LimitAllocationRequest req) { + if (req.allocateCount <= 0) { return 0; + } long uu = l.used; LimitAllocationItem lai = (LimitAllocationItem) ResourceUtil.getAllocationItem(l, req.resourceSetId); @@ -309,17 +328,19 @@ public class LimitUtil { lai.resourceKey = new ResourceKey(); lai.resourceKey.assetId = req.assetId; lai.resourceKey.resourceName = req.resourceName; - lai.applicationId = applicationId; + lai.applicationId = req.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(); + if (l.allocationItems == null) { + l.allocationItems = new ArrayList<>(); + } l.allocationItems.add(lai); - } else + } else { lai.used = req.replace ? req.allocateCount : lai.used + req.allocateCount; + } lai.allocationTime = new Date(); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java index f01d35784..04f6e8c56 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,9 +23,9 @@ package org.onap.ccsdk.sli.adaptors.rm.util; import java.util.ArrayList; import java.util.Date; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; - import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; @@ -36,51 +36,62 @@ import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; public class RangeUtil { public static void recalculate(RangeResource r) { - r.used = new TreeSet(); - if (r.allocationItems != null) + r.used = new TreeSet<>(); + if (r.allocationItems != null) { for (AllocationItem ai : r.allocationItems) { RangeAllocationItem rai = (RangeAllocationItem) ai; - if (rai.used != null) + 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) + if (num < req.checkMin || num > req.checkMax) { + return false; + } + + if (req.excludeNumbers != null && req.excludeNumbers.contains(num)) { return false; + } - if (r.allocationItems != null) + 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)) + if (!eq(req.resourceUnionId, rai.resourceUnionId) && rai.used != null && rai.used.contains(num)) { + if (!overlap(rai.resourceShareGroupList, req.resourceShareGroupList)) { + return false; + } + } + if (!req.replace && eq(req.resourceSetId, rai.resourceSetId) && 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) + 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) + 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) + public static void allocateRange(RangeResource rr, SortedSet requestedNumbers, + RangeAllocationRequest req) { + if (!req.allocate) { return; + } RangeAllocationItem rai = (RangeAllocationItem) ResourceUtil.getAllocationItem(rr, req.resourceSetId); if (rai == null) { @@ -89,22 +100,40 @@ public class RangeUtil { rai.resourceKey = new ResourceKey(); rai.resourceKey.assetId = req.assetId; rai.resourceKey.resourceName = req.resourceName; - rai.applicationId = applicationId; + rai.applicationId = req.applicationId; rai.resourceSetId = req.resourceSetId; rai.resourceUnionId = req.resourceUnionId; rai.resourceShareGroupList = req.resourceShareGroupList; rai.used = requestedNumbers; - if (rr.allocationItems == null) - rr.allocationItems = new ArrayList(); + if (rr.allocationItems == null) { + rr.allocationItems = new ArrayList<>(); + } rr.allocationItems.add(rai); - } else if (req.replace) + } else if (req.replace) { rai.used = requestedNumbers; - else + } else { rai.used.addAll(requestedNumbers); + } rai.allocationTime = new Date(); recalculate(rr); } + + private static boolean eq(Object o1, Object o2) { + return o1 == null ? o2 == null : o1.equals(o2); + } + + private static boolean overlap(Set s1, Set s2) { + if (s1 == null || s1.isEmpty() || s2 == null || s2.isEmpty()) { + return false; + } + for (String ss1 : s1) { + if (s2.contains(ss1)) { + return true; + } + } + return false; + } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java index ae7c21575..3db63804b 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/ResourceUtil.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,26 +24,34 @@ package org.onap.ccsdk.sli.adaptors.rm.util; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; import org.onap.ccsdk.sli.adaptors.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)) + 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) + if (r == null) { return; + } - if (r.resourceType == ResourceType.Limit) + if (r.resourceType == ResourceType.Limit) { LimitUtil.recalculate((LimitResource) r); - else if (r.resourceType == ResourceType.Label) + } else if (r.resourceType == ResourceType.Range) { + RangeUtil.recalculate((RangeResource) r); + } else if (r.resourceType == ResourceType.Label) { LabelUtil.recalculate((LabelResource) r); + } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java index 0e46868bc..3fa3952f2 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/CachedDataSourceWrap.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,9 +25,7 @@ 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; @@ -36,6 +34,7 @@ public class CachedDataSourceWrap implements DataSource { private static final Logger log = LoggerFactory.getLogger(CachedDataSourceWrap.class); private ThreadLocal con = new ThreadLocal<>(); + private ThreadLocal autoCommit = new ThreadLocal<>(); private DataSource dataSource; @@ -78,12 +77,17 @@ public class CachedDataSourceWrap implements DataSource { public Connection getConnection() throws SQLException { if (con.get() == null) { Connection c = dataSource.getConnection(); + ConnectionWrap cc = new ConnectionWrap(c); con.set(cc); + autoCommit.set(c.getAutoCommit()); + c.setAutoCommit(false); + log.info("Got new DB connection: " + c); - } else + } else { log.info("Using thread DB connection: " + con.get().getCon()); + } return con.get(); } @@ -92,12 +96,17 @@ public class CachedDataSourceWrap implements DataSource { 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); + autoCommit.set(c.getAutoCommit()); + c.setAutoCommit(false); + log.info("Got new DB connection: " + c); - } else + } else { log.info("Using thread DB connection: " + con.get().getCon()); + } return con.get(); } @@ -105,6 +114,7 @@ public class CachedDataSourceWrap implements DataSource { public void releaseConnection() { if (con.get() != null) { try { + con.get().setAutoCommit(autoCommit.get()); con.get().realClose(); log.info("DB Connection released: " + con.get().getCon()); @@ -116,6 +126,30 @@ public class CachedDataSourceWrap implements DataSource { } } + public void commit() { + if (con.get() != null) { + try { + con.get().commit(); + + log.info("DB Connection committed: " + con.get().getCon()); + } catch (Exception e) { + log.warn("Failed to commit DB connection", e); + } + } + } + + public void rollback() { + if (con.get() != null) { + try { + con.get().rollback(); + + log.info("DB Connection rolled back: " + con.get().getCon()); + } catch (Exception e) { + log.warn("Failed to roll back DB connection", e); + } + } + } + public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java index 037b78b77..8ba454bf4 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,36 +25,42 @@ import java.util.Map; public class ExpressionEvaluator { - public static long evalLong(String expr, Map vars) { + public static long evalLong(String expr, Map vars) { return (long) evalFloat(expr, vars); } - public static float evalFloat(String expr, Map vars) { + public static float evalFloat(String expr, Map vars) { expr = expr.trim(); int sl = expr.length(); - if (sl == 0) + if (sl == 0) { throw new IllegalArgumentException("Cannot interpret empty string."); + } // Remove parentheses if any - if (expr.charAt(0) == '(' && expr.charAt(sl - 1) == ')') + 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) + if (sss != null) { return evalFloat(sss[0], vars) - evalFloat(sss[1], vars); + } sss = findOperator(expr, "+", true); - if (sss != null) + if (sss != null) { return evalFloat(sss[0], vars) + evalFloat(sss[1], vars); + } sss = findOperator(expr, "/", true); - if (sss != null) + if (sss != null) { return evalFloat(sss[0], vars) / evalFloat(sss[1], vars); + } sss = findOperator(expr, "*", true); - if (sss != null) + if (sss != null) { return evalFloat(sss[0], vars) * evalFloat(sss[1], vars); + } // Check if expr is a number try { @@ -63,74 +69,122 @@ public class ExpressionEvaluator { } // 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; + String v = vars.get(expr); + try { + return Float.valueOf(v); + } catch (Exception e) { } return 0; } - public static boolean evalBoolean(String expr, Map vars) { + public static String evalString(String expr, Map vars) { expr = expr.trim(); int sl = expr.length(); - if (sl == 0) + if (sl == 0) { throw new IllegalArgumentException("Cannot interpret empty string."); + } + + // Remove parentheses if any + if (expr.charAt(0) == '(' && expr.charAt(sl - 1) == ')') { + return evalString(expr.substring(1, sl - 1), vars); + } + + // Look for operators in the order of least priority + String[] sss = findOperator(expr, "+", true); + if (sss != null) { + return evalString(sss[0], vars) + evalString(sss[1], vars); + } + + // Check if expr is a number + try { + return Float.valueOf(expr).toString(); + } catch (Exception e) { + } + + // Check for quotes + if (expr.charAt(0) == '"' && expr.charAt(sl - 1) == '"') { + return expr.substring(1, sl - 1); + } + if (expr.charAt(0) == '\'' && expr.charAt(sl - 1) == '\'') { + return expr.substring(1, sl - 1); + } + + // Must be a variable + String v = vars.get(expr); + return v != null ? v : ""; + } - if (expr.equalsIgnoreCase("true")) + 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")) + if (expr.equalsIgnoreCase("false")) { return false; + } // Remove parentheses if any - if (expr.charAt(0) == '(' && expr.charAt(sl - 1) == ')') + 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) + if (sss != null) { return evalBoolean(sss[0], vars) || evalBoolean(sss[1], vars); + } sss = findOperator(expr, "and", true); - if (sss != null) + if (sss != null) { return evalBoolean(sss[0], vars) && evalBoolean(sss[1], vars); + } sss = findOperator(expr, "not", true); - if (sss != null) + if (sss != null) { return !evalBoolean(sss[1], vars); + } sss = findOperator(expr, "!=", false); - if (sss == null) + if (sss == null) { sss = findOperator(expr, "<>", false); - if (sss != null) - return evalLong(sss[0], vars) != evalLong(sss[1], vars); + } + if (sss != null) { + return !evalString(sss[0], vars).equals(evalString(sss[1], vars)); + } sss = findOperator(expr, "==", false); - if (sss == null) + if (sss == null) { sss = findOperator(expr, "=", false); - if (sss != null) - return evalLong(sss[0], vars) == evalLong(sss[1], vars); + } + if (sss != null) { + return evalString(sss[0], vars).equals(evalString(sss[1], vars)); + } sss = findOperator(expr, ">=", false); - if (sss != null) + if (sss != null) { return evalLong(sss[0], vars) >= evalLong(sss[1], vars); + } sss = findOperator(expr, ">", false); - if (sss != null) + if (sss != null) { return evalLong(sss[0], vars) > evalLong(sss[1], vars); + } sss = findOperator(expr, "<=", false); - if (sss != null) + if (sss != null) { return evalLong(sss[0], vars) <= evalLong(sss[1], vars); + } sss = findOperator(expr, "<", false); - if (sss != null) + if (sss != null) { return evalLong(sss[0], vars) < evalLong(sss[1], vars); + } throw new IllegalArgumentException("Cannot interpret '" + expr + "': Invalid expression."); } @@ -142,26 +196,29 @@ public class ExpressionEvaluator { int pcount = 0, qcount = 0; for (int i = 0; i < sl; i++) { char c = s.charAt(i); - if (c == '(' && qcount == 0) + if (c == '(' && qcount == 0) { pcount++; - else if (c == ')' && qcount == 0) { + } else if (c == ')' && qcount == 0) { pcount--; - if (pcount < 0) + if (pcount < 0) { throw new IllegalArgumentException("Cannot interpret '" + s + "': Parentheses do not match."); - } else if (c == '\'') + } + } else if (c == '\'') { qcount = (qcount + 1) % 2; - else if (i <= sl - opl && pcount == 0 && qcount == 0) { + } 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) + if (i > 0) { chbefore = s.charAt(i - 1); + } char chafter = '\0'; - if (i < sl - opl) + if (i < sl - opl) { chafter = s.charAt(i + opl); + } found = delimiters.indexOf(chbefore) >= 0 && delimiters.indexOf(chafter) >= 0; } if (found) { @@ -174,23 +231,29 @@ public class ExpressionEvaluator { } } } - if (pcount > 0) + if (pcount > 0) { throw new IllegalArgumentException("Cannot interpret '" + s + "': Parentheses do not match."); - if (qcount > 0) + } + if (qcount > 0) { throw new IllegalArgumentException("Cannot interpret '" + s + "': No closing '."); + } return null; } + @SuppressWarnings("unused") private static Object parseObject(String s) { s = s.trim(); int sl = s.length(); - if (sl == 0) + if (sl == 0) { throw new IllegalArgumentException("Cannot interpret empty string."); - if (s.equalsIgnoreCase("null")) + } + if (s.equalsIgnoreCase("null")) { return null; + } if (s.charAt(0) == '\'') { - if (sl < 2 || s.charAt(sl - 1) != '\'') + 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 diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java index 1aad8f501..0d1359cf3 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/speed/SpeedUtil.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,12 +26,28 @@ public class SpeedUtil { private long unitFactor = 1000; public long convertToKbps(long maxSpeed, String unit) { - if (unit.equalsIgnoreCase("kbps")) + if (unit.equalsIgnoreCase("kbps")) { return maxSpeed; - if (unit.equalsIgnoreCase("Mbps")) + } + if (unit.equalsIgnoreCase("Mbps")) { return maxSpeed * unitFactor; - if (unit.equalsIgnoreCase("Gbps")) + } + if (unit.equalsIgnoreCase("Gbps")) { return maxSpeed * unitFactor * unitFactor; + } + return 0; + } + + public long convertToMbps(long maxSpeed, String unit) { + if (unit.equalsIgnoreCase("kbps")) { + return maxSpeed / unitFactor; + } + if (unit.equalsIgnoreCase("Mbps")) { + return maxSpeed; + } + if (unit.equalsIgnoreCase("Gbps")) { + return maxSpeed * unitFactor; + } return 0; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VpnParam.java deleted file mode 100644 index 11e64ae1a..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/vrf/VrfUtil.java deleted file mode 100644 index 74025f15b..000000000 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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/org/opendaylight/blueprint/resource-assignment-blueprint.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml index c2298af7d..11c284d64 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml @@ -26,4 +26,6 @@ + + diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml index 6e11c664c..3fba3c781 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml @@ -77,7 +77,6 @@ - @@ -105,29 +104,17 @@ - + - - - - - - - - - - + - - - 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 72dbcf87c..000000000 --- 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.onap.ccsdk.sli.adaptors.dbtype = jdbc -org.onap.ccsdk.sli.adaptors.jdbc.url = jdbc:mysql://dbhost:3306/sdnctl -org.onap.ccsdk.sli.adaptors.jdbc.database = sdnctl -org.onap.ccsdk.sli.adaptors.jdbc.user = sdnctl -org.onap.ccsdk.sli.adaptors.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 f69b6bcd8..000000000 --- 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 bc7babaf1..000000000 --- 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 e3f18390b..000000000 --- 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/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index ba57f626a..bba8e2b94 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -3,14 +3,14 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,8 +21,6 @@ package jtest.org.onap.ccsdk.sli.adaptors.ra; -import java.util.Date; - import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; @@ -30,231 +28,29 @@ 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[] 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 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) + if (resource == null) { resource = testDb.table("RESOURCE", "resource_id", RESOURCE_COLUMNS); - if (allocationItem == null) + } + 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/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java deleted file mode 100644 index 4dee2d61e..000000000 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestIsAvailable.java +++ /dev/null @@ -1,405 +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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -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 - 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 test012() throws Exception { - String t = "012"; - 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/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java new file mode 100644 index 000000000..6564dc3d1 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java @@ -0,0 +1,59 @@ +package jtest.org.onap.ccsdk.sli.adaptors.ra; + +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; +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 TestLockHelper { + + private static final Logger log = LoggerFactory.getLogger(TestLockHelper.class); + + @Autowired + private LockHelper lockHelper; + + @Test + public void test1() throws Exception { + LockThread t1 = new LockThread("req1"); + LockThread t2 = new LockThread("req2"); + LockThread t3 = new LockThread("req3"); + + t1.start(); + t2.start(); + t3.start(); + + t1.join(); + t2.join(); + t3.join(); + } + + private class LockThread extends Thread { + private String requester; + + public LockThread(String requester) { + this.requester = requester; + } + + @Override + public void run() { + lockHelper.lock("resource1", requester, 20); + + try { + Thread.sleep(500); + } catch (InterruptedException e) { + log.warn("Thread interrupted: " + e.getMessage(), e); + } + + lockHelper.unlock("resource1", false); + } + } +} diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQuery.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQuery.java deleted file mode 100644 index 435f4aaa5..000000000 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -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/onap/ccsdk/sli/adaptors/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java deleted file mode 100644 index 621022545..000000000 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -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/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index a4ee52547..c42007510 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -1,51 +1,58 @@ -/*- - * ============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.onap.ccsdk.sli.adaptors.ra; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.junit.Assert; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceEntity; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceResponse; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:test-context.xml" }) +@ContextConfiguration(locations = {"classpath:test-context.xml"}) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestReserve { private static final Logger log = LoggerFactory.getLogger(TestReserve.class); + private JdbcTemplate jdbcTemplate; + + 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"}; + + + @Autowired + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + @Autowired(required = true) private ResourceAllocator resourceAllocator; + /* + * @Autowired(required = true) private ResourceAllocatorApi resourceAllocatorApi; + */ + @Autowired(required = true) private DataSetup dataSetup; @@ -55,627 +62,576 @@ public class TestReserve { log.info("============== reserve " + t + " ================================"); log.info("=== Test successful response - new start - all resources available"); - String service1 = "reserve" + t + "/service1"; + // 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")); + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = + new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - 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"); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps"); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + ctx.setAttribute("ra-input.reservation-target-data.vnf-type", "VPE"); + ctx.setAttribute("ra-input.reservation-target-data.vpe-name", "mdt300vpe54"); + ctx.setAttribute("ra-input.reservation-target-id", "mdt300vpe54"); + ctx.setAttribute("ra-input.reservation-target-type", "VNF"); - 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")); + ctx.setAttribute("ra-input.reservation-target-data.max-vpe-bandwidth-mbps", "5000"); - 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"; + resource.print(); + allocationItem.print(); - 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)); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps"); - 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"); + ctx.setAttribute("ra-input.reservation-target-data.service-speed", "100"); + ctx.setAttribute("ra-input.reservation-target-data.service-speed-unit", "Mbps"); + ctx.setAttribute("ra-input.reservation-target-id", "ICORESITEID-123456"); + ctx.setAttribute("ra-input.reservation-target-type", "Port"); - 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")); + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); 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"); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed", "100"); + ctx.setAttribute("ra-input.reservation-entity-data.service-speed-unit", "Mbps"); - String service1 = "reserve" + t + "/service1"; + ctx.setAttribute("ra-input.reservation-target-data.vnf-type", "VPE"); + ctx.setAttribute("ra-input.reservation-target-data.vpe-name", "mdt300vpe54"); + ctx.setAttribute("ra-input.reservation-target-id", "mdt300vpe54"); + ctx.setAttribute("ra-input.reservation-target-type", "AffinityLink"); - 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")); + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); 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"; + resource.print(); + allocationItem.print(); - 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"); + /* Query Using ReservationEntityId using ServiceLogicContext */ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456"); + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); - 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); + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); 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); + /* Query Using ReservationTargetId using ServiceLogicContext */ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.reservation-target-id", "ICORESITEID-123456"); + ctx.setAttribute("ra-input.reservation-target-type", "Port"); + ctx.setAttribute("ra-input.resource-name", "Bandwidth"); + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); 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"); + log.info("======================== Query Using ResourceEntity=============================="); + /* Query Using ResourceEntity bean */ + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "ICOREPVCID-123456"; + sd.resourceEntityType = "SI"; - 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"); + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "ADIG"; + rr.resourceName = "cust-vlan-id"; + rr.requestType = "New"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; - dataSetup.setupService(service1, "Active", 2, 1000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); - dataSetup.setupService(service1, "Pending", 3, 5000, "mtanjrsv126", "mtsnj303vr1", "MTSNJA4LCP1/Server1"); + List rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, null, rsList); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Active", 2, 1000)); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 3, 5000)); + rsList.forEach(r -> { + StrUtil.info(log, r); + }); - 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"); + log.info("======================== release Using ResourceEntity=============================="); + rsList = new ArrayList<>(); + AllocationStatus status = resourceAllocator.release(sd); + Assert.assertTrue(status == AllocationStatus.Success); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - log.info("Result: " + st); + log.info("======================== Query Using ResourceEntity=============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, null, rsList); - 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"; + rsList.forEach(r -> { + StrUtil.info(log, r); + }); - 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"; + public void test002() throws Exception { + String t = "002"; 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"); + log.info("=== Test successful response - new start - all resources available"); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + Map data = new HashMap<>(); + data.put("service-speed", "100"); + data.put("service-speed-unit", "Mbps"); - log.info("Result: " + st); - for (String key : ctx.getAttributeKeySet()) - if (key.startsWith("tmp.resource-allocator-output")) - log.info(" " + key + ": " + ctx.getAttribute(key)); + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "ICOREPVCID-123456"; + sd.resourceEntityType = "SI"; + sd.data = data; - Assert.assertTrue(st == QueryStatus.SUCCESS); - Assert.assertTrue(dataSetup.serviceCorrectInDb("mtanjrsv126", "MTSNJA4LCP1", service1, "Pending", 1, 1605000)); - } + data = new HashMap<>(); + data.put("vnf-type", "VPE"); + data.put("vpe-name", "mdt300vpe54"); + data.put("max-vpe-bandwidth-mbps", "5000"); - @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."); + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "mdt300vpe54"; + rt.resourceTargetType = "VNF"; + rt.data = data; - String service1 = "reserve" + t + "/service1"; + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "ADIG"; + // rr.resourceName = "cust-vlan-id"; + rr.requestType = "New"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; - 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"); + List rsList = new ArrayList<>(); - for (int i = 1; i <= 10; i++) - dataSetup.setupService("reserve" + t + "/existing-service" + i, "Active", 2, 100000, "mtanjrsv126", - "mtsnj303vr1", "MTSNJA4LCP1/Server1"); + resourceAllocator.reserve(sd, rt, rr, rsList); - 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"); + rsList.forEach(r -> { + StrUtil.info(log, r); + }); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + log.info("======================== Query + t =============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, rr, rsList); - 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")); + rsList.forEach(r -> { + StrUtil.info(log, r); + }); - 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)); - } + public void test003() throws Exception { + String t = "003"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Cust"; + //rr.requestType = "New"; + //rr.rangeMaxOverride = 5; + //rr.rangeMinOverride = 5; + + List rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + + + + @Test + public void test004() throws Exception { + String t = "004"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + List rrs = new ArrayList(); + ResourceRequest rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Cust"; + rrs.add(rr); + + rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Core1"; + rrs.add(rr); + + rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Core2"; + rrs.add(rr); + + + + List rsList = new ArrayList(); + //resourceAllocator.reserve(sd, rt, rrs, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + + @Test + public void test005() throws Exception { + String t = "005"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + //String service1 = "reserve" + t + "/service1"; + + dataSetup.cleanup(); + + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); + + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Cust"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "cust-vlan-id"); + + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + + + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core2"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + ctx.setAttribute("ra-input.replace", "false"); + + + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + + /*Query Using ReservationEntityId using ServiceLogicContext*/ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); + + + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + + /*Query Using ReservationTargetId using ServiceLogicContext*/ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + log.info("======================== Query Using ResourceEntity=============================="); + /*Query Using ResourceEntity bean*/ + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE-Core1"; + + + ResourceRequest rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL-1"; + rr.resourceName = "vlan-id-inner"; + rr.requestType = "New"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + List rsList = new ArrayList(); + resourceAllocator.query(sd, null, null, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + /*log.info("======================== release Using ResourceEntity=============================="); + rsList = new ArrayList(); + AllocationStatus status = resourceAllocator.release(sd); + Assert.assertTrue(status == AllocationStatus.Success); + + + log.info("======================== Query Using ResourceEntity=============================="); + rsList = new ArrayList(); + resourceAllocator.query(sd, null, null, rsList); + + + rsList.forEach(r -> { + StrUtil.info(log, r); + });*/ + + } + + + + @Test + public void test006() throws Exception { + String t = "006"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE-Cust"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL-1"; + rr.resourceName = "cust-vlan-id"; + + + List rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + @Test + public void test007() throws Exception { + String t = "007"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + dataSetup.cleanup(); + + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); + + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + //rr.resourceName = "vlan-id-outer"; + rr.endPointPosition="VPE-Cust"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + List rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + //VPE-Core1 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + //rr.resourceName = "vlan-id-filter"; + rr.endPointPosition="VPE-Core1"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + + //VPE-Core2 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + //rr.resourceName = "vlan-id-filter"; + rr.endPointPosition="VPE-Core2"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + + //VPE-Core3 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr= new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + //rr.resourceName = "vlan-id-filter"; + rr.endPointPosition="VPE-Core3"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + resource.print(); + allocationItem.print(); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE"); + + + QueryStatus st = resourceAllocator.release("NetworkCapacity", "gblond2003me6", ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + } } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve2.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve2.java deleted file mode 100644 index 7ae169762..000000000 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -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/util/org/onap/ccsdk/sli/adaptors/ra/TestDb.java b/resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestDb.java new file mode 100644 index 000000000..6446240dc --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestDb.java @@ -0,0 +1,37 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.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/onap/ccsdk/sli/adaptors/ra/TestTable.java b/resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestTable.java new file mode 100644 index 000000000..e2541f393 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/util/org/onap/ccsdk/sli/adaptors/ra/TestTable.java @@ -0,0 +1,135 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra; + +import java.sql.ResultSetMetaData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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; + + private static final Logger log = LoggerFactory.getLogger(TestTable.class); + + public TestTable(JdbcTemplate jdbcTemplate, String tableName, String idName, String... columnList) { + this.jdbcTemplate = jdbcTemplate; + this.tableName = tableName; + this.idName = idName; + this.columnList = columnList; + createInsertSql(); + } + + public TestTable(JdbcTemplate jdbcTemplate, String tableName) { + this.jdbcTemplate = jdbcTemplate; + this.tableName = tableName; + } + + 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 void update(String updateSql, Object... values) { + jdbcTemplate.update(updateSql, 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 Object getColumn(String columnName, String where) { + String selectSql = "SELECT " + columnName + " FROM " + tableName + " WHERE " + where; + SqlRowSet rs = jdbcTemplate.queryForRowSet(selectSql); + if (rs.first()) + return rs.getObject(columnName); + 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); + } + + public void print() { + + jdbcTemplate.query("SELECT * FROM " + tableName, + (rs, rowNum) -> { + String row = "Table Data for " + tableName +"\n"; + String col = ""; + + final ResultSetMetaData meta = rs.getMetaData(); + final int columnCount = meta.getColumnCount(); + + do { + col = ""; + + for (int column = 1; column <= columnCount; ++column) { + Object obj = rs.getObject(column); + if(!rs.wasNull()) { + col = col + obj + ","; + } + } + col = col.trim().length() == 0 ? "" : (col.trim().substring(0, col.trim().length() - 1)); + row = row + col + "\n"; + } while (rs.next()); + + return row; + }).forEach(row -> { + log.info(row); + }); + } +} \ No newline at end of file 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 6446240dc..000000000 --- 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.onap.ccsdk.sli.adaptors.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 cda7302c9..000000000 --- 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.onap.ccsdk.sli.adaptors.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 1f061eca1..000000000 --- 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/param.txt b/resource-assignment/provider/src/test/resources/param.txt deleted file mode 100755 index a20ac909d..000000000 --- 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.onap.ccsdk.sli.adaptors.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 index 5fd4c7577..681a9c458 100644 --- a/resource-assignment/provider/src/test/resources/sql/data.sql +++ b/resource-assignment/provider/src/test/resources/sql/data.sql @@ -118,3 +118,69 @@ 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.'); +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 ( + 'PortBandwidth', 'ADIG', 'VPE', 'true', 'Port', 'true', + 'service-speed-mbps', 'service-speed-mbps', 'service-speed-mbps'); + +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', 'ADIG', 'VPE', 'true', 'VNF', 'vnf-type = "VPE"', + 'service-speed-mbps', '0.5 * max-vpe-bandwidth-mbps', '0.9 * max-vpe-bandwidth-mbps'); + + +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', 'ADIG', 'VPE', 'true', 'AffinityLink', 'true', + 'service-speed-mbps', '9999999999', '9999999999'); + +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', 'ADIG', 'VPE', 'true', 'VNF', 'true', + '1', '200', '200'); + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'cust-vlan-id', 'ADIG', 'VPE', 'VNF', '2', '1000'); + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'vlan-id-inner', 'ADIG', 'VPE', 'VNF', '1002', '2000'); + + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'vlan-id-outer', 'MY-SERV-MODEL', 'VPE-Cust', 'Site', '2', '1000'); + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core1', 'Site', '1002', '2000'); + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core2', 'Site', '1002', '2000'); + +INSERT INTO RANGE_RULE ( + range_name, service_model, end_point_position, equipment_level, min_value, + max_value) +VALUES ( + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core3', 'Site', '400', '600'); + \ No newline at end of file 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 ab8afb66f..000000000 --- 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 index c3b09a1f5..32b54e9e4 100644 --- a/resource-assignment/provider/src/test/resources/test-context.xml +++ b/resource-assignment/provider/src/test/resources/test-context.xml @@ -4,7 +4,7 @@ openECOMP : SDN-C ================================================================================ Copyright (C) 2017 AT&T Intellectual Property. All rights - reserved. + reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,22 +20,23 @@ ============LICENSE_END========================================================= --> - + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/jdbc + http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.1.xsd + "> - + - + @@ -45,10 +46,18 @@ - + + + + + + + + + @@ -57,17 +66,10 @@ - - - - - - - + - - + @@ -76,7 +78,7 @@ - + @@ -99,35 +101,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -137,161 +114,37 @@ - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - + - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - -- cgit 1.2.3-korg From be72a3cd156210d0e3f8fe3a0cd16993b32c248f Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 15 Jun 2018 18:25:23 -0400 Subject: Update sli/adaptors to ODL Oxygen Update sli/adaptors to compile against ODL Oxygen parent poms. Change-Id: I112c5aa56dd985ad0e7e361d3839ec7069e5641c Issue-ID: CCSDK-281 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 130 ++++----- aai-service/provider/pom.xml | 310 ++++++++++----------- ansible-adapter/ansible-adapter-bundle/pom.xml | 229 +++++++-------- .../ccsdk-ansible-adapter/pom.xml | 31 ++- .../features/ccsdk-mdsal-resource/pom.xml | 85 +++--- mdsal-resource/provider/pom.xml | 15 +- .../features/ccsdk-resource-assignment/pom.xml | 53 ++-- resource-assignment/provider/pom.xml | 9 - sql-resource/features/ccsdk-sql-resource/pom.xml | 30 +- sql-resource/provider/pom.xml | 13 +- 10 files changed, 417 insertions(+), 488 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 8d36b4c78..f277788e9 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -1,91 +1,55 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - single-feature-parent - 1.1.0-SNAPSHOT - - + + org.onap.ccsdk.parent + single-feature-parent + 1.1.0-SNAPSHOT + + - org.onap.ccsdk.sli.adaptors - ccsdk-aai-service - 0.3.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + ccsdk-aai-service + 0.3.0-SNAPSHOT + feature - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + + - - - org.opendaylight.controller - odl-mdsal-broker - xml - features - + + org.onap.ccsdk.sli.core + ccsdk-sli + xml + features + - - org.onap.ccsdk.sli.core - ccsdk-sli - xml - features - + + ${project.groupId} + aai-service-provider + ${project.version} + - - ${project.groupId} - aai-service-provider - ${project.version} - - - com.sun.jersey - jersey-client - ${jersey.client.version} - - - com.sun.jersey - jersey-core - ${jersey.version} - - - org.apache.httpcomponents - httpcore - ${apache.httpcomponents.core.version} - - - org.apache.httpcomponents - httpclient - ${apache.httpcomponents.client.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - commons-lang - commons-lang - ${commons.lang.version} - - - equinoxSDK381 - org.eclipse.osgi - ${equinox.osgi.version} - provided - - + + diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 30c4098ad..4c416e176 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -1,171 +1,157 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - binding-parent - 1.1.0-SNAPSHOT - - + + org.onap.ccsdk.parent + binding-parent + 1.1.0-SNAPSHOT + + - org.onap.ccsdk.sli.adaptors - aai-service-provider - 0.3.0-SNAPSHOT - bundle + org.onap.ccsdk.sli.adaptors + aai-service-provider + 0.3.0-SNAPSHOT + bundle - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - http://maven.apache.org + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + http://maven.apache.org - - UTF-8 - + + UTF-8 + - - - junit - junit - ${junit.version} - test - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.onap.ccsdk.sli.core - sli-common - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.core - sli-provider - ${sdnctl.sli.version} - compile - - - org.onap.ccsdk.sli.core - utils-provider - ${sdnctl.sli.version} - - - equinoxSDK381 - org.eclipse.osgi - ${equinox.osgi.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - com.sun.jersey - jersey-client - ${jersey.client.version} - - - com.sun.jersey - jersey-core - ${jersey.version} - - - org.apache.httpcomponents - httpcore - ${apache.httpcomponents.core.version} - - - org.apache.httpcomponents - httpclient - ${apache.httpcomponents.client.version} - - - com.fasterxml.jackson.core - jackson-databind - - ${jackson.version} - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-core - - ${jackson.version} - - - commons-lang - commons-lang - ${commons.lang.version} - + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.onap.ccsdk.sli.core + sli-common + compile + + + org.onap.ccsdk.sli.core + sli-provider + compile + + + org.onap.ccsdk.sli.core + utils-provider + ${sdnctl.sli.version} + + + org.osgi + org.osgi.core + provided + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-core + + + org.apache.httpcomponents + httpcore + ${apache.httpcomponents.core.version} + + + org.apache.httpcomponents + httpclient + ${apache.httpcomponents.client.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + commons-lang + commons-lang + - - org.jsoup - jsoup - 1.8.3 - test - - - org.springframework - spring-core - 4.3.5.RELEASE - test - - + + org.jsoup + jsoup + 1.8.3 + test + + + org.springframework + spring-core + 4.3.5.RELEASE + test + + - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - 0.13.1 - - - gen-xjc - - generate - - - - - ${project.basedir}/src/main/resources - - aai_schema_v13.xsd - - - aai-schema-bindings.xjb - - ${project.build.directory}/generated-sources/main/java - org.openecomp.aai.inventory.v13 - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 0.6.4 - - - - - - + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.13.1 + + + gen-xjc + + generate + + + + + ${project.basedir}/src/main/resources + + aai_schema_v13.xsd + + + aai-schema-bindings.xjb + + ${project.build.directory}/generated-sources/main/java + org.openecomp.aai.inventory.v13 + true + + -Xannotate + + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.4 + + + + + + diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 497a35f09..cac2b98fa 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -1,118 +1,119 @@ - - - 4.0.0 - - org.onap.ccsdk.parent - binding-parent - 1.1.0-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-bundle - 0.3.0-SNAPSHOT - bundle - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} - - - - com.att.eelf - eelf-core - - - commons-codec - commons-codec - - - commons-logging - commons-logging - 1.2 - - - - org.apache.httpcomponents - httpclient - ${apache.httpcomponents.client.version} - - - - - - org.glassfish.jersey.core - jersey-common - 2.9.1 - test - - - - org.codehaus.jackson - jackson-jaxrs - 1.9.13 - test - - - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.onap.ccsdk.sli.core - sli-common - - - - org.onap.ccsdk.sli.core - sli-provider - - - - equinoxSDK381 - org.eclipse.osgi - - - - org.slf4j - slf4j-api - - - - org.slf4j - jcl-over-slf4j - - - - org.json - json - - - - - com.google.guava - guava - - - - + + + 4.0.0 + + org.onap.ccsdk.parent + binding-parent + 1.1.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ansible-adapter-bundle + 0.3.0-SNAPSHOT + bundle + ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + + + + com.att.eelf + eelf-core + + + commons-codec + commons-codec + + + commons-logging + commons-logging + 1.2 + + + + org.apache.httpcomponents + httpclient + ${apache.httpcomponents.client.version} + + + + + + org.glassfish.jersey.core + jersey-common + 2.9.1 + test + + + + org.codehaus.jackson + jackson-jaxrs + 1.9.13 + test + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.onap.ccsdk.sli.core + sli-common + + + + org.onap.ccsdk.sli.core + sli-provider + + + + org.osgi + org.osgi.core + provided + + + org.slf4j + slf4j-api + + + + org.slf4j + jcl-over-slf4j + + + + org.json + json + + + + + com.google.guava + guava + + + + diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 232616c8b..5c6748025 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -15,14 +15,25 @@ feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} - + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + - - org.opendaylight.controller - odl-mdsal-broker - xml - features - org.onap.ccsdk.sli.core @@ -37,10 +48,6 @@ ${project.version} - - equinoxSDK381 - org.eclipse.osgi - provided - + diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index e7d48ac03..5c4ed4c78 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -1,47 +1,54 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - single-feature-parent - 1.1.0-SNAPSHOT - - + + org.onap.ccsdk.parent + single-feature-parent + 1.1.0-SNAPSHOT + + - org.onap.ccsdk.sli.adaptors - ccsdk-mdsal-resource - 0.3.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + ccsdk-mdsal-resource + 0.3.0-SNAPSHOT + feature - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + + - - - org.opendaylight.controller - odl-mdsal-broker - xml - features - + + org.onap.ccsdk.sli.core + ccsdk-sli + xml + features + - - org.onap.ccsdk.sli.core - ccsdk-sli - xml - features - + + ${project.groupId} + mdsal-resource-provider + ${project.version} + - - ${project.groupId} - mdsal-resource-provider - ${project.version} - - - - equinoxSDK381 - org.eclipse.osgi - provided - - + diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 63370bdf9..94dc3ab6c 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -27,50 +27,43 @@ junit junit - ${junit.version} test org.onap.ccsdk.sli.core sli-common - ${sdnctl.sli.version} compile org.onap.ccsdk.sli.core sli-provider - ${sdnctl.sli.version} compile - equinoxSDK381 - org.eclipse.osgi - + org.osgi + org.osgi.core + provided + org.slf4j slf4j-api - ${slf4j.version} org.slf4j jcl-over-slf4j - ${slf4j.version} commons-codec commons-codec - ${commons.codec.version} org.testng testng - 6.11 test org.mockito mockito-core - ${mockito.version} test
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index fdbbf6a88..509620f38 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -16,14 +16,25 @@ feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + - - org.opendaylight.controller - odl-mdsal-broker - xml - features - org.onap.ccsdk.sli.core @@ -46,32 +57,6 @@ ${project.version} - - org.mariadb.jdbc - mariadb-java-client - ${mariadb.connector.version} - jar - runtime - - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - equinoxSDK381 - org.eclipse.osgi - provided - +
diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 4a29b54de..5f6e54f94 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -26,43 +26,36 @@ junit junit - ${junit.version} test org.springframework spring-test - ${spring.version} test com.h2database h2 - ${h2database.version} test org.onap.ccsdk.sli.core sli-common - ${sdnctl.sli.version} compile org.onap.ccsdk.sli.core sli-provider - ${sdnctl.sli.version} compile org.onap.ccsdk.sli.core dblib-provider - ${sdnctl.dblib.version} runtime org.slf4j slf4j-api - ${slf4j.version} @@ -75,12 +68,10 @@ org.springframework spring-beans - ${spring.version} org.springframework spring-context - ${spring.version} org.springframework diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index fb01685c8..f96a7245d 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -16,14 +16,25 @@ feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + - - org.opendaylight.controller - odl-mdsal-broker - xml - features - org.onap.ccsdk.sli.core @@ -44,10 +55,5 @@ ${project.version} - - equinoxSDK381 - org.eclipse.osgi - provided -
diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 312cebc11..2e26088bc 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -26,7 +26,6 @@ junit junit - ${junit.version} test @@ -38,40 +37,30 @@ org.onap.ccsdk.sli.core sli-common - ${sdnctl.sli.version} compile org.onap.ccsdk.sli.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.onap.ccsdk.sli.core dblib-provider - ${sdnctl.dblib.version}
-- cgit 1.2.3-korg From 153b6c24886820f7f6fa1d160551f292eb4e6948 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 22 Jun 2018 15:50:29 -0400 Subject: Add feature aggregator Add feature aggregator ccsdk-sli-adaptors-all to install all adaptor features. Change-Id: I8e0fa515a18f62a5ca0530d79a1334942c71e5e0 Issue-ID: CCSDK-281 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/installer/pom.xml | 4 +- .../src/assembly/assemble_mvnrepo_zip.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 4 +- .../src/assembly/assemble_mvnrepo_zip.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 77 ++++++++++++ features/features-sli-adaptors/pom.xml | 29 +++++ features/installer/pom.xml | 137 +++++++++++++++++++++ .../src/assembly/assemble_installer_zip.xml | 39 ++++++ .../src/assembly/assemble_mvnrepo_zip.xml | 29 +++++ .../src/main/resources/scripts/install-feature.sh | 18 +++ features/pom.xml | 24 ++++ mdsal-resource/installer/pom.xml | 4 +- .../src/assembly/assemble_mvnrepo_zip.xml | 2 +- pom.xml | 1 + resource-assignment/installer/pom.xml | 4 +- .../src/assembly/assemble_mvnrepo_zip.xml | 2 +- sql-resource/installer/pom.xml | 4 +- .../src/assembly/assemble_mvnrepo_zip.xml | 2 +- 18 files changed, 369 insertions(+), 15 deletions(-) create mode 100644 features/ccsdk-sli-adaptors-all/pom.xml create mode 100644 features/features-sli-adaptors/pom.xml create mode 100755 features/installer/pom.xml create mode 100755 features/installer/src/assembly/assemble_installer_zip.xml create mode 100755 features/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 features/installer/src/main/resources/scripts/install-feature.sh create mode 100755 features/pom.xml (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 7e91aa742..1e951f80e 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -61,12 +61,12 @@ package - false + true stage/${application.name}-${project.version} src/assembly/assemble_mvnrepo_zip.xml - false + true diff --git a/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml b/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml index 2ee224477..9cdc78879 100644 --- a/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/aai-service/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,7 @@ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - mvnrepo_zip + repo zip diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 7dcaab5ea..02262acfe 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -79,8 +79,8 @@ package - false - false + true + true stage/${application.name}-${project.version} src/assembly/assemble_mvnrepo_zip.xml diff --git a/ansible-adapter/ansible-adapter-installer/src/assembly/assemble_mvnrepo_zip.xml b/ansible-adapter/ansible-adapter-installer/src/assembly/assemble_mvnrepo_zip.xml index 615ee37d0..ec65e79e1 100644 --- a/ansible-adapter/ansible-adapter-installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/ansible-adapter/ansible-adapter-installer/src/assembly/assemble_mvnrepo_zip.xml @@ -28,7 +28,7 @@ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - adapter + repo zip diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml new file mode 100644 index 000000000..3a9f034cb --- /dev/null +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.1.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-sli-adaptors-all + 0.3.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: features :: ${project.artifactId} + + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + + + + + ${project.groupId} + ccsdk-aai-service + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-ansible-adapter + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-mdsal-resource + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-resource-assignment + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-sql-resource + ${project.version} + xml + features + + + + diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml new file mode 100644 index 000000000..de1b9b8d8 --- /dev/null +++ b/features/features-sli-adaptors/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + feature-repo-parent + 1.1.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + features-sli-adaptors + 0.3.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: features :: ${project.artifactId} + + + + ${project.groupId} + ccsdk-sli-adaptors-all + ${project.version} + xml + features + + + + diff --git a/features/installer/pom.xml b/features/installer/pom.xml new file mode 100755 index 000000000..be20d9f5c --- /dev/null +++ b/features/installer/pom.xml @@ -0,0 +1,137 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.1.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + sliadaptors-features-installer + 0.3.0-SNAPSHOT + pom + + ccsdk-sli-adaptors :: features :: ${project.artifactId} + + + ccsdk-sli-adaptors-all + ${application.name} + mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features + false + + + + + + org.onap.ccsdk.sli.adaptors + ${application.name} + ${project.version} + xml + features + + + * + * + + + + + + + + + + + maven-assembly-plugin + + + maven-repo-zip + + single + + package + + true + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + true + + + + 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.onap.ccsdk.sli.adaptors + 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/features/installer/src/assembly/assemble_installer_zip.xml b/features/installer/src/assembly/assemble_installer_zip.xml new file mode 100755 index 000000000..a6a22a9ba --- /dev/null +++ b/features/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,39 @@ + + + + bin + + + zip + + + + false + + + + target/stage/ + ${application.name} + 755 + + *.sh + + + + target/stage/ + ${application.name} + 644 + + *.sh + + + + + + + diff --git a/features/installer/src/assembly/assemble_mvnrepo_zip.xml b/features/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100755 index 000000000..86b07f1f3 --- /dev/null +++ b/features/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,29 @@ + + + + repo + + + zip + + + + false + + + + target/assembly/ + . + + + + + + + + diff --git a/features/installer/src/main/resources/scripts/install-feature.sh b/features/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..e16e79a12 --- /dev/null +++ b/features/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +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} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/features/pom.xml b/features/pom.xml new file mode 100755 index 000000000..5fb7be025 --- /dev/null +++ b/features/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.1.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + sliadaptors-feature-aggregator + 0.3.0-SNAPSHOT + pom + + ccsdk-sli-adaptors :: features + + + ccsdk-sli-adaptors-all + features-sli-adaptors + installer + + diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 86792f44d..b4203b21b 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -61,12 +61,12 @@ package - false + true stage/${application.name}-${project.version} src/assembly/assemble_mvnrepo_zip.xml - false + true diff --git a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml index 2ee224477..9cdc78879 100644 --- a/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/mdsal-resource/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,7 @@ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - mvnrepo_zip + repo zip diff --git a/pom.xml b/pom.xml index a2d2ec2a7..d311050b4 100755 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,7 @@ mdsal-resource resource-assignment sql-resource + features ONAP diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 6853619cd..40e7bce69 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -76,12 +76,12 @@ package - false + true stage/${application.name}-${project.version} src/assembly/assemble_mvnrepo_zip.xml - false + true diff --git a/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml b/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml index 755df5b2a..9b4a25f49 100644 --- a/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/resource-assignment/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,7 @@ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - mvnrepo_zip + repo zip diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 7e5efd550..fff8559fc 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -61,12 +61,12 @@ package - false + true stage/${application.name}-${project.version} src/assembly/assemble_mvnrepo_zip.xml - false + true diff --git a/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml b/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml index cb56f2cd4..35e79db18 100644 --- a/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml +++ b/sql-resource/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -25,7 +25,7 @@ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - mvnrepo_zip + repo zip -- cgit 1.2.3-korg From 56e2d29ba30639c56f465a05377cf464d4ac85e4 Mon Sep 17 00:00:00 2001 From: sb5356 Date: Tue, 26 Jun 2018 10:01:27 -0400 Subject: Support for defining multiple ranges in RANGE_RULE Change-Id: I5a5a1c61629a684dfc016f14000adbcb1e6dc9a1 Issue-ID: CCSDK-315 Signed-off-by: Stan Bonev --- .../sli/adaptors/ra/alloc/DbAllocationRule.java | 267 +++++++++++---------- .../adaptors/ra/comp/EndPointAllocatorImpl.java | 3 +- .../sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java | 50 ++-- .../ccsdk/sli/adaptors/ra/rule/data/RangeRule.java | 7 +- .../sli/adaptors/rm/comp/AllocationFunction.java | 86 ++++--- .../org/onap/ccsdk/sli/adaptors/rm/data/Range.java | 28 +++ .../adaptors/rm/data/RangeAllocationRequest.java | 4 +- .../onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java | 43 +++- .../provider/src/test/resources/sql/data.sql | 42 ++-- .../provider/src/test/resources/sql/schema.sql | 4 +- 10 files changed, 321 insertions(+), 213 deletions(-) create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Range.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index e9f6e0d3f..af6a2801d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -36,6 +36,7 @@ import org.onap.ccsdk.sli.adaptors.rm.data.AllocationAction; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; import org.onap.ccsdk.sli.adaptors.util.expr.ExpressionEvaluator; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; @@ -44,127 +45,147 @@ 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 serviceModel, ResourceEntity resourceEntity, - ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { - List resourceRuleList = resourceRuleDao.getResourceRules(serviceModel, - resourceTarget.resourceTargetType); - List rangeRuleList = rangeRuleDao.getRangeRules(serviceModel, resourceTarget.resourceTargetType); - - List arlist = new ArrayList<>(); - - for (ResourceRule rr : resourceRuleList) { - if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.resourceName)) { - continue; - } - - boolean matches = ExpressionEvaluator.evalBoolean(rr.serviceExpression, resourceEntity.data); - matches = matches && ExpressionEvaluator.evalBoolean(rr.equipmentExpression, resourceTarget.data); - - if (matches) { - AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, - checkOnly, change); - arlist.add(ar1); - } - } - - for (RangeRule rr : rangeRuleList) { - if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.rangeName)) { - continue; - } - if (resourceRequest.endPointPosition != null - && !resourceRequest.endPointPosition.equals(rr.endPointPosition)) { - continue; - } - - AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, - 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, ResourceEntity resourceEntity, - ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { - StrUtil.info(log, resourceRule); - - LimitAllocationRequest ar = new LimitAllocationRequest(); - ar.applicationId = resourceRequest.applicationId; - ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; - ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; - ar.resourceName = resourceRule.resourceName; - if (resourceRequest.resourceShareGroup != null) { - ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); - } - ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = resourceRequest.replace; - ar.strict = false; - ar.checkLimit = ExpressionEvaluator.evalLong( - change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, resourceTarget.data); - ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, resourceEntity.data); - ar.allocateCount = checkOnly ? 0 : ar.checkCount; - return ar; - } - - private AllocationRequest buildAllocationRequest(RangeRule rangeRule, ResourceEntity resourceEntity, - ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { - StrUtil.info(log, rangeRule); - - RangeAllocationRequest ar = new RangeAllocationRequest(); - ar.applicationId = resourceRequest.applicationId; - if (resourceRequest.endPointPosition != null) { - ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + "::" - + resourceRequest.endPointPosition; - ar.endPointPosition = resourceRequest.endPointPosition; - }else - ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; - ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; - ar.resourceName = rangeRule.rangeName; - if (resourceRequest.resourceShareGroup != null) { - ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); - } - ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; - ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, - "Invalid value for requested-numbers"); - if (ar.requestedNumbers != null) { - ar.requestedCount = ar.requestedNumbers.size(); - } - ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); - ar.reverseOrder = resourceRequest.rangeReverseOrder; - ar.missingResourceAction = AllocationAction.Succeed_Allocate; - ar.expiredResourceAction = AllocationAction.Succeed_Allocate; - ar.replace = resourceRequest.replace; - ar.check = true; - ar.allocate = !checkOnly; - ar.checkMin = resourceRequest.rangeMinOverride >= 0 ? resourceRequest.rangeMinOverride : rangeRule.minValue; - ar.checkMax = resourceRequest.rangeMaxOverride >= 0 ? resourceRequest.rangeMaxOverride : rangeRule.maxValue; - return ar; - } - - public void setResourceRuleDao(ResourceRuleDao resourceRuleDao) { - this.resourceRuleDao = resourceRuleDao; - } - - public void setRangeRuleDao(RangeRuleDao rangeRuleDao) { - this.rangeRuleDao = rangeRuleDao; - } + private static final Logger log = LoggerFactory.getLogger(DbAllocationRule.class); + + private ResourceRuleDao resourceRuleDao; + private RangeRuleDao rangeRuleDao; + + @Override + public AllocationRequest buildAllocationRequest(String serviceModel, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + List resourceRuleList = resourceRuleDao.getResourceRules(serviceModel, + resourceTarget.resourceTargetType); + List rangeRuleList = rangeRuleDao.getRangeRules(serviceModel, resourceTarget.resourceTargetType); + + List arlist = new ArrayList<>(); + + for (ResourceRule rr : resourceRuleList) { + if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.resourceName)) { + continue; + } + + boolean matches = ExpressionEvaluator.evalBoolean(rr.serviceExpression, resourceEntity.data); + matches = matches && ExpressionEvaluator.evalBoolean(rr.equipmentExpression, resourceTarget.data); + + if (matches) { + AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, + checkOnly, change); + arlist.add(ar1); + } + } + + for (RangeRule rr : rangeRuleList) { + if (resourceRequest.resourceName != null && !resourceRequest.resourceName.equals(rr.rangeName)) { + continue; + } + if (resourceRequest.endPointPosition != null + && !resourceRequest.endPointPosition.equals(rr.endPointPosition)) { + continue; + } + + if (!ExpressionEvaluator.evalBoolean(rr.equipmentExpression, resourceTarget.data)) { + continue; + } + + AllocationRequest ar1 = buildAllocationRequest(rr, resourceEntity, resourceTarget, resourceRequest, + 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, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + StrUtil.info(log, resourceRule); + + LimitAllocationRequest ar = new LimitAllocationRequest(); + ar.applicationId = resourceRequest.applicationId; + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; + ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; + ar.resourceName = resourceRule.resourceName; + if (resourceRequest.resourceShareGroup != null) { + ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); + } + ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; + ar.missingResourceAction = AllocationAction.Succeed_Allocate; + ar.expiredResourceAction = AllocationAction.Succeed_Allocate; + ar.replace = resourceRequest.replace; + ar.strict = false; + ar.checkLimit = ExpressionEvaluator.evalLong( + change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, resourceTarget.data); + ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, resourceEntity.data); + ar.allocateCount = checkOnly ? 0 : ar.checkCount; + return ar; + } + + private AllocationRequest buildAllocationRequest(RangeRule rangeRule, ResourceEntity resourceEntity, + ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + StrUtil.info(log, rangeRule); + + RangeAllocationRequest ar = new RangeAllocationRequest(); + ar.applicationId = resourceRequest.applicationId; + if (resourceRequest.endPointPosition != null) { + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + "::" + + resourceRequest.endPointPosition; + ar.endPointPosition = resourceRequest.endPointPosition; + } else { + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; + } + ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; + ar.resourceName = rangeRule.rangeName; + if (resourceRequest.resourceShareGroup != null) { + ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); + } + ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; + ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, + "Invalid value for requested-numbers"); + if (ar.requestedNumbers != null) { + ar.requestedCount = ar.requestedNumbers.size(); + } + ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); + ar.reverseOrder = resourceRequest.rangeReverseOrder; + ar.missingResourceAction = AllocationAction.Succeed_Allocate; + ar.expiredResourceAction = AllocationAction.Succeed_Allocate; + ar.replace = resourceRequest.replace; + ar.check = true; + ar.allocate = !checkOnly; + ar.rangeList = rangeRule.rangeList; + if (ar.rangeList == null || ar.rangeList.isEmpty()) { + if (resourceRequest.rangeMinOverride >= 0 && resourceRequest.rangeMaxOverride >= resourceRequest.rangeMinOverride) { + ar.rangeList = new ArrayList<>(); + Range range = new Range(); + range.min = resourceRequest.rangeMinOverride; + range.max = resourceRequest.rangeMaxOverride; + ar.rangeList.add(range); + } + } else { + if (resourceRequest.rangeMinOverride >= 0) { + ar.rangeList.get(0).min = resourceRequest.rangeMinOverride; + } + if (resourceRequest.rangeMaxOverride >= 0) { + ar.rangeList.get(ar.rangeList.size() - 1).max = resourceRequest.rangeMaxOverride; + } + } + 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/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index e904035b1..952ceb6bd 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -46,9 +46,8 @@ import org.slf4j.LoggerFactory; public class EndPointAllocatorImpl implements EndPointAllocator { - @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(EndPointAllocatorImpl.class); - + private ResourceManager resourceManager; private Map> allocationRuleMap; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java index 825261efd..caac1c969 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java @@ -21,10 +21,10 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.dao; -import java.sql.ResultSet; -import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; import org.onap.ccsdk.sli.adaptors.ra.rule.data.RangeRule; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; @@ -42,20 +42,42 @@ public class RangeRuleDaoImpl implements RangeRuleDao { @Override public List getRangeRules(String serviceModel, String equipLevel) { List rangeRuleList = - jdbcTemplate.query(GET_SQL, new Object[] {serviceModel, equipLevel}, new RowMapper() { + jdbcTemplate.query(GET_SQL, new Object[] {serviceModel, equipLevel}, (RowMapper) (rs, rowNum) -> { + 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.equipmentExpression = rs.getString("equipment_expression"); - @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; + String rangesStr = rs.getString("ranges"); + String[] ranges = rangesStr.split(","); + rl.rangeList = new ArrayList<>(); + for (String rangeStr : ranges) { + Range range = new Range(); + String[] nn = rangeStr.split("-"); + if (nn.length >= 1) { + try { + range.min = range.max = Integer.parseInt(nn[0]); + } catch (NumberFormatException e) { + log.warn("Invalid value found in DB for range: " + rangeStr, e); + } + } + if (nn.length >= 2) { + try { + range.max = Integer.parseInt(nn[1]); + } catch (NumberFormatException e) { + log.warn("Invalid value found in DB for range: " + rangeStr, e); + } + } + if (nn.length > 2) { + log.warn("Invalid value found in DB for range: " + rangeStr); + } + rl.rangeList.add(range); } + + return rl; }); return rangeRuleList; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java index 383c28308..c1ccd8196 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/data/RangeRule.java @@ -21,6 +21,9 @@ package org.onap.ccsdk.sli.adaptors.ra.rule.data; +import java.util.List; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; + public class RangeRule { public long id; @@ -28,6 +31,6 @@ public class RangeRule { public String serviceModel; public String endPointPosition; public String equipmentLevel; - public int minValue; - public int maxValue; + public String equipmentExpression; + public List rangeList; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index 3544075fe..9cae5fee5 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -46,6 +46,7 @@ import org.onap.ccsdk.sli.adaptors.rm.data.MultiAssetAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.MultiAssetAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; @@ -283,24 +284,40 @@ class AllocationFunction extends SynchronizedFunction { // 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; + // Request may contain multiple ranges. We will find the range from the request + // that contains the currently used numbers (the first one). We will only look + // for additional numbers in that range. + + Range range = null; + if (req.rangeList != null) { + for (Range range1 : req.rangeList) { + if (uu.first() >= range1.min && uu.first() <= range1.max) { + range = range1; + 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 (range != null) { + int uumin = uu.first() - 1; + int uumax = uu.last() + 1; + foundNumbers.addAll(uu); + foundCount = uu.size(); + for (int n = uumin; foundCount < req.requestedCount && n >= range.min; n--) { + if (RangeUtil.checkRange(rr, req, n)) { + foundNumbers.add(n); + foundCount++; + } else if (req.sequential) { + break; + } + } + for (int n = uumax; foundCount < req.requestedCount && n <= range.max; n++) { + if (RangeUtil.checkRange(rr, req, n)) { + foundNumbers.add(n); + foundCount++; + } else if (req.sequential) { + break; + } } } @@ -314,22 +331,29 @@ class AllocationFunction extends SynchronizedFunction { } } - if (req.reverseOrder) { - for (int n = req.checkMax; foundCount < req.requestedCount && n >= req.checkMin; n--) { - if (RangeUtil.checkRange(rr, req, n)) { - foundNumbers.add(n); - foundCount++; - } else if (req.sequential) { - foundCount = 0; + if (req.rangeList != null) { + if (req.reverseOrder) { + for (int i = req.rangeList.size() - 1; i >= 0; i--) { + Range range = req.rangeList.get(i); + for (int n = range.max; foundCount < req.requestedCount && n >= range.min; n--) { + if (RangeUtil.checkRange(rr, req, n)) { + foundNumbers.add(n); + foundCount++; + } else if (req.sequential) { + foundCount = 0; + } + } } - } - } else { - 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; + } else { + for (Range range : req.rangeList) { + for (int n = range.min; foundCount < req.requestedCount && n <= range.max; n++) { + if (RangeUtil.checkRange(rr, req, n)) { + foundNumbers.add(n); + foundCount++; + } else if (req.sequential) { + foundCount = 0; + } + } } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Range.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Range.java new file mode 100644 index 000000000..16be77f5b --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/Range.java @@ -0,0 +1,28 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +public class Range { + + public int min = 0; + public int max = 0; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java index 9581244b3..d87469fd4 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java @@ -21,12 +21,12 @@ package org.onap.ccsdk.sli.adaptors.rm.data; +import java.util.List; import java.util.SortedSet; public class RangeAllocationRequest extends AllocationRequest { - public int checkMin = 0; - public int checkMax = 0; + public List rangeList = null; public boolean check = false; public boolean allocate = false; public boolean replace = false; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java index 04f6e8c56..4685233df 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java @@ -27,6 +27,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; @@ -48,27 +49,43 @@ public class RangeUtil { } public static boolean checkRange(RangeResource r, RangeAllocationRequest req, int num) { - if (num < req.checkMin || num > req.checkMax) { - return false; - } - if (req.excludeNumbers != null && req.excludeNumbers.contains(num)) { 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)) { - if (!overlap(rai.resourceShareGroupList, req.resourceShareGroupList)) { - return false; + if (req.rangeList != null && !req.rangeList.isEmpty()) { + boolean good = false; + for (Range range : req.rangeList) { + if (num < range.min || num > range.min) { + continue; + } + + boolean found = 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)) { + if (!overlap(rai.resourceShareGroupList, req.resourceShareGroupList)) { + found = true; + break; + } + } + if (!req.replace && eq(req.resourceSetId, rai.resourceSetId) && rai.used != null + && rai.used.contains(num)) { + found = true; + break; + } } } - if (!req.replace && eq(req.resourceSetId, rai.resourceSetId) && rai.used != null - && rai.used.contains(num)) { - return false; + + if (!found) { + good = true; + break; } } + + return good; } return true; diff --git a/resource-assignment/provider/src/test/resources/sql/data.sql b/resource-assignment/provider/src/test/resources/sql/data.sql index 681a9c458..236a16d18 100644 --- a/resource-assignment/provider/src/test/resources/sql/data.sql +++ b/resource-assignment/provider/src/test/resources/sql/data.sql @@ -80,19 +80,19 @@ values ( '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) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'subinterface-id', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 100, 3999); + 'subinterface-id', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 'true', '100-3999'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-inner', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 2, 4091); + 'vlan-id-inner', 'L3AVPN-EVC', 'VPE-Cust', 'Port', 'true', '2-4091'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'bundle-id', 'L3AVPN-PORT', 'VPE-Cust', 'Port', 1, 99999); + 'bundle-id', 'L3AVPN-PORT', 'VPE-Cust', 'Port', 'true', '1-99999'); INSERT INTO MAX_PORT_SPEED ( image_file_name, end_point_position, interface_name, max_speed, unit) @@ -148,39 +148,33 @@ VALUES ( '1', '200', '200'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'cust-vlan-id', 'ADIG', 'VPE', 'VNF', '2', '1000'); + 'cust-vlan-id', 'ADIG', 'VPE', 'VNF', 'true', '2-1000'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-inner', 'ADIG', 'VPE', 'VNF', '1002', '2000'); + 'vlan-id-inner', 'ADIG', 'VPE', 'VNF', 'true', '1002-2000'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-outer', 'MY-SERV-MODEL', 'VPE-Cust', 'Site', '2', '1000'); + 'vlan-id-outer', 'MY-SERV-MODEL', 'VPE-Cust', 'Site', 'true', '2-1000'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core1', 'Site', '1002', '2000'); + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core1', 'Site', 'true', '1002-2000'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core2', 'Site', '1002', '2000'); + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core2', 'Site', 'true', '1002-2000,2200-4000'); INSERT INTO RANGE_RULE ( - range_name, service_model, end_point_position, equipment_level, min_value, - max_value) + range_name, service_model, end_point_position, equipment_level, equipment_expression, ranges) VALUES ( - 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core3', 'Site', '400', '600'); + 'vlan-id-filter', 'MY-SERV-MODEL', 'VPE-Core3', 'Site', 'true', '400-600'); \ No newline at end of file diff --git a/resource-assignment/provider/src/test/resources/sql/schema.sql b/resource-assignment/provider/src/test/resources/sql/schema.sql index 40761de42..ed123ddd6 100644 --- a/resource-assignment/provider/src/test/resources/sql/schema.sql +++ b/resource-assignment/provider/src/test/resources/sql/schema.sql @@ -96,8 +96,8 @@ CREATE TABLE RANGE_RULE ( 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 + equipment_expression VARCHAR(2000) NOT NULL, + ranges VARCHAR(100) NOT NULL ); CREATE TABLE MAX_PORT_SPEED ( -- cgit 1.2.3-korg From e1184d3033ca9f1e1572050ef6f92f67a62865d0 Mon Sep 17 00:00:00 2001 From: sb5356 Date: Wed, 18 Jul 2018 16:56:14 -0400 Subject: RA: Fix unnecessary updates to allocation items Change-Id: Ia3569ea5c7afe00624bb5d2368253cc3e5d834f5 Issue-ID: CCSDK-387 Signed-off-by: Stan Bonev --- .../sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java | 1 - .../sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 172 ++++++++++++++------- 2 files changed, 113 insertions(+), 60 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java index caac1c969..4599314aa 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java @@ -32,7 +32,6 @@ 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 equipment_level = ?"; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index 58f103655..e202de778 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.adaptors.rm.dao.jdbc; import java.util.ArrayList; import java.util.HashSet; import java.util.List; - import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; @@ -49,14 +48,14 @@ public class ResourceDaoImpl implements ResourceDao { if (r != null) { List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); + r.allocationItems = new ArrayList<>(); for (AllocationItem aiEntity : aiEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); r.allocationItems.add(ai); } List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); + r.resourceLoadList = new ArrayList<>(); for (ResourceLoad rlEntity : rlEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); r.resourceLoadList.add(rl); @@ -68,66 +67,77 @@ public class ResourceDaoImpl implements ResourceDao { @Override public void saveResource(org.onap.ccsdk.sli.adaptors.rm.data.Resource resource) { - if (resource == null) + if (resource == null) { return; + } org.onap.ccsdk.sli.adaptors.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) + if (resource.allocationItems != null) { for (org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai : resource.allocationItems) { AllocationItem aiEntity = createAllocationItemEntity(resourceEntity.id, ai); allocationItemJdbcDao.add(aiEntity); } - if (resource.resourceLoadList != null) + } + if (resource.resourceLoadList != null) { for (org.onap.ccsdk.sli.adaptors.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) + if (resource.allocationItems != null) { for (org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem newai : resource.allocationItems) { AllocationItem foundAiEntity = null; - for (AllocationItem oldAiEntity : oldAiEntityList) + for (AllocationItem oldAiEntity : oldAiEntityList) { if (oldAiEntity.resourceSetId.equals(newai.resourceSetId)) { foundAiEntity = oldAiEntity; break; } + } if (foundAiEntity != null) { - updateAllocationItemEntity(foundAiEntity, newai); - allocationItemJdbcDao.update(foundAiEntity); + if (allocationItemChanged(foundAiEntity, newai)) { + 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.onap.ccsdk.sli.adaptors.rm.data.AllocationItem newai : resource.allocationItems) + if (resource.allocationItems != null) { + for (org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem newai : resource.allocationItems) { if (oldAiEntity.resourceSetId.equals(newai.resourceSetId)) { found = true; break; } - if (!found) + } + } + if (!found) { allocationItemJdbcDao.delete(oldAiEntity.id); + } } List oldRlEntityList = resourceLoadJdbcDao.getResourceLoads(resourceEntity.id); - if (resource.resourceLoadList != null) + if (resource.resourceLoadList != null) { for (org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad newrl : resource.resourceLoadList) { ResourceLoad foundRlEntity = null; - for (ResourceLoad oldRlEntity : oldRlEntityList) + for (ResourceLoad oldRlEntity : oldRlEntityList) { if (oldRlEntity.applicationId.equals(newrl.applicationId)) { foundRlEntity = oldRlEntity; break; } + } if (foundRlEntity != null) { updateResourceLoadEntity(foundRlEntity, newrl); resourceLoadJdbcDao.update(foundRlEntity); @@ -136,44 +146,76 @@ public class ResourceDaoImpl implements ResourceDao { resourceLoadJdbcDao.add(newRlEntity); } } + } for (ResourceLoad oldRlEntity : oldRlEntityList) { boolean found = false; - if (resource.resourceLoadList != null) - for (org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad newrl : resource.resourceLoadList) + if (resource.resourceLoadList != null) { + for (org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad newrl : resource.resourceLoadList) { if (oldRlEntity.applicationId.equals(newrl.applicationId)) { found = true; break; } - if (!found) + } + } + if (!found) { resourceLoadJdbcDao.delete(oldRlEntity.id); + } } } } + private boolean allocationItemChanged(AllocationItem aiEntity, + org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem newai) { + String newShareGroupList = StrUtil.listStr(newai.resourceShareGroupList); + if (!eq(aiEntity.resourceShareGroupList, newShareGroupList)) { + return true; + } + + if (newai.resourceType == ResourceType.Limit) { + if (aiEntity.ltUsed != ((LimitAllocationItem) newai).used) { + return true; + } + } else if (newai.resourceType == ResourceType.Label) { + if (!eq(aiEntity.llLabel, ((LabelAllocationItem) newai).label)) { + return true; + } + } else if (newai.resourceType == ResourceType.Range) { + String newRrUsed = StrUtil.listInt(((RangeAllocationItem) newai).used); + if (!eq(aiEntity.rrUsed, newRrUsed)) { + return true; + } + } + + return false; + } + @Override public void deleteResource(String assetId, String resourceName) { - org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.Resource resourceEntity = resourceJdbcDao.getResource(assetId, resourceName); - if (resourceEntity != null) + org.onap.ccsdk.sli.adaptors.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(); + List rlist = + new ArrayList<>(); for (Resource rEntity : rEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); rlist.add(r); List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); + r.allocationItems = new ArrayList<>(); for (AllocationItem aiEntity : aiEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); r.allocationItems.add(ai); } List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); + r.resourceLoadList = new ArrayList<>(); for (ResourceLoad rlEntity : rlEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); r.resourceLoadList.add(rl); @@ -185,20 +227,21 @@ public class ResourceDaoImpl implements ResourceDao { @Override public List getResourceUnion(String resourceUnionId) { List rEntityList = resourceJdbcDao.getResourceUnion(resourceUnionId); - List rlist = new ArrayList(); + List rlist = + new ArrayList<>(); for (Resource rEntity : rEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); rlist.add(r); List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList(); + r.allocationItems = new ArrayList<>(); for (AllocationItem aiEntity : aiEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); r.allocationItems.add(ai); } List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList(); + r.resourceLoadList = new ArrayList<>(); for (ResourceLoad rlEntity : rlEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); r.resourceLoadList.add(rl); @@ -212,18 +255,20 @@ public class ResourceDaoImpl implements ResourceDao { resourceEntity.assetId = resource.resourceKey.assetId; resourceEntity.name = resource.resourceKey.resourceName; resourceEntity.type = resource.resourceType.toString(); - if (resource.resourceType == ResourceType.Limit) + if (resource.resourceType == ResourceType.Limit) { resourceEntity.ltUsed = ((LimitResource) resource).used; - else if (resource.resourceType == ResourceType.Label) { + } else if (resource.resourceType == ResourceType.Label) { resourceEntity.llLabel = ((LabelResource) resource).label; resourceEntity.llReferenceCount = ((LabelResource) resource).referenceCount; - } else if (resource.resourceType == ResourceType.Range) + } else if (resource.resourceType == ResourceType.Range) { resourceEntity.rrUsed = StrUtil.listInt(((RangeResource) resource).used); + } return resourceEntity; } - private ResourceLoad createResourceLoadEntity(long resourceId, org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl) { + private ResourceLoad createResourceLoadEntity(long resourceId, + org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl) { ResourceLoad rlEntity = new ResourceLoad(); rlEntity.resourceId = resourceId; rlEntity.applicationId = rl.applicationId; @@ -237,7 +282,8 @@ public class ResourceDaoImpl implements ResourceDao { rlEntity.expirationTime = rl.resourceExpirationTime; } - private AllocationItem createAllocationItemEntity(long resourceId, org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai) { + private AllocationItem createAllocationItemEntity(long resourceId, + org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai) { AllocationItem aiEntity = new AllocationItem(); aiEntity.resourceId = resourceId; aiEntity.resourceSetId = ai.resourceSetId; @@ -245,39 +291,44 @@ public class ResourceDaoImpl implements ResourceDao { aiEntity.resourceShareGroupList = StrUtil.listStr(ai.resourceShareGroupList); aiEntity.applicationId = ai.applicationId; aiEntity.allocationTime = ai.allocationTime; - if (ai.resourceType == ResourceType.Limit) + if (ai.resourceType == ResourceType.Limit) { aiEntity.ltUsed = ((LimitAllocationItem) ai).used; - else if (ai.resourceType == ResourceType.Label) + } else if (ai.resourceType == ResourceType.Label) { aiEntity.llLabel = ((LabelAllocationItem) ai).label; - else if (ai.resourceType == ResourceType.Range) + } else if (ai.resourceType == ResourceType.Range) { aiEntity.rrUsed = StrUtil.listInt(((RangeAllocationItem) ai).used); + } return aiEntity; } - private void updateAllocationItemEntity(AllocationItem aiEntity, org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai) { + private void updateAllocationItemEntity(AllocationItem aiEntity, + org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai) { aiEntity.resourceShareGroupList = StrUtil.listStr(ai.resourceShareGroupList); aiEntity.allocationTime = ai.allocationTime; - if (ai.resourceType == ResourceType.Limit) + if (ai.resourceType == ResourceType.Limit) { aiEntity.ltUsed = ((LimitAllocationItem) ai).used; - else if (ai.resourceType == ResourceType.Label) + } else if (ai.resourceType == ResourceType.Label) { aiEntity.llLabel = ((LabelAllocationItem) ai).label; - else if (ai.resourceType == ResourceType.Range) + } else if (ai.resourceType == ResourceType.Range) { aiEntity.rrUsed = StrUtil.listInt(((RangeAllocationItem) ai).used); + } } private void updateResourceEntity(Resource resourceEntity, org.onap.ccsdk.sli.adaptors.rm.data.Resource resource) { - if (resource.resourceType == ResourceType.Limit) + if (resource.resourceType == ResourceType.Limit) { resourceEntity.ltUsed = ((LimitResource) resource).used; - else if (resource.resourceType == ResourceType.Label) { + } else if (resource.resourceType == ResourceType.Label) { resourceEntity.llLabel = ((LabelResource) resource).label; resourceEntity.llReferenceCount = ((LabelResource) resource).referenceCount; - } else if (resource.resourceType == ResourceType.Range) + } else if (resource.resourceType == ResourceType.Range) { resourceEntity.rrUsed = StrUtil.listInt(((RangeResource) resource).used); + } } private org.onap.ccsdk.sli.adaptors.rm.data.Resource createResource(Resource resourceEntity) { - if (resourceEntity == null) + if (resourceEntity == null) { return null; + } org.onap.ccsdk.sli.adaptors.rm.data.Resource r = null; ResourceType type = ResourceType.valueOf(resourceEntity.type); @@ -292,9 +343,8 @@ public class ResourceDaoImpl implements ResourceDao { 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); + rr.used = StrUtil.listInt(resourceEntity.rrUsed, "Invalid data found in DB in for Resource Id: " + + resourceEntity.id + ": RESOURCE.RR_USED: " + resourceEntity.rrUsed); r = rr; } @@ -309,10 +359,10 @@ public class ResourceDaoImpl implements ResourceDao { } private org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem createAllocationItem( - org.onap.ccsdk.sli.adaptors.rm.data.Resource r, - AllocationItem aiEntity) { - if (r == null || aiEntity == null) + org.onap.ccsdk.sli.adaptors.rm.data.Resource r, AllocationItem aiEntity) { + if (r == null || aiEntity == null) { return null; + } org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai = null; if (r.resourceType == ResourceType.Limit) { @@ -325,19 +375,19 @@ public class ResourceDaoImpl implements ResourceDao { 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); + 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; } - if (ai!=null) { + if (ai != null) { 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)); + if (aiEntity.resourceShareGroupList != null) { + ai.resourceShareGroupList = new HashSet<>(StrUtil.listStr(aiEntity.resourceShareGroupList)); + } ai.applicationId = aiEntity.applicationId; ai.allocationTime = aiEntity.allocationTime; } @@ -346,10 +396,10 @@ public class ResourceDaoImpl implements ResourceDao { } private org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad createResourceLoad( - org.onap.ccsdk.sli.adaptors.rm.data.Resource r, - ResourceLoad rlEntity) { - if (rlEntity == null) + org.onap.ccsdk.sli.adaptors.rm.data.Resource r, ResourceLoad rlEntity) { + if (rlEntity == null) { return null; + } org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = new org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad(); rl.resourceKey = r.resourceKey; @@ -360,6 +410,10 @@ public class ResourceDaoImpl implements ResourceDao { return rl; } + private static boolean eq(Object o1, Object o2) { + return o1 == null ? o2 == null : o1.equals(o2); + } + public void setResourceJdbcDao(ResourceJdbcDao resourceJdbcDao) { this.resourceJdbcDao = resourceJdbcDao; } -- cgit 1.2.3-korg From 5d0c8984dc39d465ef6c3ed776213010849d34a5 Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Fri, 27 Jul 2018 11:49:50 -0400 Subject: RA: Add capability to assign new numbers for range Change-Id: Ibb11219bfe0362055d388a4a10dab81e95979892 Issue-ID: CCSDK-408 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 4 +- .../sli/adaptors/ra/alloc/DbAllocationRule.java | 1 + .../sli/adaptors/ra/comp/ResourceRequest.java | 1 + .../sli/adaptors/rm/comp/AllocationFunction.java | 2 +- .../adaptors/rm/data/RangeAllocationRequest.java | 1 + .../onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java | 8 +- .../org/onap/ccsdk/sli/adaptors/ra/DataSetup.java | 37 +- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 863 +++++++++++---------- .../org/onap/ccsdk/sli/adaptors/rm/DataSetup.java | 106 --- 9 files changed, 518 insertions(+), 505 deletions(-) delete mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/DataSetup.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 426fd289d..0e4b9252d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -60,7 +60,7 @@ public class ResourceAllocator implements SvcLogicResource { @Override public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException { - return (QueryStatus.SUCCESS); + return QueryStatus.SUCCESS; } @Override @@ -351,6 +351,8 @@ public class ResourceAllocator implements SvcLogicResource { rr.rangeMinOverride = Integer.parseInt(rangeMinOverrideStr); String rangeMaxOverrideStr = getParam(ctx, "range-max-override", false, "-1"); rr.rangeMaxOverride = Integer.parseInt(rangeMaxOverrideStr); + String rangeForceNewNumbersStr = getParam(ctx, "range-force-new-numbers", false, "false"); + rr.rangeForceNewNumbers = Boolean.parseBoolean(rangeForceNewNumbersStr); String replaceStr = getParam(ctx, "replace", false, "true"); rr.replace = Boolean.parseBoolean(replaceStr); rr.applicationId = getParam(ctx, "application-id", false, "SDNC"); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index af6a2801d..b13ef80e8 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -178,6 +178,7 @@ public class DbAllocationRule implements AllocationRule { ar.rangeList.get(ar.rangeList.size() - 1).max = resourceRequest.rangeMaxOverride; } } + ar.forceNewNumbers = resourceRequest.rangeForceNewNumbers; return ar; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index b5c24fa71..a52ce385d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -30,6 +30,7 @@ public class ResourceRequest { public boolean rangeReverseOrder; public int rangeMinOverride; public int rangeMaxOverride; + public boolean rangeForceNewNumbers; public boolean replace; public String requestType; public String serviceModel; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index 9cae5fee5..70092db36 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -267,7 +267,7 @@ class AllocationFunction extends SynchronizedFunction { // 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() && req.replace) { + if (uu != null && !uu.isEmpty() && req.replace && !req.forceNewNumbers) { if (uu.size() >= req.requestedCount) { // Just take the first req.requestedCount numbers from uu Iterator i = uu.iterator(); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java index d87469fd4..7b60d3689 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java @@ -35,4 +35,5 @@ public class RangeAllocationRequest extends AllocationRequest { public int requestedCount = 1; public boolean sequential = false; public boolean reverseOrder = false; + public boolean forceNewNumbers = false; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java index 4685233df..fdc8a2b15 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java @@ -76,15 +76,19 @@ public class RangeUtil { found = true; break; } + if (req.forceNewNumbers && rai.used.contains(num)) { + found = true; + break; + } } } - + if (!found) { good = true; break; } } - + return good; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index bba8e2b94..e7b855de7 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -21,6 +21,7 @@ package jtest.org.onap.ccsdk.sli.adaptors.ra; +import java.util.Date; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; @@ -31,10 +32,11 @@ public class DataSetup { private TestTable resource = null; private TestTable allocationItem = null; - private static final String[] RESOURCE_COLUMNS = {"asset_id", "resource_name", "resource_type", "lt_used"}; + private static final String[] RESOURCE_COLUMNS = + {"asset_id", "resource_name", "resource_type", "lt_used", "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", "allocation_time"}; + "resource_union_id", "resource_share_group_list", "lt_used", "rr_used", "allocation_time"}; private void initTables() { if (resource == null) { @@ -51,6 +53,37 @@ public class DataSetup { 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", used, null); + rid = resource.getLastId(); + } + allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, used, 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, used); + rid = resource.getLastId(); + } + allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, null, used, new Date()); + } + + public boolean checkRangeItem(String resourceName, String assetId, String resourceSetId, String used) { + String where = "resource_id = (SELECT resource_id FROM RESOURCE WHERE resource_name = '" + resourceName + + "' AND asset_id = '" + assetId + "') AND resource_set_id = '" + resourceSetId + "'"; + Object usedInDb = allocationItem.getColumn("rr_used", where); + return used.equals(usedInDb); + } + public void setTestDb(TestDb testDb) { this.testDb = testDb; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index c42007510..cdd95dcdf 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -240,398 +240,475 @@ public class TestReserve { }); } - - + + + @Test + public void test003() throws Exception { + String t = "003"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Cust"; + // rr.requestType = "New"; + // rr.rangeMaxOverride = 5; + // rr.rangeMinOverride = 5; + + List rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + + + @Test + public void test004() throws Exception { + String t = "004"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + List rrs = new ArrayList<>(); + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Cust"; + rrs.add(rr); + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Core1"; + rrs.add(rr); + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + rr.resourceName = "VPE-Core2"; + rrs.add(rr); + + + + List rsList = new ArrayList<>(); + // resourceAllocator.reserve(sd, rt, rrs, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + + @Test + public void test005() throws Exception { + String t = "005"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + // String service1 = "reserve" + t + "/service1"; + + dataSetup.cleanup(); + + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = + new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); + + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Cust"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "cust-vlan-id"); + + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + + + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.check-only", "false"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core2"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + ctx.setAttribute("ra-input.replace", "false"); + + + st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + resource.print(); + allocationItem.print(); + + + /* Query Using ReservationEntityId using ServiceLogicContext */ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); + + + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + + /* Query Using ReservationTargetId using ServiceLogicContext */ + ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); + ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); + + st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + log.info("======================== Query Using ResourceEntity=============================="); + /* Query Using ResourceEntity bean */ + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE-Core1"; + + + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL-1"; + rr.resourceName = "vlan-id-inner"; + rr.requestType = "New"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + List rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, null, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + /* + * log.info("======================== release Using ResourceEntity=============================="); + * rsList = new ArrayList(); AllocationStatus status = + * resourceAllocator.release(sd); Assert.assertTrue(status == AllocationStatus.Success); + * + * + * log.info("======================== Query Using ResourceEntity=============================="); + * rsList = new ArrayList(); resourceAllocator.query(sd, null, null, rsList); + * + * + * rsList.forEach(r -> { StrUtil.info(log, r); }); + */ + + } + + + @Test - public void test003() throws Exception { - String t = "003"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - ResourceEntity sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VNF"; - - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - ResourceRequest rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - rr.resourceName = "VPE-Cust"; - //rr.requestType = "New"; - //rr.rangeMaxOverride = 5; - //rr.rangeMinOverride = 5; - - List rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - log.info("======================== Query + t =============================="); - rsList = new ArrayList(); - resourceAllocator.query(sd, null, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - } - - - - - @Test - public void test004() throws Exception { - String t = "004"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - ResourceEntity sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VNF"; - - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - List rrs = new ArrayList(); - ResourceRequest rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - rr.resourceName = "VPE-Cust"; - rrs.add(rr); - - rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - rr.resourceName = "VPE-Core1"; - rrs.add(rr); - - rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - rr.resourceName = "VPE-Core2"; - rrs.add(rr); - - - - List rsList = new ArrayList(); - //resourceAllocator.reserve(sd, rt, rrs, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - log.info("======================== Query + t =============================="); - rsList = new ArrayList(); - resourceAllocator.query(sd, null, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - } - - - @Test - public void test005() throws Exception { - String t = "005"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - //String service1 = "reserve" + t + "/service1"; - - dataSetup.cleanup(); - - TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); - TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", - ALLOCATION_ITEM_COLUMNS); - - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); - ctx.setAttribute("ra-input.check-only", "false"); - ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Cust"); - ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); - - ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); - ctx.setAttribute("ra-input.reservation-target-type", "Site"); - - ctx.setAttribute("ra-input.resource-name", "cust-vlan-id"); - - - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - - resource.print(); - allocationItem.print(); - - ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); - ctx.setAttribute("ra-input.check-only", "false"); - ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); - ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); - - ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); - ctx.setAttribute("ra-input.reservation-target-type", "Site"); - - ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); - - - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - - resource.print(); - allocationItem.print(); - - ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); - ctx.setAttribute("ra-input.check-only", "false"); - ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core2"); - ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); - - ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); - ctx.setAttribute("ra-input.reservation-target-type", "Site"); - - ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); - ctx.setAttribute("ra-input.replace", "false"); - - - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); - - Assert.assertTrue(st == QueryStatus.SUCCESS); - - resource.print(); - allocationItem.print(); - - - /*Query Using ReservationEntityId using ServiceLogicContext*/ - ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); - ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); - ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); - - - st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); - Assert.assertTrue(st == QueryStatus.SUCCESS); - - - /*Query Using ReservationTargetId using ServiceLogicContext*/ - ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); - ctx.setAttribute("ra-input.reservation-target-id", "MDTWNJ21A5"); - ctx.setAttribute("ra-input.reservation-target-type", "Site"); - ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); - - st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); - Assert.assertTrue(st == QueryStatus.SUCCESS); - - log.info("======================== Query Using ResourceEntity=============================="); - /*Query Using ResourceEntity bean*/ - ResourceEntity sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE-Core1"; - - - ResourceRequest rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL-1"; - rr.resourceName = "vlan-id-inner"; - rr.requestType = "New"; - rr.rangeMaxOverride = -1; - rr.rangeMinOverride = -1; - - List rsList = new ArrayList(); - resourceAllocator.query(sd, null, null, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - /*log.info("======================== release Using ResourceEntity=============================="); - rsList = new ArrayList(); - AllocationStatus status = resourceAllocator.release(sd); - Assert.assertTrue(status == AllocationStatus.Success); - - - log.info("======================== Query Using ResourceEntity=============================="); - rsList = new ArrayList(); - resourceAllocator.query(sd, null, null, rsList); - - - rsList.forEach(r -> { - StrUtil.info(log, r); - });*/ - - } - - - - @Test - public void test006() throws Exception { - String t = "006"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - ResourceEntity sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE-Cust"; - - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - ResourceRequest rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL-1"; - rr.resourceName = "cust-vlan-id"; - - - List rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - log.info("======================== Query + t =============================="); - rsList = new ArrayList(); - resourceAllocator.query(sd, null, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - } - - @Test - public void test007() throws Exception { - String t = "007"; - log.info("============== reserve " + t + " ================================"); - log.info("=== Test successful response - new start - all resources available"); - - dataSetup.cleanup(); - - TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); - TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", - ALLOCATION_ITEM_COLUMNS); - - - ResourceEntity sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE"; - sd.resourceEntityVersion = "1"; - - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - ResourceRequest rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - //rr.resourceName = "vlan-id-outer"; - rr.endPointPosition="VPE-Cust"; - rr.rangeMaxOverride = -1; - rr.rangeMinOverride = -1; - - - List rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - //VPE-Core1 - sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE"; - sd.resourceEntityVersion = "1"; - - rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - //rr.resourceName = "vlan-id-filter"; - rr.endPointPosition="VPE-Core1"; - rr.rangeMaxOverride = -1; - rr.rangeMinOverride = -1; - - - rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - - //VPE-Core2 - sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE"; - sd.resourceEntityVersion = "1"; - - rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - //rr.resourceName = "vlan-id-filter"; - rr.endPointPosition="VPE-Core2"; - rr.rangeMaxOverride = -1; - rr.rangeMinOverride = -1; - - - rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - - //VPE-Core3 - sd = new ResourceEntity(); - sd.resourceEntityId = "gblond2003me6"; - sd.resourceEntityType = "VPE"; - sd.resourceEntityVersion = "1"; - - rt = new ResourceTarget(); - rt.resourceTargetId = "MDTWNJ21A5"; - rt.resourceTargetType = "Site"; - - - rr= new ResourceRequest(); - rr.serviceModel = "MY-SERV-MODEL"; - //rr.resourceName = "vlan-id-filter"; - rr.endPointPosition="VPE-Core3"; - rr.rangeMaxOverride = -1; - rr.rangeMinOverride = -1; - - - rsList = new ArrayList(); - resourceAllocator.reserve(sd, rt, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - resource.print(); - allocationItem.print(); - - log.info("======================== Query + t =============================="); - rsList = new ArrayList(); - resourceAllocator.query(sd, null, rr, rsList); - - rsList.forEach(r -> { - StrUtil.info(log, r); - }); - - - - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); - ctx.setAttribute("ra-input.reservation-entity-type", "VPE"); - - - QueryStatus st = resourceAllocator.release("NetworkCapacity", "gblond2003me6", ctx); - Assert.assertTrue(st == QueryStatus.SUCCESS); - - } + public void test006() throws Exception { + String t = "006"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE-Cust"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL-1"; + rr.resourceName = "cust-vlan-id"; + + + List rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + } + + @Test + public void test007() throws Exception { + String t = "007"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test successful response - new start - all resources available"); + + dataSetup.cleanup(); + + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = + new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); + + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + // rr.resourceName = "vlan-id-outer"; + rr.endPointPosition = "VPE-Cust"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + List rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + // VPE-Core1 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + // rr.resourceName = "vlan-id-filter"; + rr.endPointPosition = "VPE-Core1"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + + // VPE-Core2 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + // rr.resourceName = "vlan-id-filter"; + rr.endPointPosition = "VPE-Core2"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + + // VPE-Core3 + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VPE"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL"; + // rr.resourceName = "vlan-id-filter"; + rr.endPointPosition = "VPE-Core3"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + + + rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + resource.print(); + allocationItem.print(); + + log.info("======================== Query + t =============================="); + rsList = new ArrayList<>(); + resourceAllocator.query(sd, null, rr, rsList); + + rsList.forEach(r -> { + StrUtil.info(log, r); + }); + + + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); + ctx.setAttribute("ra-input.reservation-entity-type", "VPE"); + + + QueryStatus st = resourceAllocator.release("NetworkCapacity", "gblond2003me6", ctx); + Assert.assertTrue(st == QueryStatus.SUCCESS); + + } + + @Test + public void test008() throws Exception { + String t = "008"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-force-new-numbers = false"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "cust-vlan-id"; + + String assetId = "VNF::" + targetId; + String resourceUnion = "SI::" + entityId; + String resourceSet1 = resourceUnion + "::1"; + String resourceSet2 = resourceUnion + "::2"; + + dataSetup.cleanup(); + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet1, resourceUnion, "201"); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-force-new-numbers", "false"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId); + ctx.setAttribute("ra-input.reservation-entity-version", "2"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "VNF"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201")); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201")); + } + + @Test + public void test009() throws Exception { + String t = "009"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-force-new-numbers = true"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "cust-vlan-id"; + + String assetId = "VNF::" + targetId; + String resourceUnion = "SI::" + entityId; + String resourceSet1 = resourceUnion + "::1"; + String resourceSet2 = resourceUnion + "::2"; + + dataSetup.cleanup(); + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet1, resourceUnion, "201"); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "ADIG"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-force-new-numbers", "true"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId); + ctx.setAttribute("ra-input.reservation-entity-version", "2"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "VNF"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201")); + Assert.assertFalse(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201")); + } } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/DataSetup.java deleted file mode 100644 index 473a99f4c..000000000 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/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.onap.ccsdk.sli.adaptors.rm; - -import java.util.Date; - -import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb; -import jtest.util.org.onap.ccsdk.sli.adaptors.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; - } -} -- cgit 1.2.3-korg From 10188fc727feaa425aac9b5652ed69d691129be9 Mon Sep 17 00:00:00 2001 From: sp694w Date: Mon, 6 Aug 2018 06:49:54 -0400 Subject: RA: Add capability for Policy driven VlanTags Change-Id: I5486a4989006c80b8a77ff2eb64fceed068c0c16 Issue-ID: CCSDK-438 Signed-off-by: Saurav Paira --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 99 +++++++---- .../sli/adaptors/ra/alloc/DbAllocationRule.java | 67 ++++++- .../sli/adaptors/ra/comp/ResourceRequest.java | 7 + .../sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java | 10 +- .../onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java | 2 +- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 197 ++++++++++++++------- 6 files changed, 284 insertions(+), 98 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 0e4b9252d..385dae752 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -47,7 +47,8 @@ public class ResourceAllocator implements SvcLogicResource { private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); - private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; + private static final String[] INPUT_PREFIX = { "ra-input.", "tmp.resource-allocator." }; + private static final String START_RELEASE_LC = "Starting release for: {}"; private ResourceManager resourceManager; private EndPointAllocator endPointAllocator; @@ -98,16 +99,16 @@ public class ResourceAllocator implements SvcLogicResource { String orderBy, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, false, null); - String resourceEntityType = - getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, false, null); - String resourceEntityVersion = - getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); - - String resourceTargetId = - getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, false, null); - String resourceTargetType = - getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, false, null); + new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, false, null); + String resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, + false, null); + String resourceEntityVersion = getParam(ctx, + new String[] { "reservation-entity-version", "resource-entity-version" }, false, "1"); + + String resourceTargetId = getParam(ctx, new String[] { "reservation-target-id", "resource-target-id" }, false, + null); + String resourceTargetType = getParam(ctx, new String[] { "reservation-target-type", "resource-target-type" }, + false, null); String resourceName = getParam(ctx, "resource-name", false, null); if (resourceEntityId != null && resourceEntityType != null) { @@ -130,8 +131,8 @@ public class ResourceAllocator implements SvcLogicResource { sd.resourceEntityId, sd.resourceEntityVersion); setResourceDataInResponse(rdlist, rsList); } else if (rt.resourceTargetId != null && rt.resourceTargetType != null && rr.resourceName != null) { - ResourceData rd = - endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName); + ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, + rr.resourceName); setResourceDataInResponse(Collections.singletonList(rd), rsList); } @@ -179,19 +180,24 @@ public class ResourceAllocator implements SvcLogicResource { @Override public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); - String resourceEntityType = - getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); - String resourceEntityVersion = - getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, null); + new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, true, null); + String resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, + true, null); + String resourceEntityVersion = getParam(ctx, + new String[] { "reservation-entity-version", "resource-entity-version" }, false, null); + + String endPointPosition = getParam(ctx, "endpoint-position", false, null); ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = resourceEntityId; sd.resourceEntityType = resourceEntityType; sd.resourceEntityVersion = resourceEntityVersion; + ResourceRequest rr = new ResourceRequest(); + rr.endPointPosition = endPointPosition; + try { - this.release(sd); + this.release(sd, rr); } catch (Exception e) { throw new SvcLogicException(e.getMessage()); } @@ -202,12 +208,12 @@ public class ResourceAllocator implements SvcLogicResource { if (sd.resourceEntityVersion != null) { String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; - log.info("Starting release for: " + resourceSet); + log.info(START_RELEASE_LC, resourceSet); resourceManager.releaseResourceSet(resourceSet); } else { String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; - log.info("Starting release for: " + resourceUnion); + log.info(START_RELEASE_LC, resourceUnion); resourceManager.releaseResourceUnion(resourceUnion); } @@ -216,6 +222,39 @@ public class ResourceAllocator implements SvcLogicResource { } + public AllocationStatus release(ResourceEntity sd, ResourceRequest rr) throws Exception { + + if (sd != null && sd.resourceEntityVersion != null) { + if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { + String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition + + "::" + sd.resourceEntityVersion; + log.info(START_RELEASE_LC, resourceSet); + resourceManager.releaseResourceSet(resourceSet); + + } else { + String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + + sd.resourceEntityVersion; + log.info(START_RELEASE_LC, resourceSet); + resourceManager.releaseResourceSet(resourceSet); + } + + } else if (sd != null && (sd.resourceEntityVersion == null || sd.resourceEntityVersion.isEmpty())) { + if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { + String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition; + log.info(START_RELEASE_LC, resourceUnion); + resourceManager.releaseResourceUnion(resourceUnion); + + } else { + String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; + log.info(START_RELEASE_LC, resourceUnion); + resourceManager.releaseResourceUnion(resourceUnion); + } + } + + return AllocationStatus.Success; + + } + private QueryStatus allocateResources(SvcLogicContext ctx, boolean checkOnly, String prefix) throws SvcLogicException { String serviceModel = getParam(ctx, "service-model", true, null); @@ -321,20 +360,20 @@ public class ResourceAllocator implements SvcLogicResource { private ResourceEntity getResourceEntityData(SvcLogicContext ctx) throws SvcLogicException { ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); - sd.resourceEntityType = - getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); - sd.resourceEntityVersion = - getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); + new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, true, null); + sd.resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, true, + null); + sd.resourceEntityVersion = getParam(ctx, + new String[] { "reservation-entity-version", "resource-entity-version" }, false, "1"); sd.data = getDataParam(ctx, "reservation-entity-data", "resource-entity-data", "service-data"); return sd; } private ResourceTarget getResourceTargetData(SvcLogicContext ctx) throws SvcLogicException { ResourceTarget sd = new ResourceTarget(); - sd.resourceTargetId = getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, true, null); - sd.resourceTargetType = - getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, true, null); + sd.resourceTargetId = getParam(ctx, new String[] { "reservation-target-id", "resource-target-id" }, true, null); + sd.resourceTargetType = getParam(ctx, new String[] { "reservation-target-type", "resource-target-type" }, true, + null); sd.data = getDataParam(ctx, "reservation-target-data", "resource-target-data", "equipment-data"); return sd; } @@ -443,4 +482,4 @@ public class ResourceAllocator implements SvcLogicResource { public void setSpeedUtil(SpeedUtil speedUtil) { this.speedUtil = speedUtil; } -} +} \ No newline at end of file diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index b13ef80e8..12c02c858 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -38,6 +38,7 @@ import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; import org.onap.ccsdk.sli.adaptors.util.expr.ExpressionEvaluator; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.slf4j.Logger; @@ -92,6 +93,13 @@ public class DbAllocationRule implements AllocationRule { arlist.add(ar1); } + if ((rangeRuleList == null || rangeRuleList.isEmpty()) + && ResourceType.Range.equals(resourceRequest.resourceType)) { + AllocationRequest ar1 = buildAllocationRequest(resourceEntity, resourceTarget, resourceRequest, checkOnly, + change); + arlist.add(ar1); + } + if (arlist.isEmpty()) { return null; } @@ -106,6 +114,59 @@ public class DbAllocationRule implements AllocationRule { return ar; } + private AllocationRequest buildAllocationRequest(ResourceEntity resourceEntity, ResourceTarget resourceTarget, + ResourceRequest resourceRequest, boolean checkOnly, boolean change) { + + RangeAllocationRequest ar = new RangeAllocationRequest(); + ar.applicationId = resourceRequest.applicationId; + if (resourceRequest.endPointPosition != null) { + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + "::" + + resourceRequest.endPointPosition; + ar.endPointPosition = resourceRequest.endPointPosition; + } else { + ar.resourceUnionId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId; + } + ar.resourceSetId = ar.resourceUnionId + "::" + resourceEntity.resourceEntityVersion; + ar.resourceName = resourceRequest.resourceName; + if (resourceRequest.resourceShareGroup != null) { + ar.resourceShareGroupList = Collections.singleton(resourceRequest.resourceShareGroup); + } + ar.assetId = resourceTarget.resourceTargetType + "::" + resourceTarget.resourceTargetId; + ar.requestedNumbers = StrUtil.listInt(resourceRequest.rangeRequestedNumbers, + "Invalid value for requested-numbers"); + if (ar.requestedNumbers != null) { + ar.requestedCount = ar.requestedNumbers.size(); + } + ar.excludeNumbers = StrUtil.listInt(resourceRequest.rangeExcludeNumbers, "Invalid value for exclude-numbers"); + ar.reverseOrder = resourceRequest.rangeReverseOrder; + ar.missingResourceAction = AllocationAction.Succeed_Allocate; + ar.expiredResourceAction = AllocationAction.Succeed_Allocate; + ar.replace = resourceRequest.replace; + ar.check = true; + ar.allocate = !checkOnly; + ar.rangeList = resourceRequest.rangeOverrideList; + if (ar.rangeList == null || ar.rangeList.isEmpty()) { + if (resourceRequest.rangeMinOverride >= 0 + && resourceRequest.rangeMaxOverride >= resourceRequest.rangeMinOverride) { + ar.rangeList = new ArrayList<>(); + Range range = new Range(); + range.min = resourceRequest.rangeMinOverride; + range.max = resourceRequest.rangeMaxOverride; + ar.rangeList.add(range); + } + } else { + if (resourceRequest.rangeMinOverride >= 0) { + ar.rangeList.get(0).min = resourceRequest.rangeMinOverride; + } + if (resourceRequest.rangeMaxOverride >= 0) { + ar.rangeList.get(ar.rangeList.size() - 1).max = resourceRequest.rangeMaxOverride; + } + } + ar.forceNewNumbers = resourceRequest.rangeForceNewNumbers; + StrUtil.info(log, ar); + return ar; + } + private AllocationRequest buildAllocationRequest(ResourceRule resourceRule, ResourceEntity resourceEntity, ResourceTarget resourceTarget, ResourceRequest resourceRequest, boolean checkOnly, boolean change) { StrUtil.info(log, resourceRule); @@ -163,7 +224,8 @@ public class DbAllocationRule implements AllocationRule { ar.allocate = !checkOnly; ar.rangeList = rangeRule.rangeList; if (ar.rangeList == null || ar.rangeList.isEmpty()) { - if (resourceRequest.rangeMinOverride >= 0 && resourceRequest.rangeMaxOverride >= resourceRequest.rangeMinOverride) { + if (resourceRequest.rangeMinOverride >= 0 + && resourceRequest.rangeMaxOverride >= resourceRequest.rangeMinOverride) { ar.rangeList = new ArrayList<>(); Range range = new Range(); range.min = resourceRequest.rangeMinOverride; @@ -177,6 +239,7 @@ public class DbAllocationRule implements AllocationRule { if (resourceRequest.rangeMaxOverride >= 0) { ar.rangeList.get(ar.rangeList.size() - 1).max = resourceRequest.rangeMaxOverride; } + } ar.forceNewNumbers = resourceRequest.rangeForceNewNumbers; return ar; @@ -189,4 +252,4 @@ public class DbAllocationRule implements AllocationRule { public void setRangeRuleDao(RangeRuleDao rangeRuleDao) { this.rangeRuleDao = rangeRuleDao; } -} +} \ No newline at end of file diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index a52ce385d..36a137974 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -21,6 +21,11 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; +import java.util.List; + +import org.onap.ccsdk.sli.adaptors.rm.data.Range; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; + public class ResourceRequest { public String resourceName; @@ -37,4 +42,6 @@ public class ResourceRequest { public boolean checkOnly; public String applicationId; public String endPointPosition; + public ResourceType resourceType; + public List rangeOverrideList; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java index 4599314aa..b021620ba 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/rule/dao/RangeRuleDaoImpl.java @@ -40,8 +40,8 @@ public class RangeRuleDaoImpl implements RangeRuleDao { @Override public List getRangeRules(String serviceModel, String equipLevel) { - List rangeRuleList = - jdbcTemplate.query(GET_SQL, new Object[] {serviceModel, equipLevel}, (RowMapper) (rs, rowNum) -> { + return jdbcTemplate.query(GET_SQL, new Object[] { serviceModel, equipLevel }, + (RowMapper) (rs, rowNum) -> { RangeRule rl = new RangeRule(); rl.id = rs.getLong("range_rule_id"); rl.rangeName = rs.getString("range_name"); @@ -71,17 +71,17 @@ public class RangeRuleDaoImpl implements RangeRuleDao { } } if (nn.length > 2) { - log.warn("Invalid value found in DB for range: " + rangeStr); + log.warn("Invalid value found in DB for range: {}", rangeStr); } rl.rangeList.add(range); } return rl; }); - return rangeRuleList; + } public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } -} +} \ No newline at end of file diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java index fdc8a2b15..2e378f1aa 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/util/RangeUtil.java @@ -56,7 +56,7 @@ public class RangeUtil { if (req.rangeList != null && !req.rangeList.isEmpty()) { boolean good = false; for (Range range : req.rangeList) { - if (num < range.min || num > range.min) { + if (num < range.min || num > range.max) { continue; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index cdd95dcdf..168bdd729 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -1,6 +1,7 @@ package jtest.org.onap.ccsdk.sli.adaptors.ra; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -15,6 +16,8 @@ import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceResponse; import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; @@ -27,7 +30,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"classpath:test-context.xml"}) +@ContextConfiguration(locations = { "classpath:test-context.xml" }) @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestReserve { @@ -35,11 +38,10 @@ public class TestReserve { private JdbcTemplate jdbcTemplate; - 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 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" }; @Autowired public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { @@ -50,7 +52,8 @@ public class TestReserve { private ResourceAllocator resourceAllocator; /* - * @Autowired(required = true) private ResourceAllocatorApi resourceAllocatorApi; + * @Autowired(required = true) private ResourceAllocatorApi + * resourceAllocatorApi; */ @Autowired(required = true) @@ -67,9 +70,8 @@ public class TestReserve { dataSetup.cleanup(); TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); - TestTable allocationItem = - new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "ADIG"); @@ -86,7 +88,6 @@ public class TestReserve { ctx.setAttribute("ra-input.reservation-target-data.max-vpe-bandwidth-mbps", "5000"); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -106,7 +107,6 @@ public class TestReserve { ctx.setAttribute("ra-input.reservation-target-id", "ICORESITEID-123456"); ctx.setAttribute("ra-input.reservation-target-type", "Port"); - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -123,7 +123,6 @@ public class TestReserve { ctx.setAttribute("ra-input.reservation-target-id", "mdt300vpe54"); ctx.setAttribute("ra-input.reservation-target-type", "AffinityLink"); - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -131,18 +130,15 @@ public class TestReserve { resource.print(); allocationItem.print(); - /* Query Using ReservationEntityId using ServiceLogicContext */ ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "ADIG"); ctx.setAttribute("ra-input.reservation-entity-id", "ICOREPVCID-123456"); ctx.setAttribute("ra-input.reservation-entity-type", "SI"); - st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); - /* Query Using ReservationTargetId using ServiceLogicContext */ ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "ADIG"); @@ -159,7 +155,6 @@ public class TestReserve { sd.resourceEntityId = "ICOREPVCID-123456"; sd.resourceEntityType = "SI"; - ResourceRequest rr = new ResourceRequest(); rr.serviceModel = "ADIG"; rr.resourceName = "cust-vlan-id"; @@ -179,12 +174,10 @@ public class TestReserve { AllocationStatus status = resourceAllocator.release(sd); Assert.assertTrue(status == AllocationStatus.Success); - log.info("======================== Query Using ResourceEntity=============================="); rsList = new ArrayList<>(); resourceAllocator.query(sd, null, null, rsList); - rsList.forEach(r -> { StrUtil.info(log, r); }); @@ -241,7 +234,6 @@ public class TestReserve { } - @Test public void test003() throws Exception { String t = "003"; @@ -256,7 +248,6 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - ResourceRequest rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL"; rr.resourceName = "VPE-Cust"; @@ -281,8 +272,6 @@ public class TestReserve { } - - @Test public void test004() throws Exception { String t = "004"; @@ -313,8 +302,6 @@ public class TestReserve { rr.resourceName = "VPE-Core2"; rrs.add(rr); - - List rsList = new ArrayList<>(); // resourceAllocator.reserve(sd, rt, rrs, rsList); @@ -332,7 +319,6 @@ public class TestReserve { } - @Test public void test005() throws Exception { String t = "005"; @@ -344,9 +330,8 @@ public class TestReserve { dataSetup.cleanup(); TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); - TestTable allocationItem = - new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); @@ -359,7 +344,6 @@ public class TestReserve { ctx.setAttribute("ra-input.resource-name", "cust-vlan-id"); - QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -378,7 +362,6 @@ public class TestReserve { ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -398,7 +381,6 @@ public class TestReserve { ctx.setAttribute("ra-input.resource-name", "vlan-id-inner"); ctx.setAttribute("ra-input.replace", "false"); - st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -406,18 +388,15 @@ public class TestReserve { resource.print(); allocationItem.print(); - /* Query Using ReservationEntityId using ServiceLogicContext */ ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); ctx.setAttribute("ra-input.reservation-entity-type", "VPE-Core1"); - st = resourceAllocator.query("NetworkCapacity", false, null, null, null, null, ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); - /* Query Using ReservationTargetId using ServiceLogicContext */ ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL-1"); @@ -434,7 +413,6 @@ public class TestReserve { sd.resourceEntityId = "gblond2003me6"; sd.resourceEntityType = "VPE-Core1"; - ResourceRequest rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL-1"; rr.resourceName = "vlan-id-inner"; @@ -450,13 +428,17 @@ public class TestReserve { }); /* - * log.info("======================== release Using ResourceEntity=============================="); - * rsList = new ArrayList(); AllocationStatus status = - * resourceAllocator.release(sd); Assert.assertTrue(status == AllocationStatus.Success); + * log. + * info("======================== release Using ResourceEntity==============================" + * ); rsList = new ArrayList(); AllocationStatus status = + * resourceAllocator.release(sd); Assert.assertTrue(status == + * AllocationStatus.Success); * * - * log.info("======================== Query Using ResourceEntity=============================="); - * rsList = new ArrayList(); resourceAllocator.query(sd, null, null, rsList); + * log. + * info("======================== Query Using ResourceEntity==============================" + * ); rsList = new ArrayList(); resourceAllocator.query(sd, + * null, null, rsList); * * * rsList.forEach(r -> { StrUtil.info(log, r); }); @@ -464,8 +446,6 @@ public class TestReserve { } - - @Test public void test006() throws Exception { String t = "006"; @@ -480,12 +460,10 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - ResourceRequest rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL-1"; rr.resourceName = "cust-vlan-id"; - List rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -512,9 +490,8 @@ public class TestReserve { dataSetup.cleanup(); TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); - TestTable allocationItem = - new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", ALLOCATION_ITEM_COLUMNS); - + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = "gblond2003me6"; @@ -525,7 +502,6 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - ResourceRequest rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL"; // rr.resourceName = "vlan-id-outer"; @@ -533,7 +509,6 @@ public class TestReserve { rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; - List rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -547,7 +522,6 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL"; // rr.resourceName = "vlan-id-filter"; @@ -555,11 +529,9 @@ public class TestReserve { rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; - rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); - // VPE-Core2 sd = new ResourceEntity(); sd.resourceEntityId = "gblond2003me6"; @@ -570,7 +542,6 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL"; // rr.resourceName = "vlan-id-filter"; @@ -578,11 +549,9 @@ public class TestReserve { rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; - rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); - // VPE-Core3 sd = new ResourceEntity(); sd.resourceEntityId = "gblond2003me6"; @@ -593,7 +562,6 @@ public class TestReserve { rt.resourceTargetId = "MDTWNJ21A5"; rt.resourceTargetType = "Site"; - rr = new ResourceRequest(); rr.serviceModel = "MY-SERV-MODEL"; // rr.resourceName = "vlan-id-filter"; @@ -601,7 +569,6 @@ public class TestReserve { rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; - rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -620,13 +587,10 @@ public class TestReserve { StrUtil.info(log, r); }); - - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.reservation-entity-id", "gblond2003me6"); ctx.setAttribute("ra-input.reservation-entity-type", "VPE"); - QueryStatus st = resourceAllocator.release("NetworkCapacity", "gblond2003me6", ctx); Assert.assertTrue(st == QueryStatus.SUCCESS); @@ -711,4 +675,117 @@ public class TestReserve { Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201")); Assert.assertFalse(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201")); } + + @Test + public void test0010_vlantag_with_resourcemodel() throws Exception { + + String t = "0010"; + log.info("============== reserve " + t + " ================================"); + + dataSetup.cleanup(); + + TestTable resource = new TestTable(jdbcTemplate, "RESOURCE", "resource_id", RESOURCE_COLUMNS); + TestTable allocationItem = new TestTable(jdbcTemplate, "ALLOCATION_ITEM", "allocation_item_id", + ALLOCATION_ITEM_COLUMNS); + + ResourceEntity sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + sd.resourceEntityVersion = "1"; + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + ResourceRequest rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL_3456"; + rr.resourceName = "vlan-id-outer"; + rr.endPointPosition = "VPE-Core1"; + rr.rangeMaxOverride = 3901; + rr.rangeMinOverride = 3900; + rr.resourceType = ResourceType.Range; + + List rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + resource.print(); + allocationItem.print(); + + Range range = new Range(); + range.min = 3900; + range.max = 3901; + + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL_3456"; + rr.resourceName = "vlan-id-outer"; + rr.endPointPosition = "VPE-Core2"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + rr.rangeOverrideList = Arrays.asList(range); + rr.resourceType = ResourceType.Range; + + rsList = new ArrayList<>(); + resourceAllocator.reserve(sd, rt, rr, rsList); + + resource.print(); + allocationItem.print(); + + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + sd.resourceEntityVersion = "1"; + + rt = new ResourceTarget(); + rt.resourceTargetId = "MDTWNJ21A5"; + rt.resourceTargetType = "Site"; + + Range range1 = new Range(); + range1.min = 3900; + range1.max = 3901; + + Range range2 = new Range(); + range2.min = 3904; + range2.max = 3905; + + rr = new ResourceRequest(); + rr.serviceModel = "MY-SERV-MODEL_3456"; + rr.resourceName = "vlan-id-outer"; + rr.endPointPosition = "VPE-Core3"; + rr.rangeMaxOverride = -1; + rr.rangeMinOverride = -1; + rr.rangeOverrideList = new ArrayList<>(); + rr.rangeOverrideList.add(range1); + rr.rangeOverrideList.add(range2); + rr.resourceType = ResourceType.Range; + + rsList = new ArrayList<>(); + AllocationStatus status = resourceAllocator.reserve(sd, rt, rr, rsList); + Assert.assertTrue(status == AllocationStatus.Success); + + resource.print(); + allocationItem.print(); + + sd = new ResourceEntity(); + sd.resourceEntityId = "gblond2003me6"; + sd.resourceEntityType = "VNF"; + sd.resourceEntityVersion = "1"; + + rr = new ResourceRequest(); + rr.endPointPosition = "VPE-Core2"; + status = resourceAllocator.release(sd, rr); + Assert.assertTrue(status == AllocationStatus.Success); + + resource.print(); + allocationItem.print(); + + } } -- cgit 1.2.3-korg From b46892cf1f0374dc18bec49b6a209b0e6a13ba1a Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Fri, 14 Sep 2018 15:25:55 -0400 Subject: RA: Expose resource locking as DG node Change-Id: Ic12c8c7c59baf29630dab442de64a66dc40bc02e Issue-ID: CCSDK-573 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceLockNode.java | 93 ++++++++++++++++++++++ .../blueprint/resource-assignment-blueprint.xml | 2 + .../opendaylight/blueprint/resource-assignment.xml | 4 + .../sli/adaptors/ra/TestResourceLockNode.java | 35 ++++++++ .../provider/src/test/resources/test-context.xml | 3 + 5 files changed, 137 insertions(+) create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java new file mode 100644 index 000000000..d1ba1eb76 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java @@ -0,0 +1,93 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.ra; + +import java.security.SecureRandom; +import java.util.Map; +import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ResourceLockNode implements SvcLogicJavaPlugin { + + private static final Logger log = LoggerFactory.getLogger(ResourceLockNode.class); + + private LockHelper lockHelper; + + public void setLockHelper(LockHelper lockHelper) { + this.lockHelper = lockHelper; + } + + public void lockResource(Map paramMap, SvcLogicContext ctx) throws SvcLogicException { + String resourceName = getParam(paramMap, "resource-name", true, null); + String lockRequester = getParam(paramMap, "lock-requester", false, generateLockRequester()); + String lockTimeoutStr = getParam(paramMap, "lock-timeout", false, "600"); // Default lock timeout: 10 min + int lockTimeout = Integer.parseInt(lockTimeoutStr); + + lockHelper.lock(resourceName, lockRequester, lockTimeout); + } + + public void unlockResource(Map paramMap, SvcLogicContext ctx) throws SvcLogicException { + String resourceName = getParam(paramMap, "resource-name", true, null); + + lockHelper.unlock(resourceName, false); + } + + public void lockResource(String resourceName, String lockRequester, int lockTimeout /* sec */) { + if (lockRequester == null) { + lockRequester = generateLockRequester(); + } + if (lockTimeout <= 0) { + lockTimeout = 600; + } + + lockHelper.lock(resourceName, lockRequester, lockTimeout); + } + + public void unlockResource(String resourceName) { + lockHelper.unlock(resourceName, false); + } + + private String getParam(Map paramMap, String name, boolean required, String def) + throws SvcLogicException { + String v = paramMap.get(name); + if (v != null && v.trim().length() > 0) { + log.info("Param: " + name + ": " + v.trim()); + return v.trim(); + } + if (required) { + throw new SvcLogicException("The following node parameter is required: " + name); + } + + log.info("Param: " + name + " not supplied. Using default: " + def); + return def; + } + + private static String generateLockRequester() { + SecureRandom rand = new SecureRandom(); + return "SynchronizedFunction-" + (int) (rand.nextDouble() * 1000000); + } +} + diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml index 11c284d64..77c316d2a 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml @@ -28,4 +28,6 @@ + + diff --git a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml index 3fba3c781..7fcc70c54 100755 --- a/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml +++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml @@ -98,6 +98,10 @@ + + + + diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java new file mode 100644 index 000000000..377257c41 --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java @@ -0,0 +1,35 @@ +package jtest.org.onap.ccsdk.sli.adaptors.ra; + +import java.util.HashMap; +import java.util.Map; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode; +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 TestResourceLockNode { + + @SuppressWarnings("unused") + private static final Logger log = LoggerFactory.getLogger(TestResourceLockNode.class); + + @Autowired + private ResourceLockNode resourceLockNode; + + @Test + public void test1() throws Exception { + Map paramMap = new HashMap<>(); + paramMap.put("resource-name", "test-resource-1"); + + resourceLockNode.lockResource(paramMap, null); + resourceLockNode.unlockResource(paramMap, null); + } +} diff --git a/resource-assignment/provider/src/test/resources/test-context.xml b/resource-assignment/provider/src/test/resources/test-context.xml index 32b54e9e4..ecebec723 100644 --- a/resource-assignment/provider/src/test/resources/test-context.xml +++ b/resource-assignment/provider/src/test/resources/test-context.xml @@ -122,6 +122,9 @@ + + + -- cgit 1.2.3-korg From d00cb60e14581d0596cd326bdfb45cb5cea94e28 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 25 Sep 2018 19:51:37 -0400 Subject: Prepare for release version Update to use released parent pom and remove -STAGING from release version. Change-Id: I41fbd91a0ccddf9386ac9985d6272d952c5f80ed Issue-ID: CCSDK-597 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 7 ++++++- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 7 ++++++- .../features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 12 +++++++++++- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 7 ++++++- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 7 ++++++- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- .../features/ccsdk-resource-assignment/pom.xml | 7 ++++++- .../features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../ccsdk-saltstack-adapter/pom.xml | 2 +- .../features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 7 ++++++- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- version.properties | 2 +- 48 files changed, 88 insertions(+), 48 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index f277788e9..f7743f037 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -17,6 +17,11 @@ feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + + + true + + diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 3a38d79de..eb9e7c6db 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 63c5e17ca..c72048651 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 1e951f80e..ae160f2e7 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 9a9436345..a721b6cc4 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 0324ab3d3..3be83b8cd 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index ae5d9a1f3..18f377538 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 5c6748025..ebfe08700 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -15,6 +15,11 @@ feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} + + + true + + diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 55a42e9d4..52afb65f6 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index a40e70d3a..d7c35e7cb 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.0-SNAPSHOT + 1.1.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 02262acfe..f4113d2e1 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index fb2b83a95..9d5b425c4 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 64bc2605a..6091e1d5e 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -17,6 +17,11 @@ feature ccsdk-sli-adaptors :: features :: ${project.artifactId} + + + true + + @@ -33,6 +38,11 @@ pom import + + org.onap.ccsdk.sli.adaptors + aai-service-provider + ${project.version} + diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index de1b9b8d8..28c71bc8f 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index be20d9f5c..47a4c8a31 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/features/pom.xml b/features/pom.xml index 5fb7be025..e254970b7 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 5c4ed4c78..ce1c19c8e 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -17,6 +17,11 @@ feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + true + + diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 0b4e7c83c..2d32623ff 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 051bd80c5..2a2eda0ed 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index b4203b21b..534a97663 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 003e8bb7a..260dcad81 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 94dc3ab6c..52c0abca3 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index e2f0bb2e9..9087ec9ed 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -32,6 +32,11 @@ ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + + true + + + org.opendaylight.controller diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index f775d6c67..2f6be0f80 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index df5c3e1ea..8147ee197 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 04ab0ed72..acb1dfaab 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index d16f0573e..f626611e6 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index e4e22463a..2c677b9c3 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/pom.xml b/pom.xml index 9f650c083..b7027599c 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 509620f38..e132127ff 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -16,6 +16,11 @@ feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + + true + + diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 8b08563cd..2b11c7aa8 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 4ded5a1fa..9a6a7e5eb 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 40e7bce69..19ed1b198 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 746a44747..7233b49fa 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 5f6e54f94..0361c26cb 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index b216db5c5..ff18f5ff6 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -30,7 +30,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index bdcb052ab..a7adac3a9 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 703949c06..b70aedaa3 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 7f7885991..3e5c58db6 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.0-SNAPSHOT + 1.1.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index db72000fc..787983b87 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 4c7646d63..4a21ee0bd 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,7 +18,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index f96a7245d..94b66f719 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0-SNAPSHOT + 1.1.0 @@ -16,6 +16,11 @@ feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + + true + + diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 000f87879..8e1074bf2 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 4a99dc10b..2d3496076 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index fff8559fc..09c4ca16b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 13c365c37..538c6be60 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 2e26088bc..67fc93b57 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.0-SNAPSHOT + 1.1.0 diff --git a/version.properties b/version.properties index f9fd33500..881489379 100644 --- a/version.properties +++ b/version.properties @@ -9,6 +9,6 @@ feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version}-STAGING +release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From 58df303dbd3192d391bb77c96a75ecf5e88f73cd Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 26 Sep 2018 15:06:23 -0400 Subject: Roll to next snapshot Roll to next snapshot release Change-Id: I635702b1ef321150741607ec4082f50ca1d9eee3 Issue-ID: CCSDK-597 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 7 ++----- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 8 ++------ .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 7 ++----- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 8 ++------ mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- netbox-client/features/ccsdk-netbox-client/pom.xml | 8 ++------ netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 7 ++----- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 8 ++------ sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 4 ++-- 48 files changed, 96 insertions(+), 121 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index f7743f037..250c3a909 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -7,20 +7,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - true - diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index eb9e7c6db..4cc9ff557 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index c72048651..af47c58c3 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index ae160f2e7..64853b63f 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index a721b6cc4..af48a77e6 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 3be83b8cd..6bd1077c7 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 18f377538..a096882fe 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index ebfe08700..ec09902c2 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,21 +5,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} - - true - - diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 52afb65f6..3099586d0 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index d7c35e7cb..809df33c3 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index f4113d2e1..65d9fe305 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 9d5b425c4..b682f1a92 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 6091e1d5e..503a62138 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -7,20 +7,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} - - true - diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 28c71bc8f..78b17c6e7 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 47a4c8a31..c5cf1045d 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index e254970b7..04c71846c 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index ce1c19c8e..ef564a84d 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -7,21 +7,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - - true - - diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 2d32623ff..3e85e1c7e 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 2a2eda0ed..8554f4a50 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 534a97663..89d4ddd76 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 260dcad81..839c64e64 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 52c0abca3..d5f41807e 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 9087ec9ed..bc957a4ce 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -21,21 +21,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - - true - - diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 2f6be0f80..4a6897256 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 8147ee197..920607773 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index acb1dfaab..68a801ee2 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index f626611e6..23609bcba 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 2c677b9c3..fc37ea196 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index b7027599c..c9d2803fd 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT 4.0.0 @@ -120,7 +120,7 @@ ONAP - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index e132127ff..497dca4ba 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,20 +6,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - - true - diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 2b11c7aa8..9f26223e5 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 9a6a7e5eb..a621519cb 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 19ed1b198..0f07de6af 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 7233b49fa..45b9f5f17 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 0361c26cb..06b8aa74a 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index ff18f5ff6..dd45c01b4 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -30,13 +30,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index a7adac3a9..ba2dcfb4c 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index b70aedaa3..9806b42ef 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 3e5c58db6..4e4477919 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 787983b87..011bcf0d6 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,12 +29,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 4a21ee0bd..0bf433736 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 94b66f719..f1960dc03 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,21 +6,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - true - - diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 8e1074bf2..21ad63019 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 2d3496076..f922f42de 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 09c4ca16b..9fd14690d 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 538c6be60..1d80715b3 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 67fc93b57..2b8a2ceb4 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.0 + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 881489379..36aa8e3f6 100644 --- a/version.properties +++ b/version.properties @@ -5,10 +5,10 @@ release_name=0 sprint_number=3 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version} +release_version=${base_version}-STAGING snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From 258216bfca01a583c6a86359a5eead8a339e2fc5 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 11 Oct 2018 16:14:59 -0400 Subject: Prepare for RC0 release Update to prepare for RC0 release build: remove -STAGING tag from release version and use released parent poms. Change-Id: I5e07d7af8381af1f22b8288965d400f95eb92abf Issue-ID: CCSDK-617 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- version.properties | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 250c3a909..8dac8c43d 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 4cc9ff557..91881c85e 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index af47c58c3..46932fe20 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 64853b63f..a5c8e994a 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index af48a77e6..38e0d0674 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 6bd1077c7..7804c9776 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index a096882fe..72fd9de26 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index ec09902c2..9d99785de 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 3099586d0..9b08f4d64 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 809df33c3..221484e4d 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.1-SNAPSHOT + 1.1.1 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 65d9fe305..b66d9d712 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index b682f1a92..4ab530e5f 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,7 +28,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 503a62138..d55889056 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 78b17c6e7..abf0488c2 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index c5cf1045d..ca3bb0a19 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/features/pom.xml b/features/pom.xml index 04c71846c..fa07f9fa5 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index ef564a84d..e8d383ee4 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 3e85e1c7e..f2b8adbdd 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 8554f4a50..c3ac9cfe1 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 89d4ddd76..ffb8ddbee 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 839c64e64..afad0727f 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index d5f41807e..78014fedd 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index bc957a4ce..6a17707fb 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 4a6897256..af1757192 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 920607773..6d2cb3c3a 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 68a801ee2..b4d121e03 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 23609bcba..5ba8cf1d5 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index fc37ea196..27966f15e 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,7 +21,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/pom.xml b/pom.xml index c9d2803fd..730132c59 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 497dca4ba..9dc699b0d 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 9f26223e5..e5f35bb72 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index a621519cb..c107f27b3 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 0f07de6af..d0b86040a 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 45b9f5f17..cc81fcaac 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 06b8aa74a..8c6761bd5 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index dd45c01b4..a8919f761 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -30,7 +30,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index ba2dcfb4c..69e597cee 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 9806b42ef..fe20c4e2d 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -7,7 +7,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 4e4477919..0a8171ecd 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -17,7 +17,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.1-SNAPSHOT + 1.1.1 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 011bcf0d6..5971b3529 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 0bf433736..227a0c931 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,7 +18,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index f1960dc03..cd11c47ca 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 21ad63019..035ceaf9e 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index f922f42de..761d17eda 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 9fd14690d..8ea9d2ac8 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 1d80715b3..d603ef86b 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 2b8a2ceb4..23bb49718 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,7 +6,7 @@ org.onap.ccsdk.parent binding-parent - 1.1.1-SNAPSHOT + 1.1.1 diff --git a/version.properties b/version.properties index 36aa8e3f6..9f280ea3e 100644 --- a/version.properties +++ b/version.properties @@ -9,6 +9,6 @@ feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version}-STAGING +release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From 74e0d6cdac309204f740e43befdab3426d4cd1ec Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 23 Oct 2018 08:30:01 -0400 Subject: Roll to initial Dublin snapshot Roll version to initial Dublin snapshot Change-Id: I2b1b5aaa6919c9259d46d2988fb65836f47a3bf9 Issue-ID: CCSDK-617 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 6 +++--- 48 files changed, 96 insertions(+), 96 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 8dac8c43d..e7460112b 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 91881c85e..742e006db 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 46932fe20..787c56234 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index a5c8e994a..dbc793fc8 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 38e0d0674..7b1d5535a 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 7804c9776..441143263 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 72fd9de26..858d22737 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 9d99785de..7f770ac9f 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 9b08f4d64..f073f181b 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 221484e4d..be9e9afe0 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index b66d9d712..556f85dd5 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 4ab530e5f..ffcead8f7 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -28,13 +28,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index d55889056..367c48f6b 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index abf0488c2..eeffd8be2 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index ca3bb0a19..06f306324 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index fa07f9fa5..4a673deb8 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index e8d383ee4..12779d266 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index f2b8adbdd..9d4c8bb32 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index c3ac9cfe1..6f1838790 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index ffb8ddbee..77cb421ab 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index afad0727f..bc9ea8f00 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 78014fedd..f6f65bd82 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 6a17707fb..85e50454f 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index af1757192..93711e02e 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 6d2cb3c3a..cc602b3db 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index b4d121e03..ed63472b0 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 5ba8cf1d5..efbc63769 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 27966f15e..d1de7ab21 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index 730132c59..02168f647 100755 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT 4.0.0 @@ -120,7 +120,7 @@ ONAP - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT
diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 9dc699b0d..b1ae5d3b1 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index e5f35bb72..b830c06e9 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index c107f27b3..5c51b266d 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index d0b86040a..1aee9696d 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index cc81fcaac..5ed3df9aa 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 8c6761bd5..dfb0885c6 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index a8919f761..8f58b89d1 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -30,13 +30,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 69e597cee..67bc40f9c 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index fe20c4e2d..44f156fca 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -7,13 +7,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 0a8171ecd..1ed6bb870 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -17,12 +17,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 5971b3529..5a7d58205 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,12 +29,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 227a0c931..5308dc145 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cd11c47ca..e691dbad5 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 035ceaf9e..e2dad22a3 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 761d17eda..4aed70a1f 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -12,7 +12,7 @@ org.onap.ccsdk.sli.adaptors sql-resource-features - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 8ea9d2ac8..0a074e3e9 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index d603ef86b..8b163779f 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 23bb49718..640e089b8 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -6,13 +6,13 @@ org.onap.ccsdk.parent binding-parent - 1.1.1 + 1.2.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.3.1-SNAPSHOT + 0.4.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 9f280ea3e..7439a509f 100644 --- a/version.properties +++ b/version.properties @@ -4,11 +4,11 @@ # because they are used in Jenkins, whose plug-in doesn't support release_name=0 -sprint_number=3 -feature_revision=1 +sprint_number=4 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version} +release_version=${base_version}-STAGING snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From f9865fbaaffa841172ca0ae8e5c05cb95d1c7d0c Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Fri, 19 Oct 2018 10:24:06 -0400 Subject: RA: New criteria for querying allocated resources Change-Id: Ia3a4b162ea4eca51ba7c500ad5daaa3865e26314 Issue-ID: CCSDK-620 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 19 +- .../sli/adaptors/ra/comp/EndPointAllocator.java | 3 +- .../adaptors/ra/comp/EndPointAllocatorImpl.java | 25 +- .../sli/adaptors/ra/comp/ResourceRequest.java | 4 +- .../sli/adaptors/rm/comp/ResourceManager.java | 7 +- .../sli/adaptors/rm/comp/ResourceManagerImpl.java | 8 + .../ccsdk/sli/adaptors/rm/dao/ResourceDao.java | 7 +- .../rm/dao/jdbc/AllocationItemJdbcDao.java | 6 +- .../rm/dao/jdbc/AllocationItemJdbcDaoImpl.java | 61 +++-- .../sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 32 ++- .../org/onap/ccsdk/sli/adaptors/ra/DataSetup.java | 9 +- .../ccsdk/sli/adaptors/ra/TestGetResource.java | 259 +++++++++++++++++++++ 12 files changed, 392 insertions(+), 48 deletions(-) create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 385dae752..5dab1738e 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -110,13 +110,17 @@ public class ResourceAllocator implements SvcLogicResource { String resourceTargetType = getParam(ctx, new String[] { "reservation-target-type", "resource-target-type" }, false, null); String resourceName = getParam(ctx, "resource-name", false, null); + String resourceEntityTypeFilter = getParam(ctx, "resource-entity-type-filter", false, null); + String resourceEntityIdFilter = getParam(ctx, "resource-entity-id-filter", false, null); + String resourceShareGroupFilter = getParam(ctx, "resource-share-group-filter", false, null); if (resourceEntityId != null && resourceEntityType != null) { List rdlist = endPointAllocator.getResourcesForEntity(resourceEntityType, resourceEntityId, resourceEntityVersion); setResourceDataInContext(ctx, prefix, rdlist); } else if (resourceTargetId != null && resourceTargetType != null && resourceName != null) { - ResourceData rd = endPointAllocator.getResource(resourceTargetType, resourceTargetId, resourceName); + ResourceData rd = endPointAllocator.getResource(resourceTargetType, resourceTargetId, resourceName, + resourceEntityTypeFilter, resourceEntityIdFilter, resourceShareGroupFilter); setResourceDataInContext(ctx, prefix, Collections.singletonList(rd)); } @@ -126,13 +130,14 @@ public class ResourceAllocator implements SvcLogicResource { public AllocationStatus query(ResourceEntity sd, ResourceTarget rt, ResourceRequest rr, List rsList) throws Exception { - if (sd.resourceEntityId != null && sd.resourceEntityType != null) { + if (sd != null && sd.resourceEntityId != null && sd.resourceEntityType != null) { List rdlist = endPointAllocator.getResourcesForEntity(sd.resourceEntityType, sd.resourceEntityId, sd.resourceEntityVersion); setResourceDataInResponse(rdlist, rsList); - } else if (rt.resourceTargetId != null && rt.resourceTargetType != null && rr.resourceName != null) { - ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, - rr.resourceName); + } else if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null && rr != null + && rr.resourceName != null) { + ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName, + rr.resourceEntityTypeFilter, rr.resourceEntityIdFilter, rr.resourceShareGroupFilter); setResourceDataInResponse(Collections.singletonList(rd), rsList); } @@ -232,8 +237,8 @@ public class ResourceAllocator implements SvcLogicResource { resourceManager.releaseResourceSet(resourceSet); } else { - String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" - + sd.resourceEntityVersion; + String resourceSet = + sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; log.info(START_RELEASE_LC, resourceSet); resourceManager.releaseResourceSet(resourceSet); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java index c6461d496..dbc2a31dc 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java @@ -31,5 +31,6 @@ public interface EndPointAllocator { List getResourcesForEntity(String resourceEntityType, String resourceEntityId, String resourceEntityVersion); - ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName); + ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName, + String resourceEntityTypeFilter, String resourceEntityIdFilter, String resourceShareGroupFilter); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 952ceb6bd..36891fef1 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory; public class EndPointAllocatorImpl implements EndPointAllocator { private static final Logger log = LoggerFactory.getLogger(EndPointAllocatorImpl.class); - + private ResourceManager resourceManager; private Map> allocationRuleMap; @@ -204,10 +204,27 @@ public class EndPointAllocatorImpl implements EndPointAllocator { } @Override - public ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName) { - ResourceData rd = new ResourceData();; + public ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName, + String resourceEntityTypeFilter, String resourceEntityIdFilter, String resourceShareGroupFilter) { + ResourceData rd = new ResourceData(); String assetId = resourceTargetType + "::" + resourceTargetId; - Resource r = resourceManager.getResource(resourceName, assetId); + + String resourceUnionFilter = null; + if (resourceEntityTypeFilter != null && resourceEntityIdFilter != null) { + resourceUnionFilter = resourceEntityTypeFilter + "::" + resourceEntityIdFilter; + } else if (resourceEntityTypeFilter != null) { + resourceUnionFilter = resourceEntityTypeFilter; + } else if (resourceEntityIdFilter != null) { + resourceUnionFilter = resourceEntityIdFilter; + } + + Resource r = null; + if (resourceUnionFilter != null || resourceShareGroupFilter != null) { + r = resourceManager.queryResource(resourceName, assetId, resourceUnionFilter, resourceShareGroupFilter); + } else { + r = resourceManager.getResource(resourceName, assetId); + } + if (r != null) { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index 36a137974..e8bc5ad9d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -22,7 +22,6 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; import java.util.List; - import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; @@ -44,4 +43,7 @@ public class ResourceRequest { public String endPointPosition; public ResourceType resourceType; public List rangeOverrideList; + public String resourceEntityTypeFilter; + public String resourceEntityIdFilter; + public String resourceShareGroupFilter; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java index 8aaa28687..b40e47582 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,6 @@ package org.onap.ccsdk.sli.adaptors.rm.comp; import java.util.List; - import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; @@ -38,4 +37,6 @@ public interface ResourceManager { void releaseResourceSet(String resourceSetId); void releaseResourceUnion(String resourceUnionId); + + Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, String resourceShareGroupFilter); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java index 77d8a6819..d5225b12f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -105,6 +105,14 @@ public class ResourceManagerImpl implements ResourceManager { releaseFunction.exec(); } + @Override + public Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, + String resourceShareGroupFilter) { + Resource r = resourceDao.query(assetId, resourceName, resourceUnionFilter, resourceShareGroupFilter); + ResourceUtil.recalculate(r); + return r; + } + private Set getLockNames(List resourceList) { Set lockNames = new HashSet<>(); for (Resource r : resourceList) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java index 18d6d45c7..bb4b64528 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,6 @@ package org.onap.ccsdk.sli.adaptors.rm.dao; import java.util.List; - import org.onap.ccsdk.sli.adaptors.rm.data.Resource; public interface ResourceDao { @@ -36,4 +35,6 @@ public interface ResourceDao { List getResourceSet(String resourceSetId); List getResourceUnion(String resourceUnionId); + + Resource query(String assetId, String resourceName, String resourceUnionFilter, String resourceShareGroupFilter); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java index fab61b39a..8e3a12988 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,4 +32,6 @@ public interface AllocationItemJdbcDao { void update(AllocationItem ai); void delete(long id); + + List queryAllocationItems(long resourceId, String resourceUnionFilter, String resourceShareGroupFilter); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java index 354dd4e0b..fcde0f8f1 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,14 +21,12 @@ package org.onap.ccsdk.sli.adaptors.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; @@ -59,22 +57,18 @@ public class AllocationItemJdbcDaoImpl implements AllocationItemJdbcDao { @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; - } + PreparedStatementCreator psc = dbc -> { + 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); @@ -95,12 +89,37 @@ public class AllocationItemJdbcDaoImpl implements AllocationItemJdbcDao { @Override public List getAllocationItems(long resourceId) { - if (resourceId <= 0) + if (resourceId <= 0) { return Collections.emptyList(); + } return jdbcTemplate.query(GET_SQL, new Object[] { resourceId }, allocationItemRowMapper); } + @Override + public List queryAllocationItems(long resourceId, String resourceUnionFilter, + String resourceShareGroupFilter) { + if (resourceId <= 0) { + return Collections.emptyList(); + } + + String sql = GET_SQL; + + if (resourceUnionFilter != null) { + sql += " AND resource_union_id LIKE '" + resourceUnionFilter + "'"; + } + + if (resourceShareGroupFilter != null) { + if (resourceShareGroupFilter.equalsIgnoreCase("null")) { + sql += " AND resource_share_group_list IS NULL"; + } else { + sql += " AND resource_share_group_list LIKE '" + resourceShareGroupFilter + "'"; + } + } + + return jdbcTemplate.query(sql, new Object[] { resourceId }, allocationItemRowMapper); + } + private static class AllocationItemRowMapper implements RowMapper { @Override diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index e202de778..7deec9223 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -65,6 +65,32 @@ public class ResourceDaoImpl implements ResourceDao { return r; } + @Override + public org.onap.ccsdk.sli.adaptors.rm.data.Resource query(String assetId, String resourceName, + String resourceUnionFilter, String resourceShareGroupFilter) { + Resource rEntity = resourceJdbcDao.getResource(assetId, resourceName); + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + + if (r != null) { + List aiEntityList = allocationItemJdbcDao.queryAllocationItems(rEntity.id, + resourceUnionFilter, resourceShareGroupFilter); + r.allocationItems = new ArrayList<>(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); + r.resourceLoadList.add(rl); + } + } + + return r; + } + @Override public void saveResource(org.onap.ccsdk.sli.adaptors.rm.data.Resource resource) { if (resource == null) { @@ -201,8 +227,7 @@ public class ResourceDaoImpl implements ResourceDao { @Override public List getResourceSet(String resourceSetId) { List rEntityList = resourceJdbcDao.getResourceSet(resourceSetId); - List rlist = - new ArrayList<>(); + List rlist = new ArrayList<>(); for (Resource rEntity : rEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); rlist.add(r); @@ -227,8 +252,7 @@ public class ResourceDaoImpl implements ResourceDao { @Override public List getResourceUnion(String resourceUnionId) { List rEntityList = resourceJdbcDao.getResourceUnion(resourceUnionId); - List rlist = - new ArrayList<>(); + List rlist = new ArrayList<>(); for (Resource rEntity : rEntityList) { org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); rlist.add(r); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index e7b855de7..b41c068ea 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -66,7 +66,7 @@ public class DataSetup { } public void setupRangeItem(String resourceName, String assetId, String resourceSetId, String resourceUnionId, - String used) { + String resourceShareGroup, String used) { initTables(); Long rid = resource.getId("asset_id = '" + assetId + "' AND resource_name = '" + resourceName + "'"); @@ -74,7 +74,12 @@ public class DataSetup { resource.add(assetId, resourceName, "Range", null, used); rid = resource.getLastId(); } - allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, null, null, used, new Date()); + allocationItem.add(rid, "SDNC", resourceSetId, resourceUnionId, resourceShareGroup, null, used, new Date()); + } + + public void setupRangeItem(String resourceName, String assetId, String resourceSetId, String resourceUnionId, + String used) { + setupRangeItem(resourceName, assetId, resourceSetId, resourceUnionId, null, used); } public boolean checkRangeItem(String resourceName, String assetId, String resourceSetId, String used) { diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java new file mode 100644 index 000000000..45889137f --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java @@ -0,0 +1,259 @@ +package jtest.org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; +import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.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 TestGetResource { + + private static final Logger log = LoggerFactory.getLogger(TestGetResource.class); + + @Autowired(required = true) + private ResourceAllocator resourceAllocator; + + @Autowired(required = true) + private DataSetup dataSetup; + + private void setupResourceData() { + dataSetup.cleanup(); + + String targetId = "GBLOND2025MG2"; + String assetId = "Device::" + targetId; + String resourceName = "internal-vlan"; + + for (int i = 0; i < 5; i++) { + String entityId = "TEST" + i; + + String resourceUnion = "EVC::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, String.valueOf(i)); + } + + for (int i = 0; i < 5; i++) { + String entityId = "TEST" + (i + 10); + + String resourceUnion = "EVC::SVLAN::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, String.valueOf(10 + i)); + } + + for (int i = 0; i < 5; i++) { + String entityId = "TEST" + (i + 20); + + String resourceUnion = "EVC::" + entityId; + String resourceSet = resourceUnion + "::1"; + String resourceShareGroup = "SHARE1"; + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, resourceShareGroup, + String.valueOf(20 + i)); + } + + for (int i = 0; i < 5; i++) { + String entityId = "TEST" + (i + 30); + + String resourceUnion = "EVC::SVLAN::" + entityId; + String resourceSet = resourceUnion + "::1"; + String resourceShareGroup = "SHARE1"; + + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, resourceShareGroup, + String.valueOf(30 + i)); + } + } + + @Test + public void test001() throws Exception { + + String t = "001"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resource target - no additional criteria"); + + setupResourceData(); + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "GBLOND2025MG2"; + rt.resourceTargetType = "Device"; + + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = "internal-vlan"; + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); + ctx.setAttribute("ra-input.resource-target-type", "Device"); + + ctx.setAttribute("ra-input.resource-name", "internal-vlan"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "internal-vlan"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Device"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "GBLOND2025MG2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), + "0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34"); + } + + @Test + public void test002() throws Exception { + + String t = "002"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resource target - with resource entity condition"); + + setupResourceData(); + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "GBLOND2025MG2"; + rt.resourceTargetType = "Device"; + + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = "internal-vlan"; + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); + ctx.setAttribute("ra-input.resource-target-type", "Device"); + + ctx.setAttribute("ra-input.resource-name", "internal-vlan"); + + ctx.setAttribute("ra-input.resource-entity-type-filter", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id-filter", "SVLAN%"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "internal-vlan"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Device"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "GBLOND2025MG2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), + "10, 11, 12, 13, 14, 30, 31, 32, 33, 34"); + } + + @Test + public void test003() throws Exception { + + String t = "003"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resource target - with resource share group condition"); + + setupResourceData(); + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "GBLOND2025MG2"; + rt.resourceTargetType = "Device"; + + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = "internal-vlan"; + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); + ctx.setAttribute("ra-input.resource-target-type", "Device"); + + ctx.setAttribute("ra-input.resource-name", "internal-vlan"); + + ctx.setAttribute("ra-input.resource-share-group-filter", "SHARE1"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "internal-vlan"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Device"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "GBLOND2025MG2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), + "20, 21, 22, 23, 24, 30, 31, 32, 33, 34"); + } + + @Test + public void test004() throws Exception { + + String t = "004"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resource target - with resource share group condition NULL"); + + setupResourceData(); + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "GBLOND2025MG2"; + rt.resourceTargetType = "Device"; + + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = "internal-vlan"; + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); + ctx.setAttribute("ra-input.resource-target-type", "Device"); + + ctx.setAttribute("ra-input.resource-name", "internal-vlan"); + + ctx.setAttribute("ra-input.resource-share-group-filter", "null"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "internal-vlan"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Device"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "GBLOND2025MG2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), + "0, 1, 2, 3, 4, 10, 11, 12, 13, 14"); + } + + @Test + public void test005() throws Exception { + + String t = "005"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resource target - with both resource entity and resource share group conditions"); + + setupResourceData(); + + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetId = "GBLOND2025MG2"; + rt.resourceTargetType = "Device"; + + ResourceRequest rr = new ResourceRequest(); + rr.resourceName = "internal-vlan"; + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); + ctx.setAttribute("ra-input.resource-target-type", "Device"); + + ctx.setAttribute("ra-input.resource-name", "internal-vlan"); + + ctx.setAttribute("ra-input.resource-entity-type-filter", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id-filter", "SVLAN%"); + ctx.setAttribute("ra-input.resource-share-group-filter", "null"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "internal-vlan"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Device"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "GBLOND2025MG2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), "10, 11, 12, 13, 14"); + } +} -- cgit 1.2.3-korg From 3474fad00e780e279976921d60376d8d86b953c0 Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Tue, 30 Oct 2018 10:02:42 -0400 Subject: RA: Add timeout parameters to the lock API Change-Id: I5f8cd856d245829036ed563969fe75887e443467 Issue-ID: CCSDK-642 Signed-off-by: Stan Bonev --- .../org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java | 8 ++++++-- .../onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java | 14 ++++++++++++-- .../org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java | 12 ++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java index d33703df0..040d19273 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelper.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,9 +27,13 @@ public interface LockHelper { void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */); + void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount); + void unlock(String resourceName, boolean force); void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */); + void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount); + void unlock(Collection resourceNameList, boolean force); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java index 3a8c730e4..1611b5372 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java @@ -41,7 +41,12 @@ public class LockHelperImpl implements LockHelper { @Override public void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */) { - lock(Collections.singleton(resourceName), lockRequester, lockTimeout); + lock(resourceName, lockRequester, lockTimeout, lockWait, retryCount); + } + + @Override + public void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount) { + lock(Collections.singleton(resourceName), lockRequester, lockTimeout, lockWait, retryCount); } @Override @@ -51,13 +56,18 @@ public class LockHelperImpl implements LockHelper { @Override public void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */) { + lock(resourceNameList, lockRequester, lockTimeout, lockWait, retryCount); + } + + @Override + public void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount) { for (int i = 0; true; i++) { try { tryLock(resourceNameList, lockRequester, lockTimeout); log.info("Resources locked: " + resourceNameList); return; } catch (ResourceLockedException e) { - if (i > retryCount) { + if (i >= retryCount) { throw e; } try { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java index d1ba1eb76..a7d4b0e27 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceLockNode.java @@ -45,8 +45,12 @@ public class ResourceLockNode implements SvcLogicJavaPlugin { String lockRequester = getParam(paramMap, "lock-requester", false, generateLockRequester()); String lockTimeoutStr = getParam(paramMap, "lock-timeout", false, "600"); // Default lock timeout: 10 min int lockTimeout = Integer.parseInt(lockTimeoutStr); + String lockWaitStr = getParam(paramMap, "lock-wait", false, "5"); // Time waiting before next retry. Default: 5 sec + int lockWait = Integer.parseInt(lockWaitStr); + String lockRetryCountStr = getParam(paramMap, "lock-retry-count", false, "10"); // Default: 10 retries + int lockRetryCount = Integer.parseInt(lockRetryCountStr); - lockHelper.lock(resourceName, lockRequester, lockTimeout); + lockHelper.lock(resourceName, lockRequester, lockTimeout, lockWait, lockRetryCount); } public void unlockResource(Map paramMap, SvcLogicContext ctx) throws SvcLogicException { @@ -56,6 +60,10 @@ public class ResourceLockNode implements SvcLogicJavaPlugin { } public void lockResource(String resourceName, String lockRequester, int lockTimeout /* sec */) { + lockResource(resourceName, lockRequester, lockTimeout, 5, 10); + } + + public void lockResource(String resourceName, String lockRequester, int lockTimeout /* sec */, int lockWait /* Seconds */, int retryCount) { if (lockRequester == null) { lockRequester = generateLockRequester(); } @@ -63,7 +71,7 @@ public class ResourceLockNode implements SvcLogicJavaPlugin { lockTimeout = 600; } - lockHelper.lock(resourceName, lockRequester, lockTimeout); + lockHelper.lock(resourceName, lockRequester, lockTimeout, lockWait, retryCount); } public void unlockResource(String resourceName) { -- cgit 1.2.3-korg From 10431fbfe6e8f99f04cdb7a19cd7341467e998c5 Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Thu, 1 Nov 2018 09:43:40 -0400 Subject: RA: Enhance query for allocated resources Change-Id: I97d724910d1caac8d7b16455296a41fef1669310 Issue-ID: CCSDK-644 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 63 ++++++----- .../sli/adaptors/ra/comp/EndPointAllocator.java | 3 + .../adaptors/ra/comp/EndPointAllocatorImpl.java | 59 +++++++++++ .../sli/adaptors/ra/comp/ResourceRequest.java | 2 + .../sli/adaptors/rm/comp/ResourceManager.java | 5 +- .../sli/adaptors/rm/comp/ResourceManagerImpl.java | 9 ++ .../ccsdk/sli/adaptors/rm/dao/ResourceDao.java | 2 + .../sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 25 +++++ .../sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java | 6 +- .../adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 61 ++++++----- .../ccsdk/sli/adaptors/ra/TestGetResource.java | 37 ------- .../ccsdk/sli/adaptors/ra/TestQueryResource.java | 115 +++++++++++++++++++++ 12 files changed, 296 insertions(+), 91 deletions(-) create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 5dab1738e..e0391bc14 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -47,7 +47,7 @@ public class ResourceAllocator implements SvcLogicResource { private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); - private static final String[] INPUT_PREFIX = { "ra-input.", "tmp.resource-allocator." }; + private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; private static final String START_RELEASE_LC = "Starting release for: {}"; private ResourceManager resourceManager; @@ -99,20 +99,22 @@ public class ResourceAllocator implements SvcLogicResource { String orderBy, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, false, null); - String resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, - false, null); - String resourceEntityVersion = getParam(ctx, - new String[] { "reservation-entity-version", "resource-entity-version" }, false, "1"); - - String resourceTargetId = getParam(ctx, new String[] { "reservation-target-id", "resource-target-id" }, false, - null); - String resourceTargetType = getParam(ctx, new String[] { "reservation-target-type", "resource-target-type" }, - false, null); + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, false, null); + String resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, false, null); + String resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); + + String resourceTargetId = + getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, false, null); + String resourceTargetType = + getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, false, null); String resourceName = getParam(ctx, "resource-name", false, null); String resourceEntityTypeFilter = getParam(ctx, "resource-entity-type-filter", false, null); String resourceEntityIdFilter = getParam(ctx, "resource-entity-id-filter", false, null); String resourceShareGroupFilter = getParam(ctx, "resource-share-group-filter", false, null); + String resourceTargetTypeFilter = getParam(ctx, "resource-target-type-filter", false, null); + String resourceTargetIdFilter = getParam(ctx, "resource-target-id-filter", false, null); if (resourceEntityId != null && resourceEntityType != null) { List rdlist = endPointAllocator.getResourcesForEntity(resourceEntityType, resourceEntityId, @@ -122,6 +124,10 @@ public class ResourceAllocator implements SvcLogicResource { ResourceData rd = endPointAllocator.getResource(resourceTargetType, resourceTargetId, resourceName, resourceEntityTypeFilter, resourceEntityIdFilter, resourceShareGroupFilter); setResourceDataInContext(ctx, prefix, Collections.singletonList(rd)); + } else if ((resourceTargetTypeFilter != null || resourceTargetIdFilter != null) && resourceName != null) { + List rdlist = endPointAllocator.getResourcesForTarget(resourceTargetTypeFilter, + resourceTargetIdFilter, resourceName); + setResourceDataInContext(ctx, prefix, rdlist); } return QueryStatus.SUCCESS; @@ -139,6 +145,11 @@ public class ResourceAllocator implements SvcLogicResource { ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName, rr.resourceEntityTypeFilter, rr.resourceEntityIdFilter, rr.resourceShareGroupFilter); setResourceDataInResponse(Collections.singletonList(rd), rsList); + } else if ((rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null) + && rr.resourceName != null) { + List rdlist = endPointAllocator.getResourcesForTarget(rr.resourceTargetTypeFilter, + rr.resourceTargetIdFilter, rr.resourceName); + setResourceDataInResponse(rdlist, rsList); } return AllocationStatus.Success; @@ -185,11 +196,11 @@ public class ResourceAllocator implements SvcLogicResource { @Override public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, true, null); - String resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, - true, null); - String resourceEntityVersion = getParam(ctx, - new String[] { "reservation-entity-version", "resource-entity-version" }, false, null); + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + String resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); + String resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, null); String endPointPosition = getParam(ctx, "endpoint-position", false, null); @@ -365,20 +376,20 @@ public class ResourceAllocator implements SvcLogicResource { private ResourceEntity getResourceEntityData(SvcLogicContext ctx) throws SvcLogicException { ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = getParam(ctx, - new String[] { "service-instance-id", "reservation-entity-id", "resource-entity-id" }, true, null); - sd.resourceEntityType = getParam(ctx, new String[] { "reservation-entity-type", "resource-entity-type" }, true, - null); - sd.resourceEntityVersion = getParam(ctx, - new String[] { "reservation-entity-version", "resource-entity-version" }, false, "1"); + new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + sd.resourceEntityType = + getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); + sd.resourceEntityVersion = + getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, "1"); sd.data = getDataParam(ctx, "reservation-entity-data", "resource-entity-data", "service-data"); return sd; } private ResourceTarget getResourceTargetData(SvcLogicContext ctx) throws SvcLogicException { ResourceTarget sd = new ResourceTarget(); - sd.resourceTargetId = getParam(ctx, new String[] { "reservation-target-id", "resource-target-id" }, true, null); - sd.resourceTargetType = getParam(ctx, new String[] { "reservation-target-type", "resource-target-type" }, true, - null); + sd.resourceTargetId = getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, true, null); + sd.resourceTargetType = + getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, true, null); sd.data = getDataParam(ctx, "reservation-target-data", "resource-target-data", "equipment-data"); return sd; } @@ -435,7 +446,7 @@ public class ResourceAllocator implements SvcLogicResource { "One of the following variable is required in DG context: " + Arrays.deepToString(names)); } - log.info("Param: " + names + " not supplied. Using default: " + def); + log.info("Param: " + Arrays.deepToString(names) + " not supplied. Using default: " + def); return def; } @@ -487,4 +498,4 @@ public class ResourceAllocator implements SvcLogicResource { public void setSpeedUtil(SpeedUtil speedUtil) { this.speedUtil = speedUtil; } -} \ No newline at end of file +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java index dbc2a31dc..abfb8d44f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocator.java @@ -33,4 +33,7 @@ public interface EndPointAllocator { ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName, String resourceEntityTypeFilter, String resourceEntityIdFilter, String resourceShareGroupFilter); + + List getResourcesForTarget(String resourceTargetTypeFilter, String resourceTargetIdFilter, + String resourceName); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 36891fef1..f4109a1de 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -203,6 +203,65 @@ public class EndPointAllocatorImpl implements EndPointAllocator { return rdlist; } + @Override + public List getResourcesForTarget(String resourceTargetTypeFilter, String resourceTargetIdFilter, + String resourceName) { + List rdlist = new ArrayList<>(); + + String assetIdFilter = null; + if (resourceTargetTypeFilter != null && resourceTargetIdFilter != null) { + assetIdFilter = resourceTargetTypeFilter + "::" + resourceTargetIdFilter; + } else if (resourceTargetTypeFilter != null) { + assetIdFilter = resourceTargetTypeFilter; + } else if (resourceTargetIdFilter != null) { + assetIdFilter = resourceTargetIdFilter; + } + + List rlist = resourceManager.queryResources(resourceName, assetIdFilter); + + for (Resource r : rlist) { + + log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); + + ResourceData rd = new ResourceData(); + rdlist.add(rd); + + rd.resourceName = r.resourceKey.resourceName; + int i1 = r.resourceKey.assetId.indexOf("::"); + if (i1 > 0) { + rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); + rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); + + int i2 = r.resourceKey.assetId.lastIndexOf("::"); + if (i2 > i1) { + rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); + } + } else { + rd.resourceTargetType = ""; + rd.resourceTargetId = r.resourceKey.assetId; + } + + rd.data = new HashMap<>(); + + if (r instanceof RangeResource) { + RangeResource rr = (RangeResource) r; + + log.info("rr.used: " + rr.used); + String ss = String.valueOf(rr.used); + ss = ss.substring(1, ss.length() - 1); + rd.data.put("allocated", ss); + + } else if (r instanceof LimitResource) { + LimitResource lr = (LimitResource) r; + + log.info("lr.used: " + lr.used); + rd.data.put("allocated", String.valueOf(lr.used)); + } + } + + return rdlist; + } + @Override public ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName, String resourceEntityTypeFilter, String resourceEntityIdFilter, String resourceShareGroupFilter) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index e8bc5ad9d..c870bc414 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -46,4 +46,6 @@ public class ResourceRequest { public String resourceEntityTypeFilter; public String resourceEntityIdFilter; public String resourceShareGroupFilter; + public String resourceTargetTypeFilter; + public String resourceTargetIdFilter; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java index b40e47582..ee77dee96 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java @@ -38,5 +38,8 @@ public interface ResourceManager { void releaseResourceUnion(String resourceUnionId); - Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, String resourceShareGroupFilter); + Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, + String resourceShareGroupFilter); + + List queryResources(String resourceName, String assetIdFilter); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java index d5225b12f..9ba88912d 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -113,6 +113,15 @@ public class ResourceManagerImpl implements ResourceManager { return r; } + @Override + public List queryResources(String resourceName, String assetIdFilter) { + List rlist = resourceDao.query(assetIdFilter, resourceName); + for (Resource r : rlist) { + ResourceUtil.recalculate(r); + } + return rlist; + } + private Set getLockNames(List resourceList) { Set lockNames = new HashSet<>(); for (Resource r : resourceList) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java index bb4b64528..57c3e938e 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java @@ -37,4 +37,6 @@ public interface ResourceDao { List getResourceUnion(String resourceUnionId); Resource query(String assetId, String resourceName, String resourceUnionFilter, String resourceShareGroupFilter); + + List query(String assetIdFilter, String resourceName); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index 7deec9223..172651631 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -91,6 +91,31 @@ public class ResourceDaoImpl implements ResourceDao { return r; } + @Override + public List query(String assetIdFilter, String resourceName) { + List rEntityList = resourceJdbcDao.queryResources(assetIdFilter, resourceName); + List rlist = new ArrayList<>(); + for (Resource rEntity : rEntityList) { + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + rlist.add(r); + + List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); + r.allocationItems = new ArrayList<>(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); + r.resourceLoadList.add(rl); + } + } + return rlist; + } + @Override public void saveResource(org.onap.ccsdk.sli.adaptors.rm.data.Resource resource) { if (resource == null) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java index b32f34082..fe19fd905 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +27,8 @@ public interface ResourceJdbcDao { Resource getResource(String assetId, String resourceName); + List queryResources(String assetIdFilter, String resourceName); + List getResourceSet(String resourceSetId); List getResourceUnion(String resourceUnionId); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java index 6d4455e7e..9283df9ea 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,13 +21,11 @@ package org.onap.ccsdk.sli.adaptors.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; @@ -43,6 +41,9 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao { private static final String RESOURCE_SQL = "SELECT * FROM RESOURCE WHERE asset_id = ? AND resource_name = ?"; + private static final String RESOURCE_QUERY_1_SQL = + "SELECT * FROM RESOURCE WHERE asset_id LIKE ? 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 = ?)"; @@ -63,46 +64,56 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao { @Override public Resource getResource(String assetId, String resourceName) { - if (assetId == null || assetId.trim().length() == 0 || resourceName == null || - resourceName.trim().length() == 0) + 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); + List ll = jdbcTemplate.query(RESOURCE_SQL, new Object[] {assetId, resourceName}, resourceRowMapper); return ll.isEmpty() ? null : ll.get(0); } + @Override + public List queryResources(String assetIdFilter, String resourceName) { + if (assetIdFilter == null || assetIdFilter.trim().length() == 0 || resourceName == null + || resourceName.trim().length() == 0) { + return Collections.emptyList(); + } + + + return jdbcTemplate.query(RESOURCE_QUERY_1_SQL, new Object[] {assetIdFilter, resourceName}, resourceRowMapper); + } + @Override public List getResourceSet(String resourceSetId) { - if (resourceSetId == null) + if (resourceSetId == null) { return Collections.emptyList(); + } - return jdbcTemplate.query(RESOURCE_SET_SQL, new Object[] { resourceSetId }, resourceRowMapper); + return jdbcTemplate.query(RESOURCE_SET_SQL, new Object[] {resourceSetId}, resourceRowMapper); } @Override public List getResourceUnion(String resourceUnionId) { - if (resourceUnionId == null) + if (resourceUnionId == null) { return Collections.emptyList(); + } - return jdbcTemplate.query(RESOURCE_UNION_SQL, new Object[] { resourceUnionId }, resourceRowMapper); + 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; - } + PreparedStatementCreator psc = dbc -> { + 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); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java index 45889137f..a968c3fb1 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java @@ -6,8 +6,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceRequest; -import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.slf4j.Logger; @@ -86,13 +84,6 @@ public class TestGetResource { setupResourceData(); - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "GBLOND2025MG2"; - rt.resourceTargetType = "Device"; - - ResourceRequest rr = new ResourceRequest(); - rr.resourceName = "internal-vlan"; - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); ctx.setAttribute("ra-input.resource-target-type", "Device"); @@ -120,13 +111,6 @@ public class TestGetResource { setupResourceData(); - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "GBLOND2025MG2"; - rt.resourceTargetType = "Device"; - - ResourceRequest rr = new ResourceRequest(); - rr.resourceName = "internal-vlan"; - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); ctx.setAttribute("ra-input.resource-target-type", "Device"); @@ -157,13 +141,6 @@ public class TestGetResource { setupResourceData(); - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "GBLOND2025MG2"; - rt.resourceTargetType = "Device"; - - ResourceRequest rr = new ResourceRequest(); - rr.resourceName = "internal-vlan"; - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); ctx.setAttribute("ra-input.resource-target-type", "Device"); @@ -193,13 +170,6 @@ public class TestGetResource { setupResourceData(); - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "GBLOND2025MG2"; - rt.resourceTargetType = "Device"; - - ResourceRequest rr = new ResourceRequest(); - rr.resourceName = "internal-vlan"; - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); ctx.setAttribute("ra-input.resource-target-type", "Device"); @@ -229,13 +199,6 @@ public class TestGetResource { setupResourceData(); - ResourceTarget rt = new ResourceTarget(); - rt.resourceTargetId = "GBLOND2025MG2"; - rt.resourceTargetType = "Device"; - - ResourceRequest rr = new ResourceRequest(); - rr.resourceName = "internal-vlan"; - SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("ra-input.resource-target-id", "GBLOND2025MG2"); ctx.setAttribute("ra-input.resource-target-type", "Device"); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java new file mode 100644 index 000000000..4be985b2a --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java @@ -0,0 +1,115 @@ +package jtest.org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.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 TestQueryResource { + + private static final Logger log = LoggerFactory.getLogger(TestQueryResource.class); + + @Autowired(required = true) + private ResourceAllocator resourceAllocator; + + @Autowired(required = true) + private DataSetup dataSetup; + + private void setupResourceData() { + dataSetup.cleanup(); + + for (int k = 0; k < 6; k++) { + String assetId = "Port::TESTPORT-" + (k / 2 + 1) + "-" + (k + 1); + + for (int i = 0; i < 5; i++) { + String entityId = "TEST-" + i + "-" + (k / 2 + 1); + + String resourceUnion = "EVC::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.setupRangeItem("test-range-1", assetId, resourceSet, resourceUnion, String.valueOf(i)); + } + } + + for (int k = 0; k < 6; k++) { + String assetId = "Port::TESTPORT-" + (k / 2 + 1) + "-" + (k + 1); + + for (int i = 0; i < 5; i++) { + String entityId = "TEST-" + i + "-" + (k / 2 + 1); + + String resourceUnion = "EVC::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.setupLimitItem("test-limit-1", assetId, resourceSet, resourceUnion, (i + 1) * 100); + } + } + } + + @Test + public void test001() throws Exception { + + String t = "001"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resources - with resource target condition - range"); + + setupResourceData(); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id-filter", "TESTPORT-1-%"); + ctx.setAttribute("ra-input.resource-target-type-filter", "Port"); + + ctx.setAttribute("ra-input.resource-name", "test-range-1"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "test-range-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Port"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "TESTPORT-1-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), "0, 1, 2, 3, 4"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].resource-name"), "test-range-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].resource-target-type"), "Port"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].resource-target-id"), "TESTPORT-1-2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocated"), "0, 1, 2, 3, 4"); + } + + @Test + public void test002() throws Exception { + + String t = "002"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test query for resources - with resource target condition - limit"); + + setupResourceData(); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-target-id-filter", "TESTPORT-%-1"); + ctx.setAttribute("ra-input.resource-target-type-filter", "Port"); + + ctx.setAttribute("ra-input.resource-name", "test-limit-1"); + + QueryStatus st = resourceAllocator.query("NetworkCapacity", false, null, null, "ra-output", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-name"), "test-limit-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Port"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "TESTPORT-1-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), "1500"); + } +} -- cgit 1.2.3-korg From f62f418a64da19e39c3a2b484a457f3ae68ef792 Mon Sep 17 00:00:00 2001 From: "Smokowski, Kevin (ks6305)" Date: Tue, 6 Nov 2018 16:34:46 +0000 Subject: packaging changes don't embed sli provider, sli common or db lib in sql resource or resource assignment Change-Id: I9a8a2a53455287ee60322785da9e4e7ca0614b96 Issue-ID: CCSDK-653 Signed-off-by: Smokowski, Kevin (ks6305) --- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 3 +++ resource-assignment/provider/pom.xml | 6 +++--- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 ++ sql-resource/provider/pom.xml | 5 +++-- 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index b1ae5d3b1..23c252b7a 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -41,8 +41,10 @@ org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features + provided @@ -51,6 +53,7 @@ ${ccsdk.sli.core.version} xml features + provided diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index dfb0885c6..a431968a0 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -41,17 +41,17 @@ org.onap.ccsdk.sli.core sli-common - compile + provided org.onap.ccsdk.sli.core sli-provider - compile + provided org.onap.ccsdk.sli.core dblib-provider - runtime + provided org.slf4j diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index e691dbad5..39138b34e 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -42,6 +42,7 @@ ccsdk-sli xml features + provided org.onap.ccsdk.sli.core @@ -49,6 +50,7 @@ ${ccsdk.sli.core.version} xml features + provided ${project.groupId} diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 640e089b8..dc562da6f 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -37,12 +37,12 @@ org.onap.ccsdk.sli.core sli-common - compile + provided org.onap.ccsdk.sli.core sli-provider - compile + provided @@ -61,6 +61,7 @@ org.onap.ccsdk.sli.core dblib-provider + provided
-- cgit 1.2.3-korg From 749a3c537f597505087a939a33532aef3de90c78 Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Wed, 28 Nov 2018 11:04:03 -0500 Subject: RA: Release resources on specific target Change-Id: I695a916a3d527f61b9483bbb27977695fb1e094c Issue-ID: CCSDK-766 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 69 ++--- .../sli/adaptors/rm/comp/ReleaseFunction.java | 16 +- .../sli/adaptors/rm/comp/ResourceManager.java | 4 + .../sli/adaptors/rm/comp/ResourceManagerImpl.java | 30 ++- .../ccsdk/sli/adaptors/rm/dao/ResourceDao.java | 4 + .../sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java | 109 ++++---- .../sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java | 4 + .../adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 25 ++ .../org/onap/ccsdk/sli/adaptors/ra/DataSetup.java | 7 + .../ccsdk/sli/adaptors/ra/TestGetResource.java | 10 +- .../onap/ccsdk/sli/adaptors/ra/TestRelease.java | 300 +++++++++++++++++++++ 11 files changed, 472 insertions(+), 106 deletions(-) create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index e0391bc14..5700cd72a 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -48,7 +48,8 @@ public class ResourceAllocator implements SvcLogicResource { private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; - private static final String START_RELEASE_LC = "Starting release for: {}"; + private static final String START_RELEASE = "Starting release for: {}"; + private static final String START_RELEASE_FOR_TARGET = "Starting release for: {} on target: {}"; private ResourceManager resourceManager; private EndPointAllocator endPointAllocator; @@ -201,6 +202,10 @@ public class ResourceAllocator implements SvcLogicResource { getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); String resourceEntityVersion = getParam(ctx, new String[] {"reservation-entity-version", "resource-entity-version"}, false, null); + String resourceTargetId = + getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, false, null); + String resourceTargetType = + getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, false, null); String endPointPosition = getParam(ctx, "endpoint-position", false, null); @@ -212,8 +217,12 @@ public class ResourceAllocator implements SvcLogicResource { ResourceRequest rr = new ResourceRequest(); rr.endPointPosition = endPointPosition; + ResourceTarget rt = new ResourceTarget(); + rt.resourceTargetType = resourceTargetType; + rt.resourceTargetId = resourceTargetId; + try { - this.release(sd, rr); + this.release(sd, rr, rt); } catch (Exception e) { throw new SvcLogicException(e.getMessage()); } @@ -221,54 +230,54 @@ public class ResourceAllocator implements SvcLogicResource { } public AllocationStatus release(ResourceEntity sd) throws Exception { - - if (sd.resourceEntityVersion != null) { - String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; - log.info(START_RELEASE_LC, resourceSet); - - resourceManager.releaseResourceSet(resourceSet); - } else { - String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; - log.info(START_RELEASE_LC, resourceUnion); - - resourceManager.releaseResourceUnion(resourceUnion); - } - - return AllocationStatus.Success; - + return release(sd, null, null); } public AllocationStatus release(ResourceEntity sd, ResourceRequest rr) throws Exception { + return release(sd, rr, null); + } + + public AllocationStatus release(ResourceEntity sd, ResourceRequest rr, ResourceTarget rt) throws Exception { if (sd != null && sd.resourceEntityVersion != null) { + String resourceSet = null; + if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { - String resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition - + "::" + sd.resourceEntityVersion; - log.info(START_RELEASE_LC, resourceSet); - resourceManager.releaseResourceSet(resourceSet); + resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition + "::" + + sd.resourceEntityVersion; + } else { + resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; + } + if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null) { + String assetId = rt.resourceTargetType + "::" + rt.resourceTargetId; + log.info(START_RELEASE_FOR_TARGET, resourceSet, assetId); + resourceManager.releaseResourceSet(resourceSet, assetId); } else { - String resourceSet = - sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; - log.info(START_RELEASE_LC, resourceSet); + log.info(START_RELEASE, resourceSet); resourceManager.releaseResourceSet(resourceSet); } } else if (sd != null && (sd.resourceEntityVersion == null || sd.resourceEntityVersion.isEmpty())) { + String resourceUnion = null; + if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { - String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition; - log.info(START_RELEASE_LC, resourceUnion); - resourceManager.releaseResourceUnion(resourceUnion); + resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition; + } else { + resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; + } + if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null) { + String assetId = rt.resourceTargetType + "::" + rt.resourceTargetId; + log.info(START_RELEASE_FOR_TARGET, resourceUnion, assetId); + resourceManager.releaseResourceUnion(resourceUnion, assetId); } else { - String resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; - log.info(START_RELEASE_LC, resourceUnion); + log.info(START_RELEASE, resourceUnion); resourceManager.releaseResourceUnion(resourceUnion); } } return AllocationStatus.Success; - } private QueryStatus allocateResources(SvcLogicContext ctx, boolean checkOnly, String prefix) diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java index c0dec8bb7..17641845f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java @@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.adaptors.rm.comp; import java.util.Collection; import java.util.Iterator; import java.util.List; - import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; import org.onap.ccsdk.sli.adaptors.lock.comp.ResourceLockedException; import org.onap.ccsdk.sli.adaptors.lock.comp.SynchronizedFunction; @@ -42,21 +41,24 @@ class ReleaseFunction extends SynchronizedFunction { private ResourceDao resourceDao; - private String resourceSetId, resourceUnionId; + private String resourceSetId, resourceUnionId, assetId; - public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, String resourceSetId, - String resourceUnionId, Collection lockNames, int lockTimeout) { + public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, String resourceSetId, String resourceUnionId, + String assetId, Collection lockNames, int lockTimeout) { super(lockHelper, lockNames, lockTimeout); this.resourceDao = resourceDao; this.resourceSetId = resourceSetId; this.resourceUnionId = resourceUnionId; + this.assetId = assetId; } @Override public void _exec() throws ResourceLockedException { - List resourceList = - resourceSetId != null - ? resourceDao.getResourceSet(resourceSetId) : resourceDao.getResourceUnion(resourceUnionId); + List resourceList = assetId != null + ? (resourceSetId != null ? resourceDao.getResourceSetForAsset(resourceSetId, assetId) + : resourceDao.getResourceUnionForAsset(resourceUnionId, assetId)) + : (resourceSetId != null ? resourceDao.getResourceSet(resourceSetId) + : resourceDao.getResourceUnion(resourceUnionId)); for (Resource r : resourceList) { boolean updated = false; if (r.allocationItems != null) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java index ee77dee96..68d251587 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java @@ -38,6 +38,10 @@ public interface ResourceManager { void releaseResourceUnion(String resourceUnionId); + void releaseResourceSet(String resourceSetId, String assetId); + + void releaseResourceUnion(String resourceUnionId, String assetId); + Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, String resourceShareGroupFilter); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java index 9ba88912d..c4d53ce70 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -88,7 +88,7 @@ public class ResourceManagerImpl implements ResourceManager { Set lockNames = getLockNames(resourceList); ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, lockNames, lockTimeout); + new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, null, lockNames, lockTimeout); releaseFunction.exec(); } @@ -101,7 +101,33 @@ public class ResourceManagerImpl implements ResourceManager { Set lockNames = getLockNames(resourceList); ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, null, resourceUnionId, lockNames, lockTimeout); + new ReleaseFunction(lockHelper, resourceDao, null, resourceUnionId, null, lockNames, lockTimeout); + releaseFunction.exec(); + } + + @Override + public void releaseResourceSet(String resourceSetId, String assetId) { + List resourceList = resourceDao.getResourceSetForAsset(resourceSetId, assetId); + if (resourceList == null || resourceList.isEmpty()) { + return; + } + + Set lockNames = getLockNames(resourceList); + ReleaseFunction releaseFunction = + new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, assetId, lockNames, lockTimeout); + releaseFunction.exec(); + } + + @Override + public void releaseResourceUnion(String resourceUnionId, String assetId) { + List resourceList = resourceDao.getResourceUnionForAsset(resourceUnionId, assetId); + if (resourceList == null || resourceList.isEmpty()) { + return; + } + + Set lockNames = getLockNames(resourceList); + ReleaseFunction releaseFunction = + new ReleaseFunction(lockHelper, resourceDao, null, resourceUnionId, assetId, lockNames, lockTimeout); releaseFunction.exec(); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java index 57c3e938e..87baf26c1 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/ResourceDao.java @@ -36,6 +36,10 @@ public interface ResourceDao { List getResourceUnion(String resourceUnionId); + List getResourceSetForAsset(String resourceSetId, String assetId); + + List getResourceUnionForAsset(String resourceUnionId, String assetId); + Resource query(String assetId, String resourceName, String resourceUnionFilter, String resourceShareGroupFilter); List query(String assetIdFilter, String resourceName); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java index 172651631..21f5575fc 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java @@ -44,25 +44,7 @@ public class ResourceDaoImpl implements ResourceDao { @Override public org.onap.ccsdk.sli.adaptors.rm.data.Resource getResource(String assetId, String resourceName) { Resource rEntity = resourceJdbcDao.getResource(assetId, resourceName); - org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); - - if (r != null) { - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList<>(); - for (AllocationItem aiEntity : aiEntityList) { - org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } - } - - return r; + return createResourceWithItems(rEntity); } @Override @@ -96,22 +78,8 @@ public class ResourceDaoImpl implements ResourceDao { List rEntityList = resourceJdbcDao.queryResources(assetIdFilter, resourceName); List rlist = new ArrayList<>(); for (Resource rEntity : rEntityList) { - org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResourceWithItems(rEntity); rlist.add(r); - - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList<>(); - for (AllocationItem aiEntity : aiEntityList) { - org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } } return rlist; } @@ -254,22 +222,8 @@ public class ResourceDaoImpl implements ResourceDao { List rEntityList = resourceJdbcDao.getResourceSet(resourceSetId); List rlist = new ArrayList<>(); for (Resource rEntity : rEntityList) { - org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResourceWithItems(rEntity); rlist.add(r); - - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList<>(); - for (AllocationItem aiEntity : aiEntityList) { - org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } } return rlist; } @@ -279,22 +233,32 @@ public class ResourceDaoImpl implements ResourceDao { List rEntityList = resourceJdbcDao.getResourceUnion(resourceUnionId); List rlist = new ArrayList<>(); for (Resource rEntity : rEntityList) { - org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResourceWithItems(rEntity); rlist.add(r); + } + return rlist; + } - List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); - r.allocationItems = new ArrayList<>(); - for (AllocationItem aiEntity : aiEntityList) { - org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem ai = createAllocationItem(r, aiEntity); - r.allocationItems.add(ai); - } + @Override + public List getResourceSetForAsset(String resourceSetId, + String assetId) { + List rEntityList = resourceJdbcDao.getResourceSetForAsset(resourceSetId, assetId); + List rlist = new ArrayList<>(); + for (Resource rEntity : rEntityList) { + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResourceWithItems(rEntity); + rlist.add(r); + } + return rlist; + } - List rlEntityList = resourceLoadJdbcDao.getResourceLoads(rEntity.id); - r.resourceLoadList = new ArrayList<>(); - for (ResourceLoad rlEntity : rlEntityList) { - org.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); - r.resourceLoadList.add(rl); - } + @Override + public List getResourceUnionForAsset(String resourceUnionId, + String assetId) { + List rEntityList = resourceJdbcDao.getResourceUnionForAsset(resourceUnionId, assetId); + List rlist = new ArrayList<>(); + for (Resource rEntity : rEntityList) { + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResourceWithItems(rEntity); + rlist.add(r); } return rlist; } @@ -374,6 +338,27 @@ public class ResourceDaoImpl implements ResourceDao { } } + private org.onap.ccsdk.sli.adaptors.rm.data.Resource createResourceWithItems(Resource rEntity) { + org.onap.ccsdk.sli.adaptors.rm.data.Resource r = createResource(rEntity); + + if (r != null) { + List aiEntityList = allocationItemJdbcDao.getAllocationItems(rEntity.id); + r.allocationItems = new ArrayList<>(); + for (AllocationItem aiEntity : aiEntityList) { + org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.rm.data.ResourceLoad rl = createResourceLoad(r, rlEntity); + r.resourceLoadList.add(rl); + } + } + return r; + } + private org.onap.ccsdk.sli.adaptors.rm.data.Resource createResource(Resource resourceEntity) { if (resourceEntity == null) { return null; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java index fe19fd905..d4d9a0543 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDao.java @@ -33,6 +33,10 @@ public interface ResourceJdbcDao { List getResourceUnion(String resourceUnionId); + List getResourceSetForAsset(String resourceSetId, String assetId); + + List getResourceUnionForAsset(String resourceUnionId, String assetId); + void add(Resource r); void delete(long id); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java index 9283df9ea..c94a5d8a0 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java @@ -50,6 +50,12 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao { 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 RESOURCE_SET_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" + + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_set_id = ?) AND asset_id = ?"; + + private static final String RESOURCE_UNION_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" + + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?) AND asset_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 (?, ?, ?, ?, ?, ?, ?)"; @@ -102,6 +108,25 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao { return jdbcTemplate.query(RESOURCE_UNION_SQL, new Object[] {resourceUnionId}, resourceRowMapper); } + @Override + public List getResourceSetForAsset(String resourceSetId, String assetId) { + if (resourceSetId == null) { + return Collections.emptyList(); + } + + return jdbcTemplate.query(RESOURCE_SET_FOR_ASSET_SQL, new Object[] {resourceSetId, assetId}, resourceRowMapper); + } + + @Override + public List getResourceUnionForAsset(String resourceUnionId, String assetId) { + if (resourceUnionId == null) { + return Collections.emptyList(); + } + + return jdbcTemplate.query(RESOURCE_UNION_FOR_ASSET_SQL, new Object[] {resourceUnionId, assetId}, + resourceRowMapper); + } + @Override public void add(final Resource r) { PreparedStatementCreator psc = dbc -> { diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index b41c068ea..5dcf59917 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -89,6 +89,13 @@ public class DataSetup { return used.equals(usedInDb); } + public boolean checkLimitItem(String resourceName, String assetId, String resourceSetId, int used) { + String where = "resource_id = (SELECT resource_id FROM RESOURCE WHERE resource_name = '" + resourceName + + "' AND asset_id = '" + assetId + "') AND resource_set_id = '" + resourceSetId + "' AND lt_used = " + + used; + return allocationItem.exists(where); + } + public void setTestDb(TestDb testDb) { this.testDb = testDb; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java index a968c3fb1..04ee38115 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestGetResource.java @@ -79,7 +79,7 @@ public class TestGetResource { public void test001() throws Exception { String t = "001"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - no additional criteria"); setupResourceData(); @@ -106,7 +106,7 @@ public class TestGetResource { public void test002() throws Exception { String t = "002"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource entity condition"); setupResourceData(); @@ -136,7 +136,7 @@ public class TestGetResource { public void test003() throws Exception { String t = "003"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource share group condition"); setupResourceData(); @@ -165,7 +165,7 @@ public class TestGetResource { public void test004() throws Exception { String t = "004"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with resource share group condition NULL"); setupResourceData(); @@ -194,7 +194,7 @@ public class TestGetResource { public void test005() throws Exception { String t = "005"; - log.info("============== query node " + t + " ================================"); + log.info("============== get-resource node " + t + " ================================"); log.info("=== Test query for resource target - with both resource entity and resource share group conditions"); setupResourceData(); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java new file mode 100644 index 000000000..a936786ac --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java @@ -0,0 +1,300 @@ +package jtest.org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.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; + + private void setupResourceData() { + dataSetup.cleanup(); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-1::1", "EVC::TEST-1", "1"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-2::1", "EVC::TEST-2", "2"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-2::2", "EVC::TEST-2", "2"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "EVC::TEST-3", "3"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "EVC::TEST-3", "4"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "EVC::TEST-4", "5"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "EVC::TEST-4", "5"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "EVC::TEST-4", "6"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-1::1", "EVC::TEST-1", "1"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "EVC::TEST-3", "3"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "EVC::TEST-3", "4"); + + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", "5"); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-1::1", "EVC::TEST-1", 100); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-2::1", "EVC::TEST-2", 200); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-2::2", "EVC::TEST-2", 200); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "EVC::TEST-3", 300); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "EVC::TEST-3", 400); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "EVC::TEST-4", 500); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "EVC::TEST-4", 500); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "EVC::TEST-4", 600); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-1::1", "EVC::TEST-1", 100); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "EVC::TEST-3", 300); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "EVC::TEST-3", 400); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", 500); + } + + @Test + public void test001() throws Exception { + + String t = "001"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-4"); + ctx.setAttribute("ra-input.resource-entity-version", "2"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + } + + @Test + public void test002() throws Exception { + + String t = "002"; + log.info("============== query node " + t + " ================================"); + log.info("=== Test release - with resource union"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-4"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::1", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::2", "5")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-4::3", "6")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::1", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::2", 500)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-4::3", 600)); + } + + @Test + public void test003() throws Exception { + + String t = "003"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test004() throws Exception { + + String t = "004"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource union on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test005() throws Exception { + + String t = "005"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource set and asset"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } + + @Test + public void test006() throws Exception { + + String t = "006"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - with resource union on 2 ports"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-3"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-1"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::1", "3")); + Assert.assertFalse(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-1", "EVC::TEST-3::2", "4")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::1", "3")); + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "4")); + + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::1", 300)); + Assert.assertFalse(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-3::2", 400)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); + } +} -- cgit 1.2.3-korg From 7c7fee89720151ec426aba3a928df2ad71dd8077 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Thu, 29 Nov 2018 16:59:38 +0530 Subject: Added fix for potential nullpointer exception Added fix for potential nullpointerexception reported in sonar Issue-ID: CCSDK-767 Change-Id: Ifebf7a57f27cb0de83d3cd5e805e0547b28ee845 Signed-off-by: Chandan Ghosh --- .../src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 5700cd72a..e31ce7ec2 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -146,7 +146,7 @@ public class ResourceAllocator implements SvcLogicResource { ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName, rr.resourceEntityTypeFilter, rr.resourceEntityIdFilter, rr.resourceShareGroupFilter); setResourceDataInResponse(Collections.singletonList(rd), rsList); - } else if ((rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null) + } else if ((rr!=null && rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null) && rr.resourceName != null) { List rdlist = endPointAllocator.getResourcesForTarget(rr.resourceTargetTypeFilter, rr.resourceTargetIdFilter, rr.resourceName); -- cgit 1.2.3-korg From b2e9585b4343f8f570ef422f9fec4a1f96c8c786 Mon Sep 17 00:00:00 2001 From: ezhil Date: Tue, 18 Dec 2018 15:17:07 +0530 Subject: Fixed sonar issue in ResourceLockedException.java Fixed major sonar issue Issue-ID: CCSDK-834 Change-Id: Ifeb52731e712d1459f3922008fcf65161bda0dd3 Signed-off-by: ezhil --- .../onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java index 4b90b265e..f503332cc 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/ResourceLockedException.java @@ -25,7 +25,9 @@ public class ResourceLockedException extends RuntimeException { private static final long serialVersionUID = 1L; - private String lockName, lockHolder, lockRequester; + private final String lockName; + private final String lockHolder; + private final String lockRequester; public ResourceLockedException(String lockName, String lockHolder, String lockRequester) { this.lockName = lockName; -- cgit 1.2.3-korg From 50a756f026b92c964924437c9cccc73b0554e135 Mon Sep 17 00:00:00 2001 From: ezhil Date: Tue, 18 Dec 2018 15:26:14 +0530 Subject: Fixed soanr issue in LockHelperImpl.java Fixed major sonar issues Issue-ID: CCSDK-835 Change-Id: I53375dd95cdcec36f1a97630c9fdc2d9f57d8613 Signed-off-by: ezhil --- .../java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java index 1611b5372..0efd8977a 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java @@ -73,6 +73,7 @@ public class LockHelperImpl implements LockHelper { try { Thread.sleep(lockWait * 1000); } catch (InterruptedException ex) { + log.error("Interrupted Exception", ex); } } } @@ -80,7 +81,7 @@ public class LockHelperImpl implements LockHelper { @Override public void unlock(Collection lockNames, boolean force) { - if (lockNames == null || lockNames.size() == 0) { + if (lockNames == null || lockNames.isEmpty()) { return; } @@ -105,7 +106,7 @@ public class LockHelperImpl implements LockHelper { } public void tryLock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */) { - if (resourceNameList == null || resourceNameList.size() == 0) { + if (resourceNameList == null || resourceNameList.isEmpty()) { return; } -- cgit 1.2.3-korg From 94d30765aea03290b3e0fbb5ab4a5a9b347968ef Mon Sep 17 00:00:00 2001 From: ezhil Date: Tue, 18 Dec 2018 20:00:50 +0530 Subject: Fixed sonar issue in ResourceAllocator.java Fixed major sonar issue Issue-ID: CCSDK-836 Change-Id: I8bc5229f24f7a6c5668f52fc1ab3b8e13387edb1 Signed-off-by: ezhil --- .../onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index e31ce7ec2..c0cf774a8 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +147,7 @@ public class ResourceAllocator implements SvcLogicResource { ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName, rr.resourceEntityTypeFilter, rr.resourceEntityIdFilter, rr.resourceShareGroupFilter); setResourceDataInResponse(Collections.singletonList(rd), rsList); - } else if ((rr!=null && rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null) + } else if ((rr!=null && (rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null)) && rr.resourceName != null) { List rdlist = endPointAllocator.getResourcesForTarget(rr.resourceTargetTypeFilter, rr.resourceTargetIdFilter, rr.resourceName); @@ -294,7 +295,7 @@ public class ResourceAllocator implements SvcLogicResource { StrUtil.info(log, rt); StrUtil.info(log, rr); - boolean change = requestType.equalsIgnoreCase("change"); + boolean change = "change".equalsIgnoreCase(requestType); List rlist = endPointAllocator.allocateResources(serviceModel, sd, rt, rr, checkOnly, change); @@ -302,7 +303,7 @@ public class ResourceAllocator implements SvcLogicResource { setResourceDataInContext(ctx, prefix, rlist); for (ResourceData rd : rlist) { - if (!rd.status.equals("Success")) { + if (!"Success".equals(rd.status)) { log.info("Capacity not found for: " + sd.resourceEntityType + "::" + sd.resourceEntityId); return QueryStatus.NOT_FOUND; } @@ -322,7 +323,7 @@ public class ResourceAllocator implements SvcLogicResource { StrUtil.info(log, rt); StrUtil.info(log, rr); - boolean change = requestType.equalsIgnoreCase("change"); + boolean change = "change".equalsIgnoreCase(requestType); List rlist = endPointAllocator.allocateResources(serviceModel, sd, rt, rr, rr.checkOnly, change); @@ -330,7 +331,7 @@ public class ResourceAllocator implements SvcLogicResource { setResourceDataInResponse(rlist, rsList); for (ResourceData rd : rlist) { - if (!rd.status.equals("Success")) { + if (!"Success".equals(rd.status)) { log.info("Capacity not found for: " + sd.resourceEntityType + "::" + sd.resourceEntityId); return AllocationStatus.ResourceNotFound; } @@ -350,19 +351,19 @@ public class ResourceAllocator implements SvcLogicResource { res.status = rd.status; if (rd.data != null && !rd.data.isEmpty()) { for (String kk : rd.data.keySet()) { - if (kk.equalsIgnoreCase("allocated")) { + if ("allocated".equalsIgnoreCase(kk)) { res.resourceAllocated = String.valueOf(rd.data.get(kk)); } - if (kk.equalsIgnoreCase("used")) { + if ("used".equalsIgnoreCase(kk)) { res.resourceUsed = String.valueOf(rd.data.get(kk)); } - if (kk.equalsIgnoreCase("available")) { + if ("available".equalsIgnoreCase(kk)) { res.resourceAvailable = String.valueOf(rd.data.get(kk)); } - if (kk.equalsIgnoreCase("limit")) { + if ("limit".equalsIgnoreCase(kk)) { res.resourceLimit = String.valueOf(rd.data.get(kk)); } -- cgit 1.2.3-korg From 6c1dee5b7d0e66338100c65efd51917d4f69998f Mon Sep 17 00:00:00 2001 From: ezhil Date: Wed, 26 Dec 2018 15:55:51 +0530 Subject: Fixed sonar fix in DataSourceWrap.java Fixed major bug Issue-ID: CCSDK-838 Change-Id: Iee8ce39e54f15f33e9d682068d721fb56610d12c Signed-off-by: ezhil --- .../ccsdk/sli/adaptors/util/db/DataSourceWrap.java | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java index 2aebb83e3..259b9d8d9 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,25 +75,22 @@ public class DataSourceWrap implements DataSource { @Override public Connection getConnection() throws SQLException { - Connection c = dataSource.getConnection(); - - log.debug("getConnection: " + c.getClass().getName()); - - c.setAutoCommit(true); - return c; + try (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; + try (Connection c = dataSource.getConnection(username, password)){ + log.debug("getConnection: " + c.getClass().getName()); + c.setAutoCommit(true); + return c; + } } - public void setDataSource(DataSource dataSource) { + public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } } -- cgit 1.2.3-korg From 1fa73ab04d70420b6375c1919855a1efab157e57 Mon Sep 17 00:00:00 2001 From: ezhil Date: Wed, 26 Dec 2018 16:14:22 +0530 Subject: Fixed sonar issues in AllocationFunction.java Fixed bug and major issues Issue-ID: CCSDK-875 Change-Id: I425a25eab33bc3203fcd30fa2abe4216a6bd4bc8 Signed-off-by: ezhil --- .../org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index 70092db36..0f5335443 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -105,7 +107,8 @@ class AllocationFunction extends SynchronizedFunction { @Override public void _exec() throws ResourceLockedException { outcome = allocate(request); - if (outcome.status == AllocationStatus.Success) { + + if ((outcome!=null) && (outcome.status == AllocationStatus.Success)) { for (Resource r : updateList) { resourceDao.saveResource(r); } @@ -132,7 +135,7 @@ class AllocationFunction extends SynchronizedFunction { } private MultiAssetAllocationOutcome allocateMultiAsset(MultiAssetAllocationRequest req) { - // TODO Auto-generated method stub + return null; } @@ -252,7 +255,7 @@ class AllocationFunction extends SynchronizedFunction { out.status = AllocationStatus.Success; foundNumbers = req.requestedNumbers; } else { - if (req.requestedNumbers != null && req.requestedNumbers.size() > 0) { + if (req.requestedNumbers != null && !req.requestedNumbers.isEmpty()) { foundNumbers = req.requestedNumbers; out.status = AllocationStatus.Success; for (int n : foundNumbers) { -- cgit 1.2.3-korg From 208658c5ecaa1f932de6b50eee0647c59dfb1389 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Wed, 2 Jan 2019 16:06:42 +0530 Subject: Sonar Fix: ReleaseFunction.java Fixed sonar issues/code smells across thsi file Issue-ID: CCSDK-888 Change-Id: I9748106bc5b09c342beb68df96860984722eb7d1 Signed-off-by: Arundathi Patil --- .../java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java index 17641845f..b26c54cfa 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright © 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +42,9 @@ class ReleaseFunction extends SynchronizedFunction { private ResourceDao resourceDao; - private String resourceSetId, resourceUnionId, assetId; + private String resourceSetId; + private String resourceUnionId; + private String assetId; public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, String resourceSetId, String resourceUnionId, String assetId, Collection lockNames, int lockTimeout) { -- cgit 1.2.3-korg From 0799be7db42fd7de638b4888e27e1e517691cec5 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Wed, 2 Jan 2019 16:49:38 +0530 Subject: Sonar fix: AllocationItemJdbcDaoImpl.java Fixed sonar issues/code-smells across this file Issue-ID: CCSDK-891 Change-Id: Iaea16ae96c919ad09eb7de31119a9bd14e2ef539 Signed-off-by: Arundathi Patil --- .../onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java index fcde0f8f1..2a62c63a3 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/AllocationItemJdbcDaoImpl.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright © 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,7 +111,7 @@ public class AllocationItemJdbcDaoImpl implements AllocationItemJdbcDao { } if (resourceShareGroupFilter != null) { - if (resourceShareGroupFilter.equalsIgnoreCase("null")) { + if (("null").equalsIgnoreCase(resourceShareGroupFilter)) { sql += " AND resource_share_group_list IS NULL"; } else { sql += " AND resource_share_group_list LIKE '" + resourceShareGroupFilter + "'"; -- cgit 1.2.3-korg From 12ec55610e03492410f9501ad750a702a63db5f8 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 8 Jan 2019 21:20:14 +0530 Subject: Sonar fix: ResourceJdbcDaoImpl.java Fixed sonar issues/code-smells across this file Issue-ID: CCSDK-919 Change-Id: I2f23c4fd39b55393590fd97d6a95a0c5acbb2a6d Signed-off-by: Arundathi Patil --- .../ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java index c94a5d8a0..f9de42802 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +37,8 @@ import org.springframework.jdbc.support.KeyHolder; public class ResourceJdbcDaoImpl implements ResourceJdbcDao { + private static final String baseSelectResourceQuery = "SELECT * FROM RESOURCE WHERE resource_id IN (\n"; + @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(ResourceJdbcDaoImpl.class); @@ -44,16 +47,16 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao { private static final String RESOURCE_QUERY_1_SQL = "SELECT * FROM RESOURCE WHERE asset_id LIKE ? AND resource_name = ?"; - private static final String RESOURCE_SET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" + private static final String RESOURCE_SET_SQL = baseSelectResourceQuery + "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" + private static final String RESOURCE_UNION_SQL = baseSelectResourceQuery + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?)"; - private static final String RESOURCE_SET_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" + private static final String RESOURCE_SET_FOR_ASSET_SQL = baseSelectResourceQuery + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_set_id = ?) AND asset_id = ?"; - private static final String RESOURCE_UNION_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n" + private static final String RESOURCE_UNION_FOR_ASSET_SQL = baseSelectResourceQuery + "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?) AND asset_id = ?"; private static final String INSERT_SQL = "INSERT INTO RESOURCE (\n" -- cgit 1.2.3-korg From 21ec6554123a0496d8e210739e94d91b23ca3340 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 8 Jan 2019 12:14:12 -0500 Subject: Prepare for release build Prepare for release of early ODL-Oxygen based CCSDK Dublin Change-Id: I636340b7317348c3f2c68897fc06656e1a917076 Issue-ID: CCSDK-870 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 112 ++++---- aai-service/features/features-aai-service/pom.xml | 46 ++-- aai-service/features/pom.xml | 4 +- aai-service/installer/pom.xml | 4 +- aai-service/pom.xml | 4 +- aai-service/provider/pom.xml | 295 ++++++++++----------- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- .../ccsdk-ansible-adapter/pom.xml | 44 +-- .../features-ansible-adapter/pom.xml | 8 +- ansible-adapter/ansible-adapter-features/pom.xml | 5 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 3 +- artifacts/pom.xml | 6 +- features/ccsdk-sli-adaptors-all/pom.xml | 172 ++++++------ features/features-sli-adaptors/pom.xml | 6 +- features/installer/pom.xml | 7 +- features/pom.xml | 2 +- .../features/ccsdk-mdsal-resource/pom.xml | 108 ++++---- .../features/features-mdsal-resource/pom.xml | 11 +- mdsal-resource/features/pom.xml | 7 +- mdsal-resource/installer/pom.xml | 7 +- mdsal-resource/pom.xml | 7 +- mdsal-resource/provider/pom.xml | 8 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 9 +- .../features/features-netbox-client/pom.xml | 11 +- netbox-client/features/pom.xml | 5 +- netbox-client/installer/pom.xml | 7 +- netbox-client/pom.xml | 5 +- netbox-client/provider/pom.xml | 10 +- pom.xml | 5 +- .../features/ccsdk-resource-assignment/pom.xml | 11 +- .../features/features-resource-assignment/pom.xml | 11 +- resource-assignment/features/pom.xml | 7 +- resource-assignment/installer/pom.xml | 7 +- resource-assignment/pom.xml | 7 +- resource-assignment/provider/pom.xml | 8 +- saltstack-adapter/pom.xml | 7 +- .../ccsdk-saltstack-adapter/pom.xml | 10 +- .../features-saltstack-adapter/pom.xml | 10 +- .../saltstack-adapter-features/pom.xml | 6 +- .../saltstack-adapter-installer/pom.xml | 6 +- .../saltstack-adapter-provider/pom.xml | 6 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 47 ++-- .../features/features-sql-resource/pom.xml | 11 +- sql-resource/features/pom.xml | 7 +- sql-resource/installer/pom.xml | 7 +- sql-resource/pom.xml | 7 +- sql-resource/provider/pom.xml | 8 +- version.properties | 2 +- 49 files changed, 563 insertions(+), 544 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index e7460112b..70172416c 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -1,57 +1,59 @@ - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.2.0-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-aai-service - 0.4.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - xml - features - - - - ${project.groupId} - aai-service-provider - ${project.version} - - - - + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.2.0 + + + + org.onap.ccsdk.sli.adaptors + ccsdk-aai-service + 0.4.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + + + ${project.version} + + + + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + xml + features + + + + ${project.groupId} + aai-service-provider + ${project.version} + + + + diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 742e006db..a7db1a4cf 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -1,29 +1,33 @@ - 4.0.0 + 4.0.0 - - org.onap.ccsdk.parent - feature-repo-parent - 1.2.0-SNAPSHOT - - + + org.onap.ccsdk.parent + feature-repo-parent + 1.2.0 + + - org.onap.ccsdk.sli.adaptors - features-aai-service - 0.4.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + features-aai-service + 0.4.0-SNAPSHOT + feature - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - - ${project.groupId} - ccsdk-aai-service - ${project.version} - xml - features - + + ${project.version} + - + + + ${project.groupId} + ccsdk-aai-service + ${project.version} + xml + features + + + diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 787c56234..129aea516 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,8 +5,8 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index dbc793fc8..3cfbf41b5 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,8 +5,8 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 7b1d5535a..d5805b757 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,8 +5,8 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 441143263..cd4d30bd3 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -1,157 +1,156 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - binding-parent - 1.2.0-SNAPSHOT - - + + org.onap.ccsdk.parent + binding-parent + 1.2.0 + + - org.onap.ccsdk.sli.adaptors - aai-service-provider - 0.4.0-SNAPSHOT - bundle + org.onap.ccsdk.sli.adaptors + aai-service-provider + 0.4.0-SNAPSHOT + bundle - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - http://maven.apache.org + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + http://maven.apache.org - - UTF-8 - + + UTF-8 + ${project.version} + - - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.onap.ccsdk.sli.core - sli-common - compile - - - org.onap.ccsdk.sli.core - sli-provider - compile - - - org.onap.ccsdk.sli.core - utils-provider - ${sdnctl.sli.version} - - - org.osgi - org.osgi.core - provided - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - - - com.sun.jersey - jersey-client - - - com.sun.jersey - jersey-core - - - org.apache.httpcomponents - httpcore - ${apache.httpcomponents.core.version} - - - org.apache.httpcomponents - httpclient - ${apache.httpcomponents.client.version} - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-core - - - commons-lang - commons-lang - + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.onap.ccsdk.sli.core + sli-common + compile + + + org.onap.ccsdk.sli.core + sli-provider + compile + + + org.onap.ccsdk.sli.core + utils-provider + ${sdnctl.sli.version} + + + org.osgi + org.osgi.core + provided + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-core + + + org.apache.httpcomponents + httpcore + ${apache.httpcomponents.core.version} + + + org.apache.httpcomponents + httpclient + ${apache.httpcomponents.client.version} + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + commons-lang + commons-lang + - - org.jsoup - jsoup - 1.8.3 - test - - - org.springframework - spring-core - 4.3.5.RELEASE - test - - + + org.jsoup + jsoup + 1.8.3 + test + + + org.springframework + spring-core + 4.3.5.RELEASE + test + + - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - 0.13.1 - - - gen-xjc - - generate - - - - - ${project.basedir}/src/main/resources - - aai_schema_v14.xsd - - - aai-schema-bindings.xjb - - ${project.build.directory}/generated-sources/main/java - org.onap.aai.inventory.v14 - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 0.6.4 - - - - - - + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.13.1 + + + gen-xjc + + generate + + + + + ${project.basedir}/src/main/resources + + aai_schema_v14.xsd + + + aai-schema-bindings.xjb + + ${project.build.directory}/generated-sources/main/java + org.onap.aai.inventory.v14 + true + + -Xannotate + + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.4 + + + + + + diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 858d22737..0033d2dee 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 7f770ac9f..5e2b41f9e 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,8 +5,8 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -16,24 +16,28 @@ ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - + + ${project.version} + + + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index f073f181b..d59a943f5 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,8 +5,8 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -16,6 +16,10 @@ ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index be9e9afe0..8841b956c 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -11,13 +11,12 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - + 4.0.0 odlparent-lite org.onap.ccsdk.parent - 1.2.0-SNAPSHOT + 1.2.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 556f85dd5..f9d4d058b 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index ffcead8f7..4b0db6bb2 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -22,13 +22,12 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 701cf3fcf..819f43c51 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -1,7 +1,5 @@ - + 4.0.0 org.onap.ccsdk.sli.adaptors @@ -19,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 367c48f6b..48907270c 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -1,98 +1,98 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - single-feature-parent - 1.2.0-SNAPSHOT - - + + org.onap.ccsdk.parent + single-feature-parent + 1.2.0 + + - org.onap.ccsdk.sli.adaptors - ccsdk-sli-adaptors-all - 0.4.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + ccsdk-sli-adaptors-all + 0.4.0-SNAPSHOT + feature - ccsdk-sli-adaptors :: features :: ${project.artifactId} + ccsdk-sli-adaptors :: features :: ${project.artifactId} - - - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - + + ${project.version} + + + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + org.onap.ccsdk.sli.adaptors aai-service-provider ${project.version} - - + + - - - ${project.groupId} - ccsdk-aai-service - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-ansible-adapter - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-saltstack-adapter - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-netbox-client - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-mdsal-resource - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-resource-assignment - ${project.version} - xml - features - - - ${project.groupId} - ccsdk-sql-resource - ${project.version} - xml - features - - - + + + ${project.groupId} + ccsdk-aai-service + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-ansible-adapter + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-saltstack-adapter + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-netbox-client + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-mdsal-resource + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-resource-assignment + ${project.version} + xml + features + + + ${project.groupId} + ccsdk-sql-resource + ${project.version} + xml + features + + + diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index eeffd8be2..0d2724f12 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT + 1.2.0 @@ -16,6 +16,10 @@ ccsdk-sli-adaptors :: features :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 06f306324..3578e6224 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/features/pom.xml b/features/pom.xml index 4a673deb8..cd720a6ab 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 12779d266..7f1e9cae0 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -1,55 +1,57 @@ - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.2.0-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-mdsal-resource - 0.4.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - xml - features - - - - ${project.groupId} - mdsal-resource-provider - ${project.version} - - - + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.2.0 + + + + org.onap.ccsdk.sli.adaptors + ccsdk-mdsal-resource + 0.4.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + ${project.version} + + + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + xml + features + + + + ${project.groupId} + mdsal-resource-provider + ${project.version} + + + diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 9d4c8bb32..5d5c396c6 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -17,6 +16,10 @@ ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 6f1838790..45d62b578 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 77cb421ab..60f51901a 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index bc9ea8f00..694b90cb0 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index f6f65bd82..aa8e499e5 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -20,6 +19,7 @@ UTF-8 + ${project.version} diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 85e50454f..e470d9958 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.0-SNAPSHOT + 1.2.0 @@ -33,6 +32,10 @@ ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + + ${project.version} + + org.opendaylight.controller diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 93711e02e..ead872f19 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -14,15 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -32,6 +31,10 @@ ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index cc602b3db..646be91c8 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index ed63472b0..7578d5064 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -14,15 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index efbc63769..453f8d54c 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,8 +20,8 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -38,4 +38,3 @@ installer - diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index d1de7ab21..ec56f6dfd 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -14,14 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT + 1.2.0 @@ -33,6 +31,10 @@ ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + + ${project.version} + + diff --git a/pom.xml b/pom.xml index f6a937d57..710589608 100755 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,10 @@ - + org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 23c252b7a..a0fc97d00 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -18,6 +17,10 @@ ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + ${project.version} + + diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index b830c06e9..857bff8d3 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -17,6 +16,10 @@ ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 5c51b266d..1944715cd 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 1aee9696d..23bb04fe0 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 5ed3df9aa..8bacbfe71 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index a431968a0..5bdb91051 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -20,6 +19,7 @@ UTF-8 + ${project.version} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 8f58b89d1..f38f506d1 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -22,15 +22,12 @@ ============LICENSE_END========================================================= --> - - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 67bc40f9c..7f16e2b6d 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.0-SNAPSHOT + 1.2.0 @@ -17,6 +15,10 @@ feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + + + ${project.version} + diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 44f156fca..c42b54e90 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT + 1.2.0 @@ -19,6 +17,10 @@ ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 1ed6bb870..f6f707bfe 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -10,14 +10,12 @@ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> - + 4.0.0 odlparent-lite org.onap.ccsdk.parent - 1.2.0-SNAPSHOT + 1.2.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 5a7d58205..868b61760 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -22,14 +22,12 @@ ============LICENSE_END========================================================= --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT + 1.2.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 5308dc145..e6603014a 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -11,14 +11,12 @@ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT + 1.2.0 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 39138b34e..2a74960c9 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -17,24 +16,28 @@ ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - + + ${project.version} + + + + + + org.opendaylight.controller + mdsal-artifacts + ${odl.mdsal.version} + pom + import + + + org.opendaylight.mdsal.model + mdsal-model-artifacts + ${odl.mdsal.model.version} + pom + import + + + diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index e2dad22a3..d9e298461 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -17,6 +16,10 @@ ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + ${project.version} + + ${project.groupId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 4aed70a1f..856e53e93 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.1.1 - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 0a074e3e9..ba999141b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 8b163779f..cb9002328 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index dc562da6f..7285867ee 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.0-SNAPSHOT - + 1.2.0 + org.onap.ccsdk.sli.adaptors @@ -20,6 +19,7 @@ UTF-8 + ${project.version} diff --git a/version.properties b/version.properties index 7439a509f..e1b84eea2 100644 --- a/version.properties +++ b/version.properties @@ -9,6 +9,6 @@ feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -release_version=${base_version}-STAGING +release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg From 8f446067f20b96fefb507b877b17f0bd453c49be Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Wed, 9 Jan 2019 17:25:25 +0530 Subject: fixed sonar issues in ResourceAllocator.java fixed sonar issues Issue-ID: CCSDK-525 Change-Id: Ifb2155d46aa1d1552c2ce1a9b0660b5b787e2f92 Signed-off-by: Sandeep J --- .../java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index c0cf774a8..c0220d6b3 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -51,6 +51,9 @@ public class ResourceAllocator implements SvcLogicResource { private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; private static final String START_RELEASE = "Starting release for: {}"; private static final String START_RELEASE_FOR_TARGET = "Starting release for: {} on target: {}"; + private static final String RESOURCE_ENTITY_ID= "resource-entity-id"; + private static final String SERVICE_INSTANCE_ID="service-instance-id"; + private static final String RESERVATION_ENTITY_ID= "reservation-entity-id"; private ResourceManager resourceManager; private EndPointAllocator endPointAllocator; @@ -101,7 +104,7 @@ public class ResourceAllocator implements SvcLogicResource { String orderBy, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, false, null); + new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, false, null); String resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, false, null); String resourceEntityVersion = @@ -198,7 +201,7 @@ public class ResourceAllocator implements SvcLogicResource { @Override public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, true, null); String resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); String resourceEntityVersion = @@ -386,7 +389,7 @@ public class ResourceAllocator implements SvcLogicResource { private ResourceEntity getResourceEntityData(SvcLogicContext ctx) throws SvcLogicException { ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = getParam(ctx, - new String[] {"service-instance-id", "reservation-entity-id", "resource-entity-id"}, true, null); + new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, true, null); sd.resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); sd.resourceEntityVersion = -- cgit 1.2.3-korg From 0cf282459fe7cf129a390d59d46b6de299ac86db Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Thu, 10 Jan 2019 12:52:58 -0500 Subject: RA: Fix locking when there is expired lock in DB Change-Id: I026bdea43c0386689c98902aac95be02e27f7704 Issue-ID: CCSDK-937 Signed-off-by: Stan Bonev --- .../sli/adaptors/lock/comp/LockHelperImpl.java | 15 +++++++--- .../sli/adaptors/lock/dao/ResourceLockDao.java | 2 +- .../sli/adaptors/lock/dao/ResourceLockDaoImpl.java | 32 +++++++++------------- .../sli/adaptors/ra/TestResourceLockNode.java | 1 + 4 files changed, 26 insertions(+), 24 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java index 0efd8977a..735d240c0 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/comp/LockHelperImpl.java @@ -45,7 +45,8 @@ public class LockHelperImpl implements LockHelper { } @Override - public void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount) { + public void lock(String resourceName, String lockRequester, int lockTimeout /* Seconds */, + int lockWait /* Seconds */, int retryCount) { lock(Collections.singleton(resourceName), lockRequester, lockTimeout, lockWait, retryCount); } @@ -60,7 +61,8 @@ public class LockHelperImpl implements LockHelper { } @Override - public void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */, int lockWait /* Seconds */, int retryCount) { + public void lock(Collection resourceNameList, String lockRequester, int lockTimeout /* Seconds */, + int lockWait /* Seconds */, int retryCount) { for (int i = 0; true; i++) { try { tryLock(resourceNameList, lockRequester, lockTimeout); @@ -129,6 +131,9 @@ public class LockHelperImpl implements LockHelper { } if (l != null) { + if (now.getTime() > l.expirationTime.getTime() || l.lockCount <= 0) { + l.lockCount = 0; + } dbLockList.add(l); } else { insertLockNameList.add(name); @@ -137,7 +142,7 @@ public class LockHelperImpl implements LockHelper { // Update the lock info in DB for (ResourceLock l : dbLockList) { - resourceLockDao.update(l.id, now, new Date(now.getTime() + lockTimeout * 1000), l.lockCount + 1); + resourceLockDao.update(l.id, lockRequester, now, new Date(now.getTime() + lockTimeout * 1000), l.lockCount + 1); } // Insert records for those that are not yet there @@ -159,7 +164,9 @@ public class LockHelperImpl implements LockHelper { resourceLockDao.commit(); - } finally { + }finally + + { resourceLockDao.rollback(); } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java index f9d41135c..dc86f70af 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDao.java @@ -28,7 +28,7 @@ public interface ResourceLockDao { void add(ResourceLock l); - void update(long id, Date lockTime, Date expirationTime, int lockCount); + void update(long id, String lockHolder, Date lockTime, Date expirationTime, int lockCount); ResourceLock getByResourceName(String resourceName); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java index 485419224..b8b3a66d6 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/lock/dao/ResourceLockDaoImpl.java @@ -21,8 +21,6 @@ package org.onap.ccsdk.sli.adaptors.lock.dao; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Date; import java.util.List; import org.onap.ccsdk.sli.adaptors.lock.data.ResourceLock; @@ -44,32 +42,28 @@ public class ResourceLockDaoImpl implements ResourceLockDao { 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 }); + new Object[] { l.resourceName, l.lockHolder, l.lockCount, l.lockTime, l.expirationTime }); } @Override - public void update(long id, Date lockTime, Date expirationTime, int lockCount) { + public void update(long id, String lockHolder, 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 }); + "UPDATE RESOURCE_LOCK SET lock_holder = ?, lock_time = ?, expiration_time = ?, lock_count = ? WHERE resource_lock_id = ?", + new Object[] { lockHolder, 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; - } + new Object[] { resourceName }, (RowMapper) (rs, rowNum) -> { + 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; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java index 377257c41..bfb9ad7e4 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java @@ -28,6 +28,7 @@ public class TestResourceLockNode { public void test1() throws Exception { Map paramMap = new HashMap<>(); paramMap.put("resource-name", "test-resource-1"); + paramMap.put("lock-requester", "SDNA"); resourceLockNode.lockResource(paramMap, null); resourceLockNode.unlockResource(paramMap, null); -- cgit 1.2.3-korg From f200a729ebedc2d292251e4f8a1b20b2e1668b7d Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 3 Jan 2019 16:24:22 -0500 Subject: Changes for Fluorine Update sli/adaptors to compile against ODL Fluorine Change-Id: I9ec4c89301678e9398dc2c43db4cffff03953806 Issue-ID: CCSDK-870 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 25 ++----- aai-service/features/features-aai-service/pom.xml | 4 +- aai-service/features/pom.xml | 4 +- aai-service/installer/pom.xml | 4 +- aai-service/pom.xml | 4 +- aai-service/provider/pom.xml | 16 ++++- ansible-adapter/ansible-adapter-bundle/pom.xml | 27 +++++-- .../ccsdk-ansible-adapter/pom.xml | 23 +----- .../features-ansible-adapter/pom.xml | 4 +- ansible-adapter/ansible-adapter-features/pom.xml | 4 +- ansible-adapter/ansible-adapter-installer/pom.xml | 4 +- ansible-adapter/pom.xml | 4 +- artifacts/pom.xml | 4 +- features/ccsdk-sli-adaptors-all/pom.xml | 29 ++------ features/features-sli-adaptors/pom.xml | 4 +- features/installer/pom.xml | 4 +- features/pom.xml | 4 +- .../features/ccsdk-mdsal-resource/pom.xml | 24 ++----- .../features/features-mdsal-resource/pom.xml | 4 +- mdsal-resource/features/pom.xml | 4 +- mdsal-resource/installer/pom.xml | 4 +- mdsal-resource/pom.xml | 4 +- mdsal-resource/provider/pom.xml | 16 ++++- netbox-client/features/ccsdk-netbox-client/pom.xml | 5 +- .../features/features-netbox-client/pom.xml | 4 +- netbox-client/features/pom.xml | 4 +- netbox-client/installer/pom.xml | 4 +- netbox-client/pom.xml | 4 +- netbox-client/provider/pom.xml | 22 +++++- pom.xml | 4 +- .../features/ccsdk-resource-assignment/pom.xml | 22 +----- .../features/features-resource-assignment/pom.xml | 4 +- resource-assignment/features/pom.xml | 4 +- resource-assignment/installer/pom.xml | 4 +- resource-assignment/pom.xml | 4 +- resource-assignment/provider/pom.xml | 17 ++++- saltstack-adapter/pom.xml | 4 +- .../ccsdk-saltstack-adapter/pom.xml | 82 +++++++++------------- .../features-saltstack-adapter/pom.xml | 4 +- .../saltstack-adapter-features/pom.xml | 4 +- .../saltstack-adapter-installer/pom.xml | 4 +- .../saltstack-adapter-provider/pom.xml | 20 +++++- sql-resource/features/ccsdk-sql-resource/pom.xml | 24 ++----- .../features/features-sql-resource/pom.xml | 4 +- sql-resource/features/pom.xml | 4 +- sql-resource/installer/pom.xml | 4 +- sql-resource/pom.xml | 4 +- sql-resource/provider/pom.xml | 22 +++++- version.properties | 2 +- 49 files changed, 247 insertions(+), 261 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 70172416c..a633b2476 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,45 +5,28 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + ${project.version} - - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index a7db1a4cf..3e4748a99 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 129aea516..1c34eb4a3 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 3cfbf41b5..c480fb38a 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index d5805b757..b28dea668 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index cd4d30bd3..cbf161d6f 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} @@ -21,6 +21,18 @@ UTF-8 ${project.version} + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 0033d2dee..5ae79b34f 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -12,21 +12,40 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.0 - + 1.2.1-SNAPSHOT + org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + + + ${project.version} + + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + com.att.eelf diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 5e2b41f9e..daceea7e9 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} @@ -20,29 +20,12 @@ ${project.version} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index d59a943f5..f742f14e3 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 8841b956c..2fd0e8dc7 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index f9d4d058b..f1cc2a47c 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 4b0db6bb2..083fbb98b 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 819f43c51..5660ff3d0 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.0 + 1.2.1-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 48907270c..77ccb4c8b 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,43 +5,22 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} + ${project.version} - - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.onap.ccsdk.sli.adaptors - aai-service-provider - ${project.version} - - - + diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 0d2724f12..23905b834 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 3578e6224..1e3ea210c 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index cd720a6ab..52cda122a 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 7f1e9cae0..c9bf1a31a 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,44 +5,28 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + ${project.version} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 5d5c396c6..72db30508 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 45d62b578..7e23f9639 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 60f51901a..d4e4f67d7 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 694b90cb0..700e475d4 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index aa8e499e5..dc73c6019 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} @@ -21,6 +21,18 @@ UTF-8 ${project.version} + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index e470d9958..361227209 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} @@ -47,6 +47,7 @@ org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index ead872f19..2f5144b58 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 646be91c8..ef3e436a9 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 7578d5064..221e418de 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 453f8d54c..1dd15ed9b 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index ec56f6dfd..3af22edb2 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle 4.0.0 @@ -35,6 +35,18 @@ ${project.version} + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + @@ -99,7 +111,11 @@ 1.2.3 test - + + org.osgi + org.osgi.core + test + diff --git a/pom.xml b/pom.xml index 710589608..2d1ea1562 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT 4.0.0 @@ -120,7 +120,7 @@ ONAP - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index a0fc97d00..afe0ca4ad 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} @@ -21,24 +21,6 @@ ${project.version} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 857bff8d3..5438d59b8 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 1944715cd..074f1eba5 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 23bb04fe0..16c62d576 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 8bacbfe71..35b5b8801 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 5bdb91051..e5177995c 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} @@ -21,6 +21,19 @@ UTF-8 ${project.version} + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index f38f506d1..1947a1760 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 7f16e2b6d..09ed8db07 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -1,54 +1,40 @@ - - 4.0.0 + + 4.0.0 - - org.onap.ccsdk.parent - single-feature-parent - 1.2.0 - - + + org.onap.ccsdk.parent + single-feature-parent + 1.2.1-SNAPSHOT + + - org.onap.ccsdk.sli.adaptors - ccsdk-saltstack-adapter - 0.4.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + ccsdk-saltstack-adapter + 0.4.1-SNAPSHOT + feature - ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + + + ${project.version} + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + + + ${project.groupId} + saltstack-adapter-provider + ${project.version} + + - - ${project.version} - - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - - diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index c42b54e90..9c4693ee2 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index f6f707bfe..674dc14f1 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 868b61760..da2f620a2 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index e6603014a..5fee5cdcf 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,17 +16,33 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} + + ${project.version} + + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + com.att.eelf diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 2a74960c9..cc72027d7 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,44 +5,28 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + ${project.version} - - - - org.opendaylight.controller - mdsal-artifacts - ${odl.mdsal.version} - pom - import - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - ${odl.mdsal.model.version} - pom - import - - - org.onap.ccsdk.sli.core ccsdk-sli + ${ccsdk.sli.core.version} xml features provided diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index d9e298461..8c23b28dd 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 856e53e93..12e276157 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index ba999141b..d1d9dda11 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index cb9002328..5146a92fe 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 7285867ee..23b4414bc 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.0 + 1.2.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.4.0-SNAPSHOT + 0.4.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} @@ -22,6 +22,18 @@ ${project.version} + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + junit @@ -63,7 +75,11 @@ dblib-provider provided - + + org.osgi + org.osgi.core + provided + diff --git a/version.properties b/version.properties index e1b84eea2..2a56aedac 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=4 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 0a6fde9973487398b9cdb3fdfa3f79fac2bd9048 Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Mon, 21 Jan 2019 09:51:30 -0500 Subject: RA: Allow for partial resource release Change-Id: Ie0cffbfaae6bb0ffcdb682f91ef3481fbdb35d7a Issue-ID: CCSDK-971 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 72 +++++++------ .../adaptors/ra/comp/EndPointAllocatorImpl.java | 3 +- .../sli/adaptors/ra/comp/ResourceRequest.java | 2 + .../sli/adaptors/rm/comp/ReleaseFunction.java | 98 +++++++++++++---- .../sli/adaptors/rm/comp/ResourceManager.java | 9 +- .../sli/adaptors/rm/comp/ResourceManagerImpl.java | 62 ++++------- .../ccsdk/sli/adaptors/rm/data/ReleaseRequest.java | 46 ++++++++ .../org/onap/ccsdk/sli/adaptors/ra/DataSetup.java | 6 ++ .../onap/ccsdk/sli/adaptors/ra/TestRelease.java | 120 +++++++++++++++++++++ 9 files changed, 314 insertions(+), 104 deletions(-) create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ReleaseRequest.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index c0220d6b3..944429a3c 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -36,6 +36,7 @@ import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceResponse; import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceTarget; import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManager; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationStatus; +import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -49,11 +50,6 @@ public class ResourceAllocator implements SvcLogicResource { private static final Logger log = LoggerFactory.getLogger(ResourceAllocator.class); private static final String[] INPUT_PREFIX = {"ra-input.", "tmp.resource-allocator."}; - private static final String START_RELEASE = "Starting release for: {}"; - private static final String START_RELEASE_FOR_TARGET = "Starting release for: {} on target: {}"; - private static final String RESOURCE_ENTITY_ID= "resource-entity-id"; - private static final String SERVICE_INSTANCE_ID="service-instance-id"; - private static final String RESERVATION_ENTITY_ID= "reservation-entity-id"; private ResourceManager resourceManager; private EndPointAllocator endPointAllocator; @@ -104,7 +100,7 @@ public class ResourceAllocator implements SvcLogicResource { String orderBy, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, false, null); + new String[] {"service-instance-id", "resource-entity-id", "reservation-entity-id"}, false, null); String resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, false, null); String resourceEntityVersion = @@ -150,7 +146,7 @@ public class ResourceAllocator implements SvcLogicResource { ResourceData rd = endPointAllocator.getResource(rt.resourceTargetType, rt.resourceTargetId, rr.resourceName, rr.resourceEntityTypeFilter, rr.resourceEntityIdFilter, rr.resourceShareGroupFilter); setResourceDataInResponse(Collections.singletonList(rd), rsList); - } else if ((rr!=null && (rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null)) + } else if (rr != null && (rr.resourceTargetTypeFilter != null || rr.resourceTargetIdFilter != null) && rr.resourceName != null) { List rdlist = endPointAllocator.getResourcesForTarget(rr.resourceTargetTypeFilter, rr.resourceTargetIdFilter, rr.resourceName); @@ -201,7 +197,7 @@ public class ResourceAllocator implements SvcLogicResource { @Override public QueryStatus release(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { String resourceEntityId = getParam(ctx, - new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, true, null); + new String[] {"service-instance-id", "resource-entity-id", "reservation-entity-id"}, true, null); String resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); String resourceEntityVersion = @@ -210,6 +206,11 @@ public class ResourceAllocator implements SvcLogicResource { getParam(ctx, new String[] {"reservation-target-id", "resource-target-id"}, false, null); String resourceTargetType = getParam(ctx, new String[] {"reservation-target-type", "resource-target-type"}, false, null); + String resourceName = getParam(ctx, new String[] {"resource-name"}, false, null); + String limitReleaseAmountStr = getParam(ctx, new String[] {"limit-release-amount"}, false, "-1"); + int limitReleaseAmount = Integer.parseInt(limitReleaseAmountStr); + String rangeReleaseNumbers = getParam(ctx, new String[] {"range-release-numbers"}, false, null); + String endPointPosition = getParam(ctx, "endpoint-position", false, null); @@ -220,6 +221,9 @@ public class ResourceAllocator implements SvcLogicResource { ResourceRequest rr = new ResourceRequest(); rr.endPointPosition = endPointPosition; + rr.resourceName = resourceName; + rr.rangeReleaseNumbers = rangeReleaseNumbers; + rr.limitReleaseAmount = limitReleaseAmount; ResourceTarget rt = new ResourceTarget(); rt.resourceTargetType = resourceTargetType; @@ -243,44 +247,46 @@ public class ResourceAllocator implements SvcLogicResource { public AllocationStatus release(ResourceEntity sd, ResourceRequest rr, ResourceTarget rt) throws Exception { + ReleaseRequest releaseRequest = new ReleaseRequest(); + if (sd != null && sd.resourceEntityVersion != null) { - String resourceSet = null; + releaseRequest.resourceSetId = null; if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { - resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition + "::" - + sd.resourceEntityVersion; - } else { - resourceSet = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; - } - - if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null) { - String assetId = rt.resourceTargetType + "::" + rt.resourceTargetId; - log.info(START_RELEASE_FOR_TARGET, resourceSet, assetId); - resourceManager.releaseResourceSet(resourceSet, assetId); + releaseRequest.resourceSetId = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + + rr.endPointPosition + "::" + sd.resourceEntityVersion; } else { - log.info(START_RELEASE, resourceSet); - resourceManager.releaseResourceSet(resourceSet); + releaseRequest.resourceSetId = + sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + sd.resourceEntityVersion; } } else if (sd != null && (sd.resourceEntityVersion == null || sd.resourceEntityVersion.isEmpty())) { - String resourceUnion = null; + releaseRequest.resourceUnionId = null; if (rr != null && rr.endPointPosition != null && !rr.endPointPosition.isEmpty()) { - resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition; + releaseRequest.resourceUnionId = + sd.resourceEntityType + "::" + sd.resourceEntityId + "::" + rr.endPointPosition; } else { - resourceUnion = sd.resourceEntityType + "::" + sd.resourceEntityId; + releaseRequest.resourceUnionId = sd.resourceEntityType + "::" + sd.resourceEntityId; } + } - if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null) { - String assetId = rt.resourceTargetType + "::" + rt.resourceTargetId; - log.info(START_RELEASE_FOR_TARGET, resourceUnion, assetId); - resourceManager.releaseResourceUnion(resourceUnion, assetId); - } else { - log.info(START_RELEASE, resourceUnion); - resourceManager.releaseResourceUnion(resourceUnion); - } + if (rt != null && rt.resourceTargetId != null && rt.resourceTargetType != null) { + releaseRequest.assetId = rt.resourceTargetType + "::" + rt.resourceTargetId; + } + + if (rr != null) { + releaseRequest.resourceName = rr.resourceName; + releaseRequest.releaseNumbers = + StrUtil.listInt(rr.rangeReleaseNumbers, "Invalid value for range-release-numbers"); + releaseRequest.releaseAmount = rr.limitReleaseAmount; } + log.info("Releasing resources:"); + StrUtil.info(log, releaseRequest); + + resourceManager.releaseResources(releaseRequest); + return AllocationStatus.Success; } @@ -389,7 +395,7 @@ public class ResourceAllocator implements SvcLogicResource { private ResourceEntity getResourceEntityData(SvcLogicContext ctx) throws SvcLogicException { ResourceEntity sd = new ResourceEntity(); sd.resourceEntityId = getParam(ctx, - new String[] {SERVICE_INSTANCE_ID, RESERVATION_ENTITY_ID, RESOURCE_ENTITY_ID}, true, null); + new String[] {"service-instance-id", "resource-entity-id", "reservation-entity-id"}, true, null); sd.resourceEntityType = getParam(ctx, new String[] {"reservation-entity-type", "resource-entity-type"}, true, null); sd.resourceEntityVersion = diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index f4109a1de..d188429ea 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -39,6 +39,7 @@ import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; +import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; import org.slf4j.Logger; @@ -83,7 +84,7 @@ public class EndPointAllocatorImpl implements EndPointAllocator { if (!allgood) { String resourceSetId = resourceEntity.resourceEntityType + "::" + resourceEntity.resourceEntityId + "::" + resourceEntity.resourceEntityVersion; - resourceManager.releaseResourceSet(resourceSetId); + resourceManager.releaseResources(ReleaseRequest.resourceSet(resourceSetId)); } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index c870bc414..bc05af657 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -48,4 +48,6 @@ public class ResourceRequest { public String resourceShareGroupFilter; public String resourceTargetTypeFilter; public String resourceTargetIdFilter; + public String rangeReleaseNumbers; + public int limitReleaseAmount; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java index b26c54cfa..b466b164b 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ReleaseFunction.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,6 +22,7 @@ package org.onap.ccsdk.sli.adaptors.rm.comp; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -30,7 +31,11 @@ import org.onap.ccsdk.sli.adaptors.lock.comp.ResourceLockedException; import org.onap.ccsdk.sli.adaptors.lock.comp.SynchronizedFunction; import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; +import org.onap.ccsdk.sli.adaptors.rm.data.ResourceType; import org.onap.ccsdk.sli.adaptors.rm.util.ResourceUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,42 +47,93 @@ class ReleaseFunction extends SynchronizedFunction { private ResourceDao resourceDao; - private String resourceSetId; - private String resourceUnionId; - private String assetId; + private ReleaseRequest releaseRequest; - public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, String resourceSetId, String resourceUnionId, - String assetId, Collection lockNames, int lockTimeout) { + public ReleaseFunction(LockHelper lockHelper, ResourceDao resourceDao, ReleaseRequest releaseRequest, + Collection lockNames, int lockTimeout) { super(lockHelper, lockNames, lockTimeout); this.resourceDao = resourceDao; - this.resourceSetId = resourceSetId; - this.resourceUnionId = resourceUnionId; - this.assetId = assetId; + this.releaseRequest = releaseRequest; } @Override public void _exec() throws ResourceLockedException { - List resourceList = assetId != null - ? (resourceSetId != null ? resourceDao.getResourceSetForAsset(resourceSetId, assetId) - : resourceDao.getResourceUnionForAsset(resourceUnionId, assetId)) - : (resourceSetId != null ? resourceDao.getResourceSet(resourceSetId) - : resourceDao.getResourceUnion(resourceUnionId)); + List resourceList = new ArrayList<>(); + if (releaseRequest.assetId != null && releaseRequest.resourceName != null) { + Resource r = resourceDao.getResource(releaseRequest.assetId, releaseRequest.resourceName); + if (r != null) { + resourceList.add(r); + } + } else if (releaseRequest.assetId != null) { + if (releaseRequest.resourceSetId != null) { + resourceList = resourceDao.getResourceSetForAsset(releaseRequest.resourceSetId, releaseRequest.assetId); + } else { + resourceList = + resourceDao.getResourceUnionForAsset(releaseRequest.resourceUnionId, releaseRequest.assetId); + } + } else { + if (releaseRequest.resourceSetId != null) { + resourceList = resourceDao.getResourceSet(releaseRequest.resourceSetId); + } else { + resourceList = resourceDao.getResourceUnion(releaseRequest.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(); + if (releaseRequest.resourceSetId != null) { + + if (releaseRequest.resourceSetId.equals(ai.resourceSetId)) { + if (r.resourceType == ResourceType.Limit) { + LimitAllocationItem lai = (LimitAllocationItem) ai; + if (releaseRequest.releaseAmount > 0 && releaseRequest.releaseAmount < lai.used) { + lai.used -= releaseRequest.releaseAmount; + } else { + i.remove(); + } + } else if (r.resourceType == ResourceType.Range) { + RangeAllocationItem rai = (RangeAllocationItem) ai; + if (releaseRequest.releaseNumbers != null && !releaseRequest.releaseNumbers.isEmpty()) { + rai.used.removeAll(releaseRequest.releaseNumbers); + if (rai.used.isEmpty()) { + i.remove(); + } + } else { + i.remove(); + } + } else { + i.remove(); + } updated = true; } - } else if (resourceUnionId != null) { + } else if (releaseRequest.resourceUnionId != null) { - if (resourceUnionId.equals(ai.resourceUnionId)) { - i.remove(); + if (releaseRequest.resourceUnionId.equals(ai.resourceUnionId)) { + if (r.resourceType == ResourceType.Limit) { + LimitAllocationItem lai = (LimitAllocationItem) ai; + if (releaseRequest.releaseAmount > 0 && releaseRequest.releaseAmount < lai.used) { + lai.used -= releaseRequest.releaseAmount; + } else { + i.remove(); + } + } else if (r.resourceType == ResourceType.Range) { + RangeAllocationItem rai = (RangeAllocationItem) ai; + if (releaseRequest.releaseNumbers != null && !releaseRequest.releaseNumbers.isEmpty()) { + rai.used.removeAll(releaseRequest.releaseNumbers); + if (rai.used.isEmpty()) { + i.remove(); + } + } else { + i.remove(); + } + } else { + i.remove(); + } updated = true; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java index 68d251587..9dd54cc39 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManager.java @@ -24,6 +24,7 @@ package org.onap.ccsdk.sli.adaptors.rm.comp; import java.util.List; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; public interface ResourceManager { @@ -34,13 +35,7 @@ public interface ResourceManager { AllocationOutcome allocateResources(AllocationRequest allocationRequest); - void releaseResourceSet(String resourceSetId); - - void releaseResourceUnion(String resourceUnionId); - - void releaseResourceSet(String resourceSetId, String assetId); - - void releaseResourceUnion(String resourceUnionId, String assetId); + void releaseResources(ReleaseRequest releaseRequest); Resource queryResource(String resourceName, String assetId, String resourceUnionFilter, String resourceShareGroupFilter); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java index c4d53ce70..83da27071 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/ResourceManagerImpl.java @@ -28,6 +28,7 @@ import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelper; import org.onap.ccsdk.sli.adaptors.rm.dao.ResourceDao; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.AllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; import org.onap.ccsdk.sli.adaptors.rm.util.ResourceUtil; import org.onap.ccsdk.sli.adaptors.util.str.StrUtil; @@ -80,54 +81,31 @@ public class ResourceManagerImpl implements ResourceManager { } @Override - public void releaseResourceSet(String resourceSetId) { - List resourceList = resourceDao.getResourceSet(resourceSetId); - if (resourceList == null || resourceList.isEmpty()) { + public void releaseResources(ReleaseRequest releaseRequest) { + if (releaseRequest.resourceSetId == null && releaseRequest.resourceUnionId == null) { return; } - Set lockNames = getLockNames(resourceList); - ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, 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, null, lockNames, lockTimeout); - releaseFunction.exec(); - } - - @Override - public void releaseResourceSet(String resourceSetId, String assetId) { - List resourceList = resourceDao.getResourceSetForAsset(resourceSetId, assetId); - if (resourceList == null || resourceList.isEmpty()) { - return; - } - - Set lockNames = getLockNames(resourceList); - ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, resourceSetId, null, assetId, lockNames, lockTimeout); - releaseFunction.exec(); - } - - @Override - public void releaseResourceUnion(String resourceUnionId, String assetId) { - List resourceList = resourceDao.getResourceUnionForAsset(resourceUnionId, assetId); - if (resourceList == null || resourceList.isEmpty()) { - return; + Set lockNames = new HashSet<>(); + if (releaseRequest.assetId != null) { + lockNames.add(releaseRequest.assetId); + } else { + List resourceList = null; + if (releaseRequest.resourceSetId != null) { + resourceList = resourceDao.getResourceSet(releaseRequest.resourceSetId); + } else { + resourceList = resourceDao.getResourceUnion(releaseRequest.resourceUnionId); + } + + if (resourceList == null || resourceList.isEmpty()) { + return; + } + + lockNames = getLockNames(resourceList); } - Set lockNames = getLockNames(resourceList); ReleaseFunction releaseFunction = - new ReleaseFunction(lockHelper, resourceDao, null, resourceUnionId, assetId, lockNames, lockTimeout); + new ReleaseFunction(lockHelper, resourceDao, releaseRequest, lockNames, lockTimeout); releaseFunction.exec(); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ReleaseRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ReleaseRequest.java new file mode 100644 index 000000000..dba6a172f --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/ReleaseRequest.java @@ -0,0 +1,46 @@ +/*- + * ============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.onap.ccsdk.sli.adaptors.rm.data; + +import java.util.Set; + +public class ReleaseRequest { + + public String resourceUnionId = null; + public String resourceSetId = null; + public String assetId = null; + public String resourceName = null; + public int releaseAmount = 0; + public Set releaseNumbers = null; + + public static ReleaseRequest resourceSet(String resourceSetId) { + ReleaseRequest rr = new ReleaseRequest(); + rr.resourceSetId = resourceSetId; + return rr; + } + + public static ReleaseRequest resourceUnion(String resourceUnionId) { + ReleaseRequest rr = new ReleaseRequest(); + rr.resourceUnionId = resourceUnionId; + return rr; + } +} diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java index 5dcf59917..9aa3f26c4 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/DataSetup.java @@ -96,6 +96,12 @@ public class DataSetup { return allocationItem.exists(where); } + public boolean checkItemNotThere(String resourceName, String assetId, String resourceSetId) { + String where = "resource_id = (SELECT resource_id FROM RESOURCE WHERE resource_name = '" + resourceName + + "' AND asset_id = '" + assetId + "') AND resource_set_id = '" + resourceSetId + "'"; + return !allocationItem.exists(where); + } + public void setTestDb(TestDb testDb) { this.testDb = testDb; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java index a936786ac..88ec586e8 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestRelease.java @@ -49,6 +49,8 @@ public class TestRelease { dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", "5"); + dataSetup.setupRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-6::1", "EVC::TEST-6", "6-20"); + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-1::1", "EVC::TEST-1", 100); dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-1", "EVC::TEST-2::1", "EVC::TEST-2", 200); @@ -67,6 +69,8 @@ public class TestRelease { dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", "EVC::TEST-3", 400); dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-5::1", "EVC::TEST-5", 500); + + dataSetup.setupLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-6::1", "EVC::TEST-6", 1000); } @Test @@ -297,4 +301,120 @@ public class TestRelease { Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::1", 300)); Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-3::2", 400)); } + + @Test + public void test007() throws Exception { + + String t = "007"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - partial release of range"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-6::1", "6-20")); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-6"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-2"); + + ctx.setAttribute("ra-input.resource-name", "test-range-1"); + ctx.setAttribute("ra-input.range-release-numbers", "7,9,15-17"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-6::1", "6,8,10-14,18-20")); + } + + @Test + public void test008() throws Exception { + + String t = "008"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - partial release of range, but release all numbers"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkRangeItem("test-range-1", "Port::TESTPORT-2", "EVC::TEST-6::1", "6-20")); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-6"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-2"); + + ctx.setAttribute("ra-input.resource-name", "test-range-1"); + ctx.setAttribute("ra-input.range-release-numbers", "6-25"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkItemNotThere("test-range-1", "Port::TESTPORT-2", "EVC::TEST-6::1")); + } + + @Test + public void test009() throws Exception { + + String t = "009"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - partial release of limit"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-6::1", 1000)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-6"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-2"); + + ctx.setAttribute("ra-input.resource-name", "test-limit-1"); + ctx.setAttribute("ra-input.limit-release-amount", "200"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-6::1", 800)); + } + + @Test + public void test010() throws Exception { + + String t = "010"; + log.info("============== release node " + t + " ================================"); + log.info("=== Test release - partial release of limit, but release big number"); + + setupResourceData(); + + Assert.assertTrue(dataSetup.checkLimitItem("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-6::1", 1000)); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.resource-entity-type", "EVC"); + ctx.setAttribute("ra-input.resource-entity-id", "TEST-6"); + ctx.setAttribute("ra-input.resource-entity-version", "1"); + + ctx.setAttribute("ra-input.resource-target-type", "Port"); + ctx.setAttribute("ra-input.resource-target-id", "TESTPORT-2"); + + ctx.setAttribute("ra-input.resource-name", "test-limit-1"); + ctx.setAttribute("ra-input.limit-release-amount", "2000"); + + QueryStatus st = resourceAllocator.release("NETWORK-CAPACITY", null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + + Assert.assertTrue(dataSetup.checkItemNotThere("test-limit-1", "Port::TESTPORT-2", "EVC::TEST-6::1")); + } } -- cgit 1.2.3-korg From b521b0f94e76dc8426856aa3726de56d866ab1ba Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Fri, 8 Feb 2019 15:36:56 -0500 Subject: RA: Add allocation items to query results Change-Id: I35e51461ca1119c42e81fd9351c3b9cbd06da644 Issue-ID: CCSDK-1051 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 32 ++++- .../ccsdk/sli/adaptors/ra/comp/AllocationData.java | 11 ++ .../adaptors/ra/comp/EndPointAllocatorImpl.java | 132 ++++++++++++--------- .../ccsdk/sli/adaptors/ra/comp/ResourceData.java | 4 +- .../ccsdk/sli/adaptors/ra/TestQueryResource.java | 42 +++++++ 5 files changed, 161 insertions(+), 60 deletions(-) create mode 100644 resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationData.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 944429a3c..c51b03846 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import org.onap.ccsdk.sli.adaptors.ra.comp.AllocationData; import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocator; import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceData; import org.onap.ccsdk.sli.adaptors.ra.comp.ResourceEntity; @@ -124,7 +125,9 @@ public class ResourceAllocator implements SvcLogicResource { } else if (resourceTargetId != null && resourceTargetType != null && resourceName != null) { ResourceData rd = endPointAllocator.getResource(resourceTargetType, resourceTargetId, resourceName, resourceEntityTypeFilter, resourceEntityIdFilter, resourceShareGroupFilter); - setResourceDataInContext(ctx, prefix, Collections.singletonList(rd)); + if (rd != null) { + setResourceDataInContext(ctx, prefix, Collections.singletonList(rd)); + } } else if ((resourceTargetTypeFilter != null || resourceTargetIdFilter != null) && resourceName != null) { List rdlist = endPointAllocator.getResourcesForTarget(resourceTargetTypeFilter, resourceTargetIdFilter, resourceName); @@ -157,6 +160,10 @@ public class ResourceAllocator implements SvcLogicResource { } private void setResourceDataInContext(SvcLogicContext ctx, String prefix, List rdlist) { + if (rdlist == null || rdlist.isEmpty()) { + return; + } + prefix = prefix == null ? "" : prefix + '.'; setAttr(ctx, prefix + "resource-list_length", String.valueOf(rdlist.size())); @@ -170,7 +177,6 @@ public class ResourceAllocator implements SvcLogicResource { setAttr(ctx, pp + "endpoint-position", rd.endPointPosition); setAttr(ctx, pp + "resource-target-type", rd.resourceTargetType); setAttr(ctx, pp + "resource-target-id", rd.resourceTargetId); - // SDNGC-7687 setAttr(ctx, pp + "resource-target-value", rd.resourceTargetValue); setAttr(ctx, pp + "status", rd.status); @@ -180,6 +186,28 @@ public class ResourceAllocator implements SvcLogicResource { setAttr(ctx, pp + kk, value); } } + + if (rd.allocationDataList != null && !rd.allocationDataList.isEmpty()) { + + setAttr(ctx, pp + "allocation-data-list_length", String.valueOf(rd.allocationDataList.size())); + + for (int j = 0; j < rd.allocationDataList.size(); j++) { + AllocationData ad = rd.allocationDataList.get(j); + + String ppp = pp + "allocation-data-list[" + j + "]."; + + setAttr(ctx, ppp + "resource-entity-type", ad.resourceEntityType); + setAttr(ctx, ppp + "resource-entity-id", ad.resourceEntityId); + setAttr(ctx, ppp + "resource-entity-version", ad.resourceEntityVersion); + + if (ad.data != null && !ad.data.isEmpty()) { + for (String kk : ad.data.keySet()) { + String value = String.valueOf(ad.data.get(kk)); + setAttr(ctx, ppp + kk, value); + } + } + } + } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationData.java new file mode 100644 index 000000000..3e0e6b140 --- /dev/null +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/AllocationData.java @@ -0,0 +1,11 @@ +package org.onap.ccsdk.sli.adaptors.ra.comp; + +import java.util.Map; + +public class AllocationData { + + public String resourceEntityType; + public String resourceEntityId; + public String resourceEntityVersion; + public Map data; +} diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index d188429ea..ab73dab1b 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -224,40 +224,8 @@ public class EndPointAllocatorImpl implements EndPointAllocator { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - ResourceData rd = new ResourceData(); + ResourceData rd = getResourceData(r); rdlist.add(rd); - - rd.resourceName = r.resourceKey.resourceName; - int i1 = r.resourceKey.assetId.indexOf("::"); - if (i1 > 0) { - rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); - rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); - - int i2 = r.resourceKey.assetId.lastIndexOf("::"); - if (i2 > i1) { - rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); - } - } else { - rd.resourceTargetType = ""; - rd.resourceTargetId = r.resourceKey.assetId; - } - - rd.data = new HashMap<>(); - - if (r instanceof RangeResource) { - RangeResource rr = (RangeResource) r; - - log.info("rr.used: " + rr.used); - String ss = String.valueOf(rr.used); - ss = ss.substring(1, ss.length() - 1); - rd.data.put("allocated", ss); - - } else if (r instanceof LimitResource) { - LimitResource lr = (LimitResource) r; - - log.info("lr.used: " + lr.used); - rd.data.put("allocated", String.valueOf(lr.used)); - } } return rdlist; @@ -266,7 +234,6 @@ public class EndPointAllocatorImpl implements EndPointAllocator { @Override public ResourceData getResource(String resourceTargetType, String resourceTargetId, String resourceName, String resourceEntityTypeFilter, String resourceEntityIdFilter, String resourceShareGroupFilter) { - ResourceData rd = new ResourceData(); String assetId = resourceTargetType + "::" + resourceTargetId; String resourceUnionFilter = null; @@ -288,36 +255,87 @@ public class EndPointAllocatorImpl implements EndPointAllocator { if (r != null) { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - rd.resourceName = r.resourceKey.resourceName; - int i1 = r.resourceKey.assetId.indexOf("::"); - if (i1 > 0) { - rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); - rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); + ResourceData rd = getResourceData(r); + return rd; + } - int i2 = r.resourceKey.assetId.lastIndexOf("::"); - if (i2 > i1) { - rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); - } - } else { - rd.resourceTargetType = ""; - rd.resourceTargetId = r.resourceKey.assetId; + return null; + } + + private ResourceData getResourceData(Resource r) { + ResourceData rd = new ResourceData(); + + rd.resourceName = r.resourceKey.resourceName; + int i1 = r.resourceKey.assetId.indexOf("::"); + if (i1 > 0) { + rd.resourceTargetType = r.resourceKey.assetId.substring(0, i1); + rd.resourceTargetId = r.resourceKey.assetId.substring(i1 + 2); + + int i2 = r.resourceKey.assetId.lastIndexOf("::"); + if (i2 > i1) { + rd.resourceTargetValue = r.resourceKey.assetId.substring(i2 + 2); } + } else { + rd.resourceTargetType = ""; + rd.resourceTargetId = r.resourceKey.assetId; + } - rd.data = new HashMap<>(); + rd.data = new HashMap<>(); + + if (r instanceof RangeResource) { + RangeResource rr = (RangeResource) r; + + log.info("rr.used: " + rr.used); + String ss = String.valueOf(rr.used); + ss = ss.substring(1, ss.length() - 1); + rd.data.put("allocated", ss); + + } else if (r instanceof LimitResource) { + LimitResource lr = (LimitResource) r; + + log.info("lr.used: " + lr.used); + rd.data.put("allocated", String.valueOf(lr.used)); + } + + rd.allocationDataList = new ArrayList<>(); + + if (r.allocationItems != null) { + for (AllocationItem ai : r.allocationItems) { + AllocationData ad = new AllocationData(); + rd.allocationDataList.add(ad); + + i1 = ai.resourceUnionId.indexOf("::"); + if (i1 > 0) { + ad.resourceEntityType = ai.resourceUnionId.substring(0, i1); + ad.resourceEntityId = ai.resourceUnionId.substring(i1 + 2); + } else { + ad.resourceEntityType = ""; + ad.resourceEntityId = ai.resourceUnionId; + } - if (r instanceof RangeResource) { - RangeResource rr = (RangeResource) r; + i1 = ai.resourceSetId.lastIndexOf("::"); + if (i1 > 0) { + ad.resourceEntityVersion = ai.resourceSetId.substring(i1 + 2); + } else { + ad.resourceEntityVersion = ""; + } + + ad.data = new HashMap<>(); + + if (ai instanceof RangeAllocationItem) { + RangeAllocationItem rai = (RangeAllocationItem) ai; - log.info("rr.used: " + rr.used); - String ss = String.valueOf(rr.used); - ss = ss.substring(1, ss.length() - 1); - rd.data.put("allocated", ss); + log.info("rr.used: " + rai.used); + String ss = String.valueOf(rai.used); + ss = ss.substring(1, ss.length() - 1); + ad.data.put("allocated", ss); - } else if (r instanceof LimitResource) { - LimitResource lr = (LimitResource) r; + } else if (ai instanceof LimitAllocationItem) { + LimitAllocationItem lai = (LimitAllocationItem) ai; - log.info("lr.used: " + lr.used); - rd.data.put("allocated", String.valueOf(lr.used)); + log.info("lr.used: " + lai.used); + ad.data.put("allocated", String.valueOf(lai.used)); + } } } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java index a5881b957..a20c01d79 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.adaptors.ra.comp; +import java.util.List; import java.util.Map; public class ResourceData { @@ -29,7 +30,8 @@ public class ResourceData { public String resourceTargetId; public String resourceTargetValue; public String resourceTargetType; + public String endPointPosition; public String status; public Map data; - public String endPointPosition; + public List allocationDataList; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java index 4be985b2a..f31a3859a 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestQueryResource.java @@ -85,6 +85,27 @@ public class TestQueryResource { Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].resource-target-type"), "Port"); Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].resource-target-id"), "TESTPORT-1-2"); Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocated"), "0, 1, 2, 3, 4"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list_length"), "5"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[0].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[0].resource-entity-id"), "TEST-0-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[0].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[0].allocated"), "0"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[1].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[1].resource-entity-id"), "TEST-1-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[1].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[1].allocated"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[2].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[2].resource-entity-id"), "TEST-2-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[2].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[2].allocated"), "2"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[3].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[3].resource-entity-id"), "TEST-3-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[3].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[3].allocated"), "3"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[4].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[4].resource-entity-id"), "TEST-4-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[4].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[1].allocation-data-list[4].allocated"), "4"); } @Test @@ -111,5 +132,26 @@ public class TestQueryResource { Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-type"), "Port"); Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].resource-target-id"), "TESTPORT-1-1"); Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocated"), "1500"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list_length"), "5"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[0].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[0].resource-entity-id"), "TEST-0-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[0].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[0].allocated"), "100"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[1].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[1].resource-entity-id"), "TEST-1-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[1].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[1].allocated"), "200"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[2].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[2].resource-entity-id"), "TEST-2-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[2].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[2].allocated"), "300"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[3].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[3].resource-entity-id"), "TEST-3-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[3].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[3].allocated"), "400"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[4].resource-entity-type"), "EVC"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[4].resource-entity-id"), "TEST-4-1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[4].resource-entity-version"), "1"); + Assert.assertEquals(ctx.getAttribute("ra-output.resource-list[0].allocation-data-list[4].allocated"), "500"); } } -- cgit 1.2.3-korg From 0e2eb6a4cfed02d11630215d502e873539c58058 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 14 Mar 2019 10:49:03 -0400 Subject: Prepare for release 0.4.1 Prepare to create release version 0.4.1 by using released version of parent pom Change-Id: I775f4171232f7258118e1ac426cb8d88e3c7ea09 Issue-ID: CCSDK-1156 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 8 +++----- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 5 ++--- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- grpc-resource/features/ccsdk-grpc-client/pom.xml | 5 ++--- grpc-resource/features/features-grpc-client/pom.xml | 5 ++--- grpc-resource/features/pom.xml | 5 ++--- grpc-resource/installer/pom.xml | 5 ++--- grpc-resource/pom.xml | 5 ++--- grpc-resource/provider/pom.xml | 5 ++--- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 8 +++----- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 54 files changed, 65 insertions(+), 76 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index a633b2476..204d727ae 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 3e4748a99..41db19a84 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 1c34eb4a3..fa9cefa5e 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index c480fb38a..da04951f8 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index b28dea668..735669cb3 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index cbf161d6f..0bcc19e67 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 5ae79b34f..76c73e5e9 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -12,15 +12,13 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT - + 1.2.1 + org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index daceea7e9..7b20b7c62 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index f742f14e3..23347ffe7 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 2fd0e8dc7..44e28c8f3 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.1-SNAPSHOT + 1.2.1 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index f1cc2a47c..ead528a5a 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 083fbb98b..d64126aa0 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 5660ff3d0..8a31ee66a 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 1e3ba8ada..c81601762 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -1,12 +1,11 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 23905b834..9fd550796 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 1e3ea210c..0e6fd7f87 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/features/pom.xml b/features/pom.xml index 52cda122a..4e5945a10 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/features/ccsdk-grpc-client/pom.xml b/grpc-resource/features/ccsdk-grpc-client/pom.xml index 7bc4de636..7a322e722 100644 --- a/grpc-resource/features/ccsdk-grpc-client/pom.xml +++ b/grpc-resource/features/ccsdk-grpc-client/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/features/features-grpc-client/pom.xml b/grpc-resource/features/features-grpc-client/pom.xml index 993fbe13b..a49b5de56 100755 --- a/grpc-resource/features/features-grpc-client/pom.xml +++ b/grpc-resource/features/features-grpc-client/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/features/pom.xml b/grpc-resource/features/pom.xml index ededb8ee5..fb8ce427f 100755 --- a/grpc-resource/features/pom.xml +++ b/grpc-resource/features/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/installer/pom.xml b/grpc-resource/installer/pom.xml index 9586d4fa7..8a5c00efb 100755 --- a/grpc-resource/installer/pom.xml +++ b/grpc-resource/installer/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/pom.xml b/grpc-resource/pom.xml index 7b80f9b3a..4cf1e48d8 100644 --- a/grpc-resource/pom.xml +++ b/grpc-resource/pom.xml @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/grpc-resource/provider/pom.xml b/grpc-resource/provider/pom.xml index 72fc7f1ef..7fcc4c228 100644 --- a/grpc-resource/provider/pom.xml +++ b/grpc-resource/provider/pom.xml @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index c9bf1a31a..ecf9cc071 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 72db30508..c40514e9b 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 7e23f9639..e6d88f1b8 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index d4e4f67d7..ea962347f 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 700e475d4..3e7282426 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index dc73c6019..eaede3f7f 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 361227209..eaf50886f 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 2f5144b58..0144004c2 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index ef3e436a9..a1a8d6f40 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 221e418de..69bd5ff7b 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 1dd15ed9b..46795dd5e 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index f7e8ccf92..d01ef7c17 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/pom.xml b/pom.xml index 234b34497..706ad4b64 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index afe0ca4ad..4faa6b925 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 5438d59b8..2898b569b 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 074f1eba5..adf7a0ea8 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 16c62d576..c51de479a 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 35b5b8801..33934331b 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index e5177995c..1d6878fea 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 1947a1760..8181c4f4d 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 09ed8db07..ff4efc93a 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -1,14 +1,12 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT - + 1.2.1 + org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 9c4693ee2..ac1f7941b 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 674dc14f1..94b4abd33 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,7 +15,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.1-SNAPSHOT + 1.2.1 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 873ddcdc5..be230997b 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 8134fe033..be8e9ea06 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cc72027d7..cdeffad80 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 8c23b28dd..9cb5a8878 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 12e276157..0cf331f4d 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index d1d9dda11..b031791b2 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 5146a92fe..d2cba6f8f 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1-SNAPSHOT + 1.2.1 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 23b4414bc..fe8211897 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.1-SNAPSHOT + 1.2.1 -- cgit 1.2.3-korg From 9be37c03ba6296c07d9910079061542d8160a9fc Mon Sep 17 00:00:00 2001 From: Stan Bonev Date: Tue, 19 Mar 2019 15:19:35 -0400 Subject: RA: Fix Problems with resource query results Change-Id: Ic0fa65bff95ab5bd8ab65b055dcf7ec378e99d91 Issue-ID: CCSDK-1170 Signed-off-by: Stan Bonev --- .../org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index ab73dab1b..57796768f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -221,6 +221,9 @@ public class EndPointAllocatorImpl implements EndPointAllocator { List rlist = resourceManager.queryResources(resourceName, assetIdFilter); for (Resource r : rlist) { + if (r.allocationItems == null || r.allocationItems.isEmpty()) { + continue; + } log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); @@ -252,7 +255,7 @@ public class EndPointAllocatorImpl implements EndPointAllocator { r = resourceManager.getResource(resourceName, assetId); } - if (r != null) { + if (r != null && r.allocationItems != null && !r.allocationItems.isEmpty()) { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); ResourceData rd = getResourceData(r); -- cgit 1.2.3-korg From e6b9133f88c3b8da88c125a5e63c2caad66a9fd7 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 19 Mar 2019 17:06:38 -0400 Subject: Compile against Fluorine SR2 Updated to compile against Fluorine SR2 Change-Id: Ie7ccf14c802c92fe8250de307546b79776ed984e Issue-ID: CCSDK-1156 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 6 +++--- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- grpc-resource/features/ccsdk-grpc-client/pom.xml | 4 ++-- grpc-resource/features/features-grpc-client/pom.xml | 4 ++-- grpc-resource/features/pom.xml | 4 ++-- grpc-resource/installer/pom.xml | 4 ++-- grpc-resource/pom.xml | 4 ++-- grpc-resource/provider/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/features/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 8 +++----- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 6 ++++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 62 files changed, 122 insertions(+), 122 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 204d727ae..65db7f997 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 41db19a84..cfc0fc914 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index fa9cefa5e..946ceac38 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index da04951f8..065cd34cf 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 735669cb3..d295ba0c3 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 0bcc19e67..e41553025 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 76c73e5e9..0bfddb348 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 7b20b7c62..cc0442697 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 23347ffe7..9d5f00b6d 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 44e28c8f3..3d37d44f1 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index ead528a5a..a95973a49 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index d64126aa0..2b35248b1 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 8a31ee66a..efa96c2b7 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.1 + 1.2.2-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index d54c54e32..cf7bae329 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} @@ -43,7 +43,6 @@ xml features - --> ${project.groupId} ccsdk-grpc-client @@ -51,6 +50,7 @@ xml features + --> ${project.groupId} ccsdk-netbox-client diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 9fd550796..812c6fa8b 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 0e6fd7f87..8e0d1812c 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 4e5945a10..383f078af 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/grpc-resource/features/ccsdk-grpc-client/pom.xml b/grpc-resource/features/ccsdk-grpc-client/pom.xml index 7a322e722..e471a187b 100644 --- a/grpc-resource/features/ccsdk-grpc-client/pom.xml +++ b/grpc-resource/features/ccsdk-grpc-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-grpc-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/features/features-grpc-client/pom.xml b/grpc-resource/features/features-grpc-client/pom.xml index a49b5de56..96ccef798 100755 --- a/grpc-resource/features/features-grpc-client/pom.xml +++ b/grpc-resource/features/features-grpc-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-grpc-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/features/pom.xml b/grpc-resource/features/pom.xml index fb8ce427f..1ed4baaac 100755 --- a/grpc-resource/features/pom.xml +++ b/grpc-resource/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/installer/pom.xml b/grpc-resource/installer/pom.xml index 8a5c00efb..06e305417 100755 --- a/grpc-resource/installer/pom.xml +++ b/grpc-resource/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/pom.xml b/grpc-resource/pom.xml index 4cf1e48d8..89aab6de6 100644 --- a/grpc-resource/pom.xml +++ b/grpc-resource/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client diff --git a/grpc-resource/provider/pom.xml b/grpc-resource/provider/pom.xml index 7fcc4c228..7429a264c 100644 --- a/grpc-resource/provider/pom.xml +++ b/grpc-resource/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle 4.0.0 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index ecf9cc071..d42131c29 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index c40514e9b..2ac8c2f29 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index e6d88f1b8..28ee12c5d 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index ea962347f..c1041ace8 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 3e7282426..a361f675b 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index eaede3f7f..c04564fec 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/pom.xml b/message-router/pom.xml index b5cd01348..74f270c57 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 54ff76ec0..cf9f81dc9 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index c91fe61f2..7b1c7bed6 100755 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT publisher.features diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 4e5abe5b5..c2c148196 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -1,18 +1,16 @@ - + 4.0.0 org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index adaa3de10..6ed2b3f7f 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 6afe9bd37..b1010d8b2 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 04e0f7a67..102b74219 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index eaf50886f..eeb6ec523 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 0144004c2..cd2ba14b3 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index a1a8d6f40..b022aa0cf 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 69bd5ff7b..3b5986cd9 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 46795dd5e..3fa6248ea 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index d01ef7c17..32762bc06 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index 3eb9f3cae..fb0b72da7 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT 4.0.0 @@ -100,7 +100,9 @@ ansible-adapter saltstack-adapter netbox-client + mdsal-resource resource-assignment sql-resource @@ -111,7 +113,7 @@ ONAP - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 4faa6b925..ee36f3813 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 2898b569b..7d60fd81c 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index adf7a0ea8..631386160 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index c51de479a..659aca2ef 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 33934331b..a2731e662 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 1d6878fea..ee480a5b5 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 8181c4f4d..69673be43 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index ff4efc93a..88ab92ee8 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index ac1f7941b..e25dddb72 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 94b4abd33..cdb51e7c5 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index be230997b..c3a712125 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index be8e9ea06..4be5e9fb7 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cdeffad80..548be1e9f 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 9cb5a8878..09a25b0ac 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 0cf331f4d..71ded0cc8 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index b031791b2..dc8d1381f 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index d2cba6f8f..a09bef9bf 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index fe8211897..f7b76255a 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.1 + 1.2.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 2a56aedac..e40820109 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=4 -feature_revision=1 +feature_revision=2 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 167d3788417d8cdbcf8a36901546af2e7a6f1da7 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 24 Apr 2019 12:34:28 -0400 Subject: Update to use released 1.2.2 parent Update to use released 1.2.2 version of parent poms. Change-Id: I90b5eebf030d746ff5f6166836d9dc88ad271e6e Issue-ID: CCSDK-1222 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- grpc-resource/features/ccsdk-grpc-client/pom.xml | 2 +- grpc-resource/features/features-grpc-client/pom.xml | 2 +- grpc-resource/features/pom.xml | 2 +- grpc-resource/installer/pom.xml | 2 +- grpc-resource/pom.xml | 2 +- grpc-resource/provider/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- message-router/pom.xml | 2 +- message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml | 2 +- .../publisher/features/features-messagerouter-publisher/pom.xml | 2 +- message-router/publisher/features/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 58 files changed, 58 insertions(+), 58 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 65db7f997..cc8c9e998 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index cfc0fc914..306fd5038 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 946ceac38..b18b991ee 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 065cd34cf..ee78d19a6 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index d295ba0c3..25ea5a780 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 65a2a040e..2301e2f9e 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 0bfddb348..5979e6fa5 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index cc0442697..ac479c1fa 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 9d5f00b6d..aca4000f9 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 3d37d44f1..301999280 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index a95973a49..b1b948ff1 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 2b35248b1..c51c2a70a 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index efa96c2b7..2da9dc3a9 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index e68a59bfc..2bc2da2f4 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 812c6fa8b..989b813b2 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 8e0d1812c..13e6b16eb 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/features/pom.xml b/features/pom.xml index 383f078af..6550c79e6 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/features/ccsdk-grpc-client/pom.xml b/grpc-resource/features/ccsdk-grpc-client/pom.xml index e471a187b..0cd94bc82 100644 --- a/grpc-resource/features/ccsdk-grpc-client/pom.xml +++ b/grpc-resource/features/ccsdk-grpc-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/features/features-grpc-client/pom.xml b/grpc-resource/features/features-grpc-client/pom.xml index 96ccef798..bc19c0b9b 100755 --- a/grpc-resource/features/features-grpc-client/pom.xml +++ b/grpc-resource/features/features-grpc-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/features/pom.xml b/grpc-resource/features/pom.xml index 1ed4baaac..b726808f9 100755 --- a/grpc-resource/features/pom.xml +++ b/grpc-resource/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/installer/pom.xml b/grpc-resource/installer/pom.xml index af425568d..669081e58 100755 --- a/grpc-resource/installer/pom.xml +++ b/grpc-resource/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/pom.xml b/grpc-resource/pom.xml index 89aab6de6..5c5050d10 100644 --- a/grpc-resource/pom.xml +++ b/grpc-resource/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/grpc-resource/provider/pom.xml b/grpc-resource/provider/pom.xml index 30ee7a404..18fa0c60c 100644 --- a/grpc-resource/provider/pom.xml +++ b/grpc-resource/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index d42131c29..2fcb9e493 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 2ac8c2f29..639bfeece 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 28ee12c5d..e5d947501 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index c1041ace8..87ed50327 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index a361f675b..5d3b9af15 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index c04564fec..291e93d43 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/message-router/pom.xml b/message-router/pom.xml index 74f270c57..01102bb18 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 939fb7a77..f04e753ff 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index eae146702..b6dc27fdd 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 45e1f5d86..09193895c 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index eeb6ec523..d559ccb17 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index cd2ba14b3..e467acb43 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index b022aa0cf..b8ed16314 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 3b5986cd9..5002a04ba 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 3fa6248ea..ec9d7e092 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 32762bc06..3792e811d 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/pom.xml b/pom.xml index da6283845..bc0ae3a8f 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index ee36f3813..f213236be 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 7d60fd81c..ce41838ce 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 631386160..58fba6e02 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 659aca2ef..acbca01fc 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index a2731e662..0c29a1203 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index ee480a5b5..a4cf0047b 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 69673be43..9c5e9983d 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 88ab92ee8..f6a1718f2 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index e25dddb72..982c060b7 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index cdb51e7c5..8e5205aca 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,7 +15,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index c3a712125..9ebeedce6 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 4be5e9fb7..418a30812 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 548be1e9f..6d4f03ba8 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 09a25b0ac..626e01cdb 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 71ded0cc8..50f4e17b8 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index dc8d1381f..7ccfeb305 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index a09bef9bf..3fc235ad0 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2-SNAPSHOT + 1.2.2 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index f7b76255a..6a64fd391 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.2.2-SNAPSHOT + 1.2.2 -- cgit 1.2.3-korg From 2409cc67b511ae6cfc6ea8c9c8040cde225f7668 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 30 Apr 2019 11:28:02 -0400 Subject: Roll master to El Alto Roll master version to El Alto versions Change-Id: I9f83adb1a3ce724cc541465a5af60078a615cd31 Issue-ID: CCSDK-1222 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- grpc-resource/features/ccsdk-grpc-client/pom.xml | 4 ++-- grpc-resource/features/features-grpc-client/pom.xml | 4 ++-- grpc-resource/features/pom.xml | 4 ++-- grpc-resource/installer/pom.xml | 4 ++-- grpc-resource/pom.xml | 4 ++-- grpc-resource/provider/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- .../publisher/features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- .../publisher/features/features-messagerouter-publisher/pom.xml | 4 ++-- message-router/publisher/features/pom.xml | 4 ++-- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 4 ++-- 64 files changed, 124 insertions(+), 124 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index cc8c9e998..5226ab20b 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 306fd5038..5e6188548 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index b18b991ee..afe5d0c41 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index ee78d19a6..f000657f1 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 25ea5a780..d53a289c1 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 2301e2f9e..941dc13fb 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 5979e6fa5..66d25cd22 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index ac479c1fa..d30f1746a 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index aca4000f9..3f3c3766f 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 301999280..835f10883 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index b1b948ff1..49a525804 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index c51c2a70a..25b45b39d 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 2da9dc3a9..e1fbcef63 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.2.2 + 1.3.0-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 2bc2da2f4..d9eec43ea 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 989b813b2..26c0746ec 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 13e6b16eb..5566215b5 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 6550c79e6..3b63a72ad 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/grpc-resource/features/ccsdk-grpc-client/pom.xml b/grpc-resource/features/ccsdk-grpc-client/pom.xml index 0cd94bc82..c81e94ba6 100644 --- a/grpc-resource/features/ccsdk-grpc-client/pom.xml +++ b/grpc-resource/features/ccsdk-grpc-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-grpc-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/features/features-grpc-client/pom.xml b/grpc-resource/features/features-grpc-client/pom.xml index bc19c0b9b..ffe6e9a13 100755 --- a/grpc-resource/features/features-grpc-client/pom.xml +++ b/grpc-resource/features/features-grpc-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-grpc-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/features/pom.xml b/grpc-resource/features/pom.xml index b726808f9..233d8cda8 100755 --- a/grpc-resource/features/pom.xml +++ b/grpc-resource/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/installer/pom.xml b/grpc-resource/installer/pom.xml index 669081e58..a57e7251f 100755 --- a/grpc-resource/installer/pom.xml +++ b/grpc-resource/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client :: ${project.artifactId} diff --git a/grpc-resource/pom.xml b/grpc-resource/pom.xml index 5c5050d10..edb83076b 100644 --- a/grpc-resource/pom.xml +++ b/grpc-resource/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: grpc-client diff --git a/grpc-resource/provider/pom.xml b/grpc-resource/provider/pom.xml index 18fa0c60c..6a1a9a85b 100644 --- a/grpc-resource/provider/pom.xml +++ b/grpc-resource/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors grpc-client-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle 4.0.0 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 2fcb9e493..347359e0a 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 639bfeece..1e4c12925 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index e5d947501..1cf598894 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 87ed50327..badd38ede 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 5d3b9af15..493362441 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 291e93d43..dd7cdc615 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/pom.xml b/message-router/pom.xml index 01102bb18..cf27b56af 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index cf9f81dc9..27f21301f 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index f04e753ff..ace83454a 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index b6dc27fdd..eb2be677a 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 09193895c..88ef4d102 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 8a8dc411b..43d4ed39c 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 6ed2b3f7f..f11adb5f5 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index b1010d8b2..f053cc6d5 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 102b74219..71379207b 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index d559ccb17..bf8e76f09 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index e467acb43..b47af3910 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index b8ed16314..485b4714b 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 5002a04ba..f5f65a790 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index ec9d7e092..6edd5bc92 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 3792e811d..6a552c577 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index bc0ae3a8f..ea7c08227 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT 4.0.0 @@ -111,7 +111,7 @@ ONAP - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index f213236be..df2c5ba38 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index ce41838ce..12840c8de 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 58fba6e02..ffd457e39 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index acbca01fc..b8a3649ab 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 0c29a1203..e3f47fa8f 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index a4cf0047b..e77ad92d2 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 9c5e9983d..6b355b715 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index f6a1718f2..3fbb18af7 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 982c060b7..361ac928c 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 8e5205aca..2389a8ad7 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 9ebeedce6..65f5e1219 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 418a30812..98590a0c8 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 6d4f03ba8..cac745e9c 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 626e01cdb..db1796fa3 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 50f4e17b8..651239c1f 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 7ccfeb305..2310b1906 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 3fc235ad0..67d977ea3 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 6a64fd391..befcfab12 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.2.2 + 1.3.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.4.2-SNAPSHOT + 0.5.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index e40820109..3e36988ca 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=0 -sprint_number=4 -feature_revision=2 +sprint_number=5 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From faaa1a75d85a522847acf4c7250b8da5f076cfa0 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 28 May 2019 09:15:39 -0400 Subject: Revert "Fixed sonar fix in DataSourceWrap.java" This reverts commit 6c1dee5b7d0e66338100c65efd51917d4f69998f. Sonar gave bad advice - this change causes connection to be closed on return to caller, which is useless. Change-Id: Id428c9058b5e33d72d58bbd951e6cdac2d2d151d Signed-off-by: Timoney, Dan (dt5972) --- .../ccsdk/sli/adaptors/util/db/DataSourceWrap.java | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java index 259b9d8d9..2aebb83e3 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/db/DataSourceWrap.java @@ -4,7 +4,6 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. - * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,22 +74,25 @@ public class DataSourceWrap implements DataSource { @Override public Connection getConnection() throws SQLException { - try (Connection c = dataSource.getConnection()){ - log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + 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 { - try (Connection c = dataSource.getConnection(username, password)){ - log.debug("getConnection: " + c.getClass().getName()); - c.setAutoCommit(true); - return c; - } + Connection c = dataSource.getConnection(username, password); + + log.debug("getConnection: " + c.getClass().getName()); + + c.setAutoCommit(true); + return c; } - public void setDataSource(DataSource dataSource) { + public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } } -- cgit 1.2.3-korg From 793f714168f7ec92b5a9d77fbda0d832ab109898 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 20 Jun 2019 19:16:28 -0400 Subject: Remove versions from project poms Remove versions from project poms and rely instead on dependencyManagement. Change-Id: I68171346273325e8dee0f7d2538549d2d8c154c8 Issue-ID: CCSDK-1416 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 1 + aai-service/provider/pom.xml | 8 +------- .../org/onap/ccsdk/sli/adaptors/aai/AAIServiceTest.java | 7 ++++--- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ---- ansible-adapter/ansible-adapter-installer/pom.xml | 6 +----- ansible-adapter/pom.xml | 7 ------- netbox-client/features/ccsdk-netbox-client/pom.xml | 1 + netbox-client/provider/pom.xml | 5 ++--- resource-assignment/provider/pom.xml | 2 -- saltstack-adapter/saltstack-adapter-installer/pom.xml | 5 ----- saltstack-adapter/saltstack-adapter-provider/pom.xml | 17 +++-------------- 11 files changed, 13 insertions(+), 50 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 5226ab20b..15034fdee 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -29,6 +29,7 @@ ${ccsdk.sli.core.version} xml features + provided diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 7b5a80509..4bff806cb 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -58,7 +58,7 @@ org.onap.ccsdk.sli.core utils-provider - ${sdnctl.sli.version} + ${ccsdk.sli.core.version} org.osgi @@ -76,22 +76,18 @@ org.glassfish.jersey.core jersey-client - ${jersey.version} org.glassfish.jersey.core jersey-common - ${jersey.version} org.apache.httpcomponents httpcore - ${apache.httpcomponents.core.version} org.apache.httpcomponents httpclient - ${apache.httpcomponents.client.version} com.fasterxml.jackson.core @@ -117,13 +113,11 @@ org.jsoup jsoup - 1.8.3 test org.springframework spring-core - 4.3.5.RELEASE test diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceTest.java index a17c36bf2..f0be45877 100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceTest.java @@ -146,9 +146,10 @@ public class AAIServiceTest { String url = "https://aai.api.simpledemo.onap.org:8443/aai/v11/cloud-infrastructure/pservers/pserver/chcil129snd"; setConnMock(); - when(aaiServiceSpy.getConfiguredConnection(new URL(url), HttpMethod.GET)).thenReturn(connMock); - when(connMock.getResponseCode()).thenReturn(500); - when(connMock.getInputStream()).thenReturn(getClass().getClassLoader().getResourceAsStream(fileLocation)); + // The following lines are not needed and cause latest version of mockito to throw an exception +// when(aaiServiceSpy.getConfiguredConnection(new URL(url), HttpMethod.GET)).thenReturn(connMock); +// when(connMock.getResponseCode()).thenReturn(500); +// when(connMock.getInputStream()).thenReturn(getClass().getClassLoader().getResourceAsStream(fileLocation)); aaiServiceSpy.dataChangeRequestAaiData(url, Class.class); } diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 66d25cd22..5a8a9ee00 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -56,13 +56,11 @@ commons-logging commons-logging - 1.2 org.apache.httpcomponents httpclient - ${apache.httpcomponents.client.version} @@ -70,14 +68,12 @@ org.glassfish.jersey.core jersey-common - 2.9.1 test org.codehaus.jackson jackson-jaxrs - 1.9.13 test diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 49a525804..562bd179f 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -61,11 +61,7 @@ ${project.version} - - javax - javaee-api - 7.0 - + diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 25b45b39d..6b6f4cbe5 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -165,13 +165,6 @@ ${project.version} - - junit - junit - 4.11 - test - - diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index bf8e76f09..6586a5cd9 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -36,6 +36,7 @@ ${project.version} + org.opendaylight.controller diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 6a552c577..583d15813 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -89,9 +89,9 @@ junit junit - ${junit.version} test + org.mockito mockito-core @@ -101,9 +101,9 @@ com.github.tomakehurst wiremock - 2.7.1 test + org.eclipse.jetty jetty-server @@ -113,7 +113,6 @@ ch.qos.logback logback-classic - 1.2.3 test diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index e77ad92d2..510e16209 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -74,7 +74,6 @@ org.mariadb.jdbc mariadb-java-client - ${mariadb.connector.version} jar runtime @@ -89,7 +88,6 @@ org.springframework spring-jdbc - ${spring.version} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 65f5e1219..063caf2bd 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -64,11 +64,6 @@ ${project.version} - - javax - javaee-api - 7.0 - diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 98590a0c8..91e72d5fd 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -72,31 +72,20 @@ + + + org.apache.sshd sshd-core 0.12.0 - - - - - - - - - - - - - org.apache.commons commons-io - 1.3.2 -- cgit 1.2.3-korg From 24ecc227ee9ae42f9a547fad3d70817beacc83f4 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 17 Jul 2019 10:59:25 -0400 Subject: Update parent version to 1.3.1 Update parent poms to version 1.3.1-SNAPSHOT Change-Id: I492fb0119507d39ca8ba46762375ca14a0065ab8 Issue-ID: CCSDK-1496 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml | 2 +- .../consumer/features/features-messagerouter-consumer/pom.xml | 2 +- message-router/consumer/features/pom.xml | 2 +- message-router/pom.xml | 2 +- message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml | 2 +- .../publisher/features/features-messagerouter-publisher/pom.xml | 2 +- message-router/publisher/features/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 55 files changed, 55 insertions(+), 55 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 15034fdee..d947754c8 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 5e6188548..c8569d4fa 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index afe5d0c41..b6586a08d 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index f000657f1..c5a6498d4 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/aai-service/pom.xml b/aai-service/pom.xml index d53a289c1..ff60fd3d3 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 4bff806cb..910af583c 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 5a8a9ee00..3df610443 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index d30f1746a..5f278fee5 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 3f3c3766f..71c3495c2 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 835f10883..29bef47aa 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 562bd179f..9cbc5f0f5 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 6b6f4cbe5..7a3cbee9c 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/artifacts/pom.xml b/artifacts/pom.xml index e1fbcef63..d8d61c46a 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 9eac035b6..b431cb544 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 26c0746ec..9e9188e29 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 5566215b5..aa4cf6754 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/features/pom.xml b/features/pom.xml index 3b63a72ad..141276139 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 347359e0a..62322f42a 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 1e4c12925..62b1ce77d 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 1cf598894..2bf9140be 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index badd38ede..366dd18fb 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 493362441..c4c87a035 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index dd7cdc615..6ba3680f1 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index 0fc38cb8b..4b95e13f7 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index daffd70f0..c2b1ec056 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index 296073aac..fec5ee0ed 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/pom.xml b/message-router/pom.xml index 49e7c6469..b411dab3c 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index ace83454a..1f45e9f6b 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index eb2be677a..0223fdf77 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 88ef4d102..3f4e5b71e 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 6586a5cd9..6833cba41 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index b47af3910..05c6874e2 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 485b4714b..03d5f0c24 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index f5f65a790..ee9ef3a7a 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 6edd5bc92..933a8212c 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 583d15813..8a6a93e2c 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 9f26ce4fc..acb4a0395 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index df2c5ba38..70c9ad484 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 12840c8de..e843138f2 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index ffd457e39..4cefaff2b 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index b8a3649ab..a84fff491 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index e3f47fa8f..d967c65a5 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 510e16209..be28804c3 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 6b355b715..37c6df9b9 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 3fbb18af7..5770dca1a 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 361ac928c..2fd08a9f4 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 2389a8ad7..297a190fe 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,7 +15,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 063caf2bd..400dc52f1 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 91e72d5fd..80cfcfdb8 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index cac745e9c..43501ec4e 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index db1796fa3..c41d4903e 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 651239c1f..fad6b41b1 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 2310b1906..e39c185f9 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 67d977ea3..239fe877c 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index befcfab12..c6c4168a7 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT -- cgit 1.2.3-korg From 93fa93bfc36540cd345ceacbed7d18ea7aeaa9ed Mon Sep 17 00:00:00 2001 From: Thugutla Sailakshmi Date: Mon, 29 Jul 2019 15:25:37 +0530 Subject: CCSDK-1553 -remove exception from method body remove exception from method body Issue-ID: CCSDK-1553 Change-Id: I63216b592336dab8ea9ac426bee7c4f863354aae Signed-off-by: Thugutla Sailakshmi --- .../main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index c51b03846..338c528a8 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -2,9 +2,9 @@ * ============LICENSE_START======================================================= * openECOMP : SDN-C * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2019 AT&T Intellectual Property. All rights * reserved. - * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -273,7 +273,7 @@ public class ResourceAllocator implements SvcLogicResource { return release(sd, rr, null); } - public AllocationStatus release(ResourceEntity sd, ResourceRequest rr, ResourceTarget rt) throws Exception { + public AllocationStatus release(ResourceEntity sd, ResourceRequest rr, ResourceTarget rt) { ReleaseRequest releaseRequest = new ReleaseRequest(); -- cgit 1.2.3-korg From c4a0e4279c770957fe2d12296418883897df8087 Mon Sep 17 00:00:00 2001 From: Thugutla Sailakshmi Date: Mon, 5 Aug 2019 20:36:45 +0530 Subject: CCSDK-1559-return this expression instead of assigning it to a temporary variable return this expression instead of assigning it to a temporary variable Issue-ID: CCSDK-1559 Change-Id: I1b0ce8b89f51f2fd5b2da7d8f2401d2be5007615 Signed-off-by: Thugutla Sailakshmi --- .../org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 57796768f..83dab5418 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,8 +229,8 @@ public class EndPointAllocatorImpl implements EndPointAllocator { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - ResourceData rd = getResourceData(r); - rdlist.add(rd); + + rdlist.add(getResourceData(r)); } return rdlist; -- cgit 1.2.3-korg From 11c161c3c44f52d1cd78cb5f6139193e295fc439 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 6 Aug 2019 10:18:50 -0400 Subject: Roll version to recreate artifacts Roll version to 0.5.1 to recreate El Alto early drop artifacts Change-Id: Icf2a0373baf79ab869b70e7324bcd0bef50e5fb2 Issue-ID: CCSDK-1563 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- .../consumer/features/features-messagerouter-consumer/pom.xml | 4 ++-- message-router/consumer/features/pom.xml | 4 ++-- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- .../publisher/features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- .../publisher/features/features-messagerouter-publisher/pom.xml | 4 ++-- message-router/publisher/features/pom.xml | 4 ++-- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 65 files changed, 122 insertions(+), 122 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index d947754c8..fef726bc3 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index c8569d4fa..e48daf5f4 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-aai-service - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index b6586a08d..514ac9d8b 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors aai-service-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index c5a6498d4..adcb340d1 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors aai-service-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index ff60fd3d3..7a983c6a7 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors aai-service - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 910af583c..46cd8db81 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors aai-service-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 3df610443..567750090 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 5f278fee5..12a59ee34 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 71c3495c2..665255d06 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 29bef47aa..70144556e 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 9cbc5f0f5..c8ee629e2 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 7a3cbee9c..3120e5e46 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index d8d61c46a..697f77c9e 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.3.1-SNAPSHOT + 1.3.2 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index b431cb544..e5d3c1652 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 9e9188e29..0eebfb648 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index aa4cf6754..7f1273b51 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 141276139..5af4abab0 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 62322f42a..6bb5cb3c3 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 62b1ce77d..caed41caa 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 2bf9140be..2617d986a 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 366dd18fb..b6ac04c72 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index c4c87a035..e977c0708 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors mdsal-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 6ba3680f1..c047a3814 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 541b4cc0b..7a65eae98 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT consumer.api diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index 4b95e13f7..4f4a43e0d 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index c2b1ec056..810cd05a9 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-consumer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index fec5ee0ed..cd8407dcd 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter consumer.features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 935237ea0..62e214772 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 1650421e8..5a292ce1b 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index be2315724..fa8dfee14 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index b411dab3c..2484f0c2b 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 27f21301f..44990c106 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 1f45e9f6b..1f2fb80c3 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 0223fdf77..d2d706945 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 3f4e5b71e..1e5ce9871 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 43d4ed39c..24f072619 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index f11adb5f5..f74ee2e50 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index f053cc6d5..222adcd1c 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 71379207b..4755afe35 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 6833cba41..c27757188 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 05c6874e2..4c55b34d3 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-netbox-client - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 03d5f0c24..f3df19ecd 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors netbox-client-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index ee9ef3a7a..5c1e9d7b7 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 933a8212c..3fd93b8a1 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors netbox-client - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 8a6a93e2c..04f18c87d 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index acb4a0395..03a7d5e91 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 4.0.0 @@ -110,7 +110,7 @@ ONAP - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 70c9ad484..72e393cdd 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index e843138f2..34ae152bd 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 4cefaff2b..ca4365c6d 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index a84fff491..7c51251f0 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index d967c65a5..f6e41143e 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors resource-assignment - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index be28804c3..f390c8682 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 37c6df9b9..f90213da0 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 5770dca1a..d583c0996 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 2fd08a9f4..d048a40f2 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 297a190fe..11b168425 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 400dc52f1..1ba2e1baf 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 69246b395..0b11d2cf2 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 43501ec4e..aaf35c678 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index c41d4903e..83cbd748b 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors features-sql-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index fad6b41b1..0295141ae 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sql-resource-features - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index e39c185f9..766e8982c 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 239fe877c..f99c8feeb 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sql-resource - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index c6c4168a7..ae66cd89b 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.1-SNAPSHOT + 1.3.2 org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 3e36988ca..71ba554ca 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=5 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From c5302e63a7cfffa1fdf7f435d559a49688747a84 Mon Sep 17 00:00:00 2001 From: Thugutla Sailakshmi Date: Mon, 5 Aug 2019 19:44:53 +0530 Subject: CCSDK-1556 -Move this constructor to comply with Java Code Conventions Move this constructor to comply with Java Code Conventions Issue-ID: CCSDK-1556 Change-Id: I6b6c75c07cccdd4b18027f6c4ab3badf9c273c97 Signed-off-by: Thugutla Sailakshmi --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ccsdk-ansible-adapter/pom.xml | 4 ++-- .../features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- .../features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- .../features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- .../features/features-messagerouter-consumer/pom.xml | 4 ++-- message-router/consumer/features/pom.xml | 4 ++-- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- .../consumer/provider/impl/ConsumerFactory.java | 19 ++++++++++--------- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- .../features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- .../features/features-messagerouter-publisher/pom.xml | 4 ++-- message-router/publisher/features/pom.xml | 4 ++-- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- .../features/ccsdk-resource-assignment/pom.xml | 4 ++-- .../features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 66 files changed, 132 insertions(+), 131 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index fef726bc3..1c5b5e3f8 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index e48daf5f4..6af177d8b 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 514ac9d8b..434687b55 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index adcb340d1..9205617b5 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 7a983c6a7..cbebfb182 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 46cd8db81..a76d1c5b2 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 567750090..557584e40 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 12a59ee34..6b8e46d60 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 665255d06..415597f99 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 70144556e..705bd09b0 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index c8ee629e2..263480b04 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 3120e5e46..02804a982 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 697f77c9e..b08cfff08 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.3.2 + 1.3.3-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index e5d3c1652..082209701 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 0eebfb648..ed6835793 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 7f1273b51..ffb577af1 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 5af4abab0..3677957b7 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index 6bb5cb3c3..60c45b95b 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index caed41caa..c99fe813f 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 2617d986a..cdc1304cf 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index b6ac04c72..3fa53e1ce 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index e977c0708..accb8cb3d 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index c047a3814..2c69e4aa7 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 7a65eae98..2b55169b3 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT consumer.api diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index 4f4a43e0d..f3fc352c4 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index 810cd05a9..a1e12a4b8 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-consumer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index cd8407dcd..2651a5013 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 62e214772..1e6cc380a 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 5a292ce1b..6476c407a 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index fa8dfee14..3b1373edf 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT consumer.provider diff --git a/message-router/consumer/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/ConsumerFactory.java b/message-router/consumer/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/ConsumerFactory.java index 0802bec2f..1aa02c70a 100755 --- a/message-router/consumer/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/ConsumerFactory.java +++ b/message-router/consumer/provider/src/main/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/ConsumerFactory.java @@ -77,6 +77,16 @@ public class ConsumerFactory { setDefaults(); } + public ConsumerFactory(String username, String password, String host, String group, String id, Integer connectTimeout, Integer readTimeout) { + this.username = username; + this.password = password; + this.host = host; + this.group = group; + this.id = id; + setDefaults(); + } + + public String getAuth() { return auth; } @@ -133,15 +143,6 @@ public class ConsumerFactory { processFilter(filter); } - public ConsumerFactory(String username, String password, String host, String group, String id, Integer connectTimeout, Integer readTimeout) { - this.username = username; - this.password = password; - this.host = host; - this.group = group; - this.id = id; - setDefaults(); - } - private Integer readOptionalInteger(Properties properties, String propertyName) { String stringValue = properties.getProperty(propertyName); if (stringValue != null && stringValue.length() > 0) { diff --git a/message-router/pom.xml b/message-router/pom.xml index 2484f0c2b..1e0590247 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 44990c106..1bdc3a269 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 1f2fb80c3..81423b45b 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index d2d706945..3460d8a88 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 1e5ce9871..bf7d8b2f6 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 24f072619..de3b51250 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index f74ee2e50..989254d0b 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 222adcd1c..347e6a455 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 4755afe35..d7ddce522 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index c27757188..951b26629 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 4c55b34d3..556a8579f 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index f3df19ecd..b3740b3c3 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 5c1e9d7b7..aab9b076a 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 3fd93b8a1..c22560a0d 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 04f18c87d..d01002ca3 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index 03a7d5e91..91d1b8e92 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT 4.0.0 @@ -110,7 +110,7 @@ ONAP - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 72e393cdd..61fdf4459 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 34ae152bd..2a852f2cd 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index ca4365c6d..6c1dcda86 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 7c51251f0..5501cf69d 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index f6e41143e..425af0283 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index f390c8682..bb498e64e 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index f90213da0..e9fbc14d4 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index d583c0996..28ddc6dcb 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index d048a40f2..2f6ad9f09 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 11b168425..c7e1d42d1 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 1ba2e1baf..d3643517a 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 0b11d2cf2..ebdfdb677 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index aaf35c678..69defc4e7 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 83cbd748b..c68504e86 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 0295141ae..48a896bef 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 766e8982c..071f084c7 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index f99c8feeb..8304259a6 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index ae66cd89b..5197a1d6a 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 71ba554ca..74fd99918 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=5 -feature_revision=1 +feature_revision=2 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From dbbd392fdc622c85958598213b2f423848666af6 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 3 Jul 2019 14:30:56 -0400 Subject: Code changes for OpenDaylight Neon Updated code for OpenDaylight Neon, using conversion script in ccsdk/parent/tools. Change-Id: Ic91cff9ee50102b8af1a73f829908de82995b2ef Issue-ID: CCSDK-1389 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 +- aai-service/features/features-aai-service/pom.xml | 4 +- aai-service/features/pom.xml | 4 +- aai-service/installer/pom.xml | 4 +- aai-service/pom.xml | 4 +- aai-service/provider/pom.xml | 10 +- .../OSGI-INF/blueprint/aaiservice-blueprint.xml | 39 +++++++ ansible-adapter/ansible-adapter-bundle/pom.xml | 27 ++++- .../blueprint/ansible-adapter-blueprint.xml | 39 +++++++ .../ccsdk-ansible-adapter/pom.xml | 5 +- .../features-ansible-adapter/pom.xml | 4 +- ansible-adapter/ansible-adapter-features/pom.xml | 4 +- ansible-adapter/ansible-adapter-installer/pom.xml | 4 +- ansible-adapter/pom.xml | 4 +- artifacts/pom.xml | 21 +--- base/http/features/ccsdk-base-http/pom.xml | 2 +- base/http/features/features-base-http/pom.xml | 2 +- base/http/features/pom.xml | 2 +- base/http/installer/pom.xml | 2 +- base/http/pom.xml | 2 +- base/http/provider/pom.xml | 2 +- base/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 11 +- features/features-sli-adaptors/pom.xml | 4 +- features/installer/pom.xml | 4 +- features/pom.xml | 4 +- .../features/ccsdk-mdsal-resource/pom.xml | 6 +- .../features/features-mdsal-resource/pom.xml | 4 +- mdsal-resource/features/pom.xml | 4 +- mdsal-resource/installer/pom.xml | 4 +- mdsal-resource/pom.xml | 4 +- mdsal-resource/provider/pom.xml | 4 +- .../blueprint/mdsal-resource-blueprint.xml | 49 ++++++++ message-router/consumer/api/pom.xml | 2 +- .../features/ccsdk-messagerouter-consumer/pom.xml | 4 +- .../features-messagerouter-consumer/pom.xml | 4 +- message-router/consumer/features/pom.xml | 4 +- message-router/consumer/installer/pom.xml | 4 +- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 +- message-router/publisher/api/pom.xml | 2 +- .../features/ccsdk-messagerouter-publisher/pom.xml | 4 +- .../features-messagerouter-publisher/pom.xml | 4 +- message-router/publisher/features/pom.xml | 4 +- message-router/publisher/installer/pom.xml | 4 +- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 17 ++- .../features/features-netbox-client/pom.xml | 4 +- netbox-client/features/pom.xml | 4 +- netbox-client/installer/pom.xml | 4 +- netbox-client/pom.xml | 4 +- netbox-client/provider/pom.xml | 11 +- .../resources/OSGI-INF/blueprint/netbox-client.xml | 37 ++++++ pom.xml | 7 +- .../features/ccsdk-resource-assignment/pom.xml | 4 +- .../features/features-resource-assignment/pom.xml | 4 +- resource-assignment/features/pom.xml | 4 +- resource-assignment/installer/pom.xml | 4 +- resource-assignment/pom.xml | 4 +- resource-assignment/provider/pom.xml | 4 +- .../blueprint/resource-assignment-blueprint.xml | 33 ++++++ .../OSGI-INF/blueprint/resource-assignment.xml | 129 +++++++++++++++++++++ saltstack-adapter/pom.xml | 4 +- .../ccsdk-saltstack-adapter/pom.xml | 4 +- .../features-saltstack-adapter/pom.xml | 4 +- .../saltstack-adapter-features/pom.xml | 4 +- .../saltstack-adapter-installer/pom.xml | 4 +- .../saltstack-adapter-provider/pom.xml | 12 +- .../blueprint/saltstack-adapter-blueprint.xml | 42 +++++++ sql-resource/features/ccsdk-sql-resource/pom.xml | 4 +- .../features/features-sql-resource/pom.xml | 4 +- sql-resource/features/pom.xml | 4 +- sql-resource/installer/pom.xml | 4 +- sql-resource/pom.xml | 4 +- sql-resource/provider/pom.xml | 4 +- .../OSGI-INF/blueprint/sql-resource-blueprint.xml | 41 +++++++ version.properties | 4 +- 80 files changed, 584 insertions(+), 172 deletions(-) create mode 100755 aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml create mode 100755 ansible-adapter/ansible-adapter-bundle/src/main/resources/OSGI-INF/blueprint/ansible-adapter-blueprint.xml create mode 100755 mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml create mode 100644 netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml create mode 100755 resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml create mode 100755 resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml create mode 100755 saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml create mode 100755 sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 1c5b5e3f8..d9a956a49 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 6af177d8b..20b366ddb 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 434687b55..10f643256 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 9205617b5..1e5cacfef 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index cbebfb182..8fe15434d 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index e07c3ecf5..fa345562e 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,16 +5,17 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + http://maven.apache.org UTF-8 @@ -47,18 +48,17 @@ org.onap.ccsdk.sli.core sli-common - provided + compile org.onap.ccsdk.sli.core sli-provider - provided + compile org.onap.ccsdk.sli.core utils-provider ${ccsdk.sli.core.version} - provided org.osgi diff --git a/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml b/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml new file mode 100755 index 000000000..970936610 --- /dev/null +++ b/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.aai.AAIService + org.onap.ccsdk.sli.adaptors.aai.AAIClient + + + + diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 00f92b5e7..da8a41f2f 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} @@ -57,21 +57,26 @@ commons-logging commons-logging + org.apache.httpcomponents httpclient + + org.glassfish.jersey.core jersey-common test + org.codehaus.jackson jackson-jaxrs test + junit junit @@ -85,13 +90,13 @@ org.onap.ccsdk.sli.core sli-common - provided + org.onap.ccsdk.sli.core sli-provider - provided + org.osgi org.osgi.core @@ -101,10 +106,24 @@ org.slf4j slf4j-api + + + org.slf4j + jcl-over-slf4j + + org.json json + + + + com.google.guava + guava + + + diff --git a/ansible-adapter/ansible-adapter-bundle/src/main/resources/OSGI-INF/blueprint/ansible-adapter-blueprint.xml b/ansible-adapter/ansible-adapter-bundle/src/main/resources/OSGI-INF/blueprint/ansible-adapter-blueprint.xml new file mode 100755 index 000000000..d7be01e9d --- /dev/null +++ b/ansible-adapter/ansible-adapter-bundle/src/main/resources/OSGI-INF/blueprint/ansible-adapter-blueprint.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter + + + + diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index ef2757c0a..cc35a73c7 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} @@ -28,7 +28,6 @@ ${ccsdk.sli.core.version} xml features - provided diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 415597f99..0d6fa20f1 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 705bd09b0..6863e06be 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 263480b04..f2ab5bd49 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 02804a982..d09afdd97 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 0c3c4a287..f2528003a 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT @@ -71,13 +71,6 @@ xml feature - - org.onap.ccsdk.sli.adaptors - ccsdk-base-http - ${project.version} - xml - feature - org.onap.ccsdk.sli.adaptors aai-service-provider @@ -148,16 +141,6 @@ sql-resource-installer ${project.version} - - org.onap.ccsdk.sli.adaptors - base-http-provider - ${project.version} - - - org.onap.ccsdk.sli.adaptors - base-http-installer - ${project.version} - diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml index 38181b683..c417382a4 100644 --- a/base/http/features/ccsdk-base-http/pom.xml +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml index 3b7766fd9..4b51ccccc 100644 --- a/base/http/features/features-base-http/pom.xml +++ b/base/http/features/features-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml index 960a71952..6e3cea56b 100644 --- a/base/http/features/pom.xml +++ b/base/http/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index 4ba0614e1..443d8c4b6 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/http/pom.xml b/base/http/pom.xml index 65571050a..e556b94c6 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 083a7fc7f..17ff73984 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/base/pom.xml b/base/pom.xml index 12a2f779c..f46dda7c5 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 47a431464..e48b58e46 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} @@ -80,12 +80,5 @@ xml features - - ${project.groupId} - ccsdk-base-http - ${project.version} - xml - features - diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index ed6835793..bbdbb6ee1 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index ffb577af1..76643efda 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 3677957b7..73ad702dd 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index cbaee2570..cb73db08e 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} @@ -29,8 +29,8 @@ ${ccsdk.sli.core.version} xml features - provided + ${project.groupId} mdsal-resource-provider diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index c99fe813f..7314197cb 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index cdc1304cf..c597abd5c 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 3fa53e1ce..649b66104 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index accb8cb3d..364850f79 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 2c69e4aa7..91534cb39 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml b/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml new file mode 100755 index 000000000..9c691263c --- /dev/null +++ b/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource + + + + + + org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource + + + diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 2b55169b3..43c314811 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT consumer.api diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index f3fc352c4..f6dda2240 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index a1e12a4b8..dac4461a9 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-consumer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index 2651a5013..54193f953 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 1e6cc380a..304b639de 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 6476c407a..585b378c9 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index 3b1373edf..bc107db07 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 1e0590247..9f5c88cb7 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 1bdc3a269..7a48fb4f8 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 81423b45b..0acfb5e21 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 3460d8a88..2fc8c1450 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index bf7d8b2f6..1c0825e75 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index de3b51250..e34a66555 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 989254d0b..f7232fb50 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 347e6a455..2ecbfd1ad 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index d7ddce522..81fbebadb 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index c9d105b9e..eee799198 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,38 +20,47 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + ${project.version} + + + org.opendaylight.controller + odl-mdsal-broker + xml + features + + org.onap.ccsdk.sli.core ccsdk-sli ${ccsdk.sli.core.version} xml features - provided + org.onap.ccsdk.sli.core ccsdk-dblib ${ccsdk.sli.core.version} xml features - provided + ${project.groupId} netbox-client-provider diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 556a8579f..b1195eba2 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index b3740b3c3..3556a4c5e 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index aab9b076a..ac85879b9 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index c22560a0d..c1b4e3e71 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index c6237d38b..cbc698b6a 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle 4.0.0 @@ -71,13 +71,13 @@ org.onap.ccsdk.sli.core sli-common - provided + compile org.onap.ccsdk.sli.core sliPluginUtils-provider ${project.version} - provided + compile org.osgi @@ -101,13 +101,12 @@ com.github.tomakehurst wiremock + 2.23.2 test - org.eclipse.jetty jetty-server - 9.3.1.v20150714 test diff --git a/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml b/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml new file mode 100644 index 000000000..b667dcba5 --- /dev/null +++ b/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 61c05c14f..26bf386e4 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT 4.0.0 @@ -103,15 +103,14 @@ mdsal-resource resource-assignment sql-resource - base - message-router features artifacts + message-router ONAP - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 61fdf4459..d89cda04a 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 2a852f2cd..09e7a0626 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index 6c1dcda86..d7e77bab3 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 5501cf69d..900ad9f01 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 425af0283..b17b31aa6 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index bb498e64e..a73949efc 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml b/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml new file mode 100755 index 000000000..77c316d2a --- /dev/null +++ b/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml b/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml new file mode 100755 index 000000000..7fcc70c54 --- /dev/null +++ b/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index e9fbc14d4..1d618319f 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 28ddc6dcb..3d9ec2079 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index 2f6ad9f09..a3e21d9d3 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index c7e1d42d1..57875e823 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index d3643517a..639e308aa 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index d863ca08f..fb875e471 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} @@ -66,6 +66,10 @@ org.slf4j slf4j-api + + org.slf4j + jcl-over-slf4j + @@ -98,13 +102,11 @@ org.onap.ccsdk.sli.core sli-common - provided - + org.onap.ccsdk.sli.core sli-provider - provided diff --git a/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml b/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml new file mode 100755 index 000000000..e360f8184 --- /dev/null +++ b/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapter + + + + + diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 69defc4e7..4ca6c9fc4 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index c68504e86..75ee45d87 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 48a896bef..e603e0a6f 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 071f084c7..7f157d0fd 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 8304259a6..645576e18 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 5197a1d6a..d49d01877 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.3-SNAPSHOT + 1.4.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.5.2-SNAPSHOT + 0.6.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml b/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml new file mode 100755 index 000000000..5e8d33946 --- /dev/null +++ b/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource + + + + diff --git a/version.properties b/version.properties index 74fd99918..54c44bc24 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=0 -sprint_number=5 -feature_revision=2 +sprint_number=6 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 602de7cdf89676891604130d64e8bc4cc88c05f6 Mon Sep 17 00:00:00 2001 From: Thugutla sailakshmi Date: Tue, 13 Aug 2019 15:23:38 +0530 Subject: CCSDK-1556-Immediately return this expression instead of assigning it to the temporary variable "rd" immediately return the expression Issue-ID: CCSDK-1559 Change-Id: I6a6b76684b99783fd498e3fac88b0a3747186b1c Signed-off-by: Thugutla sailakshmi --- .../org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 83dab5418..91f587340 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -259,9 +259,7 @@ public class EndPointAllocatorImpl implements EndPointAllocator { if (r != null && r.allocationItems != null && !r.allocationItems.isEmpty()) { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - - ResourceData rd = getResourceData(r); - return rd; + return getResourceData(r); } return null; -- cgit 1.2.3-korg From b1dd81ede363508f83c86ed497b8c0815045f8e5 Mon Sep 17 00:00:00 2001 From: Matej Perina Date: Wed, 3 Apr 2019 09:11:35 +0200 Subject: Proposal to remove OSGi dependencies from the CCSDK project Dependencies on the OSGi frameworks and libraries are removed by integrating the CCSDK project with the lighty.io. It's a toolkit that allows to use ODL services (in this case core services and the Restconf) without the dependency on the Karaf framework and the Blueprint DI. In this change are created the lighty.io modules which initialize and expose same services as the Blueprint DI in the blueprint.xml files. More info about the lighty.io - https://lighty.io Change-Id: Ia9eed2f60c71b7fc2e93b738c857d290b28e9420 Signed-off-by: Matej Perina Signed-off-by: Samuel Kontris --- aai-service/lighty/pom.xml | 48 + .../ccsdk/sli/adaptors/aai/AAIClientLighty.java | 94 + .../adaptors/aai/AAIClientRESTExecutorLighty.java | 776 ++++++++ .../sli/adaptors/aai/AAIDeclarationsLighty.java | 1997 ++++++++++++++++++++ .../adaptors/aai/AAIExecutorInterfaceLighty.java | 36 + .../ccsdk/sli/adaptors/aai/AAIRequestLighty.java | 470 +++++ .../ccsdk/sli/adaptors/aai/AAIServiceLighty.java | 1545 +++++++++++++++ .../sli/adaptors/aai/AAIServiceProviderLighty.java | 206 ++ .../sli/adaptors/aai/CustomQueryRequestLighty.java | 136 ++ .../ccsdk/sli/adaptors/aai/EchoRequestLighty.java | 98 + .../adaptors/aai/GenericQueryRequestLighty.java | 129 ++ .../sli/adaptors/aai/GenericRequestLighty.java | 261 +++ .../sli/adaptors/aai/NodesQueryRequestLighty.java | 130 ++ .../ccsdk/sli/adaptors/aai/PathRequestLighty.java | 92 + .../aai/RelationshipListRequestLighty.java | 67 + .../adaptors/aai/RelationshipRequestLighty.java | 67 + .../sli/adaptors/aai/SelfLinkRequestLighty.java | 110 ++ .../sli/adaptors/aai/UpdateRequestLighty.java | 153 ++ .../sli/adaptors/aai/lighty/AaaServiceModule.java | 55 + aai-service/pom.xml | 1 + ansible-adapter/ansible-adapter-lighty/pom.xml | 48 + ...AnsibleAdapterPropertiesProviderImplLighty.java | 176 ++ .../ansible/lighty/AnsibleAdapterModule.java | 52 + ansible-adapter/pom.xml | 1 + ccsdk-adaptors-lighty/pom.xml | 59 + .../adaptors/lighty/CcsdkAdaptorsLightyModule.java | 175 ++ mdsal-resource/lighty/pom.xml | 47 + .../resource/mdsal/lighty/MdsalResourceModule.java | 58 + mdsal-resource/pom.xml | 1 + netbox-client/lighty/pom.xml | 47 + .../netbox/impl/NetboxClientImplLighty.java | 216 +++ .../netbox/impl/NetboxHttpClientLighty.java | 97 + .../adaptors/netbox/lighty/NetboxClientModule.java | 70 + .../netbox/property/NetboxPropertiesLighty.java | 64 + netbox-client/pom.xml | 1 + pom.xml | 3 +- resource-assignment/lighty/pom.xml | 58 + .../adaptors/resource/lighty/ResourceModule.java | 152 ++ resource-assignment/pom.xml | 1 + saltstack-adapter/pom.xml | 1 + saltstack-adapter/saltstack-adapter-lighty/pom.xml | 53 + ...ltstackAdapterPropertiesProviderImplLighty.java | 175 ++ .../saltstack/lighty/SaltstackAdapterModule.java | 61 + sql-resource/lighty/pom.xml | 58 + .../adaptors/resource/sql/lighty/SqlModule.java | 54 + sql-resource/pom.xml | 1 + 46 files changed, 8199 insertions(+), 1 deletion(-) create mode 100755 aai-service/lighty/pom.xml create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java create mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java create mode 100644 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java create mode 100755 ansible-adapter/ansible-adapter-lighty/pom.xml create mode 100755 ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java create mode 100644 ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java create mode 100755 ccsdk-adaptors-lighty/pom.xml create mode 100644 ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java create mode 100755 mdsal-resource/lighty/pom.xml create mode 100644 mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java create mode 100755 netbox-client/lighty/pom.xml create mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java create mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java create mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java create mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java create mode 100755 resource-assignment/lighty/pom.xml create mode 100644 resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java create mode 100755 saltstack-adapter/saltstack-adapter-lighty/pom.xml create mode 100755 saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java create mode 100644 saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java create mode 100755 sql-resource/lighty/pom.xml create mode 100644 sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java (limited to 'resource-assignment') diff --git a/aai-service/lighty/pom.xml b/aai-service/lighty/pom.xml new file mode 100755 index 000000000..c53c9c3ee --- /dev/null +++ b/aai-service/lighty/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + aai-service-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + aai-service-provider + ${project.version} + compile + + + diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java new file mode 100755 index 000000000..67d8c07de --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; +import org.onap.aai.inventory.v16.GenericVnf; +import org.onap.aai.inventory.v16.PhysicalLink; +import org.onap.aai.inventory.v16.SearchResults; +import org.onap.aai.inventory.v16.Vserver; +import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; + +/** + * THIS CLASS IS A COPY OF {@link AAIClient} WITH REMOVED OSGi DEPENDENCIES + */ +public interface AAIClientLighty extends SvcLogicResource, SvcLogicJavaPlugin { + + public SearchResults requestServiceInstanceURL(String svcInstanceId) throws AAIServiceException; + + // VServers + public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException; + + public URL requestVserverURLNodeQuery(String vserverName) throws AAIServiceException; + public String getTenantIdFromVserverUrl(URL url); + public String getCloudOwnerFromVserverUrl(URL url); + public String getCloudRegionFromVserverUrl(URL url); + public String getVServerIdFromVserverUrl(URL url, String tennantId); + public Vserver requestVServerDataByURL(URL url) throws AAIServiceException; + + + + // ----------------- Release 1510 ---------------------- + // // GenericVNF + public GenericVnf requestGenericVnfData(String vnfId) throws AAIServiceException; + public boolean postGenericVnfData(String vnfId, GenericVnf request) throws AAIServiceException; + + // Physical Link + public PhysicalLink requestPhysicalLinkData(String vnfId) throws AAIServiceException; + public boolean postPhysicalLinkData(String vnfId, PhysicalLink request) throws AAIServiceException; + public boolean deletePhysicalLinkData(String vnfId, String resourceVersion) throws AAIServiceException; + + // UBB Notify + public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException; + + // Node Query - 1602 + public SearchResults requestNodeQuery(String type, String entityIdentifier, String entityName) throws AAIServiceException; + public String requestDataByURL(URL url) throws AAIServiceException; + public GenericVnf requestGenericVnfeNodeQuery(String vnfName) throws AAIServiceException; + + public QueryStatus backup(Map params, SvcLogicContext ctx) throws SvcLogicException; + public QueryStatus restore(Map params, SvcLogicContext ctx) throws SvcLogicException; + + public void logKeyError(String keys); + + public QueryStatus processResponseData(String rv, String resource, AAIRequestLighty request, String prefix, + SvcLogicContext ctx, Map nameValues, String modifier) throws IOException, AAIServiceException ; + public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException; + public boolean isDeprecatedFormat(String resource, Map nameValues); + + String query(AAIRequestLighty request) throws AAIServiceException; + String save(AAIRequestLighty request) throws AAIServiceException; + boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; + boolean update(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; + +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java new file mode 100755 index 000000000..f4cb55218 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java @@ -0,0 +1,776 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.Properties; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import org.apache.commons.codec.binary.Base64; +import org.apache.http.impl.EnglishReasonPhraseCatalog; +import org.onap.ccsdk.sli.adaptors.aai.AAIService.TransactionIdTracker; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; +import org.onap.ccsdk.sli.adaptors.aai.data.RequestError; +import org.onap.ccsdk.sli.adaptors.aai.data.ResourceVersion; +import org.onap.ccsdk.sli.adaptors.aai.data.ServiceException; +import org.onap.ccsdk.sli.core.sli.MetricLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link AAIClientRESTExecutor} WITH REMOVED OSGi DEPENDENCIES + */ +public class AAIClientRESTExecutorLighty implements AAIExecutorInterfaceLighty { + + private final String truststorePath; + private final String truststorePassword; + private final String keystorePath; + private final String keystorePassword; + private final Boolean ignoreCertificateHostError; + // authentication credentials + private String userName; + private String userPassword; + private final String applicationId; + private static final String HTTP_URL_CONNECTION_RESULT="HttpURLConnection result: {} : {}"; + private static final String ENTRY_DOESNT_EXIST="Entry does not exist."; + + /** + * class Constructor + * @param props - properties to initialize an instance. + */ + public AAIClientRESTExecutorLighty(Properties props) { + super(); + + userName = props.getProperty(AAIService.CLIENT_NAME); + userPassword = props.getProperty(AAIService.CLIENT_PWWD); + + if(userName == null || userName.isEmpty()){ + LOG.debug("Basic user name is not set"); + } + if(userPassword == null || userPassword.isEmpty()) { + LOG.debug("Basic password is not set"); + } + + truststorePath = props.getProperty(AAIService.TRUSTSTORE_PATH); + truststorePassword = props.getProperty(AAIService.TRUSTSTORE_PSSWD); + keystorePath = props.getProperty(AAIService.KEYSTORE_PATH); + keystorePassword = props.getProperty(AAIService.KEYSTORE_PSSWD); + + String tmpApplicationId =props.getProperty(AAIService.APPLICATION_ID); + if(tmpApplicationId == null || tmpApplicationId.isEmpty()) { + tmpApplicationId = "SDNC"; + } + applicationId = tmpApplicationId; + + String iche = props.getProperty(AAIService.CERTIFICATE_HOST_ERROR); + boolean host_error = false; + if(iche != null && !iche.isEmpty()) { + host_error = Boolean.valueOf(iche); + } + + ignoreCertificateHostError = host_error; + + HttpsURLConnection.setDefaultHostnameVerifier( (String string,SSLSession ssls) -> { + return ignoreCertificateHostError; + + }); + + if(truststorePath != null && truststorePassword != null && (new File(truststorePath)).exists()) { + System.setProperty("javax.net.ssl.trustStore", truststorePath); + System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword); + } + + if(keystorePath != null && keystorePassword != null && (new File(keystorePath)).exists()) + { + //both jersey and HttpURLConnection can use this + SSLContext ctx = null; + try { + ctx = SSLContext.getInstance("TLS"); + + KeyManagerFactory kmf = null; + try (FileInputStream fin = new FileInputStream(keystorePath)){ + String storeType = "PKCS12"; + String def = KeyStore.getDefaultType(); + kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + + String extension = keystorePath.substring(keystorePath.lastIndexOf(".") + 1); + + if(extension != null && !extension.isEmpty() && "JKS".equalsIgnoreCase(extension)) { + storeType = "JKS"; + } + KeyStore ks = KeyStore.getInstance(storeType); + + char[] pwd = keystorePassword.toCharArray(); + ks.load(fin, pwd); + kmf.init(ks, pwd); + } catch (Exception ex) { + LOG.error("AAIResource", ex); + } + + ctx.init(kmf.getKeyManagers(), null, null); + + CTX = ctx; + LOG.debug("SSLContext created"); + + } catch (KeyManagementException | NoSuchAlgorithmException exc) { + LOG.error("AAIResource", exc); + } + } + + try { + Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); + methodsField.setAccessible(true); + // get the methods field modifiers + Field modifiersField = Field.class.getDeclaredField("modifiers"); + // bypass the "private" modifier + modifiersField.setAccessible(true); + + // remove the "final" modifier + modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); + + /* valid HTTP methods */ + String[] methods = { + "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE", "PATCH" + }; + // set the new methods - including patch + methodsField.set(null, methods); + + } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + LOG.warn("Adding PATCH method", e); + } + LOG.info("AAIResource.ctor initialized."); + + } + + private static final Logger LOG = LoggerFactory.getLogger(AAIService.class); + private static final String NOT_PROVIDED = "NOT PROVIDED"; + private final MetricLogger ml = new MetricLogger(); + + private SSLContext CTX; + + + private int connection_timeout = 300000; + + private int read_timeout = 300000; + + /** + * Returns an String that contains JSON data returned from the AAI Server. + *

+ * This method always returns immediately, whether or not the + * data exists. + * + * @param request an instance of AAIRequiest representing + * the request made by DirectedGraph node. + * @return the JSON based representation of data instance requested. + * @see String + */ + @Override + public String get(AAIRequestLighty request) throws AAIServiceException { + String response = null; + InputStream inputStream = null; + HttpURLConnection con = null; + URL requestUrl = null; + + StringBuilder errorStringBuilder = new StringBuilder(); + + try { + + if(request.getRequestObject() != null) { + requestUrl = request.getRequestUrl(HttpMethod.POST, null); + requestUrl = appendDepth(requestUrl, request); + con = getConfiguredConnection(requestUrl, HttpMethod.POST); + String json_text = request.toJSONString(); + LOGwriteDateTrace("data", json_text); + logMetricRequest("POST "+requestUrl.getPath(), json_text, requestUrl.getPath()); + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(json_text); + osw.flush(); + } else { + requestUrl = request.getRequestUrl(HttpMethod.GET, null); + requestUrl = appendDepth(requestUrl, request); + con = getConfiguredConnection(requestUrl, HttpMethod.GET); + logMetricRequest("GET "+requestUrl.getPath(), "", requestUrl.getPath()); + } + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + String responseMessage = null; + try { + responseMessage = con.getResponseMessage(); + } catch(Exception exc) { + responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); + } finally { + if(responseMessage == null) + responseMessage = NOT_PROVIDED; + } + + // Process the response + LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); + logMetricResponse(responseCode, responseMessage); + + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = AAIService.getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + StringBuilder stringBuilder = new StringBuilder(); + String line = null; + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + response = stringBuilder.toString(); + try { + Object object = mapper.readValue(response, Object.class); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(object)); + } catch(Exception exc) { + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response)); + } + } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { + LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); + ErrorResponse errorresponse = null; + try { + errorresponse = mapper.readValue(reader, ErrorResponse.class); + } catch(Exception exc) { + errorresponse = new ErrorResponse(); + RequestError requestError = new RequestError(); + ServiceException serviceException = new ServiceException(); + serviceException.setText(ENTRY_DOESNT_EXIST); + requestError.setServiceException(serviceException); + errorresponse.setRequestError(requestError ); + } + throw new AAIServiceException(responseCode, errorresponse); + } else if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) { + StringBuilder stringBuilder = new StringBuilder(); + String line = null; + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString()); + ServiceException serviceException = new ServiceException(); + serviceException.setMessageId("HTTP_UNAUTHORIZED"); + serviceException.setText(stringBuilder.toString()); + RequestError requestError = new RequestError(); + requestError.setServiceException(serviceException); + ErrorResponse errorresponse = new ErrorResponse(); + errorresponse.setRequestError(requestError); + throw new AAIServiceException(responseCode, errorresponse); + } else { + String line = null; + while( ( line = reader.readLine() ) != null ) { + errorStringBuilder.append("\n").append( line ); + } + + ErrorResponse errorresponse = mapper.readValue(errorStringBuilder.toString(), ErrorResponse.class); + LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(errorStringBuilder.toString(), exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("", exc); + } + } + } + return response; + } + + /** + * Returns an String that contains JSON data returned from the AAI Server. + *

+ * This method always returns immediately, whether or not the + * data exists. + * + * @param request an instance of AAIRequiest representing + * the request made by DirectedGraph node. + * @return the JSON based representation of data instance requested. + * @see String + */ + @Override + public String post(AAIRequestLighty request) throws AAIServiceException { + InputStream inputStream = null; + + try { + String resourceVersion = null; + AAIDatum instance = request.getRequestObject(); + + try { + Method getResourceVersionMethod = instance.getClass().getMethod("getResourceVersion"); + if(getResourceVersionMethod != null){ + try { + Object object = getResourceVersionMethod.invoke(instance); + if(object != null) + resourceVersion = object.toString(); + } catch (InvocationTargetException exc) { + LOG.warn("", exc); + } + } + } catch(Exception exc) { + LOG.error("", exc); + } + + URL requestUrl = request.getRequestUrl(HttpMethod.PUT, resourceVersion); + HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.PUT); + ObjectMapper mapper = AAIService.getObjectMapper(); + String jsonText = request.toJSONString(); + + LOGwriteDateTrace("data", jsonText); + logMetricRequest("PUT "+requestUrl.getPath(), jsonText, requestUrl.getPath()); + + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(jsonText); + osw.flush(); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + String responseMessage = null; + try { + responseMessage = con.getResponseMessage(); + } catch(Exception exc) { + responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); + } finally { + if(responseMessage == null) + responseMessage = NOT_PROVIDED; + } + + LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); + logMetricResponse(responseCode, responseMessage); + + // Process the response + BufferedReader reader; + String line = null; + reader = new BufferedReader( new InputStreamReader( inputStream ) ); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}"); + return stringBuilder.toString(); + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); + + throw new AAIServiceException(responseCode, errorresponse); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("AAIRequestExecutor.post", exc); + throw new AAIServiceException(exc); + } finally { + try { + if(inputStream != null) + inputStream.close(); + } catch (Exception exc) { + LOG.warn("AAIRequestExecutor.post", exc); + } + } + } + + /** + * Returns Boolean that contains completion state of the command executed. + *

+ * This method always returns immediately, whether or not the + * data exists. + * + * @param request an instance of AAIRequiest representing + * @param resourceVersion a resource version of the data instacne to be deleted. + * the request made by DirectedGraph node. + * @return completion state of the command. + * @see String + */ + @Override + public Boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { + Boolean response = null; + InputStream inputStream = null; + + if(resourceVersion == null) { + throw new AAIServiceException("resource-version is required for DELETE request"); + } + + try { + URL requestUrl = request.getRequestUrl(HttpMethod.DELETE, resourceVersion); + HttpURLConnection conn = getConfiguredConnection(requestUrl, HttpMethod.DELETE); + logMetricRequest("DELETE "+requestUrl.getPath(), "", requestUrl.getPath()); + conn.setDoOutput(true); + + // Check for errors + int responseCode = conn.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = conn.getInputStream(); + } else { + inputStream = conn.getErrorStream(); + } + String responseMessage = null; + try { + responseMessage = conn.getResponseMessage(); + } catch(Exception exc) { + responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); + } finally { + if(responseMessage == null) + responseMessage = NOT_PROVIDED; + } + + // Process the response + LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); + logMetricResponse(responseCode, responseMessage); + + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + String line = null; + + ObjectMapper mapper = AAIService.getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString()); + response = true; + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); + response = false; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("delete", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("delete", exc); + } + } + } + return response; + } + + /** + * Returns an String that contains JSON data returned from the AAI Server. + *

+ * This method always returns immediately, whether or not the + * data exists. + * + * @param request an instance of AAIRequiest representing + * the request made by DirectedGraph node. + * @param clas an definition of the class for which data will be returned + * @return the instance of the class with data. + * @see String + */ + @Override + public Object query(AAIRequestLighty request, Class clas) throws AAIServiceException { + Object response = null; + InputStream inputStream = null; + + try { + URL requestUrl = request.getRequestQueryUrl(HttpMethod.GET); + HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.GET); + logMetricRequest("GET "+requestUrl.getPath(), "", requestUrl.getPath()); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + String responseMessage = null; + try { + responseMessage = con.getResponseMessage(); + } catch(Exception exc) { + responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); + } finally { + if(responseMessage == null) + responseMessage = NOT_PROVIDED; + } + + LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); + logMetricResponse(responseCode, responseMessage); + ObjectMapper mapper = AAIService.getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + // Process the response + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + response = mapper.readValue(reader, clas); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); + } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", ENTRY_DOESNT_EXIST); + return response; + } else { + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("GET", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("GET", exc); + } + } + } + return response; + } + + @Override + public Boolean patch(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { + InputStream inputStream = null; + + try { + AAIDatum instance = request.getRequestObject(); + if(instance instanceof ResourceVersion) { + resourceVersion = ((ResourceVersion)instance).getResourceVersion(); + } + + URL requestUrl = null; + requestUrl = request.getRequestUrl("PATCH", resourceVersion); + HttpURLConnection con = getConfiguredConnection(requestUrl, "PATCH"); + ObjectMapper mapper = AAIService.getObjectMapper(); + String jsonText = request.toJSONString(); + + LOGwriteDateTrace("data", jsonText); + logMetricRequest("PATCH "+requestUrl.getPath(), jsonText, requestUrl.getPath()); + + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(jsonText); + osw.flush(); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + String responseMessage = null; + try { + responseMessage = con.getResponseMessage(); + } catch(Exception exc) { + LOG.info("Exception occured", exc.getMessage()); + responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); + } finally { + if(responseMessage == null) + responseMessage = NOT_PROVIDED; + } + + LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); + logMetricResponse(responseCode, responseMessage); + + // Process the response + BufferedReader reader; + String line = null; + reader = new BufferedReader( new InputStreamReader( inputStream ) ); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}"); + return true; + } else { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append("\n").append( line ); + } + LOG.info(stringBuilder.toString()); + + + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); + + throw new AAIServiceException(responseCode, errorresponse); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("AAIRequestExecutor.patch", exc); + throw new AAIServiceException(exc); + } finally { + try { + if(inputStream != null) + inputStream.close(); + } catch (Exception exc) { + LOG.warn("AAIRequestExecutor.patch", exc); + } + } + } + + /** + * + * @param httpReqUrl + * @param method + * @return + * @throws Exception + */ + protected HttpURLConnection getConfiguredConnection(URL httpReqUrl, String method) throws Exception { + HttpURLConnection con = (HttpURLConnection) httpReqUrl.openConnection(); + + // Set up the connection properties + con.setRequestProperty("Connection", "close"); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setConnectTimeout(connection_timeout); + con.setReadTimeout(read_timeout); + con.setRequestMethod(method); + con.setRequestProperty("Accept", "application/json"); + con.setRequestProperty("Transfer-Encoding","chunked"); + con.setRequestProperty("Content-Type", + "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json"); + con.setRequestProperty("X-FromAppId", applicationId); + con.setRequestProperty("X-TransactionId", TransactionIdTracker.getNextTransactionId()); + String mlId = ml.getRequestID(); + if (mlId != null && !mlId.isEmpty()) { + LOG.debug(String.format("MetricLogger requestId = %s", mlId)); + con.setRequestProperty(MetricLogger.REQUEST_ID, mlId); + } else { + LOG.debug("MetricLogger requestId is null"); + } + + if (userName != null && !userName.isEmpty() && userPassword != null && !userPassword.isEmpty()) { + String basicAuth = "Basic " + new String(Base64.encodeBase64((userName + ":" + userPassword).getBytes())); + con.setRequestProperty("Authorization", basicAuth); + } + + if (con instanceof HttpsURLConnection && CTX != null) { + SSLSocketFactory sockFact = CTX.getSocketFactory(); + HttpsURLConnection.class.cast(con).setSSLSocketFactory(sockFact); + } + return con; + } + + private URL appendDepth(URL requestUrl, AAIRequestLighty request) throws MalformedURLException { + + String depth = request.requestProperties.getProperty("depth", "1"); + String path = requestUrl.toString(); + if(path.contains("?depth=") || path.contains("&depth=")) { + return requestUrl; + } else { + if(path.contains("?")) { + path = String.format("%s&depth=%s", path, depth); + } else { + path = String.format("%s?depth=%s", path, depth); + } + return new URL(path); + } + } + + public void logMetricRequest(String targetServiceName, String msg, String path){ + String svcInstanceId = ""; + String svcName = null; + String partnerName = null; + String targetEntity = "A&AI"; + String targetVirtualEntity = null; + + ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg); + } + + public void logMetricResponse(int responseCode, String responseDescription){ + ml.logResponse(responseCode < 400 ? "COMPLETE" : "ERROR", Integer.toString(responseCode), responseDescription); + } + + protected void LOGwriteFirstTrace(String method, String url) { + String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis()); + LOG.info("A&AI transaction :"); + LOG.info("Request Time : " + time + ", Method : " + method); + LOG.info("Request URL : "+ url); + } + + protected void LOGwriteDateTrace(String name, String data) { + LOG.info("Input - " + name + " : " + data); + } + + protected void LOGwriteEndingTrace(int response_code, String comment, String data) { + LOG.info("Response code : " + response_code +", " + comment); + LOG.info(String.format("Response data : %s", data)); + } + +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java new file mode 100755 index 000000000..1099f6586 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java @@ -0,0 +1,1997 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang.StringUtils; +import org.onap.aai.inventory.v16.GenericVnf; +import org.onap.aai.inventory.v16.Image; +import org.onap.aai.inventory.v16.Metadata; +import org.onap.aai.inventory.v16.Metadatum; +import org.onap.aai.inventory.v16.RelatedToProperty; +import org.onap.aai.inventory.v16.Relationship; +import org.onap.aai.inventory.v16.RelationshipData; +import org.onap.aai.inventory.v16.RelationshipList; +import org.onap.aai.inventory.v16.ResultData; +import org.onap.aai.inventory.v16.SearchResults; +import org.onap.aai.inventory.v16.ServiceInstance; +import org.onap.aai.inventory.v16.Vlan; +import org.onap.aai.inventory.v16.Vlans; +import org.onap.aai.inventory.v16.Vserver; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList; +import org.onap.ccsdk.sli.adaptors.aai.query.Result; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link AAIDeclarations} WITH REMOVED OSGi DEPENDENCIES + */ +public abstract class AAIDeclarationsLighty implements AAIClientLighty { + + public static final String TRUSTSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust"; + public static final String TRUSTSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd"; + public static final String KEYSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.key"; + public static final String KEYSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd"; + + public static final String APPLICATION_ID = "org.onap.ccsdk.sli.adaptors.aai.application"; + + public static final String CLIENT_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.name"; + public static final String CLIENT_PWWD = "org.onap.ccsdk.sli.adaptors.aai.client.psswd"; + + + public static final String CONNECTION_TIMEOUT = "connection.timeout"; + public static final String READ_TIMEOUT = "read.timeout"; + + public static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri"; + + public static final String AAI_VERSION = "org.onap.ccsdk.sli.adaptors.aai.version"; + + // Availability zones query + public static final String QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.query"; + + // Update + public static final String UPDATE_PATH = "org.onap.ccsdk.sli.adaptors.aai.update"; + + // Service instance + public static final String SVC_INSTANCE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst"; + public static final String SVC_INST_QRY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query"; + + // VServer + public static final String NETWORK_VSERVER_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vserver"; + + public static final String VNF_IMAGE_QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query"; + + public static final String PARAM_SERVICE_TYPE = "org.onap.ccsdk.sli.adaptors.aai.param.service.type"; + public static final String CERTIFICATE_HOST_ERROR = "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore"; + + // UBB Notify + public static final String UBB_NOTIFY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.notify"; + public static final String SELFLINK_AVPN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn"; + public static final String SELFLINK_FQDN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn"; + + //Service + public static final String SERVICE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.service"; + + // site-pair-sets + public static final String SITE_PAIR_SET_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set"; + + // node query (1602) + public static final String QUERY_NODES_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes"; + + private static final String VERSION_PATTERN = "/v$/"; + + private static final String AAI_SERVICE_EXCEPTION = "AAI Service Exception"; + + protected abstract Logger getLogger(); + public abstract AAIExecutorInterfaceLighty getExecutor(); + + private static final String RELATIONSHIP_DATA= "Retrofitting relationship data: "; + + + @Override + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) + throws SvcLogicException { + + getLogger().debug("AAIService.query \tresource = "+resource); + + String vnfId; + String vnfName = null; + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + getLogger().debug("key = "+ nameValues.toString()); + + if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); + return QueryStatus.FAILURE; + } + + if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); + return QueryStatus.FAILURE; + } + + // process data using new model + boolean useNewModelProcessing = true; + // process server query by name the old way + if("vserver".equals(resource) || "vserver2".equals(resource)){ + if(nameValues.containsKey("vserver_name") || nameValues.containsKey("vserver-name") || nameValues.containsKey("vserver.vserver_name") || nameValues.containsKey("vserver.vserver-name")) + useNewModelProcessing = false; + } + if("generic-vnf".equals(resource)){ + if(nameValues.containsKey("vnf_name") || nameValues.containsKey("vnf-name") || nameValues.containsKey("generic_vnf.vnf_name") || nameValues.containsKey("generic-vnf.vnf-name")) + useNewModelProcessing = false; + } + + // process data using new model + if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) { + + try { + return newModelQuery(resource, localOnly, select, key, prefix, orderBy, ctx); + } catch (Exception exc) { + getLogger().warn("Failed query - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } + + ObjectMapper mapper = AAIService.getObjectMapper(); + Map attributes = new HashMap<>(); + + String modifier = null; + + if(resource.contains(":")) { + String[] tokens = resource.split(":"); + resource = tokens[0]; + if(tokens.length > 1) { + modifier = tokens[1]; + } + } + + resource = resource.toLowerCase().replace("-", "_"); + + try { + + switch(resource) { + case "generic_vnf": + vnfId = nameValues.get("vnf_id"); + if(nameValues.containsKey("vnf_id")) + vnfId = nameValues.get("vnf_id"); + else if(nameValues.containsKey("generic_vnf.vnf_name")) + vnfId = nameValues.get("generic_vnf.vserver_name"); + + if(nameValues.containsKey("vnf_name")) + vnfName = nameValues.get("vnf_name"); + else if(nameValues.containsKey("generic_vnf.vnf_name")) + vnfName = nameValues.get("generic_vnf.vnf_name"); + + if(vnfId != null && !vnfId.isEmpty()) { + // at this point of the project this part should not be executed + vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", ""); + GenericVnf vnf = this.requestGenericVnfData(vnfId); + if(vnf == null) { + return QueryStatus.NOT_FOUND; + } + + attributes = mapper.convertValue(vnf, attributes.getClass()); + } else if(vnfName != null && !vnfName.isEmpty()) { + try { + vnfName = vnfName.trim().replace("'", "").replace("$", "").replace("'", ""); + GenericVnf vnf = this.requestGenericVnfeNodeQuery(vnfName); + if(vnf == null) { + return QueryStatus.NOT_FOUND; + } + vnfId=vnf.getVnfId(); + nameValues.put("vnf_id", vnfId); + attributes = mapper.convertValue(vnf, attributes.getClass()); + } catch (AAIServiceException exc) { + int errorCode = exc.getReturnCode(); + switch(errorCode) { + case 400: + case 404: + case 412: + break; + default: + getLogger().warn("Caught exception trying to refresh generic VNF", exc); + } + ctx.setAttribute(prefix + ".error.message", exc.getMessage()); + if(errorCode >= 300) { + ctx.setAttribute(prefix + ".error.http.response-code", + Integer.toString(exc.getReturnCode())); + } + return QueryStatus.FAILURE; + } + } else { + getLogger().warn("No arguments are available to process generic VNF"); + return QueryStatus.FAILURE; + } + break; + case "vserver": + case "vserver2": + String vserverName = null; + if(nameValues.containsKey("vserver_name")) + vserverName = nameValues.get("vserver_name"); + else if(nameValues.containsKey("vserver.vserver_name")) + vserverName = nameValues.get("vserver.vserver_name"); + + String vserverId = null; + if(nameValues.containsKey("vserver_id")) + vserverId = nameValues.get("vserver_id"); + if(nameValues.containsKey("vserver.vserver_id")) + vserverId = nameValues.get("vserver.vserver_id"); + String tenantId = nameValues.get("teannt_id"); + + if(vserverName != null) vserverName = vserverName.trim().replace("'", "").replace("$", "").replace("'", ""); + if(vserverId != null) vserverId = vserverId.trim().replace("'", "").replace("$", "").replace("'", ""); + if(tenantId != null) tenantId = tenantId.trim().replace("'", "").replace("$", "").replace("'", ""); + + if (vserverName != null) { + URL vserverUrl = null; + try { + vserverUrl = this.requestVserverURLNodeQuery(vserverName); + } catch (AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); + if (aaiexc.getReturnCode() >= 300) { + ctx.setAttribute(prefix + ".error.http" + "" + ".response-code", Integer.toString(aaiexc.getReturnCode())); + } + + if (aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + else + return QueryStatus.FAILURE; + } + if (vserverUrl == null) { + return QueryStatus.NOT_FOUND; + } + + tenantId = getTenantIdFromVserverUrl(vserverUrl); + String cloudOwner = getCloudOwnerFromVserverUrl(vserverUrl); + String cloudRegionId = getCloudRegionFromVserverUrl(vserverUrl); + + Vserver vserver = null; + try { + vserver = this.requestVServerDataByURL(vserverUrl); + } catch (AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); + if (aaiexc.getReturnCode() >= 300) { + ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); + } + + if (aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + else + return QueryStatus.FAILURE; + } + if (vserver == null) { + return QueryStatus.NOT_FOUND; + } + attributes = mapper.convertValue(vserver, attributes.getClass()); + if (!attributes.containsKey("tenant-id") && tenantId != null) { + attributes.put("tenant-id", tenantId); + } + if (!attributes.containsKey("cloud-owner") && cloudOwner != null) { + attributes.put("cloud-owner", cloudOwner); + } + if (!attributes.containsKey("cloud-region-id") && cloudRegionId != null) { + attributes.put("cloud-region-id", cloudRegionId); + } + } else if (vserverId != null && tenantId != null) { + Vserver vserver = this.requestVServerData(tenantId, vserverId, "att-aic", "AAIAIC25"); + if(vserver == null) { + return QueryStatus.NOT_FOUND; + } + attributes = mapper.convertValue(vserver, attributes.getClass()); + if(!attributes.containsKey("tenant-id") && tenantId != null){ + attributes.put("tenant-id", tenantId); + } + } else { + return QueryStatus.FAILURE; + } + break; + + default: + return QueryStatus.FAILURE; + } + + QueryStatus retval = QueryStatus.SUCCESS; + + if (attributes == null || attributes.isEmpty()) { + retval = QueryStatus.NOT_FOUND; + getLogger().debug("No data found"); + } else { + if (ctx != null) { + if (prefix != null) { + ArrayList keys = new ArrayList<>(attributes.keySet()); + + int numCols = keys.size(); + + for (int i = 0; i < numCols; i++) { + String colValue; + String colName = keys.get(i); + Object object = attributes.get(colName); + + if(object != null && object instanceof String) { + colValue = (String)object; + + if (prefix != null) { + getLogger().debug("Setting "+prefix + "." + colName.replaceAll("_", "-")+" = "+ colValue); + ctx.setAttribute(prefix + "." + colName.replaceAll("_", "-"), colValue); + } else { + getLogger().debug("Setting " + colValue.replaceAll("_", "-")+" = "+colValue); + ctx.setAttribute(colValue.replaceAll("_", "-"), colValue); + } + } else if(object != null && object instanceof Map) { + if(colName.equals(modifier) || "relationship-list".equals(colName)){ + String localNodifier = modifier; + if(localNodifier == null) + localNodifier = "relationship-list"; + Map properties = (Map)object; + writeMap(properties, prefix+"."+localNodifier, ctx); + } + } + } + } + } + } + getLogger().debug("Query - returning " + retval); + return retval; + + } catch (Exception exc) { + getLogger().warn("Failed query - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } + + + public void writeMap(Map properties, String prefix, SvcLogicContext ctx) { + Set mapKeys = properties.keySet(); + + for(String mapKey : mapKeys) { + Object entity = properties.get(mapKey); + if(entity instanceof ArrayList) { + writeList((ArrayList)entity, prefix + "." + mapKey, ctx); + } else + if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) { + ctx.setAttribute(prefix + "." + mapKey, entity.toString()); + getLogger().debug(prefix + "." + mapKey + " : " + entity.toString()); + } else if(entity instanceof Map) { + String localPrefix = prefix; + if(mapKey != null) { + localPrefix = String.format("%s.%s", prefix, mapKey); + } + writeMap( (Map)entity, localPrefix, ctx); + } + } + } + + private void writeList(ArrayList list, String prefix, SvcLogicContext ctx) { + for(int i = 0; i < list.size(); i++ ) { + Object entity = list.get(i); + if(entity instanceof Map) { + writeMap( (Map)entity, prefix + "[" + i + "]", ctx); + } else + if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) { + ctx.setAttribute(prefix, entity.toString()); + getLogger().debug(prefix + " : " + entity.toString()); + } + } + + if(!list.isEmpty()) { + ctx.setAttribute(prefix + "_length", Integer.toString(list.size())); + getLogger().debug(prefix + "_length" + " : " + Integer.toString(list.size())); + } + } + + @Override + public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map params, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + + getLogger().debug("AAIService.save\tresource="+resource); + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + + if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); + return QueryStatus.FAILURE; + } + + if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { + getLogger().warn("AAIService.save has unspecified resource"); + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); + return QueryStatus.FAILURE; + } + // keys passed + getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); + + // process params + if(params.containsKey("prefix")) { + Map tmpParams = ctxGetBeginsWith(ctx, params.get("prefix")); + if(!tmpParams.isEmpty()) { + params.putAll(tmpParams); +// params.remove("prefix"); + } + } + // params passed + getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray())); + + boolean useNewModelProcessing = true; + // process server query by name the old way + if("vserver".equals(resource) || "vserver2".equals(resource)){ + if(nameValues.containsKey("vserver-name")) { + useNewModelProcessing = false; + } + + if(!params.containsKey("vserver-selflink")) { + + AAIRequest request = AAIRequest.createRequest(resource, nameValues); + URL path = null; + try { + request.processRequestPathValues(nameValues); + path = request.getRequestUrl("GET", null); + params.put("vserver-selflink", path.toString()); + } catch (UnsupportedEncodingException | MalformedURLException | URISyntaxException e) { + getLogger().warn("URL error Exception", e); + params.put("vserver-selflink", "/vserver"); + } + } + } + + // process data using new model + if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) { + + try { + if(!resource.contains(":")){ + return newModelSave(resource, force, key, params, prefix, ctx); + } else { + String[] tokens = resource.split(":"); + String localResource = tokens[0]; + String dependency = tokens[1]; + + AAIDatum instance = newModelObjectRequest( localResource, nameValues, prefix, ctx); + if(instance == null) { + return QueryStatus.NOT_FOUND; + } + + switch(dependency){ + case "relationship-list": + newModelProcessRelationshipList(instance, params, prefix, ctx); + break; + case "metadata": + newModelProcessMetadata(instance, params, prefix, ctx); + break; + } + // create a method to update relationship-list + AAIRequestLighty request = AAIRequestLighty.createRequest(localResource, nameValues); + request.setRequestObject(instance); + request.processRequestPathValues(nameValues); + + getExecutor().post(request); + getLogger().debug("Save relationship list - returning SUCCESS"); + return QueryStatus.SUCCESS; + } + } catch (Exception exc) { + ctx.setAttribute(prefix + ".error.message", exc.getMessage()); + if(exc instanceof AAIServiceException) { + AAIServiceException aaiexc = (AAIServiceException)exc; + if(aaiexc.getReturnCode() >= 300) { + ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); + } + + if(aaiexc.getReturnCode() == 404) { + return QueryStatus.NOT_FOUND; + } + } + getLogger().warn("Failed save() - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } else { + getLogger().debug("Save() request for {} is not supported- returning FAILURE", resource); + return QueryStatus.FAILURE; + } + } + + @Override + public QueryStatus update(String resource, String key, Map params, String prefix, SvcLogicContext ctx) throws SvcLogicException { + + resource = resource.toLowerCase(); + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); + if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); + return QueryStatus.FAILURE; + } + + if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); + return QueryStatus.FAILURE; + } + + // check if request is for groups + if(!AAIServiceUtils.containsResource(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not permitted in 'update' operation", resource)); + return QueryStatus.FAILURE; + } + + getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray())); + + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); + request = new UpdateRequestLighty(request, params); + + String[] arguments = request.getArgsList(); + for(String name : arguments) { + String modifiedKey = name.replaceAll("-", "_"); + if(nameValues.containsKey(modifiedKey)) { + String argValue = nameValues.get(modifiedKey); + if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", ""); + request.addRequestProperty(name, argValue); + } + } + + try { + QueryStatus retval = QueryStatus.SUCCESS; + + retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx); + + if(retval == null || retval != QueryStatus.SUCCESS) { + return retval; + } + + String resourceVersion = ctx.getAttribute("tmpDelete.resource-version"); + if(resourceVersion == null) { + return QueryStatus.NOT_FOUND; + } + params.put("resource-version", resourceVersion); + + request.processRequestPathValues(nameValues); + getExecutor().patch(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + if(aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + else + return QueryStatus.FAILURE; + } catch (Exception exc) { + getLogger().warn("Failed update - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + + getLogger().debug("Update - returning SUCCESS"); + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + getLogger().debug("AAIService.delete\tresource="+resource); + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); + + if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", "aaiData"), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); + return QueryStatus.FAILURE; + } + + if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { + ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not supported", resource)); + return QueryStatus.FAILURE; + } + + // check if request is for groups + if(!AAIServiceUtils.containsResource(resource, nameValues)) { + ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not permitted in 'delete' operation", resource)); + return QueryStatus.FAILURE; + } + + if(AAIRequest.createRequest(resource, nameValues) != null) { + if(resource.contains(":")) { + switch (resource.split(":")[1]){ + case "relationship-list": + return processDeleteRelationshipList(resource, key, ctx, nameValues); + case "metadata": + return processDeleteMetadata(resource, key, ctx, nameValues); + } + } + + + try { + QueryStatus retval = QueryStatus.SUCCESS; + + retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx); + + if(retval == null || retval != QueryStatus.SUCCESS) { + return retval; + } + + String resourceVersion = ctx.getAttribute("tmpDelete.resource-version"); + if(resourceVersion == null) { + return QueryStatus.NOT_FOUND; + } + + try { + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); + if(request == null) { + return QueryStatus.FAILURE; + } + + request.processRequestPathValues(nameValues); + + if(getExecutor().delete(request, resourceVersion)) { + return QueryStatus.SUCCESS; + } + } catch(AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + if(aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + else + return QueryStatus.FAILURE; + + } catch (Exception exc) { + getLogger().warn("requestGenericVnfData", exc); + return QueryStatus.FAILURE; + } + + } catch (Exception exc) { + getLogger().warn("Failed delete - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } else { + String resourceName = resource; + String identifier = null; + + if(resourceName.contains(":")) { + String[] tokens = resourceName.split(":"); + if(tokens != null && tokens.length > 0) { + resourceName = tokens[0]; + identifier = tokens[1]; + } + } + if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) { +// RelationshipRequest relationshipRequest = new RelationshipRequest(); + if("generic-vnf".equals(resourceName)){ + String vnfId = nameValues.get("vnf_id"); + String relatedTo = nameValues.get("related_to"); + vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", ""); + relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", ""); + + GenericVnf vnf; + try { + vnf = this.requestGenericVnfData(vnfId); + if(vnf == null) + return QueryStatus.NOT_FOUND; + } catch (AAIServiceException exc) { + getLogger().warn("Failed delete - returning NOT_FOUND", exc); + return QueryStatus.NOT_FOUND; + } + boolean itemRemoved = false; + RelationshipList relationshipList = vnf.getRelationshipList(); + List relationships = relationshipList.getRelationship(); + List iterableList = new LinkedList<>(relationships); + for(Relationship relationship : iterableList) { + if(relationship.getRelatedTo().equals(relatedTo)) { + relationships.remove(relationship); + itemRemoved = true; + } + } + + if(!itemRemoved) + return QueryStatus.NOT_FOUND; + try { + this.postGenericVnfData(vnf.getVnfId(), vnf); + } catch (AAIServiceException exc) { + if(exc.getReturnCode() == 404){ + return QueryStatus.NOT_FOUND; + } else { + getLogger().warn("Failed delete - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } + return QueryStatus.SUCCESS; + } + } + } + return QueryStatus.FAILURE; + } + + @Override + public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { + return query(resource, false, null, key, prefix, null, ctx); + } + + @Override + public QueryStatus isAvailable(String arg0, String arg1, String arg2, SvcLogicContext arg3) + throws SvcLogicException { + throw new SvcLogicException("Method AAIService.isAvailable() has not been implemented yet"); + } + + @Override + public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException { + throw new SvcLogicException("Method AAIService.notify() has not been implemented yet"); + } + + // @Override + public QueryStatus newModelQuery(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) { + + QueryStatus retval = QueryStatus.SUCCESS; + String modifier = null; + + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + if(resource.contains(":")) { + modifier = resource.split(":")[1]; + } + + try { + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); + if(request == null) { + return QueryStatus.FAILURE; + } + + Map params = new HashMap<>(); + + request.processRequestPathValues(nameValues); + if(nameValues.containsKey("prefix")){ + Map tmpParams = ctxGetBeginsWith(ctx, nameValues.get("prefix")); + if(!tmpParams.isEmpty()) { + params.putAll(tmpParams); + } + } + String rv = getExecutor().get(request); + + retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, modifier); + + } catch(AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + int errorCode = aaiexc.getReturnCode(); + ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); + if(errorCode >= 300) { + ctx.setAttribute(prefix + ".error.http.response-code", + Integer.toString(aaiexc.getReturnCode())); + } + + if(aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + + return QueryStatus.FAILURE; + } catch (Exception exc) { + getLogger().warn("requestGenericVnfData", exc); + ctx.setAttribute(prefix + ".error.message", exc.getMessage()); + return QueryStatus.FAILURE; + } + + return retval; + } + + public QueryStatus processResponseData(String rv, String resource, AAIRequestLighty request, String prefix, SvcLogicContext ctx, Map nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException + { + Object response; + + if(rv == null) { + return QueryStatus.NOT_FOUND; + } + + response = request.jsonStringToObject(rv); + if(response == null) { + return QueryStatus.NOT_FOUND; + } + + if("generic-query".equals(resource)) { + SearchResults rd = SearchResults.class.cast(response); + List rdList = rd.getResultData(); + if(rdList == null || rdList.isEmpty()) { + return QueryStatus.NOT_FOUND; + } + ResultData rDatum = rdList.get(0); + nameValues.put("selflink", rDatum.getResourceLink()); + AAIRequestLighty req2 = AAIRequestLighty.createRequest(rDatum.getResourceType(), nameValues); + req2.processRequestPathValues(nameValues); + rv = getExecutor().get(req2); + if(rv == null) { + return QueryStatus.NOT_FOUND; + } + + response = req2.jsonStringToObject(rv); + if(response == null) { + return QueryStatus.NOT_FOUND; + } + } + + if("nodes-query".equals(resource)) { + SearchResults rd = SearchResults.class.cast(response); + List rdList = rd.getResultData(); + if(rdList == null || rdList.isEmpty()) { + return QueryStatus.NOT_FOUND; + } + ResultData rDatum = rdList.get(0); + response = rDatum; + } + + if("formatted-query".equals(resource) || "custom-query".equals(resource)) { + FormattedQueryResultList rd = FormattedQueryResultList.class.cast(response); + List iRIlist = rd.getResults(); + if(iRIlist == null || iRIlist.isEmpty()) { + return QueryStatus.NOT_FOUND; + } + } + + // process relationship list + // this is a temporary soluton to address the realationship handling changes added in Release 17.07 + try { + Class clazz = response.getClass(); + Method getter = clazz.getMethod("getRelationshipList"); + Object obj = getter.invoke(response); + if(obj != null && obj instanceof RelationshipList) { + RelationshipList list = RelationshipList.class.cast(obj); + AAIServiceUtils.populateRelationshipDataFromPath(list); + } + } catch(Exception exc) { + getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); + } + + String preFix; + if(prefix == null || prefix.isEmpty()) { + preFix = ""; + } else { + preFix = prefix + "."; + } + + Map props = objectToProperties(response); + Set keys = props.keySet(); + for(String theKey: keys) { + if(getLogger().isTraceEnabled()) + getLogger().trace(theKey); + + Object value = props.get(theKey); + if(value == null) + continue; + Object type = value.getClass(); + if(value instanceof String) { + ctx.setAttribute(preFix + theKey, value.toString()); + continue; + } + if(value instanceof Boolean) { + ctx.setAttribute(preFix + theKey, value.toString()); + continue; + } + if(value instanceof Integer) { + ctx.setAttribute(preFix + theKey, value.toString()); + continue; + } + if(value instanceof Long) { + ctx.setAttribute(preFix + theKey, value.toString()); + continue; + } + + if(value instanceof ArrayList) { + ArrayList array = ArrayList.class.cast(value); + for(int i = 0; i < array.size(); i++) { + writeList(array, String.format("%s.%s", prefix, theKey), ctx); + } + continue; + } + + if("relationship-list".equals(theKey)){ + Map relationshipList = (Map)value; + // we are interested in seeing just the selected relationship + if(theKey.equals(modifier)) { + List relationships = (List)relationshipList.get("relationship"); + if(relationships != null && !relationships.isEmpty()) { + + List newRelationships = new LinkedList(); + newRelationships.addAll(relationships); + + for(Object obj : newRelationships){ + if(obj instanceof Map) { + Map relProperties = (Map)obj; + if(relProperties.containsKey("related-to")) { + Object relPropsRelatedTo = relProperties.get("related-to"); + + String relatedTo = nameValues.get("related_to"); + if(relatedTo != null) { + relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", ""); + if(!relatedTo.equals(relPropsRelatedTo)) { + relationships.remove(relProperties); + } + continue; + } else { + continue; + } + } + } + } + } + } + writeMap(relationshipList, String.format("%s.%s", prefix, theKey), ctx); + continue; + } + + if(value instanceof Map) { + Map subnetsList = (Map)value; + writeMap(subnetsList, String.format("%s.%s", prefix, theKey), ctx); + continue; + } + + } + return QueryStatus.SUCCESS; + } + + + public QueryStatus newModelBackupRequest(String resource, Map params, String prefix, SvcLogicContext ctx) { + + QueryStatus retval = QueryStatus.SUCCESS; + HashMap nameValues = new HashMap<>(); + + try { + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); + if(request == null) { + return QueryStatus.FAILURE; + } + + boolean argsFound = false; + String[] arguments = request.getArgsList(); + for(String name : arguments) { + String tmpName = name.replaceAll("-", "_"); + String value = params.get(tmpName); + if(value != null && !value.isEmpty()) { + value = value.trim().replace("'", "").replace("$", "").replace("'", ""); + request.addRequestProperty(name, value); + argsFound = true; + } + } + if(!argsFound) { + getLogger().warn("No arguments were found. Terminating backup request."); + return QueryStatus.FAILURE; + } + + String rv = getExecutor().get(request); + ctx.setAttribute(prefix, rv); + } catch(AAIServiceException aaiexc) { + getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); + if(aaiexc.getReturnCode() == 404) + return QueryStatus.NOT_FOUND; + + return QueryStatus.FAILURE; + } catch (Exception exc) { + getLogger().warn("newModelBackupRequest", exc); + return QueryStatus.FAILURE; + } + + return retval; + } + + public AAIDatum newModelObjectRequest(String resource, Map params, String prefix, SvcLogicContext ctx) + throws AAIServiceException { + + AAIDatum response = null; + + try { + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, params); + if(request == null) { + return null; + } + + request.processRequestPathValues(params); + String rv = getExecutor().get(request); + response = request.jsonStringToObject(rv); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + getLogger().warn("newModelBackupRequest", exc); + throw new AAIServiceException(exc); + } + + return response; + } + + + @Override + public QueryStatus release(String arg0, String arg1, SvcLogicContext arg2) throws SvcLogicException { + throw new SvcLogicException("Method AAIService.release() has not been implemented yet"); + } + + @Override + public QueryStatus reserve(String arg0, String arg1, String arg2, String arg3, SvcLogicContext arg4) + throws SvcLogicException { + throw new SvcLogicException("Method AAIService.reserve() has not been implemented yet"); + } + + private QueryStatus newModelSave(String resource, boolean force, String key, Map params, String prefix, SvcLogicContext ctx) { + getLogger().debug("Executing newModelSave for resource : " + resource); + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + + try { + ArrayList subResources = new ArrayList<>(); + Set set = params.keySet(); + Map setters = new HashMap<>(); + Map getters = new HashMap<>(); + + // 1. find class + AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); + Class resourceClass = request.getModelClass(); + getLogger().debug(resourceClass.getName()); + AAIDatum instance = resourceClass.newInstance(); + + { + Annotation[] annotations = resourceClass.getAnnotations(); + for(Annotation annotation : annotations) { + Class anotationType = annotation.annotationType(); + String annotationName = anotationType.getName(); + + // 2. find string property setters and getters for the lists + if("javax.xml.bind.annotation.XmlType".equals(annotationName)){ + XmlType order = (XmlType)annotation; + String[] values = order.propOrder(); + for(String value : values) { + String id = AAIServiceUtils.camelCaseToDashedString(value); + Field field = resourceClass.getDeclaredField(value); + Class type = field.getType(); + Method setter = null; + try { + setter = resourceClass.getMethod("set"+StringUtils.capitalize(value), type); + if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName()) || "int".equals(type.getName())) { + try { + Object arglist[] = new Object[1]; + arglist[0] = params.get(id); + + if(arglist[0] != null) { + if(!type.getName().equals("java.lang.String")) { +// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value)); + if("java.lang.Long".equals(type.getName()) || "java.lang.Integer".equals(type.getName())) { + String fv = params.get(id); + if(fv == null || fv.isEmpty()) { + arglist[0] = null; + } else { + arglist[0] = valueOf(type, params.get(id)); + } + } else if("boolean".equals(type.getName())) { + arglist[0] = valueOf(Boolean.class, params.get(id)); + } else if("int".equals(type.getName())) { + arglist[0] = valueOf(Integer.class, params.get(id)); + } else if("long".equals(type.getName())) { + String fv = params.get(id); + if(fv == null || fv.isEmpty()) { + arglist[0] = null; + } else { + arglist[0] = valueOf(Long.class, params.get(id)); + } + } else { + arglist[0] = valueOf(type, params.get(id)); + } + } + Object obj = setter.invoke(instance, arglist); + } + set.remove(id); + + } catch (Exception x) { + Throwable cause = x.getCause(); + getLogger().warn("Failed process for " + resourceClass.getName(), x); + } + } else if("java.util.List".equals(type.getName())) { + List newValues = new ArrayList<>(); + String length = id+"_length"; + if(!params.isEmpty() && params.containsKey(length)) { + String tmp = params.get(length); + int count = Integer.parseInt(tmp); + for(int i=0; i relationshipKeys = new TreeSet<>(); + Set vlansKeys = new TreeSet<>(); + Set metadataKeys = new TreeSet<>(); + + for(String attribute : set) { + String value = params.get(attribute); + if(attribute.startsWith("relationship-list")) { + relationshipKeys.add(attribute); + } else if(attribute.startsWith("vlans")) { + vlansKeys.add(attribute); + } else if(attribute.startsWith("metadata")) { + metadataKeys.add(attribute); + } + } + // 3. find list property getters + for(String attribute : set) { + String value = params.get(attribute); + Method method = getters.get(attribute); + if(method != null) { + try { + Object arglist[] = new Object[0]; +// arglist[0] = value; + Class[] types = method.getParameterTypes(); + if(types.length == 0){ + Object o = method.invoke(instance, arglist); + if(o instanceof ArrayList) { + ArrayList values = (ArrayList)o; + value = value.replace("[", "").replace("]", ""); + List items = Arrays.asList(value.split("\\s*,\\s*")); + for(String s : items) { + values.add(s.trim()); + } + } + } + } catch (Exception x) { + Throwable cause = x.getCause(); + getLogger().warn("Failed process for " + resourceClass.getName(), x); + } + } + } + // 4. Process Relationships + // add relationship list + if( (subResources.contains("relationship-list") || subResources.contains("relationshipList")) && !relationshipKeys.isEmpty()) { + RelationshipList relationshipList = null; + Object obj = null; + Method getRelationshipListMethod = null; + try { + getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); + } catch(Exception exc) { + getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); + } + + if(getRelationshipListMethod != null){ + try { + obj = getRelationshipListMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof RelationshipList){ + relationshipList = (RelationshipList)obj; + } else { + relationshipList = new RelationshipList(); + Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class); + if(setRelationshipListMethod != null){ + try { + Object arglist[] = new Object[1]; + arglist[0] = relationshipList; + + obj = setRelationshipListMethod.invoke(instance, arglist); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + } + + List relationships = relationshipList.getRelationship(); + + int i = 0; + while(true){ + String searchKey = "relationship-list.relationship[" + i + "].related-to"; + if(!params.containsKey(searchKey)) + break; + int j = 0; + String relatedTo = params.get(searchKey); + String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link"; + String relatedLink = null; + if(params.containsKey(relatedLinkKey)) { + relatedLink = params.get(relatedLinkKey); + } + Relationship relationship = new Relationship(); + relationships.add(relationship); + relationship.setRelatedTo(relatedTo); + String relationshipLabel = "relationship-list.relationship[" + i + "].relationship-label"; + if(params.containsKey(searchKey)) { + relationship.setRelationshipLabel(params.get(relationshipLabel)); + } + getLogger().debug("About to process related link of {}", relatedLink); + if(relatedLink != null) { + if(relatedLink.contains("v$")) + relatedLink = relatedLink.replace(VERSION_PATTERN, "/v16/"); + relationship.setRelatedLink(relatedLink); + } else { + Map relParams = new HashMap<>(); + + while(true) { + String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key"; + String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value"; + if(!params.containsKey(searchRelationshipKey)) + break; + + relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue)); + j++; + } + AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams); + for(Map.Entry entry : relParams.entrySet()) { + rlRequest.addRequestProperty(entry.getKey(), entry.getValue()); + } + String path = rlRequest.updatePathDataValues(null); + relationship.setRelatedLink(path); + } + { + int k = 0; + // process related to properties + Map relParams = new HashMap(); + + while(true) { + String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key"; + String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value"; + if(!params.containsKey(searchRelatedToKey)) + break; + + RelatedToProperty relDatum = new RelatedToProperty(); + relDatum.setPropertyKey(params.get(searchRelatedToKey)); + relDatum.setPropertyValue(params.get(searchRelatedToValue)); + relationship.getRelatedToProperty().add(relDatum); + + relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue)); + k++; + } + } + i++; + } + } + + // 4. vlans + if(subResources.contains("vlans") && !vlansKeys.isEmpty()) { + Object obj = null; + Vlans vlanList = null; + Method getVLansMethod = resourceClass.getMethod("getVlans"); + if(getVLansMethod != null){ + try { + obj = getVLansMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof Vlans){ + vlanList = (Vlans)obj; + } else { + vlanList = new Vlans(); + Method setVlansMethod = resourceClass.getMethod("setVlans", Vlans.class); + if(setVlansMethod != null){ + try { + Object arglist[] = new Object[1]; + arglist[0] = vlanList; + + obj = setVlansMethod.invoke(instance, arglist); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + } + + int i = 0; + while(true){ + String searchKey = "vlans.vlan[" + i + "].vlan-interface"; + if(!params.containsKey(searchKey)) + break; + + String vlanInterface = params.get("vlans.vlan[" + i + "].vlan-interface"); + String vlanIdInner = params.get("vlans.vlan[" + i + "].vlan-id-inner"); + String vlanIdOute = params.get("vlans.vlan[" + i + "].vlan-id-outer"); + String speedValue = params.get("vlans.vlan[" + i + "].speed-value"); + String speedUnits = params.get("vlans.vlan[" + i + "].speed-units"); + + Vlan vlan = new Vlan(); + vlan.setVlanInterface(vlanInterface); + + if(vlanIdInner != null) { + Long iVlanIdInner = Long.parseLong(vlanIdInner); + vlan.setVlanIdInner(iVlanIdInner); + } + + if(vlanIdOute != null) { + Long iVlanIdOuter = Long.parseLong(vlanIdOute); + vlan.setVlanIdOuter(iVlanIdOuter); + } + + if(speedValue != null) { + vlan.setSpeedValue(speedValue); + vlan.setSpeedUnits(speedUnits); + } + + vlanList.getVlan().add(vlan); + i++; + } + } + + // 5. metadata + if(subResources.contains("metadata") && !metadataKeys.isEmpty()) { + Object obj = null; + Metadata metadataList = null; + Method getMetadataMethod = resourceClass.getMethod("getMetadata"); + if(getMetadataMethod != null){ + try { + obj = getMetadataMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof Metadata){ + metadataList = (Metadata)obj; + } else { + metadataList = new Metadata(); + Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class); + if(setMetadataMethod != null){ + try { + Object arglist[] = new Object[1]; + arglist[0] = metadataList; + + obj = setMetadataMethod.invoke(instance, arglist); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + } + + // process data + int i = 0; + while(true){ + String metaKey = "metadata.metadatum[" + i + "].meta-key"; + if(!params.containsKey(metaKey)) + break; + + String metaValue = params.get("metadata.metadatum[" + i + "].meta-value"); + + Metadatum vlan = new Metadatum(); + vlan.setMetaname(metaKey); + vlan.setMetaval(metaValue); + + metadataList.getMetadatum().add(vlan); + i++; + } + + } + + + // 6. Prepare AAI request + String[] args = request.getArgsList(); + for(String arg : args) { + String modifiedKey = arg.replaceAll("-", "_"); + if(nameValues.containsKey(modifiedKey)) { + String argValue = nameValues.get(modifiedKey); + if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", ""); + request.addRequestProperty(arg, argValue); + } + } + + request.processRequestPathValues(nameValues); + request.setRequestObject(instance); + Object response = getExecutor().post(request); + if(request.expectsDataFromPUTRequest()){ + if(response != null && response instanceof String) { + String rv = response.toString(); + QueryStatus retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, null); + getLogger().debug("newModelSave - returning " + retval.toString()); + return retval; + } + } + + } catch(AAIServiceException exc){ + ctx.setAttribute(prefix + ".error.message", exc.getMessage()); + int returnCode = exc.getReturnCode(); + if(returnCode >= 300) { + ctx.setAttribute(prefix + ".error.http.response-code", + Integer.toString(exc.getReturnCode())); + } + + if(returnCode == 400 || returnCode == 412) + return QueryStatus.FAILURE; + else if(returnCode == 404) + return QueryStatus.NOT_FOUND; + else { + getLogger().warn("Failed newModelSave - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } catch(Exception exc){ + getLogger().warn("Failed newModelSave - returning FAILURE", exc); + ctx.setAttribute(prefix + ".error.message", exc.getMessage()); + return QueryStatus.FAILURE; + } + + getLogger().debug("newModelSave - returning SUCCESS"); + return QueryStatus.SUCCESS; + } + + private QueryStatus newModelProcessRelationshipList(Object instance, Map params, String prefix, SvcLogicContext ctx) throws Exception { + + Class resourceClass = instance.getClass(); + + Set relationshipKeys = new TreeSet<>(); + + Set set = params.keySet(); + + for(String attribute : set) { + String value = params.get(attribute); + + if(attribute.startsWith("relationship-list")) { + relationshipKeys.add(attribute); + } + } + + // 3. Process Relationships + // add relationship list + if(!relationshipKeys.isEmpty()) { + RelationshipList relationshipList; + Object obj = null; + Method getRelationshipListMethod = null; + try { + getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); + } catch(Exception exc) { + getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); + } + if(getRelationshipListMethod != null){ + try { + obj = getRelationshipListMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof RelationshipList){ + relationshipList = (RelationshipList)obj; + } else { + relationshipList = new RelationshipList(); + Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class); + if(setRelationshipListMethod != null){ + try { + Object arglist[] = new Object[1]; + arglist[0] = relationshipList; + + obj = setRelationshipListMethod.invoke(instance, arglist); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + } + + boolean createdNewRelationships = false; + List relationships = relationshipList.getRelationship(); + if(relationships == null) { + relationships = new ArrayList<>(); + createdNewRelationships = true; + } + + int i = 0; + while(true){ + String searchKey = "relationship-list.relationship[" + i + "].related-to"; + if(!params.containsKey(searchKey)) + break; + + String relatedTo = params.get(searchKey); + String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link"; + String relatedLink = null; + if(params.containsKey(relatedLinkKey)) { + relatedLink = params.get(relatedLinkKey); + } + + Relationship relationship = new Relationship(); + relationships.add(relationship); + relationship.setRelatedTo(relatedTo); + + String relationshipLabel = "relationship-list.relationship[" + i + "].relationship-label"; + if(params.containsKey(searchKey)) { + relationship.setRelationshipLabel(params.get(relationshipLabel)); + } + + if (relatedLink != null) { + if(relatedLink.contains("v$")) + relatedLink = relatedLink.replace(VERSION_PATTERN, AAIRequest.getSupportedAAIVersion()); + relationship.setRelatedLink(relatedLink); + } else { + Map relParams = new HashMap<>(); + int j = 0; + + while (true) { + String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + + j + "].relationship-key"; + String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + + j + "].relationship-value"; + if (!params.containsKey(searchRelationshipKey)) + break; + + RelationshipData relDatum = new RelationshipData(); + relDatum.setRelationshipKey(params.get(searchRelationshipKey)); + relDatum.setRelationshipValue(params.get(searchRelationshipValue)); + relationship.getRelationshipData().add(relDatum); + + relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue)); + j++; + } + AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams); + for (Map.Entry entry : relParams.entrySet()) { + rlRequest.addRequestProperty(entry.getKey(), entry.getValue()); + } + String path = rlRequest.updatePathDataValues(null); + relationship.setRelatedLink(path); + } + { + int k = 0; + // process related to properties + Map relParams = new HashMap(); + + while(true) { + String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key"; + String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value"; + if(!params.containsKey(searchRelatedToKey)) + break; + + RelatedToProperty relDatum = new RelatedToProperty(); + relDatum.setPropertyKey(params.get(searchRelatedToKey)); + relDatum.setPropertyValue(params.get(searchRelatedToValue)); + relationship.getRelatedToProperty().add(relDatum); + + relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue)); + k++; + } + } + + i++; + } + } + + return QueryStatus.SUCCESS; + } + + private QueryStatus newModelProcessMetadata(Object instance, Map params, String prefix, SvcLogicContext ctx) throws Exception { + + if (!(instance instanceof ServiceInstance) && !(instance instanceof Image)) { + throw new IllegalArgumentException("request is not applicable for selected request"); + } + + Class resourceClass = instance.getClass(); + Set metadataKeys = new TreeSet(); + Set set = params.keySet(); + for(String attribute : set) { + if(attribute.startsWith("metadata")) { + metadataKeys.add(attribute); + } + } + + // 3. Process Metadata + // add metadata + if(!metadataKeys.isEmpty()) { + Metadata metadata = null; + Object obj = null; + Method getMetadataMethod = resourceClass.getMethod("getMetadata"); + if(getMetadataMethod != null){ + try { + obj = getMetadataMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof Metadata){ + metadata = (Metadata)obj; + } else { + metadata = new Metadata(); + Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class); + if(setMetadataMethod != null){ + try { + setMetadataMethod.invoke(instance, metadata); + } catch (InvocationTargetException x) { + } + } + } + + List metadatumList = metadata.getMetadatum(); + int i = 0; + while(true){ + String metaNameKey = "metadata.metadatum[" + i + "].metaname"; + String metaValueKey = "metadata.metadatum[" + i + "].metaval"; + if(!params.containsKey(metaNameKey) || !params.containsKey(metaValueKey)) + break; + + Metadatum metadatum = new Metadatum(); + metadatum.setMetaname(params.get(metaNameKey)); + metadatum.setMetaval(params.get(metaValueKey)); + metadatumList.add(metadatum); + + i++; + } + } + + return QueryStatus.SUCCESS; + } + + private Relationship findRelationship(List relationships, String relatedTo) { + if(relatedTo == null) + return null; + + for(Relationship relationship : relationships) { + if(relationship.getRelatedTo().equals(relatedTo)){ + return relationship; + } + } + return null; + } + + + public QueryStatus backup(Map params, SvcLogicContext ctx) throws SvcLogicException { + String resource = params.get("resource").toLowerCase(); + String prefix = params.get("data-key"); + + HashMap nameValues = new HashMap<>(); + if(AAIRequest.createRequest(resource, nameValues) != null) { + + try { + return newModelBackupRequest(resource, params, prefix, ctx); + } catch (Exception exc) { + getLogger().warn("Failed backup - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } + + return QueryStatus.NOT_FOUND; + } + + @Override + public QueryStatus restore(Map params, SvcLogicContext ctx) throws SvcLogicException { + + QueryStatus retval = QueryStatus.SUCCESS; + String resource = params.get("resource").toLowerCase(); + String prefix = params.get("data-key"); + + HashMap nameValues = new HashMap<>(); + if(AAIRequest.createRequest(resource, nameValues) != null) { + + try { + retval = newModelBackupRequest(resource, params, "tmpRestore", ctx); + if(retval == QueryStatus.SUCCESS) { + ctx.setAttribute("tmpRestore", null); + } + } catch (Exception exc) { + getLogger().warn("Failed restore - returning FAILURE", exc); + return QueryStatus.FAILURE; + } + } + + return QueryStatus.NOT_FOUND; + } + + protected Map objectToProperties(Object object) { + ObjectMapper mapper = AAIService.getObjectMapper(); + return mapper.convertValue(object, Map.class); + } + + static T valueOf(Class klazz, String arg) { + Exception cause = null; + T ret = null; + try { + ret = klazz.cast(klazz.getDeclaredMethod("valueOf", String.class).invoke(null, arg)); + } catch (NoSuchMethodException exc) { + LoggerFactory.getLogger(AAIService.class).warn("Wrong data type", exc); + ret = klazz.cast(arg); + } catch (IllegalAccessException e) { + cause = e; + } catch (InvocationTargetException e) { + cause = e; + } + if (cause == null) { + return ret; + } else { + throw new IllegalArgumentException(cause); + } + } + + private QueryStatus processDeleteRelationshipList(String resource, String key, SvcLogicContext ctx, HashMap nameValues) { + try { + AAIRequest request = AAIRequest.createRequest(resource.split(":")[0], nameValues); + if(request == null) { + return QueryStatus.FAILURE; + } + + request.processRequestPathValues(nameValues); + URL url = request.getRequestUrl("GET", null); + + Class resourceClass = request.getModelClass(); + Object instance = getResource(url.toString(), resourceClass); + if(instance == null) + return QueryStatus.NOT_FOUND; + + // get resource version + String resourceVersion = null; + Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion"); + if(getResourceVersionMethod != null){ + try { + Object object = getResourceVersionMethod.invoke(instance); + if(object != null) + resourceVersion = object.toString(); + } catch (InvocationTargetException exc) { + getLogger().warn("Retrieving resource version", exc); + } + } + + RelationshipList relationshipList = null; + Object obj = null; + Method getRelationshipListMethod = null; + try { + getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); + } catch(Exception exc) { + getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); + } + if(getRelationshipListMethod != null){ + try { + obj = getRelationshipListMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof RelationshipList){ + relationshipList = (RelationshipList)obj; + } else { + getLogger().debug("No relationships found to process."); + return QueryStatus.NOT_FOUND; + } + + if(relationshipList.getRelationship() == null || relationshipList.getRelationship().isEmpty()) { + return QueryStatus.NOT_FOUND; + } + String relatedTo = nameValues.get("related_to"); + if(relatedTo == null) { + return QueryStatus.FAILURE; + } + + relatedTo = relatedTo.replaceAll("_", "-"); + + String relatedLink = nameValues.get("relationship.related_link"); + if(relatedLink != null) { + relatedLink = URLDecoder.decode(relatedLink, "UTF-8"); + } + + List relationships = relationshipList.getRelationship(); + List relationshipsToDelete = new LinkedList<>(); + + for(Relationship relationship : relationships) { + if(relatedTo.equals(relationship.getRelatedTo())) { + if(relatedLink != null) { + if(relationship.getRelatedLink() != null ) { + String localRelatedLink = relationship.getRelatedLink(); + localRelatedLink = URLDecoder.decode(localRelatedLink, "UTF-8"); + if(localRelatedLink.endsWith(relatedLink)) { + getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); + relationshipsToDelete.add(relationship); + } + } + } else { + getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); + relationshipsToDelete.add(relationship); + } + } + } + if(relationshipsToDelete == null || relationshipsToDelete.isEmpty()) { + getLogger().info(String.format("Relationship has not been found for %s", key)); + return QueryStatus.NOT_FOUND; + } + + String path = url.toString(); + path = path + "/relationship-list/relationship"; + URL deleteUrl = new URL(path); + + ObjectMapper mapper = AAIService.getObjectMapper(); + + boolean cumulativeResponse = true; + + for(Relationship targetRelationship : relationshipsToDelete) { + String json_text = mapper.writeValueAsString(targetRelationship); + boolean response = deleteList(deleteUrl, json_text); + if(!response) + cumulativeResponse = response; + + } + + if(!cumulativeResponse) + return QueryStatus.FAILURE; + + return QueryStatus.SUCCESS; + + } catch(Exception exc) { + getLogger().warn("processDelete", exc); + return QueryStatus.FAILURE; + } + } + + private QueryStatus processDeleteMetadata(String resource, String key, SvcLogicContext ctx, HashMap nameValues) { + try { + AAIRequest request = AAIRequest.createRequest(resource, nameValues); + if(request == null) { + return QueryStatus.FAILURE; + } + + request.processRequestPathValues(nameValues); + URL url = request.getRequestUrl("GET", null); + + Class resourceClass = request.getModelClass(); + Object instance = getResource(url.toString(), resourceClass); + + // get resource version + String resourceVersion = null; + Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion"); + if(getResourceVersionMethod != null){ + try { + resourceVersion = (String) getResourceVersionMethod.invoke(instance); + } catch (InvocationTargetException x) { + } + } + + Metadata metadata = null; + Object obj = null; + Method getMetadataMethod = resourceClass.getMethod("getMetadata"); + if(getMetadataMethod != null){ + try { + obj = getMetadataMethod.invoke(instance); + } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); + } + } + if(obj != null && obj instanceof Metadata){ + metadata = (Metadata)obj; + } else { + getLogger().debug("No metadata found to process."); + return QueryStatus.NOT_FOUND; + } + + if(metadata.getMetadatum() == null || metadata.getMetadatum().isEmpty()) { + return QueryStatus.NOT_FOUND; + } + + List metadatumList = metadata.getMetadatum(); + Metadatum metadatumToDelete = null; + + final String metaname = nameValues.get("metaname"); + + for(Metadatum metadatum : metadatumList) { + getLogger().debug(String.format("Comparing existing metadatum of '%s' to keyword '%s'", metadatum.getMetaname(), metaname)); + if(metaname.equals(metadatum.getMetaname())) { + metadatumToDelete = metadatum; + break; + } + } + if(metadatumToDelete == null) { + getLogger().info(String.format("Metadatum has not been found for %s", key)); + return QueryStatus.NOT_FOUND; + } + + String path = url.toString(); + path = path + "/metadata/metadatum/" + encodeQuery( metadatumToDelete.getMetaname() ) + + "?resource-version=" + metadatumToDelete.getResourceVersion(); + URL deleteUrl = new URL(path); + boolean response = deleteList(deleteUrl, null); + + if(!response) + return QueryStatus.FAILURE; + + return QueryStatus.SUCCESS; + + } catch(Exception exc) { + getLogger().warn("processDelete", exc); + return QueryStatus.FAILURE; + } + } + + protected String encodeQuery(String param) throws UnsupportedEncodingException { + return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); + } + + static final Map ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) { + Map tmpPrefixMap = new HashMap<>(); + + if(prefix == null || prefix.isEmpty()){ + return tmpPrefixMap; + } + + for( String key : ctx.getAttributeKeySet() ) { + if( key.startsWith(prefix) ) { + String tmpKey = key.substring(prefix.length() + 1); + tmpPrefixMap.put( tmpKey, ctx.getAttribute(key)); + } + } + + Map prefixMap = new HashMap<>(); + Pattern p = Pattern.compile(".*\\[\\d\\]"); + + SortedSet keys = new TreeSet(tmpPrefixMap.keySet () ); + for(String key : keys) { + Matcher m = p.matcher(key); + if(m.matches()) { + continue; + } else if(key.endsWith("_length")) { + String listKey = key.substring(0, key.indexOf("_length")); + int max = Integer.parseInt(tmpPrefixMap.get(key)); + + ArrayList data = new ArrayList<>(); + for(int x = 0; x < max; x++){ + String tmpKey = String.format("%s[%d]", listKey, x); + String tmpValue = tmpPrefixMap.get(tmpKey); + if(tmpValue != null && !tmpValue.isEmpty()) { + data.add(tmpValue); + } + } + if(!data.isEmpty()) { + prefixMap.put(listKey, data.toString()); + } else { + prefixMap.put(key, tmpPrefixMap.get(key)); + } + } else { + prefixMap.put(key, tmpPrefixMap.get(key)); + } + } + + return prefixMap; + } + + public abstract T getResource(String key, Class type) throws AAIServiceException ; + protected abstract boolean deleteList(URL url, String caller) throws AAIServiceException; +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java new file mode 100755 index 000000000..d2c3812a1 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java @@ -0,0 +1,36 @@ +/*- + * ============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========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +/** + * THIS CLASS IS A COPY OF {@link AAIExecutorInterface} WITH REMOVED OSGi DEPENDENCIES + */ +public interface AAIExecutorInterfaceLighty { + public String get(AAIRequestLighty request) throws AAIServiceException; + public String post(AAIRequestLighty request) throws AAIServiceException; + public Boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; + public Object query(AAIRequestLighty request, Class clas) throws AAIServiceException; + public Boolean patch(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java new file mode 100755 index 000000000..81acfca59 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java @@ -0,0 +1,470 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; +import org.apache.commons.lang.StringUtils; +import org.onap.aai.inventory.v16.GenericVnf; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link AAIRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public abstract class AAIRequestLighty { + protected static final Logger LOG = LoggerFactory.getLogger(AAIRequestLighty.class); + + protected static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri"; + + protected static final String MASTER_REQUEST = "master-request"; + + public static final String RESOURCE_VERSION = "resource-version"; + + public static final String DEPTH = "depth"; + + protected static Properties configProperties; + protected final String targetUri; + protected static AAIServiceLighty aaiService; + + protected AAIDatum requestDatum; + + protected final Properties requestProperties = new Properties(); + + + public static AAIRequestLighty createRequest(String resoourceName, Map nameValues){ + + String resoource = resoourceName; + String masterResource = null; + + if(resoource == null) + return null; + + if(resoource.contains(":")) { + String[] tokens = resoource.split(":"); + if(tokens != null && tokens.length == 2) { + resoource = tokens[1]; + masterResource = tokens[0]; + Class clazz = getClassFromResource(resoource) ; + + if(clazz == null) { + return null; + } + } + } + + if(nameValues.containsKey("selflink")){ + Class clazz = getClassFromResource(resoource) ; + + if(clazz != null) + return new SelfLinkRequestLighty(clazz); + else + return null; + } + + switch(resoource){ + case "generic-query": + return new GenericQueryRequestLighty(); + case "nodes-query": + return new NodesQueryRequestLighty(); + case "custom-query": + case "formatted-query": + return new CustomQueryRequestLighty(); + case "echo": + case "test": + return new EchoRequestLighty(); + + case "linterface": + case "l2-bridge-sbg": + case "l2-bridge-bgf": + { + resoource = "l-interface"; + return getRequestFromResource("l-interface"); + } + case "relationship-list": + return new RelationshipListRequestLighty( + AAIRequestLighty.createRequest(masterResource, nameValues)); + case "relationship": + return new RelationshipRequestLighty( + AAIRequestLighty.createRequest(masterResource, nameValues)); + default: + return getRequestFromResource(resoource); + } + } + + + /** + * Map containing resource tag to its bit position in bitset mapping + */ + private static Map tagValues = new LinkedHashMap<>(); + /** + * Map containing bitset value of the path to its path mapping + */ + private static Map bitsetPaths = new LinkedHashMap<>(); + + + public static Set getResourceNames() { + return tagValues.keySet(); + } + + + public static void setProperties(Properties props, AAIServiceLighty aaiService) { + AAIRequestLighty.configProperties = props; + AAIRequestLighty.aaiService = aaiService; + + try + { + URL url = aaiService.getClass().getResource("/aai-path.properties"); + + InputStream in = url.openStream(); + Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8); + + Properties properties = new Properties(); + properties.load(reader); + LOG.info("loaded " + properties.size()); + + Set keys = properties.stringPropertyNames(); + + int index = 0; + Set resourceNames = new TreeSet<>(); + + for(String key : keys) { + String[] tags = key.split("\\|"); + for(String tag : tags) { + if(!resourceNames.contains(tag)) { + resourceNames.add(tag); + tagValues.put(tag, Integer.toString(++index)); + } + } + BitSet bs = new BitSet(256); + for(String tag : tags) { + String value = tagValues.get(tag); + Integer bitIndex = Integer.parseInt(value) ; + bs.set(bitIndex); + } + String path = properties.getProperty(key); + LOG.info(String.format("bitset %s\t\t%s", bs.toString(), path)); + bitsetPaths.put(bs, path); + } + LOG.info("loaded " + resourceNames.toString()); + } + catch (Exception e) + { + LOG.error("Caught exception", e); + } + } + + public AAIRequestLighty() { + targetUri = configProperties.getProperty(TARGET_URI); + } + + public void addRequestProperty(String key, String value) { + requestProperties.put(key, value); + } + + public final void setRequestObject(AAIDatum value) { + requestDatum = value; + } + + public final AAIDatum getRequestObject() { + return requestDatum; + } + + public final void addMasterRequest(AAIRequestLighty masterRequest) { + requestProperties.put(MASTER_REQUEST, masterRequest); + } + + protected static String encodeQuery(String param) throws UnsupportedEncodingException { + return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); + } + + protected void handleException(AAIRequestLighty lInterfaceRequest, JsonProcessingException exc) { + aaiService.getLogger().warn("Could not deserialize object of type " + lInterfaceRequest.getClass().getSimpleName(), exc) ; + } + + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + + String request_url = null; + + request_url = targetUri + updatePathDataValues(resourceVersion); + + URL http_req_url = new URL(request_url); + + aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); + + return http_req_url; + } + + public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + String request_url = getRequestPath(); + + Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); + + for(String resoourceName:uniqueResources) { + AAIRequestLighty + locRequest = AAIRequestLighty.createRequest(resoourceName, new HashMap()); + if(locRequest != null) { + Class clazz = locRequest.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) { + LOG.error("Caught exception", e); + } + } + } + + if(resourceVersion != null) { + request_url = request_url +"?resource-version="+resourceVersion; + } + + return request_url; + } + + protected String getRequestPath() throws MalformedURLException { + return getRequestPath(null); + } + + protected String getRequestPath(String resource) throws MalformedURLException { + if(requestProperties.containsKey("resource-path")) { + return requestProperties.getProperty("resource-path"); + } + + Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); + if(resource != null) { + // for group search add itself, but remove singular version of itself + if(!uniqueResources.contains(resource)) { + boolean replaced = false; + Set tmpUniqueResources = new HashSet<>(); + tmpUniqueResources.addAll(uniqueResources); + for(String item : tmpUniqueResources){ + String plural = item +"s"; + if(item.endsWith("y")){ + plural = item.substring(0, item.length()-1)+ "ies"; + } + if(plural.equals(resource)) { + uniqueResources.remove(item); + uniqueResources.add(resource); + replaced = true; + break; + } + } + if(!replaced){ + if(!uniqueResources.contains(resource)) { + uniqueResources.add(resource); + } + } + } + } + BitSet bitset = new BitSet(); + for(String key : uniqueResources) { + if(tagValues.containsKey(key)) { + Object tmpValue = tagValues.get(key); + if(tmpValue != null) { + String value = tmpValue.toString(); + int bitIndex = Integer.parseInt(value); + bitset.set(bitIndex); + } + } + } + + String path = bitsetPaths.get(bitset); + if(path == null) { + throw new MalformedURLException("PATH not found for key string containing valies :" +requestProperties.toString()); + } + return path; + } + + public abstract URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException; + + public abstract String toJSONString(); + + public abstract String[] getArgsList(); + + public abstract Class getModelClass() ; + + public String getPrimaryResourceName(String resource) { + return resource; + } + + public String formatKey(String argument) { + return argument; + } + + public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException { + if(jsonData == null) { + return null; + } + + AAIDatum response = null; + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(jsonData, getModelClass()); + return response; + } + + protected static Set extractUniqueResourceSetFromKeys(Set keySet) { + Set uniqueResources = new TreeSet<>(); + List keys = new ArrayList<>(keySet); + for(String resource : keys) { + if(resource.contains(".")) { + String [] split = resource.split("\\."); + uniqueResources.add(split[0].replaceAll("_", "-")); + } + } + return uniqueResources; + } + + public void processRequestPathValues(Map nameValues) { + Set uniqueResources = extractUniqueResourceSetFromKeys(nameValues.keySet()); + + Set tokens = new TreeSet<>(); + tokens.add(DEPTH); + tokens.addAll(Arrays.asList(this.getArgsList())); + + for(String resoourceName:uniqueResources) { + AAIRequestLighty + locRequest = AAIRequestLighty.createRequest(resoourceName, nameValues); + if(locRequest != null) + tokens.addAll(Arrays.asList(locRequest.getArgsList())); + } + + String[] arguments = tokens.toArray(new String[0]); + for(String name : arguments) { + String tmpName = name.replaceAll("-", "_"); + String value = nameValues.get(tmpName); + if(value != null && !value.isEmpty()) { + value = value.trim().replace("'", "").replace("$", "").replace("'", ""); + this.addRequestProperty(name, value); + } + } + } + + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + return request_url; + } + + public boolean isDeleteDataRequired() { + return false; + } + + ObjectMapper getObjectMapper() { + return AAIService.getObjectMapper(); + } + + public static Class getClassFromResource(String resoourceName) { + String className = GenericVnf.class.getName(); + String[] split = resoourceName.split("-"); + for(int i = 0; i < split.length; i++) { + split[i] = StringUtils.capitalize(split[i]); + } + + String caps = StringUtils.join(split); + className = className.replace("GenericVnf", caps); + try { + return (Class)Class.forName(className); + } catch (ClassNotFoundException e) { + LOG.warn("AAIRequestLighty does not support class: " + e.getMessage()); + return null; + } + } + + protected static AAIRequestLighty getRequestFromResource(String resoourceName) { + + Class clazz = getClassFromResource(resoourceName); + + if(clazz == null) { + return null; + } + return new GenericRequestLighty(clazz); + } + + public static Map splitQuery(String query) throws UnsupportedEncodingException { + Map query_pairs = new LinkedHashMap<>(); + + if(query != null && !query.isEmpty()) { + String[] pairs = query.split("&"); + for (String pair : pairs) { + int idx = pair.indexOf('='); + query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); + } + } + return query_pairs; + } + + public static Map splitPath(String path) throws UnsupportedEncodingException { + Map query_pairs = new LinkedHashMap<>(); + + if(path != null && !path.isEmpty()) { + String[] pairs = path.split("/"); + for (String pair : pairs) { + int idx = pair.indexOf('='); + query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); + } + } + return query_pairs; + } + + protected boolean expectsDataFromPUTRequest() { + return false; + } + + + public String getTargetUri() { + return targetUri; + } + + public static final String getSupportedAAIVersion() { + return configProperties.getProperty(AAIDeclarations.AAI_VERSION, "/v16/"); + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java new file mode 100755 index 000000000..bd9115b64 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java @@ -0,0 +1,1545 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2019 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.AnnotationIntrospector; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; +import com.fasterxml.jackson.databind.type.TypeFactory; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Set; +import java.util.TimeZone; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.ws.rs.HttpMethod; +import javax.xml.bind.annotation.XmlElement; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import org.onap.aai.inventory.v16.GenericVnf; +import org.onap.aai.inventory.v16.PhysicalLink; +import org.onap.aai.inventory.v16.ResultData; +import org.onap.aai.inventory.v16.SearchResults; +import org.onap.aai.inventory.v16.Vserver; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; +import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; +import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.sli.MetricLogger; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +/** + * THIS CLASS IS A COPY OF {@link AAIService} WITH REMOVED OSGi DEPENDENCIES + */ +public class AAIServiceLighty extends AAIDeclarationsLighty implements AAIClientLighty, SvcLogicResource { + + public static final String AAICLIENT_PROPERTIES = "/aaiclient.properties"; + public static final String PATH_PROPERTIES = "/aai-path.properties"; + + private static final Logger LOG = LoggerFactory.getLogger(AAIServiceLighty.class); + + private final String truststorePath; + private final String truststorePassword; + private final String keystorePath; + private final String keystorePassword; + private final Boolean ignoreCertificateHostError; + + private final String targetUri; + private final String networkVserverPath; + + private final String svc_inst_query_path; + + private final String ubb_notify_path; + private final String selflinkAvpn; + private final String selflinkFqdn; + + private final int connectionTimeout; + private final int readTimeout; + + // 1602 + private final String queryNodesPath; + private final String applicationId; + + // authentication credentials + private String userName; + private String userPassword; + + // runtime + private final boolean runtimeOSGI; + + private SSLContext CTX; + + private final MetricLogger ml = new MetricLogger(); + + private AAIExecutorInterfaceLighty executor; + + public AAIServiceLighty(final UtilsProvider configuration) { + this(configuration.getProperties()); + } + + public AAIServiceLighty(final URL url) { + this(getProperties(url)); + } + + public AAIServiceLighty(Properties props) { + LOG.info("Entered AAIService.ctor"); + + String runtime = System.getProperty("aaiclient.runtime"); + if("OSGI".equals(runtime)) { + runtimeOSGI = true; + } else { + runtimeOSGI = false; + } + + try { + AAIRequestLighty.setProperties(props, this); + + } catch(Exception exc){ + LOG.error("AicAAIResource.static", exc); + } + + executor = new AAIClientRESTExecutorLighty(props); + + userName = props.getProperty(CLIENT_NAME); + userPassword = props.getProperty(CLIENT_PWWD); + + if(userName == null || userName.isEmpty()){ + LOG.debug("Basic user name is not set"); + } + if(userPassword == null || userPassword.isEmpty()) { + LOG.debug("Basic password is not set"); + } + + truststorePath = props.getProperty(TRUSTSTORE_PATH); + truststorePassword = props.getProperty(TRUSTSTORE_PSSWD); + keystorePath = props.getProperty(KEYSTORE_PATH); + keystorePassword = props.getProperty(KEYSTORE_PSSWD); + + targetUri = props.getProperty(TARGET_URI); + props.getProperty(QUERY_PATH); + props.getProperty(UPDATE_PATH); + + String tmpApplicationId = props.getProperty(APPLICATION_ID); + if(tmpApplicationId == null || tmpApplicationId.isEmpty()) { + tmpApplicationId = "SDNC"; + } + this.applicationId = tmpApplicationId; + + // connection timeout + int tmpConnectionTimeout = 30000; + int tmpReadTimeout = 30000; + + try { + String tmpValue = null; + tmpValue = props.getProperty(CONNECTION_TIMEOUT, "30000"); + tmpConnectionTimeout = Integer.parseInt(tmpValue); + tmpValue = props.getProperty(READ_TIMEOUT, "30000"); + tmpReadTimeout = Integer.parseInt(tmpValue); + } catch(Exception exc) { + LOG.error("Failed setting connection timeout", exc); + tmpConnectionTimeout = 30000; + tmpReadTimeout = 30000; + } + connectionTimeout = tmpConnectionTimeout; + readTimeout = tmpReadTimeout; + + networkVserverPath =props.getProperty(NETWORK_VSERVER_PATH); + + props.getProperty(SVC_INSTANCE_PATH); + svc_inst_query_path = props.getProperty(SVC_INST_QRY_PATH); + props.getProperty(PARAM_SERVICE_TYPE, "service-type"); + + props.getProperty(VNF_IMAGE_QUERY_PATH); + + ubb_notify_path = props.getProperty(UBB_NOTIFY_PATH); + selflinkAvpn = props.getProperty(SELFLINK_AVPN); + selflinkFqdn = props.getProperty(SELFLINK_FQDN); + + props.getProperty(SERVICE_PATH); + + props.getProperty(SITE_PAIR_SET_PATH); + + queryNodesPath = props.getProperty(QUERY_NODES_PATH); + + String iche = props.getProperty(CERTIFICATE_HOST_ERROR); + boolean host_error = false; + if(iche != null && !iche.isEmpty()) { + host_error = Boolean.valueOf(iche); + } + + ignoreCertificateHostError = host_error; + + HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){ + public boolean verify(String string,SSLSession ssls) { + return ignoreCertificateHostError; + } + }); + + if(truststorePath != null && truststorePassword != null && (new File(truststorePath)).exists()) { + System.setProperty("javax.net.ssl.trustStore", truststorePath); + System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword); + } + + if(keystorePath != null && keystorePassword != null && (new File(keystorePath)).exists()) { + //DefaultClientConfig config = new DefaultClientConfig(); + //both jersey and HttpURLConnection can use this + SSLContext ctx = null; + try { + ctx = SSLContext.getInstance("TLS"); + + KeyManagerFactory kmf = null; + try (FileInputStream fin = new FileInputStream(keystorePath)){ + String def = "SunX509"; + String storeType = "PKCS12"; + def = KeyStore.getDefaultType(); + kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + + String extension = keystorePath.substring(keystorePath.lastIndexOf(".") + 1); + if("JKS".equalsIgnoreCase(extension)) { + storeType = "JKS"; + } + KeyStore ks = KeyStore.getInstance(storeType); + + char[] pwd = keystorePassword.toCharArray(); + ks.load(fin, pwd); + kmf.init(ks, pwd); + } catch (Exception ex) { + LOG.error("AAIResource", ex); + } + + if(null!=kmf) { + ctx.init(kmf.getKeyManagers(), null, null); + } + /* + * config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new + * HTTPSProperties( new HostnameVerifier() { + * + * @Override public boolean verify( String s, SSLSession sslSession ) { return + * ignoreCertificateHostError; } }, ctx)); + */ + + CTX = ctx; + LOG.debug("SSLContext created"); + + } catch (KeyManagementException | NoSuchAlgorithmException exc) { + LOG.error("AAIResource", exc); + } + } + + LOG.info("AAIResource.ctor initialized."); + + try { + Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); + methodsField.setAccessible(true); + // get the methods field modifiers + Field modifiersField = Field.class.getDeclaredField("modifiers"); + // bypass the "private" modifier + modifiersField.setAccessible(true); + + // remove the "final" modifier + modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); + + /* valid HTTP methods */ + String[] methods = { + "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE", "PATCH" + }; + // set the new methods - including patch + methodsField.set(null, methods); + + } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + LOG.error("Exception occured", e); + } + + } + + private static Properties getProperties(URL url) { + Properties properties = new Properties(); + try { + properties.load(url.openStream()); + } catch (IOException exc) { + LOG.error("getProperties", exc); + } + return properties; + } + + public void setExecutor(AAIExecutorInterfaceLighty executor) { + this.executor = executor; + } + + public void cleanUp() { + + } + + /** + * + * @param http_req_url + * @param method + * @return + * @throws Exception + */ + protected HttpURLConnection getConfiguredConnection(URL http_req_url, String method) throws Exception { + HttpURLConnection con = (HttpURLConnection) http_req_url.openConnection(); + + // Set up the connection properties + con.setRequestProperty( "Connection", "close" ); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setConnectTimeout( connectionTimeout ); + con.setReadTimeout( readTimeout ); + con.setRequestMethod( method ); + con.setRequestProperty( "Accept", "application/json" ); + con.setRequestProperty( "Content-Type", "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json" ); + con.setRequestProperty("X-FromAppId", applicationId); + con.setRequestProperty("X-TransactionId", TransactionIdTracker.getNextTransactionId()); + String mlId = ml.getRequestID(); + if(mlId != null && !mlId.isEmpty()) { + LOG.debug(String.format("MetricLogger requestId = %s", mlId)); + con.setRequestProperty(MetricLogger.REQUEST_ID, mlId); + } else { + LOG.debug("MetricLogger requestId is null"); + } + con.setRequestProperty("Transfer-Encoding","chunked"); + + if(userName != null && !userName.isEmpty() && userPassword != null && !userPassword.isEmpty()) { + String basicAuth = "Basic " + new String(Base64.encodeBase64((userName + ":" + userPassword).getBytes())); + con.setRequestProperty ("Authorization", basicAuth); + } + + if(con instanceof HttpsURLConnection && CTX != null) { + SSLSocketFactory sockFact = CTX.getSocketFactory(); + HttpsURLConnection.class.cast(con).setSSLSocketFactory( sockFact ); + } + return con; + } + + + @Override + public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException { + GenericVnf response = null; + + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("generic-vnf"); + request.addRequestProperty("generic-vnf.vnf-id", vnf_id); + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, GenericVnf.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + + return response; + + } + + @Override + public boolean postGenericVnfData(String vnf_id, GenericVnf data) throws AAIServiceException { + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("generic-vnf"); + request.addRequestProperty("generic-vnf.vnf-id", vnf_id); + request.setRequestObject(data); + Object response = executor.post(request); + return true; + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestGenericVnfData", exc); + throw new AAIServiceException(exc); + } + } + + @Override + public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException { + SearchResults response = null; + InputStream inputStream = null; + + try { + String path = svc_inst_query_path; + path = path.replace("{svc-instance-id}", encodeQuery(svc_instance_id)); + + String request_url = targetUri+path; + URL http_req_url = new URL(request_url); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); + + LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); + LOGwriteDateTrace("svc_instance_id", svc_instance_id); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + response = mapper.readValue(reader, SearchResults.class); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + return response; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestServiceInstanceURL", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("Error closing Inputstream", exc); + } + } + } + return response; + } + + + private static Properties initialize(URL url ) throws ConfigurationException { + + if(url == null) { + throw new NullPointerException(); + } + + InputStream is = null; + Properties props = new Properties(); + + try { + if(LOG.isDebugEnabled()) + LOG.info("Property file is: " + url.toString()); + + is = url.openStream(); + + props.load(is); + if(LOG.isDebugEnabled()) { + LOG.info("Properties loaded: " + props.size()); + Enumeration en = props.keys(); + + while(en.hasMoreElements()) { + String key = (String)en.nextElement(); + String property = props.getProperty(key); + LOG.debug(key + " : " + property); + } + } + } catch (Exception e) { + throw new ConfigurationException("Could not load properties file.", e); + } + return props; + } + + static class TransactionIdTracker { +// protected static AtomicLong tracker = new AtomicLong(); + + public static String getNextTransactionId() { + // Check if RequestId exists as MDC. If not, create new. + String transactionId = MDC.get("RequestId"); + if ("".equals(transactionId) || transactionId == null) { + transactionId = UUID.randomUUID().toString(); + LOG.info("Missing requestID. Assigned " + transactionId); + MDC.put("RequestId", transactionId); + } + return transactionId; + } + + } + + protected void LOGwriteFirstTrace(String method, String url) { + String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis()); + LOG.info("A&AI transaction :"); + LOG.info("Request Time : " + time + ", Method : " + method); + LOG.info("Request URL : "+ url); + } + + protected void LOGwriteDateTrace(String name, String data) { + LOG.info("Input - " + name + " : " + data); + } + + protected void LOGwriteEndingTrace(int response_code, String comment, String data) { + LOG.info("Response code : " + response_code +", " + comment); + LOG.info(String.format("Response data : %s", data)); + } + + protected String encodeQuery(String param) throws UnsupportedEncodingException { + return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); + } + + private String encodeCustomerURL(final String selection) + { + String encrypted_url = selection; + String apnpattern = + "/aai/v11/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/"; + Pattern pattern = Pattern.compile(apnpattern); + + try { + URL url = new URL(selection); + String path = url.getPath(); + + LOG.info("Trying to match apn to <" + path + ">"); + + Matcher matcher = pattern.matcher(path); + + while(matcher.find()) { + String customer = matcher.group(1); + String subscription = matcher.group(2); + String service = matcher.group(3); + + encrypted_url = selection.replace(customer, encodeQuery(customer)); + encrypted_url = encrypted_url.replace(subscription, encodeQuery(subscription)); + encrypted_url = encrypted_url.replace(service, encodeQuery(service)); + } + } catch (Exception e) { + LOG.warn("", e); + } + + return encrypted_url; + } + + + + /* + * (non-Javadoc) + * @see org.onap.sdnct.sli.aai.AAIClient#requestVServersData(java.lang.String, java.lang.String) + */ + @Override + public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException { + Vserver response = null; + + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("vserver"); + request.addRequestProperty("cloud-region.cloud-owner", cloudOwner); + request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId); + request.addRequestProperty("tenant.tenant-id", tenantId); + request.addRequestProperty("vserver.vserver-id", vserverId); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, Vserver.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + + //================== End of DvsSwitch ================= + //==================== PhysicalLink ====================== + @Override + public PhysicalLink requestPhysicalLinkData(String linkName) throws AAIServiceException { + PhysicalLink response = null; + + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); + request.addRequestProperty("physical-link.link-name", linkName); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, PhysicalLink.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestPhysicalLinkData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean postPhysicalLinkData(String linkName, PhysicalLink data) throws AAIServiceException { + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); + request.addRequestProperty("physical-link.link-name", linkName); + request.setRequestObject(data); + Object response = executor.post(request); + return true; + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + } + + @Override + public boolean deletePhysicalLinkData(String linkName, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); + request.addRequestProperty("physical-link.link-name", linkName); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deletePhysicalLinkData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + public boolean deleteAAIEntity(URL url, String caller) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + boolean response = false; + InputStream inputStream = null; + + try { + URL http_req_url = url; + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.DELETE); + + LOGwriteFirstTrace("DELETE", http_req_url.toString()); + + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + String line = null; + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString()); + response = true; + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + response = false; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(caller, exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("Error closing InputStream", exc); + } + } + } + return response; + } + + /** + * Generic method to GET json data from an A&AI callback URL. + * Then convert that json to an Object. + * If successful the Object is attempted to be cast to the type parameter. + * + * @param key + * callback url for A&AI + * @param type + * the class of object that A&AI will return + * @return the object created from json or null if the response code is not 200 + * + * @throws AAIServiceException + * if empty or null key and or type or there's an error with processing + */ + public T dataChangeRequestAaiData(String key, Class type) throws AAIServiceException { + if (StringUtils.isEmpty(key) || type == null) { + throw new AAIServiceException("Key is empty or null and or type is null"); + } + + T response = null; + + SvcLogicContext ctx = new SvcLogicContext(); + if(!key.contains(" = ") && isValidURL(key)) { + key = String.format("selflink = '%s'", key); + } else + if(!key.contains(" = ") && isValidURI(key)) { + key = String.format("resource-path = '%s'", key); + } + + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + + SelfLinkRequestLighty request = new SelfLinkRequestLighty(type); + request.processRequestPathValues(nameValues); + Object obj = this.getExecutor().query(request, type); + response = type.cast(obj); + + return response != null ? type.cast(response) : response; + } + + + public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException { + InputStream inputStream = null; + + try { + + String selfLink = selflinkFqdn; + if(SELFLINK_AVPN != null && SELFLINK_AVPN.equals(pathCode)) { + selfLink = selflinkAvpn; + } + selfLink = selfLink.replace("{service-instance-id}", encodeQuery(serviceInstanceId)); + event.setSelflink(selfLink); + + ObjectMapper mapper = getObjectMapper(); + String json_text = mapper.writeValueAsString(event); + + SSLSocketFactory sockFact = CTX.getSocketFactory(); + + String request_url = targetUri+ubb_notify_path; + URL http_req_url = new URL(request_url); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT); + + if (json_text != null) { + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(json_text); + osw.flush(); + osw.close(); + } + + LOGwriteFirstTrace("PUT", request_url); + LOGwriteDateTrace("NotifyEvent", json_text); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + BufferedReader reader; + String line = null; + reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : + "{no-data}"); + return true; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + + throw new AAIServiceException(responseCode, errorresponse); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("sendNotify", exc); + throw new AAIServiceException(exc); + } finally { + try { + if(inputStream != null) + inputStream.close(); + } catch (Exception exc) { + LOG.warn("Error closing Input stream", exc); + } + } + } + + @Override + public SearchResults requestNodeQuery(String node_type, String entityIdentifier, String entityName) throws AAIServiceException { + SearchResults response = null; + InputStream inputStream = null; + + try { + String request_url = targetUri+queryNodesPath; + request_url = request_url.replace("{node-type}", encodeQuery(node_type)) ; + request_url = request_url.replace("{entity-identifier}", entityIdentifier) ; + request_url = request_url.replace("{entity-name}", encodeQuery(entityName)) ; + URL http_req_url = new URL(request_url); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); + + LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); + LOGwriteDateTrace("node_type", node_type); + LOGwriteDateTrace("vnf_name", entityName); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + response = mapper.readValue(reader, SearchResults.class); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); + } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + return response; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestNodeQuery", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("Error closing Input stream", exc); + } + } + } + return response; + + } + + + @Override + public String requestDataByURL(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + String response = null; + InputStream inputStream = null; + + try { + URL http_req_url = url; + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); + + LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + StringBuilder stringBuilder = new StringBuilder("\n"); + String line = null; + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOG.info(stringBuilder.toString()); +// response = mapper.readValue(reader, String.class); + response = stringBuilder.toString(); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + response = null; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestNetworkVceData", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + LOG.warn("Error closing Input stream", exc); + } + } + } + return response; + } + + + @Override + public GenericVnf requestGenericVnfeNodeQuery(String vnf_name) throws AAIServiceException { + + if(vnf_name == null) { + throw new NullPointerException(); + } + + GenericVnf entity = null; + SearchResults resp = this.requestNodeQuery("generic-vnf", "vnf-name", vnf_name); + + List resultDataList = resp.getResultData(); + + try { + for (ResultData datum : resultDataList) { + URI url = new URI(datum.getResourceLink()); + entity = this.getResource(url.toString(), GenericVnf.class); + } + } + catch (Exception e) + { + LOG.error("Caught exception", e); + } + return entity; + } + + @Override + public Vserver requestVServerDataByURL(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + Vserver entity = null; + + try { + entity = this.getResource(url.toString(), Vserver.class); + } catch (AAIServiceException exc) { + throw exc; + } catch (Exception e) { + throw new AAIServiceException(e); + } + return entity; + } + + @Override + public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException { + + if(vserver_name == null) { + throw new NullPointerException(); + } + + URL entity = null; + SearchResults resp = this.requestNodeQuery("vserver", "vserver-name", vserver_name); + + List resultDataList = resp.getResultData(); + + try { + for (ResultData datum : resultDataList) { + String data_type = datum.getResourceType(); + String resourceLink = datum.getResourceLink(); + if(!resourceLink.isEmpty() && !resourceLink.toLowerCase().startsWith("http")) { + resourceLink = (new EchoRequest()).targetUri + resourceLink; + } + entity = new URL(resourceLink); + } + } catch (Exception e) { + throw new AAIServiceException(e); + } + return entity; + } + + @Override + public String getTenantIdFromVserverUrl(URL url) { + + String path = url.getPath(); + + String[] split = path.split("/tenants/tenant/"); + if(split.length > 1) { + split = split[1].split("/"); + return split[0]; + } else { + return null; + } + } + + @Override + public String getCloudOwnerFromVserverUrl(URL url) { + + String path = url.getPath(); + + String[] split = path.split("/cloud-regions/cloud-region/"); + if(split.length > 1) { + split = split[1].split("/"); + return split[0]; + } else { + return null; + } + } + + @Override + public String getCloudRegionFromVserverUrl(URL url) { + + String path = url.getPath(); + + String[] split = path.split("/cloud-regions/cloud-region/"); + if(split.length > 1) { + split = split[1].split("/"); + return split[1]; + } else { + return null; + } + } + + @Override + public String getVServerIdFromVserverUrl(URL url, String tenantId) { + String pattern = networkVserverPath; + pattern = pattern.replace("{tenant-id}", tenantId); + + int end = pattern.indexOf("{vserver-id}"); + String prefix = pattern.substring(0, end); + + String path = url.getPath(); + + if(path.startsWith(prefix)) { + path = path.substring(prefix.length()); + } + + return path; + } + + protected Logger getLogger(){ + return LOG; + } + + + @Override + public AAIExecutorInterfaceLighty getExecutor() { + return executor; + } + + /** + * Creates a current time stamp in UTC i.e. 2016-03-08T22:15:13.343Z. + * If there are any parameters the values are appended to the time stamp. + * + * @param parameters + * values to be appended to current time stamp + * @param ctx + * used to set an attribute for a DG + * @throws SvcLogicException + */ + public void setStatusMethod(Map parameters, SvcLogicContext ctx) throws SvcLogicException { + if (ctx == null) { + throw new SvcLogicException("SvcLogicContext is null."); + } + + StringBuilder sb = new StringBuilder(); + sb.append(String.format("%tFT% entry : parameters.entrySet()) { + sb.append(entry.getValue()).append(" "); + } + + if (sb.length() > 0) { + sb.setLength(sb.length() - 2); + } + + ctx.setAttribute("aai-summary-status-message", sb.toString()); + LOG.info("aai-summary-status-message: " + sb.toString()); + } + + /** + * Generic method to GET json data from an A&AI using key structure. + * Then convert that json to an Object. + * If successful the Object is attempted to be cast to the type parameter. + * + * @param key + * key identifying the resource to be retrieved from AAI + * @param type + * the class of object that A&AI will return + * @return the object created from json or null if the response code is not 200 + * + * @throws AAIServiceException + * if empty or null key and or type or there's an error with processing + */ + + public T getResource(String key, Class type) throws AAIServiceException { + if (StringUtils.isEmpty(key) || type == null) { + throw new AAIServiceException("Key is empty or null and or type is null"); + } + + T response = null; + + SvcLogicContext ctx = new SvcLogicContext(); + if(!key.contains(" = ")) { + if(isValidURL(key)) { + key = String.format("selflink = '%s'", key); + } else if(isValidURI(key)) { + key = String.format("resource-path = '%s'", key); + } else { + return response; + } + } + + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + + AAIRequestLighty request = new SelfLinkRequestLighty(type); + if(nameValues.containsKey(PathRequest.RESOURCE_PATH.replaceAll("-", "_"))) { + request = new PathRequestLighty(type); + } + + request.processRequestPathValues(nameValues); + Object obj = this.getExecutor().query(request, type); + response = type.cast(obj); + + return response != null ? type.cast(response) : response; + } + + public boolean isValidURL(String url) { + + URL u = null; + + try { + u = new URL(url); + } catch (MalformedURLException e) { + LOG.warn("MalformedURLException", e); + return false; + } + + try { + u.toURI(); + } catch (URISyntaxException e) { + LOG.warn("URISyntaxException", e); + return false; + } + + return true; + } + + + public boolean isValidURI(String url) { + + URI u = null; + + try { + u = new URI(url); + } catch (URISyntaxException e) { + LOG.warn("URISyntaxException", e); + return false; + } + + return true; + } + + + protected boolean deleteList(URL httpReqUrl, String json_text) throws AAIServiceException { + if(httpReqUrl == null) { + throw new NullPointerException(); + } + + boolean response = false; + InputStream inputStream = null; + + try { + HttpURLConnection con = getConfiguredConnection(httpReqUrl, HttpMethod.DELETE); + +// SSLSocketFactory sockFact = CTX.getSocketFactory(); +// con.setSSLSocketFactory( sockFact ); + if (json_text != null) { + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(json_text); + osw.flush(); + osw.close(); + } + + LOGwriteFirstTrace("DELETE", httpReqUrl.toString()); + LOGwriteDateTrace("data", json_text); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + String line = null; + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString()); + response = true; + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + response = false; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteList", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + + } + } + } + return response; + } + + public static ObjectMapper getObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); + AnnotationIntrospector secondary = new JacksonAnnotationIntrospector(); + mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary)); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + mapper.setSerializationInclusion(Include.NON_NULL); + mapper.setSerializationInclusion(Include.NON_EMPTY); + return mapper; + } + + public void logMetricRequest(String requestId, String targetServiceName, String msg, String path){ + String svcInstanceId = ""; + String svcName = null; + String partnerName = null; + String targetEntity = "A&AI"; + String targetVirtualEntity = null; + + ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg); + } + + public void logMetricResponse(String requestId, int responseCode, String responseDescription){ + ml.logResponse(responseCode < 400 ? "COMPLETE" : "ERROR", Integer.toString(responseCode), responseDescription); + } + + public void logKeyError(String keys){ + LOG.error("Atleast one of the keys [" + keys + "] should have been populated. This will cause a NPE."); + } + + + /** + * Retrofit code + */ + @Override + public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map params, String prefix, SvcLogicContext ctx) + throws SvcLogicException { + String normResource = resource.split(":")[0]; + + switch(normResource){ + case "custom-query": + case "formatted-query": + case "generic-query": + case "nodes-query": + case "linterface": + case "l2-bridge-sbg": + case "l2-bridge-bgf": + case "echo": + case "test": + break; + + default: + if(key.contains("selflink =")) { + break; + } + if(!key.contains(String.format("%s.", normResource))) { + key = rewriteKey(resource, key, ctx); + } + } + return super.save(resource, force, localOnly, key, params, prefix, ctx); + } + + @Override + public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) + throws SvcLogicException { + String normResource = resource.split(":")[0]; + + switch(normResource){ + case "custom-query": + case "formatted-query": + case "generic-query": + case "nodes-query": + case "linterface": + case "l2-bridge-sbg": + case "l2-bridge-bgf": + case "echo": + case "test": + break; + + default: + if(key.contains("selflink =")) { + break; + } + if(!key.contains(String.format("%s.", normResource))) { + key = rewriteKey(resource, key, ctx); + } + } + + return super.query(resource, localOnly, select, key, prefix, orderBy, ctx); + } + + @Override + public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { + String normResource = resource.split(":")[0]; + + switch(normResource){ + case "custom-query": + case "formatted-query": + case "generic-query": + case "nodes-query": + case "linterface": + case "l2-bridge-sbg": + case "l2-bridge-bgf": + case "echo": + case "test": + break; + + default: + if(key.contains("selflink =")) { + break; + } + if(!key.contains(String.format("%s.", normResource))) { + key = rewriteKey(resource, key, ctx); + } + } + + return super.delete(resource, key, ctx); + } + + @Override + public QueryStatus update(String resource, String key, Map params, String prefix, SvcLogicContext ctx) throws SvcLogicException { + String normResource = resource.split(":")[0]; + + switch(normResource){ + case "custom-query": + case "formatted-query": + case "generic-query": + case "nodes-query": + case "linterface": + case "l2-bridge-sbg": + case "l2-bridge-bgf": + case "echo": + case "test": + break; + + default: + if(key.contains("selflink =")) { + break; + } + if(!key.contains(String.format("%s.", normResource))) { + key = rewriteKey(resource, key, ctx); + } + } + + return super.update(resource, key, params, prefix, ctx); + } + + private String rewriteKey(String resource, String key, SvcLogicContext ctx) { + LOG.info("AAI Deprecation - the format of request key is no longer supported. Please rewrite this key : " + key); + + String normResource = resource.split(":")[0]; + Class clazz = AAIRequestLighty.getClassFromResource(normResource) ; + + if(clazz == null) + return key; + + List fieldAnnotatedNames = new LinkedList<>(); + + Field[] fields = clazz.getDeclaredFields(); + for(Field field : fields) { + String fieldName = field.getName(); + XmlElement annotation = field.getAnnotation(XmlElement.class); + if(annotation == null) + continue; + String primaryId = annotation.name(); + if("##default".equals(primaryId)) { + primaryId = fieldName; + } + fieldAnnotatedNames.add(primaryId); + } + + HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); + Set keyset = nameValues.keySet(); + for(String keyName : keyset) { + if(keyName.contains(".")) + continue; + else { + String tmpKeyName = keyName.replaceAll("_", "-"); + String valueToSubstitute = String.format("%s =", tmpKeyName); + if(fieldAnnotatedNames.contains(tmpKeyName) && key.contains(valueToSubstitute)) { + key = key.replace(valueToSubstitute, String.format("%s.%s =", normResource, tmpKeyName)); + } + } + } + + + return key; + } + + @Override + public String getPathTemplateForResource(String resoourceName, String keys, SvcLogicContext ctx) throws MalformedURLException { + return AAIServiceUtils.getPathForResource(resoourceName, StringUtils.join(keys, " AND "), ctx); + } + + @Override + public boolean isDeprecatedFormat(String resource, Map nameValues) { + return !AAIServiceUtils.isValidFormat(resource, nameValues); + } + + public AAIRequestLighty getRequestFromResource(String resoourceName) { + return AAIRequestLighty.getRequestFromResource(resoourceName); + } + + /* (non-Javadoc) + * @see org.onap.ccsdk.sli.core.sli.aai.haha#query(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty) + */ + @Override + public String query(AAIRequestLighty request) throws AAIServiceException { + return executor.get(request); + } + + /* (non-Javadoc) + * @see org.onap.ccsdk.sli.core.sli.aai.haha#save(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty) + */ + @Override + public String save(AAIRequestLighty request) throws AAIServiceException { + return executor.post(request); + } + + public boolean update(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { + return executor.patch(request, resourceVersion); + } + + /* (non-Javadoc) + * @see org.onap.ccsdk.sli.core.sli.aai.haha#delete(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty, java.lang.String) + */ + @Override + public boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { + return executor.delete(request, resourceVersion); + } + +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java new file mode 100755 index 000000000..c0e825268 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.Optional; +import java.util.Properties; +import java.util.Vector; +import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; +import org.onap.ccsdk.sli.core.utils.common.BundleContextFileResolver; +import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; +import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link AAIServiceProvider} WITH REMOVED OSGi DEPENDENCIES + */ +public class AAIServiceProviderLighty implements UtilsProvider { + + private static final Logger LOG = LoggerFactory.getLogger(AAIServiceProviderLighty.class); + + /** + * The name of the properties file for database configuration + */ + private static final String AAISEERVICE_PROP_FILE_NAME = "aaiclient.properties"; + + /** + * The name of the pwd key + */ + private static final String AAICLIENT_PROPERTY_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.psswd"; + + /** + * A prioritized list of strategies for resolving dblib properties files. + */ + private Vector dblibPropertiesFileResolvers = new Vector<>(); + + /** + * The configuration properties for the db connection. + */ + private Properties properties; + + /** + * Set up the prioritized list of strategies for resolving dblib properties files. + */ + public AAIServiceProviderLighty() { + dblibPropertiesFileResolvers.add(new SdncConfigEnvVarFileResolver( + "Using property file (1) from environment variable" + )); + dblibPropertiesFileResolvers.add(new BundleContextFileResolver( + "Using property file (3) from JRE argument", AAIServiceProviderLighty.class + )); + dblibPropertiesFileResolvers.add(new KarafRootFileResolver( + "Using property file (4) from karaf root", this + )); + dblibPropertiesFileResolvers.add(new CoreDefaultFileResolver( + "Using property file (5) from default directory" + )); + + // determines properties file as according to the priority described in the class header comment + final File propertiesFile = determinePropertiesFile(); + if (propertiesFile != null) { + try(FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { + properties = new Properties(); + properties.load(fileInputStream); + + if(properties.containsKey(AAICLIENT_PROPERTY_NAME)) { + String sensitive = properties.getProperty(AAICLIENT_PROPERTY_NAME); + if(sensitive != null && sensitive.startsWith("ENC:")) { + try { + sensitive = sensitive.substring(4); + String postsense = decrypt(sensitive); + properties.setProperty(AAICLIENT_PROPERTY_NAME, postsense); + } catch(Exception exc) { + LOG.error("Failed to translate property", exc); + } + } + } + } catch (final IOException e) { + LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), + new AAIServiceException("Failed to load properties for file: " + + propertiesFile.toString(), e)); + } + } + } + + /** + * + * @param value + * @return decrypted string if successful or the original value if unsuccessful + */ + private String decrypt(String value) { + try { + BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); + + ServiceReference sref = bctx.getServiceReference("org.opendaylight.aaa.encrypt.AAAEncryptionService"); + if(sref == null) { + LOG.warn("Could not acquire service reference for 'org.opendaylight.aaa.encrypt.AAAEncryptionService'"); + return value; + } + Object encrSvc = bctx.getService(sref); + if(encrSvc == null) { + LOG.warn("Could not access service for 'org.opendaylight.aaa.encrypt.AAAEncryptionService'"); + return value; + } + + Method gs2Method = encrSvc.getClass().getMethod("decrypt", new Class[] { "".getClass() }); + Object unmasked = gs2Method.invoke(encrSvc, new Object[] { value }); + return unmasked.toString(); + + } catch (Exception exc) { + LOG.error("Failure", exc); + return value; + } + } + + /** + * Extract db config properties. + * + * @return the db config properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Reports the method chosen for properties resolution to the Logger. + * + * @param message Some user friendly message + * @param fileOptional The file location of the chosen properties file + * @return the file location of the chosen properties file + */ + private static File reportSuccess(final String message, final Optional fileOptional) { + if(fileOptional.isPresent()) { + final File file = fileOptional.get(); + LOG.info("{} {}", message, file.getPath()); + return file; + } + return null; + } + + /** + * Reports fatal errors. This is the case in which no properties file could be found. + * + * @param message An appropriate fatal error message + * @param dblibConfigurationException An exception describing what went wrong during resolution + */ + private static void reportFailure(final String message, + final AAIServiceException dblibConfigurationException) { + + LOG.error("{}", message, dblibConfigurationException); + } + + /** + * Determines the dblib properties file to use based on the following priority: + *
    + *
  1. A directory identified by the system environment variable SDNC_CONFIG_DIR
  2. + *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. + *
  5. A directory identified by the JRE argument dblib.properties
  6. + *
  7. A dblib.properties file located in the karaf root directory
  8. + *
+ */ + File determinePropertiesFile() { + + for (final PropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) { + final Optional fileOptional = dblibPropertiesFileResolver.resolveFile(AAISEERVICE_PROP_FILE_NAME); + if (fileOptional.isPresent()) { + return reportSuccess(dblibPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); + } + } + + reportFailure("Missing configuration properties resource(3)", + new AAIServiceException("Missing configuration properties resource(3): " + + AAISEERVICE_PROP_FILE_NAME)); + return null; + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java new file mode 100755 index 000000000..fa8dce485 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryRequestData; +import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList; + +/** + * THIS CLASS IS A COPY OF {@link CustomQueryRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class CustomQueryRequestLighty extends AAIRequestLighty { + + public static final String GENERIC_SEARCH_PATH_CONST = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; + + private final String generic_search_path; + + public static final String FORMAT = "format"; + + + public CustomQueryRequestLighty() { + String tmpGenericSearchPath = configProperties.getProperty(GENERIC_SEARCH_PATH_CONST); + tmpGenericSearchPath = tmpGenericSearchPath.split("search")[0]; + generic_search_path = tmpGenericSearchPath +"query"; + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String requestUrl = targetUri+generic_search_path; + + requestUrl = processPathData(requestUrl, requestProperties); + + String formatQuery = requestProperties.getProperty(FORMAT); + + if(formatQuery != null) { + requestUrl = requestUrl +"?format="+formatQuery; + } + URL httpReqUrl = new URL(requestUrl); + + aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString()); + + return httpReqUrl; + } + + @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 jsonText = null; + try { + jsonText = mapper.writeValueAsString(tenant); + } catch (JsonProcessingException exc) { + handleException(this, exc); + return null; + } + return jsonText; + } + + + @Override + public String[] getArgsList() { + String[] args = {FORMAT}; + return args; + } + + + @Override + public Class getModelClass() { + return FormattedQueryRequestData.class; + } + + + public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException { + + String key = FORMAT; + + String encodedVnf = encodeQuery(requestProperties.getProperty(key)); + requestUrl = requestUrl.replace("{identifier}", encodedVnf) ; + aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); + + return requestUrl; + } + + public AAIDatum jsonStringToObject(String jsonData) throws 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/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java new file mode 100755 index 000000000..46e6aa7af --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.adaptors.aai.data.EchoResponse; + +/** + * THIS CLASS IS A COPY OF {@link EchoRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class EchoRequestLighty extends AAIRequestLighty { + + + + private final String echoPath; + + public EchoRequestLighty() { + echoPath = "/aai/util/echo"; + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String requestUrl = targetUri+echoPath; + + if(resourceVersion != null) { + requestUrl = requestUrl +"?resource-version="+resourceVersion; + } + URL httpReqUrl = new URL(requestUrl); + + aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString()); + + return httpReqUrl; + } + + @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 jsonText = null; + try { + jsonText = mapper.writeValueAsString(tenant); + } catch (JsonProcessingException exc) { + handleException(this, exc); + return null; + } + return jsonText; + } + + + @Override + public String[] getArgsList() { + String[] args = {}; + return args; + } + + + @Override + public Class getModelClass() { + return EchoResponse.class; + } + +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java new file mode 100755 index 000000000..65fe0e783 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; +import org.onap.aai.inventory.v16.ResultData; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link GenericQueryRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class GenericQueryRequestLighty extends AAIRequestLighty { + + public static final String GENERIC_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; + + private final String generic_search_path; + + public static final String START_NODE_TYPE = "start-node-type"; + public static final String IDENTIFIER = "identifier"; + public static final String VALUE = "value"; + + + public GenericQueryRequestLighty() { + generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH); + } + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String request_url = targetUri+generic_search_path; + + request_url = processPathData(request_url, requestProperties); + + 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(); + ResultData tenant = (ResultData)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 = {START_NODE_TYPE, IDENTIFIER, VALUE}; + return args; + } + + + @Override + public Class getModelClass() { + return ResultData.class; + } + + + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + + String key = IDENTIFIER; + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{identifier}", encoded_vnf) ; + aaiService.LOGwriteDateTrace(IDENTIFIER, requestProperties.getProperty(key)); + + key = VALUE; + + encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{value}", encoded_vnf) ; + aaiService.LOGwriteDateTrace(VALUE, requestProperties.getProperty(key)); + + key = START_NODE_TYPE; + + encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{start-node-type}", encoded_vnf) ; + aaiService.LOGwriteDateTrace(START_NODE_TYPE, requestProperties.getProperty(key)); + + return request_url; + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java new file mode 100755 index 000000000..96b1e7f19 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java @@ -0,0 +1,261 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + /** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; +import java.io.UnsupportedEncodingException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import org.onap.aai.inventory.v16.L3Network; +import org.onap.aai.inventory.v16.L3Networks; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link GenericRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class GenericRequestLighty extends AAIRequestLighty { + + + protected Class model; + + public GenericRequestLighty(Class clazz) { + model = clazz; + } + + @Override + public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String originalPath = null; + String pathSubstitute = null; + String resourceName = null; + + Annotation[] annotations = model.getAnnotations(); + for(Annotation annotation : annotations) { + Class anotationType = annotation.annotationType(); + String annotationName = anotationType.getName(); + if("javax.xml.bind.annotation.XmlRootElement".equals(annotationName)){ + XmlRootElement order = (XmlRootElement)annotation; + resourceName = order.name(); + } + } + + String request_url = getRequestPath(resourceName); + + Map queryParams = new HashMap<> (); + if(resourceVersion != null) { + queryParams.put("resource-version", resourceVersion.toString()); + } + + Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); + + String[] keys = requestProperties.keySet().toArray(new String[0]); + for(String key : keys) { + switch(key) { + case "cloud-region.cloud-region-id": + case "entitlement.resource-uuid": + case "license.resource-uuid": + case "route-target.route-target-role": + case "service-capability.vnf-type": + case "ctag-pool.availability-zone-name": + continue; + } + + String value = requestProperties.getProperty(key); + if(key.contains(".")) { + String[] splitKey = key.split("\\."); + if("cloud-region".equals(splitKey[0])){ + String cloudRegionId = requestProperties.getProperty("cloud-region.cloud-region-id"); + aaiService.LOGwriteDateTrace("cloud-region-id", cloudRegionId); + String token = String.format("%s/{%s}/{cloud-region-id}", splitKey[0], splitKey[1] ); + String encoded_owner = encodeQuery(value); + String encoded_region = encodeQuery(cloudRegionId); + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); + } else if("entitlement".equals(splitKey[0])){ + String cloudRegionId = requestProperties.getProperty("entitlement.resource-uuid"); + aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId); + String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] ); + String encoded_owner = encodeQuery(value); + String encoded_region = encodeQuery(cloudRegionId); + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); + } else if("license".equals(splitKey[0])){ + String cloudRegionId = requestProperties.getProperty("license.resource-uuid"); + aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId); + String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] ); + String encoded_owner = encodeQuery(value); + String encoded_region = encodeQuery(cloudRegionId); + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); + } else if("route-target".equals(splitKey[0])){ + String cloudRegionId = requestProperties.getProperty("route-target.route-target-role"); + aaiService.LOGwriteDateTrace("route-target-role", cloudRegionId); + String token = String.format("%s/{%s}/{route-target-role}", splitKey[0], splitKey[1] ); + String encoded_owner = encodeQuery(value); + String encoded_region = encodeQuery(cloudRegionId); + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); + } else if("service-capability".equals(splitKey[0])){ + String vnfType = requestProperties.getProperty("service-capability.vnf-type"); + aaiService.LOGwriteDateTrace("vnf-type", vnfType); + String token = String.format("%s/{%s}/{vnf-type}", splitKey[0], splitKey[1] ); + String encoded_service_type = encodeQuery(value); + String encoded_vnf_type = encodeQuery(vnfType); + if("service-capability".equals(resourceName)) { + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_service_type, encoded_vnf_type)); + } else if("service-capabilities".equals(resourceName)) { + queryParams.put("service-type", encoded_service_type); + queryParams.put("vnf-type", encoded_vnf_type); + } + } else if("ctag-pool".equals(splitKey[0])){ + String cloudRegionId = requestProperties.getProperty("ctag-pool.availability-zone-name"); + aaiService.LOGwriteDateTrace("availability-zone-name", cloudRegionId); + String token = String.format("%s/{%s}/{availability-zone-name}", splitKey[0], splitKey[1] ); + String encoded_owner = encodeQuery(value); + String encoded_region = encodeQuery(cloudRegionId); + request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); + } else { + Class clazz = getClassFromResource(splitKey[0]); + + if(clazz != null) { + if(clazz == this.model) { + Field[] fields = this.model.getDeclaredFields(); + Field field = fields[0]; + String fieldName = field.getName(); + XmlElement annotation = field.getAnnotation(XmlElement.class); + String primaryId = null; + if(annotation != null) { + primaryId = annotation.name(); + if("##default".equals(primaryId)) { + primaryId = fieldName; + } + } else { + primaryId = fieldName; + } + + String token = String.format("%s/{%s}", splitKey[0], primaryId); + + if(splitKey[1].equals(primaryId)) { + String encoded_vnf = encodeQuery(value); + request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); + } else { + queryParams.put(splitKey[1], encodeQuery(value)); + originalPath = token; + pathSubstitute = String.format("%s", splitKey[0]); + } + } else if(L3Networks.class == this.model) { + Field[] fields = L3Network.class.getDeclaredFields(); + Field field = fields[0]; + String fieldName = field.getName(); + XmlElement annotation = field.getAnnotation(XmlElement.class); + String primaryId = annotation.name(); + if("##default".equals(primaryId)) { + primaryId = fieldName; + } + + String token = String.format("%s/{%s}", splitKey[0], primaryId); + originalPath = token; + pathSubstitute = String.format(""); + + queryParams.put(splitKey[1], encodeQuery(value)); + } else { + String token = String.format("%s/{%s}", splitKey[0], splitKey[1]); + String encoded_vnf = encodeQuery(value); + request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); + } + } + + } + aaiService.LOGwriteDateTrace(splitKey[1], value); + } + } + + if(originalPath != null && pathSubstitute != null) + request_url = request_url.replace(originalPath, pathSubstitute); + + if(!queryParams.isEmpty()) { + Joiner.MapJoiner mapJoiner = Joiner.on("&").withKeyValueSeparator("="); + String queryString = mapJoiner.join(queryParams); + request_url = String.format("%s?%s", request_url, queryString); + } + + return request_url; + } + + @Override + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + return this.getRequestUrl(method, null); + } + + + @Override + public String toJSONString() { + ObjectMapper mapper = getObjectMapper(); + + String json_text = null; + try { + json_text = mapper.writeValueAsString(requestDatum); + } catch (JsonProcessingException exc) { + handleException(this, exc); + return null; + } + return json_text; + } + + @Override + public String[] getArgsList() { + String[] args = {}; + return args; + } + + @Override + public Class getModelClass() { + return model; + } + + public void processRequestPathValues(Map nameValues) { + // identify unique resources + Set uniqueResources = AAIRequest.extractUniqueResourceSetFromKeys(nameValues.keySet()); + + String[] arguments = nameValues.keySet().toArray(new String[0]); + for(String name : arguments) { + String tmpName = name.replaceAll("-", "_"); + String value = nameValues.get(tmpName); + if(value != null && !value.isEmpty()) { + value = value.trim().replace("'", "").replace("$", "").replace("'", ""); + tmpName = name.replaceAll("_", "-"); + this.addRequestProperty(tmpName, value); + } + } + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java new file mode 100755 index 000000000..ed79b261b --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; +import org.onap.aai.inventory.v16.SearchResults; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link NodesQueryRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class NodesQueryRequestLighty extends AAIRequestLighty { + + public static final String NODES_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes"; + + private final String nodes_search_path; + + public static final String NODE_TYPE = "node-type"; + public static final String ENTITY_IDENTIFIER = "entity-identifier"; + public static final String ENTITY_VALUE = "entity-value"; + + + public NodesQueryRequestLighty() { + nodes_search_path = configProperties.getProperty(NODES_SEARCH_PATH); + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String request_url = targetUri+nodes_search_path; + + request_url = processPathData(request_url, requestProperties); + + 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(); + SearchResults tenant = (SearchResults)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 = {NODE_TYPE, ENTITY_IDENTIFIER, ENTITY_VALUE}; + return args; + } + + + @Override + public Class getModelClass() { + return SearchResults.class; + } + + + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + + String key = ENTITY_IDENTIFIER; + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{entity-identifier}", encoded_vnf) ; + aaiService.LOGwriteDateTrace(ENTITY_IDENTIFIER, requestProperties.getProperty(key)); + + key = ENTITY_VALUE; + + encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{entity-name}", encoded_vnf) ; + aaiService.LOGwriteDateTrace("entity-name", requestProperties.getProperty(key)); + + key = NODE_TYPE; + + encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{node-type}", encoded_vnf) ; + aaiService.LOGwriteDateTrace(NODE_TYPE, requestProperties.getProperty(key)); + + return request_url; + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java new file mode 100755 index 000000000..47543d0b2 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java @@ -0,0 +1,92 @@ +/*- + * ============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========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link PathRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class PathRequestLighty extends AAIRequestLighty { + + private final Class classType; + + public static final String RESOURCE_PATH = "resource-path"; + + public PathRequestLighty(Class type) { + classType = (Class)type; + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String request_url = targetUri + "{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/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java new file mode 100755 index 000000000..03a22e732 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java @@ -0,0 +1,67 @@ +/*- + * ============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========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.List; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.onap.aai.inventory.v16.RelationshipList; + +/** + * THIS CLASS IS A COPY OF {@link RelationshipListRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class RelationshipListRequestLighty extends GenericRequestLighty { + + public static final String SELFLINK = "selflink"; + + public RelationshipListRequestLighty(AAIRequestLighty masterRequest) { + super(RelationshipList.class); + this.addMasterRequest(masterRequest); + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + + URL url = super.getRequestUrl(method, null); + URIBuilder builder = new URIBuilder(url.toURI()); + String newPath = builder.getPath() + "/relationship-list"; + builder.setPath(newPath); + if(resourceVersion != null) { + List queryList = builder.getQueryParams(); + NameValuePair nvp = new BasicNameValuePair("resourceVersion", resourceVersion); + queryList.add(nvp); + } + + aaiService.LOGwriteFirstTrace(method, builder.toString()); + + return builder.build().toURL(); + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java new file mode 100755 index 000000000..6e375d5a9 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.List; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.onap.aai.inventory.v16.Relationship; + +/** + * THIS CLASS IS A COPY OF {@link RelationshipRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class RelationshipRequestLighty extends GenericRequestLighty { + + public RelationshipRequestLighty(AAIRequestLighty masterRequest) { + super(Relationship.class); + this.addMasterRequest(masterRequest); + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + + + URL url = super.getRequestUrl(method, null); + URIBuilder builder = new URIBuilder(url.toURI()); + String newPath = builder.getPath() + "/relationship-list/relationship"; + builder.setPath(newPath); + if(resourceVersion != null) { + List queryList = builder.getQueryParams(); + NameValuePair nvp = new BasicNameValuePair("resourceVersion", resourceVersion); + queryList.add(nvp); + } + + aaiService.LOGwriteFirstTrace(method, builder.toString()); + + return builder.build().toURL(); + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java new file mode 100755 index 000000000..aafc993a0 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java @@ -0,0 +1,110 @@ +/*- + * ============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========================================================= + */ +/** + * @author Rich Tabedzki + * + */ +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link SelfLinkRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class SelfLinkRequestLighty extends AAIRequestLighty { + + private final Class classType; + + public static final String SELFLINK = "selflink"; + + public SelfLinkRequestLighty(Class type) { + classType = (Class)type; + } + + + @Override + public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { + + String request_url = null; + + request_url = requestProperties.getProperty(SELFLINK); + try { + URI uri = new URI(request_url); + if(uri.getHost() == null) { + request_url = targetUri + request_url; + } + } catch(Exception exc) { + LOG.error("SelfLinkRequest.getRequestUrl", exc); + } + String query = null; + + if(request_url.contains("?")) { + query = request_url.substring(request_url.indexOf("?")); + Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); +// String queryString = mapJoiner.join(query); + } else { + request_url = request_url + "?depth=1"; + } + + 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 = {SELFLINK}; + return args; + } + + @Override + public Class getModelClass() { + return classType; + } +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java new file mode 100755 index 000000000..312215410 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * The UpdateRequest class provides processing related to update transaction. + * @author richtabedzki + */ + +package org.onap.ccsdk.sli.adaptors.aai; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.stream.Collectors; +import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; + +/** + * THIS CLASS IS A COPY OF {@link UpdateRequest} WITH REMOVED OSGi DEPENDENCIES + */ +public class UpdateRequestLighty extends AAIRequestLighty { + + private AAIRequestLighty request; + private Map params; + + public UpdateRequestLighty(AAIRequestLighty request, Map parms) { + this.request = request; + this.params = parms; + } + + @Override + public URL getRequestUrl(String method, String resourceVersion) + throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + return request.getRequestUrl(method, resourceVersion); + } + + @Override + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + return request.getRequestQueryUrl(method); + } + + @Override + public String toJSONString() { + updateArrayEntries(params); + 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; + } + + /** + * + * Update array entries. + * The method converts indexed data entries to an array of values + * + * @param data Map containing String:String values representing input data + */ + private void updateArrayEntries( Map data) { + Set set = data.keySet() + .stream() + .filter(s -> s.endsWith("_length")) + .collect(Collectors.toSet()); + + for(String lenghtKey : set) { + String key = lenghtKey.replace("_length", ""); +// String index = data.get(lenghtKey); + List array = new ArrayList<>(); + + Set subset = data.keySet() + .stream() + .filter(s -> s.startsWith(String.format("%s[",key))) + .collect(Collectors.toSet()); + for(String subKey : subset) { + String subValue = data.get(subKey); + array.add(subValue); + LOG.trace("{} : {} ", subKey, subValue); + } + data.put(key, array.toString()); + data.remove(lenghtKey); + for(String subKey : subset) { + data.remove(subKey); + } + } + } + + @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 requestUrl, Properties requestProperties) { + +// 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 requestUrl; + } + + public void processRequestPathValues(Map nameValues) { + request.processRequestPathValues(nameValues); + } + +} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java new file mode 100644 index 000000000..d3ae452a0 --- /dev/null +++ b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java @@ -0,0 +1,55 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.aai.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.aai.AAIClientLighty; +import org.onap.ccsdk.sli.adaptors.aai.AAIServiceLighty; +import org.onap.ccsdk.sli.adaptors.aai.AAIServiceProviderLighty; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the aai-service-provider artifact. + */ +public class AaaServiceModule extends AbstractLightyModule { + + private AAIServiceProviderLighty aaiServiceProvider; + private AAIServiceLighty aaiService; + + @Override + protected boolean initProcedure() { + this.aaiServiceProvider = new AAIServiceProviderLighty(); + this.aaiService = new AAIServiceLighty(aaiServiceProvider); + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public AAIServiceLighty getAAIClient() { + return aaiService; + } + + // FIXME original blueprint is exposing AAIClient interface but it contains dependencies on AAIRequest which + // contains dependencies on OSGi - rewrite this AAIRequest into interface or remove the OSGi dependency + public AAIClientLighty getAAIService() { + return aaiService; + } + +} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 8fe15434d..6ce9992fd 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -21,5 +21,6 @@ provider features installer + lighty diff --git a/ansible-adapter/ansible-adapter-lighty/pom.xml b/ansible-adapter/ansible-adapter-lighty/pom.xml new file mode 100755 index 000000000..25603e446 --- /dev/null +++ b/ansible-adapter/ansible-adapter-lighty/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ansible-adapter-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + ansible-adapter-bundle + ${project.version} + compile + + + diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java new file mode 100755 index 000000000..9690cd61e --- /dev/null +++ b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java @@ -0,0 +1,176 @@ +/*- + * ============LICENSE_START======================================================= + * onap + * ================================================================================ + * Copyright (C) 2016 - 2017 ONAP + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.adaptors.ansible.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; +import java.util.Properties; +import java.util.Vector; +import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapterPropertiesProvider; +import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; +import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; +import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link AnsibleAdapterPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES + */ +public class AnsibleAdapterPropertiesProviderImplLighty implements AnsibleAdapterPropertiesProvider { + + private static final Logger LOG = LoggerFactory.getLogger(AnsibleAdapterPropertiesProviderImplLighty.class); + + /** + * The name of the properties file for database configuration + */ + private static final String ANSIBLEADAPTER_PROP_FILE_NAME = "ansible-adapter.properties"; + + /** + * A prioritized list of strategies for resolving sql-resource properties files. + */ + private Vector ansibleAdapterPropertiesFileResolvers = new Vector<>(); + + /** + * The configuration properties for the db connection. + */ + private Properties properties; + + /** + * Set up the prioritized list of strategies for resolving dblib properties + * files. + */ + public AnsibleAdapterPropertiesProviderImplLighty() { + ansibleAdapterPropertiesFileResolvers + .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); + ansibleAdapterPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); + + ansibleAdapterPropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); + + // determines properties file as according to the priority described in the + // class header comment + final File propertiesFile = determinePropertiesFile(this); + if (propertiesFile != null) { + try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { + properties = new Properties(); + properties.load(fileInputStream); + } catch (final IOException e) { + LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), + new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), + e)); + } + } else { + // Try to read properties as resource + + InputStream propStr = getClass().getResourceAsStream("/" + ANSIBLEADAPTER_PROP_FILE_NAME); + if (propStr != null) { + properties = new Properties(); + try { + properties.load(propStr); + propStr.close(); + } catch (IOException e) { + properties = null; + } + } + + } + + if (properties == null) { + reportFailure("Missing configuration properties resource(3)", new ConfigurationException( + "Missing configuration properties resource(3): " + ANSIBLEADAPTER_PROP_FILE_NAME)); + + LOG.info("Defaulting org.onap.appc.adapter.ansible.clientType to TRUST_ALL"); + + properties = new Properties(); + properties.setProperty("org.onap.appc.adapter.ansible.clientType", "TRUST_ALL"); + } + } + + /** + * Extract svclogic config properties. + * + * @return the svclogic config properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Reports the method chosen for properties resolution to the + * Logger. + * + * @param message + * Some user friendly message + * @param fileOptional + * The file location of the chosen properties file + * @return the file location of the chosen properties file + */ + private static File reportSuccess(final String message, final Optional fileOptional) { + if (fileOptional.isPresent()) { + final File file = fileOptional.get(); + LOG.info("{} {}", message, file.getPath()); + return file; + } + return null; + } + + /** + * Reports fatal errors. This is the case in which no properties file could be + * found. + * + * @param message + * An appropriate fatal error message + * @param configurationException + * An exception describing what went wrong during resolution + */ + private static void reportFailure(final String message, final ConfigurationException configurationException) { + + LOG.error("{}", message, configurationException); + } + + /** + * Determines the sql-resource properties file to use based on the following priority: + *
    + *
  1. A directory identified by the system environment variable + * SDNC_CONFIG_DIR
  2. + *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. + *
  5. A directory identified by the JRE argument + * sql-resource.properties
  6. + *
  7. A sql-resource.properties file located in the karaf root + * directory
  8. + *
+ */ + File determinePropertiesFile(final AnsibleAdapterPropertiesProviderImplLighty resourceProvider) { + + for (final PropertiesFileResolver sliPropertiesFileResolver : ansibleAdapterPropertiesFileResolvers) { + final Optional fileOptional = sliPropertiesFileResolver.resolveFile(ANSIBLEADAPTER_PROP_FILE_NAME); + if (fileOptional.isPresent()) { + return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); + } + } + + return null; + } +} diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java new file mode 100644 index 000000000..ae49542b4 --- /dev/null +++ b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.ansible.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter; +import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterImpl; +import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterPropertiesProviderImplLighty; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the ansible-adaptor artifact. + */ +public class AnsibleAdapterModule extends AbstractLightyModule { + + private AnsibleAdapterPropertiesProviderImplLighty ansibleProviderImpl; + private AnsibleAdapterImpl ansibleAdapterImpl; + + @Override + protected boolean initProcedure() { + this.ansibleProviderImpl = new AnsibleAdapterPropertiesProviderImplLighty(); + this.ansibleAdapterImpl = new AnsibleAdapterImpl(ansibleProviderImpl); + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public AnsibleAdapterPropertiesProviderImplLighty getAnsibleAdapterPropertiesProviderImpl() { + return this.ansibleProviderImpl; + } + + public AnsibleAdapter getAnsibleAdapterImpl() { + return ansibleAdapterImpl; + } +} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index d09afdd97..4cf85e3d7 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -185,5 +185,6 @@ ansible-adapter-bundle ansible-adapter-features ansible-adapter-installer + ansible-adapter-lighty diff --git a/ccsdk-adaptors-lighty/pom.xml b/ccsdk-adaptors-lighty/pom.xml new file mode 100755 index 000000000..161375ee6 --- /dev/null +++ b/ccsdk-adaptors-lighty/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-adaptors-lighty + 0.6.0-SNAPSHOT + jar + + + + org.onap.ccsdk.sli.core + ccsdk-core-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + aai-service-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + ansible-adapter-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + mdsal-resource-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + netbox-client-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + resource-assignment-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + saltstack-adapter-lighty + ${project.version} + + + org.onap.ccsdk.sli.adaptors + sql-resource-lighty + ${project.version} + + + diff --git a/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java b/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java new file mode 100644 index 000000000..102c01c7f --- /dev/null +++ b/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java @@ -0,0 +1,175 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.aai.lighty.AaaServiceModule; +import org.onap.ccsdk.sli.adaptors.ansible.lighty.AnsibleAdapterModule; +import org.onap.ccsdk.sli.adaptors.netbox.lighty.NetboxClientModule; +import org.onap.ccsdk.sli.adaptors.resource.lighty.ResourceModule; +import org.onap.ccsdk.sli.adaptors.resource.mdsal.lighty.MdsalResourceModule; +import org.onap.ccsdk.sli.adaptors.resource.sql.lighty.SqlModule; +import org.onap.ccsdk.sli.adaptors.saltstack.lighty.SaltstackAdapterModule; +import org.onap.ccsdk.sli.core.dblib.DbLibService; +import org.onap.ccsdk.sli.core.lighty.common.CcsdkLightyUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that groups all other LightyModules + * from the ccsdk-sli-adaptors repository so they can be all treated as one component (for example started/stopped + * at once). + * For more information about the lighty.io visit the website https://lighty.io. + */ +public class CcsdkAdaptorsLightyModule extends AbstractLightyModule { + + private static final Logger LOG = LoggerFactory.getLogger(CcsdkAdaptorsLightyModule.class); + + private DbLibService dbLibService; + + private AaaServiceModule aaaServiceModule; + private AnsibleAdapterModule ansibleAdapterModule; + private MdsalResourceModule mdsalResourceModule; + private NetboxClientModule netboxClientModule; + private ResourceModule resourceModule; + private SaltstackAdapterModule saltstackAdapterModule; + private SqlModule sqlModule; + + public CcsdkAdaptorsLightyModule(DbLibService dbLibService) { + this.dbLibService = dbLibService; + } + + @Override + protected boolean initProcedure() { + LOG.debug("Initializing CCSDK Adaptors Lighty module..."); + + this.aaaServiceModule = new AaaServiceModule(); + if (!CcsdkLightyUtils.startLightyModule(aaaServiceModule)) { + LOG.error("Unable to start AaaServiceModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.ansibleAdapterModule = new AnsibleAdapterModule(); + if (!CcsdkLightyUtils.startLightyModule(ansibleAdapterModule)) { + LOG.error("Unable to start AnsibleAdapterModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.mdsalResourceModule = new MdsalResourceModule(); + if (!CcsdkLightyUtils.startLightyModule(mdsalResourceModule)) { + LOG.error("Unable to start MdsalResourceModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.netboxClientModule = new NetboxClientModule(dbLibService); + if (!CcsdkLightyUtils.startLightyModule(netboxClientModule)) { + LOG.error("Unable to start NetboxClientModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.resourceModule = new ResourceModule(dbLibService); + if (!CcsdkLightyUtils.startLightyModule(resourceModule)) { + LOG.error("Unable to start ResourceModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.saltstackAdapterModule = new SaltstackAdapterModule(); + if (!CcsdkLightyUtils.startLightyModule(saltstackAdapterModule)) { + LOG.error("Unable to start SaltstackAdapterModule in CCSDK Adaptors Lighty module!"); + return false; + } + + this.sqlModule = new SqlModule(dbLibService); + if (!CcsdkLightyUtils.startLightyModule(sqlModule)) { + LOG.error("Unable to start SqlModule in CCSDK Adaptors Lighty module!"); + return false; + } + + LOG.debug("CCSDK Adaptors Lighty module was initialized successfully"); + return true; + } + + @Override + protected boolean stopProcedure() { + LOG.debug("Stopping CCSDK Adaptors Lighty module..."); + + boolean stopSuccessful = true; + + if (!CcsdkLightyUtils.stopLightyModule(sqlModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(saltstackAdapterModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(resourceModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(netboxClientModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(mdsalResourceModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(ansibleAdapterModule)) { + stopSuccessful = false; + } + + if (!CcsdkLightyUtils.stopLightyModule(aaaServiceModule)) { + stopSuccessful = false; + } + + if (stopSuccessful) { + LOG.debug("CCSDK Adaptors Lighty module was stopped successfully"); + } else { + LOG.error("CCSDK Adaptors Lighty module was not stopped successfully!"); + } + return stopSuccessful; + } + + public AaaServiceModule getAaaServiceModule() { + return aaaServiceModule; + } + + public AnsibleAdapterModule getAnsibleAdapterModule() { + return ansibleAdapterModule; + } + + public MdsalResourceModule getMdsalResourceModule() { + return mdsalResourceModule; + } + + public NetboxClientModule getNetboxClientModule() { + return netboxClientModule; + } + + public ResourceModule getResourceModule() { + return resourceModule; + } + + public SaltstackAdapterModule getSaltstackAdapterModule() { + return saltstackAdapterModule; + } + + public SqlModule getSqlModule() { + return sqlModule; + } +} diff --git a/mdsal-resource/lighty/pom.xml b/mdsal-resource/lighty/pom.xml new file mode 100755 index 000000000..08f0a5696 --- /dev/null +++ b/mdsal-resource/lighty/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + mdsal-resource-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + mdsal-resource-provider + ${project.version} + + + diff --git a/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java b/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java new file mode 100644 index 000000000..44faa8761 --- /dev/null +++ b/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.resource.mdsal.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource; +import org.onap.ccsdk.sli.adaptors.resource.mdsal.MdsalResourcePropertiesProviderImpl; +import org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the mdsal-resource-provider artifact. + */ +public class MdsalResourceModule extends AbstractLightyModule { + + private MdsalResourcePropertiesProviderImpl mdsalResourcePropertiesProvider; + private ConfigResource configResource; + private OperationalResource operationalResource; + + @Override + protected boolean initProcedure() { + this.mdsalResourcePropertiesProvider = new MdsalResourcePropertiesProviderImpl(); + this.configResource = new ConfigResource(mdsalResourcePropertiesProvider); + this.operationalResource = new OperationalResource(mdsalResourcePropertiesProvider); + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public MdsalResourcePropertiesProviderImpl getMdsalResourcePropertiesProviderImpl() { + return this.mdsalResourcePropertiesProvider; + } + + public ConfigResource getConfigResource() { + return configResource; + } + + public OperationalResource getOperationalResource() { + return this.operationalResource; + } +} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 364850f79..468ec98b7 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -21,6 +21,7 @@ provider features installer + lighty diff --git a/netbox-client/lighty/pom.xml b/netbox-client/lighty/pom.xml new file mode 100755 index 000000000..18db29466 --- /dev/null +++ b/netbox-client/lighty/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + netbox-client-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + netbox-client-provider + ${project.version} + + + diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java new file mode 100644 index 000000000..2658c06cc --- /dev/null +++ b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java @@ -0,0 +1,216 @@ +/* + * Copyright (C) 2018 Bell Canada. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.ccsdk.sli.adaptors.netbox.impl; + +import com.google.common.collect.Lists; +import com.google.gson.JsonSyntaxException; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Map; +import javax.sql.rowset.CachedRowSet; +import org.apache.http.HttpResponse; +import org.apache.http.util.EntityUtils; +import org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient; +import org.onap.ccsdk.sli.adaptors.netbox.model.IPAddress; +import org.onap.ccsdk.sli.adaptors.netbox.model.IPStatus; +import org.onap.ccsdk.sli.core.dblib.DbLibService; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; +import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link NetboxClientImpl} WITH REMOVED OSGi DEPENDENCIES + */ +public class NetboxClientImplLighty implements NetboxClient { + + private static final Logger LOG = LoggerFactory.getLogger(NetboxClientImplLighty.class); + + // Netbox URI + + private static final String NEXT_AVAILABLE_IP_IN_PREFIX_PATH = "/api/ipam/prefixes/%s/available-ips/"; + private static final String IP_ADDRESS_PATH = "/api/ipam/ip-addresses/%s/"; + + // Netbox Payload + + private static final String ASSIGN_IP_ADDRESS_PAYLOAD = "{\n" + + " \"custom_fields\": {\n" + + " \"external-key\": \"%s\",\n" + + " \"resource-name\": \"%s\"\n" + + " }\n" + + "}"; + + // Service Logic Context input variables and exception + + private static final String SERVICE_INSTANCE_ID_PROP = "service_instance_id"; + private static final String VF_MODULE_ID_PROP = "vf_module_id"; + private static final String EXTERNAL_KEY_PROP = "external_key"; + private static final String SQL_EXCEPTION_MESSAGE = "Caught SQL exception"; + + // SQL statement + + private static final String ASSIGN_IP_SQL_STATEMENT = + "INSERT INTO IPAM_IP_ASSIGNEMENT (service_instance_id, vf_module_id, prefix_id, ip_address_id, ip_address, ip_status, ip_response_json, external_key, ip_address_type) \n" + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; + private static final String UNASSIGN_IP_SQL_STATEMENT = + "UPDATE IPAM_IP_ASSIGNEMENT SET ip_status = ? WHERE service_instance_id = ? AND external_key = ?"; + private static final String GET_IP_ADDRESS_ID_SQL_STATEMENT = + "SELECT ip_address_id FROM IPAM_IP_ASSIGNEMENT WHERE service_instance_id = ? AND external_key = ?"; + + private final NetboxHttpClientLighty client; + private final DbLibService dbLibService; + + public NetboxClientImplLighty(final NetboxHttpClientLighty client, final DbLibService dbLibService) { + this.client = client; + this.dbLibService = dbLibService; + } + + @Override + public QueryStatus assignIpAddress(final Map parameters, final SvcLogicContext ctx) { + + try { + SliPluginUtils + .checkParameters(parameters, + new String[]{SERVICE_INSTANCE_ID_PROP, VF_MODULE_ID_PROP, "prefix_id", "resource_name", + EXTERNAL_KEY_PROP}, LOG); + } catch (SvcLogicException e) { + return QueryStatus.FAILURE; + } + + final String serviceInstanceId = parameters.get(SERVICE_INSTANCE_ID_PROP); + final String vfModuleId = parameters.get(VF_MODULE_ID_PROP); + final String prefixId = parameters.get("prefix_id"); + final String resourceName = parameters.get("resource_name"); + final String externalKey = parameters.get(EXTERNAL_KEY_PROP); + + HttpResponse httpResp; + try { + httpResp = client + .post(String.format(NEXT_AVAILABLE_IP_IN_PREFIX_PATH, prefixId), + String.format(ASSIGN_IP_ADDRESS_PAYLOAD, externalKey, resourceName)); + } catch (IOException e) { + LOG.error("Fail to assign IP for Prefix(id={}). {}", prefixId, e.getMessage(), e.getCause()); + return QueryStatus.FAILURE; + } + + String ipamRespJson; + try { + ipamRespJson = EntityUtils.toString(httpResp.getEntity(), "UTF-8"); + } catch (IOException e) { + LOG.error("Fail to parse IPAM response for assign in Prefix(id={}). Response={}", prefixId, + httpResp.getEntity(), e); + return QueryStatus.FAILURE; + } + + if (httpResp.getStatusLine().getStatusCode() != 201) { + LOG.error("Fail to assign IP for Prefix(id={}). HTTP code 201!={}. Response={}", prefixId, + httpResp.getStatusLine().getStatusCode(), ipamRespJson); + return QueryStatus.FAILURE; + } + + IPAddress ipAddress; + try { + ipAddress = IPAddress.fromJson(ipamRespJson); + } catch (JsonSyntaxException e) { + LOG.error("Fail to parse IPAM JSON reponse to IPAddress POJO. IPAM JSON Response={}", ipamRespJson, e); + return QueryStatus.FAILURE; + } + + ArrayList args = Lists.newArrayList( + serviceInstanceId, + vfModuleId, + String.valueOf(prefixId), + String.valueOf(ipAddress.getId()), + ipAddress.getAddress(), + IPStatus.ASSIGNED.name(), + ipamRespJson, + externalKey, + resourceName); + + try { + dbLibService.writeData(ASSIGN_IP_SQL_STATEMENT, args, null); + } catch (SQLException e) { + LOG.error(SQL_EXCEPTION_MESSAGE, e); + return QueryStatus.FAILURE; + } + + ctx.setAttribute("self_serve_netbox_ip_assignement.ip-address", ipAddress.getAddress()); + + return QueryStatus.SUCCESS; + } + + @Override + public QueryStatus unassignIpAddress(final Map parameters, final SvcLogicContext ctx) { + try { + SliPluginUtils + .checkParameters(parameters, new String[]{SERVICE_INSTANCE_ID_PROP, EXTERNAL_KEY_PROP}, + LOG); + } catch (SvcLogicException e) { + return QueryStatus.FAILURE; + } + + final String serviceInstanceId = parameters.get(SERVICE_INSTANCE_ID_PROP); + final String externalKey = parameters.get(EXTERNAL_KEY_PROP); + + String ipAddressId; + ArrayList args = Lists.newArrayList( + serviceInstanceId, + externalKey); + try (CachedRowSet row = dbLibService.getData(GET_IP_ADDRESS_ID_SQL_STATEMENT, args, null)) { + if (row.next()) { + ipAddressId = row.getString("ip_address_id"); + } else { + throw new SQLException("Data not found."); + } + } catch (SQLException e) { + LOG.error(SQL_EXCEPTION_MESSAGE, e); + return QueryStatus.FAILURE; + } + + HttpResponse httpResp; + try { + httpResp = client.delete(String.format(IP_ADDRESS_PATH, ipAddressId)); + } catch (IOException e) { + LOG.error("Fail to unassign IP for IPAddress(id= " + ipAddressId + "). " + e.getMessage(), + e.getCause()); + return QueryStatus.FAILURE; + } + + if (httpResp.getStatusLine().getStatusCode() - 200 >= 100) { + LOG.error("Fail to unassign IP for IPAddress(id={}). HTTP code={}.", ipAddressId, + httpResp.getStatusLine().getStatusCode()); + return QueryStatus.FAILURE; + } + + args.clear(); + args = Lists.newArrayList( + IPStatus.DELETED.name(), + serviceInstanceId, + externalKey); + + try { + dbLibService.writeData(UNASSIGN_IP_SQL_STATEMENT, args, null); + } catch (SQLException e) { + LOG.error(SQL_EXCEPTION_MESSAGE, e); + return QueryStatus.FAILURE; + } + + return QueryStatus.SUCCESS; + } +} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java new file mode 100644 index 000000000..388486c4f --- /dev/null +++ b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2018 Bell Canada. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.ccsdk.sli.adaptors.netbox.impl; + +import static org.apache.http.HttpHeaders.ACCEPT; +import static org.apache.http.HttpHeaders.AUTHORIZATION; +import static org.apache.http.HttpHeaders.CONTENT_TYPE; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import javax.net.ssl.SSLContext; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.ssl.TrustStrategy; +import org.onap.ccsdk.sli.adaptors.netbox.property.NetboxPropertiesLighty; + +/** + * THIS CLASS IS A COPY OF {@link NetboxHttpClient} WITH REMOVED OSGi DEPENDENCIES + */ +public class NetboxHttpClientLighty implements AutoCloseable { + + private static final String APPLICATION_JSON = "application/json"; + + private final CloseableHttpClient client; + private final String url; + private final String token; + + // Used by the blueprint container + public NetboxHttpClientLighty(NetboxPropertiesLighty properties) { + this(properties.getHost(), properties.getApiKey()); + } + + NetboxHttpClientLighty(final String url, final String token) { + this.url = url; + this.token = token; + + final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true; + final SSLContext sslContext; + try { + sslContext = SSLContexts.custom() + .loadTrustMaterial(null, acceptingTrustStrategy).build(); + } catch (final NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { + throw new IllegalStateException("Can't create http client", e); + } + client = HttpClientBuilder.create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setSSLContext(sslContext) + .build(); + } + + @Override + public void close() throws IOException { + client.close(); + } + + HttpResponse post(final String uri, final String requestBody) throws IOException { + final HttpPost request = new HttpPost(url + uri); + setHeaders(request); + request.setEntity(new StringEntity(requestBody, Charset.forName("UTF-8"))); + return client.execute(request); + } + + HttpResponse delete(final String uri) throws IOException { + final HttpDelete request = new HttpDelete(url + uri); + setHeaders(request); + return client.execute(request); + } + + private void setHeaders(final HttpRequestBase request) { + request.addHeader(ACCEPT, APPLICATION_JSON); + request.addHeader(CONTENT_TYPE, APPLICATION_JSON); + request.addHeader(AUTHORIZATION, "Token " + token); + } +} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java new file mode 100644 index 000000000..13f7963bb --- /dev/null +++ b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java @@ -0,0 +1,70 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.netbox.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import java.io.IOException; +import org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient; +import org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxClientImplLighty; +import org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxHttpClientLighty; +import org.onap.ccsdk.sli.adaptors.netbox.property.NetboxPropertiesLighty; +import org.onap.ccsdk.sli.core.dblib.DbLibService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the netbox-client-provider artifact. + */ +public class NetboxClientModule extends AbstractLightyModule { + + private static final Logger LOG = LoggerFactory.getLogger(NetboxClientModule.class); + + private final DbLibService dbLibService; + + private NetboxPropertiesLighty netboxProperties; + private NetboxHttpClientLighty netboxHttpClient; + private NetboxClientImplLighty netboxClient; + + public NetboxClientModule(DbLibService dbLibService) { + this.dbLibService = dbLibService; + } + + @Override + protected boolean initProcedure() { + this.netboxProperties = new NetboxPropertiesLighty(); + this.netboxHttpClient = new NetboxHttpClientLighty(netboxProperties); + this.netboxClient = new NetboxClientImplLighty(netboxHttpClient, dbLibService); + return true; + } + + @Override + protected boolean stopProcedure() { + try { + netboxHttpClient.close(); + } catch (IOException e) { + LOG.error("Exception thrown while closing {}!", netboxHttpClient.getClass(), e); + return false; + } + return true; + } + + public NetboxClient getNetboxClient() { + return netboxClient; + } + +} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java new file mode 100644 index 000000000..15759c721 --- /dev/null +++ b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2018 Bell Canada. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.ccsdk.sli.adaptors.netbox.property; + +import java.io.FileInputStream; +import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link NetboxProperties} WITH REMOVED OSGi DEPENDENCIES + */ +public class NetboxPropertiesLighty { + + private static final Logger LOG = LoggerFactory.getLogger(NetboxPropertiesLighty.class); + + private static final String NETBOX_PROPERTY_FILE_NAME = "netbox.properties"; + private static final String DEFAULT_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties"; + private static final String PROPERTIES_DIR_KEY = "SDNC_CONFIG_DIR"; + + private static final String NETBOX_URL_PROP = "org.onap.ccsdk.sli.adaptors.netbox.url"; + private static final String NETBOX_API_KEY_PROP = "org.onap.ccsdk.sli.adaptors.netbox.apikey"; + + private Properties properties; + + public NetboxPropertiesLighty() { + loadProps(); + } + + public String getHost() { + return properties.getProperty(NETBOX_URL_PROP); + } + + public String getApiKey() { + return properties.getProperty(NETBOX_API_KEY_PROP); + } + + private void loadProps() { + properties = new Properties(); + // Try to load config from dir + final String ccsdkConfigDir = + System.getProperty(PROPERTIES_DIR_KEY, DEFAULT_PROPERTIES_DIR) + "/" + NETBOX_PROPERTY_FILE_NAME; + LOG.info("Loading properties from file {}", ccsdkConfigDir); + try (FileInputStream in = new FileInputStream(ccsdkConfigDir)) { + properties.load(in); + LOG.info("Loaded {} properties from file {}", properties.size(), ccsdkConfigDir); + } catch (Exception e) { + LOG.error("Failed to load properties for file: {} " + NETBOX_PROPERTY_FILE_NAME, e); + } + } +} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index c1b4e3e71..d772ca82c 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -36,5 +36,6 @@ provider features installer + lighty diff --git a/pom.xml b/pom.xml index d3af7131d..15e483b33 100755 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ aai-service ansible-adapter saltstack-adapter - netbox-client + netbox-client mdsal-resource resource-assignment sql-resource @@ -107,6 +107,7 @@ message-router features artifacts + ccsdk-adaptors-lighty ONAP diff --git a/resource-assignment/lighty/pom.xml b/resource-assignment/lighty/pom.xml new file mode 100755 index 000000000..6807c2257 --- /dev/null +++ b/resource-assignment/lighty/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + resource-assignment-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + resource-assignment-provider + ${project.version} + + + org.onap.ccsdk.sli.core + dblib-provider + ${project.version} + + + org.onap.ccsdk.sli.core + sli-provider + ${project.version} + provided + + + diff --git a/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java b/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java new file mode 100644 index 000000000..b90905995 --- /dev/null +++ b/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java @@ -0,0 +1,152 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.resource.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import java.util.Collections; +import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl; +import org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl; +import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; +import org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode; +import org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule; +import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl; +import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl; +import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl; +import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl; +import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl; +import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl; +import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl; +import org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap; +import org.onap.ccsdk.sli.adaptors.util.db.DataSourceWrap; +import org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil; +import org.onap.ccsdk.sli.core.dblib.DbLibService; +import org.springframework.jdbc.core.JdbcTemplate; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the resource-assignment-provider artifact. + */ +public class ResourceModule extends AbstractLightyModule { + + private final DbLibService dbLibService; + + private DataSourceWrap dataSourceWrap; + private CachedDataSourceWrap cachedDataSourceWrap; + private JdbcTemplate rmJdbcTemplate; + private JdbcTemplate lockJdbcTemplate; + private ResourceLockDaoImpl resourceLockDao; + private LockHelperImpl lockHelper; + private ResourceJdbcDaoImpl resourceJdbcDao; + private AllocationItemJdbcDaoImpl allocationItemJdbcDao; + private ResourceLoadJdbcDaoImpl resourceLoadJdbcDao; + private ResourceDaoImpl resourceDao; + private ResourceManagerImpl resourceManager; + private ResourceRuleDaoImpl resourceRuleDao; + private RangeRuleDaoImpl rangeRuleDao; + private ResourceAllocator resourceAllocator; + private ResourceLockNode resourceLockNode; + private SpeedUtil speedUtil; + private EndPointAllocatorImpl endPointAllocator; + private DbAllocationRule dbAllocationRule; + + public ResourceModule(final DbLibService dbLibService) { + this.dbLibService = dbLibService; + } + + @Override + protected boolean initProcedure() { + this.dataSourceWrap = new DataSourceWrap(); + this.dataSourceWrap.setDataSource(dbLibService); + + this.cachedDataSourceWrap = new CachedDataSourceWrap(); + this.cachedDataSourceWrap.setDataSource(dataSourceWrap); + + this.rmJdbcTemplate = new JdbcTemplate(); + this.rmJdbcTemplate.setDataSource(dataSourceWrap); + + this.lockJdbcTemplate = new JdbcTemplate(); + this.lockJdbcTemplate.setDataSource(cachedDataSourceWrap); + + this.resourceLockDao = new ResourceLockDaoImpl(); + this.resourceLockDao.setJdbcTemplate(lockJdbcTemplate); + + this.lockHelper = new LockHelperImpl(); + this.lockHelper.setResourceLockDao(resourceLockDao); + this.lockHelper.setRetryCount(10); + this.lockHelper.setLockWait(5); + + this.resourceJdbcDao = new ResourceJdbcDaoImpl(); + this.resourceJdbcDao.setJdbcTemplate(rmJdbcTemplate); + + this.allocationItemJdbcDao = new AllocationItemJdbcDaoImpl(); + this.allocationItemJdbcDao.setJdbcTemplate(rmJdbcTemplate); + + this.resourceLoadJdbcDao = new ResourceLoadJdbcDaoImpl(); + this.resourceLoadJdbcDao.setJdbcTemplate(rmJdbcTemplate); + + this.resourceDao = new ResourceDaoImpl(); + this.resourceDao.setResourceJdbcDao(resourceJdbcDao); + this.resourceDao.setAllocationItemJdbcDao(allocationItemJdbcDao); + this.resourceDao.setResourceLoadJdbcDao(resourceLoadJdbcDao); + + this.resourceManager = new ResourceManagerImpl(); + this.resourceManager.setLockHelper(lockHelper); + this.resourceManager.setResourceDao(resourceDao); + this.resourceManager.setLockTimeout(600); + + this.resourceRuleDao = new ResourceRuleDaoImpl(); + this.resourceRuleDao.setJdbcTemplate(rmJdbcTemplate); + + this.rangeRuleDao = new RangeRuleDaoImpl(); + this.rangeRuleDao.setJdbcTemplate(rmJdbcTemplate); + + this.resourceLockNode = new ResourceLockNode(); + this.resourceLockNode.setLockHelper(lockHelper); + + this.speedUtil = new SpeedUtil(); + + this.dbAllocationRule = new DbAllocationRule(); + this.dbAllocationRule.setResourceRuleDao(resourceRuleDao); + this.dbAllocationRule.setRangeRuleDao(rangeRuleDao); + + this.endPointAllocator = new EndPointAllocatorImpl(); + this.endPointAllocator.setResourceManager(resourceManager); + this.endPointAllocator.setAllocationRuleMap( + Collections.singletonMap("DEFAULT", Collections.singletonList(dbAllocationRule))); + + this.resourceAllocator = new ResourceAllocator(); + this.resourceAllocator.setResourceManager(resourceManager); + this.resourceAllocator.setEndPointAllocator(endPointAllocator); + this.resourceAllocator.setSpeedUtil(speedUtil); + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public ResourceAllocator getResourceAllocator() { + return resourceAllocator; + } + + public ResourceLockNode getResourceLockNode() { + return resourceLockNode; + } + +} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index b17b31aa6..4aa99ad7c 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -21,6 +21,7 @@ provider features installer + lighty diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 1d618319f..0700b270c 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -193,5 +193,6 @@ saltstack-adapter-provider saltstack-adapter-features saltstack-adapter-installer + saltstack-adapter-lighty diff --git a/saltstack-adapter/saltstack-adapter-lighty/pom.xml b/saltstack-adapter/saltstack-adapter-lighty/pom.xml new file mode 100755 index 000000000..54eea24ce --- /dev/null +++ b/saltstack-adapter/saltstack-adapter-lighty/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + saltstack-adapter-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + saltstack-adapter-provider + ${project.version} + + + org.onap.ccsdk.sli.adaptors + saltstack-adapter-provider + ${project.version} + compile + + + diff --git a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java new file mode 100755 index 000000000..0ea5a589d --- /dev/null +++ b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK + * ================================================================================ + * Copyright (C) 2018 Samsung Electronics. All rights reserved. + * ================================================================================ + * + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.adaptors.saltstack.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; +import java.util.Properties; +import java.util.Vector; +import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapterPropertiesProvider; +import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; +import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; +import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * THIS CLASS IS A COPY OF {@link SaltstackAdapterPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES + */ +public class SaltstackAdapterPropertiesProviderImplLighty implements SaltstackAdapterPropertiesProvider { + + private static final Logger LOG = LoggerFactory.getLogger(SaltstackAdapterPropertiesProviderImplLighty.class); + + /** + * The name of the properties file for database configuration + */ + private static final String SALTSTACKADAPTER_PROP_FILE_NAME = "saltstack-adapter.properties"; + + /** + * A prioritized list of strategies for resolving sql-resource properties files. + */ + private Vector saltstackAdapterPropertiesFileResolvers = new Vector<>(); + + /** + * The configuration properties for the db connection. + */ + private Properties properties; + + /** + * Set up the prioritized list of strategies for resolving dblib properties + * files. + */ + public SaltstackAdapterPropertiesProviderImplLighty() { + saltstackAdapterPropertiesFileResolvers + .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); + saltstackAdapterPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); + saltstackAdapterPropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); + + // determines properties file as according to the priority described in the + // class header comment + final File propertiesFile = determinePropertiesFile(this); + if (propertiesFile != null) { + try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { + properties = new Properties(); + properties.load(fileInputStream); + } catch (final IOException e) { + LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), + new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), + e)); + } + } else { + // Try to read properties as resource + + InputStream propStr = getClass().getResourceAsStream("/" + SALTSTACKADAPTER_PROP_FILE_NAME); + if (propStr != null) { + properties = new Properties(); + try { + properties.load(propStr); + propStr.close(); + } catch (IOException e) { + properties = null; + } + } + + } + + if (properties == null) { + reportFailure("Missing configuration properties resource(3)", new ConfigurationException( + "Missing configuration properties resource(3): " + SALTSTACKADAPTER_PROP_FILE_NAME)); + + LOG.info("Defaulting org.onap.appc.adapter.saltstack.clientType to NONE"); + + properties = new Properties(); + properties.setProperty("org.onap.appc.adapter.saltstack.clientType", "NONE"); + } + } + + /** + * Reports the method chosen for properties resolution to the + * Logger. + * + * @param message Some user friendly message + * @param fileOptional The file location of the chosen properties file + * @return the file location of the chosen properties file + */ + private static File reportSuccess(final String message, final Optional fileOptional) { + if (fileOptional.isPresent()) { + final File file = fileOptional.get(); + LOG.info("{} {}", message, file.getPath()); + return file; + } + return null; + } + + /** + * Reports fatal errors. This is the case in which no properties file could be + * found. + * + * @param message An appropriate fatal error message + * @param configurationException An exception describing what went wrong during resolution + */ + private static void reportFailure(final String message, final ConfigurationException configurationException) { + + LOG.error("{}", message, configurationException); + } + + /** + * Extract svclogic config properties. + * + * @return the svclogic config properties + */ + public Properties getProperties() { + return properties; + } + + /** + * Determines the sql-resource properties file to use based on the following priority: + *
    + *
  1. A directory identified by the system environment variable + * SDNC_CONFIG_DIR
  2. + *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. + *
  5. A directory identified by the JRE argument + * sql-resource.properties
  6. + *
  7. A sql-resource.properties file located in the karaf root + * directory
  8. + *
+ */ + File determinePropertiesFile(final SaltstackAdapterPropertiesProviderImplLighty resourceProvider) { + + for (final PropertiesFileResolver sliPropertiesFileResolver : saltstackAdapterPropertiesFileResolvers) { + final Optional fileOptional = sliPropertiesFileResolver.resolveFile(SALTSTACKADAPTER_PROP_FILE_NAME); + if (fileOptional.isPresent()) { + return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); + } + } + + return null; + } +} diff --git a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java new file mode 100644 index 000000000..2f58d1f75 --- /dev/null +++ b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.saltstack.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapter; +import org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterImpl; +import org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterPropertiesProviderImplLighty; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the saltstack-adapter-provider artifact. + */ +public class SaltstackAdapterModule extends AbstractLightyModule { + + private static final Logger LOG = LoggerFactory.getLogger(SaltstackAdapterModule.class); + + private SaltstackAdapterPropertiesProviderImplLighty salstackPropertiesProvider; + private SaltstackAdapterImpl saltstackAdapter; + + @Override + protected boolean initProcedure() { + this.salstackPropertiesProvider = new SaltstackAdapterPropertiesProviderImplLighty(); + try { + this.saltstackAdapter = new SaltstackAdapterImpl(salstackPropertiesProvider); + } catch (SvcLogicException e) { + LOG.error("Exception thrown while initializing {} in {}!", SaltstackAdapterImpl.class, this.getClass(), e); + } + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public SaltstackAdapterPropertiesProviderImplLighty getSalstackPropertiesProvider() { + return this.salstackPropertiesProvider; + } + + public SaltstackAdapter getSaltstackAdapter() { + return saltstackAdapter; + } +} diff --git a/sql-resource/lighty/pom.xml b/sql-resource/lighty/pom.xml new file mode 100755 index 000000000..1647e5dbe --- /dev/null +++ b/sql-resource/lighty/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.4.0-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + sql-resource-lighty + 0.6.0-SNAPSHOT + jar + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + http://maven.apache.org + + + UTF-8 + + + + + + org.onap.ccsdk.sli.core + ccsdk-lighty-dependency-versions + ${project.version} + pom + import + + + + + + + io.lighty.core + lighty-controller + + + org.onap.ccsdk.sli.adaptors + sql-resource-provider + ${project.version} + + + org.onap.ccsdk.sli.core + dblib-provider + ${project.version} + + + org.onap.ccsdk.sli.core + sli-provider + ${project.version} + provided + + + diff --git a/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java b/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java new file mode 100644 index 000000000..fc760ba58 --- /dev/null +++ b/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * Copyright (c) 2019 PANTHEON.tech s.r.o. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + */ +package org.onap.ccsdk.sli.adaptors.resource.sql.lighty; + +import io.lighty.core.controller.api.AbstractLightyModule; +import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource; +import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResourcePropertiesProviderImpl; +import org.onap.ccsdk.sli.core.dblib.DbLibService; + +/** + * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from + * the sql-resource-provider artifact. + */ +public class SqlModule extends AbstractLightyModule { + + private final DbLibService dbService; + + private SqlResourcePropertiesProviderImpl sqlPropertiesProvider; + private SqlResource sqlResource; + + public SqlModule(DbLibService dbService) { + this.dbService = dbService; + } + + @Override + protected boolean initProcedure() { + this.sqlPropertiesProvider = new SqlResourcePropertiesProviderImpl(); + this.sqlResource = new SqlResource(sqlPropertiesProvider, dbService); + return true; + } + + @Override + protected boolean stopProcedure() { + return true; + } + + public SqlResource getSqlResource() { + return sqlResource; + } +} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 645576e18..2a5c34971 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -21,6 +21,7 @@ provider features installer + lighty -- cgit 1.2.3-korg From e82381b841584a4d4f94ade8ddf5a881353742bf Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 28 Aug 2019 13:13:32 -0400 Subject: Roll versions Roll versions in master branch Change-Id: Idbfc7999336f017e81a1715a9255d72188647d18 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/lighty/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-lighty/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- base/http/features/ccsdk-base-http/pom.xml | 4 ++-- base/http/features/features-base-http/pom.xml | 4 ++-- base/http/features/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- ccsdk-adaptors-lighty/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/lighty/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- .../consumer/features/features-messagerouter-consumer/pom.xml | 4 ++-- message-router/consumer/features/pom.xml | 4 ++-- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- .../publisher/features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- .../publisher/features/features-messagerouter-publisher/pom.xml | 4 ++-- message-router/publisher/features/pom.xml | 4 ++-- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/lighty/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/lighty/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-lighty/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/lighty/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 80 files changed, 152 insertions(+), 152 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index d9a956a49..f9623e425 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 20b366ddb..0a6fe2b8b 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 10f643256..250f6f8af 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 1e5cacfef..fd13163d4 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/lighty/pom.xml b/aai-service/lighty/pom.xml index c53c9c3ee..e3b7fe7c9 100755 --- a/aai-service/lighty/pom.xml +++ b/aai-service/lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 6ce9992fd..bd24021b4 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index fa345562e..7f1ab2063 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index da8a41f2f..0f33402e6 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index cc35a73c7..a4a5b8e45 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 0d6fa20f1..e3551d8b7 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 6863e06be..371aa901f 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index f2ab5bd49..89ba417a8 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-lighty/pom.xml b/ansible-adapter/ansible-adapter-lighty/pom.xml index 25603e446..166a7b821 100755 --- a/ansible-adapter/ansible-adapter-lighty/pom.xml +++ b/ansible-adapter/ansible-adapter-lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 4cf85e3d7..7ffac67ec 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index f2528003a..cb4603cd2 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml index 52266de31..2f1014665 100644 --- a/base/http/features/ccsdk-base-http/pom.xml +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml index 83adf90c1..856458467 100644 --- a/base/http/features/features-base-http/pom.xml +++ b/base/http/features/features-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-base-http - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml index ff2640b5c..a8d2d42b6 100644 --- a/base/http/features/pom.xml +++ b/base/http/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index 2e81dfd2f..fea814a4c 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index 689db2e76..8db53036d 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 5b9a60509..293cc1603 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index 70b5d1bf2..a2a81130a 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT @@ -12,7 +12,7 @@ pom org.onap.ccsdk.sli.adaptors base-parent - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT http diff --git a/ccsdk-adaptors-lighty/pom.xml b/ccsdk-adaptors-lighty/pom.xml index 161375ee6..8e6a70cef 100755 --- a/ccsdk-adaptors-lighty/pom.xml +++ b/ccsdk-adaptors-lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-adaptors-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index e48b58e46..9751f0498 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index bbdbb6ee1..e22d2bfcb 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 76643efda..397a4efde 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 73ad702dd..42a19590b 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index cb73db08e..f15910c72 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 7314197cb..1fb761cc2 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index c597abd5c..c92c3a717 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 649b66104..243e7bc07 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/lighty/pom.xml b/mdsal-resource/lighty/pom.xml index 08f0a5696..e2a5e6afd 100755 --- a/mdsal-resource/lighty/pom.xml +++ b/mdsal-resource/lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 468ec98b7..4c18bd59b 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 91534cb39..dd23d85e6 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 43c314811..6a1b06a8f 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT consumer.api diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index f6dda2240..ceb518bd8 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index dac4461a9..0144e761a 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-consumer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index 54193f953..3b470600a 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 304b639de..985edc127 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 585b378c9..01fc945e0 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index bc107db07..032116efb 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 9f5c88cb7..8e86b4b3b 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 7a48fb4f8..9cc3942d4 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 0acfb5e21..25fc225d4 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 2fc8c1450..0005b76e0 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 1c0825e75..7a18303f0 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index e34a66555..af3314b75 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index f7232fb50..3d17f68e6 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 2ecbfd1ad..1cff228d5 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 81fbebadb..49b52d5bf 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index eee799198..a0f2580f5 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index b1195eba2..fc51c2870 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 3556a4c5e..89f4c7c24 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index ac85879b9..9244ffad6 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/lighty/pom.xml b/netbox-client/lighty/pom.xml index 18db29466..ddfc4c733 100755 --- a/netbox-client/lighty/pom.xml +++ b/netbox-client/lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index d772ca82c..7c2ff9c6f 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index cbc698b6a..06a919dea 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index 15e483b33..d0f51ed77 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT 4.0.0 @@ -112,7 +112,7 @@ ONAP - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index d89cda04a..975f24b01 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 09e7a0626..7b9eaae29 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index d7e77bab3..dc2601256 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 900ad9f01..1af542668 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/lighty/pom.xml b/resource-assignment/lighty/pom.xml index 6807c2257..feea3e10f 100755 --- a/resource-assignment/lighty/pom.xml +++ b/resource-assignment/lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 4aa99ad7c..196331a32 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index a73949efc..96a96fd87 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 0700b270c..5ae3ddde6 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 3d9ec2079..ebbead493 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index a3e21d9d3..b02b8f4f0 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 57875e823..f6d430605 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 639e308aa..2c217c047 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-lighty/pom.xml b/saltstack-adapter/saltstack-adapter-lighty/pom.xml index 54eea24ce..c82bf6121 100755 --- a/saltstack-adapter/saltstack-adapter-lighty/pom.xml +++ b/saltstack-adapter/saltstack-adapter-lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index fb875e471..cd2709cab 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 4ca6c9fc4..48a3c541d 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 75ee45d87..928e9a9b0 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index e603e0a6f..28b1c6400 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 7f157d0fd..e451161d0 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/lighty/pom.xml b/sql-resource/lighty/pom.xml index 1647e5dbe..c0ad68e32 100755 --- a/sql-resource/lighty/pom.xml +++ b/sql-resource/lighty/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-lighty - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT jar ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 2a5c34971..9c25b8173 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index d49d01877..2afccfb68 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.6.0-SNAPSHOT + 0.6.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 54c44bc24..54d8edb35 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=6 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 116667df3977935f02206b3ce16e8d117ffa7545 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 29 Aug 2019 10:49:50 -0400 Subject: Revert "Proposal to remove OSGi dependencies from the CCSDK project" This reverts commit b1dd81ede363508f83c86ed497b8c0815045f8e5. This commit contains a significant amount of new code with no jUnit testing, which drives our code coverage for this repo below mandatory 55% line coverage. Thus, this is not acceptable. Change-Id: I8a3196df31d0c86747bdb3facd963983276a66e2 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/lighty/pom.xml | 48 - .../ccsdk/sli/adaptors/aai/AAIClientLighty.java | 94 - .../adaptors/aai/AAIClientRESTExecutorLighty.java | 776 -------- .../sli/adaptors/aai/AAIDeclarationsLighty.java | 1997 -------------------- .../adaptors/aai/AAIExecutorInterfaceLighty.java | 36 - .../ccsdk/sli/adaptors/aai/AAIRequestLighty.java | 470 ----- .../ccsdk/sli/adaptors/aai/AAIServiceLighty.java | 1545 --------------- .../sli/adaptors/aai/AAIServiceProviderLighty.java | 206 -- .../sli/adaptors/aai/CustomQueryRequestLighty.java | 136 -- .../ccsdk/sli/adaptors/aai/EchoRequestLighty.java | 98 - .../adaptors/aai/GenericQueryRequestLighty.java | 129 -- .../sli/adaptors/aai/GenericRequestLighty.java | 261 --- .../sli/adaptors/aai/NodesQueryRequestLighty.java | 130 -- .../ccsdk/sli/adaptors/aai/PathRequestLighty.java | 92 - .../aai/RelationshipListRequestLighty.java | 67 - .../adaptors/aai/RelationshipRequestLighty.java | 67 - .../sli/adaptors/aai/SelfLinkRequestLighty.java | 110 -- .../sli/adaptors/aai/UpdateRequestLighty.java | 153 -- .../sli/adaptors/aai/lighty/AaaServiceModule.java | 55 - aai-service/pom.xml | 1 - ansible-adapter/ansible-adapter-lighty/pom.xml | 48 - ...AnsibleAdapterPropertiesProviderImplLighty.java | 176 -- .../ansible/lighty/AnsibleAdapterModule.java | 52 - ansible-adapter/pom.xml | 1 - ccsdk-adaptors-lighty/pom.xml | 59 - .../adaptors/lighty/CcsdkAdaptorsLightyModule.java | 175 -- mdsal-resource/lighty/pom.xml | 47 - .../resource/mdsal/lighty/MdsalResourceModule.java | 58 - mdsal-resource/pom.xml | 1 - netbox-client/lighty/pom.xml | 47 - .../netbox/impl/NetboxClientImplLighty.java | 216 --- .../netbox/impl/NetboxHttpClientLighty.java | 97 - .../adaptors/netbox/lighty/NetboxClientModule.java | 70 - .../netbox/property/NetboxPropertiesLighty.java | 64 - netbox-client/pom.xml | 1 - pom.xml | 3 +- resource-assignment/lighty/pom.xml | 58 - .../adaptors/resource/lighty/ResourceModule.java | 152 -- resource-assignment/pom.xml | 1 - saltstack-adapter/pom.xml | 1 - saltstack-adapter/saltstack-adapter-lighty/pom.xml | 53 - ...ltstackAdapterPropertiesProviderImplLighty.java | 175 -- .../saltstack/lighty/SaltstackAdapterModule.java | 61 - sql-resource/lighty/pom.xml | 58 - .../adaptors/resource/sql/lighty/SqlModule.java | 54 - sql-resource/pom.xml | 1 - 46 files changed, 1 insertion(+), 8199 deletions(-) delete mode 100755 aai-service/lighty/pom.xml delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java delete mode 100755 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java delete mode 100644 aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java delete mode 100755 ansible-adapter/ansible-adapter-lighty/pom.xml delete mode 100755 ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java delete mode 100644 ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java delete mode 100755 ccsdk-adaptors-lighty/pom.xml delete mode 100644 ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java delete mode 100755 mdsal-resource/lighty/pom.xml delete mode 100644 mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java delete mode 100755 netbox-client/lighty/pom.xml delete mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java delete mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java delete mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java delete mode 100644 netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java delete mode 100755 resource-assignment/lighty/pom.xml delete mode 100644 resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java delete mode 100755 saltstack-adapter/saltstack-adapter-lighty/pom.xml delete mode 100755 saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java delete mode 100644 saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java delete mode 100755 sql-resource/lighty/pom.xml delete mode 100644 sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java (limited to 'resource-assignment') diff --git a/aai-service/lighty/pom.xml b/aai-service/lighty/pom.xml deleted file mode 100755 index e3b7fe7c9..000000000 --- a/aai-service/lighty/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - aai-service-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - aai-service-provider - ${project.version} - compile - - - diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java deleted file mode 100755 index 67d8c07de..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientLighty.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright © 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; -import org.onap.aai.inventory.v16.GenericVnf; -import org.onap.aai.inventory.v16.PhysicalLink; -import org.onap.aai.inventory.v16.SearchResults; -import org.onap.aai.inventory.v16.Vserver; -import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; - -/** - * THIS CLASS IS A COPY OF {@link AAIClient} WITH REMOVED OSGi DEPENDENCIES - */ -public interface AAIClientLighty extends SvcLogicResource, SvcLogicJavaPlugin { - - public SearchResults requestServiceInstanceURL(String svcInstanceId) throws AAIServiceException; - - // VServers - public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException; - - public URL requestVserverURLNodeQuery(String vserverName) throws AAIServiceException; - public String getTenantIdFromVserverUrl(URL url); - public String getCloudOwnerFromVserverUrl(URL url); - public String getCloudRegionFromVserverUrl(URL url); - public String getVServerIdFromVserverUrl(URL url, String tennantId); - public Vserver requestVServerDataByURL(URL url) throws AAIServiceException; - - - - // ----------------- Release 1510 ---------------------- - // // GenericVNF - public GenericVnf requestGenericVnfData(String vnfId) throws AAIServiceException; - public boolean postGenericVnfData(String vnfId, GenericVnf request) throws AAIServiceException; - - // Physical Link - public PhysicalLink requestPhysicalLinkData(String vnfId) throws AAIServiceException; - public boolean postPhysicalLinkData(String vnfId, PhysicalLink request) throws AAIServiceException; - public boolean deletePhysicalLinkData(String vnfId, String resourceVersion) throws AAIServiceException; - - // UBB Notify - public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException; - - // Node Query - 1602 - public SearchResults requestNodeQuery(String type, String entityIdentifier, String entityName) throws AAIServiceException; - public String requestDataByURL(URL url) throws AAIServiceException; - public GenericVnf requestGenericVnfeNodeQuery(String vnfName) throws AAIServiceException; - - public QueryStatus backup(Map params, SvcLogicContext ctx) throws SvcLogicException; - public QueryStatus restore(Map params, SvcLogicContext ctx) throws SvcLogicException; - - public void logKeyError(String keys); - - public QueryStatus processResponseData(String rv, String resource, AAIRequestLighty request, String prefix, - SvcLogicContext ctx, Map nameValues, String modifier) throws IOException, AAIServiceException ; - public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException; - public boolean isDeprecatedFormat(String resource, Map nameValues); - - String query(AAIRequestLighty request) throws AAIServiceException; - String save(AAIRequestLighty request) throws AAIServiceException; - boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; - boolean update(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; - -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java deleted file mode 100755 index f4cb55218..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorLighty.java +++ /dev/null @@ -1,776 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.NoSuchAlgorithmException; -import java.text.SimpleDateFormat; -import java.util.Properties; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocketFactory; -import org.apache.commons.codec.binary.Base64; -import org.apache.http.impl.EnglishReasonPhraseCatalog; -import org.onap.ccsdk.sli.adaptors.aai.AAIService.TransactionIdTracker; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; -import org.onap.ccsdk.sli.adaptors.aai.data.RequestError; -import org.onap.ccsdk.sli.adaptors.aai.data.ResourceVersion; -import org.onap.ccsdk.sli.adaptors.aai.data.ServiceException; -import org.onap.ccsdk.sli.core.sli.MetricLogger; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AAIClientRESTExecutor} WITH REMOVED OSGi DEPENDENCIES - */ -public class AAIClientRESTExecutorLighty implements AAIExecutorInterfaceLighty { - - private final String truststorePath; - private final String truststorePassword; - private final String keystorePath; - private final String keystorePassword; - private final Boolean ignoreCertificateHostError; - // authentication credentials - private String userName; - private String userPassword; - private final String applicationId; - private static final String HTTP_URL_CONNECTION_RESULT="HttpURLConnection result: {} : {}"; - private static final String ENTRY_DOESNT_EXIST="Entry does not exist."; - - /** - * class Constructor - * @param props - properties to initialize an instance. - */ - public AAIClientRESTExecutorLighty(Properties props) { - super(); - - userName = props.getProperty(AAIService.CLIENT_NAME); - userPassword = props.getProperty(AAIService.CLIENT_PWWD); - - if(userName == null || userName.isEmpty()){ - LOG.debug("Basic user name is not set"); - } - if(userPassword == null || userPassword.isEmpty()) { - LOG.debug("Basic password is not set"); - } - - truststorePath = props.getProperty(AAIService.TRUSTSTORE_PATH); - truststorePassword = props.getProperty(AAIService.TRUSTSTORE_PSSWD); - keystorePath = props.getProperty(AAIService.KEYSTORE_PATH); - keystorePassword = props.getProperty(AAIService.KEYSTORE_PSSWD); - - String tmpApplicationId =props.getProperty(AAIService.APPLICATION_ID); - if(tmpApplicationId == null || tmpApplicationId.isEmpty()) { - tmpApplicationId = "SDNC"; - } - applicationId = tmpApplicationId; - - String iche = props.getProperty(AAIService.CERTIFICATE_HOST_ERROR); - boolean host_error = false; - if(iche != null && !iche.isEmpty()) { - host_error = Boolean.valueOf(iche); - } - - ignoreCertificateHostError = host_error; - - HttpsURLConnection.setDefaultHostnameVerifier( (String string,SSLSession ssls) -> { - return ignoreCertificateHostError; - - }); - - if(truststorePath != null && truststorePassword != null && (new File(truststorePath)).exists()) { - System.setProperty("javax.net.ssl.trustStore", truststorePath); - System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword); - } - - if(keystorePath != null && keystorePassword != null && (new File(keystorePath)).exists()) - { - //both jersey and HttpURLConnection can use this - SSLContext ctx = null; - try { - ctx = SSLContext.getInstance("TLS"); - - KeyManagerFactory kmf = null; - try (FileInputStream fin = new FileInputStream(keystorePath)){ - String storeType = "PKCS12"; - String def = KeyStore.getDefaultType(); - kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - - String extension = keystorePath.substring(keystorePath.lastIndexOf(".") + 1); - - if(extension != null && !extension.isEmpty() && "JKS".equalsIgnoreCase(extension)) { - storeType = "JKS"; - } - KeyStore ks = KeyStore.getInstance(storeType); - - char[] pwd = keystorePassword.toCharArray(); - ks.load(fin, pwd); - kmf.init(ks, pwd); - } catch (Exception ex) { - LOG.error("AAIResource", ex); - } - - ctx.init(kmf.getKeyManagers(), null, null); - - CTX = ctx; - LOG.debug("SSLContext created"); - - } catch (KeyManagementException | NoSuchAlgorithmException exc) { - LOG.error("AAIResource", exc); - } - } - - try { - Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); - methodsField.setAccessible(true); - // get the methods field modifiers - Field modifiersField = Field.class.getDeclaredField("modifiers"); - // bypass the "private" modifier - modifiersField.setAccessible(true); - - // remove the "final" modifier - modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); - - /* valid HTTP methods */ - String[] methods = { - "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE", "PATCH" - }; - // set the new methods - including patch - methodsField.set(null, methods); - - } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { - LOG.warn("Adding PATCH method", e); - } - LOG.info("AAIResource.ctor initialized."); - - } - - private static final Logger LOG = LoggerFactory.getLogger(AAIService.class); - private static final String NOT_PROVIDED = "NOT PROVIDED"; - private final MetricLogger ml = new MetricLogger(); - - private SSLContext CTX; - - - private int connection_timeout = 300000; - - private int read_timeout = 300000; - - /** - * Returns an String that contains JSON data returned from the AAI Server. - *

- * This method always returns immediately, whether or not the - * data exists. - * - * @param request an instance of AAIRequiest representing - * the request made by DirectedGraph node. - * @return the JSON based representation of data instance requested. - * @see String - */ - @Override - public String get(AAIRequestLighty request) throws AAIServiceException { - String response = null; - InputStream inputStream = null; - HttpURLConnection con = null; - URL requestUrl = null; - - StringBuilder errorStringBuilder = new StringBuilder(); - - try { - - if(request.getRequestObject() != null) { - requestUrl = request.getRequestUrl(HttpMethod.POST, null); - requestUrl = appendDepth(requestUrl, request); - con = getConfiguredConnection(requestUrl, HttpMethod.POST); - String json_text = request.toJSONString(); - LOGwriteDateTrace("data", json_text); - logMetricRequest("POST "+requestUrl.getPath(), json_text, requestUrl.getPath()); - OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); - osw.write(json_text); - osw.flush(); - } else { - requestUrl = request.getRequestUrl(HttpMethod.GET, null); - requestUrl = appendDepth(requestUrl, request); - con = getConfiguredConnection(requestUrl, HttpMethod.GET); - logMetricRequest("GET "+requestUrl.getPath(), "", requestUrl.getPath()); - } - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - String responseMessage = null; - try { - responseMessage = con.getResponseMessage(); - } catch(Exception exc) { - responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); - } finally { - if(responseMessage == null) - responseMessage = NOT_PROVIDED; - } - - // Process the response - LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); - logMetricResponse(responseCode, responseMessage); - - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - - ObjectMapper mapper = AAIService.getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK) { - StringBuilder stringBuilder = new StringBuilder(); - String line = null; - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - response = stringBuilder.toString(); - try { - Object object = mapper.readValue(response, Object.class); - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(object)); - } catch(Exception exc) { - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response)); - } - } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { - LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); - ErrorResponse errorresponse = null; - try { - errorresponse = mapper.readValue(reader, ErrorResponse.class); - } catch(Exception exc) { - errorresponse = new ErrorResponse(); - RequestError requestError = new RequestError(); - ServiceException serviceException = new ServiceException(); - serviceException.setText(ENTRY_DOESNT_EXIST); - requestError.setServiceException(serviceException); - errorresponse.setRequestError(requestError ); - } - throw new AAIServiceException(responseCode, errorresponse); - } else if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) { - StringBuilder stringBuilder = new StringBuilder(); - String line = null; - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString()); - ServiceException serviceException = new ServiceException(); - serviceException.setMessageId("HTTP_UNAUTHORIZED"); - serviceException.setText(stringBuilder.toString()); - RequestError requestError = new RequestError(); - requestError.setServiceException(serviceException); - ErrorResponse errorresponse = new ErrorResponse(); - errorresponse.setRequestError(requestError); - throw new AAIServiceException(responseCode, errorresponse); - } else { - String line = null; - while( ( line = reader.readLine() ) != null ) { - errorStringBuilder.append("\n").append( line ); - } - - ErrorResponse errorresponse = mapper.readValue(errorStringBuilder.toString(), ErrorResponse.class); - LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn(errorStringBuilder.toString(), exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("", exc); - } - } - } - return response; - } - - /** - * Returns an String that contains JSON data returned from the AAI Server. - *

- * This method always returns immediately, whether or not the - * data exists. - * - * @param request an instance of AAIRequiest representing - * the request made by DirectedGraph node. - * @return the JSON based representation of data instance requested. - * @see String - */ - @Override - public String post(AAIRequestLighty request) throws AAIServiceException { - InputStream inputStream = null; - - try { - String resourceVersion = null; - AAIDatum instance = request.getRequestObject(); - - try { - Method getResourceVersionMethod = instance.getClass().getMethod("getResourceVersion"); - if(getResourceVersionMethod != null){ - try { - Object object = getResourceVersionMethod.invoke(instance); - if(object != null) - resourceVersion = object.toString(); - } catch (InvocationTargetException exc) { - LOG.warn("", exc); - } - } - } catch(Exception exc) { - LOG.error("", exc); - } - - URL requestUrl = request.getRequestUrl(HttpMethod.PUT, resourceVersion); - HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.PUT); - ObjectMapper mapper = AAIService.getObjectMapper(); - String jsonText = request.toJSONString(); - - LOGwriteDateTrace("data", jsonText); - logMetricRequest("PUT "+requestUrl.getPath(), jsonText, requestUrl.getPath()); - - OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); - osw.write(jsonText); - osw.flush(); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - String responseMessage = null; - try { - responseMessage = con.getResponseMessage(); - } catch(Exception exc) { - responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); - } finally { - if(responseMessage == null) - responseMessage = NOT_PROVIDED; - } - - LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); - logMetricResponse(responseCode, responseMessage); - - // Process the response - BufferedReader reader; - String line = null; - reader = new BufferedReader( new InputStreamReader( inputStream ) ); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}"); - return stringBuilder.toString(); - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); - - throw new AAIServiceException(responseCode, errorresponse); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("AAIRequestExecutor.post", exc); - throw new AAIServiceException(exc); - } finally { - try { - if(inputStream != null) - inputStream.close(); - } catch (Exception exc) { - LOG.warn("AAIRequestExecutor.post", exc); - } - } - } - - /** - * Returns Boolean that contains completion state of the command executed. - *

- * This method always returns immediately, whether or not the - * data exists. - * - * @param request an instance of AAIRequiest representing - * @param resourceVersion a resource version of the data instacne to be deleted. - * the request made by DirectedGraph node. - * @return completion state of the command. - * @see String - */ - @Override - public Boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { - Boolean response = null; - InputStream inputStream = null; - - if(resourceVersion == null) { - throw new AAIServiceException("resource-version is required for DELETE request"); - } - - try { - URL requestUrl = request.getRequestUrl(HttpMethod.DELETE, resourceVersion); - HttpURLConnection conn = getConfiguredConnection(requestUrl, HttpMethod.DELETE); - logMetricRequest("DELETE "+requestUrl.getPath(), "", requestUrl.getPath()); - conn.setDoOutput(true); - - // Check for errors - int responseCode = conn.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = conn.getInputStream(); - } else { - inputStream = conn.getErrorStream(); - } - String responseMessage = null; - try { - responseMessage = conn.getResponseMessage(); - } catch(Exception exc) { - responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); - } finally { - if(responseMessage == null) - responseMessage = NOT_PROVIDED; - } - - // Process the response - LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); - logMetricResponse(responseCode, responseMessage); - - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - String line = null; - - ObjectMapper mapper = AAIService.getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString()); - response = true; - } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); - response = false; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("delete", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("delete", exc); - } - } - } - return response; - } - - /** - * Returns an String that contains JSON data returned from the AAI Server. - *

- * This method always returns immediately, whether or not the - * data exists. - * - * @param request an instance of AAIRequiest representing - * the request made by DirectedGraph node. - * @param clas an definition of the class for which data will be returned - * @return the instance of the class with data. - * @see String - */ - @Override - public Object query(AAIRequestLighty request, Class clas) throws AAIServiceException { - Object response = null; - InputStream inputStream = null; - - try { - URL requestUrl = request.getRequestQueryUrl(HttpMethod.GET); - HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.GET); - logMetricRequest("GET "+requestUrl.getPath(), "", requestUrl.getPath()); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - String responseMessage = null; - try { - responseMessage = con.getResponseMessage(); - } catch(Exception exc) { - responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); - } finally { - if(responseMessage == null) - responseMessage = NOT_PROVIDED; - } - - LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); - logMetricResponse(responseCode, responseMessage); - ObjectMapper mapper = AAIService.getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK) { - // Process the response - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - response = mapper.readValue(reader, clas); - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); - } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", ENTRY_DOESNT_EXIST); - return response; - } else { - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("GET", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("GET", exc); - } - } - } - return response; - } - - @Override - public Boolean patch(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { - InputStream inputStream = null; - - try { - AAIDatum instance = request.getRequestObject(); - if(instance instanceof ResourceVersion) { - resourceVersion = ((ResourceVersion)instance).getResourceVersion(); - } - - URL requestUrl = null; - requestUrl = request.getRequestUrl("PATCH", resourceVersion); - HttpURLConnection con = getConfiguredConnection(requestUrl, "PATCH"); - ObjectMapper mapper = AAIService.getObjectMapper(); - String jsonText = request.toJSONString(); - - LOGwriteDateTrace("data", jsonText); - logMetricRequest("PATCH "+requestUrl.getPath(), jsonText, requestUrl.getPath()); - - OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); - osw.write(jsonText); - osw.flush(); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - String responseMessage = null; - try { - responseMessage = con.getResponseMessage(); - } catch(Exception exc) { - LOG.info("Exception occured", exc.getMessage()); - responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null); - } finally { - if(responseMessage == null) - responseMessage = NOT_PROVIDED; - } - - LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage); - logMetricResponse(responseCode, responseMessage); - - // Process the response - BufferedReader reader; - String line = null; - reader = new BufferedReader( new InputStreamReader( inputStream ) ); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}"); - return true; - } else { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append("\n").append( line ); - } - LOG.info(stringBuilder.toString()); - - - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse)); - - throw new AAIServiceException(responseCode, errorresponse); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("AAIRequestExecutor.patch", exc); - throw new AAIServiceException(exc); - } finally { - try { - if(inputStream != null) - inputStream.close(); - } catch (Exception exc) { - LOG.warn("AAIRequestExecutor.patch", exc); - } - } - } - - /** - * - * @param httpReqUrl - * @param method - * @return - * @throws Exception - */ - protected HttpURLConnection getConfiguredConnection(URL httpReqUrl, String method) throws Exception { - HttpURLConnection con = (HttpURLConnection) httpReqUrl.openConnection(); - - // Set up the connection properties - con.setRequestProperty("Connection", "close"); - con.setDoInput(true); - con.setDoOutput(true); - con.setUseCaches(false); - con.setConnectTimeout(connection_timeout); - con.setReadTimeout(read_timeout); - con.setRequestMethod(method); - con.setRequestProperty("Accept", "application/json"); - con.setRequestProperty("Transfer-Encoding","chunked"); - con.setRequestProperty("Content-Type", - "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json"); - con.setRequestProperty("X-FromAppId", applicationId); - con.setRequestProperty("X-TransactionId", TransactionIdTracker.getNextTransactionId()); - String mlId = ml.getRequestID(); - if (mlId != null && !mlId.isEmpty()) { - LOG.debug(String.format("MetricLogger requestId = %s", mlId)); - con.setRequestProperty(MetricLogger.REQUEST_ID, mlId); - } else { - LOG.debug("MetricLogger requestId is null"); - } - - if (userName != null && !userName.isEmpty() && userPassword != null && !userPassword.isEmpty()) { - String basicAuth = "Basic " + new String(Base64.encodeBase64((userName + ":" + userPassword).getBytes())); - con.setRequestProperty("Authorization", basicAuth); - } - - if (con instanceof HttpsURLConnection && CTX != null) { - SSLSocketFactory sockFact = CTX.getSocketFactory(); - HttpsURLConnection.class.cast(con).setSSLSocketFactory(sockFact); - } - return con; - } - - private URL appendDepth(URL requestUrl, AAIRequestLighty request) throws MalformedURLException { - - String depth = request.requestProperties.getProperty("depth", "1"); - String path = requestUrl.toString(); - if(path.contains("?depth=") || path.contains("&depth=")) { - return requestUrl; - } else { - if(path.contains("?")) { - path = String.format("%s&depth=%s", path, depth); - } else { - path = String.format("%s?depth=%s", path, depth); - } - return new URL(path); - } - } - - public void logMetricRequest(String targetServiceName, String msg, String path){ - String svcInstanceId = ""; - String svcName = null; - String partnerName = null; - String targetEntity = "A&AI"; - String targetVirtualEntity = null; - - ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg); - } - - public void logMetricResponse(int responseCode, String responseDescription){ - ml.logResponse(responseCode < 400 ? "COMPLETE" : "ERROR", Integer.toString(responseCode), responseDescription); - } - - protected void LOGwriteFirstTrace(String method, String url) { - String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis()); - LOG.info("A&AI transaction :"); - LOG.info("Request Time : " + time + ", Method : " + method); - LOG.info("Request URL : "+ url); - } - - protected void LOGwriteDateTrace(String name, String data) { - LOG.info("Input - " + name + " : " + data); - } - - protected void LOGwriteEndingTrace(int response_code, String comment, String data) { - LOG.info("Response code : " + response_code +", " + comment); - LOG.info(String.format("Response data : %s", data)); - } - -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java deleted file mode 100755 index 1099f6586..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarationsLighty.java +++ /dev/null @@ -1,1997 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.xml.bind.annotation.XmlType; -import org.apache.commons.lang.StringUtils; -import org.onap.aai.inventory.v16.GenericVnf; -import org.onap.aai.inventory.v16.Image; -import org.onap.aai.inventory.v16.Metadata; -import org.onap.aai.inventory.v16.Metadatum; -import org.onap.aai.inventory.v16.RelatedToProperty; -import org.onap.aai.inventory.v16.Relationship; -import org.onap.aai.inventory.v16.RelationshipData; -import org.onap.aai.inventory.v16.RelationshipList; -import org.onap.aai.inventory.v16.ResultData; -import org.onap.aai.inventory.v16.SearchResults; -import org.onap.aai.inventory.v16.ServiceInstance; -import org.onap.aai.inventory.v16.Vlan; -import org.onap.aai.inventory.v16.Vlans; -import org.onap.aai.inventory.v16.Vserver; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList; -import org.onap.ccsdk.sli.adaptors.aai.query.Result; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AAIDeclarations} WITH REMOVED OSGi DEPENDENCIES - */ -public abstract class AAIDeclarationsLighty implements AAIClientLighty { - - public static final String TRUSTSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust"; - public static final String TRUSTSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd"; - public static final String KEYSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.key"; - public static final String KEYSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd"; - - public static final String APPLICATION_ID = "org.onap.ccsdk.sli.adaptors.aai.application"; - - public static final String CLIENT_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.name"; - public static final String CLIENT_PWWD = "org.onap.ccsdk.sli.adaptors.aai.client.psswd"; - - - public static final String CONNECTION_TIMEOUT = "connection.timeout"; - public static final String READ_TIMEOUT = "read.timeout"; - - public static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri"; - - public static final String AAI_VERSION = "org.onap.ccsdk.sli.adaptors.aai.version"; - - // Availability zones query - public static final String QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.query"; - - // Update - public static final String UPDATE_PATH = "org.onap.ccsdk.sli.adaptors.aai.update"; - - // Service instance - public static final String SVC_INSTANCE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst"; - public static final String SVC_INST_QRY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query"; - - // VServer - public static final String NETWORK_VSERVER_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vserver"; - - public static final String VNF_IMAGE_QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query"; - - public static final String PARAM_SERVICE_TYPE = "org.onap.ccsdk.sli.adaptors.aai.param.service.type"; - public static final String CERTIFICATE_HOST_ERROR = "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore"; - - // UBB Notify - public static final String UBB_NOTIFY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.notify"; - public static final String SELFLINK_AVPN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn"; - public static final String SELFLINK_FQDN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn"; - - //Service - public static final String SERVICE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.service"; - - // site-pair-sets - public static final String SITE_PAIR_SET_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set"; - - // node query (1602) - public static final String QUERY_NODES_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes"; - - private static final String VERSION_PATTERN = "/v$/"; - - private static final String AAI_SERVICE_EXCEPTION = "AAI Service Exception"; - - protected abstract Logger getLogger(); - public abstract AAIExecutorInterfaceLighty getExecutor(); - - private static final String RELATIONSHIP_DATA= "Retrofitting relationship data: "; - - - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) - throws SvcLogicException { - - getLogger().debug("AAIService.query \tresource = "+resource); - - String vnfId; - String vnfName = null; - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - getLogger().debug("key = "+ nameValues.toString()); - - if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); - return QueryStatus.FAILURE; - } - - if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); - return QueryStatus.FAILURE; - } - - // process data using new model - boolean useNewModelProcessing = true; - // process server query by name the old way - if("vserver".equals(resource) || "vserver2".equals(resource)){ - if(nameValues.containsKey("vserver_name") || nameValues.containsKey("vserver-name") || nameValues.containsKey("vserver.vserver_name") || nameValues.containsKey("vserver.vserver-name")) - useNewModelProcessing = false; - } - if("generic-vnf".equals(resource)){ - if(nameValues.containsKey("vnf_name") || nameValues.containsKey("vnf-name") || nameValues.containsKey("generic_vnf.vnf_name") || nameValues.containsKey("generic-vnf.vnf-name")) - useNewModelProcessing = false; - } - - // process data using new model - if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) { - - try { - return newModelQuery(resource, localOnly, select, key, prefix, orderBy, ctx); - } catch (Exception exc) { - getLogger().warn("Failed query - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } - - ObjectMapper mapper = AAIService.getObjectMapper(); - Map attributes = new HashMap<>(); - - String modifier = null; - - if(resource.contains(":")) { - String[] tokens = resource.split(":"); - resource = tokens[0]; - if(tokens.length > 1) { - modifier = tokens[1]; - } - } - - resource = resource.toLowerCase().replace("-", "_"); - - try { - - switch(resource) { - case "generic_vnf": - vnfId = nameValues.get("vnf_id"); - if(nameValues.containsKey("vnf_id")) - vnfId = nameValues.get("vnf_id"); - else if(nameValues.containsKey("generic_vnf.vnf_name")) - vnfId = nameValues.get("generic_vnf.vserver_name"); - - if(nameValues.containsKey("vnf_name")) - vnfName = nameValues.get("vnf_name"); - else if(nameValues.containsKey("generic_vnf.vnf_name")) - vnfName = nameValues.get("generic_vnf.vnf_name"); - - if(vnfId != null && !vnfId.isEmpty()) { - // at this point of the project this part should not be executed - vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", ""); - GenericVnf vnf = this.requestGenericVnfData(vnfId); - if(vnf == null) { - return QueryStatus.NOT_FOUND; - } - - attributes = mapper.convertValue(vnf, attributes.getClass()); - } else if(vnfName != null && !vnfName.isEmpty()) { - try { - vnfName = vnfName.trim().replace("'", "").replace("$", "").replace("'", ""); - GenericVnf vnf = this.requestGenericVnfeNodeQuery(vnfName); - if(vnf == null) { - return QueryStatus.NOT_FOUND; - } - vnfId=vnf.getVnfId(); - nameValues.put("vnf_id", vnfId); - attributes = mapper.convertValue(vnf, attributes.getClass()); - } catch (AAIServiceException exc) { - int errorCode = exc.getReturnCode(); - switch(errorCode) { - case 400: - case 404: - case 412: - break; - default: - getLogger().warn("Caught exception trying to refresh generic VNF", exc); - } - ctx.setAttribute(prefix + ".error.message", exc.getMessage()); - if(errorCode >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", - Integer.toString(exc.getReturnCode())); - } - return QueryStatus.FAILURE; - } - } else { - getLogger().warn("No arguments are available to process generic VNF"); - return QueryStatus.FAILURE; - } - break; - case "vserver": - case "vserver2": - String vserverName = null; - if(nameValues.containsKey("vserver_name")) - vserverName = nameValues.get("vserver_name"); - else if(nameValues.containsKey("vserver.vserver_name")) - vserverName = nameValues.get("vserver.vserver_name"); - - String vserverId = null; - if(nameValues.containsKey("vserver_id")) - vserverId = nameValues.get("vserver_id"); - if(nameValues.containsKey("vserver.vserver_id")) - vserverId = nameValues.get("vserver.vserver_id"); - String tenantId = nameValues.get("teannt_id"); - - if(vserverName != null) vserverName = vserverName.trim().replace("'", "").replace("$", "").replace("'", ""); - if(vserverId != null) vserverId = vserverId.trim().replace("'", "").replace("$", "").replace("'", ""); - if(tenantId != null) tenantId = tenantId.trim().replace("'", "").replace("$", "").replace("'", ""); - - if (vserverName != null) { - URL vserverUrl = null; - try { - vserverUrl = this.requestVserverURLNodeQuery(vserverName); - } catch (AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); - if (aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http" + "" + ".response-code", Integer.toString(aaiexc.getReturnCode())); - } - - if (aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - else - return QueryStatus.FAILURE; - } - if (vserverUrl == null) { - return QueryStatus.NOT_FOUND; - } - - tenantId = getTenantIdFromVserverUrl(vserverUrl); - String cloudOwner = getCloudOwnerFromVserverUrl(vserverUrl); - String cloudRegionId = getCloudRegionFromVserverUrl(vserverUrl); - - Vserver vserver = null; - try { - vserver = this.requestVServerDataByURL(vserverUrl); - } catch (AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); - if (aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); - } - - if (aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - else - return QueryStatus.FAILURE; - } - if (vserver == null) { - return QueryStatus.NOT_FOUND; - } - attributes = mapper.convertValue(vserver, attributes.getClass()); - if (!attributes.containsKey("tenant-id") && tenantId != null) { - attributes.put("tenant-id", tenantId); - } - if (!attributes.containsKey("cloud-owner") && cloudOwner != null) { - attributes.put("cloud-owner", cloudOwner); - } - if (!attributes.containsKey("cloud-region-id") && cloudRegionId != null) { - attributes.put("cloud-region-id", cloudRegionId); - } - } else if (vserverId != null && tenantId != null) { - Vserver vserver = this.requestVServerData(tenantId, vserverId, "att-aic", "AAIAIC25"); - if(vserver == null) { - return QueryStatus.NOT_FOUND; - } - attributes = mapper.convertValue(vserver, attributes.getClass()); - if(!attributes.containsKey("tenant-id") && tenantId != null){ - attributes.put("tenant-id", tenantId); - } - } else { - return QueryStatus.FAILURE; - } - break; - - default: - return QueryStatus.FAILURE; - } - - QueryStatus retval = QueryStatus.SUCCESS; - - if (attributes == null || attributes.isEmpty()) { - retval = QueryStatus.NOT_FOUND; - getLogger().debug("No data found"); - } else { - if (ctx != null) { - if (prefix != null) { - ArrayList keys = new ArrayList<>(attributes.keySet()); - - int numCols = keys.size(); - - for (int i = 0; i < numCols; i++) { - String colValue; - String colName = keys.get(i); - Object object = attributes.get(colName); - - if(object != null && object instanceof String) { - colValue = (String)object; - - if (prefix != null) { - getLogger().debug("Setting "+prefix + "." + colName.replaceAll("_", "-")+" = "+ colValue); - ctx.setAttribute(prefix + "." + colName.replaceAll("_", "-"), colValue); - } else { - getLogger().debug("Setting " + colValue.replaceAll("_", "-")+" = "+colValue); - ctx.setAttribute(colValue.replaceAll("_", "-"), colValue); - } - } else if(object != null && object instanceof Map) { - if(colName.equals(modifier) || "relationship-list".equals(colName)){ - String localNodifier = modifier; - if(localNodifier == null) - localNodifier = "relationship-list"; - Map properties = (Map)object; - writeMap(properties, prefix+"."+localNodifier, ctx); - } - } - } - } - } - } - getLogger().debug("Query - returning " + retval); - return retval; - - } catch (Exception exc) { - getLogger().warn("Failed query - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } - - - public void writeMap(Map properties, String prefix, SvcLogicContext ctx) { - Set mapKeys = properties.keySet(); - - for(String mapKey : mapKeys) { - Object entity = properties.get(mapKey); - if(entity instanceof ArrayList) { - writeList((ArrayList)entity, prefix + "." + mapKey, ctx); - } else - if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) { - ctx.setAttribute(prefix + "." + mapKey, entity.toString()); - getLogger().debug(prefix + "." + mapKey + " : " + entity.toString()); - } else if(entity instanceof Map) { - String localPrefix = prefix; - if(mapKey != null) { - localPrefix = String.format("%s.%s", prefix, mapKey); - } - writeMap( (Map)entity, localPrefix, ctx); - } - } - } - - private void writeList(ArrayList list, String prefix, SvcLogicContext ctx) { - for(int i = 0; i < list.size(); i++ ) { - Object entity = list.get(i); - if(entity instanceof Map) { - writeMap( (Map)entity, prefix + "[" + i + "]", ctx); - } else - if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) { - ctx.setAttribute(prefix, entity.toString()); - getLogger().debug(prefix + " : " + entity.toString()); - } - } - - if(!list.isEmpty()) { - ctx.setAttribute(prefix + "_length", Integer.toString(list.size())); - getLogger().debug(prefix + "_length" + " : " + Integer.toString(list.size())); - } - } - - @Override - public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map params, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - - getLogger().debug("AAIService.save\tresource="+resource); - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - - if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); - return QueryStatus.FAILURE; - } - - if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { - getLogger().warn("AAIService.save has unspecified resource"); - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); - return QueryStatus.FAILURE; - } - // keys passed - getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); - - // process params - if(params.containsKey("prefix")) { - Map tmpParams = ctxGetBeginsWith(ctx, params.get("prefix")); - if(!tmpParams.isEmpty()) { - params.putAll(tmpParams); -// params.remove("prefix"); - } - } - // params passed - getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray())); - - boolean useNewModelProcessing = true; - // process server query by name the old way - if("vserver".equals(resource) || "vserver2".equals(resource)){ - if(nameValues.containsKey("vserver-name")) { - useNewModelProcessing = false; - } - - if(!params.containsKey("vserver-selflink")) { - - AAIRequest request = AAIRequest.createRequest(resource, nameValues); - URL path = null; - try { - request.processRequestPathValues(nameValues); - path = request.getRequestUrl("GET", null); - params.put("vserver-selflink", path.toString()); - } catch (UnsupportedEncodingException | MalformedURLException | URISyntaxException e) { - getLogger().warn("URL error Exception", e); - params.put("vserver-selflink", "/vserver"); - } - } - } - - // process data using new model - if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) { - - try { - if(!resource.contains(":")){ - return newModelSave(resource, force, key, params, prefix, ctx); - } else { - String[] tokens = resource.split(":"); - String localResource = tokens[0]; - String dependency = tokens[1]; - - AAIDatum instance = newModelObjectRequest( localResource, nameValues, prefix, ctx); - if(instance == null) { - return QueryStatus.NOT_FOUND; - } - - switch(dependency){ - case "relationship-list": - newModelProcessRelationshipList(instance, params, prefix, ctx); - break; - case "metadata": - newModelProcessMetadata(instance, params, prefix, ctx); - break; - } - // create a method to update relationship-list - AAIRequestLighty request = AAIRequestLighty.createRequest(localResource, nameValues); - request.setRequestObject(instance); - request.processRequestPathValues(nameValues); - - getExecutor().post(request); - getLogger().debug("Save relationship list - returning SUCCESS"); - return QueryStatus.SUCCESS; - } - } catch (Exception exc) { - ctx.setAttribute(prefix + ".error.message", exc.getMessage()); - if(exc instanceof AAIServiceException) { - AAIServiceException aaiexc = (AAIServiceException)exc; - if(aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); - } - - if(aaiexc.getReturnCode() == 404) { - return QueryStatus.NOT_FOUND; - } - } - getLogger().warn("Failed save() - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } else { - getLogger().debug("Save() request for {} is not supported- returning FAILURE", resource); - return QueryStatus.FAILURE; - } - } - - @Override - public QueryStatus update(String resource, String key, Map params, String prefix, SvcLogicContext ctx) throws SvcLogicException { - - resource = resource.toLowerCase(); - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); - if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); - return QueryStatus.FAILURE; - } - - if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource)); - return QueryStatus.FAILURE; - } - - // check if request is for groups - if(!AAIServiceUtils.containsResource(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not permitted in 'update' operation", resource)); - return QueryStatus.FAILURE; - } - - getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray())); - - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); - request = new UpdateRequestLighty(request, params); - - String[] arguments = request.getArgsList(); - for(String name : arguments) { - String modifiedKey = name.replaceAll("-", "_"); - if(nameValues.containsKey(modifiedKey)) { - String argValue = nameValues.get(modifiedKey); - if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", ""); - request.addRequestProperty(name, argValue); - } - } - - try { - QueryStatus retval = QueryStatus.SUCCESS; - - retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx); - - if(retval == null || retval != QueryStatus.SUCCESS) { - return retval; - } - - String resourceVersion = ctx.getAttribute("tmpDelete.resource-version"); - if(resourceVersion == null) { - return QueryStatus.NOT_FOUND; - } - params.put("resource-version", resourceVersion); - - request.processRequestPathValues(nameValues); - getExecutor().patch(request, resourceVersion); - } catch(AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - if(aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - else - return QueryStatus.FAILURE; - } catch (Exception exc) { - getLogger().warn("Failed update - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - - getLogger().debug("Update - returning SUCCESS"); - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - getLogger().debug("AAIService.delete\tresource="+resource); - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray())); - - if(!AAIServiceUtils.isValidFormat(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", "aaiData"), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource)); - return QueryStatus.FAILURE; - } - - if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) { - ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not supported", resource)); - return QueryStatus.FAILURE; - } - - // check if request is for groups - if(!AAIServiceUtils.containsResource(resource, nameValues)) { - ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not permitted in 'delete' operation", resource)); - return QueryStatus.FAILURE; - } - - if(AAIRequest.createRequest(resource, nameValues) != null) { - if(resource.contains(":")) { - switch (resource.split(":")[1]){ - case "relationship-list": - return processDeleteRelationshipList(resource, key, ctx, nameValues); - case "metadata": - return processDeleteMetadata(resource, key, ctx, nameValues); - } - } - - - try { - QueryStatus retval = QueryStatus.SUCCESS; - - retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx); - - if(retval == null || retval != QueryStatus.SUCCESS) { - return retval; - } - - String resourceVersion = ctx.getAttribute("tmpDelete.resource-version"); - if(resourceVersion == null) { - return QueryStatus.NOT_FOUND; - } - - try { - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); - if(request == null) { - return QueryStatus.FAILURE; - } - - request.processRequestPathValues(nameValues); - - if(getExecutor().delete(request, resourceVersion)) { - return QueryStatus.SUCCESS; - } - } catch(AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - if(aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - else - return QueryStatus.FAILURE; - - } catch (Exception exc) { - getLogger().warn("requestGenericVnfData", exc); - return QueryStatus.FAILURE; - } - - } catch (Exception exc) { - getLogger().warn("Failed delete - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } else { - String resourceName = resource; - String identifier = null; - - if(resourceName.contains(":")) { - String[] tokens = resourceName.split(":"); - if(tokens != null && tokens.length > 0) { - resourceName = tokens[0]; - identifier = tokens[1]; - } - } - if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) { -// RelationshipRequest relationshipRequest = new RelationshipRequest(); - if("generic-vnf".equals(resourceName)){ - String vnfId = nameValues.get("vnf_id"); - String relatedTo = nameValues.get("related_to"); - vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", ""); - relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", ""); - - GenericVnf vnf; - try { - vnf = this.requestGenericVnfData(vnfId); - if(vnf == null) - return QueryStatus.NOT_FOUND; - } catch (AAIServiceException exc) { - getLogger().warn("Failed delete - returning NOT_FOUND", exc); - return QueryStatus.NOT_FOUND; - } - boolean itemRemoved = false; - RelationshipList relationshipList = vnf.getRelationshipList(); - List relationships = relationshipList.getRelationship(); - List iterableList = new LinkedList<>(relationships); - for(Relationship relationship : iterableList) { - if(relationship.getRelatedTo().equals(relatedTo)) { - relationships.remove(relationship); - itemRemoved = true; - } - } - - if(!itemRemoved) - return QueryStatus.NOT_FOUND; - try { - this.postGenericVnfData(vnf.getVnfId(), vnf); - } catch (AAIServiceException exc) { - if(exc.getReturnCode() == 404){ - return QueryStatus.NOT_FOUND; - } else { - getLogger().warn("Failed delete - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } - return QueryStatus.SUCCESS; - } - } - } - return QueryStatus.FAILURE; - } - - @Override - public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException { - return query(resource, false, null, key, prefix, null, ctx); - } - - @Override - public QueryStatus isAvailable(String arg0, String arg1, String arg2, SvcLogicContext arg3) - throws SvcLogicException { - throw new SvcLogicException("Method AAIService.isAvailable() has not been implemented yet"); - } - - @Override - public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException { - throw new SvcLogicException("Method AAIService.notify() has not been implemented yet"); - } - - // @Override - public QueryStatus newModelQuery(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) { - - QueryStatus retval = QueryStatus.SUCCESS; - String modifier = null; - - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - if(resource.contains(":")) { - modifier = resource.split(":")[1]; - } - - try { - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); - if(request == null) { - return QueryStatus.FAILURE; - } - - Map params = new HashMap<>(); - - request.processRequestPathValues(nameValues); - if(nameValues.containsKey("prefix")){ - Map tmpParams = ctxGetBeginsWith(ctx, nameValues.get("prefix")); - if(!tmpParams.isEmpty()) { - params.putAll(tmpParams); - } - } - String rv = getExecutor().get(request); - - retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, modifier); - - } catch(AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - int errorCode = aaiexc.getReturnCode(); - ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); - if(errorCode >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", - Integer.toString(aaiexc.getReturnCode())); - } - - if(aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - - return QueryStatus.FAILURE; - } catch (Exception exc) { - getLogger().warn("requestGenericVnfData", exc); - ctx.setAttribute(prefix + ".error.message", exc.getMessage()); - return QueryStatus.FAILURE; - } - - return retval; - } - - public QueryStatus processResponseData(String rv, String resource, AAIRequestLighty request, String prefix, SvcLogicContext ctx, Map nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException - { - Object response; - - if(rv == null) { - return QueryStatus.NOT_FOUND; - } - - response = request.jsonStringToObject(rv); - if(response == null) { - return QueryStatus.NOT_FOUND; - } - - if("generic-query".equals(resource)) { - SearchResults rd = SearchResults.class.cast(response); - List rdList = rd.getResultData(); - if(rdList == null || rdList.isEmpty()) { - return QueryStatus.NOT_FOUND; - } - ResultData rDatum = rdList.get(0); - nameValues.put("selflink", rDatum.getResourceLink()); - AAIRequestLighty req2 = AAIRequestLighty.createRequest(rDatum.getResourceType(), nameValues); - req2.processRequestPathValues(nameValues); - rv = getExecutor().get(req2); - if(rv == null) { - return QueryStatus.NOT_FOUND; - } - - response = req2.jsonStringToObject(rv); - if(response == null) { - return QueryStatus.NOT_FOUND; - } - } - - if("nodes-query".equals(resource)) { - SearchResults rd = SearchResults.class.cast(response); - List rdList = rd.getResultData(); - if(rdList == null || rdList.isEmpty()) { - return QueryStatus.NOT_FOUND; - } - ResultData rDatum = rdList.get(0); - response = rDatum; - } - - if("formatted-query".equals(resource) || "custom-query".equals(resource)) { - FormattedQueryResultList rd = FormattedQueryResultList.class.cast(response); - List iRIlist = rd.getResults(); - if(iRIlist == null || iRIlist.isEmpty()) { - return QueryStatus.NOT_FOUND; - } - } - - // process relationship list - // this is a temporary soluton to address the realationship handling changes added in Release 17.07 - try { - Class clazz = response.getClass(); - Method getter = clazz.getMethod("getRelationshipList"); - Object obj = getter.invoke(response); - if(obj != null && obj instanceof RelationshipList) { - RelationshipList list = RelationshipList.class.cast(obj); - AAIServiceUtils.populateRelationshipDataFromPath(list); - } - } catch(Exception exc) { - getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); - } - - String preFix; - if(prefix == null || prefix.isEmpty()) { - preFix = ""; - } else { - preFix = prefix + "."; - } - - Map props = objectToProperties(response); - Set keys = props.keySet(); - for(String theKey: keys) { - if(getLogger().isTraceEnabled()) - getLogger().trace(theKey); - - Object value = props.get(theKey); - if(value == null) - continue; - Object type = value.getClass(); - if(value instanceof String) { - ctx.setAttribute(preFix + theKey, value.toString()); - continue; - } - if(value instanceof Boolean) { - ctx.setAttribute(preFix + theKey, value.toString()); - continue; - } - if(value instanceof Integer) { - ctx.setAttribute(preFix + theKey, value.toString()); - continue; - } - if(value instanceof Long) { - ctx.setAttribute(preFix + theKey, value.toString()); - continue; - } - - if(value instanceof ArrayList) { - ArrayList array = ArrayList.class.cast(value); - for(int i = 0; i < array.size(); i++) { - writeList(array, String.format("%s.%s", prefix, theKey), ctx); - } - continue; - } - - if("relationship-list".equals(theKey)){ - Map relationshipList = (Map)value; - // we are interested in seeing just the selected relationship - if(theKey.equals(modifier)) { - List relationships = (List)relationshipList.get("relationship"); - if(relationships != null && !relationships.isEmpty()) { - - List newRelationships = new LinkedList(); - newRelationships.addAll(relationships); - - for(Object obj : newRelationships){ - if(obj instanceof Map) { - Map relProperties = (Map)obj; - if(relProperties.containsKey("related-to")) { - Object relPropsRelatedTo = relProperties.get("related-to"); - - String relatedTo = nameValues.get("related_to"); - if(relatedTo != null) { - relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", ""); - if(!relatedTo.equals(relPropsRelatedTo)) { - relationships.remove(relProperties); - } - continue; - } else { - continue; - } - } - } - } - } - } - writeMap(relationshipList, String.format("%s.%s", prefix, theKey), ctx); - continue; - } - - if(value instanceof Map) { - Map subnetsList = (Map)value; - writeMap(subnetsList, String.format("%s.%s", prefix, theKey), ctx); - continue; - } - - } - return QueryStatus.SUCCESS; - } - - - public QueryStatus newModelBackupRequest(String resource, Map params, String prefix, SvcLogicContext ctx) { - - QueryStatus retval = QueryStatus.SUCCESS; - HashMap nameValues = new HashMap<>(); - - try { - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); - if(request == null) { - return QueryStatus.FAILURE; - } - - boolean argsFound = false; - String[] arguments = request.getArgsList(); - for(String name : arguments) { - String tmpName = name.replaceAll("-", "_"); - String value = params.get(tmpName); - if(value != null && !value.isEmpty()) { - value = value.trim().replace("'", "").replace("$", "").replace("'", ""); - request.addRequestProperty(name, value); - argsFound = true; - } - } - if(!argsFound) { - getLogger().warn("No arguments were found. Terminating backup request."); - return QueryStatus.FAILURE; - } - - String rv = getExecutor().get(request); - ctx.setAttribute(prefix, rv); - } catch(AAIServiceException aaiexc) { - getLogger().warn(AAI_SERVICE_EXCEPTION, aaiexc); - if(aaiexc.getReturnCode() == 404) - return QueryStatus.NOT_FOUND; - - return QueryStatus.FAILURE; - } catch (Exception exc) { - getLogger().warn("newModelBackupRequest", exc); - return QueryStatus.FAILURE; - } - - return retval; - } - - public AAIDatum newModelObjectRequest(String resource, Map params, String prefix, SvcLogicContext ctx) - throws AAIServiceException { - - AAIDatum response = null; - - try { - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, params); - if(request == null) { - return null; - } - - request.processRequestPathValues(params); - String rv = getExecutor().get(request); - response = request.jsonStringToObject(rv); - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - getLogger().warn("newModelBackupRequest", exc); - throw new AAIServiceException(exc); - } - - return response; - } - - - @Override - public QueryStatus release(String arg0, String arg1, SvcLogicContext arg2) throws SvcLogicException { - throw new SvcLogicException("Method AAIService.release() has not been implemented yet"); - } - - @Override - public QueryStatus reserve(String arg0, String arg1, String arg2, String arg3, SvcLogicContext arg4) - throws SvcLogicException { - throw new SvcLogicException("Method AAIService.reserve() has not been implemented yet"); - } - - private QueryStatus newModelSave(String resource, boolean force, String key, Map params, String prefix, SvcLogicContext ctx) { - getLogger().debug("Executing newModelSave for resource : " + resource); - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - - try { - ArrayList subResources = new ArrayList<>(); - Set set = params.keySet(); - Map setters = new HashMap<>(); - Map getters = new HashMap<>(); - - // 1. find class - AAIRequestLighty request = AAIRequestLighty.createRequest(resource, nameValues); - Class resourceClass = request.getModelClass(); - getLogger().debug(resourceClass.getName()); - AAIDatum instance = resourceClass.newInstance(); - - { - Annotation[] annotations = resourceClass.getAnnotations(); - for(Annotation annotation : annotations) { - Class anotationType = annotation.annotationType(); - String annotationName = anotationType.getName(); - - // 2. find string property setters and getters for the lists - if("javax.xml.bind.annotation.XmlType".equals(annotationName)){ - XmlType order = (XmlType)annotation; - String[] values = order.propOrder(); - for(String value : values) { - String id = AAIServiceUtils.camelCaseToDashedString(value); - Field field = resourceClass.getDeclaredField(value); - Class type = field.getType(); - Method setter = null; - try { - setter = resourceClass.getMethod("set"+StringUtils.capitalize(value), type); - if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName()) || "int".equals(type.getName())) { - try { - Object arglist[] = new Object[1]; - arglist[0] = params.get(id); - - if(arglist[0] != null) { - if(!type.getName().equals("java.lang.String")) { -// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value)); - if("java.lang.Long".equals(type.getName()) || "java.lang.Integer".equals(type.getName())) { - String fv = params.get(id); - if(fv == null || fv.isEmpty()) { - arglist[0] = null; - } else { - arglist[0] = valueOf(type, params.get(id)); - } - } else if("boolean".equals(type.getName())) { - arglist[0] = valueOf(Boolean.class, params.get(id)); - } else if("int".equals(type.getName())) { - arglist[0] = valueOf(Integer.class, params.get(id)); - } else if("long".equals(type.getName())) { - String fv = params.get(id); - if(fv == null || fv.isEmpty()) { - arglist[0] = null; - } else { - arglist[0] = valueOf(Long.class, params.get(id)); - } - } else { - arglist[0] = valueOf(type, params.get(id)); - } - } - Object obj = setter.invoke(instance, arglist); - } - set.remove(id); - - } catch (Exception x) { - Throwable cause = x.getCause(); - getLogger().warn("Failed process for " + resourceClass.getName(), x); - } - } else if("java.util.List".equals(type.getName())) { - List newValues = new ArrayList<>(); - String length = id+"_length"; - if(!params.isEmpty() && params.containsKey(length)) { - String tmp = params.get(length); - int count = Integer.parseInt(tmp); - for(int i=0; i relationshipKeys = new TreeSet<>(); - Set vlansKeys = new TreeSet<>(); - Set metadataKeys = new TreeSet<>(); - - for(String attribute : set) { - String value = params.get(attribute); - if(attribute.startsWith("relationship-list")) { - relationshipKeys.add(attribute); - } else if(attribute.startsWith("vlans")) { - vlansKeys.add(attribute); - } else if(attribute.startsWith("metadata")) { - metadataKeys.add(attribute); - } - } - // 3. find list property getters - for(String attribute : set) { - String value = params.get(attribute); - Method method = getters.get(attribute); - if(method != null) { - try { - Object arglist[] = new Object[0]; -// arglist[0] = value; - Class[] types = method.getParameterTypes(); - if(types.length == 0){ - Object o = method.invoke(instance, arglist); - if(o instanceof ArrayList) { - ArrayList values = (ArrayList)o; - value = value.replace("[", "").replace("]", ""); - List items = Arrays.asList(value.split("\\s*,\\s*")); - for(String s : items) { - values.add(s.trim()); - } - } - } - } catch (Exception x) { - Throwable cause = x.getCause(); - getLogger().warn("Failed process for " + resourceClass.getName(), x); - } - } - } - // 4. Process Relationships - // add relationship list - if( (subResources.contains("relationship-list") || subResources.contains("relationshipList")) && !relationshipKeys.isEmpty()) { - RelationshipList relationshipList = null; - Object obj = null; - Method getRelationshipListMethod = null; - try { - getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); - } catch(Exception exc) { - getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); - } - - if(getRelationshipListMethod != null){ - try { - obj = getRelationshipListMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof RelationshipList){ - relationshipList = (RelationshipList)obj; - } else { - relationshipList = new RelationshipList(); - Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class); - if(setRelationshipListMethod != null){ - try { - Object arglist[] = new Object[1]; - arglist[0] = relationshipList; - - obj = setRelationshipListMethod.invoke(instance, arglist); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - } - - List relationships = relationshipList.getRelationship(); - - int i = 0; - while(true){ - String searchKey = "relationship-list.relationship[" + i + "].related-to"; - if(!params.containsKey(searchKey)) - break; - int j = 0; - String relatedTo = params.get(searchKey); - String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link"; - String relatedLink = null; - if(params.containsKey(relatedLinkKey)) { - relatedLink = params.get(relatedLinkKey); - } - Relationship relationship = new Relationship(); - relationships.add(relationship); - relationship.setRelatedTo(relatedTo); - String relationshipLabel = "relationship-list.relationship[" + i + "].relationship-label"; - if(params.containsKey(searchKey)) { - relationship.setRelationshipLabel(params.get(relationshipLabel)); - } - getLogger().debug("About to process related link of {}", relatedLink); - if(relatedLink != null) { - if(relatedLink.contains("v$")) - relatedLink = relatedLink.replace(VERSION_PATTERN, "/v16/"); - relationship.setRelatedLink(relatedLink); - } else { - Map relParams = new HashMap<>(); - - while(true) { - String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key"; - String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value"; - if(!params.containsKey(searchRelationshipKey)) - break; - - relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue)); - j++; - } - AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams); - for(Map.Entry entry : relParams.entrySet()) { - rlRequest.addRequestProperty(entry.getKey(), entry.getValue()); - } - String path = rlRequest.updatePathDataValues(null); - relationship.setRelatedLink(path); - } - { - int k = 0; - // process related to properties - Map relParams = new HashMap(); - - while(true) { - String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key"; - String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value"; - if(!params.containsKey(searchRelatedToKey)) - break; - - RelatedToProperty relDatum = new RelatedToProperty(); - relDatum.setPropertyKey(params.get(searchRelatedToKey)); - relDatum.setPropertyValue(params.get(searchRelatedToValue)); - relationship.getRelatedToProperty().add(relDatum); - - relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue)); - k++; - } - } - i++; - } - } - - // 4. vlans - if(subResources.contains("vlans") && !vlansKeys.isEmpty()) { - Object obj = null; - Vlans vlanList = null; - Method getVLansMethod = resourceClass.getMethod("getVlans"); - if(getVLansMethod != null){ - try { - obj = getVLansMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof Vlans){ - vlanList = (Vlans)obj; - } else { - vlanList = new Vlans(); - Method setVlansMethod = resourceClass.getMethod("setVlans", Vlans.class); - if(setVlansMethod != null){ - try { - Object arglist[] = new Object[1]; - arglist[0] = vlanList; - - obj = setVlansMethod.invoke(instance, arglist); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - } - - int i = 0; - while(true){ - String searchKey = "vlans.vlan[" + i + "].vlan-interface"; - if(!params.containsKey(searchKey)) - break; - - String vlanInterface = params.get("vlans.vlan[" + i + "].vlan-interface"); - String vlanIdInner = params.get("vlans.vlan[" + i + "].vlan-id-inner"); - String vlanIdOute = params.get("vlans.vlan[" + i + "].vlan-id-outer"); - String speedValue = params.get("vlans.vlan[" + i + "].speed-value"); - String speedUnits = params.get("vlans.vlan[" + i + "].speed-units"); - - Vlan vlan = new Vlan(); - vlan.setVlanInterface(vlanInterface); - - if(vlanIdInner != null) { - Long iVlanIdInner = Long.parseLong(vlanIdInner); - vlan.setVlanIdInner(iVlanIdInner); - } - - if(vlanIdOute != null) { - Long iVlanIdOuter = Long.parseLong(vlanIdOute); - vlan.setVlanIdOuter(iVlanIdOuter); - } - - if(speedValue != null) { - vlan.setSpeedValue(speedValue); - vlan.setSpeedUnits(speedUnits); - } - - vlanList.getVlan().add(vlan); - i++; - } - } - - // 5. metadata - if(subResources.contains("metadata") && !metadataKeys.isEmpty()) { - Object obj = null; - Metadata metadataList = null; - Method getMetadataMethod = resourceClass.getMethod("getMetadata"); - if(getMetadataMethod != null){ - try { - obj = getMetadataMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof Metadata){ - metadataList = (Metadata)obj; - } else { - metadataList = new Metadata(); - Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class); - if(setMetadataMethod != null){ - try { - Object arglist[] = new Object[1]; - arglist[0] = metadataList; - - obj = setMetadataMethod.invoke(instance, arglist); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - } - - // process data - int i = 0; - while(true){ - String metaKey = "metadata.metadatum[" + i + "].meta-key"; - if(!params.containsKey(metaKey)) - break; - - String metaValue = params.get("metadata.metadatum[" + i + "].meta-value"); - - Metadatum vlan = new Metadatum(); - vlan.setMetaname(metaKey); - vlan.setMetaval(metaValue); - - metadataList.getMetadatum().add(vlan); - i++; - } - - } - - - // 6. Prepare AAI request - String[] args = request.getArgsList(); - for(String arg : args) { - String modifiedKey = arg.replaceAll("-", "_"); - if(nameValues.containsKey(modifiedKey)) { - String argValue = nameValues.get(modifiedKey); - if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", ""); - request.addRequestProperty(arg, argValue); - } - } - - request.processRequestPathValues(nameValues); - request.setRequestObject(instance); - Object response = getExecutor().post(request); - if(request.expectsDataFromPUTRequest()){ - if(response != null && response instanceof String) { - String rv = response.toString(); - QueryStatus retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, null); - getLogger().debug("newModelSave - returning " + retval.toString()); - return retval; - } - } - - } catch(AAIServiceException exc){ - ctx.setAttribute(prefix + ".error.message", exc.getMessage()); - int returnCode = exc.getReturnCode(); - if(returnCode >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", - Integer.toString(exc.getReturnCode())); - } - - if(returnCode == 400 || returnCode == 412) - return QueryStatus.FAILURE; - else if(returnCode == 404) - return QueryStatus.NOT_FOUND; - else { - getLogger().warn("Failed newModelSave - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } catch(Exception exc){ - getLogger().warn("Failed newModelSave - returning FAILURE", exc); - ctx.setAttribute(prefix + ".error.message", exc.getMessage()); - return QueryStatus.FAILURE; - } - - getLogger().debug("newModelSave - returning SUCCESS"); - return QueryStatus.SUCCESS; - } - - private QueryStatus newModelProcessRelationshipList(Object instance, Map params, String prefix, SvcLogicContext ctx) throws Exception { - - Class resourceClass = instance.getClass(); - - Set relationshipKeys = new TreeSet<>(); - - Set set = params.keySet(); - - for(String attribute : set) { - String value = params.get(attribute); - - if(attribute.startsWith("relationship-list")) { - relationshipKeys.add(attribute); - } - } - - // 3. Process Relationships - // add relationship list - if(!relationshipKeys.isEmpty()) { - RelationshipList relationshipList; - Object obj = null; - Method getRelationshipListMethod = null; - try { - getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); - } catch(Exception exc) { - getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); - } - if(getRelationshipListMethod != null){ - try { - obj = getRelationshipListMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof RelationshipList){ - relationshipList = (RelationshipList)obj; - } else { - relationshipList = new RelationshipList(); - Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class); - if(setRelationshipListMethod != null){ - try { - Object arglist[] = new Object[1]; - arglist[0] = relationshipList; - - obj = setRelationshipListMethod.invoke(instance, arglist); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - } - - boolean createdNewRelationships = false; - List relationships = relationshipList.getRelationship(); - if(relationships == null) { - relationships = new ArrayList<>(); - createdNewRelationships = true; - } - - int i = 0; - while(true){ - String searchKey = "relationship-list.relationship[" + i + "].related-to"; - if(!params.containsKey(searchKey)) - break; - - String relatedTo = params.get(searchKey); - String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link"; - String relatedLink = null; - if(params.containsKey(relatedLinkKey)) { - relatedLink = params.get(relatedLinkKey); - } - - Relationship relationship = new Relationship(); - relationships.add(relationship); - relationship.setRelatedTo(relatedTo); - - String relationshipLabel = "relationship-list.relationship[" + i + "].relationship-label"; - if(params.containsKey(searchKey)) { - relationship.setRelationshipLabel(params.get(relationshipLabel)); - } - - if (relatedLink != null) { - if(relatedLink.contains("v$")) - relatedLink = relatedLink.replace(VERSION_PATTERN, AAIRequest.getSupportedAAIVersion()); - relationship.setRelatedLink(relatedLink); - } else { - Map relParams = new HashMap<>(); - int j = 0; - - while (true) { - String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" - + j + "].relationship-key"; - String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" - + j + "].relationship-value"; - if (!params.containsKey(searchRelationshipKey)) - break; - - RelationshipData relDatum = new RelationshipData(); - relDatum.setRelationshipKey(params.get(searchRelationshipKey)); - relDatum.setRelationshipValue(params.get(searchRelationshipValue)); - relationship.getRelationshipData().add(relDatum); - - relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue)); - j++; - } - AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams); - for (Map.Entry entry : relParams.entrySet()) { - rlRequest.addRequestProperty(entry.getKey(), entry.getValue()); - } - String path = rlRequest.updatePathDataValues(null); - relationship.setRelatedLink(path); - } - { - int k = 0; - // process related to properties - Map relParams = new HashMap(); - - while(true) { - String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key"; - String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value"; - if(!params.containsKey(searchRelatedToKey)) - break; - - RelatedToProperty relDatum = new RelatedToProperty(); - relDatum.setPropertyKey(params.get(searchRelatedToKey)); - relDatum.setPropertyValue(params.get(searchRelatedToValue)); - relationship.getRelatedToProperty().add(relDatum); - - relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue)); - k++; - } - } - - i++; - } - } - - return QueryStatus.SUCCESS; - } - - private QueryStatus newModelProcessMetadata(Object instance, Map params, String prefix, SvcLogicContext ctx) throws Exception { - - if (!(instance instanceof ServiceInstance) && !(instance instanceof Image)) { - throw new IllegalArgumentException("request is not applicable for selected request"); - } - - Class resourceClass = instance.getClass(); - Set metadataKeys = new TreeSet(); - Set set = params.keySet(); - for(String attribute : set) { - if(attribute.startsWith("metadata")) { - metadataKeys.add(attribute); - } - } - - // 3. Process Metadata - // add metadata - if(!metadataKeys.isEmpty()) { - Metadata metadata = null; - Object obj = null; - Method getMetadataMethod = resourceClass.getMethod("getMetadata"); - if(getMetadataMethod != null){ - try { - obj = getMetadataMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof Metadata){ - metadata = (Metadata)obj; - } else { - metadata = new Metadata(); - Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class); - if(setMetadataMethod != null){ - try { - setMetadataMethod.invoke(instance, metadata); - } catch (InvocationTargetException x) { - } - } - } - - List metadatumList = metadata.getMetadatum(); - int i = 0; - while(true){ - String metaNameKey = "metadata.metadatum[" + i + "].metaname"; - String metaValueKey = "metadata.metadatum[" + i + "].metaval"; - if(!params.containsKey(metaNameKey) || !params.containsKey(metaValueKey)) - break; - - Metadatum metadatum = new Metadatum(); - metadatum.setMetaname(params.get(metaNameKey)); - metadatum.setMetaval(params.get(metaValueKey)); - metadatumList.add(metadatum); - - i++; - } - } - - return QueryStatus.SUCCESS; - } - - private Relationship findRelationship(List relationships, String relatedTo) { - if(relatedTo == null) - return null; - - for(Relationship relationship : relationships) { - if(relationship.getRelatedTo().equals(relatedTo)){ - return relationship; - } - } - return null; - } - - - public QueryStatus backup(Map params, SvcLogicContext ctx) throws SvcLogicException { - String resource = params.get("resource").toLowerCase(); - String prefix = params.get("data-key"); - - HashMap nameValues = new HashMap<>(); - if(AAIRequest.createRequest(resource, nameValues) != null) { - - try { - return newModelBackupRequest(resource, params, prefix, ctx); - } catch (Exception exc) { - getLogger().warn("Failed backup - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } - - return QueryStatus.NOT_FOUND; - } - - @Override - public QueryStatus restore(Map params, SvcLogicContext ctx) throws SvcLogicException { - - QueryStatus retval = QueryStatus.SUCCESS; - String resource = params.get("resource").toLowerCase(); - String prefix = params.get("data-key"); - - HashMap nameValues = new HashMap<>(); - if(AAIRequest.createRequest(resource, nameValues) != null) { - - try { - retval = newModelBackupRequest(resource, params, "tmpRestore", ctx); - if(retval == QueryStatus.SUCCESS) { - ctx.setAttribute("tmpRestore", null); - } - } catch (Exception exc) { - getLogger().warn("Failed restore - returning FAILURE", exc); - return QueryStatus.FAILURE; - } - } - - return QueryStatus.NOT_FOUND; - } - - protected Map objectToProperties(Object object) { - ObjectMapper mapper = AAIService.getObjectMapper(); - return mapper.convertValue(object, Map.class); - } - - static T valueOf(Class klazz, String arg) { - Exception cause = null; - T ret = null; - try { - ret = klazz.cast(klazz.getDeclaredMethod("valueOf", String.class).invoke(null, arg)); - } catch (NoSuchMethodException exc) { - LoggerFactory.getLogger(AAIService.class).warn("Wrong data type", exc); - ret = klazz.cast(arg); - } catch (IllegalAccessException e) { - cause = e; - } catch (InvocationTargetException e) { - cause = e; - } - if (cause == null) { - return ret; - } else { - throw new IllegalArgumentException(cause); - } - } - - private QueryStatus processDeleteRelationshipList(String resource, String key, SvcLogicContext ctx, HashMap nameValues) { - try { - AAIRequest request = AAIRequest.createRequest(resource.split(":")[0], nameValues); - if(request == null) { - return QueryStatus.FAILURE; - } - - request.processRequestPathValues(nameValues); - URL url = request.getRequestUrl("GET", null); - - Class resourceClass = request.getModelClass(); - Object instance = getResource(url.toString(), resourceClass); - if(instance == null) - return QueryStatus.NOT_FOUND; - - // get resource version - String resourceVersion = null; - Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion"); - if(getResourceVersionMethod != null){ - try { - Object object = getResourceVersionMethod.invoke(instance); - if(object != null) - resourceVersion = object.toString(); - } catch (InvocationTargetException exc) { - getLogger().warn("Retrieving resource version", exc); - } - } - - RelationshipList relationshipList = null; - Object obj = null; - Method getRelationshipListMethod = null; - try { - getRelationshipListMethod = resourceClass.getMethod("getRelationshipList"); - } catch(Exception exc) { - getLogger().debug(RELATIONSHIP_DATA + exc.getMessage()); - } - if(getRelationshipListMethod != null){ - try { - obj = getRelationshipListMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof RelationshipList){ - relationshipList = (RelationshipList)obj; - } else { - getLogger().debug("No relationships found to process."); - return QueryStatus.NOT_FOUND; - } - - if(relationshipList.getRelationship() == null || relationshipList.getRelationship().isEmpty()) { - return QueryStatus.NOT_FOUND; - } - String relatedTo = nameValues.get("related_to"); - if(relatedTo == null) { - return QueryStatus.FAILURE; - } - - relatedTo = relatedTo.replaceAll("_", "-"); - - String relatedLink = nameValues.get("relationship.related_link"); - if(relatedLink != null) { - relatedLink = URLDecoder.decode(relatedLink, "UTF-8"); - } - - List relationships = relationshipList.getRelationship(); - List relationshipsToDelete = new LinkedList<>(); - - for(Relationship relationship : relationships) { - if(relatedTo.equals(relationship.getRelatedTo())) { - if(relatedLink != null) { - if(relationship.getRelatedLink() != null ) { - String localRelatedLink = relationship.getRelatedLink(); - localRelatedLink = URLDecoder.decode(localRelatedLink, "UTF-8"); - if(localRelatedLink.endsWith(relatedLink)) { - getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); - relationshipsToDelete.add(relationship); - } - } - } else { - getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); - relationshipsToDelete.add(relationship); - } - } - } - if(relationshipsToDelete == null || relationshipsToDelete.isEmpty()) { - getLogger().info(String.format("Relationship has not been found for %s", key)); - return QueryStatus.NOT_FOUND; - } - - String path = url.toString(); - path = path + "/relationship-list/relationship"; - URL deleteUrl = new URL(path); - - ObjectMapper mapper = AAIService.getObjectMapper(); - - boolean cumulativeResponse = true; - - for(Relationship targetRelationship : relationshipsToDelete) { - String json_text = mapper.writeValueAsString(targetRelationship); - boolean response = deleteList(deleteUrl, json_text); - if(!response) - cumulativeResponse = response; - - } - - if(!cumulativeResponse) - return QueryStatus.FAILURE; - - return QueryStatus.SUCCESS; - - } catch(Exception exc) { - getLogger().warn("processDelete", exc); - return QueryStatus.FAILURE; - } - } - - private QueryStatus processDeleteMetadata(String resource, String key, SvcLogicContext ctx, HashMap nameValues) { - try { - AAIRequest request = AAIRequest.createRequest(resource, nameValues); - if(request == null) { - return QueryStatus.FAILURE; - } - - request.processRequestPathValues(nameValues); - URL url = request.getRequestUrl("GET", null); - - Class resourceClass = request.getModelClass(); - Object instance = getResource(url.toString(), resourceClass); - - // get resource version - String resourceVersion = null; - Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion"); - if(getResourceVersionMethod != null){ - try { - resourceVersion = (String) getResourceVersionMethod.invoke(instance); - } catch (InvocationTargetException x) { - } - } - - Metadata metadata = null; - Object obj = null; - Method getMetadataMethod = resourceClass.getMethod("getMetadata"); - if(getMetadataMethod != null){ - try { - obj = getMetadataMethod.invoke(instance); - } catch (InvocationTargetException x) { - Throwable cause = x.getCause(); - } - } - if(obj != null && obj instanceof Metadata){ - metadata = (Metadata)obj; - } else { - getLogger().debug("No metadata found to process."); - return QueryStatus.NOT_FOUND; - } - - if(metadata.getMetadatum() == null || metadata.getMetadatum().isEmpty()) { - return QueryStatus.NOT_FOUND; - } - - List metadatumList = metadata.getMetadatum(); - Metadatum metadatumToDelete = null; - - final String metaname = nameValues.get("metaname"); - - for(Metadatum metadatum : metadatumList) { - getLogger().debug(String.format("Comparing existing metadatum of '%s' to keyword '%s'", metadatum.getMetaname(), metaname)); - if(metaname.equals(metadatum.getMetaname())) { - metadatumToDelete = metadatum; - break; - } - } - if(metadatumToDelete == null) { - getLogger().info(String.format("Metadatum has not been found for %s", key)); - return QueryStatus.NOT_FOUND; - } - - String path = url.toString(); - path = path + "/metadata/metadatum/" + encodeQuery( metadatumToDelete.getMetaname() ) + - "?resource-version=" + metadatumToDelete.getResourceVersion(); - URL deleteUrl = new URL(path); - boolean response = deleteList(deleteUrl, null); - - if(!response) - return QueryStatus.FAILURE; - - return QueryStatus.SUCCESS; - - } catch(Exception exc) { - getLogger().warn("processDelete", exc); - return QueryStatus.FAILURE; - } - } - - protected String encodeQuery(String param) throws UnsupportedEncodingException { - return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); - } - - static final Map ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) { - Map tmpPrefixMap = new HashMap<>(); - - if(prefix == null || prefix.isEmpty()){ - return tmpPrefixMap; - } - - for( String key : ctx.getAttributeKeySet() ) { - if( key.startsWith(prefix) ) { - String tmpKey = key.substring(prefix.length() + 1); - tmpPrefixMap.put( tmpKey, ctx.getAttribute(key)); - } - } - - Map prefixMap = new HashMap<>(); - Pattern p = Pattern.compile(".*\\[\\d\\]"); - - SortedSet keys = new TreeSet(tmpPrefixMap.keySet () ); - for(String key : keys) { - Matcher m = p.matcher(key); - if(m.matches()) { - continue; - } else if(key.endsWith("_length")) { - String listKey = key.substring(0, key.indexOf("_length")); - int max = Integer.parseInt(tmpPrefixMap.get(key)); - - ArrayList data = new ArrayList<>(); - for(int x = 0; x < max; x++){ - String tmpKey = String.format("%s[%d]", listKey, x); - String tmpValue = tmpPrefixMap.get(tmpKey); - if(tmpValue != null && !tmpValue.isEmpty()) { - data.add(tmpValue); - } - } - if(!data.isEmpty()) { - prefixMap.put(listKey, data.toString()); - } else { - prefixMap.put(key, tmpPrefixMap.get(key)); - } - } else { - prefixMap.put(key, tmpPrefixMap.get(key)); - } - } - - return prefixMap; - } - - public abstract T getResource(String key, Class type) throws AAIServiceException ; - protected abstract boolean deleteList(URL url, String caller) throws AAIServiceException; -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.java deleted file mode 100755 index d2c3812a1..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterfaceLighty.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========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -/** - * THIS CLASS IS A COPY OF {@link AAIExecutorInterface} WITH REMOVED OSGi DEPENDENCIES - */ -public interface AAIExecutorInterfaceLighty { - public String get(AAIRequestLighty request) throws AAIServiceException; - public String post(AAIRequestLighty request) throws AAIServiceException; - public Boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; - public Object query(AAIRequestLighty request, Class clas) throws AAIServiceException; - public Boolean patch(AAIRequestLighty request, String resourceVersion) throws AAIServiceException; -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java deleted file mode 100755 index 81acfca59..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequestLighty.java +++ /dev/null @@ -1,470 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.BitSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.TreeSet; -import org.apache.commons.lang.StringUtils; -import org.onap.aai.inventory.v16.GenericVnf; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AAIRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public abstract class AAIRequestLighty { - protected static final Logger LOG = LoggerFactory.getLogger(AAIRequestLighty.class); - - protected static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri"; - - protected static final String MASTER_REQUEST = "master-request"; - - public static final String RESOURCE_VERSION = "resource-version"; - - public static final String DEPTH = "depth"; - - protected static Properties configProperties; - protected final String targetUri; - protected static AAIServiceLighty aaiService; - - protected AAIDatum requestDatum; - - protected final Properties requestProperties = new Properties(); - - - public static AAIRequestLighty createRequest(String resoourceName, Map nameValues){ - - String resoource = resoourceName; - String masterResource = null; - - if(resoource == null) - return null; - - if(resoource.contains(":")) { - String[] tokens = resoource.split(":"); - if(tokens != null && tokens.length == 2) { - resoource = tokens[1]; - masterResource = tokens[0]; - Class clazz = getClassFromResource(resoource) ; - - if(clazz == null) { - return null; - } - } - } - - if(nameValues.containsKey("selflink")){ - Class clazz = getClassFromResource(resoource) ; - - if(clazz != null) - return new SelfLinkRequestLighty(clazz); - else - return null; - } - - switch(resoource){ - case "generic-query": - return new GenericQueryRequestLighty(); - case "nodes-query": - return new NodesQueryRequestLighty(); - case "custom-query": - case "formatted-query": - return new CustomQueryRequestLighty(); - case "echo": - case "test": - return new EchoRequestLighty(); - - case "linterface": - case "l2-bridge-sbg": - case "l2-bridge-bgf": - { - resoource = "l-interface"; - return getRequestFromResource("l-interface"); - } - case "relationship-list": - return new RelationshipListRequestLighty( - AAIRequestLighty.createRequest(masterResource, nameValues)); - case "relationship": - return new RelationshipRequestLighty( - AAIRequestLighty.createRequest(masterResource, nameValues)); - default: - return getRequestFromResource(resoource); - } - } - - - /** - * Map containing resource tag to its bit position in bitset mapping - */ - private static Map tagValues = new LinkedHashMap<>(); - /** - * Map containing bitset value of the path to its path mapping - */ - private static Map bitsetPaths = new LinkedHashMap<>(); - - - public static Set getResourceNames() { - return tagValues.keySet(); - } - - - public static void setProperties(Properties props, AAIServiceLighty aaiService) { - AAIRequestLighty.configProperties = props; - AAIRequestLighty.aaiService = aaiService; - - try - { - URL url = aaiService.getClass().getResource("/aai-path.properties"); - - InputStream in = url.openStream(); - Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8); - - Properties properties = new Properties(); - properties.load(reader); - LOG.info("loaded " + properties.size()); - - Set keys = properties.stringPropertyNames(); - - int index = 0; - Set resourceNames = new TreeSet<>(); - - for(String key : keys) { - String[] tags = key.split("\\|"); - for(String tag : tags) { - if(!resourceNames.contains(tag)) { - resourceNames.add(tag); - tagValues.put(tag, Integer.toString(++index)); - } - } - BitSet bs = new BitSet(256); - for(String tag : tags) { - String value = tagValues.get(tag); - Integer bitIndex = Integer.parseInt(value) ; - bs.set(bitIndex); - } - String path = properties.getProperty(key); - LOG.info(String.format("bitset %s\t\t%s", bs.toString(), path)); - bitsetPaths.put(bs, path); - } - LOG.info("loaded " + resourceNames.toString()); - } - catch (Exception e) - { - LOG.error("Caught exception", e); - } - } - - public AAIRequestLighty() { - targetUri = configProperties.getProperty(TARGET_URI); - } - - public void addRequestProperty(String key, String value) { - requestProperties.put(key, value); - } - - public final void setRequestObject(AAIDatum value) { - requestDatum = value; - } - - public final AAIDatum getRequestObject() { - return requestDatum; - } - - public final void addMasterRequest(AAIRequestLighty masterRequest) { - requestProperties.put(MASTER_REQUEST, masterRequest); - } - - protected static String encodeQuery(String param) throws UnsupportedEncodingException { - return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); - } - - protected void handleException(AAIRequestLighty lInterfaceRequest, JsonProcessingException exc) { - aaiService.getLogger().warn("Could not deserialize object of type " + lInterfaceRequest.getClass().getSimpleName(), exc) ; - } - - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - - String request_url = null; - - request_url = targetUri + updatePathDataValues(resourceVersion); - - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - - return http_req_url; - } - - public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - String request_url = getRequestPath(); - - Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); - - for(String resoourceName:uniqueResources) { - AAIRequestLighty - locRequest = AAIRequestLighty.createRequest(resoourceName, new HashMap()); - if(locRequest != null) { - Class clazz = locRequest.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) { - LOG.error("Caught exception", e); - } - } - } - - if(resourceVersion != null) { - request_url = request_url +"?resource-version="+resourceVersion; - } - - return request_url; - } - - protected String getRequestPath() throws MalformedURLException { - return getRequestPath(null); - } - - protected String getRequestPath(String resource) throws MalformedURLException { - if(requestProperties.containsKey("resource-path")) { - return requestProperties.getProperty("resource-path"); - } - - Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); - if(resource != null) { - // for group search add itself, but remove singular version of itself - if(!uniqueResources.contains(resource)) { - boolean replaced = false; - Set tmpUniqueResources = new HashSet<>(); - tmpUniqueResources.addAll(uniqueResources); - for(String item : tmpUniqueResources){ - String plural = item +"s"; - if(item.endsWith("y")){ - plural = item.substring(0, item.length()-1)+ "ies"; - } - if(plural.equals(resource)) { - uniqueResources.remove(item); - uniqueResources.add(resource); - replaced = true; - break; - } - } - if(!replaced){ - if(!uniqueResources.contains(resource)) { - uniqueResources.add(resource); - } - } - } - } - BitSet bitset = new BitSet(); - for(String key : uniqueResources) { - if(tagValues.containsKey(key)) { - Object tmpValue = tagValues.get(key); - if(tmpValue != null) { - String value = tmpValue.toString(); - int bitIndex = Integer.parseInt(value); - bitset.set(bitIndex); - } - } - } - - String path = bitsetPaths.get(bitset); - if(path == null) { - throw new MalformedURLException("PATH not found for key string containing valies :" +requestProperties.toString()); - } - return path; - } - - public abstract URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException; - - public abstract String toJSONString(); - - public abstract String[] getArgsList(); - - public abstract Class getModelClass() ; - - public String getPrimaryResourceName(String resource) { - return resource; - } - - public String formatKey(String argument) { - return argument; - } - - public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException { - if(jsonData == null) { - return null; - } - - AAIDatum response = null; - ObjectMapper mapper = getObjectMapper(); - response = mapper.readValue(jsonData, getModelClass()); - return response; - } - - protected static Set extractUniqueResourceSetFromKeys(Set keySet) { - Set uniqueResources = new TreeSet<>(); - List keys = new ArrayList<>(keySet); - for(String resource : keys) { - if(resource.contains(".")) { - String [] split = resource.split("\\."); - uniqueResources.add(split[0].replaceAll("_", "-")); - } - } - return uniqueResources; - } - - public void processRequestPathValues(Map nameValues) { - Set uniqueResources = extractUniqueResourceSetFromKeys(nameValues.keySet()); - - Set tokens = new TreeSet<>(); - tokens.add(DEPTH); - tokens.addAll(Arrays.asList(this.getArgsList())); - - for(String resoourceName:uniqueResources) { - AAIRequestLighty - locRequest = AAIRequestLighty.createRequest(resoourceName, nameValues); - if(locRequest != null) - tokens.addAll(Arrays.asList(locRequest.getArgsList())); - } - - String[] arguments = tokens.toArray(new String[0]); - for(String name : arguments) { - String tmpName = name.replaceAll("-", "_"); - String value = nameValues.get(tmpName); - if(value != null && !value.isEmpty()) { - value = value.trim().replace("'", "").replace("$", "").replace("'", ""); - this.addRequestProperty(name, value); - } - } - } - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - return request_url; - } - - public boolean isDeleteDataRequired() { - return false; - } - - ObjectMapper getObjectMapper() { - return AAIService.getObjectMapper(); - } - - public static Class getClassFromResource(String resoourceName) { - String className = GenericVnf.class.getName(); - String[] split = resoourceName.split("-"); - for(int i = 0; i < split.length; i++) { - split[i] = StringUtils.capitalize(split[i]); - } - - String caps = StringUtils.join(split); - className = className.replace("GenericVnf", caps); - try { - return (Class)Class.forName(className); - } catch (ClassNotFoundException e) { - LOG.warn("AAIRequestLighty does not support class: " + e.getMessage()); - return null; - } - } - - protected static AAIRequestLighty getRequestFromResource(String resoourceName) { - - Class clazz = getClassFromResource(resoourceName); - - if(clazz == null) { - return null; - } - return new GenericRequestLighty(clazz); - } - - public static Map splitQuery(String query) throws UnsupportedEncodingException { - Map query_pairs = new LinkedHashMap<>(); - - if(query != null && !query.isEmpty()) { - String[] pairs = query.split("&"); - for (String pair : pairs) { - int idx = pair.indexOf('='); - query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); - } - } - return query_pairs; - } - - public static Map splitPath(String path) throws UnsupportedEncodingException { - Map query_pairs = new LinkedHashMap<>(); - - if(path != null && !path.isEmpty()) { - String[] pairs = path.split("/"); - for (String pair : pairs) { - int idx = pair.indexOf('='); - query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); - } - } - return query_pairs; - } - - protected boolean expectsDataFromPUTRequest() { - return false; - } - - - public String getTargetUri() { - return targetUri; - } - - public static final String getSupportedAAIVersion() { - return configProperties.getProperty(AAIDeclarations.AAI_VERSION, "/v16/"); - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java deleted file mode 100755 index bd9115b64..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceLighty.java +++ /dev/null @@ -1,1545 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2019 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.NoSuchAlgorithmException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.Set; -import java.util.TimeZone; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLSocketFactory; -import javax.ws.rs.HttpMethod; -import javax.xml.bind.annotation.XmlElement; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.StringUtils; -import org.onap.aai.inventory.v16.GenericVnf; -import org.onap.aai.inventory.v16.PhysicalLink; -import org.onap.aai.inventory.v16.ResultData; -import org.onap.aai.inventory.v16.SearchResults; -import org.onap.aai.inventory.v16.Vserver; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; -import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.sli.MetricLogger; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; - -/** - * THIS CLASS IS A COPY OF {@link AAIService} WITH REMOVED OSGi DEPENDENCIES - */ -public class AAIServiceLighty extends AAIDeclarationsLighty implements AAIClientLighty, SvcLogicResource { - - public static final String AAICLIENT_PROPERTIES = "/aaiclient.properties"; - public static final String PATH_PROPERTIES = "/aai-path.properties"; - - private static final Logger LOG = LoggerFactory.getLogger(AAIServiceLighty.class); - - private final String truststorePath; - private final String truststorePassword; - private final String keystorePath; - private final String keystorePassword; - private final Boolean ignoreCertificateHostError; - - private final String targetUri; - private final String networkVserverPath; - - private final String svc_inst_query_path; - - private final String ubb_notify_path; - private final String selflinkAvpn; - private final String selflinkFqdn; - - private final int connectionTimeout; - private final int readTimeout; - - // 1602 - private final String queryNodesPath; - private final String applicationId; - - // authentication credentials - private String userName; - private String userPassword; - - // runtime - private final boolean runtimeOSGI; - - private SSLContext CTX; - - private final MetricLogger ml = new MetricLogger(); - - private AAIExecutorInterfaceLighty executor; - - public AAIServiceLighty(final UtilsProvider configuration) { - this(configuration.getProperties()); - } - - public AAIServiceLighty(final URL url) { - this(getProperties(url)); - } - - public AAIServiceLighty(Properties props) { - LOG.info("Entered AAIService.ctor"); - - String runtime = System.getProperty("aaiclient.runtime"); - if("OSGI".equals(runtime)) { - runtimeOSGI = true; - } else { - runtimeOSGI = false; - } - - try { - AAIRequestLighty.setProperties(props, this); - - } catch(Exception exc){ - LOG.error("AicAAIResource.static", exc); - } - - executor = new AAIClientRESTExecutorLighty(props); - - userName = props.getProperty(CLIENT_NAME); - userPassword = props.getProperty(CLIENT_PWWD); - - if(userName == null || userName.isEmpty()){ - LOG.debug("Basic user name is not set"); - } - if(userPassword == null || userPassword.isEmpty()) { - LOG.debug("Basic password is not set"); - } - - truststorePath = props.getProperty(TRUSTSTORE_PATH); - truststorePassword = props.getProperty(TRUSTSTORE_PSSWD); - keystorePath = props.getProperty(KEYSTORE_PATH); - keystorePassword = props.getProperty(KEYSTORE_PSSWD); - - targetUri = props.getProperty(TARGET_URI); - props.getProperty(QUERY_PATH); - props.getProperty(UPDATE_PATH); - - String tmpApplicationId = props.getProperty(APPLICATION_ID); - if(tmpApplicationId == null || tmpApplicationId.isEmpty()) { - tmpApplicationId = "SDNC"; - } - this.applicationId = tmpApplicationId; - - // connection timeout - int tmpConnectionTimeout = 30000; - int tmpReadTimeout = 30000; - - try { - String tmpValue = null; - tmpValue = props.getProperty(CONNECTION_TIMEOUT, "30000"); - tmpConnectionTimeout = Integer.parseInt(tmpValue); - tmpValue = props.getProperty(READ_TIMEOUT, "30000"); - tmpReadTimeout = Integer.parseInt(tmpValue); - } catch(Exception exc) { - LOG.error("Failed setting connection timeout", exc); - tmpConnectionTimeout = 30000; - tmpReadTimeout = 30000; - } - connectionTimeout = tmpConnectionTimeout; - readTimeout = tmpReadTimeout; - - networkVserverPath =props.getProperty(NETWORK_VSERVER_PATH); - - props.getProperty(SVC_INSTANCE_PATH); - svc_inst_query_path = props.getProperty(SVC_INST_QRY_PATH); - props.getProperty(PARAM_SERVICE_TYPE, "service-type"); - - props.getProperty(VNF_IMAGE_QUERY_PATH); - - ubb_notify_path = props.getProperty(UBB_NOTIFY_PATH); - selflinkAvpn = props.getProperty(SELFLINK_AVPN); - selflinkFqdn = props.getProperty(SELFLINK_FQDN); - - props.getProperty(SERVICE_PATH); - - props.getProperty(SITE_PAIR_SET_PATH); - - queryNodesPath = props.getProperty(QUERY_NODES_PATH); - - String iche = props.getProperty(CERTIFICATE_HOST_ERROR); - boolean host_error = false; - if(iche != null && !iche.isEmpty()) { - host_error = Boolean.valueOf(iche); - } - - ignoreCertificateHostError = host_error; - - HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){ - public boolean verify(String string,SSLSession ssls) { - return ignoreCertificateHostError; - } - }); - - if(truststorePath != null && truststorePassword != null && (new File(truststorePath)).exists()) { - System.setProperty("javax.net.ssl.trustStore", truststorePath); - System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword); - } - - if(keystorePath != null && keystorePassword != null && (new File(keystorePath)).exists()) { - //DefaultClientConfig config = new DefaultClientConfig(); - //both jersey and HttpURLConnection can use this - SSLContext ctx = null; - try { - ctx = SSLContext.getInstance("TLS"); - - KeyManagerFactory kmf = null; - try (FileInputStream fin = new FileInputStream(keystorePath)){ - String def = "SunX509"; - String storeType = "PKCS12"; - def = KeyStore.getDefaultType(); - kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - - String extension = keystorePath.substring(keystorePath.lastIndexOf(".") + 1); - if("JKS".equalsIgnoreCase(extension)) { - storeType = "JKS"; - } - KeyStore ks = KeyStore.getInstance(storeType); - - char[] pwd = keystorePassword.toCharArray(); - ks.load(fin, pwd); - kmf.init(ks, pwd); - } catch (Exception ex) { - LOG.error("AAIResource", ex); - } - - if(null!=kmf) { - ctx.init(kmf.getKeyManagers(), null, null); - } - /* - * config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new - * HTTPSProperties( new HostnameVerifier() { - * - * @Override public boolean verify( String s, SSLSession sslSession ) { return - * ignoreCertificateHostError; } }, ctx)); - */ - - CTX = ctx; - LOG.debug("SSLContext created"); - - } catch (KeyManagementException | NoSuchAlgorithmException exc) { - LOG.error("AAIResource", exc); - } - } - - LOG.info("AAIResource.ctor initialized."); - - try { - Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); - methodsField.setAccessible(true); - // get the methods field modifiers - Field modifiersField = Field.class.getDeclaredField("modifiers"); - // bypass the "private" modifier - modifiersField.setAccessible(true); - - // remove the "final" modifier - modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); - - /* valid HTTP methods */ - String[] methods = { - "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE", "PATCH" - }; - // set the new methods - including patch - methodsField.set(null, methods); - - } catch (SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { - LOG.error("Exception occured", e); - } - - } - - private static Properties getProperties(URL url) { - Properties properties = new Properties(); - try { - properties.load(url.openStream()); - } catch (IOException exc) { - LOG.error("getProperties", exc); - } - return properties; - } - - public void setExecutor(AAIExecutorInterfaceLighty executor) { - this.executor = executor; - } - - public void cleanUp() { - - } - - /** - * - * @param http_req_url - * @param method - * @return - * @throws Exception - */ - protected HttpURLConnection getConfiguredConnection(URL http_req_url, String method) throws Exception { - HttpURLConnection con = (HttpURLConnection) http_req_url.openConnection(); - - // Set up the connection properties - con.setRequestProperty( "Connection", "close" ); - con.setDoInput(true); - con.setDoOutput(true); - con.setUseCaches(false); - con.setConnectTimeout( connectionTimeout ); - con.setReadTimeout( readTimeout ); - con.setRequestMethod( method ); - con.setRequestProperty( "Accept", "application/json" ); - con.setRequestProperty( "Content-Type", "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json" ); - con.setRequestProperty("X-FromAppId", applicationId); - con.setRequestProperty("X-TransactionId", TransactionIdTracker.getNextTransactionId()); - String mlId = ml.getRequestID(); - if(mlId != null && !mlId.isEmpty()) { - LOG.debug(String.format("MetricLogger requestId = %s", mlId)); - con.setRequestProperty(MetricLogger.REQUEST_ID, mlId); - } else { - LOG.debug("MetricLogger requestId is null"); - } - con.setRequestProperty("Transfer-Encoding","chunked"); - - if(userName != null && !userName.isEmpty() && userPassword != null && !userPassword.isEmpty()) { - String basicAuth = "Basic " + new String(Base64.encodeBase64((userName + ":" + userPassword).getBytes())); - con.setRequestProperty ("Authorization", basicAuth); - } - - if(con instanceof HttpsURLConnection && CTX != null) { - SSLSocketFactory sockFact = CTX.getSocketFactory(); - HttpsURLConnection.class.cast(con).setSSLSocketFactory( sockFact ); - } - return con; - } - - - @Override - public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException { - GenericVnf response = null; - - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("generic-vnf"); - request.addRequestProperty("generic-vnf.vnf-id", vnf_id); - String rv = executor.get(request); - if(rv != null) { - ObjectMapper mapper = getObjectMapper(); - response = mapper.readValue(rv, GenericVnf.class); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); - throw new AAIServiceException(exc); - } - - return response; - - } - - @Override - public boolean postGenericVnfData(String vnf_id, GenericVnf data) throws AAIServiceException { - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("generic-vnf"); - request.addRequestProperty("generic-vnf.vnf-id", vnf_id); - request.setRequestObject(data); - Object response = executor.post(request); - return true; - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("requestGenericVnfData", exc); - throw new AAIServiceException(exc); - } - } - - @Override - public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException { - SearchResults response = null; - InputStream inputStream = null; - - try { - String path = svc_inst_query_path; - path = path.replace("{svc-instance-id}", encodeQuery(svc_instance_id)); - - String request_url = targetUri+path; - URL http_req_url = new URL(request_url); - - HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); - - LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); - LOGwriteDateTrace("svc_instance_id", svc_instance_id); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - LOG.debug("HttpURLConnection result:" + responseCode); - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - - ObjectMapper mapper = getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK) { - response = mapper.readValue(reader, SearchResults.class); - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); - } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); - return response; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("requestServiceInstanceURL", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("Error closing Inputstream", exc); - } - } - } - return response; - } - - - private static Properties initialize(URL url ) throws ConfigurationException { - - if(url == null) { - throw new NullPointerException(); - } - - InputStream is = null; - Properties props = new Properties(); - - try { - if(LOG.isDebugEnabled()) - LOG.info("Property file is: " + url.toString()); - - is = url.openStream(); - - props.load(is); - if(LOG.isDebugEnabled()) { - LOG.info("Properties loaded: " + props.size()); - Enumeration en = props.keys(); - - while(en.hasMoreElements()) { - String key = (String)en.nextElement(); - String property = props.getProperty(key); - LOG.debug(key + " : " + property); - } - } - } catch (Exception e) { - throw new ConfigurationException("Could not load properties file.", e); - } - return props; - } - - static class TransactionIdTracker { -// protected static AtomicLong tracker = new AtomicLong(); - - public static String getNextTransactionId() { - // Check if RequestId exists as MDC. If not, create new. - String transactionId = MDC.get("RequestId"); - if ("".equals(transactionId) || transactionId == null) { - transactionId = UUID.randomUUID().toString(); - LOG.info("Missing requestID. Assigned " + transactionId); - MDC.put("RequestId", transactionId); - } - return transactionId; - } - - } - - protected void LOGwriteFirstTrace(String method, String url) { - String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis()); - LOG.info("A&AI transaction :"); - LOG.info("Request Time : " + time + ", Method : " + method); - LOG.info("Request URL : "+ url); - } - - protected void LOGwriteDateTrace(String name, String data) { - LOG.info("Input - " + name + " : " + data); - } - - protected void LOGwriteEndingTrace(int response_code, String comment, String data) { - LOG.info("Response code : " + response_code +", " + comment); - LOG.info(String.format("Response data : %s", data)); - } - - protected String encodeQuery(String param) throws UnsupportedEncodingException { - return URLEncoder.encode(param, "UTF-8").replace("+", "%20"); - } - - private String encodeCustomerURL(final String selection) - { - String encrypted_url = selection; - String apnpattern = - "/aai/v11/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/"; - Pattern pattern = Pattern.compile(apnpattern); - - try { - URL url = new URL(selection); - String path = url.getPath(); - - LOG.info("Trying to match apn to <" + path + ">"); - - Matcher matcher = pattern.matcher(path); - - while(matcher.find()) { - String customer = matcher.group(1); - String subscription = matcher.group(2); - String service = matcher.group(3); - - encrypted_url = selection.replace(customer, encodeQuery(customer)); - encrypted_url = encrypted_url.replace(subscription, encodeQuery(subscription)); - encrypted_url = encrypted_url.replace(service, encodeQuery(service)); - } - } catch (Exception e) { - LOG.warn("", e); - } - - return encrypted_url; - } - - - - /* - * (non-Javadoc) - * @see org.onap.sdnct.sli.aai.AAIClient#requestVServersData(java.lang.String, java.lang.String) - */ - @Override - public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException { - Vserver response = null; - - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("vserver"); - request.addRequestProperty("cloud-region.cloud-owner", cloudOwner); - request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId); - request.addRequestProperty("tenant.tenant-id", tenantId); - request.addRequestProperty("vserver.vserver-id", vserverId); - - String rv = executor.get(request); - if(rv != null) { - ObjectMapper mapper = getObjectMapper(); - response = mapper.readValue(rv, Vserver.class); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); - throw new AAIServiceException(exc); - } - return response; - } - - - //================== End of DvsSwitch ================= - //==================== PhysicalLink ====================== - @Override - public PhysicalLink requestPhysicalLinkData(String linkName) throws AAIServiceException { - PhysicalLink response = null; - - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); - request.addRequestProperty("physical-link.link-name", linkName); - - String rv = executor.get(request); - if(rv != null) { - ObjectMapper mapper = getObjectMapper(); - response = mapper.readValue(rv, PhysicalLink.class); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("requestPhysicalLinkData", exc); - throw new AAIServiceException(exc); - } - return response; - } - - @Override - public boolean postPhysicalLinkData(String linkName, PhysicalLink data) throws AAIServiceException { - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); - request.addRequestProperty("physical-link.link-name", linkName); - request.setRequestObject(data); - Object response = executor.post(request); - return true; - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc); - throw new AAIServiceException(exc); - } - } - - @Override - public boolean deletePhysicalLinkData(String linkName, String resourceVersion) throws AAIServiceException { - boolean response = false; - - try { - AAIRequestLighty request = AAIRequestLighty.getRequestFromResource("physical-link"); - request.addRequestProperty("physical-link.link-name", linkName); - response = executor.delete(request, resourceVersion); - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("deletePhysicalLinkData", exc); - throw new AAIServiceException(exc); - } - return response; - } - - public boolean deleteAAIEntity(URL url, String caller) throws AAIServiceException { - - if(url == null) { - throw new NullPointerException(); - } - - boolean response = false; - InputStream inputStream = null; - - try { - URL http_req_url = url; - - HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.DELETE); - - LOGwriteFirstTrace("DELETE", http_req_url.toString()); - - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - LOG.debug("HttpURLConnection result:" + responseCode); - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - String line = null; - - ObjectMapper mapper = getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString()); - response = true; - } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); - response = false; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn(caller, exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("Error closing InputStream", exc); - } - } - } - return response; - } - - /** - * Generic method to GET json data from an A&AI callback URL. - * Then convert that json to an Object. - * If successful the Object is attempted to be cast to the type parameter. - * - * @param key - * callback url for A&AI - * @param type - * the class of object that A&AI will return - * @return the object created from json or null if the response code is not 200 - * - * @throws AAIServiceException - * if empty or null key and or type or there's an error with processing - */ - public T dataChangeRequestAaiData(String key, Class type) throws AAIServiceException { - if (StringUtils.isEmpty(key) || type == null) { - throw new AAIServiceException("Key is empty or null and or type is null"); - } - - T response = null; - - SvcLogicContext ctx = new SvcLogicContext(); - if(!key.contains(" = ") && isValidURL(key)) { - key = String.format("selflink = '%s'", key); - } else - if(!key.contains(" = ") && isValidURI(key)) { - key = String.format("resource-path = '%s'", key); - } - - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - - SelfLinkRequestLighty request = new SelfLinkRequestLighty(type); - request.processRequestPathValues(nameValues); - Object obj = this.getExecutor().query(request, type); - response = type.cast(obj); - - return response != null ? type.cast(response) : response; - } - - - public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException { - InputStream inputStream = null; - - try { - - String selfLink = selflinkFqdn; - if(SELFLINK_AVPN != null && SELFLINK_AVPN.equals(pathCode)) { - selfLink = selflinkAvpn; - } - selfLink = selfLink.replace("{service-instance-id}", encodeQuery(serviceInstanceId)); - event.setSelflink(selfLink); - - ObjectMapper mapper = getObjectMapper(); - String json_text = mapper.writeValueAsString(event); - - SSLSocketFactory sockFact = CTX.getSocketFactory(); - - String request_url = targetUri+ubb_notify_path; - URL http_req_url = new URL(request_url); - - HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT); - - if (json_text != null) { - OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); - osw.write(json_text); - osw.flush(); - osw.close(); - } - - LOGwriteFirstTrace("PUT", request_url); - LOGwriteDateTrace("NotifyEvent", json_text); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - BufferedReader reader; - String line = null; - reader = new BufferedReader( new InputStreamReader( inputStream ) ); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : - "{no-data}"); - return true; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - - throw new AAIServiceException(responseCode, errorresponse); - } - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("sendNotify", exc); - throw new AAIServiceException(exc); - } finally { - try { - if(inputStream != null) - inputStream.close(); - } catch (Exception exc) { - LOG.warn("Error closing Input stream", exc); - } - } - } - - @Override - public SearchResults requestNodeQuery(String node_type, String entityIdentifier, String entityName) throws AAIServiceException { - SearchResults response = null; - InputStream inputStream = null; - - try { - String request_url = targetUri+queryNodesPath; - request_url = request_url.replace("{node-type}", encodeQuery(node_type)) ; - request_url = request_url.replace("{entity-identifier}", entityIdentifier) ; - request_url = request_url.replace("{entity-name}", encodeQuery(entityName)) ; - URL http_req_url = new URL(request_url); - - HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); - - LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); - LOGwriteDateTrace("node_type", node_type); - LOGwriteDateTrace("vnf_name", entityName); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - LOG.debug("HttpURLConnection result:" + responseCode); - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - - ObjectMapper mapper = getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK) { - response = mapper.readValue(reader, SearchResults.class); - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); - } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); - return response; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("requestNodeQuery", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("Error closing Input stream", exc); - } - } - } - return response; - - } - - - @Override - public String requestDataByURL(URL url) throws AAIServiceException { - - if(url == null) { - throw new NullPointerException(); - } - - String response = null; - InputStream inputStream = null; - - try { - URL http_req_url = url; - - HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); - - LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - LOG.debug("HttpURLConnection result:" + responseCode); - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - - ObjectMapper mapper = getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK) { - StringBuilder stringBuilder = new StringBuilder("\n"); - String line = null; - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOG.info(stringBuilder.toString()); -// response = mapper.readValue(reader, String.class); - response = stringBuilder.toString(); - LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); - } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); - response = null; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("requestNetworkVceData", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - LOG.warn("Error closing Input stream", exc); - } - } - } - return response; - } - - - @Override - public GenericVnf requestGenericVnfeNodeQuery(String vnf_name) throws AAIServiceException { - - if(vnf_name == null) { - throw new NullPointerException(); - } - - GenericVnf entity = null; - SearchResults resp = this.requestNodeQuery("generic-vnf", "vnf-name", vnf_name); - - List resultDataList = resp.getResultData(); - - try { - for (ResultData datum : resultDataList) { - URI url = new URI(datum.getResourceLink()); - entity = this.getResource(url.toString(), GenericVnf.class); - } - } - catch (Exception e) - { - LOG.error("Caught exception", e); - } - return entity; - } - - @Override - public Vserver requestVServerDataByURL(URL url) throws AAIServiceException { - - if(url == null) { - throw new NullPointerException(); - } - - Vserver entity = null; - - try { - entity = this.getResource(url.toString(), Vserver.class); - } catch (AAIServiceException exc) { - throw exc; - } catch (Exception e) { - throw new AAIServiceException(e); - } - return entity; - } - - @Override - public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException { - - if(vserver_name == null) { - throw new NullPointerException(); - } - - URL entity = null; - SearchResults resp = this.requestNodeQuery("vserver", "vserver-name", vserver_name); - - List resultDataList = resp.getResultData(); - - try { - for (ResultData datum : resultDataList) { - String data_type = datum.getResourceType(); - String resourceLink = datum.getResourceLink(); - if(!resourceLink.isEmpty() && !resourceLink.toLowerCase().startsWith("http")) { - resourceLink = (new EchoRequest()).targetUri + resourceLink; - } - entity = new URL(resourceLink); - } - } catch (Exception e) { - throw new AAIServiceException(e); - } - return entity; - } - - @Override - public String getTenantIdFromVserverUrl(URL url) { - - String path = url.getPath(); - - String[] split = path.split("/tenants/tenant/"); - if(split.length > 1) { - split = split[1].split("/"); - return split[0]; - } else { - return null; - } - } - - @Override - public String getCloudOwnerFromVserverUrl(URL url) { - - String path = url.getPath(); - - String[] split = path.split("/cloud-regions/cloud-region/"); - if(split.length > 1) { - split = split[1].split("/"); - return split[0]; - } else { - return null; - } - } - - @Override - public String getCloudRegionFromVserverUrl(URL url) { - - String path = url.getPath(); - - String[] split = path.split("/cloud-regions/cloud-region/"); - if(split.length > 1) { - split = split[1].split("/"); - return split[1]; - } else { - return null; - } - } - - @Override - public String getVServerIdFromVserverUrl(URL url, String tenantId) { - String pattern = networkVserverPath; - pattern = pattern.replace("{tenant-id}", tenantId); - - int end = pattern.indexOf("{vserver-id}"); - String prefix = pattern.substring(0, end); - - String path = url.getPath(); - - if(path.startsWith(prefix)) { - path = path.substring(prefix.length()); - } - - return path; - } - - protected Logger getLogger(){ - return LOG; - } - - - @Override - public AAIExecutorInterfaceLighty getExecutor() { - return executor; - } - - /** - * Creates a current time stamp in UTC i.e. 2016-03-08T22:15:13.343Z. - * If there are any parameters the values are appended to the time stamp. - * - * @param parameters - * values to be appended to current time stamp - * @param ctx - * used to set an attribute for a DG - * @throws SvcLogicException - */ - public void setStatusMethod(Map parameters, SvcLogicContext ctx) throws SvcLogicException { - if (ctx == null) { - throw new SvcLogicException("SvcLogicContext is null."); - } - - StringBuilder sb = new StringBuilder(); - sb.append(String.format("%tFT% entry : parameters.entrySet()) { - sb.append(entry.getValue()).append(" "); - } - - if (sb.length() > 0) { - sb.setLength(sb.length() - 2); - } - - ctx.setAttribute("aai-summary-status-message", sb.toString()); - LOG.info("aai-summary-status-message: " + sb.toString()); - } - - /** - * Generic method to GET json data from an A&AI using key structure. - * Then convert that json to an Object. - * If successful the Object is attempted to be cast to the type parameter. - * - * @param key - * key identifying the resource to be retrieved from AAI - * @param type - * the class of object that A&AI will return - * @return the object created from json or null if the response code is not 200 - * - * @throws AAIServiceException - * if empty or null key and or type or there's an error with processing - */ - - public T getResource(String key, Class type) throws AAIServiceException { - if (StringUtils.isEmpty(key) || type == null) { - throw new AAIServiceException("Key is empty or null and or type is null"); - } - - T response = null; - - SvcLogicContext ctx = new SvcLogicContext(); - if(!key.contains(" = ")) { - if(isValidURL(key)) { - key = String.format("selflink = '%s'", key); - } else if(isValidURI(key)) { - key = String.format("resource-path = '%s'", key); - } else { - return response; - } - } - - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - - AAIRequestLighty request = new SelfLinkRequestLighty(type); - if(nameValues.containsKey(PathRequest.RESOURCE_PATH.replaceAll("-", "_"))) { - request = new PathRequestLighty(type); - } - - request.processRequestPathValues(nameValues); - Object obj = this.getExecutor().query(request, type); - response = type.cast(obj); - - return response != null ? type.cast(response) : response; - } - - public boolean isValidURL(String url) { - - URL u = null; - - try { - u = new URL(url); - } catch (MalformedURLException e) { - LOG.warn("MalformedURLException", e); - return false; - } - - try { - u.toURI(); - } catch (URISyntaxException e) { - LOG.warn("URISyntaxException", e); - return false; - } - - return true; - } - - - public boolean isValidURI(String url) { - - URI u = null; - - try { - u = new URI(url); - } catch (URISyntaxException e) { - LOG.warn("URISyntaxException", e); - return false; - } - - return true; - } - - - protected boolean deleteList(URL httpReqUrl, String json_text) throws AAIServiceException { - if(httpReqUrl == null) { - throw new NullPointerException(); - } - - boolean response = false; - InputStream inputStream = null; - - try { - HttpURLConnection con = getConfiguredConnection(httpReqUrl, HttpMethod.DELETE); - -// SSLSocketFactory sockFact = CTX.getSocketFactory(); -// con.setSSLSocketFactory( sockFact ); - if (json_text != null) { - OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); - osw.write(json_text); - osw.flush(); - osw.close(); - } - - LOGwriteFirstTrace("DELETE", httpReqUrl.toString()); - LOGwriteDateTrace("data", json_text); - - // Check for errors - int responseCode = con.getResponseCode(); - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - inputStream = con.getInputStream(); - } else { - inputStream = con.getErrorStream(); - } - - // Process the response - LOG.debug("HttpURLConnection result:" + responseCode); - if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); - BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); - String line = null; - - ObjectMapper mapper = getObjectMapper(); - - if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { - StringBuilder stringBuilder = new StringBuilder(); - - while( ( line = reader.readLine() ) != null ) { - stringBuilder.append( line ); - } - LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString()); - response = true; - } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); - response = false; - } else { - ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); - LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); - throw new AAIServiceException(responseCode, errorresponse); - } - - } catch(AAIServiceException aaiexc) { - throw aaiexc; - } catch (Exception exc) { - LOG.warn("deleteList", exc); - throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - - } - } - } - return response; - } - - public static ObjectMapper getObjectMapper() { - ObjectMapper mapper = new ObjectMapper(); - AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector secondary = new JacksonAnnotationIntrospector(); - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary)); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.setSerializationInclusion(Include.NON_EMPTY); - return mapper; - } - - public void logMetricRequest(String requestId, String targetServiceName, String msg, String path){ - String svcInstanceId = ""; - String svcName = null; - String partnerName = null; - String targetEntity = "A&AI"; - String targetVirtualEntity = null; - - ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg); - } - - public void logMetricResponse(String requestId, int responseCode, String responseDescription){ - ml.logResponse(responseCode < 400 ? "COMPLETE" : "ERROR", Integer.toString(responseCode), responseDescription); - } - - public void logKeyError(String keys){ - LOG.error("Atleast one of the keys [" + keys + "] should have been populated. This will cause a NPE."); - } - - - /** - * Retrofit code - */ - @Override - public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map params, String prefix, SvcLogicContext ctx) - throws SvcLogicException { - String normResource = resource.split(":")[0]; - - switch(normResource){ - case "custom-query": - case "formatted-query": - case "generic-query": - case "nodes-query": - case "linterface": - case "l2-bridge-sbg": - case "l2-bridge-bgf": - case "echo": - case "test": - break; - - default: - if(key.contains("selflink =")) { - break; - } - if(!key.contains(String.format("%s.", normResource))) { - key = rewriteKey(resource, key, ctx); - } - } - return super.save(resource, force, localOnly, key, params, prefix, ctx); - } - - @Override - public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) - throws SvcLogicException { - String normResource = resource.split(":")[0]; - - switch(normResource){ - case "custom-query": - case "formatted-query": - case "generic-query": - case "nodes-query": - case "linterface": - case "l2-bridge-sbg": - case "l2-bridge-bgf": - case "echo": - case "test": - break; - - default: - if(key.contains("selflink =")) { - break; - } - if(!key.contains(String.format("%s.", normResource))) { - key = rewriteKey(resource, key, ctx); - } - } - - return super.query(resource, localOnly, select, key, prefix, orderBy, ctx); - } - - @Override - public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException { - String normResource = resource.split(":")[0]; - - switch(normResource){ - case "custom-query": - case "formatted-query": - case "generic-query": - case "nodes-query": - case "linterface": - case "l2-bridge-sbg": - case "l2-bridge-bgf": - case "echo": - case "test": - break; - - default: - if(key.contains("selflink =")) { - break; - } - if(!key.contains(String.format("%s.", normResource))) { - key = rewriteKey(resource, key, ctx); - } - } - - return super.delete(resource, key, ctx); - } - - @Override - public QueryStatus update(String resource, String key, Map params, String prefix, SvcLogicContext ctx) throws SvcLogicException { - String normResource = resource.split(":")[0]; - - switch(normResource){ - case "custom-query": - case "formatted-query": - case "generic-query": - case "nodes-query": - case "linterface": - case "l2-bridge-sbg": - case "l2-bridge-bgf": - case "echo": - case "test": - break; - - default: - if(key.contains("selflink =")) { - break; - } - if(!key.contains(String.format("%s.", normResource))) { - key = rewriteKey(resource, key, ctx); - } - } - - return super.update(resource, key, params, prefix, ctx); - } - - private String rewriteKey(String resource, String key, SvcLogicContext ctx) { - LOG.info("AAI Deprecation - the format of request key is no longer supported. Please rewrite this key : " + key); - - String normResource = resource.split(":")[0]; - Class clazz = AAIRequestLighty.getClassFromResource(normResource) ; - - if(clazz == null) - return key; - - List fieldAnnotatedNames = new LinkedList<>(); - - Field[] fields = clazz.getDeclaredFields(); - for(Field field : fields) { - String fieldName = field.getName(); - XmlElement annotation = field.getAnnotation(XmlElement.class); - if(annotation == null) - continue; - String primaryId = annotation.name(); - if("##default".equals(primaryId)) { - primaryId = fieldName; - } - fieldAnnotatedNames.add(primaryId); - } - - HashMap nameValues = AAIServiceUtils.keyToHashMap(key, ctx); - Set keyset = nameValues.keySet(); - for(String keyName : keyset) { - if(keyName.contains(".")) - continue; - else { - String tmpKeyName = keyName.replaceAll("_", "-"); - String valueToSubstitute = String.format("%s =", tmpKeyName); - if(fieldAnnotatedNames.contains(tmpKeyName) && key.contains(valueToSubstitute)) { - key = key.replace(valueToSubstitute, String.format("%s.%s =", normResource, tmpKeyName)); - } - } - } - - - return key; - } - - @Override - public String getPathTemplateForResource(String resoourceName, String keys, SvcLogicContext ctx) throws MalformedURLException { - return AAIServiceUtils.getPathForResource(resoourceName, StringUtils.join(keys, " AND "), ctx); - } - - @Override - public boolean isDeprecatedFormat(String resource, Map nameValues) { - return !AAIServiceUtils.isValidFormat(resource, nameValues); - } - - public AAIRequestLighty getRequestFromResource(String resoourceName) { - return AAIRequestLighty.getRequestFromResource(resoourceName); - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.aai.haha#query(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty) - */ - @Override - public String query(AAIRequestLighty request) throws AAIServiceException { - return executor.get(request); - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.aai.haha#save(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty) - */ - @Override - public String save(AAIRequestLighty request) throws AAIServiceException { - return executor.post(request); - } - - public boolean update(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { - return executor.patch(request, resourceVersion); - } - - /* (non-Javadoc) - * @see org.onap.ccsdk.sli.core.sli.aai.haha#delete(org.onap.ccsdk.sli.core.sli.aai.AAIRequestLighty, java.lang.String) - */ - @Override - public boolean delete(AAIRequestLighty request, String resourceVersion) throws AAIServiceException { - return executor.delete(request, resourceVersion); - } - -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java deleted file mode 100755 index c0e825268..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProviderLighty.java +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Optional; -import java.util.Properties; -import java.util.Vector; -import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; -import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; -import org.onap.ccsdk.sli.core.utils.common.BundleContextFileResolver; -import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; -import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AAIServiceProvider} WITH REMOVED OSGi DEPENDENCIES - */ -public class AAIServiceProviderLighty implements UtilsProvider { - - private static final Logger LOG = LoggerFactory.getLogger(AAIServiceProviderLighty.class); - - /** - * The name of the properties file for database configuration - */ - private static final String AAISEERVICE_PROP_FILE_NAME = "aaiclient.properties"; - - /** - * The name of the pwd key - */ - private static final String AAICLIENT_PROPERTY_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.psswd"; - - /** - * A prioritized list of strategies for resolving dblib properties files. - */ - private Vector dblibPropertiesFileResolvers = new Vector<>(); - - /** - * The configuration properties for the db connection. - */ - private Properties properties; - - /** - * Set up the prioritized list of strategies for resolving dblib properties files. - */ - public AAIServiceProviderLighty() { - dblibPropertiesFileResolvers.add(new SdncConfigEnvVarFileResolver( - "Using property file (1) from environment variable" - )); - dblibPropertiesFileResolvers.add(new BundleContextFileResolver( - "Using property file (3) from JRE argument", AAIServiceProviderLighty.class - )); - dblibPropertiesFileResolvers.add(new KarafRootFileResolver( - "Using property file (4) from karaf root", this - )); - dblibPropertiesFileResolvers.add(new CoreDefaultFileResolver( - "Using property file (5) from default directory" - )); - - // determines properties file as according to the priority described in the class header comment - final File propertiesFile = determinePropertiesFile(); - if (propertiesFile != null) { - try(FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { - properties = new Properties(); - properties.load(fileInputStream); - - if(properties.containsKey(AAICLIENT_PROPERTY_NAME)) { - String sensitive = properties.getProperty(AAICLIENT_PROPERTY_NAME); - if(sensitive != null && sensitive.startsWith("ENC:")) { - try { - sensitive = sensitive.substring(4); - String postsense = decrypt(sensitive); - properties.setProperty(AAICLIENT_PROPERTY_NAME, postsense); - } catch(Exception exc) { - LOG.error("Failed to translate property", exc); - } - } - } - } catch (final IOException e) { - LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), - new AAIServiceException("Failed to load properties for file: " - + propertiesFile.toString(), e)); - } - } - } - - /** - * - * @param value - * @return decrypted string if successful or the original value if unsuccessful - */ - private String decrypt(String value) { - try { - BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); - - ServiceReference sref = bctx.getServiceReference("org.opendaylight.aaa.encrypt.AAAEncryptionService"); - if(sref == null) { - LOG.warn("Could not acquire service reference for 'org.opendaylight.aaa.encrypt.AAAEncryptionService'"); - return value; - } - Object encrSvc = bctx.getService(sref); - if(encrSvc == null) { - LOG.warn("Could not access service for 'org.opendaylight.aaa.encrypt.AAAEncryptionService'"); - return value; - } - - Method gs2Method = encrSvc.getClass().getMethod("decrypt", new Class[] { "".getClass() }); - Object unmasked = gs2Method.invoke(encrSvc, new Object[] { value }); - return unmasked.toString(); - - } catch (Exception exc) { - LOG.error("Failure", exc); - return value; - } - } - - /** - * Extract db config properties. - * - * @return the db config properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Reports the method chosen for properties resolution to the Logger. - * - * @param message Some user friendly message - * @param fileOptional The file location of the chosen properties file - * @return the file location of the chosen properties file - */ - private static File reportSuccess(final String message, final Optional fileOptional) { - if(fileOptional.isPresent()) { - final File file = fileOptional.get(); - LOG.info("{} {}", message, file.getPath()); - return file; - } - return null; - } - - /** - * Reports fatal errors. This is the case in which no properties file could be found. - * - * @param message An appropriate fatal error message - * @param dblibConfigurationException An exception describing what went wrong during resolution - */ - private static void reportFailure(final String message, - final AAIServiceException dblibConfigurationException) { - - LOG.error("{}", message, dblibConfigurationException); - } - - /** - * Determines the dblib properties file to use based on the following priority: - *
    - *
  1. A directory identified by the system environment variable SDNC_CONFIG_DIR
  2. - *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. - *
  5. A directory identified by the JRE argument dblib.properties
  6. - *
  7. A dblib.properties file located in the karaf root directory
  8. - *
- */ - File determinePropertiesFile() { - - for (final PropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) { - final Optional fileOptional = dblibPropertiesFileResolver.resolveFile(AAISEERVICE_PROP_FILE_NAME); - if (fileOptional.isPresent()) { - return reportSuccess(dblibPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); - } - } - - reportFailure("Missing configuration properties resource(3)", - new AAIServiceException("Missing configuration properties resource(3): " - + AAISEERVICE_PROP_FILE_NAME)); - return null; - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java deleted file mode 100755 index fa8dce485..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequestLighty.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryRequestData; -import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList; - -/** - * THIS CLASS IS A COPY OF {@link CustomQueryRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class CustomQueryRequestLighty extends AAIRequestLighty { - - public static final String GENERIC_SEARCH_PATH_CONST = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; - - private final String generic_search_path; - - public static final String FORMAT = "format"; - - - public CustomQueryRequestLighty() { - String tmpGenericSearchPath = configProperties.getProperty(GENERIC_SEARCH_PATH_CONST); - tmpGenericSearchPath = tmpGenericSearchPath.split("search")[0]; - generic_search_path = tmpGenericSearchPath +"query"; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String requestUrl = targetUri+generic_search_path; - - requestUrl = processPathData(requestUrl, requestProperties); - - String formatQuery = requestProperties.getProperty(FORMAT); - - if(formatQuery != null) { - requestUrl = requestUrl +"?format="+formatQuery; - } - URL httpReqUrl = new URL(requestUrl); - - aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString()); - - return httpReqUrl; - } - - @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 jsonText = null; - try { - jsonText = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return jsonText; - } - - - @Override - public String[] getArgsList() { - String[] args = {FORMAT}; - return args; - } - - - @Override - public Class getModelClass() { - return FormattedQueryRequestData.class; - } - - - public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException { - - String key = FORMAT; - - String encodedVnf = encodeQuery(requestProperties.getProperty(key)); - requestUrl = requestUrl.replace("{identifier}", encodedVnf) ; - aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); - - return requestUrl; - } - - public AAIDatum jsonStringToObject(String jsonData) throws 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/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java deleted file mode 100755 index 46e6aa7af..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestLighty.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.data.EchoResponse; - -/** - * THIS CLASS IS A COPY OF {@link EchoRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class EchoRequestLighty extends AAIRequestLighty { - - - - private final String echoPath; - - public EchoRequestLighty() { - echoPath = "/aai/util/echo"; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String requestUrl = targetUri+echoPath; - - if(resourceVersion != null) { - requestUrl = requestUrl +"?resource-version="+resourceVersion; - } - URL httpReqUrl = new URL(requestUrl); - - aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString()); - - return httpReqUrl; - } - - @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 jsonText = null; - try { - jsonText = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return jsonText; - } - - - @Override - public String[] getArgsList() { - String[] args = {}; - return args; - } - - - @Override - public Class getModelClass() { - return EchoResponse.class; - } - -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java deleted file mode 100755 index 65fe0e783..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequestLighty.java +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; -import org.onap.aai.inventory.v16.ResultData; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link GenericQueryRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class GenericQueryRequestLighty extends AAIRequestLighty { - - public static final String GENERIC_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; - - private final String generic_search_path; - - public static final String START_NODE_TYPE = "start-node-type"; - public static final String IDENTIFIER = "identifier"; - public static final String VALUE = "value"; - - - public GenericQueryRequestLighty() { - generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH); - } - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = targetUri+generic_search_path; - - request_url = processPathData(request_url, requestProperties); - - 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(); - ResultData tenant = (ResultData)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 = {START_NODE_TYPE, IDENTIFIER, VALUE}; - return args; - } - - - @Override - public Class getModelClass() { - return ResultData.class; - } - - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - - String key = IDENTIFIER; - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{identifier}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(IDENTIFIER, requestProperties.getProperty(key)); - - key = VALUE; - - encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{value}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(VALUE, requestProperties.getProperty(key)); - - key = START_NODE_TYPE; - - encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{start-node-type}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(START_NODE_TYPE, requestProperties.getProperty(key)); - - return request_url; - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java deleted file mode 100755 index 96b1e7f19..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequestLighty.java +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - /** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; -import java.io.UnsupportedEncodingException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import org.onap.aai.inventory.v16.L3Network; -import org.onap.aai.inventory.v16.L3Networks; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link GenericRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class GenericRequestLighty extends AAIRequestLighty { - - - protected Class model; - - public GenericRequestLighty(Class clazz) { - model = clazz; - } - - @Override - public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String originalPath = null; - String pathSubstitute = null; - String resourceName = null; - - Annotation[] annotations = model.getAnnotations(); - for(Annotation annotation : annotations) { - Class anotationType = annotation.annotationType(); - String annotationName = anotationType.getName(); - if("javax.xml.bind.annotation.XmlRootElement".equals(annotationName)){ - XmlRootElement order = (XmlRootElement)annotation; - resourceName = order.name(); - } - } - - String request_url = getRequestPath(resourceName); - - Map queryParams = new HashMap<> (); - if(resourceVersion != null) { - queryParams.put("resource-version", resourceVersion.toString()); - } - - Set uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames()); - - String[] keys = requestProperties.keySet().toArray(new String[0]); - for(String key : keys) { - switch(key) { - case "cloud-region.cloud-region-id": - case "entitlement.resource-uuid": - case "license.resource-uuid": - case "route-target.route-target-role": - case "service-capability.vnf-type": - case "ctag-pool.availability-zone-name": - continue; - } - - String value = requestProperties.getProperty(key); - if(key.contains(".")) { - String[] splitKey = key.split("\\."); - if("cloud-region".equals(splitKey[0])){ - String cloudRegionId = requestProperties.getProperty("cloud-region.cloud-region-id"); - aaiService.LOGwriteDateTrace("cloud-region-id", cloudRegionId); - String token = String.format("%s/{%s}/{cloud-region-id}", splitKey[0], splitKey[1] ); - String encoded_owner = encodeQuery(value); - String encoded_region = encodeQuery(cloudRegionId); - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); - } else if("entitlement".equals(splitKey[0])){ - String cloudRegionId = requestProperties.getProperty("entitlement.resource-uuid"); - aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId); - String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] ); - String encoded_owner = encodeQuery(value); - String encoded_region = encodeQuery(cloudRegionId); - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); - } else if("license".equals(splitKey[0])){ - String cloudRegionId = requestProperties.getProperty("license.resource-uuid"); - aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId); - String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] ); - String encoded_owner = encodeQuery(value); - String encoded_region = encodeQuery(cloudRegionId); - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); - } else if("route-target".equals(splitKey[0])){ - String cloudRegionId = requestProperties.getProperty("route-target.route-target-role"); - aaiService.LOGwriteDateTrace("route-target-role", cloudRegionId); - String token = String.format("%s/{%s}/{route-target-role}", splitKey[0], splitKey[1] ); - String encoded_owner = encodeQuery(value); - String encoded_region = encodeQuery(cloudRegionId); - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); - } else if("service-capability".equals(splitKey[0])){ - String vnfType = requestProperties.getProperty("service-capability.vnf-type"); - aaiService.LOGwriteDateTrace("vnf-type", vnfType); - String token = String.format("%s/{%s}/{vnf-type}", splitKey[0], splitKey[1] ); - String encoded_service_type = encodeQuery(value); - String encoded_vnf_type = encodeQuery(vnfType); - if("service-capability".equals(resourceName)) { - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_service_type, encoded_vnf_type)); - } else if("service-capabilities".equals(resourceName)) { - queryParams.put("service-type", encoded_service_type); - queryParams.put("vnf-type", encoded_vnf_type); - } - } else if("ctag-pool".equals(splitKey[0])){ - String cloudRegionId = requestProperties.getProperty("ctag-pool.availability-zone-name"); - aaiService.LOGwriteDateTrace("availability-zone-name", cloudRegionId); - String token = String.format("%s/{%s}/{availability-zone-name}", splitKey[0], splitKey[1] ); - String encoded_owner = encodeQuery(value); - String encoded_region = encodeQuery(cloudRegionId); - request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region)); - } else { - Class clazz = getClassFromResource(splitKey[0]); - - if(clazz != null) { - if(clazz == this.model) { - Field[] fields = this.model.getDeclaredFields(); - Field field = fields[0]; - String fieldName = field.getName(); - XmlElement annotation = field.getAnnotation(XmlElement.class); - String primaryId = null; - if(annotation != null) { - primaryId = annotation.name(); - if("##default".equals(primaryId)) { - primaryId = fieldName; - } - } else { - primaryId = fieldName; - } - - String token = String.format("%s/{%s}", splitKey[0], primaryId); - - if(splitKey[1].equals(primaryId)) { - String encoded_vnf = encodeQuery(value); - request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); - } else { - queryParams.put(splitKey[1], encodeQuery(value)); - originalPath = token; - pathSubstitute = String.format("%s", splitKey[0]); - } - } else if(L3Networks.class == this.model) { - Field[] fields = L3Network.class.getDeclaredFields(); - Field field = fields[0]; - String fieldName = field.getName(); - XmlElement annotation = field.getAnnotation(XmlElement.class); - String primaryId = annotation.name(); - if("##default".equals(primaryId)) { - primaryId = fieldName; - } - - String token = String.format("%s/{%s}", splitKey[0], primaryId); - originalPath = token; - pathSubstitute = String.format(""); - - queryParams.put(splitKey[1], encodeQuery(value)); - } else { - String token = String.format("%s/{%s}", splitKey[0], splitKey[1]); - String encoded_vnf = encodeQuery(value); - request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); - } - } - - } - aaiService.LOGwriteDateTrace(splitKey[1], value); - } - } - - if(originalPath != null && pathSubstitute != null) - request_url = request_url.replace(originalPath, pathSubstitute); - - if(!queryParams.isEmpty()) { - Joiner.MapJoiner mapJoiner = Joiner.on("&").withKeyValueSeparator("="); - String queryString = mapJoiner.join(queryParams); - request_url = String.format("%s?%s", request_url, queryString); - } - - return request_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - return this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - - String json_text = null; - try { - json_text = mapper.writeValueAsString(requestDatum); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {}; - return args; - } - - @Override - public Class getModelClass() { - return model; - } - - public void processRequestPathValues(Map nameValues) { - // identify unique resources - Set uniqueResources = AAIRequest.extractUniqueResourceSetFromKeys(nameValues.keySet()); - - String[] arguments = nameValues.keySet().toArray(new String[0]); - for(String name : arguments) { - String tmpName = name.replaceAll("-", "_"); - String value = nameValues.get(tmpName); - if(value != null && !value.isEmpty()) { - value = value.trim().replace("'", "").replace("$", "").replace("'", ""); - tmpName = name.replaceAll("_", "-"); - this.addRequestProperty(tmpName, value); - } - } - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java deleted file mode 100755 index ed79b261b..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequestLighty.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; -import org.onap.aai.inventory.v16.SearchResults; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link NodesQueryRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class NodesQueryRequestLighty extends AAIRequestLighty { - - public static final String NODES_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes"; - - private final String nodes_search_path; - - public static final String NODE_TYPE = "node-type"; - public static final String ENTITY_IDENTIFIER = "entity-identifier"; - public static final String ENTITY_VALUE = "entity-value"; - - - public NodesQueryRequestLighty() { - nodes_search_path = configProperties.getProperty(NODES_SEARCH_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = targetUri+nodes_search_path; - - request_url = processPathData(request_url, requestProperties); - - 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(); - SearchResults tenant = (SearchResults)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 = {NODE_TYPE, ENTITY_IDENTIFIER, ENTITY_VALUE}; - return args; - } - - - @Override - public Class getModelClass() { - return SearchResults.class; - } - - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - - String key = ENTITY_IDENTIFIER; - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{entity-identifier}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(ENTITY_IDENTIFIER, requestProperties.getProperty(key)); - - key = ENTITY_VALUE; - - encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{entity-name}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("entity-name", requestProperties.getProperty(key)); - - key = NODE_TYPE; - - encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{node-type}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(NODE_TYPE, requestProperties.getProperty(key)); - - return request_url; - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java deleted file mode 100755 index 47543d0b2..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequestLighty.java +++ /dev/null @@ -1,92 +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========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link PathRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class PathRequestLighty extends AAIRequestLighty { - - private final Class classType; - - public static final String RESOURCE_PATH = "resource-path"; - - public PathRequestLighty(Class type) { - classType = (Class)type; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = targetUri + "{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/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java deleted file mode 100755 index 03a22e732..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequestLighty.java +++ /dev/null @@ -1,67 +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========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.List; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.message.BasicNameValuePair; -import org.onap.aai.inventory.v16.RelationshipList; - -/** - * THIS CLASS IS A COPY OF {@link RelationshipListRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class RelationshipListRequestLighty extends GenericRequestLighty { - - public static final String SELFLINK = "selflink"; - - public RelationshipListRequestLighty(AAIRequestLighty masterRequest) { - super(RelationshipList.class); - this.addMasterRequest(masterRequest); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - - URL url = super.getRequestUrl(method, null); - URIBuilder builder = new URIBuilder(url.toURI()); - String newPath = builder.getPath() + "/relationship-list"; - builder.setPath(newPath); - if(resourceVersion != null) { - List queryList = builder.getQueryParams(); - NameValuePair nvp = new BasicNameValuePair("resourceVersion", resourceVersion); - queryList.add(nvp); - } - - aaiService.LOGwriteFirstTrace(method, builder.toString()); - - return builder.build().toURL(); - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java deleted file mode 100755 index 6e375d5a9..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequestLighty.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.List; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.message.BasicNameValuePair; -import org.onap.aai.inventory.v16.Relationship; - -/** - * THIS CLASS IS A COPY OF {@link RelationshipRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class RelationshipRequestLighty extends GenericRequestLighty { - - public RelationshipRequestLighty(AAIRequestLighty masterRequest) { - super(Relationship.class); - this.addMasterRequest(masterRequest); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - - - URL url = super.getRequestUrl(method, null); - URIBuilder builder = new URIBuilder(url.toURI()); - String newPath = builder.getPath() + "/relationship-list/relationship"; - builder.setPath(newPath); - if(resourceVersion != null) { - List queryList = builder.getQueryParams(); - NameValuePair nvp = new BasicNameValuePair("resourceVersion", resourceVersion); - queryList.add(nvp); - } - - aaiService.LOGwriteFirstTrace(method, builder.toString()); - - return builder.build().toURL(); - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.java deleted file mode 100755 index aafc993a0..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequestLighty.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========================================================= - */ -/** - * @author Rich Tabedzki - * - */ -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link SelfLinkRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class SelfLinkRequestLighty extends AAIRequestLighty { - - private final Class classType; - - public static final String SELFLINK = "selflink"; - - public SelfLinkRequestLighty(Class type) { - classType = (Class)type; - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = null; - - request_url = requestProperties.getProperty(SELFLINK); - try { - URI uri = new URI(request_url); - if(uri.getHost() == null) { - request_url = targetUri + request_url; - } - } catch(Exception exc) { - LOG.error("SelfLinkRequest.getRequestUrl", exc); - } - String query = null; - - if(request_url.contains("?")) { - query = request_url.substring(request_url.indexOf("?")); - Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); -// String queryString = mapJoiner.join(query); - } else { - request_url = request_url + "?depth=1"; - } - - 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 = {SELFLINK}; - return args; - } - - @Override - public Class getModelClass() { - return classType; - } -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java deleted file mode 100755 index 312215410..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequestLighty.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : SDN-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/** - * The UpdateRequest class provides processing related to update transaction. - * @author richtabedzki - */ - -package org.onap.ccsdk.sli.adaptors.aai; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.stream.Collectors; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -/** - * THIS CLASS IS A COPY OF {@link UpdateRequest} WITH REMOVED OSGi DEPENDENCIES - */ -public class UpdateRequestLighty extends AAIRequestLighty { - - private AAIRequestLighty request; - private Map params; - - public UpdateRequestLighty(AAIRequestLighty request, Map parms) { - this.request = request; - this.params = parms; - } - - @Override - public URL getRequestUrl(String method, String resourceVersion) - throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - return request.getRequestUrl(method, resourceVersion); - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - return request.getRequestQueryUrl(method); - } - - @Override - public String toJSONString() { - updateArrayEntries(params); - 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; - } - - /** - * - * Update array entries. - * The method converts indexed data entries to an array of values - * - * @param data Map containing String:String values representing input data - */ - private void updateArrayEntries( Map data) { - Set set = data.keySet() - .stream() - .filter(s -> s.endsWith("_length")) - .collect(Collectors.toSet()); - - for(String lenghtKey : set) { - String key = lenghtKey.replace("_length", ""); -// String index = data.get(lenghtKey); - List array = new ArrayList<>(); - - Set subset = data.keySet() - .stream() - .filter(s -> s.startsWith(String.format("%s[",key))) - .collect(Collectors.toSet()); - for(String subKey : subset) { - String subValue = data.get(subKey); - array.add(subValue); - LOG.trace("{} : {} ", subKey, subValue); - } - data.put(key, array.toString()); - data.remove(lenghtKey); - for(String subKey : subset) { - data.remove(subKey); - } - } - } - - @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 requestUrl, Properties requestProperties) { - -// 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 requestUrl; - } - - public void processRequestPathValues(Map nameValues) { - request.processRequestPathValues(nameValues); - } - -} diff --git a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java b/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java deleted file mode 100644 index d3ae452a0..000000000 --- a/aai-service/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/aai/lighty/AaaServiceModule.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.aai.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.aai.AAIClientLighty; -import org.onap.ccsdk.sli.adaptors.aai.AAIServiceLighty; -import org.onap.ccsdk.sli.adaptors.aai.AAIServiceProviderLighty; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the aai-service-provider artifact. - */ -public class AaaServiceModule extends AbstractLightyModule { - - private AAIServiceProviderLighty aaiServiceProvider; - private AAIServiceLighty aaiService; - - @Override - protected boolean initProcedure() { - this.aaiServiceProvider = new AAIServiceProviderLighty(); - this.aaiService = new AAIServiceLighty(aaiServiceProvider); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public AAIServiceLighty getAAIClient() { - return aaiService; - } - - // FIXME original blueprint is exposing AAIClient interface but it contains dependencies on AAIRequest which - // contains dependencies on OSGi - rewrite this AAIRequest into interface or remove the OSGi dependency - public AAIClientLighty getAAIService() { - return aaiService; - } - -} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index bd24021b4..a2e18c900 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -21,6 +21,5 @@ provider features installer - lighty diff --git a/ansible-adapter/ansible-adapter-lighty/pom.xml b/ansible-adapter/ansible-adapter-lighty/pom.xml deleted file mode 100755 index 166a7b821..000000000 --- a/ansible-adapter/ansible-adapter-lighty/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-bundle - ${project.version} - compile - - - diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java deleted file mode 100755 index 9690cd61e..000000000 --- a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java +++ /dev/null @@ -1,176 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * onap - * ================================================================================ - * Copyright (C) 2016 - 2017 ONAP - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.ccsdk.sli.adaptors.ansible.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; -import java.util.Properties; -import java.util.Vector; -import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapterPropertiesProvider; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; -import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; -import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; -import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AnsibleAdapterPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES - */ -public class AnsibleAdapterPropertiesProviderImplLighty implements AnsibleAdapterPropertiesProvider { - - private static final Logger LOG = LoggerFactory.getLogger(AnsibleAdapterPropertiesProviderImplLighty.class); - - /** - * The name of the properties file for database configuration - */ - private static final String ANSIBLEADAPTER_PROP_FILE_NAME = "ansible-adapter.properties"; - - /** - * A prioritized list of strategies for resolving sql-resource properties files. - */ - private Vector ansibleAdapterPropertiesFileResolvers = new Vector<>(); - - /** - * The configuration properties for the db connection. - */ - private Properties properties; - - /** - * Set up the prioritized list of strategies for resolving dblib properties - * files. - */ - public AnsibleAdapterPropertiesProviderImplLighty() { - ansibleAdapterPropertiesFileResolvers - .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); - ansibleAdapterPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); - - ansibleAdapterPropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); - - // determines properties file as according to the priority described in the - // class header comment - final File propertiesFile = determinePropertiesFile(this); - if (propertiesFile != null) { - try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { - properties = new Properties(); - properties.load(fileInputStream); - } catch (final IOException e) { - LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), - new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), - e)); - } - } else { - // Try to read properties as resource - - InputStream propStr = getClass().getResourceAsStream("/" + ANSIBLEADAPTER_PROP_FILE_NAME); - if (propStr != null) { - properties = new Properties(); - try { - properties.load(propStr); - propStr.close(); - } catch (IOException e) { - properties = null; - } - } - - } - - if (properties == null) { - reportFailure("Missing configuration properties resource(3)", new ConfigurationException( - "Missing configuration properties resource(3): " + ANSIBLEADAPTER_PROP_FILE_NAME)); - - LOG.info("Defaulting org.onap.appc.adapter.ansible.clientType to TRUST_ALL"); - - properties = new Properties(); - properties.setProperty("org.onap.appc.adapter.ansible.clientType", "TRUST_ALL"); - } - } - - /** - * Extract svclogic config properties. - * - * @return the svclogic config properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Reports the method chosen for properties resolution to the - * Logger. - * - * @param message - * Some user friendly message - * @param fileOptional - * The file location of the chosen properties file - * @return the file location of the chosen properties file - */ - private static File reportSuccess(final String message, final Optional fileOptional) { - if (fileOptional.isPresent()) { - final File file = fileOptional.get(); - LOG.info("{} {}", message, file.getPath()); - return file; - } - return null; - } - - /** - * Reports fatal errors. This is the case in which no properties file could be - * found. - * - * @param message - * An appropriate fatal error message - * @param configurationException - * An exception describing what went wrong during resolution - */ - private static void reportFailure(final String message, final ConfigurationException configurationException) { - - LOG.error("{}", message, configurationException); - } - - /** - * Determines the sql-resource properties file to use based on the following priority: - *
    - *
  1. A directory identified by the system environment variable - * SDNC_CONFIG_DIR
  2. - *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. - *
  5. A directory identified by the JRE argument - * sql-resource.properties
  6. - *
  7. A sql-resource.properties file located in the karaf root - * directory
  8. - *
- */ - File determinePropertiesFile(final AnsibleAdapterPropertiesProviderImplLighty resourceProvider) { - - for (final PropertiesFileResolver sliPropertiesFileResolver : ansibleAdapterPropertiesFileResolvers) { - final Optional fileOptional = sliPropertiesFileResolver.resolveFile(ANSIBLEADAPTER_PROP_FILE_NAME); - if (fileOptional.isPresent()) { - return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); - } - } - - return null; - } -} diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java deleted file mode 100644 index ae49542b4..000000000 --- a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.ansible.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter; -import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterImpl; -import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterPropertiesProviderImplLighty; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the ansible-adaptor artifact. - */ -public class AnsibleAdapterModule extends AbstractLightyModule { - - private AnsibleAdapterPropertiesProviderImplLighty ansibleProviderImpl; - private AnsibleAdapterImpl ansibleAdapterImpl; - - @Override - protected boolean initProcedure() { - this.ansibleProviderImpl = new AnsibleAdapterPropertiesProviderImplLighty(); - this.ansibleAdapterImpl = new AnsibleAdapterImpl(ansibleProviderImpl); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public AnsibleAdapterPropertiesProviderImplLighty getAnsibleAdapterPropertiesProviderImpl() { - return this.ansibleProviderImpl; - } - - public AnsibleAdapter getAnsibleAdapterImpl() { - return ansibleAdapterImpl; - } -} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 7ffac67ec..8ab564a72 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -185,6 +185,5 @@ ansible-adapter-bundle ansible-adapter-features ansible-adapter-installer - ansible-adapter-lighty diff --git a/ccsdk-adaptors-lighty/pom.xml b/ccsdk-adaptors-lighty/pom.xml deleted file mode 100755 index 8e6a70cef..000000000 --- a/ccsdk-adaptors-lighty/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-adaptors-lighty - 0.6.1-SNAPSHOT - jar - - - - org.onap.ccsdk.sli.core - ccsdk-core-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - aai-service-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - netbox-client-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - resource-assignment-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - saltstack-adapter-lighty - ${project.version} - - - org.onap.ccsdk.sli.adaptors - sql-resource-lighty - ${project.version} - - - diff --git a/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java b/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java deleted file mode 100644 index 102c01c7f..000000000 --- a/ccsdk-adaptors-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/lighty/CcsdkAdaptorsLightyModule.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.aai.lighty.AaaServiceModule; -import org.onap.ccsdk.sli.adaptors.ansible.lighty.AnsibleAdapterModule; -import org.onap.ccsdk.sli.adaptors.netbox.lighty.NetboxClientModule; -import org.onap.ccsdk.sli.adaptors.resource.lighty.ResourceModule; -import org.onap.ccsdk.sli.adaptors.resource.mdsal.lighty.MdsalResourceModule; -import org.onap.ccsdk.sli.adaptors.resource.sql.lighty.SqlModule; -import org.onap.ccsdk.sli.adaptors.saltstack.lighty.SaltstackAdapterModule; -import org.onap.ccsdk.sli.core.dblib.DbLibService; -import org.onap.ccsdk.sli.core.lighty.common.CcsdkLightyUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that groups all other LightyModules - * from the ccsdk-sli-adaptors repository so they can be all treated as one component (for example started/stopped - * at once). - * For more information about the lighty.io visit the website https://lighty.io. - */ -public class CcsdkAdaptorsLightyModule extends AbstractLightyModule { - - private static final Logger LOG = LoggerFactory.getLogger(CcsdkAdaptorsLightyModule.class); - - private DbLibService dbLibService; - - private AaaServiceModule aaaServiceModule; - private AnsibleAdapterModule ansibleAdapterModule; - private MdsalResourceModule mdsalResourceModule; - private NetboxClientModule netboxClientModule; - private ResourceModule resourceModule; - private SaltstackAdapterModule saltstackAdapterModule; - private SqlModule sqlModule; - - public CcsdkAdaptorsLightyModule(DbLibService dbLibService) { - this.dbLibService = dbLibService; - } - - @Override - protected boolean initProcedure() { - LOG.debug("Initializing CCSDK Adaptors Lighty module..."); - - this.aaaServiceModule = new AaaServiceModule(); - if (!CcsdkLightyUtils.startLightyModule(aaaServiceModule)) { - LOG.error("Unable to start AaaServiceModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.ansibleAdapterModule = new AnsibleAdapterModule(); - if (!CcsdkLightyUtils.startLightyModule(ansibleAdapterModule)) { - LOG.error("Unable to start AnsibleAdapterModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.mdsalResourceModule = new MdsalResourceModule(); - if (!CcsdkLightyUtils.startLightyModule(mdsalResourceModule)) { - LOG.error("Unable to start MdsalResourceModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.netboxClientModule = new NetboxClientModule(dbLibService); - if (!CcsdkLightyUtils.startLightyModule(netboxClientModule)) { - LOG.error("Unable to start NetboxClientModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.resourceModule = new ResourceModule(dbLibService); - if (!CcsdkLightyUtils.startLightyModule(resourceModule)) { - LOG.error("Unable to start ResourceModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.saltstackAdapterModule = new SaltstackAdapterModule(); - if (!CcsdkLightyUtils.startLightyModule(saltstackAdapterModule)) { - LOG.error("Unable to start SaltstackAdapterModule in CCSDK Adaptors Lighty module!"); - return false; - } - - this.sqlModule = new SqlModule(dbLibService); - if (!CcsdkLightyUtils.startLightyModule(sqlModule)) { - LOG.error("Unable to start SqlModule in CCSDK Adaptors Lighty module!"); - return false; - } - - LOG.debug("CCSDK Adaptors Lighty module was initialized successfully"); - return true; - } - - @Override - protected boolean stopProcedure() { - LOG.debug("Stopping CCSDK Adaptors Lighty module..."); - - boolean stopSuccessful = true; - - if (!CcsdkLightyUtils.stopLightyModule(sqlModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(saltstackAdapterModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(resourceModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(netboxClientModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(mdsalResourceModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(ansibleAdapterModule)) { - stopSuccessful = false; - } - - if (!CcsdkLightyUtils.stopLightyModule(aaaServiceModule)) { - stopSuccessful = false; - } - - if (stopSuccessful) { - LOG.debug("CCSDK Adaptors Lighty module was stopped successfully"); - } else { - LOG.error("CCSDK Adaptors Lighty module was not stopped successfully!"); - } - return stopSuccessful; - } - - public AaaServiceModule getAaaServiceModule() { - return aaaServiceModule; - } - - public AnsibleAdapterModule getAnsibleAdapterModule() { - return ansibleAdapterModule; - } - - public MdsalResourceModule getMdsalResourceModule() { - return mdsalResourceModule; - } - - public NetboxClientModule getNetboxClientModule() { - return netboxClientModule; - } - - public ResourceModule getResourceModule() { - return resourceModule; - } - - public SaltstackAdapterModule getSaltstackAdapterModule() { - return saltstackAdapterModule; - } - - public SqlModule getSqlModule() { - return sqlModule; - } -} diff --git a/mdsal-resource/lighty/pom.xml b/mdsal-resource/lighty/pom.xml deleted file mode 100755 index e2a5e6afd..000000000 --- a/mdsal-resource/lighty/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-provider - ${project.version} - - - diff --git a/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java b/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java deleted file mode 100644 index 44faa8761..000000000 --- a/mdsal-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/lighty/MdsalResourceModule.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.resource.mdsal.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource; -import org.onap.ccsdk.sli.adaptors.resource.mdsal.MdsalResourcePropertiesProviderImpl; -import org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the mdsal-resource-provider artifact. - */ -public class MdsalResourceModule extends AbstractLightyModule { - - private MdsalResourcePropertiesProviderImpl mdsalResourcePropertiesProvider; - private ConfigResource configResource; - private OperationalResource operationalResource; - - @Override - protected boolean initProcedure() { - this.mdsalResourcePropertiesProvider = new MdsalResourcePropertiesProviderImpl(); - this.configResource = new ConfigResource(mdsalResourcePropertiesProvider); - this.operationalResource = new OperationalResource(mdsalResourcePropertiesProvider); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public MdsalResourcePropertiesProviderImpl getMdsalResourcePropertiesProviderImpl() { - return this.mdsalResourcePropertiesProvider; - } - - public ConfigResource getConfigResource() { - return configResource; - } - - public OperationalResource getOperationalResource() { - return this.operationalResource; - } -} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 4c18bd59b..87565f714 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -21,7 +21,6 @@ provider features installer - lighty diff --git a/netbox-client/lighty/pom.xml b/netbox-client/lighty/pom.xml deleted file mode 100755 index ddfc4c733..000000000 --- a/netbox-client/lighty/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - netbox-client-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - netbox-client-provider - ${project.version} - - - diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java deleted file mode 100644 index 2658c06cc..000000000 --- a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxClientImplLighty.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2018 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.sli.adaptors.netbox.impl; - -import com.google.common.collect.Lists; -import com.google.gson.JsonSyntaxException; -import java.io.IOException; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Map; -import javax.sql.rowset.CachedRowSet; -import org.apache.http.HttpResponse; -import org.apache.http.util.EntityUtils; -import org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient; -import org.onap.ccsdk.sli.adaptors.netbox.model.IPAddress; -import org.onap.ccsdk.sli.adaptors.netbox.model.IPStatus; -import org.onap.ccsdk.sli.core.dblib.DbLibService; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; -import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link NetboxClientImpl} WITH REMOVED OSGi DEPENDENCIES - */ -public class NetboxClientImplLighty implements NetboxClient { - - private static final Logger LOG = LoggerFactory.getLogger(NetboxClientImplLighty.class); - - // Netbox URI - - private static final String NEXT_AVAILABLE_IP_IN_PREFIX_PATH = "/api/ipam/prefixes/%s/available-ips/"; - private static final String IP_ADDRESS_PATH = "/api/ipam/ip-addresses/%s/"; - - // Netbox Payload - - private static final String ASSIGN_IP_ADDRESS_PAYLOAD = "{\n" - + " \"custom_fields\": {\n" - + " \"external-key\": \"%s\",\n" - + " \"resource-name\": \"%s\"\n" - + " }\n" - + "}"; - - // Service Logic Context input variables and exception - - private static final String SERVICE_INSTANCE_ID_PROP = "service_instance_id"; - private static final String VF_MODULE_ID_PROP = "vf_module_id"; - private static final String EXTERNAL_KEY_PROP = "external_key"; - private static final String SQL_EXCEPTION_MESSAGE = "Caught SQL exception"; - - // SQL statement - - private static final String ASSIGN_IP_SQL_STATEMENT = - "INSERT INTO IPAM_IP_ASSIGNEMENT (service_instance_id, vf_module_id, prefix_id, ip_address_id, ip_address, ip_status, ip_response_json, external_key, ip_address_type) \n" - + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; - private static final String UNASSIGN_IP_SQL_STATEMENT = - "UPDATE IPAM_IP_ASSIGNEMENT SET ip_status = ? WHERE service_instance_id = ? AND external_key = ?"; - private static final String GET_IP_ADDRESS_ID_SQL_STATEMENT = - "SELECT ip_address_id FROM IPAM_IP_ASSIGNEMENT WHERE service_instance_id = ? AND external_key = ?"; - - private final NetboxHttpClientLighty client; - private final DbLibService dbLibService; - - public NetboxClientImplLighty(final NetboxHttpClientLighty client, final DbLibService dbLibService) { - this.client = client; - this.dbLibService = dbLibService; - } - - @Override - public QueryStatus assignIpAddress(final Map parameters, final SvcLogicContext ctx) { - - try { - SliPluginUtils - .checkParameters(parameters, - new String[]{SERVICE_INSTANCE_ID_PROP, VF_MODULE_ID_PROP, "prefix_id", "resource_name", - EXTERNAL_KEY_PROP}, LOG); - } catch (SvcLogicException e) { - return QueryStatus.FAILURE; - } - - final String serviceInstanceId = parameters.get(SERVICE_INSTANCE_ID_PROP); - final String vfModuleId = parameters.get(VF_MODULE_ID_PROP); - final String prefixId = parameters.get("prefix_id"); - final String resourceName = parameters.get("resource_name"); - final String externalKey = parameters.get(EXTERNAL_KEY_PROP); - - HttpResponse httpResp; - try { - httpResp = client - .post(String.format(NEXT_AVAILABLE_IP_IN_PREFIX_PATH, prefixId), - String.format(ASSIGN_IP_ADDRESS_PAYLOAD, externalKey, resourceName)); - } catch (IOException e) { - LOG.error("Fail to assign IP for Prefix(id={}). {}", prefixId, e.getMessage(), e.getCause()); - return QueryStatus.FAILURE; - } - - String ipamRespJson; - try { - ipamRespJson = EntityUtils.toString(httpResp.getEntity(), "UTF-8"); - } catch (IOException e) { - LOG.error("Fail to parse IPAM response for assign in Prefix(id={}). Response={}", prefixId, - httpResp.getEntity(), e); - return QueryStatus.FAILURE; - } - - if (httpResp.getStatusLine().getStatusCode() != 201) { - LOG.error("Fail to assign IP for Prefix(id={}). HTTP code 201!={}. Response={}", prefixId, - httpResp.getStatusLine().getStatusCode(), ipamRespJson); - return QueryStatus.FAILURE; - } - - IPAddress ipAddress; - try { - ipAddress = IPAddress.fromJson(ipamRespJson); - } catch (JsonSyntaxException e) { - LOG.error("Fail to parse IPAM JSON reponse to IPAddress POJO. IPAM JSON Response={}", ipamRespJson, e); - return QueryStatus.FAILURE; - } - - ArrayList args = Lists.newArrayList( - serviceInstanceId, - vfModuleId, - String.valueOf(prefixId), - String.valueOf(ipAddress.getId()), - ipAddress.getAddress(), - IPStatus.ASSIGNED.name(), - ipamRespJson, - externalKey, - resourceName); - - try { - dbLibService.writeData(ASSIGN_IP_SQL_STATEMENT, args, null); - } catch (SQLException e) { - LOG.error(SQL_EXCEPTION_MESSAGE, e); - return QueryStatus.FAILURE; - } - - ctx.setAttribute("self_serve_netbox_ip_assignement.ip-address", ipAddress.getAddress()); - - return QueryStatus.SUCCESS; - } - - @Override - public QueryStatus unassignIpAddress(final Map parameters, final SvcLogicContext ctx) { - try { - SliPluginUtils - .checkParameters(parameters, new String[]{SERVICE_INSTANCE_ID_PROP, EXTERNAL_KEY_PROP}, - LOG); - } catch (SvcLogicException e) { - return QueryStatus.FAILURE; - } - - final String serviceInstanceId = parameters.get(SERVICE_INSTANCE_ID_PROP); - final String externalKey = parameters.get(EXTERNAL_KEY_PROP); - - String ipAddressId; - ArrayList args = Lists.newArrayList( - serviceInstanceId, - externalKey); - try (CachedRowSet row = dbLibService.getData(GET_IP_ADDRESS_ID_SQL_STATEMENT, args, null)) { - if (row.next()) { - ipAddressId = row.getString("ip_address_id"); - } else { - throw new SQLException("Data not found."); - } - } catch (SQLException e) { - LOG.error(SQL_EXCEPTION_MESSAGE, e); - return QueryStatus.FAILURE; - } - - HttpResponse httpResp; - try { - httpResp = client.delete(String.format(IP_ADDRESS_PATH, ipAddressId)); - } catch (IOException e) { - LOG.error("Fail to unassign IP for IPAddress(id= " + ipAddressId + "). " + e.getMessage(), - e.getCause()); - return QueryStatus.FAILURE; - } - - if (httpResp.getStatusLine().getStatusCode() - 200 >= 100) { - LOG.error("Fail to unassign IP for IPAddress(id={}). HTTP code={}.", ipAddressId, - httpResp.getStatusLine().getStatusCode()); - return QueryStatus.FAILURE; - } - - args.clear(); - args = Lists.newArrayList( - IPStatus.DELETED.name(), - serviceInstanceId, - externalKey); - - try { - dbLibService.writeData(UNASSIGN_IP_SQL_STATEMENT, args, null); - } catch (SQLException e) { - LOG.error(SQL_EXCEPTION_MESSAGE, e); - return QueryStatus.FAILURE; - } - - return QueryStatus.SUCCESS; - } -} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java deleted file mode 100644 index 388486c4f..000000000 --- a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/impl/NetboxHttpClientLighty.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2018 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.sli.adaptors.netbox.impl; - -import static org.apache.http.HttpHeaders.ACCEPT; -import static org.apache.http.HttpHeaders.AUTHORIZATION; -import static org.apache.http.HttpHeaders.CONTENT_TYPE; - -import java.io.IOException; -import java.nio.charset.Charset; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import javax.net.ssl.SSLContext; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.ssl.SSLContexts; -import org.apache.http.ssl.TrustStrategy; -import org.onap.ccsdk.sli.adaptors.netbox.property.NetboxPropertiesLighty; - -/** - * THIS CLASS IS A COPY OF {@link NetboxHttpClient} WITH REMOVED OSGi DEPENDENCIES - */ -public class NetboxHttpClientLighty implements AutoCloseable { - - private static final String APPLICATION_JSON = "application/json"; - - private final CloseableHttpClient client; - private final String url; - private final String token; - - // Used by the blueprint container - public NetboxHttpClientLighty(NetboxPropertiesLighty properties) { - this(properties.getHost(), properties.getApiKey()); - } - - NetboxHttpClientLighty(final String url, final String token) { - this.url = url; - this.token = token; - - final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true; - final SSLContext sslContext; - try { - sslContext = SSLContexts.custom() - .loadTrustMaterial(null, acceptingTrustStrategy).build(); - } catch (final NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { - throw new IllegalStateException("Can't create http client", e); - } - client = HttpClientBuilder.create() - .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .setSSLContext(sslContext) - .build(); - } - - @Override - public void close() throws IOException { - client.close(); - } - - HttpResponse post(final String uri, final String requestBody) throws IOException { - final HttpPost request = new HttpPost(url + uri); - setHeaders(request); - request.setEntity(new StringEntity(requestBody, Charset.forName("UTF-8"))); - return client.execute(request); - } - - HttpResponse delete(final String uri) throws IOException { - final HttpDelete request = new HttpDelete(url + uri); - setHeaders(request); - return client.execute(request); - } - - private void setHeaders(final HttpRequestBase request) { - request.addHeader(ACCEPT, APPLICATION_JSON); - request.addHeader(CONTENT_TYPE, APPLICATION_JSON); - request.addHeader(AUTHORIZATION, "Token " + token); - } -} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java deleted file mode 100644 index 13f7963bb..000000000 --- a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/lighty/NetboxClientModule.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.netbox.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import java.io.IOException; -import org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient; -import org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxClientImplLighty; -import org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxHttpClientLighty; -import org.onap.ccsdk.sli.adaptors.netbox.property.NetboxPropertiesLighty; -import org.onap.ccsdk.sli.core.dblib.DbLibService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the netbox-client-provider artifact. - */ -public class NetboxClientModule extends AbstractLightyModule { - - private static final Logger LOG = LoggerFactory.getLogger(NetboxClientModule.class); - - private final DbLibService dbLibService; - - private NetboxPropertiesLighty netboxProperties; - private NetboxHttpClientLighty netboxHttpClient; - private NetboxClientImplLighty netboxClient; - - public NetboxClientModule(DbLibService dbLibService) { - this.dbLibService = dbLibService; - } - - @Override - protected boolean initProcedure() { - this.netboxProperties = new NetboxPropertiesLighty(); - this.netboxHttpClient = new NetboxHttpClientLighty(netboxProperties); - this.netboxClient = new NetboxClientImplLighty(netboxHttpClient, dbLibService); - return true; - } - - @Override - protected boolean stopProcedure() { - try { - netboxHttpClient.close(); - } catch (IOException e) { - LOG.error("Exception thrown while closing {}!", netboxHttpClient.getClass(), e); - return false; - } - return true; - } - - public NetboxClient getNetboxClient() { - return netboxClient; - } - -} diff --git a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java b/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java deleted file mode 100644 index 15759c721..000000000 --- a/netbox-client/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/netbox/property/NetboxPropertiesLighty.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2018 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.sli.adaptors.netbox.property; - -import java.io.FileInputStream; -import java.util.Properties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link NetboxProperties} WITH REMOVED OSGi DEPENDENCIES - */ -public class NetboxPropertiesLighty { - - private static final Logger LOG = LoggerFactory.getLogger(NetboxPropertiesLighty.class); - - private static final String NETBOX_PROPERTY_FILE_NAME = "netbox.properties"; - private static final String DEFAULT_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties"; - private static final String PROPERTIES_DIR_KEY = "SDNC_CONFIG_DIR"; - - private static final String NETBOX_URL_PROP = "org.onap.ccsdk.sli.adaptors.netbox.url"; - private static final String NETBOX_API_KEY_PROP = "org.onap.ccsdk.sli.adaptors.netbox.apikey"; - - private Properties properties; - - public NetboxPropertiesLighty() { - loadProps(); - } - - public String getHost() { - return properties.getProperty(NETBOX_URL_PROP); - } - - public String getApiKey() { - return properties.getProperty(NETBOX_API_KEY_PROP); - } - - private void loadProps() { - properties = new Properties(); - // Try to load config from dir - final String ccsdkConfigDir = - System.getProperty(PROPERTIES_DIR_KEY, DEFAULT_PROPERTIES_DIR) + "/" + NETBOX_PROPERTY_FILE_NAME; - LOG.info("Loading properties from file {}", ccsdkConfigDir); - try (FileInputStream in = new FileInputStream(ccsdkConfigDir)) { - properties.load(in); - LOG.info("Loaded {} properties from file {}", properties.size(), ccsdkConfigDir); - } catch (Exception e) { - LOG.error("Failed to load properties for file: {} " + NETBOX_PROPERTY_FILE_NAME, e); - } - } -} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 7c2ff9c6f..a4c8040ea 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -36,6 +36,5 @@ provider features installer - lighty diff --git a/pom.xml b/pom.xml index d0f51ed77..0cab4278d 100755 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ aai-service ansible-adapter saltstack-adapter - netbox-client + netbox-client mdsal-resource resource-assignment sql-resource @@ -107,7 +107,6 @@ message-router features artifacts - ccsdk-adaptors-lighty ONAP diff --git a/resource-assignment/lighty/pom.xml b/resource-assignment/lighty/pom.xml deleted file mode 100755 index feea3e10f..000000000 --- a/resource-assignment/lighty/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - resource-assignment-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - resource-assignment-provider - ${project.version} - - - org.onap.ccsdk.sli.core - dblib-provider - ${project.version} - - - org.onap.ccsdk.sli.core - sli-provider - ${project.version} - provided - - - diff --git a/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java b/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java deleted file mode 100644 index b90905995..000000000 --- a/resource-assignment/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/lighty/ResourceModule.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.resource.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import java.util.Collections; -import org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl; -import org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl; -import org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator; -import org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode; -import org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule; -import org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl; -import org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl; -import org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl; -import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl; -import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl; -import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl; -import org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl; -import org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap; -import org.onap.ccsdk.sli.adaptors.util.db.DataSourceWrap; -import org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil; -import org.onap.ccsdk.sli.core.dblib.DbLibService; -import org.springframework.jdbc.core.JdbcTemplate; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the resource-assignment-provider artifact. - */ -public class ResourceModule extends AbstractLightyModule { - - private final DbLibService dbLibService; - - private DataSourceWrap dataSourceWrap; - private CachedDataSourceWrap cachedDataSourceWrap; - private JdbcTemplate rmJdbcTemplate; - private JdbcTemplate lockJdbcTemplate; - private ResourceLockDaoImpl resourceLockDao; - private LockHelperImpl lockHelper; - private ResourceJdbcDaoImpl resourceJdbcDao; - private AllocationItemJdbcDaoImpl allocationItemJdbcDao; - private ResourceLoadJdbcDaoImpl resourceLoadJdbcDao; - private ResourceDaoImpl resourceDao; - private ResourceManagerImpl resourceManager; - private ResourceRuleDaoImpl resourceRuleDao; - private RangeRuleDaoImpl rangeRuleDao; - private ResourceAllocator resourceAllocator; - private ResourceLockNode resourceLockNode; - private SpeedUtil speedUtil; - private EndPointAllocatorImpl endPointAllocator; - private DbAllocationRule dbAllocationRule; - - public ResourceModule(final DbLibService dbLibService) { - this.dbLibService = dbLibService; - } - - @Override - protected boolean initProcedure() { - this.dataSourceWrap = new DataSourceWrap(); - this.dataSourceWrap.setDataSource(dbLibService); - - this.cachedDataSourceWrap = new CachedDataSourceWrap(); - this.cachedDataSourceWrap.setDataSource(dataSourceWrap); - - this.rmJdbcTemplate = new JdbcTemplate(); - this.rmJdbcTemplate.setDataSource(dataSourceWrap); - - this.lockJdbcTemplate = new JdbcTemplate(); - this.lockJdbcTemplate.setDataSource(cachedDataSourceWrap); - - this.resourceLockDao = new ResourceLockDaoImpl(); - this.resourceLockDao.setJdbcTemplate(lockJdbcTemplate); - - this.lockHelper = new LockHelperImpl(); - this.lockHelper.setResourceLockDao(resourceLockDao); - this.lockHelper.setRetryCount(10); - this.lockHelper.setLockWait(5); - - this.resourceJdbcDao = new ResourceJdbcDaoImpl(); - this.resourceJdbcDao.setJdbcTemplate(rmJdbcTemplate); - - this.allocationItemJdbcDao = new AllocationItemJdbcDaoImpl(); - this.allocationItemJdbcDao.setJdbcTemplate(rmJdbcTemplate); - - this.resourceLoadJdbcDao = new ResourceLoadJdbcDaoImpl(); - this.resourceLoadJdbcDao.setJdbcTemplate(rmJdbcTemplate); - - this.resourceDao = new ResourceDaoImpl(); - this.resourceDao.setResourceJdbcDao(resourceJdbcDao); - this.resourceDao.setAllocationItemJdbcDao(allocationItemJdbcDao); - this.resourceDao.setResourceLoadJdbcDao(resourceLoadJdbcDao); - - this.resourceManager = new ResourceManagerImpl(); - this.resourceManager.setLockHelper(lockHelper); - this.resourceManager.setResourceDao(resourceDao); - this.resourceManager.setLockTimeout(600); - - this.resourceRuleDao = new ResourceRuleDaoImpl(); - this.resourceRuleDao.setJdbcTemplate(rmJdbcTemplate); - - this.rangeRuleDao = new RangeRuleDaoImpl(); - this.rangeRuleDao.setJdbcTemplate(rmJdbcTemplate); - - this.resourceLockNode = new ResourceLockNode(); - this.resourceLockNode.setLockHelper(lockHelper); - - this.speedUtil = new SpeedUtil(); - - this.dbAllocationRule = new DbAllocationRule(); - this.dbAllocationRule.setResourceRuleDao(resourceRuleDao); - this.dbAllocationRule.setRangeRuleDao(rangeRuleDao); - - this.endPointAllocator = new EndPointAllocatorImpl(); - this.endPointAllocator.setResourceManager(resourceManager); - this.endPointAllocator.setAllocationRuleMap( - Collections.singletonMap("DEFAULT", Collections.singletonList(dbAllocationRule))); - - this.resourceAllocator = new ResourceAllocator(); - this.resourceAllocator.setResourceManager(resourceManager); - this.resourceAllocator.setEndPointAllocator(endPointAllocator); - this.resourceAllocator.setSpeedUtil(speedUtil); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public ResourceAllocator getResourceAllocator() { - return resourceAllocator; - } - - public ResourceLockNode getResourceLockNode() { - return resourceLockNode; - } - -} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 196331a32..8b53a45c3 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -21,7 +21,6 @@ provider features installer - lighty diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 5ae3ddde6..57f868737 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -193,6 +193,5 @@ saltstack-adapter-provider saltstack-adapter-features saltstack-adapter-installer - saltstack-adapter-lighty diff --git a/saltstack-adapter/saltstack-adapter-lighty/pom.xml b/saltstack-adapter/saltstack-adapter-lighty/pom.xml deleted file mode 100755 index c82bf6121..000000000 --- a/saltstack-adapter/saltstack-adapter-lighty/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - saltstack-adapter-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - saltstack-adapter-provider - ${project.version} - - - org.onap.ccsdk.sli.adaptors - saltstack-adapter-provider - ${project.version} - compile - - - diff --git a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java deleted file mode 100755 index 0ea5a589d..000000000 --- a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/SaltstackAdapterPropertiesProviderImplLighty.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : CCSDK - * ================================================================================ - * Copyright (C) 2018 Samsung Electronics. All rights reserved. - * ================================================================================ - * - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * ============LICENSE_END========================================================= - */ - -package org.onap.ccsdk.sli.adaptors.saltstack.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; -import java.util.Properties; -import java.util.Vector; -import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapterPropertiesProvider; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; -import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; -import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; -import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link SaltstackAdapterPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES - */ -public class SaltstackAdapterPropertiesProviderImplLighty implements SaltstackAdapterPropertiesProvider { - - private static final Logger LOG = LoggerFactory.getLogger(SaltstackAdapterPropertiesProviderImplLighty.class); - - /** - * The name of the properties file for database configuration - */ - private static final String SALTSTACKADAPTER_PROP_FILE_NAME = "saltstack-adapter.properties"; - - /** - * A prioritized list of strategies for resolving sql-resource properties files. - */ - private Vector saltstackAdapterPropertiesFileResolvers = new Vector<>(); - - /** - * The configuration properties for the db connection. - */ - private Properties properties; - - /** - * Set up the prioritized list of strategies for resolving dblib properties - * files. - */ - public SaltstackAdapterPropertiesProviderImplLighty() { - saltstackAdapterPropertiesFileResolvers - .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); - saltstackAdapterPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); - saltstackAdapterPropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); - - // determines properties file as according to the priority described in the - // class header comment - final File propertiesFile = determinePropertiesFile(this); - if (propertiesFile != null) { - try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { - properties = new Properties(); - properties.load(fileInputStream); - } catch (final IOException e) { - LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), - new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), - e)); - } - } else { - // Try to read properties as resource - - InputStream propStr = getClass().getResourceAsStream("/" + SALTSTACKADAPTER_PROP_FILE_NAME); - if (propStr != null) { - properties = new Properties(); - try { - properties.load(propStr); - propStr.close(); - } catch (IOException e) { - properties = null; - } - } - - } - - if (properties == null) { - reportFailure("Missing configuration properties resource(3)", new ConfigurationException( - "Missing configuration properties resource(3): " + SALTSTACKADAPTER_PROP_FILE_NAME)); - - LOG.info("Defaulting org.onap.appc.adapter.saltstack.clientType to NONE"); - - properties = new Properties(); - properties.setProperty("org.onap.appc.adapter.saltstack.clientType", "NONE"); - } - } - - /** - * Reports the method chosen for properties resolution to the - * Logger. - * - * @param message Some user friendly message - * @param fileOptional The file location of the chosen properties file - * @return the file location of the chosen properties file - */ - private static File reportSuccess(final String message, final Optional fileOptional) { - if (fileOptional.isPresent()) { - final File file = fileOptional.get(); - LOG.info("{} {}", message, file.getPath()); - return file; - } - return null; - } - - /** - * Reports fatal errors. This is the case in which no properties file could be - * found. - * - * @param message An appropriate fatal error message - * @param configurationException An exception describing what went wrong during resolution - */ - private static void reportFailure(final String message, final ConfigurationException configurationException) { - - LOG.error("{}", message, configurationException); - } - - /** - * Extract svclogic config properties. - * - * @return the svclogic config properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Determines the sql-resource properties file to use based on the following priority: - *
    - *
  1. A directory identified by the system environment variable - * SDNC_CONFIG_DIR
  2. - *
  3. The default directory DEFAULT_DBLIB_PROP_DIR
  4. - *
  5. A directory identified by the JRE argument - * sql-resource.properties
  6. - *
  7. A sql-resource.properties file located in the karaf root - * directory
  8. - *
- */ - File determinePropertiesFile(final SaltstackAdapterPropertiesProviderImplLighty resourceProvider) { - - for (final PropertiesFileResolver sliPropertiesFileResolver : saltstackAdapterPropertiesFileResolvers) { - final Optional fileOptional = sliPropertiesFileResolver.resolveFile(SALTSTACKADAPTER_PROP_FILE_NAME); - if (fileOptional.isPresent()) { - return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); - } - } - - return null; - } -} diff --git a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java b/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java deleted file mode 100644 index 2f58d1f75..000000000 --- a/saltstack-adapter/saltstack-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/lighty/SaltstackAdapterModule.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.saltstack.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapter; -import org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterImpl; -import org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterPropertiesProviderImplLighty; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the saltstack-adapter-provider artifact. - */ -public class SaltstackAdapterModule extends AbstractLightyModule { - - private static final Logger LOG = LoggerFactory.getLogger(SaltstackAdapterModule.class); - - private SaltstackAdapterPropertiesProviderImplLighty salstackPropertiesProvider; - private SaltstackAdapterImpl saltstackAdapter; - - @Override - protected boolean initProcedure() { - this.salstackPropertiesProvider = new SaltstackAdapterPropertiesProviderImplLighty(); - try { - this.saltstackAdapter = new SaltstackAdapterImpl(salstackPropertiesProvider); - } catch (SvcLogicException e) { - LOG.error("Exception thrown while initializing {} in {}!", SaltstackAdapterImpl.class, this.getClass(), e); - } - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public SaltstackAdapterPropertiesProviderImplLighty getSalstackPropertiesProvider() { - return this.salstackPropertiesProvider; - } - - public SaltstackAdapter getSaltstackAdapter() { - return saltstackAdapter; - } -} diff --git a/sql-resource/lighty/pom.xml b/sql-resource/lighty/pom.xml deleted file mode 100755 index c0ad68e32..000000000 --- a/sql-resource/lighty/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - sql-resource-lighty - 0.6.1-SNAPSHOT - jar - - ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - http://maven.apache.org - - - UTF-8 - - - - - - org.onap.ccsdk.sli.core - ccsdk-lighty-dependency-versions - ${project.version} - pom - import - - - - - - - io.lighty.core - lighty-controller - - - org.onap.ccsdk.sli.adaptors - sql-resource-provider - ${project.version} - - - org.onap.ccsdk.sli.core - dblib-provider - ${project.version} - - - org.onap.ccsdk.sli.core - sli-provider - ${project.version} - provided - - - diff --git a/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java b/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java deleted file mode 100644 index fc760ba58..000000000 --- a/sql-resource/lighty/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/lighty/SqlModule.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - */ -package org.onap.ccsdk.sli.adaptors.resource.sql.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource; -import org.onap.ccsdk.sli.adaptors.resource.sql.SqlResourcePropertiesProviderImpl; -import org.onap.ccsdk.sli.core.dblib.DbLibService; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the sql-resource-provider artifact. - */ -public class SqlModule extends AbstractLightyModule { - - private final DbLibService dbService; - - private SqlResourcePropertiesProviderImpl sqlPropertiesProvider; - private SqlResource sqlResource; - - public SqlModule(DbLibService dbService) { - this.dbService = dbService; - } - - @Override - protected boolean initProcedure() { - this.sqlPropertiesProvider = new SqlResourcePropertiesProviderImpl(); - this.sqlResource = new SqlResource(sqlPropertiesProvider, dbService); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public SqlResource getSqlResource() { - return sqlResource; - } -} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 9c25b8173..070afb089 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -21,7 +21,6 @@ provider features installer - lighty -- cgit 1.2.3-korg From c3bfb60fff8fc530bdba7e0f3338c3a5e37899ea Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 5 Sep 2019 10:58:54 -0400 Subject: Add junit coverage Add junit test coverage for sli/adaptors Change-Id: Ia487abd65ef9ed10d66c25e455414cd8fc736943 Issue-ID: CCSDK-1694 Signed-off-by: Timoney, Dan (dt5972) --- .../ccsdk/sli/adaptors/rm/util/LabelUtilTest.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtilTest.java (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtilTest.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtilTest.java new file mode 100644 index 000000000..eb903ecdc --- /dev/null +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/rm/util/LabelUtilTest.java @@ -0,0 +1,45 @@ +package jtest.org.onap.ccsdk.sli.adaptors.rm.util; + +import org.junit.Test; +import org.onap.ccsdk.sli.adaptors.rm.data.AllocationItem; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelAllocationRequest; +import org.onap.ccsdk.sli.adaptors.rm.data.LabelResource; +import org.onap.ccsdk.sli.adaptors.rm.util.LabelUtil; + +import java.util.Date; + +import static org.junit.Assert.*; + +public class LabelUtilTest { + + @Test + public void testLabelUtils() { + LabelAllocationRequest req = new LabelAllocationRequest(); + req.check = true; + req.allocate = true; + req.label = "testLabel"; + req.resourceUnionId = "123"; + req.applicationId = "testApp"; + req.assetId = "asset1"; + req.resourceName = "resource1"; + req.resourceSetId = "set1"; + + + + LabelResource resource = new LabelResource(); + resource.label = "testLabel"; + + LabelUtil.allocateLabel(resource, req); + LabelUtil.checkLabel(resource, req); + LabelUtil.recalculate(resource); + + + + + + + + } + + +} \ No newline at end of file -- cgit 1.2.3-korg From 4736befed266373062619037ca55db4d6c9c2fb0 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 10 Sep 2019 16:16:07 -0400 Subject: Roll version for Frankfurt release Roll version in master branch to Frankfurt version (0.7.0-SNAPSHOT) Change-Id: I668004304935d1d1c312749f4c2507a159db4f0f Issue-ID: CCSDK-1701 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 4 ++-- aai-service/features/features-aai-service/pom.xml | 4 ++-- aai-service/features/pom.xml | 4 ++-- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- .../ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 4 ++-- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-features/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- base/http/features/ccsdk-base-http/pom.xml | 4 ++-- base/http/features/features-base-http/pom.xml | 4 ++-- base/http/features/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/features-mdsal-resource/pom.xml | 4 ++-- mdsal-resource/features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- .../consumer/features/features-messagerouter-consumer/pom.xml | 4 ++-- message-router/consumer/features/pom.xml | 4 ++-- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- .../publisher/features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- .../publisher/features/features-messagerouter-publisher/pom.xml | 4 ++-- message-router/publisher/features/pom.xml | 4 ++-- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 4 ++-- netbox-client/features/features-netbox-client/pom.xml | 4 ++-- netbox-client/features/pom.xml | 4 ++-- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/features-resource-assignment/pom.xml | 4 ++-- resource-assignment/features/pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-features/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/features/ccsdk-sql-resource/pom.xml | 4 ++-- sql-resource/features/features-sql-resource/pom.xml | 4 ++-- sql-resource/features/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 4 ++-- 72 files changed, 137 insertions(+), 137 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index f9623e425..cdc00fea4 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 0a6fe2b8b..c78fdf01f 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-aai-service - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 250f6f8af..78241eded 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index fd13163d4..544ca9341 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index a2e18c900..b30be9f4c 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 7f1ab2063..142e381d2 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 0f33402e6..c73018b28 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index a4a5b8e45..bf0b5b543 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index e3551d8b7..a578bb63f 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-ansible-adapter - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 371aa901f..27ce13e4e 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 89ba417a8..8b53dfb37 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 8ab564a72..3c88518cc 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index cb4603cd2..bda25dfab 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml index 2f1014665..3bbf4719f 100644 --- a/base/http/features/ccsdk-base-http/pom.xml +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml index 856458467..e46c69842 100644 --- a/base/http/features/features-base-http/pom.xml +++ b/base/http/features/features-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-base-http - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml index a8d2d42b6..5b237baf5 100644 --- a/base/http/features/pom.xml +++ b/base/http/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index fea814a4c..8514a0220 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index 8db53036d..aa66f593e 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 293cc1603..56728be61 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index a2a81130a..ca9c326a4 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT @@ -12,7 +12,7 @@ pom org.onap.ccsdk.sli.adaptors base-parent - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT http diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 9751f0498..44e9e0d30 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index e22d2bfcb..f35fa4228 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 397a4efde..b1a98c816 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 42a19590b..4acec5b01 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index f15910c72..41b0ef326 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 1fb761cc2..6f781c9e8 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-mdsal-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index c92c3a717..5838805f5 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 243e7bc07..5278b349a 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 87565f714..e0264c1af 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index dd23d85e6..5f2bfe175 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 6a1b06a8f..17ed5d13f 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT consumer.api diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index ceb518bd8..774139b32 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index 0144e761a..d1ece9ce8 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-consumer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index 3b470600a..20dc81431 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 985edc127..876232b1e 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 01fc945e0..0960b8f0f 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index 032116efb..3b03cff9f 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 8e86b4b3b..f5c0726cb 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 9cc3942d4..9e52ee534 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT publisher.api diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 25fc225d4..2260d2610 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 0005b76e0..14a5fcaaf 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter features-messagerouter-publisher - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 7a18303f0..52e705500 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,12 +16,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} pom diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index af3314b75..b6fb5b022 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 3d17f68e6..daad3646a 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 1cff228d5..0966f0d42 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 49b52d5bf..0aa6b6eba 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT sample.client diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index a0f2580f5..e006b1976 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index fc51c2870..66b7be493 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-netbox-client - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 89f4c7c24..70b70852c 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 9244ffad6..c8e4c01c8 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index a4c8040ea..fe90341c3 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 06a919dea..475eeb593 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index 0cab4278d..d88f1bf7f 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT 4.0.0 @@ -111,7 +111,7 @@ ONAP - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 975f24b01..834a0da01 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 7b9eaae29..074b8fc21 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-resource-assignment - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index dc2601256..e0f225186 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 1af542668..abf28a9f3 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 8b53a45c3..028169fb4 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 96a96fd87..b9194bd14 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 57f868737..229cc67f6 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index ebbead493..de4b4e184 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index b02b8f4f0..de6615549 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-saltstack-adapter - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index f6d430605..56050d289 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,12 +15,12 @@ odlparent-lite org.onap.ccsdk.parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 2c217c047..c2f55ac8a 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index cd2709cab..f4850cccc 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 48a3c541d..74fd8d45b 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 928e9a9b0..c8e81aadb 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sql-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 28b1c6400..e1811d5fa 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-features - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index e451161d0..60b746b96 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 070afb089..538228797 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 2afccfb68..e255a9d3c 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.4.1-SNAPSHOT + 1.5.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.6.1-SNAPSHOT + 0.7.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 54d8edb35..d6537b40b 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=0 -sprint_number=6 -feature_revision=1 +sprint_number=7 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From a609b5ca43ab3aebde2004cf807795eec1a9dea9 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 13 Nov 2019 09:39:46 -0500 Subject: Use 1.5.0 parent pom Use released 1.5.0 version of parent pom Change-Id: I296db09cd94de93c150da5c2be5b34348ee320d7 Issue-ID: CCSDK-1920 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 252 ++++++++++----------- .../ccsdk-ansible-adapter/pom.xml | 2 +- .../features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- base/http/features/ccsdk-base-http/pom.xml | 2 +- base/http/features/features-base-http/pom.xml | 2 +- base/http/features/pom.xml | 2 +- base/http/installer/pom.xml | 2 +- base/http/pom.xml | 2 +- base/http/provider/pom.xml | 2 +- base/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- .../features/ccsdk-mdsal-resource/pom.xml | 2 +- .../features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- .../features/ccsdk-messagerouter-consumer/pom.xml | 2 +- .../features-messagerouter-consumer/pom.xml | 2 +- message-router/consumer/features/pom.xml | 2 +- message-router/pom.xml | 2 +- .../features/ccsdk-messagerouter-publisher/pom.xml | 2 +- .../features-messagerouter-publisher/pom.xml | 2 +- message-router/publisher/features/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- .../features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- .../features/ccsdk-resource-assignment/pom.xml | 2 +- .../features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../ccsdk-saltstack-adapter/pom.xml | 58 ++--- .../features-saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/pom.xml | 2 +- .../saltstack-adapter-installer/pom.xml | 2 +- .../saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- .../features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 62 files changed, 215 insertions(+), 215 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index cdc00fea4..643f373fa 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index c78fdf01f..9cffcc7d1 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 78241eded..5651eb3bf 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 544ca9341..e13ccefd5 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index b30be9f4c..9ec1d7595 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index f63bc424e..6a3ae8c50 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 614fe6d57..7dc711dc1 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -1,132 +1,132 @@ + ONAP : APPC ================================================================================ + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Copyright (C) 2017 Amdocs ============================================================================= + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. ECOMP is + a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - 4.0.0 - - org.onap.ccsdk.parent - binding-parent - 1.5.0-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-bundle - 0.7.0-SNAPSHOT - bundle - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} - - - - ${project.version} - - - - - - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import - - - - - - - com.att.eelf - eelf-core - - - commons-codec - commons-codec - - - commons-logging - commons-logging - - - - org.apache.httpcomponents - httpclient - - - - - - org.glassfish.jersey.core - jersey-common - test - - - - org.codehaus.jackson - jackson-jaxrs - test - - - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.onap.ccsdk.sli.core - sli-common - provided - - - - org.onap.ccsdk.sli.core - sli-provider - provided - - - - org.osgi - org.osgi.core - provided - - - org.slf4j - slf4j-api - - - - org.slf4j - jcl-over-slf4j - - - - org.json - json - - - - - com.google.guava - guava - - - - + 4.0.0 + + org.onap.ccsdk.parent + binding-parent + 1.5.0 + + + + org.onap.ccsdk.sli.adaptors + ansible-adapter-bundle + 0.7.0-SNAPSHOT + bundle + ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + + + + ${project.version} + + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + + + + com.att.eelf + eelf-core + + + commons-codec + commons-codec + + + commons-logging + commons-logging + + + + org.apache.httpcomponents + httpclient + + + + + + org.glassfish.jersey.core + jersey-common + test + + + + org.codehaus.jackson + jackson-jaxrs + test + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.onap.ccsdk.sli.core + sli-common + provided + + + + org.onap.ccsdk.sli.core + sli-provider + provided + + + + org.osgi + org.osgi.core + provided + + + org.slf4j + slf4j-api + + + + org.slf4j + jcl-over-slf4j + + + + org.json + json + + + + + com.google.guava + guava + + + + diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 523d45069..7a9db04da 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index a578bb63f..6b8564047 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index 27ce13e4e..d550902c4 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 8b53dfb37..6a4b9005f 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 3c88518cc..12ac7e09e 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index bda25dfab..537996cc2 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml index 3bbf4719f..2ff90f62e 100644 --- a/base/http/features/ccsdk-base-http/pom.xml +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml index e46c69842..24e3cf0ad 100644 --- a/base/http/features/features-base-http/pom.xml +++ b/base/http/features/features-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml index 5b237baf5..69faf5c21 100644 --- a/base/http/features/pom.xml +++ b/base/http/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index 8514a0220..e8d6be3aa 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/pom.xml b/base/http/pom.xml index aa66f593e..8c6e92289 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 642238cd2..4e41a8f54 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/base/pom.xml b/base/pom.xml index ca9c326a4..484bfe657 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 44e9e0d30..44757871e 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index f35fa4228..ca35ad413 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index b1a98c816..0cf43cfd6 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/features/pom.xml b/features/pom.xml index 4acec5b01..ce63c6cfb 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index ab512ed63..ccebd3f9f 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 6f781c9e8..136108797 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 5838805f5..4f907a53a 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 5278b349a..0d78b8d66 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index e0264c1af..3c98e88aa 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 5f2bfe175..8672d15e5 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index 774139b32..b6f62b3b9 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index d1ece9ce8..58d526e5c 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index 20dc81431..c649fdffc 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/pom.xml b/message-router/pom.xml index f5c0726cb..90b25c6bd 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index 2260d2610..d59ab5254 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 14a5fcaaf..6297e65e2 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index 52e705500..ba9e8ce61 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 13dc8bf97..41e44422e 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 66b7be493..7a59b65ca 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index 70b70852c..ac0d37965 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index c8e4c01c8..d872be5a4 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index fe90341c3..b14b9b6b1 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index b8fa494ad..7a1a5abc7 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/pom.xml b/pom.xml index d88f1bf7f..0c3281b25 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 834a0da01..ee5c1bc10 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 074b8fc21..91026c828 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index e0f225186..a566e0624 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index abf28a9f3..d05a610a9 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 028169fb4..3329aa867 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index b9194bd14..a8fe3304a 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 229cc67f6..efcdb6e23 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index de4b4e184..44aad078c 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -1,38 +1,38 @@ - 4.0.0 + 4.0.0 - - org.onap.ccsdk.parent - single-feature-parent - 1.5.0-SNAPSHOT - - + + org.onap.ccsdk.parent + single-feature-parent + 1.5.0 + + - org.onap.ccsdk.sli.adaptors - ccsdk-saltstack-adapter - 0.7.0-SNAPSHOT - feature + org.onap.ccsdk.sli.adaptors + ccsdk-saltstack-adapter + 0.7.0-SNAPSHOT + feature - ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} - - ${project.version} - + + ${project.version} + - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - - - ${project.groupId} - saltstack-adapter-provider - ${project.version} - - + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + + + ${project.groupId} + saltstack-adapter-provider + ${project.version} + + diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index de6615549..e44f20e42 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 56050d289..5a2bea47b 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,7 +15,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index c2f55ac8a..ab407100b 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index f4850cccc..591394960 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 74fd8d45b..8c0f442c8 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index c8e81aadb..6ef384ae5 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index e1811d5fa..6300f980e 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 60b746b96..16a85a2f2 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 538228797..4160c06d3 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0-SNAPSHOT + 1.5.0 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index e255a9d3c..9d4350656 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0-SNAPSHOT + 1.5.0 -- cgit 1.2.3-korg From f2e0976cb492b1e0ec48761f61cdfb543ad50462 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Tue, 19 Nov 2019 13:12:27 -0500 Subject: Fix versions of sli core dependencies Fix to override ccsdk sli core version from parent pom with current version Change-Id: Ibd5ef12c65286a089332ed21ea7d85d90ac72911 Issue-ID: CCSDK-1944 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 1 + aai-service/provider/pom.xml | 1 + ansible-adapter/ansible-adapter-bundle/pom.xml | 1 + ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 1 + mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 1 + mdsal-resource/provider/pom.xml | 1 + netbox-client/features/ccsdk-netbox-client/pom.xml | 1 + netbox-client/provider/pom.xml | 1 + resource-assignment/features/ccsdk-resource-assignment/pom.xml | 1 + resource-assignment/provider/pom.xml | 1 + .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 1 + saltstack-adapter/saltstack-adapter-provider/pom.xml | 1 + sql-resource/features/ccsdk-sql-resource/pom.xml | 1 + sql-resource/provider/pom.xml | 1 + 14 files changed, 14 insertions(+) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 643f373fa..7a99f7d4e 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -18,6 +18,7 @@ + ${project.version} ${project.version} diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 6a3ae8c50..32f84e258 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -17,6 +17,7 @@ ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + ${project.version} ${project.version} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 7dc711dc1..b90053245 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -29,6 +29,7 @@ + ${project.version} ${project.version} diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index 7a9db04da..b1f8ec184 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -17,6 +17,7 @@ ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} + ${project.version} ${project.version} diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index ccebd3f9f..d31b36cbc 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -18,6 +18,7 @@ + ${project.version} ${project.version} diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 8672d15e5..022cac772 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -19,6 +19,7 @@ UTF-8 + ${project.version} ${project.version} diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 41e44422e..8bb8af96d 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -33,6 +33,7 @@ + ${project.version} ${project.version} diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 7a1a5abc7..64104e206 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -32,6 +32,7 @@ ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + ${project.version} ${project.version} diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index ee5c1bc10..2e5413e51 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -18,6 +18,7 @@ + ${project.version} ${project.version} diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index a8fe3304a..30f7a8bb4 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -19,6 +19,7 @@ UTF-8 + ${project.version} ${project.version} diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 44aad078c..485a9ac0d 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -17,6 +17,7 @@ ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + ${project.version} ${project.version} diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 591394960..9f4c4ea89 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -28,6 +28,7 @@ + ${project.version} ${project.version} diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index 8c0f442c8..c2d4e43f6 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -18,6 +18,7 @@ + ${project.version} ${project.version} diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 9d4350656..88ae02afe 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -19,6 +19,7 @@ UTF-8 + ${project.version} ${project.version} -- cgit 1.2.3-korg From 54f98b397826e9d4281af1446b0227cdcf36f4a3 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Mon, 2 Dec 2019 12:35:00 -0500 Subject: Use 1.5.1-SNAPSHOT version of parent pom Fixed version of parent pom to use snapshot version Change-Id: Iec34f6ca9bd1ab14d4c1c8a837e3b693bd716069 Issue-ID: CCSDK-1935 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 2 +- aai-service/features/features-aai-service/pom.xml | 2 +- aai-service/features/pom.xml | 2 +- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml | 2 +- .../ansible-adapter-features/features-ansible-adapter/pom.xml | 2 +- ansible-adapter/ansible-adapter-features/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- base/http/features/ccsdk-base-http/pom.xml | 2 +- base/http/features/features-base-http/pom.xml | 2 +- base/http/features/pom.xml | 2 +- base/http/installer/pom.xml | 2 +- base/http/pom.xml | 2 +- base/http/provider/pom.xml | 2 +- base/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/features/ccsdk-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/features-mdsal-resource/pom.xml | 2 +- mdsal-resource/features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml | 2 +- .../consumer/features/features-messagerouter-consumer/pom.xml | 2 +- message-router/consumer/features/pom.xml | 2 +- message-router/pom.xml | 2 +- message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml | 2 +- .../publisher/features/features-messagerouter-publisher/pom.xml | 2 +- message-router/publisher/features/pom.xml | 2 +- netbox-client/features/ccsdk-netbox-client/pom.xml | 2 +- netbox-client/features/features-netbox-client/pom.xml | 2 +- netbox-client/features/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/features/ccsdk-resource-assignment/pom.xml | 2 +- resource-assignment/features/features-resource-assignment/pom.xml | 2 +- resource-assignment/features/pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml | 2 +- .../saltstack-adapter-features/features-saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-features/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/features/ccsdk-sql-resource/pom.xml | 2 +- sql-resource/features/features-sql-resource/pom.xml | 2 +- sql-resource/features/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 62 files changed, 62 insertions(+), 62 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml index 7a99f7d4e..aaa18ab95 100644 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ b/aai-service/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml index 9cffcc7d1..6bd97ef25 100755 --- a/aai-service/features/features-aai-service/pom.xml +++ b/aai-service/features/features-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml index 5651eb3bf..68dc26f06 100755 --- a/aai-service/features/pom.xml +++ b/aai-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index e13ccefd5..a1f7f5117 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 9ec1d7595..5c92bd415 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 32f84e258..aca8ab8dd 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index b90053245..9ae7f584b 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml index b1f8ec184..9b6c89bb1 100644 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml index 6b8564047..91a6fc9b2 100755 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml index d550902c4..9d9f088c8 100644 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ b/ansible-adapter/ansible-adapter-features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 6a4b9005f..5f71725ce 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 12ac7e09e..68ffdce8a 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 537996cc2..1d1abb6e0 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml index 2ff90f62e..168f6f43f 100644 --- a/base/http/features/ccsdk-base-http/pom.xml +++ b/base/http/features/ccsdk-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml index 24e3cf0ad..4a038f99a 100644 --- a/base/http/features/features-base-http/pom.xml +++ b/base/http/features/features-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml index 69faf5c21..ef98e5317 100644 --- a/base/http/features/pom.xml +++ b/base/http/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index e8d6be3aa..7f8d3e8fe 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/pom.xml b/base/http/pom.xml index 8c6e92289..2ec203250 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 4e41a8f54..34a866c28 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/base/pom.xml b/base/pom.xml index 484bfe657..bc81212fd 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 44757871e..ae26d4cbb 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index ca35ad413..a3e5f17ef 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 0cf43cfd6..30174b0a3 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/features/pom.xml b/features/pom.xml index ce63c6cfb..17fbcf271 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml index d31b36cbc..76e212bcc 100644 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml index 136108797..96c2589bd 100755 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ b/mdsal-resource/features/features-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml index 4f907a53a..e1c15e499 100755 --- a/mdsal-resource/features/pom.xml +++ b/mdsal-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 0d78b8d66..4c5472ccf 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 3c98e88aa..f19064760 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 022cac772..1c8839bd4 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml index b6f62b3b9..6ab191e64 100755 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml index 58d526e5c..f90de46c3 100755 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ b/message-router/consumer/features/features-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml index c649fdffc..46e289ac5 100755 --- a/message-router/consumer/features/pom.xml +++ b/message-router/consumer/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/pom.xml b/message-router/pom.xml index 90b25c6bd..29652e81e 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml index d59ab5254..21b498d1a 100755 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml index 6297e65e2..860b46c03 100755 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ b/message-router/publisher/features/features-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml index ba9e8ce61..38ad37c7f 100644 --- a/message-router/publisher/features/pom.xml +++ b/message-router/publisher/features/pom.xml @@ -16,7 +16,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml index 8bb8af96d..0b03d275c 100644 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ b/netbox-client/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml index 7a59b65ca..4cd3a3bc6 100755 --- a/netbox-client/features/features-netbox-client/pom.xml +++ b/netbox-client/features/features-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml index ac0d37965..a8b8cd726 100755 --- a/netbox-client/features/pom.xml +++ b/netbox-client/features/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index d872be5a4..e9f437e19 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index b14b9b6b1..88e37a1ab 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 64104e206..d73751614 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 0c3281b25..81a8d1c60 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT 4.0.0 diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml index 2e5413e51..03feeaadd 100644 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ b/resource-assignment/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml index 91026c828..6919271a6 100755 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ b/resource-assignment/features/features-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml index a566e0624..94a45aa1e 100755 --- a/resource-assignment/features/pom.xml +++ b/resource-assignment/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index d05a610a9..9d111a6e0 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 3329aa867..b03a65820 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 30f7a8bb4..43c50ceb2 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index efcdb6e23..21a6b88ca 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml index 485a9ac0d..fc0598ecd 100644 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml index e44f20e42..a792f8f46 100755 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml index 5a2bea47b..1b5e61c80 100644 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ b/saltstack-adapter/saltstack-adapter-features/pom.xml @@ -15,7 +15,7 @@ odlparent-lite org.onap.ccsdk.parent - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index ab407100b..47deb556f 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 9f4c4ea89..606a45f4f 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml index c2d4e43f6..bab202094 100644 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ b/sql-resource/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml index 6ef384ae5..a85ff700a 100755 --- a/sql-resource/features/features-sql-resource/pom.xml +++ b/sql-resource/features/features-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml index 6300f980e..5046316be 100755 --- a/sql-resource/features/pom.xml +++ b/sql-resource/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 16a85a2f2..ffff87c24 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 4160c06d3..a08406bb8 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.0 + 1.5.1-SNAPSHOT diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 88ae02afe..49a5a92e6 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.0 + 1.5.1-SNAPSHOT -- cgit 1.2.3-korg From 98e280c2cd8a777ed953606022aa7afd94b38d18 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 5 Dec 2019 14:09:05 -0500 Subject: Clean up installer Clean up installers to install only ONAP code, not third party dependencies. Third party dependencies should be installed in ccsdk/distribution/dependencies only. Change-Id: I02cbe548db11ed453cb2f5ac9ac4b63cd247a511 Issue-ID: CCSDK-1979 Signed-off-by: Timoney, Dan (dt5972) --- ansible-adapter/ansible-adapter-installer/pom.xml | 3 ++- pom.xml | 2 +- resource-assignment/installer/pom.xml | 17 +---------------- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- 4 files changed, 5 insertions(+), 19 deletions(-) (limited to 'resource-assignment') diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 5f71725ce..f4eee6e66 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -119,7 +119,8 @@ true false false - org.opendaylight + org.onap.ccsdk.sli.adaptors + provided diff --git a/pom.xml b/pom.xml index 81a8d1c60..c8fe41506 100755 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ mdsal-resource resource-assignment sql-resource - base + base message-router features artifacts diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 9d111a6e0..7055ebf64 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -45,21 +45,6 @@ ${project.version} - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - @@ -119,7 +104,7 @@ true false false - org.onap.ccsdk.sli.core,org.opendaylight + org.onap.ccsdk.sli.adaptors provided diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 47deb556f..96c59a044 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -132,7 +132,7 @@ true false false - org.opendaylight + org.onap.ccsdk.sli.adaptors provided -- cgit 1.2.3-korg From bc18e2c019f4b16752ae25fa50b436e7cd65c8e8 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 13 Dec 2019 12:42:39 -0500 Subject: Refactor features to separate installer Refactor karaf feature.xml files to separate installer Change-Id: I4dc4ad3c139522b12f41f1786ef16bfdd556f2b9 Issue-ID: CCSDK-1754 Signed-off-by: Timoney, Dan (dt5972) --- aai-service/features/ccsdk-aai-service/pom.xml | 44 ------- aai-service/features/features-aai-service/pom.xml | 33 ------ aai-service/features/pom.xml | 23 ---- aai-service/pom.xml | 1 - .../ansible-adapter-features/.gitignore | 26 ---- .../ccsdk-ansible-adapter/pom.xml | 43 ------- .../features-ansible-adapter/pom.xml | 33 ------ ansible-adapter/ansible-adapter-features/pom.xml | 33 ------ ansible-adapter/ansible-adapter-installer/pom.xml | 14 +-- ansible-adapter/pom.xml | 1 - base/http/features/ccsdk-base-http/pom.xml | 26 ---- base/http/features/features-base-http/pom.xml | 29 ----- base/http/features/pom.xml | 23 ---- base/http/installer/pom.xml | 14 --- base/http/pom.xml | 1 - features/ccsdk-aai-service/pom.xml | 44 +++++++ features/ccsdk-ansible-adapter/pom.xml | 43 +++++++ features/ccsdk-base-http/pom.xml | 26 ++++ features/ccsdk-mdsal-resource/pom.xml | 43 +++++++ features/ccsdk-messagerouter-consumer/pom.xml | 30 +++++ features/ccsdk-messagerouter-publisher/pom.xml | 30 +++++ features/ccsdk-netbox-client/pom.xml | 67 +++++++++++ features/ccsdk-resource-assignment/pom.xml | 53 +++++++++ features/ccsdk-saltstack-adapter/pom.xml | 39 ++++++ features/ccsdk-sql-resource/pom.xml | 50 ++++++++ features/installer/pom.xml | 131 ++++++++++++++++++++- features/pom.xml | 10 ++ .../features/ccsdk-mdsal-resource/pom.xml | 43 ------- .../features/features-mdsal-resource/pom.xml | 33 ------ mdsal-resource/features/pom.xml | 23 ---- mdsal-resource/installer/pom.xml | 15 --- mdsal-resource/pom.xml | 1 - .../features/ccsdk-messagerouter-consumer/pom.xml | 30 ----- .../features-messagerouter-consumer/pom.xml | 33 ------ message-router/consumer/features/pom.xml | 33 ------ .../consumer/features/src/main/feature/feature.xml | 12 -- message-router/consumer/installer/pom.xml | 7 -- message-router/consumer/pom.xml | 1 - .../features/ccsdk-messagerouter-publisher/pom.xml | 30 ----- .../features-messagerouter-publisher/pom.xml | 33 ------ message-router/publisher/features/pom.xml | 33 ------ .../features/src/main/feature/feature.xml | 16 --- message-router/publisher/installer/pom.xml | 7 -- message-router/publisher/pom.xml | 1 - netbox-client/features/ccsdk-netbox-client/pom.xml | 67 ----------- .../features/features-netbox-client/pom.xml | 48 -------- netbox-client/features/pom.xml | 38 ------ netbox-client/installer/pom.xml | 14 +-- netbox-client/pom.xml | 1 - .../features/ccsdk-resource-assignment/pom.xml | 53 --------- .../features/features-resource-assignment/pom.xml | 33 ------ resource-assignment/features/pom.xml | 23 ---- resource-assignment/installer/pom.xml | 14 --- resource-assignment/pom.xml | 1 - saltstack-adapter/pom.xml | 1 - .../saltstack-adapter-features/.gitignore | 26 ---- .../ccsdk-saltstack-adapter/pom.xml | 39 ------ .../features-saltstack-adapter/pom.xml | 34 ------ .../saltstack-adapter-features/pom.xml | 33 ------ .../src/main/resources/features.xml | 42 ------- .../saltstack-adapter-installer/pom.xml | 14 +-- sql-resource/features/ccsdk-sql-resource/pom.xml | 50 -------- .../features/features-sql-resource/pom.xml | 33 ------ sql-resource/features/pom.xml | 23 ---- .../features/src/main/resources/features.xml | 39 ------ sql-resource/installer/pom.xml | 14 --- sql-resource/pom.xml | 1 - 67 files changed, 568 insertions(+), 1334 deletions(-) delete mode 100644 aai-service/features/ccsdk-aai-service/pom.xml delete mode 100755 aai-service/features/features-aai-service/pom.xml delete mode 100755 aai-service/features/pom.xml delete mode 100644 ansible-adapter/ansible-adapter-features/.gitignore delete mode 100644 ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml delete mode 100755 ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml delete mode 100644 ansible-adapter/ansible-adapter-features/pom.xml delete mode 100644 base/http/features/ccsdk-base-http/pom.xml delete mode 100644 base/http/features/features-base-http/pom.xml delete mode 100644 base/http/features/pom.xml create mode 100644 features/ccsdk-aai-service/pom.xml create mode 100644 features/ccsdk-ansible-adapter/pom.xml create mode 100644 features/ccsdk-base-http/pom.xml create mode 100644 features/ccsdk-mdsal-resource/pom.xml create mode 100755 features/ccsdk-messagerouter-consumer/pom.xml create mode 100755 features/ccsdk-messagerouter-publisher/pom.xml create mode 100644 features/ccsdk-netbox-client/pom.xml create mode 100644 features/ccsdk-resource-assignment/pom.xml create mode 100644 features/ccsdk-saltstack-adapter/pom.xml create mode 100644 features/ccsdk-sql-resource/pom.xml delete mode 100644 mdsal-resource/features/ccsdk-mdsal-resource/pom.xml delete mode 100755 mdsal-resource/features/features-mdsal-resource/pom.xml delete mode 100755 mdsal-resource/features/pom.xml delete mode 100755 message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml delete mode 100755 message-router/consumer/features/features-messagerouter-consumer/pom.xml delete mode 100755 message-router/consumer/features/pom.xml delete mode 100755 message-router/consumer/features/src/main/feature/feature.xml delete mode 100755 message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml delete mode 100755 message-router/publisher/features/features-messagerouter-publisher/pom.xml delete mode 100644 message-router/publisher/features/pom.xml delete mode 100755 message-router/publisher/features/src/main/feature/feature.xml delete mode 100644 netbox-client/features/ccsdk-netbox-client/pom.xml delete mode 100755 netbox-client/features/features-netbox-client/pom.xml delete mode 100755 netbox-client/features/pom.xml delete mode 100644 resource-assignment/features/ccsdk-resource-assignment/pom.xml delete mode 100755 resource-assignment/features/features-resource-assignment/pom.xml delete mode 100755 resource-assignment/features/pom.xml delete mode 100644 saltstack-adapter/saltstack-adapter-features/.gitignore delete mode 100644 saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml delete mode 100755 saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml delete mode 100644 saltstack-adapter/saltstack-adapter-features/pom.xml delete mode 100644 saltstack-adapter/saltstack-adapter-features/src/main/resources/features.xml delete mode 100644 sql-resource/features/ccsdk-sql-resource/pom.xml delete mode 100755 sql-resource/features/features-sql-resource/pom.xml delete mode 100755 sql-resource/features/pom.xml delete mode 100644 sql-resource/features/src/main/resources/features.xml (limited to 'resource-assignment') diff --git a/aai-service/features/ccsdk-aai-service/pom.xml b/aai-service/features/ccsdk-aai-service/pom.xml deleted file mode 100644 index aaa18ab95..000000000 --- a/aai-service/features/ccsdk-aai-service/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-aai-service - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - - - ${project.version} - ${project.version} - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - - ${project.groupId} - aai-service-provider - ${project.version} - - - - - diff --git a/aai-service/features/features-aai-service/pom.xml b/aai-service/features/features-aai-service/pom.xml deleted file mode 100755 index 6bd97ef25..000000000 --- a/aai-service/features/features-aai-service/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-aai-service - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-aai-service - ${project.version} - xml - features - - - - diff --git a/aai-service/features/pom.xml b/aai-service/features/pom.xml deleted file mode 100755 index 68dc26f06..000000000 --- a/aai-service/features/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - aai-service-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - - - ccsdk-aai-service - features-aai-service - - diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 5c92bd415..71ad8adb2 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -19,7 +19,6 @@ provider - features installer diff --git a/ansible-adapter/ansible-adapter-features/.gitignore b/ansible-adapter/ansible-adapter-features/.gitignore deleted file mode 100644 index 8820cee57..000000000 --- a/ansible-adapter/ansible-adapter-features/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# ============LICENSE_START========================================== -# ONAP : APPC -# =================================================================== -# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the License); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# ============LICENSE_END============================================ -/target/ -/target-ide/ -/bin/ -/classes/ -/.settings/ diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml deleted file mode 100644 index 9b6c89bb1..000000000 --- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-ansible-adapter - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} - - - ${project.version} - ${project.version} - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - - ${project.groupId} - ansible-adapter-bundle - ${project.version} - - - - - diff --git a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml deleted file mode 100755 index 91a6fc9b2..000000000 --- a/ansible-adapter/ansible-adapter-features/features-ansible-adapter/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-ansible-adapter - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-ansible-adapter - ${project.version} - xml - features - - - - diff --git a/ansible-adapter/ansible-adapter-features/pom.xml b/ansible-adapter/ansible-adapter-features/pom.xml deleted file mode 100644 index 9d9f088c8..000000000 --- a/ansible-adapter/ansible-adapter-features/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - odlparent-lite - org.onap.ccsdk.parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors - ansible-adapter-features - 0.7.0-SNAPSHOT - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} - - pom - - - ccsdk-ansible-adapter - features-ansible-adapter - - diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index f4eee6e66..82a9a080f 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -42,19 +42,7 @@ false - - org.onap.ccsdk.sli.adaptors - ${application.name} - ${project.version} - features - xml - - - * - * - - - + org.onap.ccsdk.sli.adaptors ansible-adapter-bundle diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 68ffdce8a..cf3667d85 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -183,7 +183,6 @@ ansible-adapter-bundle - ansible-adapter-features ansible-adapter-installer diff --git a/base/http/features/ccsdk-base-http/pom.xml b/base/http/features/ccsdk-base-http/pom.xml deleted file mode 100644 index 168f6f43f..000000000 --- a/base/http/features/ccsdk-base-http/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-base-http - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: base-http :: ${project.artifactId} - - - - ${project.groupId} - base-http-provider - ${project.version} - - - diff --git a/base/http/features/features-base-http/pom.xml b/base/http/features/features-base-http/pom.xml deleted file mode 100644 index 4a038f99a..000000000 --- a/base/http/features/features-base-http/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-base-http - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: base-http :: ${project.artifactId} - - - - ${project.groupId} - ccsdk-base-http - ${project.version} - xml - features - - - - diff --git a/base/http/features/pom.xml b/base/http/features/pom.xml deleted file mode 100644 index ef98e5317..000000000 --- a/base/http/features/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - base-http-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: base-http :: ${project.artifactId} - - - ccsdk-base-http - features-base-http - - diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index 7f8d3e8fe..a974d82f9 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -25,20 +25,6 @@ - - org.onap.ccsdk.sli.adaptors - ${application.name} - ${project.version} - xml - features - - - * - * - - - - org.onap.ccsdk.sli.adaptors base-http-provider diff --git a/base/http/pom.xml b/base/http/pom.xml index 2ec203250..013f77e0a 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -16,7 +16,6 @@ provider - features installer diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml new file mode 100644 index 000000000..aaa18ab95 --- /dev/null +++ b/features/ccsdk-aai-service/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-aai-service + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} + + + + ${project.version} + ${project.version} + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + + ${project.groupId} + aai-service-provider + ${project.version} + + + + + diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml new file mode 100644 index 000000000..9b6c89bb1 --- /dev/null +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-ansible-adapter + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} + + + ${project.version} + ${project.version} + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + + ${project.groupId} + ansible-adapter-bundle + ${project.version} + + + + + diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml new file mode 100644 index 000000000..168f6f43f --- /dev/null +++ b/features/ccsdk-base-http/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-base-http + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: base-http :: ${project.artifactId} + + + + ${project.groupId} + base-http-provider + ${project.version} + + + diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml new file mode 100644 index 000000000..76e212bcc --- /dev/null +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-mdsal-resource + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} + + + + ${project.version} + ${project.version} + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + + ${project.groupId} + mdsal-resource-provider + ${project.version} + + + + diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml new file mode 100755 index 000000000..6ab191e64 --- /dev/null +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + org.onap.ccsdk.sli.adaptors.messagerouter + ccsdk-messagerouter-consumer + 0.7.0-SNAPSHOT + feature + + + + ${project.groupId} + consumer.api + ${project.version} + + + ${project.groupId} + consumer.provider + ${project.version} + + + + + diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml new file mode 100755 index 000000000..21b498d1a --- /dev/null +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + org.onap.ccsdk.sli.adaptors.messagerouter + ccsdk-messagerouter-publisher + 0.7.0-SNAPSHOT + feature + + + + ${project.groupId} + publisher.api + ${project.version} + + + ${project.groupId} + publisher.provider + ${project.version} + + + + + diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml new file mode 100644 index 000000000..0b03d275c --- /dev/null +++ b/features/ccsdk-netbox-client/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-netbox-client + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} + + + + ${project.version} + ${project.version} + + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + + org.onap.ccsdk.sli.core + ccsdk-dblib + ${ccsdk.sli.core.version} + xml + features + provided + + + + ${project.groupId} + netbox-client-provider + ${project.version} + + + diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml new file mode 100644 index 000000000..03feeaadd --- /dev/null +++ b/features/ccsdk-resource-assignment/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-resource-assignment + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} + + + + ${project.version} + ${project.version} + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + + org.onap.ccsdk.sli.core + ccsdk-dblib + ${ccsdk.sli.core.version} + xml + features + provided + + + + ${project.groupId} + resource-assignment-provider + ${project.version} + + + + + diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml new file mode 100644 index 000000000..fc0598ecd --- /dev/null +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-saltstack-adapter + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} + + + ${project.version} + ${project.version} + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + + + ${project.groupId} + saltstack-adapter-provider + ${project.version} + + + + diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml new file mode 100644 index 000000000..bab202094 --- /dev/null +++ b/features/ccsdk-sql-resource/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.5.1-SNAPSHOT + + + + org.onap.ccsdk.sli.adaptors + ccsdk-sql-resource + 0.7.0-SNAPSHOT + feature + + ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} + + + + ${project.version} + ${project.version} + + + + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + provided + + + org.onap.ccsdk.sli.core + ccsdk-dblib + ${ccsdk.sli.core.version} + xml + features + provided + + + ${project.groupId} + sql-resource-provider + ${project.version} + + + + diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 30174b0a3..2956c94ff 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -24,7 +24,136 @@ - + + org.onap.ccsdk.sli.adaptors + ccsdk-aai-service + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-ansible-adapter + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-base-http + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-mdsal-resource + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors.messagerouter + ccsdk-messagerouter-consumer + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors.messagerouter + ccsdk-messagerouter-publisher + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-netbox-client + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-resource-assignment + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-saltstack-adapter + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.adaptors + ccsdk-sql-resource + ${project.version} + xml + features + + + * + * + + + org.onap.ccsdk.sli.adaptors ${application.name} diff --git a/features/pom.xml b/features/pom.xml index 17fbcf271..ce33f8dfd 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -17,6 +17,16 @@ ccsdk-sli-adaptors :: features + ccsdk-aai-service + ccsdk-ansible-adapter + ccsdk-base-http + ccsdk-mdsal-resource + ccsdk-messagerouter-consumer + ccsdk-messagerouter-publisher + ccsdk-netbox-client + ccsdk-resource-assignment + ccsdk-saltstack-adapter + ccsdk-sql-resource ccsdk-sli-adaptors-all features-sli-adaptors installer diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml deleted file mode 100644 index 76e212bcc..000000000 --- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-mdsal-resource - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - - - - ${project.version} - ${project.version} - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - - ${project.groupId} - mdsal-resource-provider - ${project.version} - - - - diff --git a/mdsal-resource/features/features-mdsal-resource/pom.xml b/mdsal-resource/features/features-mdsal-resource/pom.xml deleted file mode 100755 index 96c2589bd..000000000 --- a/mdsal-resource/features/features-mdsal-resource/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-mdsal-resource - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-mdsal-resource - ${project.version} - xml - features - - - - diff --git a/mdsal-resource/features/pom.xml b/mdsal-resource/features/pom.xml deleted file mode 100755 index e1c15e499..000000000 --- a/mdsal-resource/features/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - mdsal-resource-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - - - ccsdk-mdsal-resource - features-mdsal-resource - - diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 4c5472ccf..0202ce430 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -24,21 +24,6 @@ - - - org.onap.ccsdk.sli.adaptors - ccsdk-mdsal-resource - ${project.version} - xml - features - - - * - * - - - - org.onap.ccsdk.sli.adaptors mdsal-resource-provider diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index f19064760..6e41a2c7e 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -19,7 +19,6 @@ provider - features installer diff --git a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml b/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml deleted file mode 100755 index 6ab191e64..000000000 --- a/message-router/consumer/features/ccsdk-messagerouter-consumer/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors.messagerouter - ccsdk-messagerouter-consumer - 0.7.0-SNAPSHOT - feature - - - - ${project.groupId} - consumer.api - ${project.version} - - - ${project.groupId} - consumer.provider - ${project.version} - - - - - diff --git a/message-router/consumer/features/features-messagerouter-consumer/pom.xml b/message-router/consumer/features/features-messagerouter-consumer/pom.xml deleted file mode 100755 index f90de46c3..000000000 --- a/message-router/consumer/features/features-messagerouter-consumer/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors.messagerouter - features-messagerouter-consumer - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-messagerouter-consumer - ${project.version} - xml - features - - - - diff --git a/message-router/consumer/features/pom.xml b/message-router/consumer/features/pom.xml deleted file mode 100755 index 46e289ac5..000000000 --- a/message-router/consumer/features/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - odlparent-lite - org.onap.ccsdk.parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors.messagerouter - consumer.features - 0.7.0-SNAPSHOT - ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} - - pom - - - ccsdk-messagerouter-consumer - features-messagerouter-consumer - - diff --git a/message-router/consumer/features/src/main/feature/feature.xml b/message-router/consumer/features/src/main/feature/feature.xml deleted file mode 100755 index 3541270c0..000000000 --- a/message-router/consumer/features/src/main/feature/feature.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - mvn:${project.groupId}/consumer.api/${project.version} - mvn:${project.groupId}/consumer.provider/${project.version} - - - diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 876232b1e..a30150628 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -21,13 +21,6 @@ - - ${project.groupId} - ccsdk-messagerouter-consumer - ${project.version} - xml - features - ${project.groupId} consumer.api diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 0960b8f0f..5b7984a05 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -13,7 +13,6 @@ api - features provider installer diff --git a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml b/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml deleted file mode 100755 index 21b498d1a..000000000 --- a/message-router/publisher/features/ccsdk-messagerouter-publisher/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors.messagerouter - ccsdk-messagerouter-publisher - 0.7.0-SNAPSHOT - feature - - - - ${project.groupId} - publisher.api - ${project.version} - - - ${project.groupId} - publisher.provider - ${project.version} - - - - - diff --git a/message-router/publisher/features/features-messagerouter-publisher/pom.xml b/message-router/publisher/features/features-messagerouter-publisher/pom.xml deleted file mode 100755 index 860b46c03..000000000 --- a/message-router/publisher/features/features-messagerouter-publisher/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors.messagerouter - features-messagerouter-publisher - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-messagerouter-publisher - ${project.version} - xml - features - - - - diff --git a/message-router/publisher/features/pom.xml b/message-router/publisher/features/pom.xml deleted file mode 100644 index 38ad37c7f..000000000 --- a/message-router/publisher/features/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - odlparent-lite - org.onap.ccsdk.parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors.messagerouter - publisher.features - 0.7.0-SNAPSHOT - ccsdk-sli-adaptors :: messagerouter :: ${project.artifactId} - - pom - - - ccsdk-messagerouter-publisher - features-messagerouter-publisher - - diff --git a/message-router/publisher/features/src/main/feature/feature.xml b/message-router/publisher/features/src/main/feature/feature.xml deleted file mode 100755 index b53323572..000000000 --- a/message-router/publisher/features/src/main/feature/feature.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - mvn:${project.groupId}/publisher.api/${project.version} - mvn:${project.groupId}/publisher.provider/${project.version} - - - - mvn:${project.groupId}/sample.client/${project.version} - - - diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index b6fb5b022..5f4890625 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -21,13 +21,6 @@ - - ${project.groupId} - ccsdk-messagerouter-publisher - ${project.version} - xml - features - ${project.groupId} publisher.api diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index daad3646a..be5207e0b 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -13,7 +13,6 @@ api - features provider sample.client installer diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml deleted file mode 100644 index 0b03d275c..000000000 --- a/netbox-client/features/ccsdk-netbox-client/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-netbox-client - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - - - - ${project.version} - ${project.version} - - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - - org.onap.ccsdk.sli.core - ccsdk-dblib - ${ccsdk.sli.core.version} - xml - features - provided - - - - ${project.groupId} - netbox-client-provider - ${project.version} - - - diff --git a/netbox-client/features/features-netbox-client/pom.xml b/netbox-client/features/features-netbox-client/pom.xml deleted file mode 100755 index 4cd3a3bc6..000000000 --- a/netbox-client/features/features-netbox-client/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-netbox-client - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-netbox-client - ${project.version} - xml - features - - - - diff --git a/netbox-client/features/pom.xml b/netbox-client/features/pom.xml deleted file mode 100755 index a8b8cd726..000000000 --- a/netbox-client/features/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - netbox-client-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - - - ccsdk-netbox-client - features-netbox-client - - diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index e9f437e19..ae25dadfd 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -40,19 +40,7 @@ - - org.onap.ccsdk.sli.adaptors - ccsdk-netbox-client - ${project.version} - xml - features - - - * - * - - - + org.onap.ccsdk.sli.adaptors diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 88e37a1ab..010ba0448 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -34,7 +34,6 @@ provider - features installer diff --git a/resource-assignment/features/ccsdk-resource-assignment/pom.xml b/resource-assignment/features/ccsdk-resource-assignment/pom.xml deleted file mode 100644 index 03feeaadd..000000000 --- a/resource-assignment/features/ccsdk-resource-assignment/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-resource-assignment - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - - - - ${project.version} - ${project.version} - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - - org.onap.ccsdk.sli.core - ccsdk-dblib - ${ccsdk.sli.core.version} - xml - features - provided - - - - ${project.groupId} - resource-assignment-provider - ${project.version} - - - - - diff --git a/resource-assignment/features/features-resource-assignment/pom.xml b/resource-assignment/features/features-resource-assignment/pom.xml deleted file mode 100755 index 6919271a6..000000000 --- a/resource-assignment/features/features-resource-assignment/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-resource-assignment - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-resource-assignment - ${project.version} - xml - features - - - - diff --git a/resource-assignment/features/pom.xml b/resource-assignment/features/pom.xml deleted file mode 100755 index 94a45aa1e..000000000 --- a/resource-assignment/features/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - resource-assignment-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - - - ccsdk-resource-assignment - features-resource-assignment - - diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 7055ebf64..6a24ba529 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -25,20 +25,6 @@ - - org.onap.ccsdk.sli.adaptors - ccsdk-resource-assignment - ${project.version} - xml - features - - - * - * - - - - org.onap.ccsdk.sli.adaptors resource-assignment-provider diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index b03a65820..2046c1b3c 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -19,7 +19,6 @@ provider - features installer diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 21a6b88ca..4bed5f7f2 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -191,7 +191,6 @@ saltstack-adapter-provider - saltstack-adapter-features saltstack-adapter-installer diff --git a/saltstack-adapter/saltstack-adapter-features/.gitignore b/saltstack-adapter/saltstack-adapter-features/.gitignore deleted file mode 100644 index e1ca0dee0..000000000 --- a/saltstack-adapter/saltstack-adapter-features/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# ============LICENSE_START========================================== -# ONAP : CCSDK -# =================================================================== -# Copyright (C) 2017-2018 Samsung Electronics. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the License); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# ============LICENSE_END============================================ -/target/ -/target-ide/ -/bin/ -/classes/ -/.settings/ diff --git a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml deleted file mode 100644 index fc0598ecd..000000000 --- a/saltstack-adapter/saltstack-adapter-features/ccsdk-saltstack-adapter/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-saltstack-adapter - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} - - - ${project.version} - ${project.version} - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - - - ${project.groupId} - saltstack-adapter-provider - ${project.version} - - - - diff --git a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml b/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml deleted file mode 100755 index a792f8f46..000000000 --- a/saltstack-adapter/saltstack-adapter-features/features-saltstack-adapter/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-saltstack-adapter - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} - - - - ${project.version} - - - - - ${project.groupId} - ccsdk-saltstack-adapter - ${project.version} - xml - features - - - - diff --git a/saltstack-adapter/saltstack-adapter-features/pom.xml b/saltstack-adapter/saltstack-adapter-features/pom.xml deleted file mode 100644 index 1b5e61c80..000000000 --- a/saltstack-adapter/saltstack-adapter-features/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - odlparent-lite - org.onap.ccsdk.parent - 1.5.1-SNAPSHOT - - - org.onap.ccsdk.sli.adaptors - saltstack-adapter-features - 0.7.0-SNAPSHOT - ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} - - - pom - - - ccsdk-saltstack-adapter - features-saltstack-adapter - - diff --git a/saltstack-adapter/saltstack-adapter-features/src/main/resources/features.xml b/saltstack-adapter/saltstack-adapter-features/src/main/resources/features.xml deleted file mode 100644 index d92aa49e4..000000000 --- a/saltstack-adapter/saltstack-adapter-features/src/main/resources/features.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features - - - odl-mdsal-broker - sdnc-sli - mvn:org.apache.sshd/sshd-core/0.12.0 - mvn:org.apache.commons/commons-io/1.3.2 - mvn:org.onap.ccsdk.sli.adaptors/saltstack-adapter-provider/${project.version} - - - diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 96c59a044..5951b618a 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -45,19 +45,7 @@ false - - org.onap.ccsdk.sli.adaptors - ${application.name} - ${project.version} - features - xml - - - * - * - - - + org.onap.ccsdk.sli.adaptors saltstack-adapter-provider diff --git a/sql-resource/features/ccsdk-sql-resource/pom.xml b/sql-resource/features/ccsdk-sql-resource/pom.xml deleted file mode 100644 index bab202094..000000000 --- a/sql-resource/features/ccsdk-sql-resource/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - single-feature-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - ccsdk-sql-resource - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - - - ${project.version} - ${project.version} - - - - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - provided - - - org.onap.ccsdk.sli.core - ccsdk-dblib - ${ccsdk.sli.core.version} - xml - features - provided - - - ${project.groupId} - sql-resource-provider - ${project.version} - - - - diff --git a/sql-resource/features/features-sql-resource/pom.xml b/sql-resource/features/features-sql-resource/pom.xml deleted file mode 100755 index a85ff700a..000000000 --- a/sql-resource/features/features-sql-resource/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - feature-repo-parent - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - features-sql-resource - 0.7.0-SNAPSHOT - feature - - ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - - ${project.version} - - - - - ${project.groupId} - ccsdk-sql-resource - ${project.version} - xml - features - - - - diff --git a/sql-resource/features/pom.xml b/sql-resource/features/pom.xml deleted file mode 100755 index 5046316be..000000000 --- a/sql-resource/features/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.onap.ccsdk.parent - odlparent-lite - 1.5.1-SNAPSHOT - - - - org.onap.ccsdk.sli.adaptors - sql-resource-features - 0.7.0-SNAPSHOT - pom - - ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - - - ccsdk-sql-resource - features-sql-resource - - 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 5cf1d9c50..000000000 --- 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.onap.ccsdk.sli.adaptors/sql-resource-provider/${project.version} - - - diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index ffff87c24..f3dd45b2b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -25,20 +25,6 @@ - - org.onap.ccsdk.sli.adaptors - ccsdk-sql-resource - ${project.version} - xml - features - - - * - * - - - - org.onap.ccsdk.sli.adaptors sql-resource-provider diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index a08406bb8..689c34369 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -19,7 +19,6 @@ provider - features installer -- cgit 1.2.3-korg From 4de5e6cbb62b3588a916f7696e7a9ecc73061782 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 23 Jan 2020 14:40:14 -0500 Subject: Use released parent pom Use released version of ccsdk/parent poms Change-Id: Ifa7059c687e09de9977b94d92fbf1869d510b00d Issue-ID: CCSDK-1963 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- base/http/installer/pom.xml | 2 +- base/http/pom.xml | 2 +- base/http/provider/pom.xml | 2 +- base/pom.xml | 2 +- features/ccsdk-aai-service/pom.xml | 2 +- features/ccsdk-ansible-adapter/pom.xml | 2 +- features/ccsdk-base-http/pom.xml | 2 +- features/ccsdk-mdsal-resource/pom.xml | 2 +- features/ccsdk-messagerouter-consumer/pom.xml | 2 +- features/ccsdk-messagerouter-publisher/pom.xml | 2 +- features/ccsdk-netbox-client/pom.xml | 2 +- features/ccsdk-resource-assignment/pom.xml | 2 +- features/ccsdk-saltstack-adapter/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/ccsdk-sql-resource/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- message-router/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index a1f7f5117..c12087f2c 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 71ad8adb2..dbf07cdc4 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index aca8ab8dd..30cfe62cb 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 9ae7f584b..86d1c1886 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 82a9a080f..09e9bf7ba 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index cf3667d85..83c789a3c 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 1d1abb6e0..435345649 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index a974d82f9..a14318fbc 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/base/http/pom.xml b/base/http/pom.xml index 013f77e0a..40991e057 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 34a866c28..007cea293 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/base/pom.xml b/base/pom.xml index bc81212fd..b76e6c4b1 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index aaa18ab95..ef47eac14 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index 9b6c89bb1..7a882404a 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index 168f6f43f..4c909c06f 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index 76e212bcc..deaf0055d 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 6ab191e64..5e55ca55c 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index 21b498d1a..e3790bc86 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index 0b03d275c..a9fd8f34d 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 03feeaadd..679b1e9b4 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index fc0598ecd..215931f5f 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index ae26d4cbb..6732d5afd 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index bab202094..7d41f033b 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index a3e5f17ef..757f86b11 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 2956c94ff..e00d02316 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/features/pom.xml b/features/pom.xml index ce33f8dfd..56513b259 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 0202ce430..d9b1e4f11 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 6e41a2c7e..2889e6b80 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 1c8839bd4..e63d01a6f 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/message-router/pom.xml b/message-router/pom.xml index 29652e81e..031f82edc 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index ae25dadfd..b0eb42247 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 010ba0448..fe89488e8 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index d73751614..1394a01d5 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/pom.xml b/pom.xml index fa8254e8e..c60d03f85 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 4.0.0 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 6a24ba529..198e1bab1 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 2046c1b3c..baf7c7e2e 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 43c50ceb2..048c13d7f 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 4bed5f7f2..6bb7ac9a0 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 5951b618a..5bc5fae3c 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 606a45f4f..5dd3f7fc7 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index f3dd45b2b..7b548ee4b 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 689c34369..141bdee82 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1-SNAPSHOT + 1.5.1 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 49a5a92e6..9a1a521dc 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.1-SNAPSHOT + 1.5.1 -- cgit 1.2.3-korg From 6b1ac1200e74ff91e74df595c8e2a025b1bcd842 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Fri, 24 Jan 2020 16:03:21 -0500 Subject: Roll versions to next snapshot Roll CCSDK to next snapshot version Change-Id: Ib08be10d412384fcf791805c0101cfdb6375c178 Issue-ID: CCSDK-1963 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- features/ccsdk-aai-service/pom.xml | 4 ++-- features/ccsdk-ansible-adapter/pom.xml | 4 ++-- features/ccsdk-base-http/pom.xml | 4 ++-- features/ccsdk-mdsal-resource/pom.xml | 4 ++-- features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- features/ccsdk-netbox-client/pom.xml | 4 ++-- features/ccsdk-resource-assignment/pom.xml | 4 ++-- features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/ccsdk-sql-resource/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 52 files changed, 96 insertions(+), 96 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index c12087f2c..9d244cd59 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index dbf07cdc4..04bf7dbe3 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 30cfe62cb..f3ffe5559 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 86d1c1886..8872f1e85 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,13 +17,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 09e9bf7ba..8b354e422 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} pom diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 83c789a3c..a531c3b13 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST pom diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 435345649..03135874a 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.5.1 + 1.5.2-SNAPSHOT diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index a14318fbc..d4eebd9e5 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index 40991e057..d55ca6d50 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 007cea293..3b8add63c 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index b76e6c4b1..516347689 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT @@ -12,7 +12,7 @@ pom org.onap.ccsdk.sli.adaptors base-parent - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT http diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index ef47eac14..b4828cd69 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index 7a882404a..f5bb9cda7 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index 4c909c06f..98a63df6a 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index deaf0055d..c822ce0cc 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 5e55ca55c..0678e969f 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index e3790bc86..a4f591b41 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index a9fd8f34d..15a8c75bd 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 679b1e9b4..46fdee467 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index 215931f5f..a547e2eb0 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 6732d5afd..88ff52c39 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index 7d41f033b..ed137dcba 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 757f86b11..7d4170f5c 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index e00d02316..a4a7636af 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 56513b259..5ad3531d8 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index d9b1e4f11..b55148d20 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 2889e6b80..59a973ead 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index e63d01a6f..0af519f6f 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 17ed5d13f..117e60093 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT consumer.api diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index a30150628..345b50fe7 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 5b7984a05..5b67ca4b0 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index 3b03cff9f..f3ccafa74 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 031f82edc..3d59596b7 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 9e52ee534..c4831f482 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT publisher.api diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 5f4890625..792e3c05b 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index be5207e0b..487591fe5 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 0966f0d42..456307764 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 0aa6b6eba..47692aad7 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT sample.client diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index b0eb42247..70b602dc2 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index fe89488e8..54505b95f 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 1394a01d5..851bc6706 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle 4.0.0 diff --git a/pom.xml b/pom.xml index c60d03f85..4814a5c5e 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT 4.0.0 @@ -155,7 +155,7 @@ ONAP - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 198e1bab1..acccf483b 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index baf7c7e2e..ebefe02a1 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 048c13d7f..54b2e10e7 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 6bb7ac9a0..d6400f9d1 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,13 +27,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 5bc5fae3c..dd91e01c7 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,12 +27,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} pom diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 5dd3f7fc7..cfc32b138 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,13 +16,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 7b548ee4b..f48c05ba1 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 141bdee82..c6251e05b 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 9a1a521dc..582b2e925 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.1 + 1.5.2-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.7.0-SNAPSHOT + 0.7.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index d6537b40b..c11ada9fe 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=7 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From d95c9b66abae3570cd9d0bf86e9fc0d348e2ef1e Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 3 Mar 2020 12:23:18 -0500 Subject: Use released 1.5.2 CCSDK parent Update to use released version of CCSDK parent pom Change-Id: I24f981aaaca40909690d8118f7c0cdb8faa57d3a Issue-ID: CCSDK-2152 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 2 +- aai-service/pom.xml | 2 +- aai-service/provider/pom.xml | 2 +- ansible-adapter/ansible-adapter-bundle/pom.xml | 2 +- ansible-adapter/ansible-adapter-installer/pom.xml | 2 +- ansible-adapter/pom.xml | 2 +- artifacts/pom.xml | 2 +- base/http/installer/pom.xml | 2 +- base/http/pom.xml | 2 +- base/http/provider/pom.xml | 2 +- base/pom.xml | 2 +- features/ccsdk-aai-service/pom.xml | 2 +- features/ccsdk-ansible-adapter/pom.xml | 2 +- features/ccsdk-base-http/pom.xml | 2 +- features/ccsdk-mdsal-resource/pom.xml | 2 +- features/ccsdk-messagerouter-consumer/pom.xml | 2 +- features/ccsdk-messagerouter-publisher/pom.xml | 2 +- features/ccsdk-netbox-client/pom.xml | 2 +- features/ccsdk-resource-assignment/pom.xml | 2 +- features/ccsdk-saltstack-adapter/pom.xml | 2 +- features/ccsdk-sli-adaptors-all/pom.xml | 2 +- features/ccsdk-sql-resource/pom.xml | 2 +- features/features-sli-adaptors/pom.xml | 2 +- features/installer/pom.xml | 2 +- features/pom.xml | 2 +- mdsal-resource/installer/pom.xml | 2 +- mdsal-resource/pom.xml | 2 +- mdsal-resource/provider/pom.xml | 2 +- message-router/pom.xml | 2 +- netbox-client/installer/pom.xml | 2 +- netbox-client/pom.xml | 2 +- netbox-client/provider/pom.xml | 2 +- pom.xml | 2 +- resource-assignment/installer/pom.xml | 2 +- resource-assignment/pom.xml | 2 +- resource-assignment/provider/pom.xml | 2 +- saltstack-adapter/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-installer/pom.xml | 2 +- saltstack-adapter/saltstack-adapter-provider/pom.xml | 2 +- sql-resource/installer/pom.xml | 2 +- sql-resource/pom.xml | 2 +- sql-resource/provider/pom.xml | 2 +- 42 files changed, 42 insertions(+), 42 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 9d244cd59..baf41865f 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 04bf7dbe3..c5167d507 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index f3ffe5559..082fcaab5 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 8872f1e85..cad248b06 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 8b354e422..2e09acc9e 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 org.onap.ccsdk.sli.adaptors diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index a531c3b13..6cea61f87 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 03135874a..966417619 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index d4eebd9e5..a8397faf3 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/base/http/pom.xml b/base/http/pom.xml index d55ca6d50..fda2c83f9 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 3b8add63c..b7002e521 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/base/pom.xml b/base/pom.xml index 516347689..120bbc35e 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index b4828cd69..983f22461 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index f5bb9cda7..ee66e2a70 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index 98a63df6a..002c14c21 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index c822ce0cc..8af9fa9b6 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 0678e969f..8e2766bc5 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index a4f591b41..1b3b702cb 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 org.onap.ccsdk.sli.adaptors.messagerouter diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index 15a8c75bd..29f90b3c4 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 46fdee467..0048a7e18 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index a547e2eb0..1c4014096 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 88ff52c39..bce028866 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index ed137dcba..2dfa36f72 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 7d4170f5c..5f2fbc578 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/installer/pom.xml b/features/installer/pom.xml index a4a7636af..23205e69a 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/features/pom.xml b/features/pom.xml index 5ad3531d8..2c93658cb 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index b55148d20..dce634d05 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 59a973ead..de34cd2e8 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 0af519f6f..32f0a66f1 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/message-router/pom.xml b/message-router/pom.xml index 3d59596b7..09d47afc4 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 70b602dc2..93e005673 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 54505b95f..6051f2ce9 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,7 +20,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 851bc6706..cef1f05da 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -19,7 +19,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/pom.xml b/pom.xml index 4814a5c5e..2bf3026b4 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 4.0.0 diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index acccf483b..2dce577c6 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index ebefe02a1..e1eff0029 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 54b2e10e7..862370886 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index d6400f9d1..62e1720ac 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index dd91e01c7..334aafad2 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -27,7 +27,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 org.onap.ccsdk.sli.adaptors diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index cfc32b138..ffaf8033a 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -16,7 +16,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index f48c05ba1..94cc33ae4 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index c6251e05b..58a72ab49 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2-SNAPSHOT + 1.5.2 diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 582b2e925..7be4fc110 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 1.5.2-SNAPSHOT + 1.5.2 -- cgit 1.2.3-korg From a612cdd3fbed35c4d5b454c6f0329fa6ecec22e1 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 5 Mar 2020 11:51:01 -0500 Subject: Roll master to Guilin Roll versions of master for early Guilin development Change-Id: Id725abd9ecb3c67b2687e15286cb2f2bcd50be1a Issue-ID: CCSDK-2152 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 4 +- aai-service/pom.xml | 4 +- aai-service/provider/pom.xml | 21 +++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 14 ++- ansible-adapter/ansible-adapter-installer/pom.xml | 12 ++- ansible-adapter/pom.xml | 86 +++++++++--------- artifacts/pom.xml | 15 ++-- base/http/installer/pom.xml | 4 +- base/http/pom.xml | 4 +- base/http/provider/pom.xml | 4 +- base/pom.xml | 11 ++- features/ccsdk-aai-service/pom.xml | 5 +- features/ccsdk-ansible-adapter/pom.xml | 6 +- features/ccsdk-base-http/pom.xml | 4 +- features/ccsdk-mdsal-resource/pom.xml | 5 +- features/ccsdk-messagerouter-consumer/pom.xml | 8 +- features/ccsdk-messagerouter-publisher/pom.xml | 8 +- features/ccsdk-netbox-client/pom.xml | 10 +-- features/ccsdk-resource-assignment/pom.xml | 5 +- features/ccsdk-saltstack-adapter/pom.xml | 7 +- features/ccsdk-sli-adaptors-all/pom.xml | 4 +- features/ccsdk-sql-resource/pom.xml | 5 +- features/features-sli-adaptors/pom.xml | 4 +- features/installer/pom.xml | 4 +- features/pom.xml | 4 +- mdsal-resource/installer/pom.xml | 4 +- mdsal-resource/pom.xml | 6 +- mdsal-resource/provider/pom.xml | 18 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/installer/pom.xml | 4 +- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 6 +- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 4 +- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/installer/pom.xml | 4 +- netbox-client/pom.xml | 4 +- netbox-client/provider/pom.xml | 22 +++-- pom.xml | 85 ++++++++---------- resource-assignment/installer/pom.xml | 4 +- resource-assignment/pom.xml | 6 +- resource-assignment/provider/pom.xml | 20 ++--- saltstack-adapter/pom.xml | 100 +++++++++++---------- .../saltstack-adapter-installer/pom.xml | 14 ++- .../saltstack-adapter-provider/pom.xml | 20 ++--- sql-resource/installer/pom.xml | 4 +- sql-resource/pom.xml | 5 +- sql-resource/provider/pom.xml | 17 ++-- version.properties | 6 +- 52 files changed, 301 insertions(+), 324 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index baf41865f..6a0d99097 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index c5167d507..e96f57540 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 082fcaab5..0f564e858 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} @@ -20,19 +20,18 @@ ${project.version} ${project.version} - + - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - junit @@ -53,7 +52,7 @@ org.onap.logging-analytics logging-filter-base - provided + provided org.osgi @@ -109,7 +108,7 @@ org.jvnet.jaxb2.maven2 maven-jaxb2-plugin - 0.14.0 + 0.14.0 gen-xjc diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index cad248b06..e0ac33813 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -14,19 +14,20 @@ a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> 4.0.0 + org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} ${project.version} @@ -44,7 +45,6 @@ - com.att.eelf @@ -91,13 +91,13 @@ org.onap.ccsdk.sli.core sli-common - provided + provided org.onap.ccsdk.sli.core sli-provider - provided + provided @@ -128,6 +128,4 @@ - - diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 2e09acc9e..22295c283 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -24,23 +24,28 @@ --> 4.0.0 + org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT + org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 0.7.1-SNAPSHOT - ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + 1.0.0-SNAPSHOT pom + + ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} + ccsdk-ansible-adapter ${application.name} mvn:org.onap.ccsdk.sli.adaptors/${features.boot}/${project.version}/xml/features false + @@ -51,6 +56,7 @@ + diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 6cea61f87..e1b6482a0 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -22,21 +22,61 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> - + 4.0.0 + org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT + pom + ccsdk-sli-adaptors :: ansible-adapter Abstractions to interact with Ansible server via REST - pom + + + ansible-adapter-bundle + ansible-adapter-installer + + + + + + + org.onap.appc + ansible-adapter-features + ${project.version} + xml + features + + + + org.onap.appc + ansible-adapter-provider + ${project.version} + + + + + + + + + + + + JCenter + JCenter Repository + http://jcenter.bintray.com + + + @@ -147,42 +187,4 @@ - - - - - - org.onap.appc - ansible-adapter-features - features - xml - ${project.version} - - - - org.onap.appc - ansible-adapter-provider - ${project.version} - - - - - - - - - - - - JCenter - JCenter Repository - http://jcenter.bintray.com - - - - - - ansible-adapter-bundle - ansible-adapter-installer - diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 966417619..53a8fbe10 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -2,9 +2,15 @@ 4.0.0 + + org.onap.ccsdk.parent + parent + 2.0.0-SNAPSHOT + + org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts @@ -14,12 +20,6 @@ ONAP
- - org.onap.ccsdk.parent - parent - 1.5.2 - - @@ -143,5 +143,4 @@ - diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index a8397faf3..4940c55c9 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index fda2c83f9..e72441db5 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index b7002e521..6aab259b4 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index 120bbc35e..364fd7878 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -1,21 +1,20 @@ - + + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT - 4.0.0 - pom org.onap.ccsdk.sli.adaptors base-parent - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT + pom http - diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index 983f22461..f91e58502 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,18 +5,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index ee66e2a70..32ec5058f 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} @@ -29,7 +29,7 @@ ${ccsdk.sli.core.version} xml features - provided + provided diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index 002c14c21..a38fa4c73 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index 8af9fa9b6..e3ef74a05 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,18 +5,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 8e2766bc5..47fc35316 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,14 +5,14 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature - + ${project.groupId} @@ -25,6 +25,4 @@ ${project.version} - - diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index 1b3b702cb..ef3f13649 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,14 +5,14 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature - + ${project.groupId} @@ -25,6 +25,4 @@ ${project.version} - - diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index 29f90b3c4..28e672350 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -20,24 +20,22 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - ${project.version} ${project.version} - @@ -46,7 +44,7 @@ ${ccsdk.sli.core.version} xml features - provided + provided @@ -55,7 +53,7 @@ ${ccsdk.sli.core.version} xml features - provided + provided diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 0048a7e18..1672c6c21 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,18 +5,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index 1c4014096..ffc43e152 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -1,17 +1,17 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} @@ -35,5 +35,4 @@ ${project.version} - diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index bce028866..53664b4ed 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index 2dfa36f72..8b553c0ce 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,18 +5,17 @@ org.onap.ccsdk.parent single-feature-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 5f2fbc578..4c9c862b8 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 23205e69a..036cc9a5d 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 2c93658cb..2c4d8098c 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index dce634d05..d78bec957 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index de34cd2e8..36ea6e83e 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource @@ -21,6 +21,4 @@ provider installer - - diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 32f0a66f1..3da2dc241 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} @@ -22,19 +22,18 @@ ${project.version} ${project.version} - + - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - @@ -80,5 +79,4 @@ test - diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 117e60093..70dd0408e 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT consumer.api diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 345b50fe7..465550386 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 5b67ca4b0..56586eae8 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index f3ccafa74..1e69ad150 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 09d47afc4..5fe29e144 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -2,16 +2,16 @@ 4.0.0 - + org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index c4831f482..0532ed77e 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT publisher.api diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 792e3c05b..b700fa878 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 487591fe5..0e069c6ac 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 456307764..c1fbf274d 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 47692aad7..bcdd14d54 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT sample.client diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 93e005673..e2be415ca 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index 6051f2ce9..da901ae9c 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -20,13 +20,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index cef1f05da..19080bcda 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -15,19 +15,19 @@ limitations under the License. --> + 4.0.0 org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle - 4.0.0 ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} @@ -39,15 +39,14 @@ - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - @@ -77,7 +76,7 @@ org.onap.ccsdk.sli.core sliPluginUtils-provider - ${ccsdk.sli.core.version} + ${ccsdk.sli.core.version} provided @@ -102,7 +101,7 @@ com.github.tomakehurst wiremock - 2.23.2 + 2.23.2 test @@ -135,5 +134,4 @@ - diff --git a/pom.xml b/pom.xml index 2bf3026b4..101c6779e 100755 --- a/pom.xml +++ b/pom.xml @@ -1,27 +1,38 @@ - + + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT - 4.0.0 - pom org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors + 1.0.0-SNAPSHOT + pom ccsdk-sli-adaptors - https://wiki.onap.org The CCSDK core components contains the SLI, dblib and root pom + https://wiki.onap.org + + ONAP + - - - JIRA - https://jira.onap.org/ - - + + aai-service + ansible-adapter + saltstack-adapter + netbox-client + mdsal-resource + resource-assignment + sql-resource + base + message-router + features + artifacts + scm:git:ssh://git@${onap.git.host}/ccsdk/sli/adaptors @@ -29,12 +40,14 @@ ${onap.git.protocol}://${onap.git.host}/ccsdk/sli/adaptors ccsdk-adaptors-${project.version} - + + JIRA + https://jira.onap.org/ + Jenkins https://jenkins.onap.org/ - sdnc-javadoc @@ -44,6 +57,19 @@ + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.17 + + false + + + + + blackduck @@ -125,37 +151,4 @@ - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.17 - - false - - - - - - - aai-service - ansible-adapter - saltstack-adapter - netbox-client - mdsal-resource - resource-assignment - sql-resource - base - message-router - features - artifacts - - - ONAP - - 0.7.1-SNAPSHOT - - diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 2dce577c6..ebfc5e518 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index e1eff0029..3c3fab354 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment @@ -21,6 +21,4 @@ provider installer - - diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 862370886..cc6043a70 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} @@ -22,20 +22,18 @@ ${project.version} ${project.version} - + - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - - junit @@ -91,6 +89,4 @@ spring-jdbc - - diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index 62e1720ac..da1b6095c 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -22,22 +22,69 @@ ============LICENSE_END========================================================= --> - + 4.0.0 + org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT + pom + ccsdk-sli-adaptors :: saltstack-adapter Abstractions to interact with Saltstack server via REST - pom + + + saltstack-adapter-provider + saltstack-adapter-installer + + + + + + + org.onap.appc + saltstack-adapter-features + ${project.version} + xml + features + + + + org.onap.appc + saltstack-adapter-provider + ${project.version} + + + + junit + junit + 4.11 + test + + + + + + + + + + + + JCenter + JCenter Repository + http://jcenter.bintray.com + + + @@ -148,49 +195,4 @@ - - - - - - org.onap.appc - saltstack-adapter-features - features - xml - ${project.version} - - - - org.onap.appc - saltstack-adapter-provider - ${project.version} - - - - junit - junit - 4.11 - test - - - - - - - - - - - - JCenter - JCenter Repository - http://jcenter.bintray.com - - - - - - saltstack-adapter-provider - saltstack-adapter-installer - diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 334aafad2..a0f37d18f 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -22,20 +22,24 @@ ============LICENSE_END========================================================= --> - + 4.0.0 + org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT + org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT + pom + ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} - pom + ccsdk-saltstack-adapter ${application.name} @@ -44,6 +48,7 @@ false + @@ -53,6 +58,7 @@ + diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index ffaf8033a..eb7788d94 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -11,19 +11,21 @@ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> - + 4.0.0 + org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle + ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} @@ -35,15 +37,14 @@ - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - com.att.eelf @@ -116,5 +117,4 @@ - diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 94cc33ae4..e518767b6 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 58a72ab49..3fcf5e4e6 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource @@ -21,5 +21,4 @@ provider installer - diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 7be4fc110..90e0224bb 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.5.2 + 2.0.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 0.7.1-SNAPSHOT + 1.0.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} @@ -26,15 +26,14 @@ - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import - junit @@ -82,6 +81,4 @@ provided - - diff --git a/version.properties b/version.properties index c11ada9fe..feea7088f 100644 --- a/version.properties +++ b/version.properties @@ -3,9 +3,9 @@ # Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) # because they are used in Jenkins, whose plug-in doesn't support -release_name=0 -sprint_number=7 -feature_revision=1 +release_name=1 +sprint_number=0 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 3531095b169085b5cfd25c4dbc2e9be2d35314f2 Mon Sep 17 00:00:00 2001 From: sb5356 Date: Wed, 25 Mar 2020 15:48:17 -0400 Subject: RA: Add the allowed range in the return values Change-Id: I18530c17ac78269c1b48ba499edfb3921d23f164 Issue-ID: CCSDK-2189 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 43 +++++++++++++++++++--- .../adaptors/ra/comp/EndPointAllocatorImpl.java | 17 ++++++++- .../ccsdk/sli/adaptors/ra/comp/ResourceData.java | 2 +- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 11 ++++++ 4 files changed, 65 insertions(+), 8 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 338c528a8..19062d53b 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -22,6 +22,7 @@ package org.onap.ccsdk.sli.adaptors.ra; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -180,11 +181,10 @@ public class ResourceAllocator implements SvcLogicResource { setAttr(ctx, pp + "resource-target-value", rd.resourceTargetValue); setAttr(ctx, pp + "status", rd.status); - if (rd.data != null && !rd.data.isEmpty()) { - for (String kk : rd.data.keySet()) { - String value = String.valueOf(rd.data.get(kk)); - setAttr(ctx, pp + kk, value); - } + Map dataProp = dataToProperties(rd.data); + for (String kk : dataProp.keySet()) { + String value = String.valueOf(dataProp.get(kk)); + setAttr(ctx, pp + kk, value); } if (rd.allocationDataList != null && !rd.allocationDataList.isEmpty()) { @@ -534,6 +534,39 @@ public class ResourceAllocator implements SvcLogicResource { return data; } + @SuppressWarnings("unchecked") + public static Map dataToProperties(Map data) { + if (data == null || data.isEmpty()) { + return Collections.emptyMap(); + } + + Map prop = new HashMap<>(); + Map data1 = new HashMap<>(data); + + while (!data1.isEmpty()) { + for (String key : new ArrayList<>(data1.keySet())) { + Object o = data1.get(key); + data1.remove(key); + + if (o instanceof Boolean || o instanceof Number || o instanceof String) { + prop.put(key, o.toString()); + } else if (o instanceof Map) { + Map mm = (Map) o; + for (String key1 : mm.keySet()) { + data1.put(key + "." + key1, mm.get(key1)); + } + } else if (o instanceof List) { + List ll = (List) o; + prop.put(key + "_length", String.valueOf(ll.size())); + for (int i = 0; i < ll.size(); i++) { + data1.put(key + '[' + i + ']', ll.get(i)); + } + } + } + } + return prop; + } + public void setResourceManager(ResourceManager resourceManager) { this.resourceManager = resourceManager; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java index 91f587340..36e40d589 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/EndPointAllocatorImpl.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. - * + * * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,8 +38,10 @@ import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.LimitAllocationOutcome; import org.onap.ccsdk.sli.adaptors.rm.data.LimitResource; import org.onap.ccsdk.sli.adaptors.rm.data.MultiResourceAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.Range; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationItem; import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationOutcome; +import org.onap.ccsdk.sli.adaptors.rm.data.RangeAllocationRequest; import org.onap.ccsdk.sli.adaptors.rm.data.RangeResource; import org.onap.ccsdk.sli.adaptors.rm.data.ReleaseRequest; import org.onap.ccsdk.sli.adaptors.rm.data.Resource; @@ -129,6 +131,17 @@ public class EndPointAllocatorImpl implements EndPointAllocator { RangeAllocationOutcome rao = (RangeAllocationOutcome) ao; rd.data.put("allocated", String.valueOf(StrUtil.listInt(rao.allocated))); rd.data.put("used", String.valueOf(StrUtil.listInt(rao.used))); + List rangeList = ((RangeAllocationRequest) rao.request).rangeList; + if (rangeList != null && !rangeList.isEmpty()) { + List ll = new ArrayList<>(); + for (Range r : rangeList) { + Map mm = new HashMap<>(); + mm.put("min", r.min); + mm.put("max", r.max); + ll.add(mm); + } + rd.data.put("range-list", ll); + } } return Collections.singletonList(rd); @@ -229,7 +242,7 @@ public class EndPointAllocatorImpl implements EndPointAllocator { log.info("ResourceName:" + r.resourceKey.resourceName + " assetId:" + r.resourceKey.assetId); - + rdlist.add(getResourceData(r)); } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java index a20c01d79..d83d4cdb4 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceData.java @@ -32,6 +32,6 @@ public class ResourceData { public String resourceTargetType; public String endPointPosition; public String status; - public Map data; + public Map data; public List allocationDataList; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index 168bdd729..f42ef9c3a 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -634,6 +634,17 @@ public class TestReserve { Assert.assertTrue(st == QueryStatus.SUCCESS); Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet1, "201")); Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, resourceSet2, "201")); + + Assert.assertEquals(ctx.getAttribute("resource-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].resource-name"), "cust-vlan-id"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].resource-target-type"), "VNF"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].resource-target-id"), "port-id-1"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].status"), "Success"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].allocated"), "201"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].used"), "201"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].range-list_length"), "1"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].range-list[0].min"), "2"); + Assert.assertEquals(ctx.getAttribute("resource-list[0].range-list[0].max"), "1000"); } @Test -- cgit 1.2.3-korg From c3c435eb583ca80e3626a6811a0dce3ac7bd7411 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Thu, 2 Apr 2020 12:51:23 +0530 Subject: removed code smells Reduced the code smells Issue-ID: CCSDK-2232 Change-Id: I30eec021ba50f28dc1df2fd554c4e349c4a76dd6 Signed-off-by: Rupinder --- .../main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java | 4 +++- .../org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java | 3 ++- .../src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java | 3 ++- .../ccsdk/sli/adaptors/saltstack/model/SaltstackMessageParser.java | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java index 4b0c82f92..6b764a7e1 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/Resource.java @@ -24,7 +24,9 @@ package org.onap.ccsdk.sli.adaptors.rm.dao.jdbc; public class Resource { public long id; - public String assetId, name, type; + public String assetId; + public String name; + public String type; public long ltUsed; public String llLabel; public int llReferenceCount; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java index 8ba454bf4..8092a7515 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/expr/ExpressionEvaluator.java @@ -193,7 +193,8 @@ public class ExpressionEvaluator { int opl = op.length(); int sl = s.length(); String delimiters = " \0\t\r\n()"; - int pcount = 0, qcount = 0; + int pcount = 0; + int qcount = 0; for (int i = 0; i < sl; i++) { char c = s.charAt(i); if (c == '(' && qcount == 0) { diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java index ef889f0d5..126ec94e5 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/util/str/StrUtil.java @@ -215,7 +215,8 @@ public class StrUtil { for (String s : str) { try { int i1 = s.indexOf('-'); - int start, end; + int start; + int end; if (i1 > 0) { String s1 = s.substring(0, i1); String s2 = s.substring(i1 + 1); diff --git a/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/model/SaltstackMessageParser.java b/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/model/SaltstackMessageParser.java index 50d08e23a..3bb401ad4 100644 --- a/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/model/SaltstackMessageParser.java +++ b/saltstack-adapter/saltstack-adapter-provider/src/main/java/org/onap/ccsdk/sli/adaptors/saltstack/model/SaltstackMessageParser.java @@ -307,7 +307,8 @@ public class SaltstackMessageParser { public SaltstackResult parseResponse(SvcLogicContext ctx, String pfx, SaltstackResult saltstackResult, boolean slsExec) throws IOException { int code = saltstackResult.getStatusCode(); - boolean executionStatus = true, retCodeFound = false; + boolean executionStatus = true; + boolean retCodeFound = false; if (code != SaltstackResultCodes.SUCCESS.getValue()) { return saltstackResult; } -- cgit 1.2.3-korg From a19d05b4c780b5fbedf9724a60fa82786924901a Mon Sep 17 00:00:00 2001 From: Rupinder Date: Wed, 27 May 2020 15:11:12 +0530 Subject: added assert statements in 7 test files Issue-ID: CCSDK-2232 Change-Id: I07e3806cac9a317130ad1d5fe4c9af4fb1a17a5d Signed-off-by: Rupinder --- .../test/java/org/onap/ccsdk/sli/adaptors/aai/RegressionTest.java | 5 +++++ .../onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java | 2 ++ .../resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java | 2 ++ .../ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java | 2 ++ .../consumer/provider/impl/AbstractBaseConsumerTest.java | 1 + .../java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java | 2 ++ .../test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java | 5 +++++ 7 files changed, 19 insertions(+) (limited to 'resource-assignment') diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/RegressionTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/RegressionTest.java index 0e81e5b52..eb8dbc4a8 100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/RegressionTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/RegressionTest.java @@ -121,6 +121,7 @@ public class RegressionTest { QueryStatus resp = client.save("connector", false, false, "resource-instance-id = '12345'", data, "aaidata", ctx); LOG.info("AAIResponse: " + resp.toString()); + assertNotNull(ctx); } catch (Exception e) { @@ -158,6 +159,7 @@ public class RegressionTest { QueryStatus resp = client.save("connector", false, false, "resource-instance-id = '11012345'", data, "aaidata", ctx); LOG.info("AAIResponse: " + resp.toString()); + assertNotNull(ctx); } catch (Exception e) { @@ -210,6 +212,7 @@ public class RegressionTest { QueryStatus resp = client.save("logical-link", false, false, "link-name = '1252541'", data, "aaidata", ctx); LOG.info("AAIResponse: " + resp.toString()); + assertNotNull(data); } catch (Exception e) { @@ -241,6 +244,7 @@ public class RegressionTest { QueryStatus resp = client.save("virtual-data-center", false, false, "vdc-id = '1252541'", data, "aaidata", ctx); LOG.info("AAIResponse: " + resp.toString()); + assertNotNull(data); } catch (Exception e) { @@ -408,6 +412,7 @@ public class RegressionTest { // assertTrue(response == QueryStatus.SUCCESS); LOG.info("AAIResponse: " + datum.toString()); + assertNotNull(nameValues); } catch (Exception e) { diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java index a8f4d9483..80563b96b 100644 --- a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java @@ -5,6 +5,7 @@ import junit.framework.TestCase; import static org.mockito.Mockito.mock; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import static org.junit.Assert.assertNotNull; public class TestConfigResource extends TestCase { @@ -24,6 +25,7 @@ public class TestConfigResource extends TestCase { res.isAvailable("my-resource", "mykey", "pfx", ctx); res.save("resource", false, false, null, null, null, ctx); res.update("my-resource", "mykey", null, "pfx", ctx); + assertNotNull(res); } } diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java index 9af5b59b3..7f05d1e5f 100644 --- a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java @@ -27,6 +27,7 @@ import org.junit.Test; import java.util.Properties; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; public class TestMdsalResourcePropertiesProviderImpl { @@ -57,6 +58,7 @@ public class TestMdsalResourcePropertiesProviderImpl { MdsalResourcePropertiesProviderImpl test = new MdsalResourcePropertiesProviderImpl(); mdsal.determinePropertiesFile(test); + assertNotNull(test); } } diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java index f5725e971..2e9798df1 100644 --- a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.mock; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import junit.framework.TestCase; +import static org.junit.Assert.assertNotNull; public class TestOperationalResource extends TestCase { @@ -25,5 +26,6 @@ public class TestOperationalResource extends TestCase { res.isAvailable("my-resource", "mykey", "pfx", ctx); res.save("resource", false, false, null, null, null, ctx); res.update("my-resource", "mykey", null, "pfx", ctx); + assertNotNull(restService); } } diff --git a/message-router/consumer/provider/src/test/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/AbstractBaseConsumerTest.java b/message-router/consumer/provider/src/test/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/AbstractBaseConsumerTest.java index 99a4f3ff7..75873385b 100644 --- a/message-router/consumer/provider/src/test/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/AbstractBaseConsumerTest.java +++ b/message-router/consumer/provider/src/test/java/org/onap/ccsdk/sli/adaptors/messagerouter/consumer/provider/impl/AbstractBaseConsumerTest.java @@ -58,6 +58,7 @@ public class AbstractBaseConsumerTest { public void callClose() throws Exception { DummyConsumer dummy = getAuthDummy(); dummy.close(); + assertNotNull(dummy); } @Test diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java index 6564dc3d1..a9389b279 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestLockHelper.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertNotNull; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:test-context.xml" }) @@ -34,6 +35,7 @@ public class TestLockHelper { t1.join(); t2.join(); t3.join(); + assertNotNull(t1); } private class LockThread extends Thread { diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index f42ef9c3a..b159127b8 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -28,6 +28,7 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; +import static org.junit.Assert.assertNotNull; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:test-context.xml" }) @@ -231,6 +232,7 @@ public class TestReserve { rsList.forEach(r -> { StrUtil.info(log, r); }); + assertNotNull(rsList); } @@ -269,6 +271,7 @@ public class TestReserve { rsList.forEach(r -> { StrUtil.info(log, r); }); + assertNotNull(sd); } @@ -316,6 +319,7 @@ public class TestReserve { rsList.forEach(r -> { StrUtil.info(log, r); }); + assertNotNull(rr); } @@ -478,6 +482,7 @@ public class TestReserve { rsList.forEach(r -> { StrUtil.info(log, r); }); + assertNotNull(rsList); } -- cgit 1.2.3-korg From b96e26ca34255ee6560a03ba7a42a43eb994df51 Mon Sep 17 00:00:00 2001 From: Rupinder Date: Thu, 28 May 2020 10:18:20 +0530 Subject: added assert statements in 3 test classes Issue-ID: CCSDK-2232 Change-Id: Ide54fa192c934dc40bb15034c8e5dbf2c2594f62 Signed-off-by: Rupinder --- .../onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java | 3 +++ .../impl/TestSaltstackAdapterPropertiesProviderImpl.java | 13 +++++++++++++ .../java/org/onap/ccsdk/adapter/model/TestJsonParser.java | 2 ++ 3 files changed, 18 insertions(+) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java index bfb9ad7e4..dc0761c20 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestResourceLockNode.java @@ -2,6 +2,8 @@ package jtest.org.onap.ccsdk.sli.adaptors.ra; import java.util.HashMap; import java.util.Map; + +import org.junit.Assert; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,5 +34,6 @@ public class TestResourceLockNode { resourceLockNode.lockResource(paramMap, null); resourceLockNode.unlockResource(paramMap, null); + Assert.assertNotNull(paramMap); } } diff --git a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterPropertiesProviderImpl.java b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterPropertiesProviderImpl.java index b03b0f785..88acc1919 100644 --- a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterPropertiesProviderImpl.java +++ b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterPropertiesProviderImpl.java @@ -34,6 +34,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException; import java.util.Properties; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; public class TestSaltstackAdapterPropertiesProviderImpl { @@ -65,6 +66,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test(expected = SvcLogicException.class) @@ -101,6 +103,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(adapter); } @Test @@ -116,6 +119,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test(expected = SvcLogicException.class) @@ -152,6 +156,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -167,6 +172,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -185,6 +191,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -200,6 +207,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -218,6 +226,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -236,6 +245,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @@ -251,6 +261,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -268,6 +279,7 @@ public class TestSaltstackAdapterPropertiesProviderImpl { } }; adapter = new SaltstackAdapterImpl(propProvider); + assertNotNull(propProvider); } @Test @@ -293,5 +305,6 @@ public class TestSaltstackAdapterPropertiesProviderImpl { public void reqExecCommand_setPropertiesDefault() throws SvcLogicException, IllegalStateException, IllegalArgumentException { adapter = new SaltstackAdapterImpl(); + assertNotNull(adapter); } } diff --git a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/model/TestJsonParser.java b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/model/TestJsonParser.java index 71798fbc8..d4eafc1a0 100644 --- a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/model/TestJsonParser.java +++ b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/model/TestJsonParser.java @@ -35,6 +35,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import static org.junit.Assert.assertNotNull; public class TestJsonParser { @@ -55,6 +56,7 @@ public class TestJsonParser { logProperties(mm); in.close(); + assertNotNull(mm); } @Test(expected = NullPointerException.class) -- cgit 1.2.3-korg From dde59cf2ebddb71d36a7a9b1ae6a1ecf4a6d2167 Mon Sep 17 00:00:00 2001 From: sb5356 Date: Tue, 9 Jun 2020 17:11:26 -0400 Subject: RA: Add option for sequential number assignment from a range Change-Id: Ifc967676d7c78063ba9ba67706bd4b98ba1d9115 Issue-ID: CCSDK-2416 Signed-off-by: Stan Bonev --- .../ccsdk/sli/adaptors/ra/ResourceAllocator.java | 2 + .../sli/adaptors/ra/alloc/DbAllocationRule.java | 1 + .../sli/adaptors/ra/comp/ResourceRequest.java | 1 + .../sli/adaptors/rm/comp/AllocationFunction.java | 53 +++++++++- .../adaptors/rm/data/RangeAllocationRequest.java | 1 + .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 116 ++++++++++++++++++++- 6 files changed, 171 insertions(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java index 19062d53b..10f3e02b7 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java @@ -455,6 +455,8 @@ public class ResourceAllocator implements SvcLogicResource { rr.rangeMaxOverride = Integer.parseInt(rangeMaxOverrideStr); String rangeForceNewNumbersStr = getParam(ctx, "range-force-new-numbers", false, "false"); rr.rangeForceNewNumbers = Boolean.parseBoolean(rangeForceNewNumbersStr); + String rangeNextInSequenceStr = getParam(ctx, "range-next-in-sequence", false, "false"); + rr.rangeNextInSequence = Boolean.parseBoolean(rangeNextInSequenceStr); String replaceStr = getParam(ctx, "replace", false, "true"); rr.replace = Boolean.parseBoolean(replaceStr); rr.applicationId = getParam(ctx, "application-id", false, "SDNC"); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java index 12c02c858..d15b1508f 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/alloc/DbAllocationRule.java @@ -242,6 +242,7 @@ public class DbAllocationRule implements AllocationRule { } ar.forceNewNumbers = resourceRequest.rangeForceNewNumbers; + ar.nextInSequence = resourceRequest.rangeNextInSequence; return ar; } diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java index bc05af657..2ebad4c89 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/comp/ResourceRequest.java @@ -35,6 +35,7 @@ public class ResourceRequest { public int rangeMinOverride; public int rangeMaxOverride; public boolean rangeForceNewNumbers; + public boolean rangeNextInSequence; public boolean replace; public String requestType; public String serviceModel; diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index 0f5335443..5ec7c26ba 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -108,7 +108,7 @@ class AllocationFunction extends SynchronizedFunction { public void _exec() throws ResourceLockedException { outcome = allocate(request); - if ((outcome!=null) && (outcome.status == AllocationStatus.Success)) { + if (outcome!=null && outcome.status == AllocationStatus.Success) { for (Resource r : updateList) { resourceDao.saveResource(r); } @@ -334,7 +334,56 @@ class AllocationFunction extends SynchronizedFunction { } } - if (req.rangeList != null) { + if (req.rangeList != null && !req.rangeList.isEmpty()) { + if (req.nextInSequence) { + // This means we allocate numbers in ascending sequence, not trying from the beginning + // of the range (leaving possible holes in the sequence of allocated numbers) + // To do that, we go through the ranges from the last towards the first (assuming + // ranges are ordered from smallest to the largest numbers), and within each range, from + // the max towards the min and find the first allocated number. Then we take the next numbers + // in the range (that we already checked are available). + + int rangeIndex; + Range range = null; + int n = 0; + boolean foundAllocated = false; + for (rangeIndex = req.rangeList.size() - 1; !foundAllocated && rangeIndex >= 0; rangeIndex--) { + range = req.rangeList.get(rangeIndex); + for (n = range.max; n >= range.min; n--) { + if (!RangeUtil.checkRange(rr, req, n)) { + foundAllocated = true; + break; + } + } + if (foundAllocated) { + break; + } + } + if (foundAllocated) { + n++; + } + for (; foundCount < req.requestedCount && n <= range.max; n++) { + foundNumbers.add(n); + foundCount++; + } + if (foundCount < req.requestedCount) { + rangeIndex++; + for (; rangeIndex < req.rangeList.size(); rangeIndex++) { + range = req.rangeList.get(rangeIndex); + for (n = range.min; foundCount < req.requestedCount && n <= range.max; n++) { + foundNumbers.add(n); + foundCount++; + } + } + } + // If we could not find enough numbers by going up in sequence, + // reset foundNumbers and foundCount, and go back to the holes + if (foundCount < req.requestedCount) { + foundNumbers = new TreeSet<>(); + foundCount = 0; + } + } + if (req.reverseOrder) { for (int i = req.rangeList.size() - 1; i >= 0; i--) { Range range = req.rangeList.get(i); diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java index 7b60d3689..a7948b02c 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/data/RangeAllocationRequest.java @@ -36,4 +36,5 @@ public class RangeAllocationRequest extends AllocationRequest { public boolean sequential = false; public boolean reverseOrder = false; public boolean forceNewNumbers = false; + public boolean nextInSequence = false; } diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index b159127b8..af9508a66 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -1,5 +1,6 @@ package jtest.org.onap.ccsdk.sli.adaptors.ra; +import static org.junit.Assert.assertNotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -28,7 +29,6 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestTable; -import static org.junit.Assert.assertNotNull; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:test-context.xml" }) @@ -804,4 +804,118 @@ public class TestReserve { allocationItem.print(); } + + @Test + public void test011() throws Exception { + String t = "011"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-next-in-sequence = true"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "vlan-id-filter"; + + String assetId = "Site::" + targetId; + String resourceUnion = "SI::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.cleanup(); + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, "1002,1004,1006,1008"); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL"); + ctx.setAttribute("ra-input.endpoint-position", "VPE-Core2"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-next-in-sequence", "true"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId + "_test"); + ctx.setAttribute("ra-input.reservation-entity-version", "1"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, "SI::" + entityId + "_test::VPE-Core2::1", "1009")); + } + + @Test + public void test012() throws Exception { + String t = "012"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-next-in-sequence = false"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "vlan-id-filter"; + + String assetId = "Site::" + targetId; + String resourceUnion = "SI::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.cleanup(); + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, "1002,1004,1006,1008"); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL"); + ctx.setAttribute("ra-input.endpoint-position", "VPE-Core2"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-next-in-sequence", "false"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId + "_test"); + ctx.setAttribute("ra-input.reservation-entity-version", "1"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, "SI::" + entityId + "_test::VPE-Core2::1", "1003")); + } + + @Test + public void test013() throws Exception { + String t = "013"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-next-in-sequence = true - multiple ranges"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "vlan-id-filter"; + + String assetId = "Site::" + targetId; + String resourceUnion = "SI::" + entityId; + String resourceSet = resourceUnion + "::1"; + + dataSetup.cleanup(); + dataSetup.setupRangeItem(resourceName, assetId, resourceSet, resourceUnion, "1002,1004,1006,1008,2205-2221"); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL"); + ctx.setAttribute("ra-input.endpoint-position", "VPE-Core2"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-next-in-sequence", "true"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId + "_test"); + ctx.setAttribute("ra-input.reservation-entity-version", "1"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, "SI::" + entityId + "_test::VPE-Core2::1", "2222")); + } } -- cgit 1.2.3-korg From 7b790e614732183db8be972a168a60d564a86d60 Mon Sep 17 00:00:00 2001 From: stan-sb <67116470+stan-sb@users.noreply.github.com> Date: Tue, 23 Jun 2020 10:21:23 -0400 Subject: RA: Add option for sequential number assignment from a range Fix case, when no previous numbers have been allocated Change-Id: Iead3cb4fe4a8ed3f6de363d31677eb389e9f1329 Issue-ID: CCSDK-2416 Signed-off-by: Stan Bonev --- .../sli/adaptors/rm/comp/AllocationFunction.java | 4 +-- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 35 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'resource-assignment') diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java index 5ec7c26ba..485010656 100644 --- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java +++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/comp/AllocationFunction.java @@ -359,9 +359,7 @@ class AllocationFunction extends SynchronizedFunction { break; } } - if (foundAllocated) { - n++; - } + n++; for (; foundCount < req.requestedCount && n <= range.max; n++) { foundNumbers.add(n); foundCount++; diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index af9508a66..ab2d936cf 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -918,4 +918,39 @@ public class TestReserve { Assert.assertTrue(st == QueryStatus.SUCCESS); Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, "SI::" + entityId + "_test::VPE-Core2::1", "2222")); } + + @Test + public void test014() throws Exception { + String t = "014"; + log.info("============== reserve " + t + " ================================"); + log.info("=== Test range-next-in-sequence = true - no previously reserved numbers"); + + String entityId = "reserve" + t; + String targetId = "port-id-1"; + String resourceName = "vlan-id-filter"; + + String assetId = "Site::" + targetId; + + dataSetup.cleanup(); + + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("ra-input.service-model", "MY-SERV-MODEL"); + ctx.setAttribute("ra-input.endpoint-position", "VPE-Core2"); + ctx.setAttribute("ra-input.check-only", "false"); + + ctx.setAttribute("ra-input.resource-name", resourceName); + ctx.setAttribute("ra-input.range-next-in-sequence", "true"); + + ctx.setAttribute("ra-input.reservation-entity-type", "SI"); + ctx.setAttribute("ra-input.reservation-entity-id", entityId + "_test"); + ctx.setAttribute("ra-input.reservation-entity-version", "1"); + + ctx.setAttribute("ra-input.reservation-target-id", targetId); + ctx.setAttribute("ra-input.reservation-target-type", "Site"); + + QueryStatus st = resourceAllocator.reserve("NetworkCapacity", null, null, null, ctx); + + Assert.assertTrue(st == QueryStatus.SUCCESS); + Assert.assertTrue(dataSetup.checkRangeItem(resourceName, assetId, "SI::" + entityId + "_test::VPE-Core2::1", "1002")); + } } -- cgit 1.2.3-korg From 6fb8dfad11c84c0833e842183ec43a4ee95e81de Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 14 Jul 2020 08:55:33 -0400 Subject: Update adaptors to sodium Update sli/adaptors to OpenDaylight Sodium release. 2 changes were needed: - mdsal-resource : needed to add unimplemented abstract methods in inner anonymous BundleContext class in test case. - resource-assignment: needed to correct unit test problems that were ignored in earlier versions of h2 Change-Id: Ice63bfce64768e46c4376db55e3e9e97d0b934ad Issue-ID: CCSDK-2551 Signed-off-by: Dan Timoney --- .gitignore | 1 + .../adaptors/aai/AAIClientRESTExecutorTest.java | 3 ++ features/ccsdk-ansible-adapter/pom.xml | 6 +++ features/ccsdk-saltstack-adapter/pom.xml | 10 ++++- .../resource/mdsal/TestMdsalResourceActivator.java | 49 ++++++++++++++++++---- .../onap/ccsdk/sli/adaptors/ra/TestReserve.java | 8 ++++ .../provider/src/test/resources/sql/schema.sql | 2 +- 7 files changed, 69 insertions(+), 10 deletions(-) (limited to 'resource-assignment') diff --git a/.gitignore b/.gitignore index cc576b7b2..42cca13bb 100755 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ classes out/ .DS_STORE .metadata +.vscode provider/src/main/java/META-INF/ provider/src/main/java/inventory/ logs/ diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorTest.java index b0272f5d0..f60b2da64 100644 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorTest.java @@ -11,6 +11,8 @@ import static org.junit.Assert.assertNotNull; public class AAIClientRESTExecutorTest { private static AAIClientRESTExecutor aaiExecute; + private static AAIService aaiService; + @BeforeClass public static void setUpBeforeClass() throws Exception { Properties properties = new Properties(); @@ -22,6 +24,7 @@ public class AAIClientRESTExecutorTest { properties.setProperty("connection.timeout", "60000"); properties.setProperty("read.timeout", "60000"); aaiExecute = new AAIClientRESTExecutor(properties); + aaiService = new AAIService(properties); } diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index 32ec5058f..da497f56f 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -36,6 +36,12 @@ ${project.groupId} ansible-adapter-bundle ${project.version} + + + powermock-api-mockito + org.powermock + + diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index ffc43e152..2e51c83be 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -33,6 +34,13 @@ ${project.groupId} saltstack-adapter-provider ${project.version} + + + + powermock-api-mockito + org.powermock + + diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourceActivator.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourceActivator.java index 397915d08..6174bc84d 100644 --- a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourceActivator.java +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourceActivator.java @@ -30,7 +30,9 @@ import org.osgi.framework.BundleListener; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkListener; import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceFactory; import org.osgi.framework.ServiceListener; +import org.osgi.framework.ServiceObjects; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; @@ -49,8 +51,7 @@ public class TestMdsalResourceActivator { mdsal = new MdsalResourceActivator(); } - - @Test (expected = ConfigurationException.class) + @Test(expected = ConfigurationException.class) public void testStartResource() throws Exception { BundleContext ctx = new BundleContext() { @Override @@ -119,27 +120,32 @@ public class TestMdsalResourceActivator { } @Override - public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) { + public ServiceRegistration registerService(String[] clazzes, Object service, + Dictionary properties) { return null; } @Override - public ServiceRegistration registerService(String clazz, Object service, Dictionary properties) { + public ServiceRegistration registerService(String clazz, Object service, + Dictionary properties) { return null; } @Override - public ServiceRegistration registerService(Class clazz, S service, Dictionary properties) { + public ServiceRegistration registerService(Class clazz, S service, + Dictionary properties) { return null; } @Override - public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException { + public ServiceReference[] getServiceReferences(String clazz, String filter) + throws InvalidSyntaxException { return new ServiceReference[0]; } @Override - public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException { + public ServiceReference[] getAllServiceReferences(String clazz, String filter) + throws InvalidSyntaxException { return new ServiceReference[0]; } @@ -154,7 +160,8 @@ public class TestMdsalResourceActivator { } @Override - public Collection> getServiceReferences(Class clazz, String filter) throws InvalidSyntaxException { + public Collection> getServiceReferences(Class clazz, String filter) + throws InvalidSyntaxException { return null; } @@ -182,6 +189,19 @@ public class TestMdsalResourceActivator { public Bundle getBundle(String location) { return null; } + + @Override + public ServiceRegistration registerService(Class clazz, ServiceFactory factory, + Dictionary properties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ServiceObjects getServiceObjects(ServiceReference reference) { + // TODO Auto-generated method stub + return null; + } }; mdsal.start(ctx); @@ -320,6 +340,19 @@ public class TestMdsalResourceActivator { public Bundle getBundle(String location) { return null; } + + @Override + public ServiceRegistration registerService(Class clazz, ServiceFactory factory, + Dictionary properties) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ServiceObjects getServiceObjects(ServiceReference reference) { + // TODO Auto-generated method stub + return null; + } }; mdsal.stop(ctx); diff --git a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java index ab2d936cf..dbf0c4aac 100644 --- a/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java +++ b/resource-assignment/provider/src/test/java/jtest/org/onap/ccsdk/sli/adaptors/ra/TestReserve.java @@ -216,6 +216,7 @@ public class TestReserve { rr.requestType = "New"; rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; + rr.applicationId = "myapp"; List rsList = new ArrayList<>(); @@ -513,6 +514,7 @@ public class TestReserve { rr.endPointPosition = "VPE-Cust"; rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; + rr.applicationId = "myapp"; List rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -533,6 +535,7 @@ public class TestReserve { rr.endPointPosition = "VPE-Core1"; rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; + rr.applicationId = "myapp"; rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -553,6 +556,7 @@ public class TestReserve { rr.endPointPosition = "VPE-Core2"; rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; + rr.applicationId = "myapp"; rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -573,6 +577,7 @@ public class TestReserve { rr.endPointPosition = "VPE-Core3"; rr.rangeMaxOverride = -1; rr.rangeMinOverride = -1; + rr.applicationId = "myapp"; rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -720,6 +725,7 @@ public class TestReserve { rr.rangeMaxOverride = 3901; rr.rangeMinOverride = 3900; rr.resourceType = ResourceType.Range; + rr.applicationId = "myapp"; List rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -748,6 +754,7 @@ public class TestReserve { rr.rangeMinOverride = -1; rr.rangeOverrideList = Arrays.asList(range); rr.resourceType = ResourceType.Range; + rr.applicationId = "myapp"; rsList = new ArrayList<>(); resourceAllocator.reserve(sd, rt, rr, rsList); @@ -781,6 +788,7 @@ public class TestReserve { rr.rangeOverrideList = new ArrayList<>(); rr.rangeOverrideList.add(range1); rr.rangeOverrideList.add(range2); + rr.applicationId = "myapp"; rr.resourceType = ResourceType.Range; rsList = new ArrayList<>(); diff --git a/resource-assignment/provider/src/test/resources/sql/schema.sql b/resource-assignment/provider/src/test/resources/sql/schema.sql index ed123ddd6..275337e44 100644 --- a/resource-assignment/provider/src/test/resources/sql/schema.sql +++ b/resource-assignment/provider/src/test/resources/sql/schema.sql @@ -124,7 +124,7 @@ CREATE TABLE SERVICE_RESOURCE ( 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, + resource_union_id VARCHAR(100) NOT NULL ); ALTER TABLE SERVICE_RESOURCE ADD CONSTRAINT C1_SERVICE_RESOURCE CHECK (service_status IN ('Active', 'Pending')); -- cgit 1.2.3-korg From 8bc3696b7c7c56671b2e9e09e6afbf0a57254421 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 6 Aug 2020 15:17:17 -0400 Subject: Roll to next snapshot Roll to snapshot version 1.0.1-SNAPSHOT Change-Id: Ie09ba5c2bedcd8cddf3e8cca0eff8e05c2ad268a Issue-ID: CCSDK-2635 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 5 +++-- ansible-adapter/ansible-adapter-installer/pom.xml | 5 +++-- ansible-adapter/pom.xml | 5 +++-- artifacts/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- features/ccsdk-aai-service/pom.xml | 4 ++-- features/ccsdk-ansible-adapter/pom.xml | 4 ++-- features/ccsdk-base-http/pom.xml | 4 ++-- features/ccsdk-mdsal-resource/pom.xml | 4 ++-- features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- features/ccsdk-netbox-client/pom.xml | 5 +++-- features/ccsdk-resource-assignment/pom.xml | 4 ++-- features/ccsdk-saltstack-adapter/pom.xml | 7 +++---- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/ccsdk-sql-resource/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/installer/pom.xml | 5 +++-- netbox-client/pom.xml | 5 +++-- netbox-client/provider/pom.xml | 5 +++-- pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 5 +++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 5 +++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 5 +++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 2 +- 52 files changed, 107 insertions(+), 98 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 6a0d99097..23971164d 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index e96f57540..e70cdc500 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index b0b02caaf..a46a243d5 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index e0ac33813..f56e0f594 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -12,19 +12,20 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 22295c283..7e64db281 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -22,19 +22,20 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index e1b6482a0..ba83b4505 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -22,19 +22,20 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 53a8fbe10..90197499e 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index 4940c55c9..b22f4362c 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index e72441db5..9ebc1ed5e 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 6aab259b4..fb472ed1b 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index 364fd7878..c7a3ba2e9 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors base-parent - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index f91e58502..d8d6be29d 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index da497f56f..c069be6ed 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index a38fa4c73..18ee2934a 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index e3ef74a05..ac12fc1da 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 47fc35316..806a82237 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index ef3f13649..a9321f677 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index 28e672350..4974da819 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -14,19 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. --> + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 1672c6c21..04bb40b20 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index 2e51c83be..07e62c576 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -1,18 +1,17 @@ - + 4.0.0 org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 53664b4ed..1f36754e7 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index 8b553c0ce..d1a8e6e08 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 4c9c862b8..66c87e239 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 036cc9a5d..41ed103ab 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 2c4d8098c..c8de8c0c3 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index d78bec957..08e29e9a3 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 36ea6e83e..8720eb9b2 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 3da2dc241..258ad3025 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index 70dd0408e..c413f9b59 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT consumer.api diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 465550386..78586a572 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 56586eae8..042c31499 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index 1e69ad150..8528e0df9 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 5fe29e144..f17c67a8a 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index 0532ed77e..abd03a6ef 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT publisher.api diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index b700fa878..9b9740aed 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 0e069c6ac..7a4eab9d8 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index c1fbf274d..5ac473239 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index bcdd14d54..2d3fbf536 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT sample.client diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index e2be415ca..d9931c8d6 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -14,19 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index da901ae9c..ef970e9c4 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -14,19 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 19080bcda..27a8f89a8 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -14,19 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. --> + 4.0.0 org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index 101c6779e..ff3c91418 100755 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index ebfc5e518..3a1384e35 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 3c3fab354..28ed730dd 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index cc6043a70..5e1ae6d0b 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index da1b6095c..a10258d45 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -22,19 +22,20 @@ ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index a0f37d18f..799c6d803 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -22,19 +22,20 @@ ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index eb7788d94..c306ea3eb 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -11,19 +11,20 @@ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END========================================================= --> + 4.0.0 org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index e518767b6..02569df34 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 3fcf5e4e6..0700af53d 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index 90e0224bb..c735617ed 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.0-SNAPSHOT + 2.0.1-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index feea7088f..6e5a89dbc 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=1 sprint_number=0 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 3a489bb37be36b72bc584c530f2c514032e12b8c Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Wed, 9 Sep 2020 17:32:42 -0400 Subject: Roll to initial Honolulu release version Roll master branch to initial Honolulu release version Change-Id: Id7829542cb5981c11b38367952e6bc29ffa4cfe8 Issue-ID: CCSDK-2742 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-bundle/pom.xml | 4 ++-- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- features/ccsdk-aai-service/pom.xml | 4 ++-- features/ccsdk-ansible-adapter/pom.xml | 4 ++-- features/ccsdk-base-http/pom.xml | 4 ++-- features/ccsdk-mdsal-resource/pom.xml | 4 ++-- features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- features/ccsdk-netbox-client/pom.xml | 4 ++-- features/ccsdk-resource-assignment/pom.xml | 4 ++-- features/ccsdk-saltstack-adapter/pom.xml | 4 ++-- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/ccsdk-sql-resource/pom.xml | 4 ++-- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 4 ++-- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 4 ++-- pom.xml | 4 ++-- resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 4 ++-- saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 4 ++-- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 4 ++-- version.properties | 4 ++-- 52 files changed, 97 insertions(+), 97 deletions(-) (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index 23971164d..c84c3635d 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index e70cdc500..78637df81 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index cb0358e02..598150772 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors aai-service-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index f56e0f594..605eb8da2 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -19,13 +19,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 7e64db281..46b478a3d 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index ba83b4505..685b830c4 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ansible-adaptor - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 90197499e..839e7b060 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index b22f4362c..c90287148 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index 9ebc1ed5e..6d9250b92 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.base http - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index fb472ed1b..95007afbf 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-http-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index c7a3ba2e9..1ec48f6d6 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors base-parent - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index d8d6be29d..245314d96 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index c069be6ed..4b6c507e7 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index 18ee2934a..ba0332297 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-base-http - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index ac12fc1da..ba326f17d 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 806a82237..516ba5959 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index a9321f677..d96c83861 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index 4974da819..a7c7d5f5a 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 04bb40b20..92efdc65b 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index 07e62c576..c7fbefbd6 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 1f36754e7..73e165229 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index d1a8e6e08..030bfbbe6 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index 66c87e239..dd11da07e 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors features-sli-adaptors - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 41ed103ab..f783f8c98 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index c8de8c0c3..55c16f1fd 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 08e29e9a3..3129af14e 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 8720eb9b2..1d746575b 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 258ad3025..5a8fa7659 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index c413f9b59..bbf389f73 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT consumer.api diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 78586a572..7e658837b 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 042c31499..01c2b5e36 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index 8528e0df9..c9f5a6197 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index f17c67a8a..7805a5890 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index abd03a6ef..cd06f4b7a 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT publisher.api diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 9b9740aed..6dcb0e6c0 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 7a4eab9d8..5cca7d677 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index 5ac473239..d0122785d 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 2d3fbf536..6e39d42f2 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT sample.client diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index d9931c8d6..023595e07 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index ef970e9c4..c07bcd628 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index 27a8f89a8..d54ea9e55 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors netbox-client-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index ff3c91418..8faca98c2 100755 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 3a1384e35..93b836182 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 28ed730dd..48e55393e 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index 5e1ae6d0b..d643151b1 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors resource-assignment-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index a10258d45..daed0609f 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adaptor - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 799c6d803..46cb2dca9 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index c306ea3eb..379b195d5 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,13 +18,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index 02569df34..af64f8388 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-installer - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 0700af53d..19f12c646 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index c735617ed..e8e2254cb 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.0.1-SNAPSHOT + 2.1.0-SNAPSHOT org.onap.ccsdk.sli.adaptors sql-resource-provider - 1.0.1-SNAPSHOT + 1.1.0-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/version.properties b/version.properties index 6e5a89dbc..60b87d41c 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=0 -feature_revision=1 +sprint_number=1 +feature_revision=0 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg From 2173e3e37bbb7648b97bcdfa734508686f176727 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Wed, 25 Nov 2020 14:51:48 -0500 Subject: Release version 1.1.0 of sli/adaptors Release initial Honolulu version of sli/adaptors and roll version to next snapshot Change-Id: I3a59f29d7819e8d777dd02aede9a263ea0be8e36 Issue-ID: CCSDK-3002 Signed-off-by: Dan Timoney --- aai-service/installer/pom.xml | 4 ++-- aai-service/pom.xml | 4 ++-- aai-service/provider/pom.xml | 5 ++--- ansible-adapter/ansible-adapter-bundle/pom.xml | 5 ++--- ansible-adapter/ansible-adapter-installer/pom.xml | 4 ++-- ansible-adapter/pom.xml | 4 ++-- artifacts/pom.xml | 4 ++-- base/http/installer/pom.xml | 4 ++-- base/http/pom.xml | 4 ++-- base/http/provider/pom.xml | 4 ++-- base/pom.xml | 4 ++-- features/ccsdk-aai-service/pom.xml | 5 ++--- features/ccsdk-ansible-adapter/pom.xml | 5 ++--- features/ccsdk-base-http/pom.xml | 4 ++-- features/ccsdk-mdsal-resource/pom.xml | 5 ++--- features/ccsdk-messagerouter-consumer/pom.xml | 4 ++-- features/ccsdk-messagerouter-publisher/pom.xml | 4 ++-- features/ccsdk-netbox-client/pom.xml | 5 ++--- features/ccsdk-resource-assignment/pom.xml | 5 ++--- features/ccsdk-saltstack-adapter/pom.xml | 5 ++--- features/ccsdk-sli-adaptors-all/pom.xml | 4 ++-- features/ccsdk-sql-resource/pom.xml | 5 ++--- features/features-sli-adaptors/pom.xml | 4 ++-- features/installer/pom.xml | 4 ++-- features/pom.xml | 4 ++-- mdsal-resource/installer/pom.xml | 4 ++-- mdsal-resource/pom.xml | 4 ++-- mdsal-resource/provider/pom.xml | 5 ++--- message-router/consumer/api/pom.xml | 2 +- message-router/consumer/installer/pom.xml | 4 ++-- message-router/consumer/pom.xml | 2 +- message-router/consumer/provider/pom.xml | 2 +- message-router/pom.xml | 4 ++-- message-router/publisher/api/pom.xml | 2 +- message-router/publisher/installer/pom.xml | 4 ++-- message-router/publisher/pom.xml | 2 +- message-router/publisher/provider/pom.xml | 2 +- message-router/publisher/sample.client/pom.xml | 2 +- netbox-client/installer/pom.xml | 4 ++-- netbox-client/pom.xml | 4 ++-- netbox-client/provider/pom.xml | 5 ++--- pom.xml | 4 ++-- releases/1.1.0.yaml | 5 +++++ resource-assignment/installer/pom.xml | 4 ++-- resource-assignment/pom.xml | 4 ++-- resource-assignment/provider/pom.xml | 15 +++++++-------- saltstack-adapter/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-installer/pom.xml | 4 ++-- saltstack-adapter/saltstack-adapter-provider/pom.xml | 5 ++--- sql-resource/installer/pom.xml | 4 ++-- sql-resource/pom.xml | 4 ++-- sql-resource/provider/pom.xml | 5 ++--- version.properties | 2 +- 53 files changed, 106 insertions(+), 115 deletions(-) create mode 100644 releases/1.1.0.yaml (limited to 'resource-assignment') diff --git a/aai-service/installer/pom.xml b/aai-service/installer/pom.xml index c84c3635d..591e9bc20 100755 --- a/aai-service/installer/pom.xml +++ b/aai-service/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors aai-service-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} diff --git a/aai-service/pom.xml b/aai-service/pom.xml index 78637df81..322291043 100755 --- a/aai-service/pom.xml +++ b/aai-service/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors aai-service - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: aai-service diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 75a35cec8..ca3fda288 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors aai-service-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml index 605eb8da2..605c64421 100644 --- a/ansible-adapter/ansible-adapter-bundle/pom.xml +++ b/ansible-adapter/ansible-adapter-bundle/pom.xml @@ -19,19 +19,18 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ansible-adapter-bundle - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/ansible-adapter/ansible-adapter-installer/pom.xml b/ansible-adapter/ansible-adapter-installer/pom.xml index 46b478a3d..af02a8c5c 100644 --- a/ansible-adapter/ansible-adapter-installer/pom.xml +++ b/ansible-adapter/ansible-adapter-installer/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ansible-adapter-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter :: ${project.artifactId} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 685b830c4..3414e7cf3 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ansible-adaptor - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: ansible-adapter diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 839e7b060..452292304 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sli-adaptors-artifacts - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: sli-adaptors-artifacts diff --git a/base/http/installer/pom.xml b/base/http/installer/pom.xml index c90287148..980302ac9 100644 --- a/base/http/installer/pom.xml +++ b/base/http/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors base-http-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/base/http/pom.xml b/base/http/pom.xml index 6d9250b92..05840986d 100644 --- a/base/http/pom.xml +++ b/base/http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors.base http - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml index 95007afbf..5a3642fd2 100644 --- a/base/http/provider/pom.xml +++ b/base/http/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors base-http-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle diff --git a/base/pom.xml b/base/pom.xml index 1ec48f6d6..a8e6b9193 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors base-parent - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom diff --git a/features/ccsdk-aai-service/pom.xml b/features/ccsdk-aai-service/pom.xml index 245314d96..2870ea50f 100644 --- a/features/ccsdk-aai-service/pom.xml +++ b/features/ccsdk-aai-service/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-aai-service - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: aai-service :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-ansible-adapter/pom.xml b/features/ccsdk-ansible-adapter/pom.xml index 4b6c507e7..652a3ee59 100644 --- a/features/ccsdk-ansible-adapter/pom.xml +++ b/features/ccsdk-ansible-adapter/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-ansible-adapter - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: ansible-adapter:: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-base-http/pom.xml b/features/ccsdk-base-http/pom.xml index ba0332297..4f83f5de1 100644 --- a/features/ccsdk-base-http/pom.xml +++ b/features/ccsdk-base-http/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-base-http - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: base-http :: ${project.artifactId} diff --git a/features/ccsdk-mdsal-resource/pom.xml b/features/ccsdk-mdsal-resource/pom.xml index ba326f17d..fc5b9ae2f 100644 --- a/features/ccsdk-mdsal-resource/pom.xml +++ b/features/ccsdk-mdsal-resource/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-mdsal-resource - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-messagerouter-consumer/pom.xml b/features/ccsdk-messagerouter-consumer/pom.xml index 516ba5959..0030d92c8 100755 --- a/features/ccsdk-messagerouter-consumer/pom.xml +++ b/features/ccsdk-messagerouter-consumer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-consumer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature diff --git a/features/ccsdk-messagerouter-publisher/pom.xml b/features/ccsdk-messagerouter-publisher/pom.xml index d96c83861..fcedcace0 100755 --- a/features/ccsdk-messagerouter-publisher/pom.xml +++ b/features/ccsdk-messagerouter-publisher/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors.messagerouter ccsdk-messagerouter-publisher - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature diff --git a/features/ccsdk-netbox-client/pom.xml b/features/ccsdk-netbox-client/pom.xml index a7c7d5f5a..cff225740 100644 --- a/features/ccsdk-netbox-client/pom.xml +++ b/features/ccsdk-netbox-client/pom.xml @@ -21,19 +21,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-netbox-client - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-resource-assignment/pom.xml b/features/ccsdk-resource-assignment/pom.xml index 92efdc65b..d73a1acda 100644 --- a/features/ccsdk-resource-assignment/pom.xml +++ b/features/ccsdk-resource-assignment/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-resource-assignment - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-saltstack-adapter/pom.xml b/features/ccsdk-saltstack-adapter/pom.xml index c7fbefbd6..3ac7fcf14 100644 --- a/features/ccsdk-saltstack-adapter/pom.xml +++ b/features/ccsdk-saltstack-adapter/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-saltstack-adapter - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: saltstack-adapter:: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/ccsdk-sli-adaptors-all/pom.xml b/features/ccsdk-sli-adaptors-all/pom.xml index 73e165229..821f1cb12 100644 --- a/features/ccsdk-sli-adaptors-all/pom.xml +++ b/features/ccsdk-sli-adaptors-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors-all - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/ccsdk-sql-resource/pom.xml b/features/ccsdk-sql-resource/pom.xml index 030bfbbe6..d8ff07047 100644 --- a/features/ccsdk-sql-resource/pom.xml +++ b/features/ccsdk-sql-resource/pom.xml @@ -5,19 +5,18 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-sql-resource - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/features/features-sli-adaptors/pom.xml b/features/features-sli-adaptors/pom.xml index dd11da07e..5e98da302 100644 --- a/features/features-sli-adaptors/pom.xml +++ b/features/features-sli-adaptors/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors features-sli-adaptors - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT feature ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index f783f8c98..fab35b5f0 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sliadaptors-features-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index 55c16f1fd..e57a639ac 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sliadaptors-feature-aggregator - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: features diff --git a/mdsal-resource/installer/pom.xml b/mdsal-resource/installer/pom.xml index 3129af14e..bb92cbff3 100755 --- a/mdsal-resource/installer/pom.xml +++ b/mdsal-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors mdsal-resource-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} diff --git a/mdsal-resource/pom.xml b/mdsal-resource/pom.xml index 1d746575b..e770e504c 100755 --- a/mdsal-resource/pom.xml +++ b/mdsal-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors mdsal-resource - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: mdsal-resource diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml index 5a8fa7659..255812b55 100755 --- a/mdsal-resource/provider/pom.xml +++ b/mdsal-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors mdsal-resource-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: mdsal-resource :: ${project.artifactId} @@ -19,7 +19,6 @@ UTF-8 - ${project.version} ${project.version} diff --git a/message-router/consumer/api/pom.xml b/message-router/consumer/api/pom.xml index bbf389f73..e77eb9793 100755 --- a/message-router/consumer/api/pom.xml +++ b/message-router/consumer/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT consumer.api diff --git a/message-router/consumer/installer/pom.xml b/message-router/consumer/installer/pom.xml index 7e658837b..2b8eb688e 100755 --- a/message-router/consumer/installer/pom.xml +++ b/message-router/consumer/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter consumer.installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom diff --git a/message-router/consumer/pom.xml b/message-router/consumer/pom.xml index 01c2b5e36..cad1bbba0 100755 --- a/message-router/consumer/pom.xml +++ b/message-router/consumer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT consumer.aggregate diff --git a/message-router/consumer/provider/pom.xml b/message-router/consumer/provider/pom.xml index c9f5a6197..d3e568c40 100755 --- a/message-router/consumer/provider/pom.xml +++ b/message-router/consumer/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter consumer.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT consumer.provider diff --git a/message-router/pom.xml b/message-router/pom.xml index 7805a5890..63d267d2a 100755 --- a/message-router/pom.xml +++ b/message-router/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom diff --git a/message-router/publisher/api/pom.xml b/message-router/publisher/api/pom.xml index cd06f4b7a..7831284cf 100755 --- a/message-router/publisher/api/pom.xml +++ b/message-router/publisher/api/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT publisher.api diff --git a/message-router/publisher/installer/pom.xml b/message-router/publisher/installer/pom.xml index 6dcb0e6c0..bc0565e5b 100644 --- a/message-router/publisher/installer/pom.xml +++ b/message-router/publisher/installer/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT org.onap.ccsdk.sli.adaptors.messagerouter publisher.installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom diff --git a/message-router/publisher/pom.xml b/message-router/publisher/pom.xml index 5cca7d677..6fb9c82d3 100755 --- a/message-router/publisher/pom.xml +++ b/message-router/publisher/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter messagerouter-root - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT publisher.aggregate diff --git a/message-router/publisher/provider/pom.xml b/message-router/publisher/provider/pom.xml index d0122785d..7cd311448 100755 --- a/message-router/publisher/provider/pom.xml +++ b/message-router/publisher/provider/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT publisher.provider diff --git a/message-router/publisher/sample.client/pom.xml b/message-router/publisher/sample.client/pom.xml index 6e39d42f2..694af1f4a 100755 --- a/message-router/publisher/sample.client/pom.xml +++ b/message-router/publisher/sample.client/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.sli.adaptors.messagerouter publisher.aggregate - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT sample.client diff --git a/netbox-client/installer/pom.xml b/netbox-client/installer/pom.xml index 023595e07..44fa16490 100755 --- a/netbox-client/installer/pom.xml +++ b/netbox-client/installer/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors netbox-client-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} diff --git a/netbox-client/pom.xml b/netbox-client/pom.xml index c07bcd628..6c9dbe85c 100644 --- a/netbox-client/pom.xml +++ b/netbox-client/pom.xml @@ -21,13 +21,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors netbox-client - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: netbox-client diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml index d54ea9e55..2242a157b 100644 --- a/netbox-client/provider/pom.xml +++ b/netbox-client/provider/pom.xml @@ -21,19 +21,18 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors netbox-client-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: netbox-client :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/pom.xml b/pom.xml index 8faca98c2..da276955c 100755 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors ccsdk-sli-adaptors - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors diff --git a/releases/1.1.0.yaml b/releases/1.1.0.yaml new file mode 100644 index 000000000..9aa20862e --- /dev/null +++ b/releases/1.1.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '1.1.0' +project: 'ccsdk-sli-adaptors' +log_dir: 'ccsdk-sli-adaptors-maven-stage-master/308/' diff --git a/resource-assignment/installer/pom.xml b/resource-assignment/installer/pom.xml index 93b836182..11ff40ce3 100755 --- a/resource-assignment/installer/pom.xml +++ b/resource-assignment/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors resource-assignment-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} diff --git a/resource-assignment/pom.xml b/resource-assignment/pom.xml index 48e55393e..c2ef269ca 100755 --- a/resource-assignment/pom.xml +++ b/resource-assignment/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors resource-assignment - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: resource-assignment diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml index d643151b1..014daeae5 100755 --- a/resource-assignment/provider/pom.xml +++ b/resource-assignment/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors resource-assignment-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: resource-assignment :: ${project.artifactId} @@ -19,18 +19,17 @@ UTF-8 - ${project.version} ${project.version} - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import diff --git a/saltstack-adapter/pom.xml b/saltstack-adapter/pom.xml index daed0609f..de8a87b05 100644 --- a/saltstack-adapter/pom.xml +++ b/saltstack-adapter/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors saltstack-adaptor - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter diff --git a/saltstack-adapter/saltstack-adapter-installer/pom.xml b/saltstack-adapter/saltstack-adapter-installer/pom.xml index 46cb2dca9..67e30fa02 100644 --- a/saltstack-adapter/saltstack-adapter-installer/pom.xml +++ b/saltstack-adapter/saltstack-adapter-installer/pom.xml @@ -29,13 +29,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors saltstack-adapter-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} diff --git a/saltstack-adapter/saltstack-adapter-provider/pom.xml b/saltstack-adapter/saltstack-adapter-provider/pom.xml index 379b195d5..4b6868179 100644 --- a/saltstack-adapter/saltstack-adapter-provider/pom.xml +++ b/saltstack-adapter/saltstack-adapter-provider/pom.xml @@ -18,20 +18,19 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors saltstack-adapter-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: saltstack-adapter :: ${project.artifactId} - ${project.version} ${project.version} diff --git a/sql-resource/installer/pom.xml b/sql-resource/installer/pom.xml index af64f8388..5ec885ce0 100755 --- a/sql-resource/installer/pom.xml +++ b/sql-resource/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sql-resource-installer - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} diff --git a/sql-resource/pom.xml b/sql-resource/pom.xml index 19f12c646..5cbee1089 100755 --- a/sql-resource/pom.xml +++ b/sql-resource/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sql-resource - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT pom ccsdk-sli-adaptors :: sql-resource diff --git a/sql-resource/provider/pom.xml b/sql-resource/provider/pom.xml index e8e2254cb..94b0225c9 100755 --- a/sql-resource/provider/pom.xml +++ b/sql-resource/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 2.1.0-SNAPSHOT + 2.1.0 org.onap.ccsdk.sli.adaptors sql-resource-provider - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT bundle ccsdk-sli-adaptors :: sql-resource :: ${project.artifactId} @@ -19,7 +19,6 @@ UTF-8 - ${project.version} ${project.version} diff --git a/version.properties b/version.properties index 60b87d41c..8c043844d 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=1 sprint_number=1 -feature_revision=0 +feature_revision=1 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg