aboutsummaryrefslogtreecommitdiffstats
path: root/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule
diff options
context:
space:
mode:
Diffstat (limited to 'resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule')
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java42
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java172
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java28
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java85
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java28
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java86
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java27
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java57
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java32
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java70
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java38
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java117
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java27
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java48
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java33
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java39
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java28
-rw-r--r--resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java32
18 files changed, 0 insertions, 989 deletions
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java
deleted file mode 100644
index d8389bf..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.comp;
-
-import org.openecomp.sdnc.ra.comp.ServiceData;
-import org.openecomp.sdnc.ra.equip.data.EquipmentData;
-import org.openecomp.sdnc.ra.rule.data.ThresholdStatus;
-import org.openecomp.sdnc.rm.data.AllocationRequest;
-import org.openecomp.sdnc.rm.data.LimitAllocationOutcome;
-
-public interface AllocationRequestBuilder {
-
- AllocationRequest buildAllocationRequest(
- ServiceData serviceData,
- EquipmentData equipmentData,
- boolean checkOnly,
- boolean change);
-
- ThresholdStatus getThresholdStatus(
- ServiceData serviceData,
- EquipmentData equipmentData,
- LimitAllocationOutcome limitAllocationOutcome);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java
deleted file mode 100644
index e78fd02..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/comp/AllocationRequestBuilderImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.comp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openecomp.sdnc.ra.comp.ServiceData;
-import org.openecomp.sdnc.ra.equip.data.EquipmentData;
-import org.openecomp.sdnc.ra.rule.dao.RangeRuleDao;
-import org.openecomp.sdnc.ra.rule.dao.ResourceRuleDao;
-import org.openecomp.sdnc.ra.rule.data.RangeRule;
-import org.openecomp.sdnc.ra.rule.data.ResourceRule;
-import org.openecomp.sdnc.ra.rule.data.ResourceThreshold;
-import org.openecomp.sdnc.ra.rule.data.ThresholdStatus;
-import org.openecomp.sdnc.rm.data.AllocationAction;
-import org.openecomp.sdnc.rm.data.AllocationRequest;
-import org.openecomp.sdnc.rm.data.LimitAllocationOutcome;
-import org.openecomp.sdnc.rm.data.LimitAllocationRequest;
-import org.openecomp.sdnc.rm.data.MultiResourceAllocationRequest;
-import org.openecomp.sdnc.rm.data.RangeAllocationRequest;
-import org.openecomp.sdnc.util.expr.ExpressionEvaluator;
-import org.openecomp.sdnc.util.str.StrUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AllocationRequestBuilderImpl implements AllocationRequestBuilder {
-
- private static final Logger log = LoggerFactory.getLogger(AllocationRequestBuilderImpl.class);
-
- private ResourceRuleDao resourceRuleDao;
- private RangeRuleDao rangeRuleDao;
-
- @Override
- public AllocationRequest buildAllocationRequest(
- ServiceData serviceData,
- EquipmentData equipmentData,
- boolean checkOnly,
- boolean change) {
- List<ResourceRule> resourceRuleList = resourceRuleDao.getResourceRules(serviceData.serviceModel,
- serviceData.endPointPosition, equipmentData.equipmentLevel);
- List<RangeRule> 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<AllocationRequest>();
- for (ResourceRule rr : resourceRuleList) {
- AllocationRequest ar1 = buildAllocationRequest(rr, serviceData, equipmentData, checkOnly, change);
- ar.allocationRequestList.add(ar1);
- }
- for (RangeRule rr : rangeRuleList) {
- AllocationRequest ar1 = buildAllocationRequest(rr, serviceData, equipmentData, checkOnly, change);
- ar.allocationRequestList.add(ar1);
- }
- return ar;
- }
-
- private AllocationRequest buildAllocationRequest(
- ResourceRule resourceRule,
- ServiceData serviceData,
- EquipmentData equipmentData,
- boolean checkOnly,
- boolean change) {
- StrUtil.info(log, resourceRule);
-
- LimitAllocationRequest ar = new LimitAllocationRequest();
- ar.resourceSetId = serviceData.resourceSetId;
- ar.resourceUnionId = serviceData.resourceUnionId;
- ar.resourceName = resourceRule.resourceName;
- ar.assetId = equipmentData.equipmentId;
- ar.missingResourceAction = AllocationAction.Succeed_Allocate;
- ar.expiredResourceAction = AllocationAction.Succeed_Allocate;
- ar.replace = true;
- ar.strict = false;
- ar.checkLimit = ExpressionEvaluator.evalLong(
- change ? resourceRule.hardLimitExpression : resourceRule.softLimitExpression, equipmentData.data);
- ar.checkCount = ExpressionEvaluator.evalLong(resourceRule.allocationExpression, serviceData.data);
- ar.allocateCount = checkOnly ? 0 : ar.checkCount;
- return ar;
- }
-
- private AllocationRequest buildAllocationRequest(
- RangeRule rangeRule,
- ServiceData serviceData,
- EquipmentData equipmentData,
- boolean checkOnly,
- boolean change) {
- StrUtil.info(log, rangeRule);
-
- RangeAllocationRequest ar = new RangeAllocationRequest();
- ar.resourceSetId = serviceData.resourceSetId;
- ar.resourceUnionId = serviceData.resourceUnionId;
- ar.resourceName = rangeRule.rangeName;
- ar.assetId = equipmentData.equipmentId;
- ar.missingResourceAction = AllocationAction.Succeed_Allocate;
- ar.expiredResourceAction = AllocationAction.Succeed_Allocate;
- ar.replace = true;
- ar.check = true;
- ar.allocate = !checkOnly;
- ar.checkMin = rangeRule.minValue;
- ar.checkMax = rangeRule.maxValue;
- return ar;
- }
-
- @Override
- public ThresholdStatus getThresholdStatus(
- ServiceData serviceData,
- EquipmentData equipmentData,
- LimitAllocationOutcome limitAllocationOutcome) {
- ResourceRule rr = resourceRuleDao.getResourceRule(serviceData.serviceModel, serviceData.endPointPosition,
- equipmentData.equipmentLevel, limitAllocationOutcome.request.resourceName);
- if (rr == null || rr.thresholdList == null || rr.thresholdList.isEmpty())
- return null;
-
- ThresholdStatus thresholdStatus = null;
- long maxThresholdValue = 0;
- for (ResourceThreshold th : rr.thresholdList) {
- long thresholdValue = ExpressionEvaluator.evalLong(th.expression, equipmentData.data);
-
- if (thresholdValue > maxThresholdValue) {
- maxThresholdValue = thresholdValue;
-
- if (limitAllocationOutcome.used >= thresholdValue) {
- thresholdStatus = new ThresholdStatus();
- thresholdStatus.resourceRule = rr;
- thresholdStatus.resourceThreshold = th;
- thresholdStatus.limitValue = limitAllocationOutcome.limit;
- thresholdStatus.thresholdValue = thresholdValue;
- thresholdStatus.used = limitAllocationOutcome.used;
- thresholdStatus.lastAdded = limitAllocationOutcome.allocatedCount;
- }
- }
- }
-
- return thresholdStatus;
- }
-
- public void setResourceRuleDao(ResourceRuleDao resourceRuleDao) {
- this.resourceRuleDao = resourceRuleDao;
- }
-
- public void setRangeRuleDao(RangeRuleDao rangeRuleDao) {
- this.rangeRuleDao = rangeRuleDao;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java
deleted file mode 100644
index 11fd974..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDao.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-public interface MaxPortSpeedDao {
-
- // Returns max speed in kbps
- long getMaxPortSpeed(String imageFile, String endPointPosition, String interfaceName);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java
deleted file mode 100644
index 7b2cd7f..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxPortSpeedDaoImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-import org.openecomp.sdnc.util.speed.SpeedUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-
-public class MaxPortSpeedDaoImpl implements MaxPortSpeedDao {
-
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(MaxPortSpeedDaoImpl.class);
-
- private final static String GET_SQL =
- "SELECT * FROM MAX_PORT_SPEED WHERE image_file_name = ? AND end_point_position = ? AND interface_name = ?";
-
- private JdbcTemplate jdbcTemplate;
- private long defaultMaxPortSpeed = 5000000;
- private SpeedUtil speedUtil;
-
- @Override
- public long getMaxPortSpeed(String imageFile, String endPointPosition, String interfaceName) {
- List<MaxPortSpeed> maxPortSpeedList =
- jdbcTemplate.query(GET_SQL, new Object[] { imageFile, endPointPosition, interfaceName },
- new RowMapper<MaxPortSpeed>() {
-
- @Override
- public MaxPortSpeed mapRow(ResultSet rs, int rowNum) throws SQLException {
- MaxPortSpeed mps = new MaxPortSpeed();
- mps.maxSpeed = rs.getLong("max_speed");
- mps.unit = rs.getString("unit");
- return mps;
- }
- });
-
- if (maxPortSpeedList.isEmpty())
- return defaultMaxPortSpeed;
-
- MaxPortSpeed mps = maxPortSpeedList.get(0);
- return speedUtil.convertToKbps(mps.maxSpeed, mps.unit);
- }
-
- private static class MaxPortSpeed {
-
- public long maxSpeed;
- public String unit;
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- public void setDefaultMaxPortSpeed(long defaultMaxPortSpeed) {
- this.defaultMaxPortSpeed = defaultMaxPortSpeed;
- }
-
- public void setSpeedUtil(SpeedUtil speedUtil) {
- this.speedUtil = speedUtil;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java
deleted file mode 100644
index 2dad56e..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDao.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-public interface MaxServerSpeedDao {
-
- // Returns max speed in kbps
- long getMaxServerSpeed(String serverModel, int evcCount);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java
deleted file mode 100644
index 4e7d1bc..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/MaxServerSpeedDaoImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-import org.openecomp.sdnc.util.speed.SpeedUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-
-public class MaxServerSpeedDaoImpl implements MaxServerSpeedDao {
-
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(MaxServerSpeedDaoImpl.class);
-
- private final static String GET_SQL =
- "SELECT * FROM MAX_SERVER_SPEED\n" +
- "WHERE (server_model = ? OR server_model = 'ALL') AND evc_count >= ?\n" +
- "ORDER BY evc_count";
-
- private JdbcTemplate jdbcTemplate;
- private long defaultMaxServerSpeed = 1600000;
- private SpeedUtil speedUtil;
-
- @Override
- public long getMaxServerSpeed(String serverModel, int evcCount) {
- List<MaxServerSpeed> maxServerSpeedList =
- jdbcTemplate.query(GET_SQL, new Object[] { serverModel, evcCount }, new RowMapper<MaxServerSpeed>() {
-
- @Override
- public MaxServerSpeed mapRow(ResultSet rs, int rowNum) throws SQLException {
- MaxServerSpeed mps = new MaxServerSpeed();
- mps.maxSpeed = rs.getLong("max_speed");
- mps.unit = rs.getString("unit");
- return mps;
- }
- });
-
- if (maxServerSpeedList.isEmpty())
- return defaultMaxServerSpeed;
-
- MaxServerSpeed mps = maxServerSpeedList.get(0);
- return speedUtil.convertToKbps(mps.maxSpeed, mps.unit);
- }
-
- private static class MaxServerSpeed {
-
- public long maxSpeed;
- public String unit;
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- public void setDefaultMaxServerSpeed(long defaultMaxServerSpeed) {
- this.defaultMaxServerSpeed = defaultMaxServerSpeed;
- }
-
- public void setSpeedUtil(SpeedUtil speedUtil) {
- this.speedUtil = speedUtil;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java
deleted file mode 100644
index 5911c8c..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDao.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-public interface ParameterDao {
-
- String getParameter(String name);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java
deleted file mode 100644
index fc1cfa1..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ParameterDaoImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-public class ParameterDaoImpl implements ParameterDao {
-
- private static final Logger log = LoggerFactory.getLogger(ParameterDaoImpl.class);
-
- private final static String GET_SQL = "SELECT * FROM PARAMETERS WHERE name = ?";
-
- private JdbcTemplate jdbcTemplate;
-
- @Override
- public String getParameter(String name) {
- List<Map<String, Object>> ll = jdbcTemplate.queryForList(GET_SQL, name);
-
- if (ll == null || ll.isEmpty()) {
- log.info("Parameter: " + name + " not found in DB");
- return null;
- }
-
- String v = (String) ll.get(0).get("value");
- log.info("Parameter from DB: " + name + "='" + v + "'");
-
- return v;
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java
deleted file mode 100644
index 29094b6..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDao.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.util.List;
-
-import org.openecomp.sdnc.ra.equip.data.EquipmentLevel;
-import org.openecomp.sdnc.ra.rule.data.RangeRule;
-
-public interface RangeRuleDao {
-
- List<RangeRule> getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java
deleted file mode 100644
index e82494d..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/RangeRuleDaoImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-import org.openecomp.sdnc.ra.equip.data.EquipmentLevel;
-import org.openecomp.sdnc.ra.rule.data.RangeRule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-
-public class RangeRuleDaoImpl implements RangeRuleDao {
-
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(RangeRuleDaoImpl.class);
-
- private static final String GET_SQL =
- "SELECT * FROM RANGE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ?";
-
- private JdbcTemplate jdbcTemplate;
-
- @Override
- public List<RangeRule> getRangeRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel) {
- List<RangeRule> rangeRuleList =
- jdbcTemplate.query(GET_SQL, new Object[] { serviceModel, endPointPosition, equipLevel.toString() },
- new RowMapper<RangeRule>() {
-
- @Override
- public RangeRule mapRow(ResultSet rs, int rowNum) throws SQLException {
- RangeRule rl = new RangeRule();
- rl.id = rs.getLong("range_rule_id");
- rl.rangeName = rs.getString("range_name");
- rl.serviceModel = rs.getString("service_model");
- rl.endPointPosition = rs.getString("end_point_position");
- rl.equipmentLevel = rs.getString("equipment_level");
- rl.minValue = rs.getInt("min_value");
- rl.maxValue = rs.getInt("max_value");
- return rl;
- }
- });
- return rangeRuleList;
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java
deleted file mode 100644
index dd6ee36..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDao.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.util.List;
-
-import org.openecomp.sdnc.ra.equip.data.EquipmentLevel;
-import org.openecomp.sdnc.ra.rule.data.ResourceRule;
-
-public interface ResourceRuleDao {
-
- List<ResourceRule> getResourceRules(String serviceModel, String endPointPosition, EquipmentLevel equipLevel);
-
- ResourceRule getResourceRule(
- String serviceModel,
- String endPointPosition,
- EquipmentLevel equipLevel,
- String resourceName);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java
deleted file mode 100644
index 9b30688..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/ResourceRuleDaoImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-import org.openecomp.sdnc.ra.equip.data.EquipmentLevel;
-import org.openecomp.sdnc.ra.rule.data.ResourceRule;
-import org.openecomp.sdnc.ra.rule.data.ResourceThreshold;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-
-public class ResourceRuleDaoImpl implements ResourceRuleDao {
-
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(ResourceRuleDaoImpl.class);
-
- private static final String GET1_SQL =
- "SELECT * FROM RESOURCE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ?";
- private static final String GET2_SQL =
- "SELECT * FROM RESOURCE_RULE WHERE service_model = ? AND end_point_position = ? AND equipment_level = ? AND resource_name = ?";
- private static final String THRESHOLD_SQL = "SELECT * FROM RESOURCE_THRESHOLD WHERE resource_rule_id = ?";
-
- private JdbcTemplate jdbcTemplate;
- ResourceRuleRowMapper resourceRuleRowMapper = new ResourceRuleRowMapper();
- ResourceThresholdRowMapper resourceThresholdRowMapper = new ResourceThresholdRowMapper();
-
- @Override
- public List<ResourceRule> getResourceRules(
- String serviceModel,
- String endPointPosition,
- EquipmentLevel equipLevel) {
- List<ResourceRule> 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<ResourceRule> 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<ResourceRule> {
-
- @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<ResourceThreshold> {
-
- @Override
- public ResourceThreshold mapRow(ResultSet rs, int rowNum) throws SQLException {
- ResourceThreshold th = new ResourceThreshold();
- th.expression = rs.getString("threshold_expression");
- th.message = rs.getString("threshold_message");
- return th;
- }
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java
deleted file mode 100644
index 2ff38b1..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDao.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-public interface VpeLockDao {
-
- String getVpeLock(String vpeName);
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java
deleted file mode 100644
index 1984235..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/dao/VpeLockDaoImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.dao;
-
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-public class VpeLockDaoImpl implements VpeLockDao {
-
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(VpeLockDaoImpl.class);
-
- private final static String GET_SQL = "SELECT vpn_lock FROM VPE_LOCK WHERE vpe_name = ?";
-
- private JdbcTemplate jdbcTemplate;
-
- @Override
- public String getVpeLock(String vpeName) {
- List<String> ll = jdbcTemplate.queryForList(GET_SQL, String.class, vpeName);
- return ll != null && !ll.isEmpty() ? ll.get(0) : null;
- }
-
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java
deleted file mode 100644
index d16c0ea..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/RangeRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.data;
-
-public class RangeRule {
-
- public long id;
- public String rangeName;
- public String serviceModel;
- public String endPointPosition;
- public String equipmentLevel;
- public int minValue;
- public int maxValue;
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java
deleted file mode 100644
index 88090cc..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceRule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.data;
-
-import java.util.List;
-
-public class ResourceRule {
-
- public long id;
- public String resourceName;
- public String serviceModel;
- public String endPointPosition;
- public String serviceExpression;
- public String equipmentLevel;
- public String equipmentExpression;
- public String allocationExpression;
- public String softLimitExpression;
- public String hardLimitExpression;
- public List<ResourceThreshold> thresholdList;
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java
deleted file mode 100644
index b4d6a5a..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ResourceThreshold.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.data;
-
-public class ResourceThreshold {
-
- public String expression;
- public String message;
-}
diff --git a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java b/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java
deleted file mode 100644
index bb4ff38..0000000
--- a/resource-assignment/provider/src/main/java/org/openecomp/sdnc/ra/rule/data/ThresholdStatus.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdnc.ra.rule.data;
-
-public class ThresholdStatus {
-
- public ResourceRule resourceRule;
- public ResourceThreshold resourceThreshold;
- public long limitValue;
- public long thresholdValue;
- public long used;
- public long lastAdded;
-}