aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java9
6 files changed, 84 insertions, 30 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java
new file mode 100644
index 0000000000..033c6876bd
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.mso.bpmn.common.recipe;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class BpmnIntegerParam {
+
+ @JsonProperty("value")
+ private int value;
+ @JsonProperty("type")
+ private final String type = "Integer";
+
+ public BpmnIntegerParam() {
+ }
+
+ @JsonProperty("value")
+ public int getValue() {
+ return value;
+ }
+
+ @JsonProperty("type")
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]";
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java
index 016afa8537..1dc0451213 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java
@@ -115,9 +115,6 @@ public class BpmnRestClient {
HttpPost post = new HttpPost(recipeUri);
MsoJavaProperties props = loadMsoProperties();
- RequestConfig requestConfig =
- RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build();
- post.setConfig(requestConfig);
msoLogger.debug("call the bpmn, url:" + recipeUri);
String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
@@ -177,6 +174,8 @@ public class BpmnRestClient {
BpmnParam serviceInstanceIdInput = new BpmnParam();
BpmnParam serviceTypeInput = new BpmnParam();
BpmnParam recipeParamsInput = new BpmnParam();
+ BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam();
+ recipeTimeoutInput.setValue(recipeTimeout);
// host.setValue(parseURL());
requestIdInput.setValue(requestId);
requestActionInput.setValue(requestAction);
@@ -191,6 +190,7 @@ public class BpmnRestClient {
recipeRequest.setServiceType(serviceTypeInput);
recipeRequest.setRecipeParams(recipeParamsInput);
recipeRequest.setResourceInput(resourceInput);
+ recipeRequest.setRecipeTimeout(recipeTimeoutInput);
jsonReq = recipeRequest.toString();
msoLogger.debug("request body is " + jsonReq);
} catch(Exception e) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java
index 5bf5a02a38..194f7c43ec 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java
@@ -56,6 +56,9 @@ public class ResourceRecipeRequest {
@JsonProperty("recipeParams")
private BpmnParam recipeParams;
+ @JsonProperty("recipeTimeout")
+ private BpmnIntegerParam recipeTimeout;
+
@JsonProperty("resourceInput")
public BpmnParam getResourceInput() {
return resourceInput;
@@ -126,7 +129,17 @@ public class ResourceRecipeRequest {
this.recipeParams = recipeParams;
}
- @Override
+ @JsonProperty("recipeTimeout")
+ public BpmnIntegerParam getRecipeTimeout() {
+ return recipeTimeout;
+ }
+
+ @JsonProperty("recipeTimeout")
+ public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ }
+
+ @Override
public String toString() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
index c72cc71a74..d32a06d89b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
@@ -35,9 +35,6 @@ import org.camunda.bpm.engine.runtime.Execution;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
-import org.openecomp.mso.bpmn.core.json.JsonUtils;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
@@ -45,6 +42,10 @@ import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.functions.GetInput;
import org.onap.sdc.toscaparser.api.parameters.Input;
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.openecomp.mso.bpmn.core.json.JsonUtils;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -56,10 +57,11 @@ public class ResourceRequestBuilder {
public static String CUSTOMIZATION_UUID = "customizationUUID";
- public static String SERVICE_URL_TOSCA_CSAR = "http://mso:8080/ecomp/mso/catalog/v3/serviceToscaCsar?serviceModelUuid=";
+ public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid=";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+
static JsonUtils jsonUtil = new JsonUtils();
/**
@@ -184,7 +186,9 @@ public class ResourceRequestBuilder {
private static String getCsarFromUuid(String uuid) throws Exception {
ResteasyClient client = new ResteasyClientBuilder().build();
- ResteasyWebTarget target = client.target(SERVICE_URL_TOSCA_CSAR + uuid);
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ String catalogEndPoint = properties.get("mso.catalog.db.endpoint");
+ ResteasyWebTarget target = client.target(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid);
Response response = target.request().get();
String value = response.readEntity(String.class);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
index 3e315a5f04..16fd351b43 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.client.adapter.vnf;
import java.net.URI;
-import java.security.GeneralSecurityException;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
@@ -29,8 +28,6 @@ import java.util.UUID;
import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.ext.ContextResolver;
-import org.apache.commons.codec.binary.Base64;
-import org.openecomp.mso.bpmn.common.util.CryptoUtils;
import org.openecomp.mso.client.ResponseExceptionMapperImpl;
import org.openecomp.mso.client.policy.JettisonStyleMapperProvider;
import org.openecomp.mso.client.policy.RestClient;
@@ -52,8 +49,7 @@ public class AdapterRestClient extends RestClient {
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("Authorization",
- this.getBasicAuth(props.getAuth(), props.getKey()));
+ addBasicAuthHeader(props.getAuth(), props.getKey());
}
@Override
@@ -70,20 +66,4 @@ public class AdapterRestClient extends RestClient {
protected ContextResolver<ObjectMapper> getMapper() {
return new JettisonStyleMapperProvider();
}
-
- private String getBasicAuth(String encryptedAuth, String msoKey) {
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
- return null;
- }
- try {
- String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
- byte[] encoded = Base64.encodeBase64(auth.getBytes());
- String encodedString = new String(encoded);
- encodedString = "Basic " + encodedString;
- return encodedString;
- } catch (GeneralSecurityException e) {
- this.logger.warn(e.getMessage(), e);
- return null;
- }
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
index 27352dc11d..a1ef35a49d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
@@ -52,4 +52,13 @@ public class AAIPropertiesImpl implements AAIProperties {
return AAIVersion.LATEST;
}
+ @Override
+ public String getAuth() {
+ return props.get("aai.auth");
+ }
+
+ @Override
+ public String getKey() {
+ return props.get("mso.msoKey");
+ }
}