aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-nssmf-adapter
diff options
context:
space:
mode:
authorhetengjiao <hetengjiao@chinamobile.com>2020-11-04 11:07:30 +0800
committerHE TENGJIAO <hetengjiao@chinamobile.com>2020-11-04 06:45:50 +0000
commit86348f496d1a2f0d6884f8f11dbb637f5b339291 (patch)
tree5f49f2e4db7ab752fea841fa3048eb64ba0b2872 /adapters/mso-nssmf-adapter
parentca38d83d2e3eb976ef66d2c222e5a0c22617dc54 (diff)
fixed nssmf adapter ssl problem and some bugs of nsmf workflow
Issue-ID: SO-2963 Signed-off-by: hetengjiao <hetengjiao@chinamobile.com> Change-Id: I018ca93da483231db1a20aac0e6146b1e2314ed3
Diffstat (limited to 'adapters/mso-nssmf-adapter')
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java10
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java1
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java9
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application.yaml2
5 files changed, 15 insertions, 9 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index c4f269c3a0..789f4f239d 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -210,10 +210,12 @@ public abstract class BaseNssmfManager implements NssmfManager {
private void urlHandler() {
NssmfUrlInfo nssmfUrlInfo =
NssmfAdapterConsts.getNssmfUrlInfo(this.executorType, this.esrInfo.getNetworkType(), actionType);
- this.nssmfUrl = nssmfUrlInfo.getUrl();
- this.httpMethod = nssmfUrlInfo.getHttpMethod();
- this.nssmfUrl = nssmfUrl.replaceAll("\\{apiVersion}", getApiVersion());
- this.params.forEach((k, v) -> this.nssmfUrl = this.nssmfUrl.replaceAll("\\{" + k + "}", v));
+ if (nssmfUrlInfo != null) {
+ this.nssmfUrl = nssmfUrlInfo.getUrl();
+ this.httpMethod = nssmfUrlInfo.getHttpMethod();
+ this.nssmfUrl = nssmfUrl.replaceAll("\\{apiVersion}", getApiVersion());
+ this.params.forEach((k, v) -> this.nssmfUrl = this.nssmfUrl.replaceAll("\\{" + k + "}", v));
+ }
}
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index bb2b83fd59..72d1b53781 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -95,6 +95,7 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
return marshal(actDeActNssi);
}
+ @Override
protected RestResponse doQueryJobStatus(ResourceOperationStatus status) throws ApplicationException {
return doResponseStatus(status);
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
index 4705e871f3..88b5071371 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
@@ -98,7 +98,7 @@ public abstract class InternalNssmfManager extends BaseNssmfManager {
// internal
private RestResponse sendInternalRequest(String content) {
- Header header = new BasicHeader("X-Auth-Token", adapterConfig.getInfraAuth());
+ Header header = new BasicHeader("Authorization", adapterConfig.getInfraAuth());
this.nssmfUrl = adapterConfig.getInfraEndpoint() + this.nssmfUrl;
return restUtil.send(this.nssmfUrl, this.httpMethod, content, header);
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
index a7adbe116a..7a86c5ba2b 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/RestUtil.java
@@ -270,6 +270,7 @@ public class RestUtil {
class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
public static final String METHOD_NAME = "DELETE";
+ @Override
public String getMethod() {
return METHOD_NAME;
}
@@ -316,12 +317,15 @@ public class RestUtil {
public HttpClient getHttpsClient() {
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
+ @Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
+ @Override
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
+ @Override
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
}};
@@ -329,10 +333,9 @@ public class RestUtil {
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
- // HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- SSLConnectionSocketFactory sslsf =
- new SSLConnectionSocketFactory(sc, new String[] {"TLSv1"}, null, (s, sslSession) -> true);
+ SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sc,
+ new String[] {"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"}, null, (s, sslSession) -> true);
return HttpClients.custom().setSSLSocketFactory(sslsf).build();
} catch (Exception e) {
throw new IllegalArgumentException(e);
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
index 8da911d4e0..5501fba88f 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
@@ -59,7 +59,7 @@ mso:
endpoint: https://so-request-db-adapter.{{ include "common.namespace" . }}:8083
auth: Basic YnBlbDpwYXNzd29yZDEk
infra:
- endpoint: https://so.{{ include "common.namespace" . }}:8080
+ endpoint: http://so.onap:8080
auth: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==
#Actuator