summaryrefslogtreecommitdiffstats
path: root/artifactbroker/plugins/forwarding-plugins
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-10-25 00:58:41 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-25 00:58:41 +0000
commitfc2a18c1a384786874fe2a6b0ca543dfaa16a7de (patch)
tree864b3d3bb60a356364fd8167b751afd5229bb782 /artifactbroker/plugins/forwarding-plugins
parentc69631da638dc5919ea9b2a0e2cfe4c99499dcca (diff)
parentdf0f6dd7c22d3981e2f5945d18d71e28f66c01e9 (diff)
Merge "Create definitions for multiple vf-modules"
Diffstat (limited to 'artifactbroker/plugins/forwarding-plugins')
-rw-r--r--artifactbroker/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/k8s/K8sArtifactForwarder.java42
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);