diff options
25 files changed, 692 insertions, 65 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-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql index c74ce6940c..054fb1af57 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql @@ -2,26 +2,183 @@ use catalogdb; DELETE FROM activity_spec_to_activity_spec_parameters; DELETE FROM activity_spec_to_activity_spec_categories; +DELETE FROM activity_spec_to_user_parameters; DELETE FROM activity_spec; DELETE FROM activity_spec_categories; DELETE FROM activity_spec_parameters; +DELETE FROM user_parameters; INSERT INTO activity_spec (NAME, DESCRIPTION, VERSION) -VALUES ('VNFSetInMaintFlagActivity','Activity to Set InMaint Flag in A&AI',1.0); +VALUES +('VNFSetInMaintFlagActivity','Activity to Set InMaint Flag in A&AI',1.0), +('VNFCheckPserversLockedFlagActivity','Activity Check Pservers Locked Flag VNF',1.0), +('VNFCheckInMaintFlagActivity','Activity CheckIn Maint Flag on VNF',1.0), +('VNFCheckClosedLoopDisabledFlagActivity','Activity Check Closed Loop Disabled Flag on VNF',1.0), +('VNFSetClosedLoopDisabledFlagActivity','Activity Set Closed Loop Disabled Flag on VNF',1.0), +('VNFUnsetClosedLoopDisabledFlagActivity','Activity Unset Closed Loop Disabled Flag on VNF',1.0), +('VNFLockActivity','Activity Lock on VNF',1.0), +('VNFUnlockActivity','Activity UnLock on VNF',1.0), +('VNFStopActivity','Activity Stop on VNF',1.0), +('VNFStartActivity','Activity Start on VNF',1.0), +('VNFSnapShotActivity','Activity Snap Shot on VNF',1.0), +('FlowCompleteActivity','Activity Complete on VNF',1.0), +('PauseForManualTaskActivity','Activity Pause For Manual Task on VNF',1.0), +('DistributeTrafficActivity','Activity Distribute Traffic on VNF',1.0), +('DistributeTrafficCheckActivity','Activity Distribute Traffic Check on VNF',1.0), +('VNFHealthCheckActivity','Activity Health Check on VNF',1.0), +('VNFQuiesceTrafficActivity','Activity Quiesce Traffic on VNF',1.0), +('VNFResumeTrafficActivity','Activity Resume Traffic on VNF',1.0), +('VNFUnsetInMaintFlagActivity','Activity Unset InMaint Flag on VNF',1.0), +('VNFUpgradeBackupActivity','Activity Upgrade Backup on VNF',1.0), +('VNFUpgradePostCheckActivity','Activity Upgrade Post Check on VNF',1.0), +('VNFUpgradePreCheckActivity','Activity Upgrade PreCheck on VNF',1.0), +('VNFUpgradeSoftwareActivity','Activity UpgradeS oftware on VNF',1.0), +('VnfInPlaceSoftwareUpdate','Activity InPlace Software Update on VNF',1.0); INSERT INTO activity_spec_categories (NAME) VALUES ('VNF'); -INSERT INTO activity_spec_parameters (NAME, TYPE, DIRECTION, DESCRIPTION) -VALUES('WorkflowException','WorkflowException','outputParameters','Description'); - INSERT INTO activity_spec_to_activity_spec_categories(ACTIVITY_SPEC_ID, ACTIVITY_SPEC_CATEGORIES_ID) VALUES -( -(select ID from ACTIVITY_SPEC where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VnfInPlaceSoftwareUpdate' and VERSION=1.0), (select ID from activity_spec_categories where NAME='VNF')); +INSERT INTO activity_spec_parameters (NAME, TYPE, DIRECTION, DESCRIPTION) +VALUES('WorkflowException','WorkflowException','output','Description'); + INSERT INTO activity_spec_to_activity_spec_parameters( ACTIVITY_SPEC_ID, ACTIVITY_SPEC_PARAMETERS_ID) -VALUES( -(select ID from ACTIVITY_SPEC where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), -(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='outputParameters'));
\ No newline at end of file +VALUES +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')); + +INSERT INTO `user_parameters`(`NAME`,`PAYLOAD_LOCATION`,`LABEL`,`TYPE`,`DESCRIPTION`,`IS_REQUIRED`,`MAX_LENGTH`,`ALLOWABLE_CHARS`) +VALUES +('cloudOwner','cloudConfiguration','Cloud Owner','text','',1,7,''), +('operations_timeout','userParams','Operations Timeout','text','',1,50,''), +('existing_software_version','userParams','Existing Software Version','text','',1,50,''), +('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''), +('new_software_version','userParams','New Software Version','text','',1,50,''), +('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,''); + +INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`) +VALUES +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='operations_timeout')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version'));
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.10.1__AlterTblActivitySpecToUserParameters.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.10.1__AlterTblActivitySpecToUserParameters.sql new file mode 100644 index 0000000000..d8bfa64033 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.10.1__AlterTblActivitySpecToUserParameters.sql @@ -0,0 +1,3 @@ +use catalogdb; + +ALTER TABLE activity_spec_to_user_parameters modify id INT(11) not null auto_increment;
\ No newline at end of file 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 32bc5ae3aa..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 @@ -64,7 +64,7 @@ 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); 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/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 825b541fda..54bb5fc15f 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -750,3 +750,178 @@ insert into activity_spec(name, description, version) values insert into workflow_activity_spec_sequence(workflow_id, activity_spec_id, seq_no) values (1, 1, 1); + +INSERT INTO activity_spec (NAME, DESCRIPTION, VERSION) +VALUES +('VNFSetInMaintFlagActivity','Activity to Set InMaint Flag in A&AI',1.0), +('VNFCheckPserversLockedFlagActivity','Activity Check Pservers Locked Flag VNF',1.0), +('VNFCheckInMaintFlagActivity','Activity CheckIn Maint Flag on VNF',1.0), +('VNFCheckClosedLoopDisabledFlagActivity','Activity Check Closed Loop Disabled Flag on VNF',1.0), +('VNFSetClosedLoopDisabledFlagActivity','Activity Set Closed Loop Disabled Flag on VNF',1.0), +('VNFUnsetClosedLoopDisabledFlagActivity','Activity Unset Closed Loop Disabled Flag on VNF',1.0), +('VNFLockActivity','Activity Lock on VNF',1.0), +('VNFUnlockActivity','Activity UnLock on VNF',1.0), +('VNFStopActivity','Activity Stop on VNF',1.0), +('VNFStartActivity','Activity Start on VNF',1.0), +('VNFSnapShotActivity','Activity Snap Shot on VNF',1.0), +('FlowCompleteActivity','Activity Complete on VNF',1.0), +('PauseForManualTaskActivity','Activity Pause For Manual Task on VNF',1.0), +('DistributeTrafficActivity','Activity Distribute Traffic on VNF',1.0), +('DistributeTrafficCheckActivity','Activity Distribute Traffic Check on VNF',1.0), +('VNFHealthCheckActivity','Activity Health Check on VNF',1.0), +('VNFQuiesceTrafficActivity','Activity Quiesce Traffic on VNF',1.0), +('VNFResumeTrafficActivity','Activity Resume Traffic on VNF',1.0), +('VNFUnsetInMaintFlagActivity','Activity Unset InMaint Flag on VNF',1.0), +('VNFUpgradeBackupActivity','Activity Upgrade Backup on VNF',1.0), +('VNFUpgradePostCheckActivity','Activity Upgrade Post Check on VNF',1.0), +('VNFUpgradePreCheckActivity','Activity Upgrade PreCheck on VNF',1.0), +('VNFUpgradeSoftwareActivity','Activity UpgradeS oftware on VNF',1.0), +('VnfInPlaceSoftwareUpdate','Activity InPlace Software Update on VNF',1.0); + +INSERT INTO activity_spec_categories (NAME) +VALUES ('VNF'); + +INSERT INTO activity_spec_to_activity_spec_categories(ACTIVITY_SPEC_ID, ACTIVITY_SPEC_CATEGORIES_ID) +VALUES +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')), +((select ID from activity_spec where NAME='VnfInPlaceSoftwareUpdate' and VERSION=1.0), +(select ID from activity_spec_categories where NAME='VNF')); + +INSERT INTO activity_spec_parameters (NAME, TYPE, DIRECTION, DESCRIPTION) +VALUES('WorkflowException','WorkflowException','output','Description'); + +INSERT INTO activity_spec_to_activity_spec_parameters( ACTIVITY_SPEC_ID, ACTIVITY_SPEC_PARAMETERS_ID) +VALUES +((select ID from activity_spec where NAME='VNFSetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckPserversLockedFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFCheckClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetClosedLoopDisabledFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFLockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnlockActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='FlowCompleteActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='PauseForManualTaskActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFHealthCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFResumeTrafficActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUnsetInMaintFlagActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from activity_spec_parameters where NAME='WorkflowException' and DIRECTION='output')); + +INSERT INTO `user_parameters`(`NAME`,`PAYLOAD_LOCATION`,`LABEL`,`TYPE`,`DESCRIPTION`,`IS_REQUIRED`,`MAX_LENGTH`,`ALLOWABLE_CHARS`) +VALUES +('cloudOwner','cloudConfiguration','Cloud Owner','text','',1,7,''), +('operations_timeout','userParams','Operations Timeout','text','',1,50,''), +('existing_software_version','userParams','Existing Software Version','text','',1,50,''), +('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''), +('new_software_version','userParams','New Software Version','text','',1,50,''), +('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,''); + +INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`) +VALUES +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStopActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFStartActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='lcpCloudRegionId')), +((select ID from activity_spec where NAME='VNFSnapShotActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='tenantId')), +((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='operations_timeout')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePostCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradePreCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='existing_software_version')), +((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='new_software_version')); diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 92979f4f32..5e43f8f3e2 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -1296,7 +1296,7 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS `activity_spec_categories` ( - `ID` INT(11) NOT NULL, + `ID` INT(11) NOT NULL AUTO_INCREMENT, `NAME` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC)) @@ -1304,7 +1304,7 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_categories` ( - `ID` INT(11) NOT NULL, + `ID` INT(11) NOT NULL AUTO_INCREMENT, `ACTIVITY_SPEC_ID` INT(11) NOT NULL, `ACTIVITY_SPEC_CATEGORIES_ID` INT(11) NOT NULL, PRIMARY KEY (`ID`), @@ -1346,7 +1346,7 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` ( - `ID` INT(11) NOT NULL, + `ID` INT(11) NOT NULL AUTO_INCREMENT, `ACTIVITY_SPEC_ID` INT(11) NOT NULL, `USER_PARAMETERS_ID` INT(11) NOT NULL, PRIMARY KEY (`ID`), |