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') 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