summaryrefslogtreecommitdiffstats
path: root/vnfm-simulator/vnfm-service
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2019-07-22 14:28:09 +0000
committerMichaelMorris <michael.morris@est.tech>2019-07-22 14:28:09 +0000
commitc6c0077ac3db6190d1f364360de5af17e9fcd08b (patch)
tree6c1a095523beb5f2de336bf419af48723c142f9d /vnfm-simulator/vnfm-service
parentbbdb1c45a93194db2712d8c146e263a03737f25c (diff)
Implement TLS for calls into VNFM adapter
Issue-ID: SO-2143 Change-Id: I2fcacab7aebc9a22b952d881b0bf2404e1638b37 Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'vnfm-simulator/vnfm-service')
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java19
-rw-r--r--vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem30
2 files changed, 49 insertions, 0 deletions
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
index 218cc2de03..83f079c376 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
@@ -1,5 +1,7 @@
package org.onap.svnfm.simulator.services;
+import java.io.IOException;
+import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -34,10 +36,13 @@ import org.onap.svnfm.simulator.model.Vnfds;
import org.onap.svnfm.simulator.repository.VnfOperationRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
public abstract class OperationProgressor implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class);
+ private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem";
+
protected final VnfOperation operation;
protected final SvnfmService svnfmService;
private final VnfOperationRepository vnfOperationRepository;
@@ -61,14 +66,25 @@ public abstract class OperationProgressor implements Runnable {
String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri();
callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/"));
apiClient.setBasePath(callBackUrl);
+ apiClient.setSslCaCert(getCertificateToTrust());
notificationClient = new DefaultApi(apiClient);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient();
grantApiClient.setBasePath(callBackUrl);
+ grantApiClient.setSslCaCert(getCertificateToTrust());
grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient);
}
+ private InputStream getCertificateToTrust() {
+ try {
+ return new ClassPathResource(CERTIFICATE_TO_TRUST).getInputStream();
+ } catch (final IOException exception) {
+ LOGGER.error("Error reading certificate to trust, https calls to VNFM adapter will fail", exception);
+ return null;
+ }
+ }
+
@Override
public void run() {
try {
@@ -176,6 +192,9 @@ public abstract class OperationProgressor implements Runnable {
MediaType.APPLICATION_JSON, authHeader);
} catch (final ApiException exception) {
LOGGER.error("Error sending notification: " + notification, exception);
+ LOGGER.error("Response code: {}, body: {}, basePath: {}", exception.getCode(), exception.getResponseBody(),
+ notificationClient.getApiClient().getBasePath());
+
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem
new file mode 100644
index 0000000000..3c899e3bf5
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem
@@ -0,0 +1,30 @@
+Bag Attributes
+ friendlyName: so@so.onap.org
+ localKeyID: 54 69 6D 65 20 31 35 36 33 34 36 33 36 32 39 35 38 33
+subject=/CN=so-vnfm-adapter/emailAddress=/OU=so@so.onap.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