From 6a32a3f617190b70b3ef285834c9d928f73c2ab1 Mon Sep 17 00:00:00 2001 From: "Merkel, Jeff" Date: Sun, 5 May 2019 11:13:06 -0400 Subject: Check if InstanceGroup modelUUID already exists - Added code to check if InstanceGroup modelUUID already exists in DB. Change-Id: Ibf3bf27e6c0523df80adad6debafa2c2f3a337ec Issue-ID: SO-1845 Signed-off-by: Benjamin, Max (mb388a) --- .../installer/heat/ToscaResourceInstaller.java | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 4e97b5f290..6f3e6c2ec0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -85,6 +85,7 @@ import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatFiles; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.InstanceGroupType; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkInstanceGroup; @@ -1724,16 +1725,25 @@ public class ToscaResourceInstaller { VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) { Metadata instanceMetadata = group.getMetadata(); - // Populate InstanceGroup + + InstanceGroup existingInstanceGroup = + instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup(); - vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - vfcInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - vfcInstanceGroup.setToscaNodeType(group.getType()); - vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role - vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type + if (existingInstanceGroup == null) { + // Populate InstanceGroup + vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + vfcInstanceGroup + .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + vfcInstanceGroup.setToscaNodeType(group.getType()); + vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role + vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type + } else { + vfcInstanceGroup = (VFCInstanceGroup) existingInstanceGroup; + } // Populate VNFCInstanceGroupCustomization VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization(); -- cgit 1.2.3-korg From 4fd7200bce3e2addf45dfade43ed901674a82398 Mon Sep 17 00:00:00 2001 From: "Merkel, Jeff" Date: Sun, 5 May 2019 11:14:39 -0400 Subject: VFModule To HeatTemplateUUID - Set existing Heat files on the vfModuleArtifact. Change-Id: Ie01a7932115158dc974ab9ba89a8954a3e732e79 Issue-ID: SO-1846 Signed-off-by: Benjamin, Max (mb388a) --- .../org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 4e97b5f290..1a8026424a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1180,6 +1180,8 @@ public class ToscaResourceInstaller { vfModuleArtifact.getArtifactInfo().getArtifactUUID()); heatTemplate.setParameters(heatParam); vfModuleArtifact.setHeatTemplate(heatTemplate); + } else { + vfModuleArtifact.setHeatTemplate(existingHeatTemplate); } } @@ -1208,6 +1210,8 @@ public class ToscaResourceInstaller { heatEnvironment.setArtifactChecksum(MANUAL_RECORD); } vfModuleArtifact.setHeatEnvironment(heatEnvironment); + } else { + vfModuleArtifact.setHeatEnvironment(existingHeatEnvironment); } } @@ -1232,7 +1236,8 @@ public class ToscaResourceInstaller { heatFile.setArtifactChecksum(MANUAL_RECORD); } vfModuleArtifact.setHeatFiles(heatFile); - + } else { + vfModuleArtifact.setHeatFiles(existingHeatFiles); } } -- cgit 1.2.3-korg From 2fcd0d81688ca3dbde9c3853a0eca5aed9e4da7d Mon Sep 17 00:00:00 2001 From: Ramesh Parthasarathy Date: Thu, 16 May 2019 21:15:29 -0700 Subject: Addressed vCPE-Infra processing issue ASDC Controller code was modified to address vCPE-infra notification received from SDC. Also added unit tests to ensure that the code works as expected. Change-Id: I217e2dfed9548bfb0e9b93c96aaf75afc1d4171c Issue-ID: SO-1861 Signed-off-by: Ramesh Parthasarathy(rp6768) --- .../org/onap/so/asdc/client/ASDCController.java | 24 +- .../client/test/rest/ASDCRestInterfaceTest.java | 46 +++ asdc-controller/src/test/resources/data.sql | 2 + .../vcpe-infra/base_vcpe_infra.env | 37 ++ .../vcpe-infra/base_vcpe_infra.yaml | 460 +++++++++++++++++++++ .../vcpe-infra/demovcpeinfra-notification.json | 111 +++++ .../vcpe-infra/service-Demovcpeinfra-csar.csar | Bin 0 -> 115651 bytes .../vcpe_infrabf35304fe92f0_modules.json | 25 ++ .../vcpe-infra/vendor-license-model.xml | 1 + .../vcpe-infra/vf-license-model.xml | 1 + 10 files changed, 695 insertions(+), 12 deletions(-) create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 9597158cb6..c0f403f388 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -784,24 +784,24 @@ public class ASDCController { errorMessage = e.getMessage(); logger.error("Exception occurred", e); } + } - if (!hasVFResource) { + if (!hasVFResource) { - logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); + logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); - logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); - try { - this.deployResourceStructure(resourceStructure, toscaResourceStructure); - } catch (ArtifactInstallerException e) { - deployStatus = DistributionStatusEnum.DEPLOY_ERROR; - errorMessage = e.getMessage(); - logger.error("Exception occurred", e); - } + logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); + try { + this.deployResourceStructure(resourceStructure, toscaResourceStructure); + } catch (ArtifactInstallerException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + errorMessage = e.getMessage(); + logger.error("Exception occurred", e); } - this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus, - errorMessage); } + this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus, + errorMessage); } catch (ASDCDownloadException | UnsupportedEncodingException e) { logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), 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 ac107f6449..2c520a3bba 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 @@ -27,11 +27,15 @@ 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.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashSet; +import java.util.List; +import java.util.Optional; import java.util.Set; import javax.transaction.Transactional; import javax.ws.rs.core.Response; @@ -45,11 +49,15 @@ 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.NetworkResource; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ToscaCsar; 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.ToscaCsarRepository; import org.onap.so.db.catalog.data.repository.WorkflowRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -74,6 +82,9 @@ public class ASDCRestInterfaceTest extends BaseTest { @Autowired private WorkflowRepository workflowRepo; + @Autowired + private ToscaCsarRepository toscaCsarRepo; + @Autowired private ASDCRestInterface asdcRestInterface; @@ -244,6 +255,41 @@ public class ASDCRestInterfaceTest extends BaseTest { } + + @Test + public void test_Vcpe_Infra_Distribution() 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()))); + + String resourceLocation = "src/test/resources/resource-examples/vcpe-infra/"; + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demovcpeinfra-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity entity = new HttpEntity(request, headers); + + ResponseEntity response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional toscaCsar = toscaCsarRepo.findById("144606d8-a505-4ba0-90a9-6d1c6219fc6b"); + assertTrue(toscaCsar.isPresent()); + assertEquals("service-Demovcpeinfra-csar.csar", toscaCsar.get().getName()); + + Optional service = serviceRepo.findById("8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7"); + assertTrue(service.isPresent()); + assertEquals("demoVCPEInfra", service.get().getModelName()); + + Optional networkResource = networkRepo.findById("89789b26-a46b-4cee-aed0-d46e21f93a5e"); + assertTrue(networkResource.isPresent()); + assertEquals("Generic NeutronNet", networkResource.get().getModelName()); + } + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql index c9179fe65f..bc97b1e54a 100644 --- a/asdc-controller/src/test/resources/data.sql +++ b/asdc-controller/src/test/resources/data.sql @@ -21,6 +21,8 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_ ('TENANT_OAM_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); 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 temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES +('Generic NeutronNet', '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); diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env new file mode 100644 index 0000000000..85d3ea19a3 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env @@ -0,0 +1,37 @@ +parameters: + cloud_env: "PUT THE CLOUD PROVIDED HERE (openstack or rackspace)" + cpe_public_net_cidr: "10.2.0.0/24" + cpe_public_net_id: "zdfw1cpe01_public" + cpe_public_subnet_id: "zdfw1cpe01_sub_public" + cpe_signal_net_cidr: "10.4.0.0/24" + cpe_signal_net_id: "zdfw1cpe01_private" + cpe_signal_subnet_id: "zdfw1cpe01_sub_private" + dcae_collector_ip: "10.0.4.1" + dcae_collector_port: "8081" + demo_artifacts_version: "1.4.0" + install_script_version: "1.4.0" + key_name: "vaaa_key" + mr_ip_addr: "10.0.11.1" + mr_ip_port: "3904" + 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 SUBNETWORK NAME HERE" + pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN" + public_net_id: "PUT THE PUBLIC NETWORK ID HERE" + vaaa_name_0: "zdcpe1cpe01aaa01" + vaaa_private_ip_0: "10.4.0.4" + vaaa_private_ip_1: "10.0.101.2" + vcpe_flavor_name: "PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED)" + vcpe_image_name: "PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED)" + vdhcp_name_0: "zdcpe1cpe01dhcp01" + vdhcp_private_ip_0: "10.4.0.1" + vdhcp_private_ip_1: "10.0.101.1" + vdns_name_0: "zdcpe1cpe01dns01" + vdns_private_ip_0: "10.2.0.1" + vdns_private_ip_1: "10.0.101.3" + vf_module_id: "vCPE_Intrastructure" + vnf_id: "vCPE_Infrastructure_demo_app" + vweb_name_0: "zdcpe1cpe01web01" + vweb_private_ip_0: "10.2.0.10" + vweb_private_ip_1: "10.0.101.40" diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml new file mode 100644 index 0000000000..9f3bf27492 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml @@ -0,0 +1,460 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 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 to deploy vCPE Infrastructue emlements (vAAA, vDHCP, vDNS_DHCP, webServer) + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_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 + 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 + onap_private_net_cidr: + type: string + label: ONAP private network CIDR + description: The CIDR of the protected private network + cpe_signal_net_id: + type: string + label: vAAA private network name or ID + description: Private network that connects vAAA with vDNSs + cpe_signal_subnet_id: + type: string + label: CPE Signal subnet + description: CPE Signal subnet + cpe_signal_net_cidr: + type: string + label: vAAA private network CIDR + description: The CIDR of the vAAA private network + cpe_public_net_id: + type: string + label: vCPE Public network (emulates internet) name or ID + description: Private network that connects vGW to emulated internet + cpe_public_subnet_id: + type: string + label: CPE Public subnet + description: CPE Public subnet + cpe_public_net_cidr: + type: string + label: vCPE public network CIDR + description: The CIDR of the vCPE public + vaaa_private_ip_0: + type: string + label: vAAA private IP address towards the CPE_SIGNAL private network + description: Private IP address that is assigned to the vAAA to communicate with the vCPE components + vaaa_private_ip_1: + type: string + label: vAAA private IP address towards the ONAP management network + description: Private IP address that is assigned to the vAAA to communicate with ONAP components + vdns_private_ip_0: + type: string + label: vDNS private IP address towards the CPE_PUBLIC private network + description: Private IP address that is assigned to the vDNS to communicate with the vCPE components + vdns_private_ip_1: + type: string + label: vDNS private IP address towards the ONAP management network + description: Private IP address that is assigned to the vDNS to communicate with ONAP components + vdhcp_private_ip_0: + type: string + label: vDHCP private IP address towards the CPE_SIGNAL private network + description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components + vdhcp_private_ip_1: + type: string + label: vDNS private IP address towards the ONAP management network + description: Private IP address that is assigned to the vDHCP to communicate with ONAP components + vweb_private_ip_0: + type: string + label: vWEB private IP address towards the CPE_PUBLIC private network + description: Private IP address that is assigned to the vWEB to communicate with the vGWs + vweb_private_ip_1: + type: string + label: vWEB private IP address towards the ONAP management network + description: Private IP address that is assigned to the vWEB to communicate with ONAP components + vaaa_name_0: + type: string + label: vAAA name + description: Name of the vAAA + vdns_name_0: + type: string + label: vDNS name + description: Name of the vDNS + vdhcp_name_0: + type: string + label: vDHCP name + description: Name of the vDHCP + vweb_name_0: + type: string + label: vWEB name + description: Name of the vWEB + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: vFirewall module ID + description: The vAAA 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 + mr_ip_addr: + type: string + label: Message Router IP address + description: IP address of the Message Router that for vDHCP configuration + mr_ip_port: + type: string + label: Message Router Port + description: IP port of the Message Router that for vDHCP configuration + 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. + default: "https://nexus.onap.org" + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + +############# +# # +# RESOURCES # +# # +############# + +resources: + + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + public_key: { get_param: pub_key } + save_private_key: false + + + # Virtual AAA server Instantiation + vaaa_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_signal_net_id } + fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vaaa_private_ip_0 }}] + + vaaa_private_1_port: + 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: vaaa_private_ip_1 }}] + + vaaa_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vaaa_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vaaa_private_0_port } + - port: { get_resource: vaaa_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + 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 } + __cpe_signal_net_ipaddr__: { get_param: vaaa_private_ip_0 } + __oam_ipaddr__: { get_param: vaaa_private_ip_1 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __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 "__cpe_signal_net_ipaddr__" > /opt/config/cpe_signal_net_ipaddr.txt + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.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.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_aaa_install.sh + cd /opt + chmod +x v_aaa_install.sh + ./v_aaa_install.sh + + + # Virtual DNS Instantiation + vdns_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_public_net_id } + fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vdns_private_ip_0 }}] + + vdns_private_1_port: + 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: vdns_private_ip_1 }}] + + vdns_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vdns_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vdns_private_0_port } + - port: { get_resource: vdns_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vdns_private_ip_1 } + __cpe_public_net_ipaddr__: { get_param: vdns_private_ip_0 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_public_net_ipaddr__" > /opt/config/cpe_public_net_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.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.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dns_install.sh + cd /opt + chmod +x v_dns_install.sh + ./v_dns_install.sh + + + # Virtual DHCP Instantiation + vdhcp_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_signal_net_id } + fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_0 }}] + + vdhcp_private_1_port: + 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: vdhcp_private_ip_1 }}] + + vdhcp_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vdhcp_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vdhcp_private_0_port } + - port: { get_resource: vdhcp_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vdhcp_private_ip_1 } + __cpe_signal_ipaddr__ : { get_param: vdhcp_private_ip_0 } + __oam_cidr__ : { get_param: onap_private_net_cidr } + __cpe_signal_net_cidr__ : { get_param: cpe_signal_net_cidr } + __mr_ip_addr__ : { get_param: mr_ip_addr } + __mr_ip_port__ : { get_param: mr_ip_port } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_signal_ipaddr__" > /opt/config/cpe_signal_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt + echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt + echo "__mr_ip_port__" > /opt/config/mr_ip_port.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.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.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dhcp_install.sh + cd /opt + chmod +x v_dhcp_install.sh + ./v_dhcp_install.sh + + # vWEB instantiaion + vweb_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_public_net_id } + fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vweb_private_ip_0 }}] + + vweb_private_1_port: + 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: vweb_private_ip_1 }}] + + + vweb_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vweb_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vweb_private_0_port } + - port: { get_resource: vweb_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vweb_private_ip_1 } + __cpe_public_ipaddr__: { get_param: vweb_private_ip_0 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_public_ipaddr__" > /opt/config/cpe_public_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.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.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_web_install.sh + cd /opt + chmod +x v_web_install.sh + ./v_web_install.sh diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json new file mode 100644 index 0000000000..61468a74f7 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json @@ -0,0 +1,111 @@ +{ + "distributionID": "e61f72f2-eee9-4c46-bf76-ae24414c6396", + "serviceName": "demoVCPEInfra", + "serviceVersion": "1.0", + "serviceUUID": "8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7", + "serviceDescription": "catalog service description", + "serviceInvariantUUID": "21c102b6-c3e6-49ca-8021-83c105a191fa", + "resources": [{ + "resourceInstanceName": "CPE_PUBLIC", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348", + "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285", + "resourceCustomizationUUID": "4b3bd88b-6351-4564-b1de-e01021cdb79b", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + }, { + "resourceInstanceName": "vCPE_infra bf35304f-e92f 0", + "resourceName": "vCPE_infra bf35304f-e92f", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "9a91c854-86fb-4072-8d4d-94dc0e96a311", + "resourceInvariantUUID": "dcd9cb6c-1634-4424-86e6-b03baed3e10a", + "resourceCustomizationUUID": "01564fe7-0541-4d92-badc-464cc35f83ba", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [{ + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "vf-license-model.xml", + "artifactChecksum": "ODc4YjdjY2M5MDE1NDcxN2JhYTA2MjdiNGUxODE2MTM=", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "7fbbb913-0309-4a8b-8596-a1faf84886e8", + "artifactVersion": "1" + }, { + "artifactName": "vcpe_infrabf35304fe92f0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "vcpe_infrabf35304fe92f0_modules.json", + "artifactChecksum": "OGQ2MTI5YjZjYTFlYzUyOTYyOTY4YWZkYTQxYzViYzg=", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "518b313a-4484-4cfd-92f0-0b23e2a415fd", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_infra.yaml", + "artifactType": "HEAT", + "artifactURL": "base_vcpe_infra.yaml", + "artifactChecksum": "ZGEyNDgwNmEzZDk3ODU3ZDg3YTg1MDc0NmU1ZTMwYmI=", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70", + "artifactVersion": "2" + }, { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "vendor-license-model.xml", + "artifactChecksum": "OTJhOTQyNTczZGRiYTJlM2M0MDQxZTdlMTE3NDE5YTQ=", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "7f4577e5-9f89-4c8e-985e-500e58425276", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_infra.env", + "artifactType": "HEAT_ENV", + "artifactURL": "base_vcpe_infra.env", + "artifactChecksum": "ZmQxYTM1Yjg0ODJmN2I0OWE4OWMxN2NjOGEwMTM5NTY=", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "1e9e20c7-6801-4a6c-a270-c8f5cec034c0", + "artifactVersion": "2", + "generatedFromUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70" + } + ] + }, { + "resourceInstanceName": "CPE_SIGNAL", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348", + "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285", + "resourceCustomizationUUID": "803e0da3-6c40-4a4f-918b-7f3484de61ff", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + } + ], + "serviceArtifacts": [{ + "artifactName": "service-Demovcpeinfra-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "service-Demovcpeinfra-template.yml", + "artifactChecksum": "ZDY3ZGY4ZTM4ZDA3ZjY4M2Y2MDgxNzI0MDE3NjkzODM=", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "a4180154-1279-47d5-acbc-392e87d3fc7f", + "artifactVersion": "1" + }, { + "artifactName": "service-Demovcpeinfra-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "service-Demovcpeinfra-csar.csar", + "artifactChecksum": "NjlhMDk2YzNlNTI5OTg3MzE2ZmUzYjI5MTY2M2Y5YmU=", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "144606d8-a505-4ba0-90a9-6d1c6219fc6b", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar new file mode 100644 index 0000000000..841c681088 Binary files /dev/null and b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar differ diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json new file mode 100644 index 0000000000..d005a09730 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "VcpeInfraBf35304fE92f..base_vcpe_infra..module-0", + "vfModuleModelInvariantUUID": "e9a09595-26cd-4929-89e6-a79a02d3ef8f", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "4555cb57-7dc6-4680-912f-84739fc8d03e", + "vfModuleModelCustomizationUUID": "354b1e83-47db-4af1-8af4-9c14b03b482d", + "isBase": true, + "artifacts": [ + "183353d4-2b50-4dc1-aecc-f2818f666b70", + "1e9e20c7-6801-4a6c-a270-c8f5cec034c0" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "base_vcpe_infra", + "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/resource-examples/vcpe-infra/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml new file mode 100644 index 0000000000..4c6a44d46b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml @@ -0,0 +1 @@ +4c24f75d-4191-4447-9b61af63f5c36c93451c99640c1b63ae5bc9187EE1211F1A437CBCC6032B608418461.04e401c4f-0679-46a0-b7f1vendor entitlement pool111111Percentage1002019-05-10T00:00:00Z2020-05-09T23:59:59Z1.022353211-5524-4b26-af02vendor license key groupUniversal111114e872234ca73482da2d4efc0a7da9e0665C063A5402146DC9CEDDB7D99F9BA1APercentage1002019-05-10T00:00:00Z2020-05-09T23:59:59Z \ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml new file mode 100644 index 0000000000..cc13fa4fea --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml @@ -0,0 +1 @@ +4c24f75d-4191-4447-9b61b9cd64d6d4dc4a93953193ac0bc096194e401c4f-0679-46a0-b7f1vendor entitlement poolaf63f5c36c93451c99640c1b63ae5bc9187EE1211F1A437CBCC6032B60841846111111Percentage1001.02019-05-10T00:00:00Z2020-05-09T23:59:59Z22353211-5524-4b26-af02vendor license key groupUniversal4e872234ca73482da2d4efc0a7da9e0665C063A5402146DC9CEDDB7D99F9BA1A11111Percentage1001.02019-05-10T00:00:00Z2020-05-09T23:59:59Z9bc21ea0-5bcd-44d6-93f0f7fdb15660df4254b520797c59297b24123abc456vendor feature group \ No newline at end of file -- cgit 1.2.3-korg From 8e8476033905ac1e07e5cb22e7fe193bcc8ae903 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 22 May 2019 06:29:53 -0700 Subject: Fix CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT distribute Add CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT type so it does not cancel the distribution of services. Change-Id: I68fe4892156312233fe677c0826e95c8aaa8da02 Issue-ID: SO-1907 Signed-off-by: Eric Multanen --- .../src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java | 9 +++++---- .../java/org/onap/so/asdc/installer/VfResourceStructure.java | 1 + .../org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 2eace7587f..f0eb77300b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,9 +57,10 @@ public class ASDCConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; public static final String WORKFLOW = "WORKFLOW"; public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA"; + public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"; - private static final String[] SUPPORTED_ARTIFACT_TYPES = - {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA}; + private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, + HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT}; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index 16e9fda7c4..0f58a21747 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -115,6 +115,7 @@ public class VfResourceStructure extends ResourceStructure { case ASDCConfiguration.HEAT_ARTIFACT: case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: + case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact); break; case ASDCConfiguration.VF_MODULES_METADATA: diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index ad3e2d8161..6f0d2d7180 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1071,6 +1071,7 @@ public class ToscaResourceInstaller { break; case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: + case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(), vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")", -- cgit 1.2.3-korg From 152fb54b77e845e9e0aa7b6295442f1e8c2c3e1f Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Tue, 21 May 2019 23:47:39 -0400 Subject: Add WORKFLOW artifactType to SDC Config Add WORKFLOW artifactType to SDC Config Issue-ID: SO-1911 Signed-off-by: Kuleshov, Elena Change-Id: I8933438ae63ca73605a05fec5467806f41fbda10 --- .../src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index f0eb77300b..60abdc33ef 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -60,7 +60,7 @@ public class ASDCConfiguration implements IConfiguration { public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"; private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, - HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT}; + HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, WORKFLOW}; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); -- cgit 1.2.3-korg From 832539c87d7334ad68454c886c4b53d510bcd64d Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Thu, 23 May 2019 11:40:17 -0400 Subject: Fix retrieval of mso.config.path Fix retrieval of mso.config.path Issue-ID: SO-1925 Signed-off-by: Kuleshov, Elena Change-Id: I5eed704334de6335672624f9e9eca809856fb984 --- .../org/onap/so/asdc/installer/bpmn/BpmnInstaller.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 7945ad0174..0379e2a423 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -34,6 +34,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -45,6 +46,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -63,6 +65,9 @@ public class BpmnInstaller { @Autowired private Environment env; + @Autowired + private ASDCConfiguration asdcConfig; + public void installBpmn(String csarFilePath) { logger.info("Deploying BPMN files from {}", csarFilePath); try { @@ -139,7 +144,7 @@ public class BpmnInstaller { protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception { FileInputStream bpmnFileStream = new FileInputStream( - Paths.get(System.getProperty("mso.config.path"), "ASDC", version, bpmnFileName).normalize().toString()); + Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString()); byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream); HttpEntity requestEntity = @@ -193,4 +198,14 @@ public class BpmnInstaller { logger.error("Unable to open file.", e); } } + + private String getMsoConfigPath() { + String msoConfigPath = System.getProperty("mso.config.path"); + if (msoConfigPath == null) { + logger.info("Unable to find the system property mso.config.path, use the default configuration"); + msoConfigPath = StringUtils.defaultString(asdcConfig.getPropertyOrNull("mso.config.defaultpath")); + } + logger.info("MSO config path is: {}", msoConfigPath); + return msoConfigPath; + } } -- cgit 1.2.3-korg From 2097de57c95002d6f1a9f3e5f4e5398ab6e19e94 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sat, 25 May 2019 00:22:33 -0400 Subject: Handle lazy init of activitySpecs Use Transactional setting for activitySpecs retrieval Issue-ID: SO-1957 Signed-off-by: Kuleshov, Elena Change-Id: Idfe57474bfdec055a12a1e8fd787d31ac9dc7507 --- .../main/java/org/onap/so/asdc/Application.java | 5 +- .../onap/so/asdc/activity/DeployActivitySpecs.java | 5 +- .../asdc/activity/DeployActivitySpecsITTest.java | 76 ++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java (limited to 'asdc-controller/src/main') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java index a05eeea466..eb2957c6f8 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java @@ -22,6 +22,8 @@ package org.onap.so.asdc; import javax.annotation.PostConstruct; import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -32,7 +34,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableScheduling @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") public class Application { - + private static final Logger logger = LoggerFactory.getLogger(Application.class); private static final String MSO_CONFIG_PATH = "mso.config.path"; private static final String LOGS_DIR = "logs_dir"; @@ -55,6 +57,7 @@ public class Application { try { deployActivitySpecs.deployActivities(); } catch (Exception e) { + logger.warn("{} {}", "Exception on deploying activitySpecs: ", e.getMessage()); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java index 87008f1d8f..54da1b9247 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java @@ -25,6 +25,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.Input; import org.onap.so.asdc.activity.beans.Output; @@ -52,14 +53,16 @@ public class DeployActivitySpecs { protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class); - + @Transactional public void deployActivities() throws Exception { String hostname = env.getProperty(SDC_ENDPOINT); + logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname); if (hostname == null || hostname.isEmpty()) { return; } List activitySpecsFromCatalog = activitySpecRepository.findAll(); for (org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog : activitySpecsFromCatalog) { + logger.debug("{} {}", "Attempting to create activity ", activitySpecFromCatalog.getName()); ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog); String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec); if (activitySpecId != null) { diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java new file mode 100644 index 0000000000..81977da278 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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========================================================= + */ +package org.onap.asdc.activity; + +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.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpHeaders; +import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.MediaType; + +public class DeployActivitySpecsITTest extends BaseTest { + @Mock + protected Environment env; + + @Value("${wiremock.server.port}") + private String wiremockPort; + + @Autowired + private DeployActivitySpecs deployActivitySpecs; + + @Test + public void deployActivitySpecsIT_Test() throws Exception { + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090"); + + String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + deployActivitySpecs.deployActivities(); + assertTrue(activitySpecCreateResponse.getId().equals("testActivityId")); + } +} -- cgit 1.2.3-korg