summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java90
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java22
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java33
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetByNameResponse.json34
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetCreateResponse.json44
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetDeleteResponse.json8
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetUpdateResponse.json8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java5
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudGetStackExists.json34
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java59
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java31
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java3
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java3
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java3
31 files changed, 484 insertions, 87 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 2788387bc1..7bf68fff78 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -25,6 +25,7 @@ package org.onap.so.openstack.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Stack;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
@@ -56,6 +57,7 @@ import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
+import org.onap.so.openstack.mappers.StackInfoMapper;
import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -195,7 +197,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString()));
}
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, null);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, null, false);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient == null) {
@@ -222,8 +224,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
timeoutMinutes, backout);
if (HeatStatus.CREATED.equals(stackStatus.getStatus())) {
- String workloadId = multicloudResponseBody == null ? null : multicloudResponseBody.getWorkloadId();
- multicloudAaiUpdate(cloudSiteId, cloudOwner, tenantId, genericVnfId, vfModuleId, workloadId,
+ multicloudAaiUpdate(cloudSiteId, cloudOwner, tenantId, genericVnfId, vfModuleId, canonicalName,
pollForCompletion, timeoutMinutes);
}
@@ -268,6 +269,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
String stackName = null;
String stackId = null;
+ boolean byName = false;
int offset = instanceId.indexOf('/');
if (offset > 0 && offset < (instanceId.length() - 1)) {
stackName = instanceId.substring(0, offset);
@@ -275,12 +277,13 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
} else {
stackName = instanceId;
stackId = instanceId;
+ byName = true;
}
StackInfo returnInfo = new StackInfo();
returnInfo.setName(stackName);
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId, byName);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient != null) {
@@ -289,24 +292,36 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
logger.debug(String.format("Multicloud GET Response: %s", response.toString()));
}
- MulticloudQueryResponse multicloudQueryBody = null;
+ MulticloudQueryResponse responseBody = null;
if (response.getStatus() == Response.Status.NOT_FOUND.getStatusCode()) {
returnInfo.setStatus(HeatStatus.NOTFOUND);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
} else if (response.getStatus() == Response.Status.OK.getStatusCode() && response.hasEntity()) {
- multicloudQueryBody = getQueryBody((java.io.InputStream) response.getEntity());
- if (multicloudQueryBody != null) {
- returnInfo.setCanonicalName(stackName + "/" + multicloudQueryBody.getWorkloadId());
- returnInfo.setStatus(getHeatStatus(multicloudQueryBody.getWorkloadStatus()));
- returnInfo.setStatusMessage(multicloudQueryBody.getWorkloadStatus());
+ responseBody = getQueryBody((java.io.InputStream) response.getEntity());
+ if (responseBody != null) {
if (logger.isDebugEnabled()) {
- logger.debug("Multicloud Create Response Body: " + multicloudQueryBody.toString());
+ logger.debug("Multicloud Create Response Body: " + responseBody.toString());
+ }
+ Stack workloadStack = getWorkloadStack(responseBody.getWorkloadStatusReason());
+ if (workloadStack != null && !responseBody.getWorkloadStatus().equals("GET_FAILED")
+ && !responseBody.getWorkloadStatus().contains("UPDATE")) {
+ returnInfo = new StackInfoMapper(workloadStack).map();
+ } else {
+ returnInfo.setCanonicalName(stackName + "/" + responseBody.getWorkloadId());
+ returnInfo.setStatus(getHeatStatus(responseBody.getWorkloadStatus()));
+ returnInfo.setStatusMessage(responseBody.getWorkloadStatus());
}
} else {
+ returnInfo.setName(stackName);
+ if (!byName)
+ returnInfo.setCanonicalName(instanceId);
returnInfo.setStatus(HeatStatus.FAILED);
returnInfo.setStatusMessage(MULTICLOUD_QUERY_BODY_NULL);
}
} else {
+ returnInfo.setName(stackName);
+ if (!byName)
+ returnInfo.setCanonicalName(instanceId);
returnInfo.setStatus(HeatStatus.FAILED);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
}
@@ -315,6 +330,35 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
return returnInfo;
}
+ private Stack getWorkloadStack(JsonNode node) {
+ if (node == null)
+ return null;
+ Stack workloadStack = null;
+ if (node.has("stacks")) {
+ try {
+ if (!node.at("/stacks/0").isNull() && node.at("/stacks/0").has("stack_status")) {
+ workloadStack = JSON_MAPPER.treeToValue(node.at("/stacks/0"), Stack.class);
+ } else {
+ workloadStack = new Stack();
+ workloadStack.setStackStatus(HeatStatus.NOTFOUND.toString());
+ }
+ } catch (Exception e) {
+ logger.debug("Multicloud Get Exception mapping /stack/0: {} ", node.toString(), e);
+ }
+ } else if (node.has("stack")) {
+ try {
+ if (node.at("/stack").has("stack_status")) {
+ workloadStack = JSON_MAPPER.treeToValue(node.at("/stack"), Stack.class);
+ }
+ } catch (Exception e) {
+ logger.debug("Multicloud Get Exception mapping /stack: {} ", node.toString(), e);
+ }
+ }
+ if (workloadStack != null)
+ logger.debug("Multicloud getWorkloadStack() returning Stack Object: {} ", workloadStack.toString());
+ return workloadStack;
+ }
+
public StackInfo deleteStack(String cloudSiteId, String cloudOwner, String tenantId, String instanceId)
throws MsoException {
if (logger.isDebugEnabled()) {
@@ -335,7 +379,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
returnInfo.setName(stackName);
Response response = null;
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId, false);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient != null) {
@@ -389,12 +433,20 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
private void multicloudAaiUpdate(String cloudSiteId, String cloudOwner, String tenantId, String genericVnfId,
String vfModuleId, String workloadId, boolean pollForCompletion, int timeoutMinutes) {
+ String stackId = null;
+ int offset = workloadId.indexOf('/');
+ if (offset > 0 && offset < (workloadId.length() - 1)) {
+ stackId = workloadId.substring(offset + 1);
+ } else {
+ stackId = workloadId;
+ }
+
MulticloudRequest multicloudRequest = new MulticloudRequest();
multicloudRequest.setGenericVnfId(genericVnfId);
multicloudRequest.setVfModuleId(vfModuleId);
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, workloadId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId, false);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient == null) {
@@ -740,7 +792,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
return null;
}
- private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) {
+ private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId, boolean isName) {
String msbIp = System.getenv().get(ONAP_IP);
if (null == msbIp || msbIp.isEmpty()) {
msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
@@ -751,10 +803,16 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme("http").build().toString();
if (workloadId != null) {
+ String middlepart = null;
+ if (isName) {
+ middlepart = "?name=";
+ } else {
+ middlepart = "/";
+ }
if (logger.isDebugEnabled()) {
- logger.debug(String.format("Multicloud Endpoint is: %s/%s", endpoint, workloadId));
+ logger.debug(String.format("Multicloud Endpoint is: %s%s%s", endpoint, middlepart, workloadId));
}
- return String.format("%s/%s", endpoint, workloadId);
+ return String.format("%s%s%s", endpoint, middlepart, workloadId);
} else {
if (logger.isDebugEnabled()) {
logger.debug(String.format("Multicloud Endpoint is: %s", endpoint));
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
index ca8f041aae..a22937aea3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
@@ -25,10 +25,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"template_type", "workload_id", "workload_status"})
+@JsonPropertyOrder({"template_type", "workload_id", "workload_status", "workload_status_reason"})
public class MulticloudQueryResponse implements Serializable {
private final static long serialVersionUID = -5215028275577848311L;
@@ -38,13 +39,17 @@ public class MulticloudQueryResponse implements Serializable {
private String workloadId;
@JsonProperty("workload_status")
private String workloadStatus;
+ @JsonProperty("workload_status_reason")
+ private JsonNode workloadStatusReason;
@JsonCreator
public MulticloudQueryResponse(@JsonProperty("template_type") String templateType,
- @JsonProperty("workload_id") String workloadId, @JsonProperty("workload_status") String workloadStatus) {
+ @JsonProperty("workload_id") String workloadId, @JsonProperty("workload_status") String workloadStatus,
+ @JsonProperty("workload_status_reason") JsonNode workloadStatusReason) {
this.templateType = templateType;
this.workloadId = workloadId;
this.workloadStatus = workloadStatus;
+ this.workloadStatusReason = workloadStatusReason;
}
@JsonProperty("template_type")
@@ -77,9 +82,20 @@ public class MulticloudQueryResponse implements Serializable {
this.workloadStatus = workloadStatus;
}
+ @JsonProperty("workload_status_reason")
+ public JsonNode getWorkloadStatusReason() {
+ return workloadStatusReason;
+ }
+
+ @JsonProperty("workload_status_reason")
+ public void setWorkloadStatus(JsonNode workloadStatusReason) {
+ this.workloadStatusReason = workloadStatusReason;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId)
- .append("workloadStatus", workloadStatus).toString();
+ .append("workloadStatus", workloadStatus).append("workloadStatusReason", workloadStatusReason)
+ .toString();
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index 0d8f451a6d..995db522e9 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -21,9 +21,11 @@
package org.onap.so.openstack.utils;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -34,7 +36,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Optional;
import org.apache.http.HttpStatus;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -64,38 +65,36 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Mock
private CloudConfig cloudConfigMock;
- private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": "
+ private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": "
+ "\"TEST-workload\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}";
private static final String UPDATE_STACK_RESPONSE =
- "{\"template_type\": \"TEST-template\", \"workload_id\": " + "\"TEST-workload\"}";
- private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": "
- + "\"TEST-workload\", \"workload_status\": \"CREATE_COMPLETE\"}";
- private static final String GET_UPDATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": "
- + "\"TEST-workload\", \"workload_status\": \"UPDATE_COMPLETE\"}";
+ "{\"template_type\": \"heat\", \"workload_id\": " + "\"TEST-workload\"}";
private static final String MULTICLOUD_CREATE_PATH = "/api/multicloud/v1/CloudOwner/MTN14/infra_workload";
private static final String MULTICLOUD_UPDATE_PATH =
"/api/multicloud/v1/CloudOwner/MTN14/infra_workload/TEST-workload";
private static final String MULTICLOUD_GET_PATH =
"/api/multicloud/v1/CloudOwner/MTN14/infra_workload/TEST-workload";
+ private static final String MULTICLOUD_DELETE_PATH =
+ "/api/multicloud/v1/CloudOwner/MTN14/infra_workload/TEST-workload";
@Test
public void createStackSuccess() throws MsoException, IOException {
wireMockServer
- .stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE")
+ .stubFor(post(urlEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE")
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_CREATED))
.willSetStateTo("CREATING"));
wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE")
.whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
+ .withBodyFile("MulticloudGetCreateResponse.json").withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH))
.inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED))
.willSetStateTo("UPDATING"));
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE")
- .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("UPDATING")
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("MulticloudGetUpdateResponse.json").withStatus(HttpStatus.SC_OK)));
StackInfo result =
multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false);
@@ -106,7 +105,13 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Test
public void deleteStack() throws MsoException {
- StackInfo result = multicloudUtils.deleteStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
+ wireMockServer.stubFor(delete(urlEqualTo(MULTICLOUD_DELETE_PATH)).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT)));
+ wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("MulticloudGetDeleteResponse.json").withStatus(HttpStatus.SC_OK)));
+ StackInfo result =
+ multicloudUtils.deleteStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack/TEST-workload");
assertNotNull(result);
assertTrue(HeatStatus.NOTFOUND == result.getStatus());
}
@@ -123,7 +128,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(CREATE_STACK_RESPONSE)
.withStatus(HttpStatus.SC_OK)));
- StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
+ StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceName/instanceId");
assertTrue(HeatStatus.FAILED == result.getStatus());
assertEquals(MULTICLOUD_QUERY_BODY_NULL, result.getStatusMessage());
}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetByNameResponse.json b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetByNameResponse.json
new file mode 100644
index 0000000000..7e671d005a
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetByNameResponse.json
@@ -0,0 +1,34 @@
+{
+ "template_type": "heat",
+ "workload_id": "TEST-workload",
+ "workload_status": "GET_COMPLETE",
+ "workload_status_reason": {
+ "stacks": [
+ {
+ "id": "TEST-workload",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "TEST-stack",
+ "stack_status": "CREATE_COMPLETE",
+ "creation_time": "2019-03-21T03:17:32Z",
+ "description": "Sample stack response",
+ "stack_owner": "stack_Owner",
+ "capabilities": [],
+ "parameters": {
+ "OS::project_id": "0e148b76ee8c42f78d37013bf6b7b1ae",
+ "apt_proxy": "10.12.5.2:8000",
+ "etcd_vm_flavor": "m1.medium",
+ "docker_version": "17.03.2",
+ "portal_hostname": "portal.api.simpledemo.onap.org",
+ "docker_proxy": "10.12.5.2:5000",
+ "kubectl_version": "1.11.5",
+ "use_ramdisk": "false"
+ }
+ }
+ ]
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetCreateResponse.json b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetCreateResponse.json
new file mode 100644
index 0000000000..8feb3e085e
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetCreateResponse.json
@@ -0,0 +1,44 @@
+{
+ "template_type": "heat",
+ "workload_id": "TEST-workload",
+ "workload_status": "CREATE_COMPLETE",
+ "workload_status_reason": {
+ "stack": {
+ "id": "TEST-workload",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "TEST-stack",
+ "stack_status": "CREATE_COMPLETE",
+ "creation_time": "2019-03-21T03:17:32Z",
+ "description": "Sample stack response",
+ "stack_owner": "stack_Owner",
+ "capabilities": [],
+ "parameters": {
+ "OS::project_id": "0e148b76ee8c42f78d37013bf6b7b1ae",
+ "apt_proxy": "10.12.5.2:8000",
+ "etcd_vm_flavor": "m1.medium",
+ "docker_version": "17.03.2",
+ "portal_hostname": "portal.api.simpledemo.onap.org",
+ "docker_proxy": "10.12.5.2:5000",
+ "kubectl_version": "1.11.5",
+ "use_ramdisk": "false"
+ },
+ "outputs": [
+ {
+ "output_value": "10.12.6.20",
+ "output_key": "k8s_12_vm_ip",
+ "description": "The IP address of the k8s_12 instance"
+ },
+ {
+ "output_value": "10.12.5.241",
+ "output_key": "k8s_01_vm_ip",
+ "description": "The IP address of the k8s_01 instance"
+ }
+ ]
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetDeleteResponse.json b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetDeleteResponse.json
new file mode 100644
index 0000000000..9efaf7b265
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetDeleteResponse.json
@@ -0,0 +1,8 @@
+{
+ "template_type": "heat",
+ "workload_id": "TEST-workload",
+ "workload_status": "DELETE_COMPLETE",
+ "workload_status_reason": {
+ "stack": {}
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetUpdateResponse.json b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetUpdateResponse.json
new file mode 100644
index 0000000000..84d7db82ba
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/MulticloudGetUpdateResponse.json
@@ -0,0 +1,8 @@
+{
+ "template_type": "heat",
+ "workload_id": "TEST-workload",
+ "workload_status": "UPDATE_COMPLETE",
+ "workload_status_reason": {
+ "stack": {}
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
index 9d13cc10a3..5f2057524f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
@@ -24,6 +24,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -138,9 +139,9 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils {
msoRequest.setServiceInstanceId("12345");
wireMockServer.stubFor(
- get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/vfname")).willReturn(aResponse()
+ get(urlEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload?name=vfname")).willReturn(aResponse()
// .withHeader()
- .withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
+ .withBodyFile("MulticloudGetStackExists.json").withStatus(HttpStatus.SC_OK)));
try {
instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudGetStackExists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudGetStackExists.json
new file mode 100644
index 0000000000..41a9959812
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudGetStackExists.json
@@ -0,0 +1,34 @@
+{
+ "template_type": "heat",
+ "workload_id": "vfname",
+ "workload_status": "GET_COMPLETE",
+ "workload_status_reason": {
+ "stacks": [
+ {
+ "id": "vfname",
+ "links" : [
+ {
+ "href" : "port",
+ "rel" : "self"
+ }
+ ],
+ "stack_name": "vfname",
+ "stack_status": "CREATE_COMPLETE",
+ "creation_time": "2019-03-21T03:17:32Z",
+ "description": "Sample stack response",
+ "stack_owner": "stack_Owner",
+ "capabilities": [],
+ "parameters": {
+ "OS::project_id": "0e148b76ee8c42f78d37013bf6b7b1ae",
+ "apt_proxy": "10.12.5.2:8000",
+ "etcd_vm_flavor": "m1.medium",
+ "docker_version": "17.03.2",
+ "portal_hostname": "portal.api.simpledemo.onap.org",
+ "docker_proxy": "10.12.5.2:5000",
+ "kubectl_version": "1.11.5",
+ "use_ramdisk": "false"
+ }
+ }
+ ]
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
index 045b98007d..f1074bcba8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -39,7 +41,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import static com.google.common.base.Splitter.on;
@@ -48,15 +54,17 @@ import static com.google.common.io.ByteStreams.toByteArray;
import static java.lang.String.format;
import static org.apache.http.HttpHeaders.ACCEPT;
import static org.apache.http.HttpHeaders.AUTHORIZATION;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.*;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement;
+import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
-
@Component
public class SdcPackageProvider {
private static final String GET_PACKAGE_URL = "%s/catalog/resources/%s/toscaModel";
- @Value("sdc.toscametapath:TOSCA-Metadata/TOSCA.meta")
+ @Value("${sdc.toscametapath:TOSCA-Metadata/TOSCA.meta}")
private List<String> toscaMetaPaths;
private final String TOSCA_VNFD_KEY = "Entry-Definitions";
private static Logger logger = getLogger(SdcPackageProvider.class);
@@ -70,7 +78,6 @@ public class SdcPackageProvider {
@Value("${sdc.endpoint}")
private String baseUrl;
-
public String getVnfdId(String csarId) {
return getVnfNodeProperty(csarId, "descriptor_id");
}
@@ -125,8 +132,7 @@ public class SdcPackageProvider {
private byte[] getPackage(String csarId) {
final String SERVICE_NAME = "vnfm-adapter";
- try {
- CloseableHttpClient client = HttpClients.createDefault();
+ try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId));
httpget.setHeader(ACCEPT, APPLICATION_OCTET_STREAM_VALUE);
httpget.setHeader("X-ECOMP-InstanceID", SERVICE_NAME);
@@ -140,7 +146,6 @@ public class SdcPackageProvider {
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
byte[] bytes = toByteArray(is);
- client.close();
return bytes;
} catch (Exception e) {
throw abortOperation("Unable to download " + csarId + " package from SDC", e);
@@ -182,7 +187,6 @@ public class SdcPackageProvider {
throw new NoSuchElementException("Unable to find the " + path + " in archive found: " + items);
}
-
public String getFlavourId(String csarId) {
return getVnfNodeProperty(csarId, "flavour_id");
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
index 88b8ba8ef0..50fd5bcf3a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
@@ -20,7 +20,15 @@
package org.onap.so.adapters.vnfmadapter.extclients.aai;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.TenantNotFoundException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
index 807f3bdb9d..f991ffafba 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
@@ -20,7 +20,11 @@
package org.onap.so.adapters.vnfmadapter.extclients.aai;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.vnfmadapter.v1.model.Tenant;
import java.util.List;
@@ -93,7 +97,7 @@ public interface AaiServiceProvider {
* @param cloudOwner the cloud owner
* @param cloudRegion the cloud region
* @param tenantId the ID of the tenant
- * @param vserver the ID of the vserver
+ * @param vserverId the ID of the vserver
* @return
*/
void invokeDeleteVserver(final String cloudOwner, final String cloudRegion, final String tenantId,
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index 4346114e34..fa07ab5720 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -20,7 +20,11 @@
package org.onap.so.adapters.vnfmadapter.extclients.aai;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.vnfmadapter.v1.model.Tenant;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 70567d8631..31399f7720 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -30,9 +30,16 @@ import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.InterfaceInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.VimCredentials;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter.NotificationTypesEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
import org.onap.so.security.WebSecurityConfig;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
index d061dd05c3..7a0df0fdba 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
@@ -21,7 +21,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest;
/**
* Provides methods for invoking REST calls to a VNFM.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
index b096f51cb0..951c6f187b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -21,7 +21,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmRequestFailureException;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
index a16c3fb5cc..6b8802eed2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
@@ -23,7 +23,11 @@ package org.onap.so.adapters.vnfmadapter.rest;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
import org.onap.vnfmadapter.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,7 +35,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
index 1cf00da499..8eccc476d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
@@ -35,7 +35,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
index 7e87e669e2..b7f5e96eab 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
@@ -27,7 +27,12 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.hamcrest.MockitoHamcrest;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index 363780dcc5..66e8e99f72 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -36,8 +36,13 @@ import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource;
import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationComputeResource;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfIdentifierCreationNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
@@ -62,10 +67,17 @@ import org.springframework.web.client.RestTemplate;
import javax.inject.Inject;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index 39572c73cd..20a074b2ba 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -28,7 +28,21 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.hamcrest.MockitoHamcrest;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationEnum;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
@@ -37,7 +51,9 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.Tenant;
-import org.onap.vnfmadapter.v1.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -58,7 +74,9 @@ import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneOffset;
import java.net.URI;
import java.util.Optional;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 918bcdd4cc..64567a349e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -143,12 +143,14 @@ class ExternalAPIUtil {
String uuid = utils.getRequestID()
logger.debug( "Generated uuid is: " + uuid)
logger.debug( "URL to be used is: " + url)
+ logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid)
client.addAdditionalHeader("Accept", MediaType.APPLICATION_JSON)
+ client.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl"))
apiResponse = client.get()
@@ -179,11 +181,13 @@ class ExternalAPIUtil {
String uuid = utils.getRequestID()
logger.debug( "Generated uuid is: " + uuid)
logger.debug( "URL to be used is: " + url)
+ logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
httpClient.addAdditionalHeader("X-FromAppId", "MSO")
httpClient.addAdditionalHeader("X-TransactionId", uuid)
+ httpClient.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl"))
apiResponse = httpClient.post(payload)
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index e7ab6e4606..0dbf2c2a75 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -139,7 +139,6 @@ public class ResourceRequestBuilder {
Map<String, Object> serviceInputs) {
try {
Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid);
-
// find match of customization uuid in vnf
Map<String, Map<String, Object>> serviceResources =
(Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
@@ -200,7 +199,11 @@ public class ResourceRequestBuilder {
if (serviceInputs.containsKey(tmpKey)) {
value = (String) serviceInputs.get(tmpKey);
} else {
- value = split[1];
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
}
}
resourceInput.put(key, value);
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
index db11cb6044..837bc77f19 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
@@ -146,6 +146,7 @@ class ExternalAPIUtilTest {
DelegateExecution delegateExecution = mock(DelegateExecution.class)
given(delegateExecution.getVariable("URN_externalapi_auth")).willReturn("value_externalapi_auth")
given(delegateExecution.getVariable("URN_mso_msoKey")).willReturn("value_mso_msoKey")
+ given(delegateExecution.getVariable("SPPartnerUrl")).willReturn("http://LocalExtAPIURL:8080")
return delegateExecution
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index 0c2862bf91..c7c181744f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,15 +19,15 @@
*/
package org.onap.so.bpmn.common.resource;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.so.BaseTest;
public class ResourceRequestBuilderTest extends BaseTest {
@@ -341,4 +341,49 @@ public class ResourceRequestBuilderTest extends BaseTest {
assertEquals(0, stringObjectMap.size());
}
+ @Test
+ public void testGetResourceInputEmptyValue() {
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : \"demoVFWCL\",\n"
+ + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
+ + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
+ + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
+ + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
+ + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n"
+ + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n"
+ + "\t\t{ \"modelInfo\" : {\n"
+ + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
+ + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
+ + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
+ + "\t\t\t\"modelVersion\" : \"1.0\",\n"
+ + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
+ + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
+ + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ + "\t\t\"nfFunction\" \t: null,\n"
+ + "\"resourceInput\":\"{\\\"a\\\":\\\"key1|\\\"}\","
+ + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"nfRole\" \t\t: null,\n"
+ + "\t\t\"nfNamingCode\" \t: null,\n"
+ + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
+ + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
+ + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
+ + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
+ + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
+ + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
+ + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
+ + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
+ + "\t\t\t\t\t\"initialCount\" : 1,\n"
+ + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
+ + "\t\t}]}}")));
+
+ HashMap serviceInput = new HashMap();
+ serviceInput.put("key2", "value");
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
+ "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput);
+ assertEquals(stringObjectMap.get("a"), "");
+ }
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index bd430fd679..c61808ebb1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -28,18 +28,24 @@ import org.camunda.bpm.application.PostDeploy;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
+import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.data.repository.WorkflowRepository;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Primary;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -50,12 +56,18 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
+@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
+@EntityScan({"org.onap.so.db.catalog.beans"})
@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+
public class MSOInfrastructureApplication {
private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
+ @Autowired
+ private WorkflowRepository workflowRepository;
+
@Value("${mso.async.core-pool-size}")
private int corePoolSize;
@@ -66,6 +78,7 @@ public class MSOInfrastructureApplication {
private int queueCapacity;
private static final String LOGS_DIR = "logs_dir";
+ private static final String BPMN_SUFFIX = ".bpmn";
private static void setLogsDir() {
@@ -81,7 +94,10 @@ public class MSOInfrastructureApplication {
}
@PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {}
+ public void postDeploy(ProcessEngine processEngineInstance) {
+ DeploymentBuilder deploymentBuilder = processEngineInstance.getRepositoryService().createDeployment();
+ deployCustomWorkflows(deploymentBuilder);
+ }
@PreUndeploy
public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
@@ -99,4 +115,25 @@ public class MSOInfrastructureApplication {
executor.initialize();
return executor;
}
+
+ public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) {
+ if (workflowRepository == null) {
+ return;
+ }
+ List<Workflow> workflows = workflowRepository.findAll();
+ if (workflows != null && workflows.size() != 0) {
+ for (Workflow workflow : workflows) {
+ String workflowName = workflow.getName();
+ String workflowBody = workflow.getBody();
+ if (!workflowName.endsWith(BPMN_SUFFIX)) {
+ workflowName += BPMN_SUFFIX;
+ }
+ if (workflowBody != null) {
+ logger.info("{} {}", "Deploying custom workflow", workflowName);
+ deploymentBuilder.addString(workflowName, workflowBody);
+ }
+ }
+ deploymentBuilder.deploy();
+ }
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index c8b48c6703..1578f0f7c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -347,8 +347,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.info(" ***** Started prepare3rdONAPRequest *****")
String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
- String extAPIPath = sppartnerUrl + '/serviceOrder'
+ String extAPIPath = UrnPropertiesReader.getVariable("extapi.endpoint", execution) + '/serviceOrder'
execution.setVariable("ExternalAPIURL", extAPIPath)
+ execution.setVariable("SPPartnerUrl",sppartnerUrl)
// ExternalAPI message format
String externalId = execution.getVariable("resourceName")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 896a8bd98c..22c4f95a6f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -553,21 +553,22 @@ public class ServicePluginFactory {
// Now we need to query terminal points from SP resourcemgr system.
List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
- Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0);
-
- serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id"));
- serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id"));
- serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id"));
- serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id"));
- serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id"));
- tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1);
-
- serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id"));
- serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id"));
- serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id"));
- serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id"));
- serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id"));
-
+ if (locationTerminalPointList != null) {
+ Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0);
+
+ serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+ tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1);
+
+ serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+ }
String newRequest = getJsonString(uuiObject);
return newRequest;
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
index 3bf3d602c5..153970b053 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -37,6 +39,7 @@ public class VnfInstantiationNotification implements Runnable {
Thread.sleep(10000);
} catch (final InterruptedException e) {
e.printStackTrace();
+ Thread.currentThread().interrupt();
}
System.out.println("Instantiation process finished");
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
index 61d6f7e6c2..ff299ce12e 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -33,6 +35,7 @@ public class VnfmAdapterCreationNotification implements Runnable {
Thread.sleep(10000);
} catch (final InterruptedException e) {
e.printStackTrace();
+ Thread.currentThread().interrupt();
}
System.out.println("Call to VNFM Adapter-Create");
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
index 0ad7365d30..f7a8eaa2dd 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -33,6 +35,7 @@ public class VnfmAdapterDeletionNotification implements Runnable {
Thread.sleep(10000);
} catch (final InterruptedException e) {
e.printStackTrace();
+ Thread.currentThread().interrupt();
}
System.out.println("Call to VNFM Adapter-Delete");
}