summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java23
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java3
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java12
-rwxr-xr-xaai-service/provider/src/test/resources/aaiclient.properties9
-rw-r--r--docs/index.rst8
-rwxr-xr-xmdsal-resource/provider/pom.xml2
-rw-r--r--mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java43
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java12
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java28
-rw-r--r--resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-context.xml296
-rwxr-xr-x[-rw-r--r--]resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml (renamed from resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml)26
-rwxr-xr-xresource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment.xml126
-rw-r--r--sql-resource/features/src/main/resources/features.xml2
-rw-r--r--sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java101
14 files changed, 269 insertions, 422 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index 04a0c593a..f1663d2d5 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -281,7 +281,7 @@ public abstract class AAIDeclarations implements AAIClient {
} catch (AAIServiceException aaiexc) {
ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
if (aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ ctx.setAttribute(prefix + ".error.http" + "" + ".response-code", Integer.toString(aaiexc.getReturnCode()));
}
if (aaiexc.getReturnCode() == 404)
@@ -303,7 +303,7 @@ public abstract class AAIDeclarations implements AAIClient {
} catch (AAIServiceException aaiexc) {
ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
if (aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode()));
}
if (aaiexc.getReturnCode() == 404)
@@ -521,7 +521,7 @@ public abstract class AAIDeclarations implements AAIClient {
if(exc instanceof AAIServiceException) {
AAIServiceException aaiexc = (AAIServiceException)exc;
if(aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode()));
}
if(aaiexc.getReturnCode() == 404) {
@@ -710,22 +710,19 @@ public abstract class AAIDeclarations implements AAIClient {
return QueryStatus.FAILURE;
}
} else {
- String resoourceName = resource;
+ String resourceName = resource;
String identifier = null;
- if(resoourceName == null)
- return QueryStatus.FAILURE;
-
- if(resoourceName.contains(":")) {
- String[] tokens = resoourceName.split(":");
+ if(resourceName.contains(":")) {
+ String[] tokens = resourceName.split(":");
if(tokens != null && tokens.length > 0) {
- resoourceName = tokens[0];
+ resourceName = tokens[0];
identifier = tokens[1];
}
}
if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) {
// RelationshipRequest relationshipRequest = new RelationshipRequest();
- if("generic-vnf".equals(resoourceName)){
+ if("generic-vnf".equals(resourceName)){
String vnfId = nameValues.get("vnf_id");
String relatedTo = nameValues.get("related_to");
vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
@@ -1583,8 +1580,8 @@ public abstract class AAIDeclarations implements AAIClient {
j++;
}
AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
- for(String key : relParams.keySet()) {
- rlRequest.addRequestProperty(key, relParams.get(key));
+ for(Map.Entry<String,String> entry : relParams.entrySet()) {
+ rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
}
String path = rlRequest.updatePathDataValues(null);
relationship.setRelatedLink(path);
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
index 840062e76..d3d57eaa9 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
@@ -290,12 +290,11 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ctx = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = null;
- try {
+ try (FileInputStream fin = new FileInputStream(keystore_path)){
String def = "SunX509";
String storeType = "PKCS12";
def = KeyStore.getDefaultType();
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- FileInputStream fin = new FileInputStream(keystore_path);
String extension = keystore_path.substring(keystore_path.lastIndexOf(".") + 1);
if("JKS".equalsIgnoreCase(extension)) {
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
index b0345157c..e0f201230 100644..100755
--- 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/docs/index.rst b/docs/index.rst
new file mode 100644
index 000000000..833e1aa96
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,8 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+TODO Add files to toctree and delete this header
+------------------------------------------------
+.. toctree::
+ :maxdepth: 1
+
+
diff --git a/mdsal-resource/provider/pom.xml b/mdsal-resource/provider/pom.xml
index ee0a3dc14..28eab6823 100755
--- a/mdsal-resource/provider/pom.xml
+++ b/mdsal-resource/provider/pom.xml
@@ -18,7 +18,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java
new file mode 100644
index 000000000..f5b0bcf0c
--- /dev/null
+++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.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.resource.mdsal;
+
+import org.junit.Test;
+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 static org.junit.Assert.assertEquals;
+
+public class ConfigResourceTest {
+ ConfigResource configResource = new ConfigResource("http", "local",
+ "10001", "admin",
+ "password");
+
+ @Test
+ public void isAvailableNegativeTest() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ assertEquals(QueryStatus.NOT_FOUND, configResource.isAvailable
+ ("xyz", "key", "prefix", ctx));
+ }
+}
+
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;
}
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..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
@@ -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;
}
@@ -329,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<String>(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<String>(StrUtil.listStr(aiEntity.resourceShareGroupList));
+ ai.applicationId = aiEntity.applicationId;
+ ai.allocationTime = aiEntity.allocationTime;
+ }
return ai;
}
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 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ============LICENSE_START=======================================================
- openECOMP : SDN-C
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights
- reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <!-- JDBC setup -->
-
- <bean id="rm.dataSource" class="org.onap.ccsdk.sli.adaptors.util.db.DataSourceWrap">
- <property name="dataSource" ref="dblib.dataSource" />
- </bean>
-
- <bean id="lock.dataSource" class="org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap">
- <property name="dataSource" ref="rm.dataSource" />
- </bean>
-
- <bean id="rm.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="rm.dataSource" />
- </bean>
-
- <bean id="lock.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="lock.dataSource" />
- </bean>
-
- <!-- Utils Configuration -->
-
- <bean id="speedUtil" class="org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil">
- <property name="unitFactor" value="1000" />
- </bean>
-
- <!-- Resource Lock Configuration -->
-
- <bean id="resourceLockDao" class="org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl">
- <property name="jdbcTemplate" ref="lock.jdbcTemplate" />
- </bean>
-
- <bean id="lockHelper" class="org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl">
- <property name="resourceLockDao" ref="resourceLockDao" />
- <property name="retryCount" value="10" />
- <property name="lockWait" value="5" /> <!-- Seconds -->
- </bean>
-
- <!-- RM Configuration -->
-
- <bean id="resourceJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="allocationItemJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="resourceLoadJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="resourceDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl">
- <property name="resourceJdbcDao" ref="resourceJdbcDao" />
- <property name="allocationItemJdbcDao" ref="allocationItemJdbcDao" />
- <property name="resourceLoadJdbcDao" ref="resourceLoadJdbcDao" />
- </bean>
-
- <bean id="resourceManager" class="org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl">
- <property name="lockHelper" ref="lockHelper" />
- <property name="resourceDao" ref="resourceDao" />
- <property name="applicationId" value="SDNC" />
- <property name="lockTimeout" value="600" /> <!-- Seconds -->
- </bean>
-
- <!-- Equipment DAO Configuration -->
-
- <bean id="serverDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.ServerDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="vpePortDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="vplspePortDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.VplspePortDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <!-- Rule DAO Configuration -->
-
- <bean id="parameterDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ParameterDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="maxPortSpeedDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxPortSpeedDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- <property name="speedUtil" ref="speedUtil" />
- </bean>
-
- <bean id="maxServerSpeedDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxServerSpeedDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- <property name="speedUtil" ref="speedUtil" />
- </bean>
-
- <bean id="resourceRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="rangeRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <bean id="vpeLockDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.VpeLockDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <!-- Service DAO Configuration -->
-
- <bean id="serviceResourceDao" class="org.onap.ccsdk.sli.adaptors.ra.service.dao.ServiceResourceDaoImpl">
- <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
- </bean>
-
- <!-- ResourceAllocator Configuration -->
-
- <bean id="allocationRequestBuilder"
- class="org.onap.ccsdk.sli.adaptors.ra.rule.comp.AllocationRequestBuilderImpl">
- <property name="resourceRuleDao" ref="resourceRuleDao" />
- <property name="rangeRuleDao" ref="rangeRuleDao" />
- </bean>
-
- <bean id="resourceAllocator" class="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator">
- <property name="speedUtil" ref="speedUtil" />
- <property name="parameterDao" ref="parameterDao" />
- <property name="serverDao" ref="serverDao" />
- <property name="vpePortDao" ref="vpePortDao" />
- <property name="vplspePortDao" ref="vplspePortDao" />
- <property name="maxPortSpeedDao" ref="maxPortSpeedDao" />
- <property name="maxServerSpeedDao" ref="maxServerSpeedDao" />
- <property name="serviceResourceDao" ref="serviceResourceDao" />
- <property name="allocationRequestBuilder" ref="allocationRequestBuilder" />
- <property name="resourceManager" ref="resourceManager" />
- <property name="endPointAllocator" ref="endPointAllocator" />
- </bean>
-
- <!-- EndPointAllocator Configuration -->
-
- <bean id="endPointAllocator" class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl">
- <property name="resourceManager" ref="resourceManager" />
- <property name="endPointAllocationDefinitionMap">
- <map>
- <entry key="L3AVPN-PORT">
- <list>
- <bean class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocationDefinition">
- <property name="serviceModel" value="L3AVPN-PORT" />
- <property name="endPointPosition" value="VPE-Cust" />
- <property name="equipmentReader" ref="vpePortReader" />
- <property name="equipmentCheckList">
- <list>
- <ref bean="provStatusCheck" />
- <ref bean="excludeVpeCheck" />
- <ref bean="anyVrfPresentCheck" />
- </list>
- </property>
- <property name="preferenceRuleList">
- <list>
- <ref bean="affinityLinkPref" />
- </list>
- </property>
- <property name="allocationRuleList">
- <list>
- <ref bean="dbAllocationRule" />
- <ref bean="affinityAllocationRule" />
- </list>
- </property>
- </bean>
- </list>
- </entry>
- <entry key="L3AVPN-EVC">
- <list>
- <bean class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocationDefinition">
- <property name="serviceModel" value="L3AVPN-EVC" />
- <property name="endPointPosition" value="VPE-Cust" />
- <property name="equipmentReader" ref="vpePortReader" />
- <property name="equipmentCheckList">
- <list>
- <ref bean="vlanSpeedCheck" />
- <ref bean="provStatusCheck" />
- <ref bean="excludeVpeCheck" />
- <ref bean="vpeLockCheck" />
- <ref bean="anyVrfPresentCheck" />
- <ref bean="oneMVrfCheck" />
- <ref bean="hubWithRgCheck" />
- </list>
- </property>
- <property name="preferenceRuleList">
- <list>
- <ref bean="affinityLinkPref" />
- </list>
- </property>
- <property name="allocationRuleList">
- <list>
- <ref bean="dbAllocationRule" />
- <ref bean="vrfAllocationRule" />
- <ref bean="servingSiteAllocationRule" />
- <ref bean="affinityAllocationRule" />
- </list>
- </property>
- </bean>
- </list>
- </entry>
- </map>
- </property>
- </bean>
-
- <!-- Equipment Readers Configuration -->
-
- <bean id="vpePortReader" class="org.onap.ccsdk.sli.adaptors.ra.reader.VpePortReader">
- <property name="vpePortDao" ref="vpePortDao" />
- </bean>
-
- <bean id="vnfReader" class="org.onap.ccsdk.sli.adaptors.ra.reader.VnfReader">
- </bean>
-
- <bean id="aicSiteReader" class="org.onap.ccsdk.sli.adaptors.ra.reader.AicSiteReader">
- </bean>
-
- <bean id="uplinkCircuitReader" class="org.onap.ccsdk.sli.adaptors.ra.reader.UplinkCircuitReader">
- </bean>
-
- <!-- Equipment Checks Configuration -->
-
- <bean id="vlanSpeedCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.VlanSpeedCheck">
- </bean>
-
- <bean id="provStatusCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.ProvStatusCheck">
- </bean>
-
- <bean id="excludeVpeCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.ExcludeVpeCheck">
- </bean>
-
- <bean id="vpeLockCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.VpeLockCheck">
- <property name="vpeLockDao" ref="vpeLockDao" />
- <property name="resourceManager" ref="resourceManager" />
- </bean>
-
- <bean id="anyVrfPresentCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.AnyVrfPresentCheck">
- <property name="resourceManager" ref="resourceManager" />
- </bean>
-
- <bean id="oneMVrfCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.OneMVrfCheck">
- <property name="resourceManager" ref="resourceManager" />
- </bean>
-
- <bean id="hubWithRgCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.HubWithRgCheck">
- <property name="resourceManager" ref="resourceManager" />
- </bean>
-
- <!-- Preference Rule Configuration -->
-
- <bean id="affinityLinkPref" class="org.onap.ccsdk.sli.adaptors.ra.pref.AffinityLinkPref">
- <property name="resourceManager" ref="resourceManager" />
- </bean>
-
- <!-- Resource Allocation Rule Configuration -->
-
- <bean id="dbAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule">
- <property name="resourceRuleDao" ref="resourceRuleDao" />
- <property name="rangeRuleDao" ref="rangeRuleDao" />
- </bean>
-
- <bean id="vrfAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.VrfAllocationRule">
- </bean>
-
- <bean id="servingSiteAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.ServingSiteAllocationRule">
- </bean>
-
- <bean id="affinityAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.AffinityAllocationRule">
- </bean>
-
-</beans>
diff --git a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml
index be22d8766..162ce736c 100644..100755
--- a/resource-assignment/provider/src/main/resources/META-INF/spring/resource-assignment-osgi-context.xml
+++ b/resource-assignment/provider/src/main/resources/org/opendaylight/blueprint/resource-assignment-blueprint.xml
@@ -4,14 +4,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.
@@ -20,20 +20,10 @@
============LICENSE_END=========================================================
-->
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <reference id="dblib.dataSource">
- <interfaces>
- <beans:value>javax.sql.DataSource</beans:value>
- <beans:value>org.onap.ccsdk.sli.core.dblib.DbLibService</beans:value>
- </interfaces>
- </reference>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
- <service ref="resourceAllocator" interface="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator" />
+ <reference id="dblib.dataSource" interface="javax.sql.DataSource" filter="(objectClass=org.openecomp.sdnc.sli.resource.dblib.DbLibService)"/>
-</beans:beans>
+</blueprint>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <!-- JDBC setup -->
+
+ <bean id="rm.dataSource" class="org.openecomp.sdnc.util.db.DataSourceWrap">
+ <property name="dataSource" ref="dblib.dataSource" />
+ </bean>
+
+ <bean id="lock.dataSource" class="org.openecomp.sdnc.util.db.CachedDataSourceWrap">
+ <property name="dataSource" ref="rm.dataSource" />
+ </bean>
+
+ <bean id="rm.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="rm.dataSource" />
+ </bean>
+
+ <bean id="lock.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="lock.dataSource" />
+ </bean>
+
+ <!-- Resource Lock Configuration -->
+
+ <bean id="resourceLockDao" class="org.openecomp.sdnc.lock.dao.ResourceLockDaoImpl">
+ <property name="jdbcTemplate" ref="lock.jdbcTemplate" />
+ </bean>
+
+ <bean id="lockHelper" class="org.openecomp.sdnc.lock.comp.LockHelperImpl">
+ <property name="resourceLockDao" ref="resourceLockDao" />
+ <property name="retryCount" value="10" />
+ <property name="lockWait" value="5" /> <!-- Seconds -->
+ </bean>
+
+ <!-- RM Configuration -->
+
+ <bean id="resourceJdbcDao" class="org.openecomp.sdnc.rm.dao.jdbc.ResourceJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="allocationItemJdbcDao" class="org.openecomp.sdnc.rm.dao.jdbc.AllocationItemJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="resourceLoadJdbcDao" class="org.openecomp.sdnc.rm.dao.jdbc.ResourceLoadJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="resourceDao" class="org.openecomp.sdnc.rm.dao.jdbc.ResourceDaoImpl">
+ <property name="resourceJdbcDao" ref="resourceJdbcDao" />
+ <property name="allocationItemJdbcDao" ref="allocationItemJdbcDao" />
+ <property name="resourceLoadJdbcDao" ref="resourceLoadJdbcDao" />
+ </bean>
+
+ <bean id="resourceManager" class="org.openecomp.sdnc.rm.comp.ResourceManagerImpl">
+ <property name="lockHelper" ref="lockHelper" />
+ <property name="resourceDao" ref="resourceDao" />
+ <property name="applicationId" value="SDNC" />
+ <property name="lockTimeout" value="600" /> <!-- Seconds -->
+ </bean>
+
+ <!-- Rule DAO Configuration -->
+
+ <bean id="resourceRuleDao" class="org.openecomp.sdnc.ra.rule.dao.ResourceRuleDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="rangeRuleDao" class="org.openecomp.sdnc.ra.rule.dao.RangeRuleDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <!-- ResourceAllocator Configuration -->
+
+ <bean id="resourceAllocator" class="org.openecomp.sdnc.ra.ResourceAllocator">
+ <property name="resourceManager" ref="resourceManager" />
+ <property name="endPointAllocator" ref="endPointAllocator" />
+ <property name="speedUtil" ref="speedUtil" />
+ </bean>
+
+ <bean id="speedUtil" class="org.openecomp.sdnc.util.speed.SpeedUtil" />
+
+ <!-- EndPointAllocator Configuration -->
+
+ <bean id="endPointAllocator" class="org.openecomp.sdnc.ra.comp.EndPointAllocatorImpl">
+ <property name="resourceManager" ref="resourceManager" />
+ <property name="allocationRuleMap">
+ <map>
+ <entry key="DEFAULT">
+ <list>
+ <ref component-id="dbAllocationRule" />
+ </list>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- Resource Allocation Rule Configuration -->
+
+ <bean id="dbAllocationRule" class="org.openecomp.sdnc.ra.alloc.DbAllocationRule">
+ <property name="resourceRuleDao" ref="resourceRuleDao" />
+ <property name="rangeRuleDao" ref="rangeRuleDao" />
+ </bean>
+
+</blueprint>
diff --git a/sql-resource/features/src/main/resources/features.xml b/sql-resource/features/src/main/resources/features.xml
index 320c1902b..5cf1d9c50 100644
--- a/sql-resource/features/src/main/resources/features.xml
+++ b/sql-resource/features/src/main/resources/features.xml
@@ -31,7 +31,7 @@
<feature name='sdnc-sql-resource' description="sdnc-sql-resource" version='${project.version}'>
<!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
<feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
- <feature version="${sdnctl.sli.version}">sdnc-sli</feature>
+ <feature>sdnc-sli</feature>
<feature version="${sdnctl.dblib.version}">sdnc-dblib</feature>
<bundle>mvn:org.onap.ccsdk.sli.adaptors/sql-resource-provider/${project.version}</bundle>
</feature>
diff --git a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
index 78d92d09b..df3d8132d 100644
--- a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
+++ b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
@@ -382,72 +382,41 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
return (executeSqlWrite(key, ctx));
}
- private String decryptColumn(String tableName, String colName, byte[] colValue, DbLibService dblibSvc) {
- String strValue = new String(colValue);
-
- if (StringUtils.isAsciiPrintable(strValue)) {
-
- // If printable, not encrypted
- return (strValue);
- } else {
- PreparedStatement stmt = null;
- Connection conn = null;
- ResultSet results = null;
- try {
- // CachedRowSet results =
- // dblibSvc.getData("SELECT
- // CAST(AES_DECRYPT('"+strValue+"','"+CRYPT_KEY+"') AS CHAR(50))
- // FROM DUAL",
- // null, null);
- conn = ((DBResourceManager) dblibSvc).getConnection();
-
- stmt = conn.prepareStatement("SELECT CAST(AES_DECRYPT(?, ?) AS CHAR(50)) FROM DUAL");
-
- stmt.setBytes(1, colValue);
- stmt.setString(2, getCryptKey());
-
- results = stmt.executeQuery();
-
- if ((results != null) && results.next()) {
- strValue = results.getString(1);
- LOG.debug("Decrypted value is " + strValue);
- } else {
- LOG.warn("Cannot decrypt " + tableName + "." + colName);
- }
- } catch (Exception e) {
- LOG.error("Caught exception trying to decrypt " + tableName + "." + colName, e);
- } finally {
- try {
- if (results != null) {
- results.close();
- results = null;
- }
- } catch (Exception exc) {
-
- }
-
- try {
- if (stmt != null) {
- stmt.close();
- stmt = null;
- }
- } catch (Exception exc) {
-
- }
-
- try {
- if (conn != null) {
- conn.close();
- conn = null;
- }
- } catch (Exception exc) {
-
- }
-
- }
- }
- return (strValue);
- }
+ private String decryptColumn(String tableName, String colName, byte[] colValue, DbLibService dblibSvc) {
+ String strValue = new String(colValue);
+
+ if (StringUtils.isAsciiPrintable(strValue)) {
+
+ // If printable, not encrypted
+ return (strValue);
+ } else {
+ ResultSet results = null;
+ try (Connection conn = ((DBResourceManager) dblibSvc).getConnection();
+ PreparedStatement stmt = conn.prepareStatement("SELECT CAST(AES_DECRYPT(?, ?) AS CHAR(50)) FROM DUAL")) {
+
+ stmt.setBytes(1, colValue);
+ stmt.setString(2, getCryptKey());
+ results = stmt.executeQuery();
+
+ if ((results != null) && results.next()) {
+ strValue = results.getString(1);
+ LOG.debug("Decrypted value is " + strValue);
+ } else {
+ LOG.warn("Cannot decrypt " + tableName + "." + colName);
+ }
+ } catch (Exception e) {
+ if (results != null) {
+ try {
+ results.close();
+ } catch (SQLException ignored) {
+
+ }
+ }
+ LOG.error("Caught exception trying to decrypt " + tableName + "." + colName, e);
+ }
+ }
+ return (strValue);
+ }
public static String getCryptKey() {
return (CRYPT_KEY);