From d6047d4a1a499a828e607b7a67992cb394268b34 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Fri, 9 Nov 2018 21:34:38 +0800 Subject: fix installing VL resource bug Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064406 Issue-ID: SO-1184 Signed-off-by: Yulian Han (cherry picked from commit a2e9ad5d9b34d764493951737ab73821b03bba0c) --- .../installer/heat/ToscaResourceInstaller.java | 73 ++++++++++++---------- 1 file changed, 41 insertions(+), 32 deletions(-) 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 06da4e7e03..c8f7f05436 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 @@ -347,38 +347,47 @@ public class ToscaResourceInstaller { } } - protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) - throws ArtifactInstallerException { - List nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList(); - - if (nodeTemplatesVLList != null) { - for (NodeTemplate vlNode : nodeTemplatesVLList) { - String networkResourceModelName = vlNode.getMetaData() - .getValue(SdcPropertyNames.PROPERTY_NAME_NAME); - - TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName); - - if (tempNetworkLookUp != null ) { - HeatTemplate heatTemplate = heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid()); - if (heatTemplate != null ) { - NetworkResourceCustomization networkCustomization = createNetwork(vlNode, toscaResourceStruct, heatTemplate,tempNetworkLookUp.getAicVersionMax(), - tempNetworkLookUp.getAicVersionMin(),service); - service.getNetworkCustomizations() - .add(networkCustomization); - } - else{ - throw new ArtifactInstallerException( - "No HeatTemplate found for artifactUUID: " - + tempNetworkLookUp.getHeatTemplateArtifactUuid()); - } - } else { - throw new ArtifactInstallerException( - "No NetworkResourceName found in TempNetworkHeatTemplateLookup for " - + networkResourceModelName); - } - - } - } + protected void processNetworks (ToscaResourceStructure toscaResourceStruct, + Service service) throws ArtifactInstallerException { + List nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper ().getServiceVlList (); + + if (nodeTemplatesVLList != null) { + for (NodeTemplate vlNode : nodeTemplatesVLList) { + String networkResourceModelName = vlNode.getMetaData ().getValue (SdcPropertyNames.PROPERTY_NAME_NAME); + + TempNetworkHeatTemplateLookup tempNetworkLookUp = + tempNetworkLookupRepo.findFirstBynetworkResourceModelName (networkResourceModelName); + + if (tempNetworkLookUp != null) { + HeatTemplate heatTemplate = + heatRepo.findByArtifactUuid (tempNetworkLookUp.getHeatTemplateArtifactUuid ()); + if (heatTemplate != null) { + NetworkResourceCustomization networkCustomization = + createNetwork (vlNode, + toscaResourceStruct, + heatTemplate, + tempNetworkLookUp.getAicVersionMax (), + tempNetworkLookUp.getAicVersionMin (), + service); + service.getNetworkCustomizations ().add (networkCustomization); + } else { + throw new ArtifactInstallerException ("No HeatTemplate found for artifactUUID: " + + tempNetworkLookUp.getHeatTemplateArtifactUuid ()); + } + } else { + NetworkResourceCustomization networkCustomization = createNetwork (vlNode, + toscaResourceStruct, + null, + null, + null, + service); + service.getNetworkCustomizations().add (networkCustomization); + logger.debug ("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " + + networkResourceModelName); + } + + } + } } protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service, -- cgit 1.2.3-korg