summaryrefslogtreecommitdiffstats
path: root/adapters/mso-sdnc-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-sdnc-adapter')
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java3
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/resources/application.yaml18
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java54
-rw-r--r--adapters/mso-sdnc-adapter/src/test/resources/application-test.properties4
11 files changed, 88 insertions, 47 deletions
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index cd7bf6d903..8e94db1aa0 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -93,21 +93,9 @@
<version>1.5.16</version>
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@@ -151,13 +139,11 @@
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-spring-legacy</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-registry-prometheus</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
index f88aab08a6..2fd0a58dda 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
@@ -29,12 +29,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication(scanBasePackages = { "org.onap" })
-@EnableJpaRepositories({"org.onap.so.db.request.data.repository"})
-@EntityScan({ "org.onap.so.db.request.beans"})
public class SDNCAdapterApplication {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
index d114788267..09597b26b7 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
@@ -28,13 +28,8 @@ public interface Constants {
public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1";
public static final String MY_URL_PROP = "org.onap.so.adapters.sdnc.myurl";
- public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify";
-
public static final String SDNC_AUTH_PROP = "org.onap.so.adapters.sdnc.sdncauth";
- public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC";
-
- public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB";
- public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth";
+ public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth";
public static final String SDNC_SVCCFGRESP_ROOT = "input";
@@ -42,7 +37,7 @@ public interface Constants {
public static final String SDNC_RESP_CODE = "/response-code";
public static final String SDNC_RESP_MSG = "/response-message";
public static final String SDNC_CONNECTTIME_PROP = "org.onap.so.adapters.sdnc.sdncconnecttime";
- public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+ public static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
public static final String REQUEST_TUNABLES = "org.onap.so.adapters.sdnc";
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 71937245bc..fd924cad79 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -143,7 +143,7 @@ public class SDNCRestClient{
con.setConnectTimeout(Integer.parseInt(env.getProperty(Constants.SDNC_CONNECTTIME_PROP)));
con.setReadTimeout(Integer.parseInt(rt.getTimeout()));
con.setRequestProperty("Accept", "application/yang.data+xml"); //for response in xml
- String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP), Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP), env.getProperty(Constants.ENCRYPTION_KEY_PROP));
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
con.setRequestProperty ("Authorization", basicAuth);
@@ -308,7 +308,7 @@ public class SDNCRestClient{
{
Map<String, Object> reqCtx = bp.getRequestContext();
Map<String, List<String>> headers = new HashMap<>();
- String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP), Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.BPEL_AUTH_PROP), env.getProperty(Constants.ENCRYPTION_KEY_PROP));
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index d5ce96ea5a..9c4dd5e8a0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -119,8 +119,8 @@ public class BPRestCallback {
boolean error = false;
try {
- String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP),
- Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.BPEL_AUTH_PROP),
+ env.getProperty(Constants.ENCRYPTION_KEY_PROP));
String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
method.setHeader("Authorization", authorization);
} catch (Exception e) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
index 05e272f867..dcb1fdae8c 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
@@ -64,12 +64,7 @@ public final class SDNCAdapterUtils {
* @param pathSegment the path segment to encode
* @return the encoded path segment
*/
- public static String encodeURLPathSegment(String pathSegment) {
- try {
+ public static String encodeURLPathSegment(String pathSegment) {
return UriUtils.encodePathSegment(pathSegment, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- LOGGER.debug("Exception:", e);
- throw new RuntimeException("UTF-8 encoding is not supported");
- }
}
} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 6e4fbd830e..1c5025a59d 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -114,8 +114,8 @@ public abstract class SDNCConnector {
}
- String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP),
- Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP),
+ env.getProperty(Constants.ENCRYPTION_KEY_PROP));
String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
if(null != method) {
method.setHeader("Authorization", authorization);
diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml
index 44f295e425..4141548c29 100644
--- a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml
+++ b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml
@@ -17,7 +17,7 @@ org:
onap:
so:
adapters:
- sdnc:
+ sdnc:
'.':
put: PUT|60000|sdncurl5|
query: GET|60000|sdncurl2|
@@ -57,7 +57,7 @@ org:
changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- bpelauth: 9997930a04f74e8dfd3acedf6be6f8c2ec4fb3720521304f64a468ba54ef1e14
+ bpelauth: BBD450258299BD2FEF7E3EBA3CD2B58AD417355332319856D761654AA876830A9839820D33DE8426A81E5D48649A4BE6FE7021F5
bpelurl: http://localhost:8080/mso/SDNCAdapterCallbackService
generic-resource:
network-topology-operation:
@@ -92,7 +92,7 @@ org:
myurl: http://localhost:8080/adapters/rest/SDNCNotify
rest:
bpelurl: http://localhost:8080/mso/WorkflowMessage
- sdncauth: 406B2AE613211B6FB52466DE6E1769AC
+ sdncauth: 1C2DC9B30545C5F673B3C33904608E942476F0C969B3CF7A2509459AB83C9062EFAAE89E91D6DB
sdncconnecttime: 5000
sdncurl10: 'https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:'
sdncurl12: https://localhost:8443/
@@ -101,6 +101,8 @@ org:
vfmodule:
'':
query: GET|60000|sdncurl12|
+ network:
+ encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
spring:
security:
usercredentials:
diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
index 185bc5cbd1..6009eff016 100644
--- a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
@@ -12,11 +12,23 @@ mso:
queue-capacity: 500
#Actuator
-management:
- context-path: /manage
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ context-path: /manage
metrics:
se-global-registry: false
export:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file
+ step: 1m # Step size (i.e. reporting frequency) to use.
+
+org:
+ onap:
+ so:
+ adapters:
+ network:
+ encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
new file mode 100644
index 0000000000..849374838a
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.sdnc.BaseTest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class BPRestCallbackTest extends BaseTest {
+
+ @Autowired
+ private BPRestCallback bpRestCallback;
+
+ @Test
+ public void sendTest(){
+ String response = "<errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n" +
+ "\t\t// <error>\n" +
+ "\t\t// <error-type>protocol</error-type>\n" +
+ "\t\t// <error-tag>malformed-message</error-tag>\n" +
+ "\t\t// <error-message>Error parsing input: The element type \"input\" must be terminated by the matching end-tag \"&lt;/input&gt;\".</error-message>\n" +
+ "\t\t// </error>\n" +
+ "\t\t// </errors>";
+
+ stubFor(post(urlPathEqualTo("/sdnc"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES)));
+
+ boolean responseCommon = bpRestCallback.send("http://localhost:" + wireMockPort + "/sdnc", "Test");
+ assertNotNull(responseCommon);
+ assertEquals(true,responseCommon);
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties b/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties
index 1ae9269ffa..e4f6903e23 100644
--- a/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties
+++ b/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties
@@ -17,8 +17,8 @@ org.onap.so.adapters.sdnc.rest.bpelurl=http://localhost:${wiremock.server.port}/
###
org.onap.so.adapters.sdnc.myurl=http://localhost:8080/adapters/rest/SDNCNotify
### Production value diff from other servers
-org.onap.so.adapters.sdnc.sdncauth=406B2AE613211B6FB52466DE6E1769AC
-org.onap.so.adapters.sdnc.bpelauth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D
+org.onap.so.adapters.sdnc.sdncauth=3233884EE2EA1365FB368B9B66C4C4A3C3249DA157ABF3870287EE375418B135
+org.onap.so.adapters.sdnc.bpelauth=2784520F82031D042BDD7E25A49CDB372E6A43A349C5FA26FBCB1AC1EF329C9AC055993E1CB29CDC370FD395A4696D86
org.onap.so.adapters.sdnc.sdncconnecttime=5000
###
### Distinct Requests Supported by SDNCA. sdncurls added on top of file. fields may be null eg msoaction,operation resulting in .. construct