From ce16741b481dbaae3a3447f84efb2b4ce5dffc82 Mon Sep 17 00:00:00 2001 From: Denes Nemeth Date: Wed, 30 May 2018 22:07:40 +0200 Subject: Fix template generator for R2 Change-Id: Ib686f1d29b659b64cb30f702c62ffd0ca4cd3f8b Signed-off-by: Denes Nemeth Issue-ID: VFC-728 --- .../vnfm/svnfm/nokia/NokiaSvnfmApplication.java | 8 +- .../direct/notification/GenericVnfManager.java | 3 +- .../OnapAbstractVnfdBuilder.java | 74 ++++++ .../OnapR1VnfPackageBuilder.java | 84 +++++++ .../packagetransformer/OnapR2VnfdBuilder.java | 276 +++++++++++++++++++++ .../packagetransformer/OnapVnfPackageBuilder.java | 83 ------- .../nokia/packagetransformer/OnapVnfdBuilder.java | 60 ++--- .../SupportedOnapPackageVersions.java | 25 ++ .../vnfm/svnfm/nokia/restapi/ConverterApi.java | 19 +- .../vnfm/svnfm/nokia/vnfm/CatalogManager.java | 10 +- .../driver/vnfm/svnfm/nokia/vnfm/Constants.java | 2 +- .../vnfm/svnfm/nokia/vnfm/LifecycleManager.java | 35 +-- .../LifecycleChangeNotificationManager.java | 6 +- 13 files changed, 517 insertions(+), 168 deletions(-) create mode 100644 nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapAbstractVnfdBuilder.java create mode 100644 nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR1VnfPackageBuilder.java create mode 100644 nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR2VnfdBuilder.java delete mode 100644 nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfPackageBuilder.java create mode 100644 nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/SupportedOnapPackageVersions.java (limited to 'nokiav2/driver/src/main/java/org/onap/vfc/nfvo') diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/NokiaSvnfmApplication.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/NokiaSvnfmApplication.java index f1c2a6f0..91240103 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/NokiaSvnfmApplication.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/NokiaSvnfmApplication.java @@ -82,6 +82,10 @@ public class NokiaSvnfmApplication { this.selfRegistrationManagerForSo = selfRegistrationManagerForSo; } + private static boolean isDirect(ConfigurableApplicationContext applicationContext) { + return newHashSet(applicationContext.getEnvironment().getActiveProfiles()).contains("direct"); + } + @Override public void onApplicationEvent(ApplicationReadyEvent contextRefreshedEvent) { Callable singleRegistration = () -> { @@ -116,10 +120,6 @@ public class NokiaSvnfmApplication { }); } - private static boolean isDirect(ConfigurableApplicationContext applicationContext) { - return newHashSet(applicationContext.getEnvironment().getActiveProfiles()).contains("direct"); - } - } /** diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/GenericVnfManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/GenericVnfManager.java index 164d3a23..48c008ac 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/GenericVnfManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/GenericVnfManager.java @@ -100,8 +100,7 @@ public class GenericVnfManager extends AbstractManager { } if (nsId.isPresent()) { addSingletonRelation(vnf.getRelationshipList(), linkToNs(nsId.get())); - } - else{ + } else { logger.warn("Not linking VNF with {} identifier to any NS", vnfId); } aaiRestApiProvider.getNetworkApi().createOrUpdateNetworkGenericVnfsGenericVnf(vnf.getVnfId(), vnf).blockingFirst(); diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapAbstractVnfdBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapAbstractVnfdBuilder.java new file mode 100644 index 00000000..f7f247a0 --- /dev/null +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapAbstractVnfdBuilder.java @@ -0,0 +1,74 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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. + */ + +package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer; + +import com.google.common.annotations.VisibleForTesting; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import java.util.regex.Pattern; +import org.slf4j.Logger; +import org.yaml.snakeyaml.Yaml; + +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.child; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.childElement; +import static org.slf4j.LoggerFactory.getLogger; + +/** + * Transforms a CBAM package into an ONAP package + */ +public class OnapAbstractVnfdBuilder { + public static final String DESCRIPTION = "description"; + public static final String PROPERTIES = "properties"; + public static final String REQUIREMENTS = "requirements"; + private static Logger logger = getLogger(OnapAbstractVnfdBuilder.class); + + @VisibleForTesting + static String indent(String content, int prefixSize) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < prefixSize; i++) { + sb.append(" "); + } + Pattern pattern = Pattern.compile("^(.*)$", Pattern.MULTILINE); + return pattern.matcher(content).replaceAll(sb.toString() + "$1"); + } + + protected static String getRequirement(JsonArray requirements, String key) { + for (int i = 0; i < requirements.size(); i++) { + JsonElement requirement = requirements.get(i); + Map.Entry next = requirement.getAsJsonObject().entrySet().iterator().next(); + String s = next.getKey(); + if (key.equals(s)) { + return next.getValue().getAsString(); + } + } + return null; + } + + private JsonElement get(String name, Set> nodes) { + for (Map.Entry node : nodes) { + if (name.equals(node.getKey())) { + return node.getValue(); + } + } + throw new NoSuchElementException("The VNFD does not have a node called " + name + " but required by an other node"); + } +} diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR1VnfPackageBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR1VnfPackageBuilder.java new file mode 100644 index 00000000..6542a032 --- /dev/null +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR1VnfPackageBuilder.java @@ -0,0 +1,84 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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. + */ + +package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer; + +import com.google.common.io.ByteStreams; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions.systemFunctions; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManager.getFileInZip; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManager.getVnfdLocation; + +/** + * Transforms a CBAM package into an ONAP package + */ + +public class OnapR1VnfPackageBuilder { + + /** + * Entry point for the command line package transformer + * + * @param args not used (required due to signature) + */ + public static void main(String[] args) throws Exception { + byte[] covert = new OnapR1VnfPackageBuilder().covert(systemFunctions().in(), SupportedOnapPackageVersions.V1); + systemFunctions().out().write(covert); + } + + /** + * @param zip the original CBAM package + * @param version + * @return the converted ONAP package + */ + public byte[] covert(InputStream zip, SupportedOnapPackageVersions version) throws IOException { + byte[] cbamVnfPackage = ByteStreams.toByteArray(zip); + String vnfdLocation = getVnfdLocation(new ByteArrayInputStream(cbamVnfPackage)); + ByteArrayOutputStream vnfdContent = getFileInZip(new ByteArrayInputStream(cbamVnfPackage), vnfdLocation); + byte[] cbamVnfdContent = vnfdContent.toByteArray(); + String onapVnfd = SupportedOnapPackageVersions.V2 == version ? + new OnapR2VnfdBuilder().toOnapVnfd(new String(cbamVnfdContent, StandardCharsets.UTF_8)) : + new OnapVnfdBuilder().toOnapVnfd(new String(cbamVnfdContent, StandardCharsets.UTF_8)); + byte[] modifiedCbamPackage = new CbamVnfPackageBuilder().toModifiedCbamVnfPackage(cbamVnfPackage, vnfdLocation, new CbamVnfdBuilder().build(new String(cbamVnfdContent))); + return buildNewOnapPackage(modifiedCbamPackage, onapVnfd); + } + + private byte[] buildNewOnapPackage(byte[] modifiedCbamPackage, String onapVnfd) throws IOException { + ByteArrayOutputStream result = new ByteArrayOutputStream(); + ZipOutputStream out = new ZipOutputStream(result); + out.putNextEntry(new ZipEntry("Artifacts/Deployment/OTHER/cbam.package.zip")); + out.write(modifiedCbamPackage); + out.closeEntry(); + out.putNextEntry(new ZipEntry("TOSCA-Metadata/TOSCA.meta")); + out.write(systemFunctions().loadFile("TOSCA.meta")); + out.closeEntry(); + out.putNextEntry(new ZipEntry("MainServiceTemplate.yaml")); + out.write(onapVnfd.getBytes()); + out.closeEntry(); + out.closeEntry(); + out.putNextEntry(new ZipEntry("MainServiceTemplate.mf")); + out.write(systemFunctions().loadFile("MainServiceTemplate.mf")); + out.closeEntry(); + out.close(); + return result.toByteArray(); + } +} diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR2VnfdBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR2VnfdBuilder.java new file mode 100644 index 00000000..099f641c --- /dev/null +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapR2VnfdBuilder.java @@ -0,0 +1,276 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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. + */ + +package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.util.HashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager; +import org.slf4j.Logger; +import org.yaml.snakeyaml.Yaml; + +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer.OnapVnfdBuilder.getRequirement; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer.OnapVnfdBuilder.indent; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.child; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.childElement; +import static org.slf4j.LoggerFactory.getLogger; + +/** + * Transforms a CBAM package into an ONAP package + */ +public class OnapR2VnfdBuilder { + public static final String DESCRIPTION = "description"; + public static final String PROPERTIES = "properties"; + public static final String REQUIREMENTS = "requirements"; + private static Logger logger = getLogger(OnapR2VnfdBuilder.class); + + private static String trimUnit(String data) { + //FIXME the unit should not be trimmed VF-C bug + return data; + //data.trim().replaceAll("[^0-9]", ""); + } + + /** + * @param cbamVnfd the CBAM VNFD + * @return the converted ONAP VNFD + */ + public String toOnapVnfd(String cbamVnfd) { + JsonObject root = new Gson().toJsonTree(new Yaml().load(cbamVnfd)).getAsJsonObject(); + JsonObject topologyTemplate = child(root, "topology_template"); + JsonObject substitution_mappings = child(topologyTemplate, "substitution_mappings"); + Map virtualLinks = new HashMap<>(); + if (topologyTemplate.has("node_templates")) { + Set> nodeTemplates = child(topologyTemplate, "node_templates").entrySet(); + + StringBuilder body = new StringBuilder(); + for (Map.Entry node : nodeTemplates) { + String type = childElement(node.getValue().getAsJsonObject(), "type").getAsString(); + if ("tosca.nodes.nfv.VDU".equals(type)) { + body.append(buildVdu(node.getKey(), substitution_mappings, node.getValue().getAsJsonObject(), nodeTemplates)); + } else if ("tosca.nodes.nfv.VirtualStorage".equals(type)) { + body.append(buildVolume(node.getKey(), node.getValue().getAsJsonObject())); + } else if ("tosca.nodes.nfv.VL".equals(type)) { + virtualLinks.put(node.getKey(), node.getValue()); + body.append(buildVl(node.getValue().getAsJsonObject().get(PROPERTIES).getAsJsonObject(), node.getKey())); + } else if ("tosca.nodes.nfv.ICP".equals(type)) { + body.append(buildIcp(node.getKey(), node.getValue().getAsJsonObject())); + } else if ("tosca.nodes.nfv.ECP".equals(type)) { + body.append(buildEcp(node.getKey(), node.getValue(), nodeTemplates)); + } else { + logger.warn("The {} type is not converted", type); + } + } + return buildHeader(topologyTemplate, virtualLinks) + body.toString(); + } + return buildHeader(topologyTemplate, virtualLinks); + } + + private String buildHeader(JsonObject toplogyTemplate, Map virtualLinks) { + JsonObject substitution_mappings = child(toplogyTemplate, "substitution_mappings"); + String vnfContent = buildVnf(substitution_mappings, virtualLinks); + return "tosca_definitions_version: tosca_simple_profile_yaml_1_1\n" + + "\n" + + "topology_template:\n" + + " inputs:\n" + + " etsi_config:\n" + + " type: string\n" + + " description: The ETSI configuration\n" + + " node_templates:\n" + vnfContent; + } + + private JsonElement get(String name, Set> nodes) { + for (Map.Entry node : nodes) { + if (name.equals(node.getKey())) { + return node.getValue(); + } + } + throw new NoSuchElementException("The VNFD does not have a node called " + name + " but required by an other node"); + } + + private String buildVdu(String name, JsonObject vnf, JsonObject vdu, Set> nodes) { + String memorySize = ""; + String cpuCount = ""; + StringBuilder body = new StringBuilder(); + JsonArray vduRequirements = childElement(vdu.getAsJsonObject(), REQUIREMENTS).getAsJsonArray(); + for (int i = 0; i < vduRequirements.size(); i++) { + JsonObject requirement = vduRequirements.get(i).getAsJsonObject(); + Map.Entry next = requirement.entrySet().iterator().next(); + String s = next.getKey(); + if ("virtual_compute".equals(s)) { + JsonObject virtualCompute = get(next.getValue().getAsString(), nodes).getAsJsonObject(); + cpuCount = childElement(child(child(virtualCompute, PROPERTIES), "virtual_cpu"), "num_virtual_cpu").getAsString(); + memorySize = trimUnit(childElement(child(child(virtualCompute, PROPERTIES), "virtual_memory"), "virtual_mem_size").getAsString()); + } else if ("virtual_storage".equals(s)) { + String item = indent( + "- virtual_storage:\n" + + " capability: tosca.capabilities.nfv.VirtualStorage\n" + + " node: " + next.getValue().getAsString() + "\n", 4); + body.append(item); + } + next.getValue(); + } + JsonObject flavourProperties = child(child(child(vnf, "capabilities"), "deployment_flavour"), "properties"); + JsonObject vduSizes = child(child(flavourProperties, "vdu_profile"), name); + String header = indent(name + ":\n" + + " type: tosca.nodes.nfv.Vdu.Compute\n" + + " properties:\n" + + " name: " + name + "\n" + + " description: " + childElement(child(vdu, PROPERTIES), "description").getAsString() + "\n" + + " configurable_properties:\n" + + " vdu_profile:\n" + + " min_number_of_instances: " + childElement(vduSizes, "min_number_of_instances").getAsString() + "\n" + + " max_number_of_instances: " + childElement(vduSizes, "max_number_of_instances").getAsString() + "\n" + + " capabilities:\n" + + " virtual_compute:\n" + + indent( + "properties:\n" + + " virtual_memory:\n" + + " virtual_mem_size: " + trimUnit(memorySize) + "\n" + + " virtual_cpu:\n" + + " num_virtual_cpu: " + cpuCount + "\n", 3) + + " " + REQUIREMENTS + ":\n", 2); + return header + body.toString(); + } + + private String buildEcp(String name, JsonElement ecp, Set> nodes) { + if (ecp.getAsJsonObject().has(REQUIREMENTS)) { + String icpName = getRequirement(ecp.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray(), "internal_connection_point"); + if (icpName != null) { + return buildEcpInternal(name, icpName, nodes); + } else { + logger.warn("The {} ecp does not have an internal connection point", name); + } + } else { + logger.warn("The {} ecp does not have an requirements section", name); + } + return ""; + } + + private String buildVnf(JsonObject vnf, Map virtualLinks) { + JsonObject vnfProperties = child(vnf, PROPERTIES); + JsonObject flavourProperties = child(child(child(vnf, "capabilities"), "deployment_flavour"), "properties"); + StringBuilder vlContent = new StringBuilder(); + for (Map.Entry virtualLink : virtualLinks.entrySet()) { + vlContent.append(indent("- virtual_link:\n" + + " capability: tosca.capabilities.nfv.VirtualLinkable\n" + + " node: " + virtualLink.getKey() + "\n", 4)); + } + return indent("VNF:\n" + + " type: tosca.nodes.nfv.VNF\n" + + " " + PROPERTIES + ":\n" + + " descriptor_id: " + childElement(vnfProperties, "descriptor_id").getAsString() + "\n" + + " descriptor_version: " + childElement(vnfProperties, "descriptor_version").getAsString() + "\n" + + " provider: " + childElement(vnfProperties, "provider").getAsString() + "\n" + + " product_name: " + childElement(vnfProperties, "product_name").getAsString() + "\n" + + " software_version: " + childElement(vnfProperties, "software_version").getAsString() + "\n" + + " product_info_name: " + childElement(vnfProperties, "product_info_name").getAsString() + "\n" + + (vnfProperties.has("product_info_description") ? + " product_info_description: " + childElement(vnfProperties, "product_info_description").getAsString() + "\n" : "") + + " vnfm_info: [ " + SelfRegistrationManager.SERVICE_NAME + " ]\n" + + " flavour_id: " + childElement(flavourProperties, "flavour_id").getAsString() + "\n" + + " flavour_description: " + childElement(flavourProperties, "description").getAsString() + "\n", 2) + + " " + REQUIREMENTS + ":\n" + + vlContent.toString(); + } + + private String buildEcpInternal(String ecpName, String icpName, Set> nodes) { + JsonObject icpNode = get(icpName, nodes).getAsJsonObject(); + if (icpNode.has(REQUIREMENTS)) { + String vdu = getRequirement(icpNode.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray(), "virtual_binding"); + //internal connection point is bound to VDU + if (vdu != null) { + return buildVduCpd(ecpName, vdu, child(icpNode, PROPERTIES)); + } else { + logger.warn("The {} internal connection point of the {} ecp does not have a VDU", icpName, ecpName); + } + } else { + logger.warn("The {} internal connection point of the {} ecp does not have a requirements section", icpName, ecpName); + } + return ""; + } + + private String buildIcp(String name, JsonObject icp) { + if (icp.has(REQUIREMENTS)) { + JsonArray requirements = icp.get(REQUIREMENTS).getAsJsonArray(); + String vdu = getRequirement(requirements, "virtual_binding"); + String vl = getRequirement(requirements, "virtual_link"); + if (vdu == null) { + logger.warn("The {} internal connection point does not have a VDU", name); + } else if (vl == null) { + logger.warn("The {} internal connection point does not have a VL", name); + } else { + JsonObject properties = child(icp, PROPERTIES); + return indent(name + ":\n" + + " type: tosca.nodes.nfv.VduCp\n" + + " " + PROPERTIES + ":\n" + + " layer_protocol: [ " + childElement(properties, "layer_protocol").getAsString() + " ]\n" + + (properties.has(DESCRIPTION) ? + " description: " + childElement(properties, DESCRIPTION).getAsString() + "\n" : "") + + " protocol_data: []\n" + + " trunk_mode: false\n" + + " requirements:\n" + + " - virtual_binding: " + vdu + "\n" + + " - virtual_link: " + vl + "\n", 2); + } + } else { + logger.warn("The {} internal connection point does not have a requirements section", name); + } + return ""; + } + + private String buildVduCpd(String name, String vdu, JsonObject properties) { + return indent(name + ":\n" + + " type: tosca.nodes.nfv.VduCp\n" + + " " + PROPERTIES + ":\n" + + " layer_protocol: [ " + childElement(properties, "layer_protocol").getAsString() + " ]\n" + + " protocol_data: [ ]\n" + + " trunk_mode: false\n" + + (properties.has(DESCRIPTION) ? + " description: " + childElement(properties, DESCRIPTION).getAsString() + "\n" : "") + + " requirements:\n" + + " - virtual_binding: " + vdu + "\n", 2); + } + + private String buildVolume(String nodeName, JsonObject volume) { + return indent(nodeName + ":\n" + + " type: tosca.nodes.nfv.Vdu.VirtualStorage\n" + + " properties:\n" + + " type_of_storage: volume\n" + + " size_of_storage: " + trimUnit(childElement(child(volume, PROPERTIES), "size_of_storage").getAsString()) + "\n", 2); + } + + private String buildVl(JsonObject vlProperties, String name) { + return indent(name + ":\n" + + " type: tosca.nodes.nfv.VnfVirtualLink\n" + + " properties:\n" + + " connectivity_type:\n" + + " layer_protocol: [ " + childElement(child(vlProperties, "connectivity_type"), "layer_protocol").getAsString() + " ]\n" + + " flow_pattern: " + childElement(child(vlProperties, "connectivity_type"), "flow_pattern").getAsString() + "\n" + + " vl_profile:\n" + + " max_bit_rate_requirements:\n" + + " root: " + Integer.MAX_VALUE + "\n" + //FIXME GAP IN CBAM TEMPLATE + " leaf: " + Integer.MAX_VALUE + "\n" + //FIXME GAP IN CBAM TEMPLATE + " min_bit_rate_requirements:\n" + + " root: 0\n" + //FIXME GAP IN CBAM TEMPLATE + " leaf: 0\n", 2); //FIXME GAP IN CBAM TEMPLATE + } +} diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfPackageBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfPackageBuilder.java deleted file mode 100644 index 2a058777..00000000 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfPackageBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2016-2017, Nokia Corporation - * - * 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. - */ - -package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer; - -import com.google.common.io.ByteStreams; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions.systemFunctions; -import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManager.getFileInZip; -import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManager.getVnfdLocation; - -/** - * Transforms a CBAM package into an ONAP package - */ - -public class OnapVnfPackageBuilder { - - /** - * Entry point for the command line package transformer - * - * @param args not used (required due to signature) - */ - public static void main(String[] args) throws Exception { - byte[] covert = new OnapVnfPackageBuilder().covert(systemFunctions().in()); - systemFunctions().out().write(covert); - } - - /** - * @param zip the original CBAM package - * @return the converted ONAP package - */ - public byte[] covert(InputStream zip) throws IOException { - byte[] cbamVnfPackage = ByteStreams.toByteArray(zip); - String vnfdLocation = getVnfdLocation(new ByteArrayInputStream(cbamVnfPackage)); - ByteArrayOutputStream vnfdContent = getFileInZip(new ByteArrayInputStream(cbamVnfPackage), vnfdLocation); - byte[] cbamVnfdContent = vnfdContent.toByteArray(); - String onapVnfd = new OnapVnfdBuilder().toOnapVnfd(new String(cbamVnfdContent, StandardCharsets.UTF_8)); - byte[] modifiedCbamPackage = new CbamVnfPackageBuilder().toModifiedCbamVnfPackage(cbamVnfPackage, vnfdLocation, new CbamVnfdBuilder().build(new String(cbamVnfdContent))); - return buildNewOnapPackage(modifiedCbamPackage, onapVnfd); - } - - private byte[] buildNewOnapPackage(byte[] modifiedCbamPackage, String onapVnfd) throws IOException { - ByteArrayOutputStream result = new ByteArrayOutputStream(); - ZipOutputStream out = new ZipOutputStream(result); - out.putNextEntry(new ZipEntry("Artifacts/Deployment/OTHER/cbam.package.zip")); - out.write(modifiedCbamPackage); - out.closeEntry(); - out.putNextEntry(new ZipEntry("TOSCA-Metadata/TOSCA.meta")); - out.write(systemFunctions().loadFile("TOSCA.meta")); - out.closeEntry(); - out.putNextEntry(new ZipEntry("MainServiceTemplate.yaml")); - out.write(onapVnfd.getBytes()); - out.closeEntry(); - out.closeEntry(); - out.putNextEntry(new ZipEntry("MainServiceTemplate.mf")); - out.write(systemFunctions().loadFile("MainServiceTemplate.mf")); - out.closeEntry(); - out.close(); - return result.toByteArray(); - } - - -} diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java index 406f0033..b5dd9616 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java @@ -56,6 +56,18 @@ public class OnapVnfdBuilder { return data.trim().replaceAll("[^0-9]", ""); } + public static String getRequirement(JsonArray requirements, String key) { + for (int i = 0; i < requirements.size(); i++) { + JsonElement requirement = requirements.get(i); + Map.Entry next = requirement.getAsJsonObject().entrySet().iterator().next(); + String s = next.getKey(); + if (key.equals(s)) { + return next.getValue().getAsString(); + } + } + return null; + } + /** * @param cbamVnfd the CBAM VNFD * @return the converted ONAP VNFD @@ -104,8 +116,8 @@ public class OnapVnfdBuilder { "topology_template:\n" + " inputs:\n" + " etsi_config:\n" + - " type: string\n"+ - " description: The ETSI configuration\n"+ + " type: string\n" + + " description: The ETSI configuration\n" + " node_templates:\n"; } @@ -157,7 +169,7 @@ public class OnapVnfdBuilder { private String buildEcp(String name, JsonElement ecp, Set> nodes) { if (ecp.getAsJsonObject().has(REQUIREMENTS)) { - String icpName = getIcpName(ecp.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray()); + String icpName = getRequirement(ecp.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray(), "internal_connection_point"); if (icpName != null) { return buildEcpInternal(name, icpName, nodes); } else { @@ -172,7 +184,7 @@ public class OnapVnfdBuilder { private String buildEcpInternal(String ecpName, String icpName, Set> nodes) { JsonObject icpNode = get(icpName, nodes).getAsJsonObject(); if (icpNode.has(REQUIREMENTS)) { - String vdu = getVduOfIcp(icpNode.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray()); + String vdu = getRequirement(icpNode.getAsJsonObject().get(REQUIREMENTS).getAsJsonArray(), "virtual_binding"); //internal connection point is bound to VDU if (vdu != null) { return buildVduCpd(ecpName, vdu, child(icpNode, PROPERTIES)); @@ -185,47 +197,11 @@ public class OnapVnfdBuilder { return ""; } - private String getVduOfIcp(JsonArray icpRequirements) { - String vdu = null; - for (int i = 0; i < icpRequirements.size(); i++) { - JsonElement requirement = icpRequirements.get(i); - Map.Entry next = requirement.getAsJsonObject().entrySet().iterator().next(); - String s = next.getKey(); - if ("virtual_binding".equals(s)) { - vdu = next.getValue().getAsString(); - } - } - return vdu; - } - - private String getIcpName(JsonArray requirements) { - String icpName = null; - for (int i = 0; i < requirements.size(); i++) { - JsonElement requirement = requirements.get(i); - Map.Entry next = requirement.getAsJsonObject().entrySet().iterator().next(); - String s = next.getKey(); - if ("internal_connection_point".equals(s)) { - icpName = next.getValue().getAsString(); - } - } - return icpName; - } - private String buildIcp(String name, JsonObject icp) { if (icp.has(REQUIREMENTS)) { JsonArray requirements = icp.get(REQUIREMENTS).getAsJsonArray(); - String vdu = null; - String vl = null; - for (int i = 0; i < requirements.size(); i++) { - JsonElement requirement = requirements.get(i); - Map.Entry next = requirement.getAsJsonObject().entrySet().iterator().next(); - String s = next.getKey(); - if ("virtual_binding".equals(s)) { - vdu = next.getValue().getAsString(); - } else if ("virtual_link".equals(s)) { - vl = next.getValue().getAsString(); - } - } + String vdu = getRequirement(requirements, "virtual_binding"); + String vl = getRequirement(requirements, "virtual_link"); if (vdu == null) { logger.warn("The {} internal connection point does not have a VDU", name); } else if (vl == null) { diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/SupportedOnapPackageVersions.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/SupportedOnapPackageVersions.java new file mode 100644 index 00000000..545b2d9e --- /dev/null +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/SupportedOnapPackageVersions.java @@ -0,0 +1,25 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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. + */ + +package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer; + +/** + * The supported ONAP package versions + */ +public enum SupportedOnapPackageVersions { + V1, + V2 +} \ No newline at end of file diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java index 5ecd884c..95438caa 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java @@ -15,13 +15,15 @@ */ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.restapi; +import com.google.common.base.Charsets; import com.google.common.io.ByteStreams; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer.OnapVnfPackageBuilder; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer.OnapR1VnfPackageBuilder; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.packagetransformer.SupportedOnapPackageVersions; import org.slf4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -45,7 +47,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST; @RequestMapping(value = BASE_URL) public class ConverterApi { private static Logger logger = getLogger(ConverterApi.class); - private OnapVnfPackageBuilder vnfPackageConverter = new OnapVnfPackageBuilder(); + private OnapR1VnfPackageBuilder vnfPackageConverter = new OnapR1VnfPackageBuilder(); /** * Return the converted ONAP package @@ -57,16 +59,23 @@ public class ConverterApi { @ResponseBody public void convert(HttpServletResponse httpResponse, HttpServletRequest request) throws IOException { logger.info("REST: convert package"); + SupportedOnapPackageVersions version; + try { + request.getPart("version"); + version = SupportedOnapPackageVersions.valueOf(new String(ByteStreams.toByteArray(request.getPart("version").getInputStream()), Charsets.UTF_8)); + } catch (Exception e) { + throw buildFatalFailure(logger, "Unable to determine the desired ONAP package version", e); + } byte[] content; try { - Part part = request.getPart("fileToUpload"); - content = ByteStreams.toByteArray(part.getInputStream()); + Part uploadedFile = request.getPart("fileToUpload"); + content = ByteStreams.toByteArray(uploadedFile.getInputStream()); } catch (Exception e) { throw buildFatalFailure(logger, "Unable to extract package from REST parameters", e); } byte[] convertedPackage; try { - convertedPackage = vnfPackageConverter.covert(new ByteArrayInputStream(content)); + convertedPackage = vnfPackageConverter.covert(new ByteArrayInputStream(content), version); } catch (Exception e) { throw buildFatalFailure(logger, "Unable to convert VNF package", e); } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java index 0993c6ee..ad02437d 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java @@ -52,7 +52,7 @@ public class CatalogManager { * The location of the CBAM package within the ONAP package */ public static final String CBAM_PACKAGE_NAME_IN_ZIP = "Artifacts/Deployment/OTHER/cbam.package.zip"; - public static final String ETSI_CONFIG_NAME_IN_ZIP = "Artifacts/Deployment/OTHER/" + ETSI_CONFIG +".json"; + public static final String ETSI_CONFIG_NAME_IN_ZIP = "Artifacts/Deployment/OTHER/" + ETSI_CONFIG + ".json"; private static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta"; private static final String TOSCA_VNFD_KEY = "Entry-Definitions"; @@ -112,7 +112,7 @@ public class CatalogManager { public CatalogAdapterVnfpackage preparePackageInCbam(String vnfmId, String csarId) { String cbamVnfdId = packageProvider.getCbamVnfdId(csarId); DefaultApi cbamCatalogApi = cbamRestApiProvider.getCbamCatalogApi(vnfmId); - if (!isPackageReplicated(cbamVnfdId, cbamCatalogApi)) { + if (!isPackageReplicated(cbamVnfdId, cbamCatalogApi)) { try { ByteArrayOutputStream cbamPackage = getFileInZip(new ByteArrayInputStream(packageProvider.getPackage(csarId)), CBAM_PACKAGE_NAME_IN_ZIP); return cbamCatalogApi.create(create(parse(APPLICATION_OCTET_STREAM.toString()), cbamPackage.toByteArray())).blockingFirst(); @@ -133,15 +133,15 @@ public class CatalogManager { /** * Download the ETSI configuration of the VNF + * * @param csarId the CSAR identifier of the package in ONAP catalog * @return the content of the ETSI configuration */ - public String getEtsiConfiguration(String csarId){ + public String getEtsiConfiguration(String csarId) { try { ByteArrayOutputStream etsiConfig = getFileInZip(new ByteArrayInputStream(packageProvider.getPackage(csarId)), ETSI_CONFIG_NAME_IN_ZIP); return new String(etsiConfig.toByteArray(), Charsets.UTF_8); - } - catch (Exception e){ + } catch (Exception e) { throw buildFatalFailure(logger, "Unable to download the ETSI configuration file"); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java index 1b6b4eb2..5342b4fd 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java @@ -27,7 +27,7 @@ public class Constants { public static final String BASE_URL = "/api" + BASE_SUFFIX; public static final String LCN_URL = "/lcn"; - private Constants(){ + private Constants() { //use in static way } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java index e36ede4e..f64ce1e0 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java @@ -18,8 +18,6 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm; import com.google.common.base.Joiner; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -30,8 +28,6 @@ import com.nokia.cbam.lcm.v32.model.ScaleDirection; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.servlet.http.HttpServletResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IGrantManager; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.VimInfoProvider; @@ -45,6 +41,7 @@ import org.yaml.snakeyaml.Yaml; import static java.lang.Integer.parseInt; import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.stream.Collectors.toList; import static com.google.common.base.Splitter.on; import static com.google.common.collect.Iterables.find; @@ -302,17 +299,15 @@ public class LifecycleManager { private AdditionalParameters convertInstantiationAdditionalParams(String csarId, Object additionalParams) { JsonObject root = new Gson().toJsonTree(additionalParams).getAsJsonObject(); - if(root.has(PROPERTIES)){ + if (root.has(PROPERTIES)) { JsonObject properties = new JsonParser().parse(root.get(PROPERTIES).getAsString()).getAsJsonObject(); - if(properties.has(ETSI_CONFIG)){ + if (properties.has(ETSI_CONFIG)) { JsonElement etsiConfig = properties.get(ETSI_CONFIG); return new Gson().fromJson(etsiConfig.getAsString(), AdditionalParameters.class); + } else { + logger.info("The instantiation input for VNF with {} CSAR id does not have an " + ETSI_CONFIG + " section", csarId); } - else{ - logger.info("The instantiation input for VNF with {} CSAR id does not have an " + ETSI_CONFIG +" section", csarId); - } - } - else{ + } else { logger.info("The instantiation input for VNF with {} CSAR id does not have a properties section", csarId); } JsonObject inputs = child(root, "inputs"); @@ -333,14 +328,11 @@ public class LifecycleManager { private Set> getAcceptableOperationParameters(String vnfdContent, String operationName) { JsonObject root = new Gson().toJsonTree(new Yaml().load(vnfdContent)).getAsJsonObject(); JsonObject interfaces = child(child(child(root, "topology_template"), "substitution_mappings"), "interfaces"); - for (Map.Entry categoryOfOperation : interfaces.entrySet()) { - for (Map.Entry operation : categoryOfOperation.getValue().getAsJsonObject().entrySet()) { - if(operation.getKey().equals(operationName)){ - JsonObject additionalParameters = child(child(operation.getValue().getAsJsonObject(), "inputs"), "additional_parameters"); - return additionalParameters.entrySet(); - } + List>> operations = interfaces.entrySet().stream().map(m -> m.getValue().getAsJsonObject().entrySet().stream().collect(toList())).collect(toList()); + for (Map.Entry operation : operations.stream().flatMap(List::stream).collect(toList())) { + if (operation.getKey().equals(operationName)) { + return child(child(operation.getValue().getAsJsonObject(), "inputs"), "additional_parameters").entrySet(); } - logger.debug("The {} operation was not found in {} interface", operationName, categoryOfOperation.getKey()); } throw buildFatalFailure(logger, "Unable to find operation named " + operationName); } @@ -384,14 +376,13 @@ public class LifecycleManager { } } - private void addSpecifiedExtensions(String vnfmId, String vnfId, AdditionalParameters additionalParameters){ - if(!additionalParameters.getExtensions().isEmpty()){ + private void addSpecifiedExtensions(String vnfmId, String vnfId, AdditionalParameters additionalParameters) { + if (!additionalParameters.getExtensions().isEmpty()) { ModifyVnfInfoRequest request = new ModifyVnfInfoRequest(); request.setExtensions(new ArrayList<>()); request.getExtensions().addAll(additionalParameters.getExtensions()); executeModifyVnfInfo(vnfmId, vnfId, request); - } - else{ + } else { logger.info("No extensions specified for VNF with {} identifier", vnfId); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java index c4cd4342..8d5ad490 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java @@ -218,11 +218,9 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif } else { return handleFailure(operationExecution); } - } - catch(OperationMustBeAborted handledFailuire){ + } catch (OperationMustBeAborted handledFailuire) { throw handledFailuire; - } - catch (Exception e) { + } catch (Exception e) { logger.warn("Unable to build affected connection points", e); return toleratedFailure(); } -- cgit 1.2.3-korg