diff options
Diffstat (limited to 'asdc-controller/src/test')
23 files changed, 1966 insertions, 51 deletions
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java index 86f6a89af5..aae5e5dc53 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java @@ -19,20 +19,72 @@ */ package org.onap.asdc.activity; +import java.nio.file.Files; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; import org.junit.Test; -import org.onap.so.asdc.BaseTest; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.asdc.activity.ActivitySpecsActions; import org.onap.so.asdc.activity.DeployActivitySpecs; -import org.springframework.beans.factory.annotation.Autowired; +import org.onap.so.asdc.activity.beans.ActivitySpec; +import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; +import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; +import org.springframework.core.env.Environment; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +@RunWith(MockitoJUnitRunner.class) +public class DeployActivitySpecsTest { + @Mock + protected Environment env; -public class DeployActivitySpecsTest extends BaseTest { + @Mock + protected ActivitySpecRepository activitySpecRepository; - @Autowired + @Mock + protected ActivitySpecsActions activitySpecsActions; + + @InjectMocks private DeployActivitySpecs deployActivitySpecs; @Test - public void DeployActivitySpecs_Test() throws Exception { - // Mock catalog DB results + public void deployActivitySpecs_Test() throws Exception { + boolean deploymentSuccessful = true; + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + ObjectMapper mapper = new ObjectMapper(); + org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))), + org.onap.so.db.catalog.beans.ActivitySpec.class); + List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList = + new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>(); + catalogActivitySpecList.add(catalogActivitySpec); + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint"); + when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList); + doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any()); + doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any()); deployActivitySpecs.deployActivities(); + assertTrue(deploymentSuccessful); + } + + @Test + public void mapActivitySpecFromCatalogToSdc_Test() throws Exception { + ObjectMapper mapper = new ObjectMapper(); + org.onap.so.db.catalog.beans.ActivitySpec catalogActivitySpec = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpecFromCatalog.json"))), + org.onap.so.db.catalog.beans.ActivitySpec.class); + ActivitySpec activitySpec = deployActivitySpecs.mapActivitySpecFromCatalogToSdc(catalogActivitySpec); + ActivitySpec expected = mapper.readValue( + new String(Files.readAllBytes(Paths.get("src/test/resources/ActivitySpec.json"))), ActivitySpec.class); + assertThat(expected, sameBeanAs(activitySpec)); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 815f419c40..ac107f6449 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -22,12 +22,15 @@ package org.onap.so.asdc.client.test.rest; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 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.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.HashSet; import java.util.Set; import javax.transaction.Transactional; @@ -42,9 +45,12 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.catalog.data.repository.WorkflowRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; @@ -66,6 +72,9 @@ public class ASDCRestInterfaceTest extends BaseTest { private NetworkResourceRepository networkRepo; @Autowired + private WorkflowRepository workflowRepo; + + @Autowired private ASDCRestInterface asdcRestInterface; private TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); @@ -96,6 +105,10 @@ public class ASDCRestInterfaceTest extends BaseTest { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + ObjectMapper mapper = new ObjectMapper(); NotificationDataImpl request = mapper.readValue(new File("src/test/resources/resource-examples/allottedresource/notif-portm.json"), @@ -139,15 +152,98 @@ public class ASDCRestInterfaceTest extends BaseTest { } @Test + @Transactional + public void test_VFW_Distrobution() throws Exception { + + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue( + new File("src/test/resources/resource-examples/vFW/notification.json"), NotificationDataImpl.class); + headers.add("resource-location", "src/test/resources/resource-examples/vFW/"); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Service expectedService = new Service(); + expectedService.setDescription("catalog service description"); + expectedService.setModelInvariantUUID("3164f9ff-d7e7-4813-ab32-6be7e1cacb18"); + expectedService.setModelName("vFW 2019-04-10 21:53:05"); + expectedService.setModelUUID("e16e4ed9-3429-423a-bc3c-1389ae91491c"); + expectedService.setModelVersion("1.0"); + + + + Service actualService = serviceRepo.findOneByModelUUID("e16e4ed9-3429-423a-bc3c-1389ae91491c"); + + + if (actualService == null) + throw new Exception("No Allotted Resource Written to database"); + + assertEquals(expectedService.getModelName(), actualService.getModelName()); + } + + @Test + @Transactional + public void testWorkflowDistribution() throws Exception { + + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + wireMockServer.stubFor( + post(urlPathEqualTo("/sobpmnengine/deployment/create")).willReturn(aResponse().withStatus(200))); + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue( + new File("src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json"), + NotificationDataImpl.class); + headers.add("resource-location", "src/test/resources/resource-examples/WorkflowBpmn/"); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Workflow actualResponse = workflowRepo.findByArtifactUUID("a90f8eaa-7c20-422f-8c81-aacbca6fb9e7"); + + if (actualResponse == null) + throw new Exception("No Workflow Written to database"); + + String expectedBody = new String( + Files.readAllBytes(Paths.get("src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn"))); + assertEquals(actualResponse.getArtifactChecksum(), "ZjUzNjg1NDMyMTc4MWJmZjFlNDcyOGQ0Zjc1YWQwYzQ\u003d"); + assertEquals(actualResponse.getArtifactName(), "TestWF2-1_0.bpmn"); + assertEquals(actualResponse.getDescription(), "Workflow Artifact Description"); + assertEquals(actualResponse.getBody(), expectedBody); + + Workflow shouldNotBeFound = workflowRepo.findByArtifactUUID("f27066a1-c3a7-4672-b02e-1251b74b7b71"); + assertNull(shouldNotBeFound); + } + + @Test public void invokeASDCStatusDataNullTest() { String request = ""; + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); Response response = asdcRestInterface.invokeASDCStatusData(request); assertNull(response); } - - protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java index 6efb04fc35..7071a68a23 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -81,7 +81,7 @@ public class BpmnInstallerTest { public void buildMimeMultiPart_Test() throws Exception { Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn"); Files.createFile(tempFilePath); - HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn"); + HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn", ""); String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt"; File mimeMultipartBody = new File(mimeMultipartBodyFilePath); @@ -99,7 +99,7 @@ public class BpmnInstallerTest { HttpClient httpClient = mock(HttpClient.class); doReturn(response).when(httpClient).execute(any(HttpPost.class)); bpmnInstallerSpy.installBpmn(TEST_CSAR); - verify(bpmnInstallerSpy, times(1)).sendDeploymentRequest(anyString()); + verify(bpmnInstallerSpy, times(1)).sendDeploymentRequest(anyString(), anyString()); } @Test diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java new file mode 100644 index 0000000000..e655245c31 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/WorkflowResourceTest.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc.installer.bpmn; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import javax.transaction.Transactional; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.onap.sdc.api.notification.IArtifactInfo; + +@Transactional +public class WorkflowResourceTest { + + private WorkflowResource workflowResource = new WorkflowResource(); + + private static final String TEST_CSAR = "src/test/resources/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar"; + private Path tempDirectoryPath; + + @Test + public void getActivityNameList_Test() throws Exception { + String bpmnContent = new String(Files + .readAllBytes(Paths.get("src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn"))); + List<String> activityNames = workflowResource.getActivityNameList(bpmnContent); + assertEquals("VNFSetInMaintFlagActivity", activityNames.get(0)); + } + + @Test + public void getWorkflowNameStandard_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2-1_0.bpmn"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowNameNoVersion_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2.bpmn"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowNameNoSuffix_Test() { + String workflowName = workflowResource.getWorkflowNameFromArtifactName("TestWF2-1_0"); + assertEquals("TestWF2", workflowName); + } + + @Test + public void getWorkflowVersionStandard_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2-1_0.bpmn"); + assertTrue(workflowVersion == 1.0); + } + + @Test + public void getWorkflowVersionNoVersion_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2.bpmn"); + assertNull(workflowVersion); + } + + @Test + public void getWorkflowVersionNoSuffix_Test() { + Double workflowVersion = workflowResource.getWorkflowVersionFromArtifactName("TestWF2-1_0"); + assertTrue(workflowVersion == 1.0); + } + +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index d3c0bdef66..ce70a252c9 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -20,26 +20,24 @@ package org.onap.so.asdc.installer.heat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.sdc.api.notification.IResourceInstance; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; @@ -58,13 +56,17 @@ import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; +import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.util.ReflectionTestUtils; + public class ToscaResourceInstallerTest extends BaseTest { @Autowired @@ -99,6 +101,8 @@ public class ToscaResourceInstallerTest extends BaseTest { private ISdcCsarHelper csarHelper; @Mock private StatefulEntityType entityType; + @Mock + private Service service; private NotificationDataImpl notificationData; private JsonStatusData statusData; @@ -350,8 +354,9 @@ public class ToscaResourceInstallerTest extends BaseTest { public void getConfigurationResourceCustomizationTest() { prepareConfigurationResourceCustomization(); - ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller - .getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, spResourceCustomization); + ConfigurationResourceCustomization configurationResourceCustomization = + toscaInstaller.getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, + spResourceCustomization, service); assertNotNull(configurationResourceCustomization); assertNotNull(configurationResourceCustomization.getConfigurationResource()); assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, @@ -359,16 +364,34 @@ public class ToscaResourceInstallerTest extends BaseTest { } @Test - public void getVnrNodeTemplateTest() { - prepareConfigurationResourceCustomization(); - List<NodeTemplate> nodeTemplateList = new ArrayList<>(); - doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType(); - doReturn(entityType).when(nodeTemplate).getTypeDefinition(); - nodeTemplateList.add(nodeTemplate); - Optional<ConfigurationResourceCustomization> vnrResourceCustomization = - toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization); - assertTrue(vnrResourceCustomization.isPresent()); - assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType()); + public void correlateConfigCustomResourcesTest() { + ConfigurationResource vrfConfigResource = mock(ConfigurationResource.class); + ConfigurationResourceCustomization vrfConfigCustom = mock(ConfigurationResourceCustomization.class); + doReturn(ToscaResourceInstaller.NODES_VRF_ENTRY).when(vrfConfigResource).getToscaNodeType(); + doReturn(vrfConfigResource).when(vrfConfigCustom).getConfigurationResource(); + + ConfigurationResource vnrConfigResource = mock(ConfigurationResource.class); + ConfigurationResourceCustomization vnrConfigCustom = mock(ConfigurationResourceCustomization.class); + doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(vnrConfigResource).getToscaNodeType(); + doReturn(vnrConfigResource).when(vnrConfigCustom).getConfigurationResource(); + + ConfigurationResourceCustomizationRepository configCustomizationRepo = + spy(ConfigurationResourceCustomizationRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "configCustomizationRepo", configCustomizationRepo); + doReturn(vrfConfigCustom).when(configCustomizationRepo).save(vrfConfigCustom); + doReturn(vnrConfigCustom).when(configCustomizationRepo).save(vnrConfigCustom); + + List<ConfigurationResourceCustomization> configList = new ArrayList<>(); + configList.add(vrfConfigCustom); + configList.add(vnrConfigCustom); + doReturn(configList).when(service).getConfigurationCustomizations(); + + toscaInstaller.correlateConfigCustomResources(service); + verify(vrfConfigCustom, times(1)).getConfigurationResource(); + verify(vrfConfigCustom, times(1)).setConfigResourceCustomization(vnrConfigCustom); + verify(service, times(1)).getConfigurationCustomizations(); + verify(vnrConfigCustom, times(1)).getConfigurationResource(); + verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom); } class MockConstants { @@ -381,5 +404,6 @@ public class ToscaResourceInstallerTest extends BaseTest { public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor"; public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0"; + } } diff --git a/asdc-controller/src/test/resources/ActivitySpec.json b/asdc-controller/src/test/resources/ActivitySpec.json new file mode 100644 index 0000000000..66e1b1355f --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpec.json @@ -0,0 +1,23 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "categoryList": [ + "VNF" + ], + "inputs": [ + { + "name": "parameter1", + "type": "string" + }, + { + "name": "parameter2", + "type": "string" + } + ], + "outputs": [ + { + "name": "parameter3", + "type": "string" + } + ] +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json new file mode 100644 index 0000000000..0864a2cba9 --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpecFromCatalog.json @@ -0,0 +1,41 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": [ + { + "activitySpecCategories": { + "name": "VNF" + } + } + ], + "activitySpecActivitySpecParameters": [ + { + "activitySpecParameters": { + "name": "parameter1", + "type": "string", + "direction": "input", + "description": "Parameter 1" + } + }, + { + "activitySpecParameters": { + "name": "parameter2", + "type": "string", + "direction": "input", + "description": "Parameter 2" + } + }, + { + "activitySpecParameters": { + "name": "parameter3", + "type": "string", + "direction": "output", + "description": "Parameter 3" + } + } + ] + +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/ActivitySpecList.json b/asdc-controller/src/test/resources/ActivitySpecList.json new file mode 100644 index 0000000000..c3530a2e7e --- /dev/null +++ b/asdc-controller/src/test/resources/ActivitySpecList.json @@ -0,0 +1,398 @@ +{ + "activitySpecList": [ + { + "activitySpec": { + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null + } + ] +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml index ec536491a1..9fa20550db 100644 --- a/asdc-controller/src/test/resources/application-test.yaml +++ b/asdc-controller/src/test/resources/application-test.yaml @@ -66,6 +66,7 @@ mso: db: spring: endpoint: "http://localhost:" + camundaURL: http://localhost:${wiremock.server.port}/ db: auth: Basic YnBlbDptc28tZGItMTUwNyE= site-name: siteName diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql index 7cd972ca63..47e6c4c982 100644 --- a/asdc-controller/src/test/resources/data.sql +++ b/asdc-controller/src/test/resources/data.sql @@ -22,6 +22,196 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES ('SRIOV_PROVIDER_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); +insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values +('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); + +insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values +('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); + +insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values +('ff2ae348-214a-11e7-93ae-92361f002671', '1'); + +insert into activity_spec(name, description, version) values +('testActivity1', 'Test Activity 1', 1.0); + +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')); + --------START Request DB INSERTS -------- insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS,LOCK_VERSION) values @@ -61,4 +251,4 @@ insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, DISTRIBUTION_NOTIFICATION, CONSUMER_ID) values ('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671', NULL, NULL), -('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL); +('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL);
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn new file mode 100644 index 0000000000..f3a5c7cc68 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestBpmnFromSDC.bpmn @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="customWorkflowtest1" name="TestBpmnFromSDC" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_0wtabee"> + <bpmn2:outgoing>SequenceFlow_1v7ptqz</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:serviceTask id="Task_1kxbei4" name="VNFSetInMaintFlagActivity" implementation="activity:VNFSetInMaintFlagActivity" camunda:expression="${ExecuteActivity.execute(execution)}"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1v7ptqz</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_16i7mid</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0tgyvzw"> + <bpmn2:incoming>SequenceFlow_16i7mid</bpmn2:incoming> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_16i7mid" sourceRef="Task_1kxbei4" targetRef="IntermediateThrowEvent_0tgyvzw" /> + <bpmn2:sequenceFlow id="SequenceFlow_1v7ptqz" sourceRef="StartEvent_0wtabee" targetRef="Task_1kxbei4" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="customWorkflowtest1"> + <bpmndi:BPMNShape id="StartEvent_0wtabee_di" bpmnElement="StartEvent_0wtabee"> + <dc:Bounds x="256" y="134" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cgg6ym_di" bpmnElement="Task_1kxbei4" bioc:fill="white"> + <dc:Bounds x="386" y="112" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0tgyvzw_di" bpmnElement="IntermediateThrowEvent_0tgyvzw"> + <dc:Bounds x="536" y="134" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_16i7mid_di" bpmnElement="SequenceFlow_16i7mid"> + <di:waypoint x="486" y="152" /> + <di:waypoint x="536" y="152" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1v7ptqz_di" bpmnElement="SequenceFlow_1v7ptqz"> + <di:waypoint x="292" y="152" /> + <di:waypoint x="386" y="152" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn new file mode 100644 index 0000000000..11378cfbb6 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/TestWF2-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:endEvent id="EndEvent_1naezi3" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2"> + <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3"> + <dc:Bounds x="219" y="285" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn new file mode 100644 index 0000000000..4e21a47a27 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf" name="TestWF" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_1loupvi" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf"> + <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi"> + <dc:Bounds x="274" y="212" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn new file mode 100644 index 0000000000..e54d79aee4 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf" name="TestWF" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:startEvent id="StartEvent_1loupvi" /> + <bpmn2:startEvent id="StartEvent_0z42dnp" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf"> + <bpmndi:BPMNShape id="StartEvent_1loupvi_di" bpmnElement="StartEvent_1loupvi"> + <dc:Bounds x="274" y="212" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0z42dnp_di" bpmnElement="StartEvent_0z42dnp"> + <dc:Bounds x="454" y="364" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn new file mode 100644 index 0000000000..11378cfbb6 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="testwf2" name="TestWF2" isExecutable="true"> + <bpmn2:extensionElements> + <camunda:inputOutput /> + </bpmn2:extensionElements> + <bpmn2:endEvent id="EndEvent_1naezi3" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="testwf2"> + <bpmndi:BPMNShape id="EndEvent_1naezi3_di" bpmnElement="EndEvent_1naezi3"> + <dc:Bounds x="219" y="285" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar Binary files differnew file mode 100644 index 0000000000..fe99318fe3 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-Testparentservice-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json new file mode 100644 index 0000000000..9f49be5bbb --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/workflow-distribution.json @@ -0,0 +1,76 @@ +{ + "distributionID": "48cc0f04-1d42-4fb4-a5ab-9fa62f8d64c1", + "serviceName": "TestParentService", + "serviceVersion": "1.0", + "serviceUUID": "2f55da47-c58a-453e-909f-172c94765fba", + "serviceDescription": "TestParentService", + "serviceInvariantUUID": "13b817ae-6388-40cf-9261-1619b607f1de", + "resources": [ + { + "resourceInstanceName": "TestVF 0", + "resourceName": "TestVF", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5185253e-4bef-4eb4-bbf9-8c328c787ebd", + "resourceInvariantUUID": "ea8264db-3e24-4324-87cc-12c6903ed43d", + "resourceCustomizationUUID": "a959a3cb-4988-435c-9cb7-5a40ef2ef2ac", + "category": "Allotted Resource", + "subcategory": "Contrail Route", + "artifacts": [ + { + "artifactName": "TestWF2-1_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF2-1_0.bpmn", + "artifactChecksum": "ZjUzNjg1NDMyMTc4MWJmZjFlNDcyOGQ0Zjc1YWQwYzQ\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "a90f8eaa-7c20-422f-8c81-aacbca6fb9e7", + "artifactVersion": "1" + }, + { + "artifactName": "TestWF-1_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-1_0.bpmn", + "artifactChecksum": "YzA4NDY3M2E3Njk3Y2FjMmViZjRlODIzNTY1NDY3MDY\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "f27066a1-c3a7-4672-b02e-1251b74b7b71", + "artifactVersion": "1" + }, + { + "artifactName": "TestWF-2_0.bpmn", + "artifactType": "WORKFLOW", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/resourceInstances/testvf0/artifacts/TestWF-2_0.bpmn", + "artifactChecksum": "MTE0MDA2ZGNjZmY3YWEyNzNlNjUwZDQ2OGU4YTM5ZjU\u003d", + "artifactDescription": "Workflow Artifact Description", + "artifactTimeout": 120, + "artifactUUID": "f51d2203-d1f5-43f1-9492-e59d12facb8f", + "artifactVersion": "1" + } + ] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Testparentservice-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/sdc/v1/catalog/services/Testparentservice/1.0/artifacts/service-Testparentservice-template.yml", + "artifactChecksum": "YWZlYWMwMjNkODBlYTI2MzZlNjg3YzEzODZiNzNkNTg\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "8ec96c3f-d527-48bd-8dc5-1e7682bda676", + "artifactVersion": "1" + }, + { + "artifactName": "service-Testparentservice-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "service-Testparentservice-csar.csar", + "artifactChecksum": "MTc4OWU0MGRhOTE4OGZiM2JiMjM3YmI3NzI2YWZjNjI\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "8dac522d-8e00-4794-819e-88e559ebc170", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.env b/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.env new file mode 100644 index 0000000000..f490db5249 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.env @@ -0,0 +1,38 @@ +parameters: + cloud_env: "openstack" + dcae_collector_ip: "10.0.4.1" + dcae_collector_port: "30235" + demo_artifacts_version: "1.4.0-SNAPSHOT" + install_script_version: "1.4.0-SNAPSHOT" + key_name: "vfw_key" + nexus_artifact_repo: "https://nexus.onap.org" + onap_private_net_cidr: "10.0.0.0/16" + onap_private_net_id: "PUT THE ONAP PRIVATE NETWORK NAME HERE" + onap_private_subnet_id: "PUT THE ONAP PRIVATE NETWORK NAME HERE" + protected_private_net_cidr: "192.168.20.0/24" + protected_private_net_id: "zdfw1fwl01_protected" + pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN" + public_net_id: "PUT THE PUBLIC NETWORK ID HERE" + sec_group: "PUT THE ONAP SECURITY GROUP HERE" + unprotected_private_net_cidr: "192.168.10.0/24" + unprotected_private_net_id: "zdfw1fwl01_unprotected" + vf_module_id: "vFirewall" + vfw_flavor_name: "PUT THE VM FLAVOR NAME HERE (m1.medium suggested)" + vfw_image_name: "PUT THE VM IMAGE NAME HERE (UBUNTU 1404 required)" + vfw_int_protected_private_floating_ip: "192.168.10.200" + vfw_int_protected_private_ip_0: "192.168.20.100" + vfw_int_unprotected_private_ip_0: "192.168.10.100" + vfw_name_0: "zdfw1fwl01fwl01" + vfw_onap_private_ip_0: "10.0.100.1" + vnf_id: "vFirewall_demo_app" + vnf_name: "vFW" + vpg_flavor_name: "PUT THE VM FLAVOR NAME HERE (m1.medium suggested)" + vpg_image_name: "PUT THE VM IMAGE NAME HERE (UBUNTU 1404 required)" + vpg_int_unprotected_private_ip_0: "192.168.10.200" + vpg_name_0: "zdfw1fwl01pgn01" + vpg_onap_private_ip_0: "10.0.100.2" + vsn_flavor_name: "PUT THE VM FLAVOR NAME HERE (m1.medium suggested)" + vsn_image_name: "PUT THE VM IMAGE NAME HERE (UBUNTU 1404 required)" + vsn_int_protected_private_ip_0: "192.168.20.250" + vsn_name_0: "zdfw1fwl01snk01" + vsn_onap_private_ip_0: "10.0.100.3" diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.yaml b/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.yaml new file mode 100644 index 0000000000..6137e8ab8b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vFW/base_vfw.yaml @@ -0,0 +1,491 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==================LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +########################################################################## + +heat_template_version: 2013-05-23 + +description: Heat template that deploys vFirewall demo app for ONAP + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vfw_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vfw_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + vpg_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vpg_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + vsn_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vsn_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + public_net_id: + type: string + label: Public network name or ID + description: Public network that enables remote connection to VNF + unprotected_private_net_id: + type: string + label: Unprotected private network name or ID + description: Private network that connects vPacketGenerator with vFirewall + protected_private_net_id: + type: string + label: Protected private network name or ID + description: Private network that connects vFirewall with vSink + onap_private_net_id: + type: string + label: ONAP management network name or ID + description: Private network that connects ONAP components and the VNF + onap_private_subnet_id: + type: string + label: ONAP management sub-network name or ID + description: Private sub-network that connects ONAP components and the VNF + unprotected_private_net_cidr: + type: string + label: Unprotected private network CIDR + description: The CIDR of the unprotected private network + protected_private_net_cidr: + type: string + label: Protected private network CIDR + description: The CIDR of the protected private network + onap_private_net_cidr: + type: string + label: ONAP private network CIDR + description: The CIDR of the protected private network + vfw_int_unprotected_private_ip_0: + type: string + label: vFirewall private IP address towards the unprotected network + description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator + vfw_int_protected_private_ip_0: + type: string + label: vFirewall private IP address towards the protected network + description: Private IP address that is assigned to the vFirewall to communicate with the vSink + vfw_onap_private_ip_0: + type: string + label: vFirewall private IP address towards the ONAP management network + description: Private IP address that is assigned to the vFirewall to communicate with ONAP components + vfw_int_protected_private_floating_ip: + type: string + label: same value as vpg_int_unprotected_private_ip_0 + description: IP to inform OpenStack to enable vfw protected private port to allow packets coming from the packet generator + vpg_int_unprotected_private_ip_0: + type: string + label: vPacketGenerator private IP address towards the unprotected network + description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall + vpg_onap_private_ip_0: + type: string + label: vPacketGenerator private IP address towards the ONAP management network + description: Private IP address that is assigned to the vPacketGenerator to communicate with ONAP components + vsn_int_protected_private_ip_0: + type: string + label: vSink private IP address towards the protected network + description: Private IP address that is assigned to the vSink to communicate with the vFirewall + vsn_onap_private_ip_0: + type: string + label: vSink private IP address towards the ONAP management network + description: Private IP address that is assigned to the vSink to communicate with ONAP components + vfw_name_0: + type: string + label: vFirewall name + description: Name of the vFirewall + vpg_name_0: + type: string + label: vPacketGenerator name + description: Name of the vPacketGenerator + vsn_name_0: + type: string + label: vSink name + description: Name of the vSink + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vnf_name: + type: string + label: VNF NAME + description: The VNF NAME is provided by ONAP + vf_module_id: + type: string + label: vFirewall module ID + description: The vFirewall Module ID is provided by ONAP + dcae_collector_ip: + type: string + label: DCAE collector IP address + description: IP address of the DCAE collector + dcae_collector_port: + type: string + label: DCAE collector port + description: Port of the DCAE collector + key_name: + type: string + label: Key pair name + description: Public/Private key pair name + pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + install_script_version: + type: string + label: Installation script version number + description: Version number of the scripts that install the vFW demo app + demo_artifacts_version: + type: string + label: Artifacts version used in demo vnfs + description: Artifacts (jar, tar.gz) version used in demo vnfs + nexus_artifact_repo: + type: string + description: Root URL for the Nexus repository for Maven artifacts. + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + sec_group: + type: string + description: ONAP Security Group + +############# +# # +# RESOURCES # +# # +############# + +resources: + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: vnfname_base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + vnfname: { get_param: vnf_name } + public_key: { get_param: pub_key } + save_private_key: false + + # NETWORK_ROLE: unprotected_private + # NETWORK_TYPE: internal + int_unprotected_private_network: + type: OS::Neutron::Net + properties: + name: + str_replace: + template: vnfname_netid + params: + netid: { get_param: unprotected_private_net_id } + vnfname: { get_param: vnf_name } + + # NETWORK_ROLE: protected_private + # NETWORK_TYPE: internal + int_protected_private_network: + type: OS::Neutron::Net + properties: + name: + str_replace: + template: vnfname_netid + params: + netid: { get_param: protected_private_net_id } + vnfname: { get_param: vnf_name } + + # NETWORK_ROLE: unprotected_private + # NETWORK_TYPE: internal + int_unprotected_private_subnet: + type: OS::Neutron::Subnet + properties: + network: { get_resource: int_unprotected_private_network } + cidr: { get_param: unprotected_private_net_cidr } + + # NETWORK_ROLE: protected_private + # NETWORK_TYPE: internal + int_protected_private_subnet: + type: OS::Neutron::Subnet + properties: + network: { get_resource: int_protected_private_network } + cidr: { get_param: protected_private_net_cidr } + + ### Virtual Firewall instantiation ### + + # VM_TYPE: vfw + # NETWORK_ROLE: protected_private + # NETWORK_TYPE: internal + vfw_0_int_unprotected_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_resource: int_unprotected_private_network } + fixed_ips: [{"subnet": { get_resource: int_unprotected_private_subnet }, "ip_address": { get_param: vfw_int_unprotected_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + # VM_TYPE: vfw + # NETWORK_ROLE: protected_private + # NETWORK_TYPE: internal + vfw_0_int_protected_private_port_0: + type: OS::Neutron::Port + properties: + allowed_address_pairs: [{ "ip_address": { get_param: vfw_int_protected_private_floating_ip }}] + network: { get_resource: int_protected_private_network } + fixed_ips: [{"subnet": { get_resource: int_protected_private_subnet }, "ip_address": { get_param: vfw_int_protected_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + # VM_TYPE: vfw + # NETWORK_ROLE: onap_private + # NETWORK_TYPE: external + vfw_0_onap_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vfw_onap_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + # VM_TYPE: vfw + vfw_server_0: + type: OS::Nova::Server + properties: + image: { get_param: vfw_image_name } + flavor: { get_param: vfw_flavor_name } + name: { get_param: vfw_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vfw_0_int_unprotected_private_port_0 } + - port: { get_resource: vfw_0_int_protected_private_port_0 } + - port: { get_resource: vfw_0_onap_private_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + user_data_format: RAW + user_data: + str_replace: + params: + __dcae_collector_ip__ : { get_param: dcae_collector_ip } + __dcae_collector_port__ : { get_param: dcae_collector_port } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __vfw_private_ip_0__ : { get_param: vfw_int_unprotected_private_ip_0 } + __vfw_private_ip_1__ : { get_param: vfw_int_protected_private_ip_0 } + __vfw_private_ip_2__ : { get_param: vfw_onap_private_ip_0 } + __unprotected_private_net_cidr__ : { get_param: unprotected_private_net_cidr } + __protected_private_net_cidr__ : { get_param: protected_private_net_cidr } + __onap_private_net_cidr__ : { get_param: onap_private_net_cidr } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt + echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__vfw_private_ip_0__" > /opt/config/vfw_private_ip_0.txt + echo "__vfw_private_ip_1__" > /opt/config/vfw_private_ip_1.txt + echo "__vfw_private_ip_2__" > /opt/config/vfw_private_ip_2.txt + echo "__unprotected_private_net_cidr__" > /opt/config/unprotected_private_net_cidr.txt + echo "__protected_private_net_cidr__" > /opt/config/protected_private_net_cidr.txt + echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vfw&a=vfw-scripts&e=zip&v=__install_script_version__" -o /opt/vfw-scripts-__install_script_version__.zip + unzip -j /opt/vfw-scripts-__install_script_version__.zip -d /opt v_firewall_install.sh + cd /opt + chmod +x v_firewall_install.sh + ./v_firewall_install.sh + + + ### Virtual Packet Generator instantiation ### + + vpg_0_int_unprotected_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_resource: int_unprotected_private_network } + fixed_ips: [{"subnet": { get_resource: int_unprotected_private_subnet }, "ip_address": { get_param: vpg_int_unprotected_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + vpg_0_onap_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_onap_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + vpg_server_0: + type: OS::Nova::Server + properties: + image: { get_param: vpg_image_name } + flavor: { get_param: vpg_flavor_name } + name: { get_param: vpg_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vpg_0_int_unprotected_private_port_0 } + - port: { get_resource: vpg_0_onap_private_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + user_data_format: RAW + user_data: + str_replace: + params: + __fw_ipaddr__: { get_param: vfw_int_unprotected_private_ip_0 } + __protected_net_cidr__: { get_param: protected_private_net_cidr } + __sink_ipaddr__: { get_param: vsn_int_protected_private_ip_0 } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __vpg_private_ip_0__ : { get_param: vpg_int_unprotected_private_ip_0 } + __vpg_private_ip_1__ : { get_param: vpg_onap_private_ip_0 } + __unprotected_private_net_cidr__ : { get_param: unprotected_private_net_cidr } + __onap_private_net_cidr__ : { get_param: onap_private_net_cidr } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__fw_ipaddr__" > /opt/config/fw_ipaddr.txt + echo "__protected_net_cidr__" > /opt/config/protected_net_cidr.txt + echo "__sink_ipaddr__" > /opt/config/sink_ipaddr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__vpg_private_ip_0__" > /opt/config/vpg_private_ip_0.txt + echo "__vpg_private_ip_1__" > /opt/config/vpg_private_ip_1.txt + echo "__unprotected_private_net_cidr__" > /opt/config/unprotected_private_net_cidr.txt + echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vfw&a=vfw-scripts&e=zip&v=__install_script_version__" -o /opt/vfw-scripts-__install_script_version__.zip + unzip -j /opt/vfw-scripts-__install_script_version__.zip -d /opt v_packetgen_install.sh + cd /opt + chmod +x v_packetgen_install.sh + ./v_packetgen_install.sh + + + ### Virtual Sink instantiation ### + + vsn_0_int_protected_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_resource: int_protected_private_network } + fixed_ips: [{"subnet": { get_resource: int_protected_private_subnet }, "ip_address": { get_param: vsn_int_protected_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + vsn_0_onap_private_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vsn_onap_private_ip_0 }}] + security_groups: + - { get_param: sec_group } + + vsn_server_0: + type: OS::Nova::Server + properties: + image: { get_param: vsn_image_name } + flavor: { get_param: vsn_flavor_name } + name: { get_param: vsn_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vsn_0_int_protected_private_port_0 } + - port: { get_resource: vsn_0_onap_private_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + user_data_format: RAW + user_data: + str_replace: + params: + __protected_net_gw__: { get_param: vfw_int_protected_private_ip_0 } + __unprotected_net__: { get_param: unprotected_private_net_cidr } + __install_script_version__ : { get_param: install_script_version } + __vsn_private_ip_0__ : { get_param: vsn_int_protected_private_ip_0 } + __vsn_private_ip_1__ : { get_param: vsn_onap_private_ip_0 } + __protected_private_net_cidr__ : { get_param: protected_private_net_cidr } + __onap_private_net_cidr__ : { get_param: onap_private_net_cidr } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__protected_net_gw__" > /opt/config/protected_net_gw.txt + echo "__unprotected_net__" > /opt/config/unprotected_net.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__vsn_private_ip_0__" > /opt/config/vsn_private_ip_0.txt + echo "__vsn_private_ip_1__" > /opt/config/vsn_private_ip_1.txt + echo "__protected_private_net_cidr__" > /opt/config/protected_private_net_cidr.txt + echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vfw&a=vfw-scripts&e=zip&v=__install_script_version__" -o /opt/vfw-scripts-__install_script_version__.zip + unzip -j /opt/vfw-scripts-__install_script_version__.zip -d /opt v_sink_install.sh + cd /opt + chmod +x v_sink_install.sh + ./v_sink_install.sh diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/notification.json b/asdc-controller/src/test/resources/resource-examples/vFW/notification.json new file mode 100644 index 0000000000..4e93df510b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vFW/notification.json @@ -0,0 +1,80 @@ +{ + "distributionID": "3d1c9f3c-550e-41c3-bfb6-800f8274a40c", + "resources": [ + { + "artifacts": [ + { + "artifactChecksum": "NDg0ZDJjYTIzNDhlZmFkZjRjMzM5MTkzOGFhZTU5ZjI=", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactName": "vfw1f52feb055020_modules.json", + "artifactTimeout": 120, + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "vfw1f52feb055020_modules.json", + "artifactUUID": "7ff1c5cb-8ca1-43b1-8f97-05c0d8c879ec", + "artifactVersion": "1", + "relatedArtifactsInfo": [] + }, + { + "artifactChecksum": "MDQyYTIxMTlhZDdlMzdiNjBjNjdjZTFhMWE0NThmMzc=", + "artifactDescription": "created from csar", + "artifactName": "base_vfw.yaml", + "artifactTimeout": 120, + "artifactType": "HEAT", + "artifactURL": "base_vfw.yaml", + "artifactUUID": "4f0b1b88-09ab-43b9-9506-57de3c69433a", + "artifactVersion": "2", + "generatedArtifact": { + "artifactChecksum": "MjQ2YWIxOTY2M2E0ZjAzMTI4NjVkNWZkZGRmM2VmMGI=", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactName": "base_vfw.env", + "artifactTimeout": 120, + "artifactType": "HEAT_ENV", + "artifactURL": "base_vfw.env", + "artifactUUID": "005bc362-b40f-4c54-82bc-2716147f9c3a", + "artifactVersion": "2", + "generatedFromUUID": "4f0b1b88-09ab-43b9-9506-57de3c69433a" + }, + "relatedArtifactsInfo": [] + }, + { + "artifactChecksum": "MjQ2YWIxOTY2M2E0ZjAzMTI4NjVkNWZkZGRmM2VmMGI=", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactName": "base_vfw.env", + "artifactTimeout": 120, + "artifactType": "HEAT_ENV", + "artifactURL": "base_vfw.env", + "artifactUUID": "005bc362-b40f-4c54-82bc-2716147f9c3a", + "artifactVersion": "2", + "relatedArtifactsInfo": [] + } + ], + "category": "Generic", + "resourceType": "VF", + "resourceCustomizationUUID": "0451bf8d-49e1-4f7f-960f-2e24f27c9f42", + "resourceInstanceName": "vFW 1f52feb0-5502 0", + "resourceInvariantUUID": "459f18ec-aaee-40d1-8fae-60fec2aae37f", + "resourceName": "vFW 1f52feb0-5502", + "resourceUUID": "1b1346cb-bf0b-4097-9d1b-5a041c536897", + "resourceVersion": "1.0", + "subcategory": "Abstract" + } + ], + "serviceArtifacts": [ + { + "artifactChecksum": "YWNkZTJmYmVmYTg0NTdjMzg0MjVjZTliOTRiYTQ5YjM=", + "artifactDescription": "TOSCA definition package of the asset", + "artifactName": "service-Vfw20190410215305-csar.csar", + "artifactTimeout": 0, + "artifactType": "TOSCA_CSAR", + "artifactURL": "service-Vfw.csar", + "artifactUUID": "f4fcb0ba-40d3-46d2-819e-3b69eda88fcf", + "artifactVersion": "1" + } + ], + "serviceDescription": "catalog service description", + "serviceInvariantUUID": "3164f9ff-d7e7-4813-ab32-6be7e1cacb18", + "serviceName": "vFW 2019-04-10 21:53:05", + "serviceUUID": "e16e4ed9-3429-423a-bc3c-1389ae91491c", + "serviceVersion": "1.0", + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar Binary files differnew file mode 100644 index 0000000000..fe0b9f3131 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/vfw1f52feb055020_modules.json b/asdc-controller/src/test/resources/resource-examples/vFW/vfw1f52feb055020_modules.json new file mode 100644 index 0000000000..944adbd0d2 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vFW/vfw1f52feb055020_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "Vfw1f52feb05502..base_vfw..module-0", + "vfModuleModelInvariantUUID": "062e75f9-ccbd-4946-8d31-92118efac741", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "3f99a421-abd0-4e5e-a9e4-3b9b8464ddb6", + "vfModuleModelCustomizationUUID": "12c7bf93-9021-41cf-8c65-86856cfab11d", + "isBase": true, + "artifacts": [ + "4f0b1b88-09ab-43b9-9506-57de3c69433a", + "005bc362-b40f-4c54-82bc-2716147f9c3a" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "base_vfw", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 2db2dfb5bf..8cc5ee9d49 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -1,7 +1,6 @@ --------START Catalog DB SCHEMA -------- use catalogdb; - set foreign_key_checks=0; DROP TABLE IF EXISTS `allotted_resource`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -284,6 +283,7 @@ DROP TABLE IF EXISTS `configuration_customization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, @@ -292,27 +292,18 @@ CREATE TABLE `configuration_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), - KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), - CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `configuration_customization_to_service` --- - -DROP TABLE IF EXISTS `configuration_customization_to_service`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `configuration_customization_to_service` ( - `SERVICE_MODEL_UUID` varchar(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + `SERVICE_MODEL_UUID` varchar(200), + PRIMARY KEY (`ID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_idx` (`SERVICE_MODEL_UUID`), + UNIQUE KEY `uk_configuration_customization` (`MODEL_CUSTOMIZATION_UUID` ASC, `SERVICE_MODEL_UUID` ASC), + CONSTRAINT `fk_configuration_customization__configuration1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_customization__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1170,7 +1161,7 @@ CREATE TABLE `vnfc_instance_group_customization` ( set foreign_key_checks=1; CREATE TABLE IF NOT EXISTS `pnf_resource` ( - `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL, `DESCRIPTION` varchar(1200) DEFAULT NULL, `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `MODEL_UUID` varchar(200) NOT NULL, @@ -1205,9 +1196,173 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( `SERVICE_MODEL_UUID` varchar(200) NOT NULL, `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, - PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) )ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `workflow` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `ARTIFACT_UUID` varchar(200) NOT NULL, + `ARTIFACT_NAME` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `OPERATION_NAME` varchar(200) DEFAULT NULL, + `VERSION` double NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext DEFAULT NULL, + `RESOURCE_TARGET` varchar(200) NOT NULL, + `SOURCE` varchar(200) NOT NULL, + `TIMEOUT_MINUTES` int(11) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `WORKFLOW_ID` int(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_vnf_resource_to_workflow` (`VNF_RESOURCE_MODEL_UUID`,`WORKFLOW_ID`), + KEY `fk_vnf_resource_to_workflow__workflow1_idx` (`WORKFLOW_ID`), + KEY `fk_vnf_resource_to_workflow__vnf_res_mod_uuid_idx` (`VNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_vnf_resource_to_workflow__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NOT NULL, + `VERSION` DOUBLE NOT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec` (`NAME` ASC, `VERSION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `user_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `PAYLOAD_LOCATION` VARCHAR(500) NULL, + `LABEL` VARCHAR(200) NOT NULL, + `TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `IS_REQUIRED` TINYINT(1) NOT NULL, + `MAX_LENGTH` INT(11) NULL, + `ALLOWABLE_CHARS` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_user_parameters` (`NAME` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `workflow_activity_spec_sequence` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `WORKFLOW_ID` INT(11) NOT NULL, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `SEQ_NO` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_workflow_activity_spec_sequence` (`WORKFLOW_ID` ASC, `ACTIVITY_SPEC_ID` ASC, `SEQ_NO` ASC), + INDEX `fk_workflow_activity_spec_sequence__activity_spec_idx` (`ACTIVITY_SPEC_ID` ASC), + INDEX `fk_workflow_activity_spec_sequence__workflow_actifact_uuid_idx` (`WORKFLOW_ID` ASC), + CONSTRAINT `fk_workflow_activity_spec_sequence__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1` + FOREIGN KEY (`WORKFLOW_ID`) + REFERENCES `workflow` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + `TYPE` VARCHAR(200) NOT NULL, + `DIRECTION` VARCHAR(200) NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_parameters` (`NAME` ASC, `DIRECTION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_categories` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `NAME` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_categories` ( + `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`), + UNIQUE INDEX `UK_activity_spec_to_activity_spec_categories` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_CATEGORIES_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx` (`ACTIVITY_SPEC_CATEGORIES_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx1` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec_c1` + FOREIGN KEY (`ACTIVITY_SPEC_CATEGORIES_ID`) + REFERENCES `activity_spec_categories` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_activity_spec_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `ACTIVITY_SPEC_PARAMETERS_ID` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_activity_spec_to_activity_spec_params__act_sp_param_id_idx` (`ACTIVITY_SPEC_PARAMETERS_ID` ASC), + UNIQUE INDEX `UK_activity_spec_to_activity_spec_parameters` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_activity_spec_parameters__act_spec_id_idx` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activity_spec_1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activ_spec_param1` + FOREIGN KEY (`ACTIVITY_SPEC_PARAMETERS_ID`) + REFERENCES `activity_spec_parameters` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `ACTIVITY_SPEC_ID` INT(11) NOT NULL, + `USER_PARAMETERS_ID` INT(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_activity_spec_to_user_parameters` (`ACTIVITY_SPEC_ID` ASC, `USER_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_user_parameters__user_parameters1_idx` (`USER_PARAMETERS_ID` ASC), + INDEX `fk_activity_spec_to_user_parameters__activity_spec1_idx` (`ACTIVITY_SPEC_ID` ASC), + CONSTRAINT `fk_activity_spec_to_user_parameters__activity_spec1` + FOREIGN KEY (`ACTIVITY_SPEC_ID`) + REFERENCES `activity_spec` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1` + FOREIGN KEY (`USER_PARAMETERS_ID`) + REFERENCES `user_parameters` (`ID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; @@ -1477,3 +1632,7 @@ create table if not exists model ( CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`), FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + + |