From cf45bfe15be62a79dab30f69116e050d81e3a9ae Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 13 Mar 2019 14:56:05 -0400 Subject: Openstack adapter can't resolve HEAT parameter only cast to Element if value is of that type added XmlAccessorType annotations to classes map of string, object now correctly maps with jaxb Null comma delimited lists can convert to null as well Handle null values all types in input parameters map. Change-Id: Ic46ed31c05b8f8551d39b2267ae731829abfc1f0 Issue-ID: SO-1617 Signed-off-by: Benjamin, Max (mb388a) --- .../so/openstack/mappers/JAXBMarshallingTest.java | 51 +++++ .../createVfModuleRequest-with-params.xml | 206 +++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml (limited to 'adapters/mso-adapters-rest-interface/src/test') diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java new file mode 100644 index 0000000000..038e88317d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 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.so.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; + + +public class JAXBMarshallingTest { + + + @Test + public void xmlMarshalTest() throws IOException, JAXBException { + JAXBContext context = JAXBContext.newInstance(CreateVfModuleRequest.class); + + CreateVfModuleRequest request = (CreateVfModuleRequest) context.createUnmarshaller().unmarshal(Files.newBufferedReader(Paths.get("src/test/resources/createVfModuleRequest-with-params.xml"))); + + assertEquals("ubuntu-16-04-cloud-amd64", request.getVfModuleParams().get("vcpe_image_name")); + assertEquals("10.2.0.0/24", request.getVfModuleParams().get("cpe_public_net_cidr")); + assertEquals("", request.getVfModuleParams().get("workload_context")); + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml new file mode 100644 index 0000000000..76ba3695f2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml @@ -0,0 +1,206 @@ + + RegionOne + 09d8566ea45e43aa974cf447ed591d77 + 8daea639-82b9-4da6-aec9-5054f006a82d + vcpe_vnf_vcpe_infra_201903101808 + vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808 + 1ea78add-a36c-4af4-959f-4c43292b3aac + demoVCPEInfra/vCPE_infra 53f27a62-85bd 0 + VcpeInfra53f27a6285bd..base_vcpe_infra..module-0 + 1.0 + 76135970-0c64-4b62-a4d0-56606fc040b3 + + + + + + true + false + true + + + vf_module_id + 1ea78add-a36c-4af4-959f-4c43292b3aac + + + cpe_public_subnet_id + vcpe_net_cpe_public_subnet_201903101808 + + + oof_directives + {} + + + cpe_signal_subnet_id + vcpe_net_cpe_signal_subnet_201903101808 + + + onap_private_net_id + oam_network_hkV9 + + + vnf_name + vcpe_vnf_vcpe_infra_201903101808 + + + key_name + vaaa_key + + + workload_context + + + + vweb_name_0 + zdcpe1cpe01web01_201903101808 + + + vf_module_name + vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808 + + + vcpe_flavor_name + m1.medium + + + vdhcp_name_0 + zdcpe1cpe01dhcp01_201903101808 + + + vdhcp_private_ip_0 + 10.4.0.1 + + + install_script_version + 1.3.0 + + + vdhcp_private_ip_1 + 10.0.101.1 + + + vnf_id + 8daea639-82b9-4da6-aec9-5054f006a82d + + + cloud_env + openstack + + + mr_ip_addr + 10.12.5.69 + + + repo_url_artifacts + https://nexus.onap.org/content/repositories/releases + + + dcae_collector_port + 8080 + + + repo_url_blob + https://nexus.onap.org/content/sites/raw + + + public_net_id + 971040b2-7059-49dc-b220-4fab50cb2ad4 + + + onap_private_net_cidr + 10.0.0.0/16 + + + cpe_signal_net_cidr + 10.4.0.0/24 + + + environment_context + + + + onap_private_subnet_id + oam_network_hkV9 + + + vweb_private_ip_0 + 10.2.0.10 + + + vaaa_private_ip_1 + 10.0.101.2 + + + cpe_public_net_id + vcpe_net_cpe_public_201903101808 + + + vweb_private_ip_1 + 10.0.101.40 + + + mr_ip_port + 30227 + + + vaaa_private_ip_0 + 10.4.0.2 + + + pub_key + ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh + + + sdnc_directives + {} + + + vdns_private_ip_0 + 10.2.0.1 + + + cpe_signal_net_id + vcpe_net_cpe_signal_201903101808 + + + vdns_private_ip_1 + 10.0.101.3 + + + demo_artifacts_version + 1.3.0 + + + vdns_name_0 + zdcpe1cpe01dns01_201903101808 + + + cpe_public_net_cidr + 10.2.0.0/24 + + + vaaa_name_0 + zdcpe1cpe01aaa01_201903101808 + + + dcae_collector_ip + 10.0.4.102 + + + vcpe_image_name + ubuntu-16-04-cloud-amd64 + + + vf_module_index + 0 + + + + + 11c8ec20-a1f8-4aa2-926f-e55d67a30f8b + 807648fc-c84c-4662-bf23-23c7d8cbe0c8 + + 11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248 + http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248 + \ No newline at end of file -- cgit 1.2.3-korg