diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2019-10-22 10:20:27 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2019-10-22 10:32:34 +0200 |
commit | df0f6dd7c22d3981e2f5945d18d71e28f66c01e9 (patch) | |
tree | 2c74bfea10844d89b8d658b54fd63ed15af7362f /artifactbroker/plugins/forwarding-plugins/src | |
parent | 5361935a9eb936b72045f297263304febf0bcca4 (diff) |
Create definitions for multiple vf-modules
This fix does not change distribution when there is one
dummy heat and one cloud technology artifact.
When there is more than one dummy heat or more than one
cloud technology artifact forwarder will try to match them
base on the name of the heat file that should match the prefix
of the name of cloud artifact. There is no need to change use
cases of vFW and EdgeX showcased for Dublin and ElAlto neither
their descriptions should be changed.
Issue-ID: MULTICLOUD-869
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I4d44ea22b412546806ee7dbcdb7e3c9ed644349a
Diffstat (limited to 'artifactbroker/plugins/forwarding-plugins/src')
-rw-r--r-- | artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java index e5cf487..894f0c1 100644 --- a/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java +++ b/artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java @@ -138,24 +138,50 @@ public class K8sArtifactForwarder implements ArtifactForwarder { List<String> artifacts = vfModule.getArtifacts(); System.out.println("artifacts = " + artifacts); - String cloudUuid = null; + String vfNamePrefix = vfModule.getVfModuleModelName().toLowerCase(); + if ( vfNamePrefix.indexOf("..") > 0 ) { + vfNamePrefix = vfNamePrefix.substring(vfNamePrefix.indexOf("..") + 2); + if ( vfNamePrefix.indexOf("..") > 0 ) + vfNamePrefix = vfNamePrefix.substring(0, vfNamePrefix.indexOf("..")) + "_"; + else + vfNamePrefix = ""; + } else + vfNamePrefix = ""; + IArtifactInfo cloudArtifact = null; + IArtifactInfo firstCloudArtifact = null; + int cloudArtifactCount = 0; boolean found = false; for (String artifact: artifacts) { if ( artifactMap.get(artifact) != null && artifactMap.get(artifact).getArtifactType().equals("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT")) { - cloudArtifact = artifactMap.get(artifact); - cloudUuid = cloudArtifact.getArtifactUUID(); - found = true; - break; + if ( cloudArtifactCount == 0 ) + firstCloudArtifact = artifactMap.get(artifact); + cloudArtifactCount++; + IArtifactInfo tmpArtifact = artifactMap.get(artifact); + if ( tmpArtifact.getArtifactName().toLowerCase().startsWith(vfNamePrefix) ) { + cloudArtifact = tmpArtifact; + found = true; + break; + } } } - if ( found == false ) { - System.out.println(" meets error , no CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT type found "); - return false; + if ( found == false ) { + if ( firstCloudArtifact == null ) { + System.out.println(" meets error , no CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT type found "); + return false; + } else { + if ( cloudArtifactCount == 1 || vfNamePrefix == "" ) { + cloudArtifact = firstCloudArtifact; + } else { + System.out.println(" meets error , CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT artifacts mismatch "); + return false; + } + } } + String cloudArtifactPath = "/data/" + vfModule.getVfModuleModelCustomizationUUID() + "/" + cloudArtifact.getArtifactName(); File file = new File(cloudArtifactPath); |