diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
5 files changed, 37 insertions, 25 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java index 00eb46183a..a0c346c677 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/AbstractOnboardingManifest.java @@ -39,7 +39,7 @@ import java.util.Optional; import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; import static org.openecomp.sdc.tosca.csar.CSARConstants.METADATA_MF_ATTRIBUTE; -import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; +import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPARATOR_MF_ATTRIBUTE; abstract class AbstractOnboardingManifest implements Manifest{ @@ -118,7 +118,7 @@ import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; } protected boolean isMetadata(String line) { - if(line.trim().equals(METADATA_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){ + if(line.trim().equals(METADATA_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE)){ return true; } reportError(line); diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java index d7dd3d450f..123bddaa1d 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/CSARConstants.java @@ -17,9 +17,10 @@ package org.openecomp.sdc.tosca.csar; +import static com.google.common.collect.ImmutableSet.of; + import com.google.common.collect.ImmutableSet; -import static com.google.common.collect.ImmutableSet.of; public class CSARConstants { public static final ImmutableSet<String> ELIGBLE_FOLDERS = of("Artifacts/","Definitions/", @@ -39,10 +40,21 @@ public class CSARConstants { public static final String TOSCA_META_ETSI_ENTRY_CERTIFICATE = "ETSI-Entry-Certificate"; public static final ImmutableSet<String> ELIGIBLE_FILES = of(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME,MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME); + + public static final String PNFD_PROVIDER = "pnfd_provider"; + public static final String PNFD_NAME = "pnfd_name"; + public static final String PNFD_RELEASE_DATE_TIME = "pnfd_release_date_time"; + public static final String PNFD_ARCHIVE_VERSION = "pnfd_archive_version"; public static final ImmutableSet<String> MANIFEST_PNF_METADATA = - of("pnfd_provider", "pnfd_name", "pnfd_release_date_time", "pnfd_archive_version"); + of(PNFD_PROVIDER, PNFD_NAME, PNFD_RELEASE_DATE_TIME, PNFD_ARCHIVE_VERSION); + + public static final String VNF_PROVIDER_ID = "vnf_provider_id"; + public static final String VNF_PRODUCT_NAME = "vnf_product_name"; + public static final String VNF_RELEASE_DATE_TIME = "vnf_release_date_time"; + public static final String VNF_PACKAGE_VERSION = "vnf_package_version"; public static final ImmutableSet<String> MANIFEST_VNF_METADATA = - of("vnf_provider_id", "vnf_product_name", "vnf_release_date_time", "vnf_package_version"); + of(VNF_PROVIDER_ID, VNF_PRODUCT_NAME, VNF_RELEASE_DATE_TIME, VNF_PACKAGE_VERSION); + public static final int MANIFEST_METADATA_LIMIT = 4; public static final String METADATA_MF_ATTRIBUTE = "metadata"; public static final String SOURCE_MF_ATTRIBUTE = "Source"; @@ -50,7 +62,7 @@ public class CSARConstants { public static final String HASH_MF_ATTRIBUTE = "Hash"; public static final String CMS_BEGIN = "----BEGIN CMS-----"; public static final String CMD_END = "----END CMS-----"; - public static final String SEPERATOR_MF_ATTRIBUTE = ":"; + public static final String SEPARATOR_MF_ATTRIBUTE = ":"; public static final String NON_MANO_MF_ATTRIBUTE = "non_mano_artifact_sets"; public static final String TOSCA_META_ORIG_PATH_FILE_NAME="TOSCA-Metadata/TOSCA.meta.original"; diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/ONAPManifestOnboarding.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/ONAPManifestOnboarding.java index 8e56669c62..2c4cc3a81f 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/ONAPManifestOnboarding.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/ONAPManifestOnboarding.java @@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableList; import org.openecomp.sdc.common.errors.Messages; import java.util.Iterator; -import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; +import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPARATOR_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.SOURCE_MF_ATTRIBUTE; public class ONAPManifestOnboarding extends AbstractOnboardingManifest implements Manifest { @@ -46,16 +46,16 @@ public class ONAPManifestOnboarding extends AbstractOnboardingManifest implement if(isEmptyLine(iterator, line)) { return; } - String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE); + String[] metaSplit = line.split(SEPARATOR_MF_ATTRIBUTE); if (isInvalidLine(line, metaSplit)) { return; } if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE)){ - String value = line.substring((metaSplit[0] + SEPERATOR_MF_ATTRIBUTE).length()).trim(); + String value = line.substring((metaSplit[0] + SEPARATOR_MF_ATTRIBUTE).length()).trim(); metadata.put(metaSplit[0].trim(),value.trim()); processMetadata(iterator); }else if(metaSplit[0].startsWith(SOURCE_MF_ATTRIBUTE)){ - String value = line.substring((metaSplit[0] + SEPERATOR_MF_ATTRIBUTE).length()).trim(); + String value = line.substring((metaSplit[0] + SEPARATOR_MF_ATTRIBUTE).length()).trim(); sources.add(value); processMetadata(iterator); } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingToscaMetadata.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingToscaMetadata.java index 6dd6979751..8d603cccb3 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingToscaMetadata.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/OnboardingToscaMetadata.java @@ -36,7 +36,7 @@ import java.util.List; import java.util.Map; import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters; -import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; +import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPARATOR_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_DEFINITIONS; public class OnboardingToscaMetadata implements ToscaMetadata{ @@ -66,7 +66,7 @@ public class OnboardingToscaMetadata implements ToscaMetadata{ if (line.isEmpty()) { return meta; } - String[] entry = line.split(SEPERATOR_MF_ATTRIBUTE); + String[] entry = line.split(SEPARATOR_MF_ATTRIBUTE); //No empty keys allowed, no empty values allowed if (entry.length < 2 || entry[0].isEmpty()) { meta.errors.add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters( diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java index 1ee1c1b1ae..b5b3d9cdce 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboarding.java @@ -29,7 +29,7 @@ import static org.openecomp.sdc.tosca.csar.CSARConstants.CMD_END; import static org.openecomp.sdc.tosca.csar.CSARConstants.CMS_BEGIN; import static org.openecomp.sdc.tosca.csar.CSARConstants.HASH_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.NON_MANO_MF_ATTRIBUTE; -import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPERATOR_MF_ATTRIBUTE; +import static org.openecomp.sdc.tosca.csar.CSARConstants.SEPARATOR_MF_ATTRIBUTE; import static org.openecomp.sdc.tosca.csar.CSARConstants.SOURCE_MF_ATTRIBUTE; public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { @@ -43,12 +43,12 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { if(isEmptyLine(iterator, line)){ return; } - String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE); + String[] metaSplit = line.split(SEPARATOR_MF_ATTRIBUTE); if (isInvalidLine(line, metaSplit)) { return; } if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE) && !metaSplit[0].equals(NON_MANO_MF_ATTRIBUTE)){ - String value = line.substring((metaSplit[0] + SEPERATOR_MF_ATTRIBUTE).length()).trim(); + String value = line.substring((metaSplit[0] + SEPARATOR_MF_ATTRIBUTE).length()).trim(); metadata.put(metaSplit[0].trim(),value.trim()); processMetadata(iterator); } else { @@ -61,11 +61,11 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { if(iterator.hasNext()){ processSourcesAndNonManoSources(iterator, iterator.next()); } - } else if(prevLine.startsWith(SOURCE_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){ + } else if(prevLine.startsWith(SOURCE_MF_ATTRIBUTE+ SEPARATOR_MF_ATTRIBUTE)){ processSource(iterator, prevLine); } - else if(prevLine.startsWith(ALGORITHM_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE) || - prevLine.startsWith(HASH_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){ + else if(prevLine.startsWith(ALGORITHM_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE) || + prevLine.startsWith(HASH_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE)){ processSourcesAndNonManoSources(iterator, iterator.next()); }else if(prevLine.startsWith(CMS_BEGIN)){ String line = iterator.next(); @@ -74,7 +74,7 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { } processSourcesAndNonManoSources(iterator, iterator.next()); } - else if(prevLine.startsWith(NON_MANO_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){ + else if(prevLine.startsWith(NON_MANO_MF_ATTRIBUTE+ SEPARATOR_MF_ATTRIBUTE)){ //non mano should be the last bit in manifest file, // all sources after non mano will be placed to the last non mano // key, if any other structure met error reported @@ -85,7 +85,7 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { } private void processSource(Iterator<String> iterator, String prevLine) { - String value = prevLine.substring((SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE).length()).trim(); + String value = prevLine.substring((SOURCE_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE).length()).trim(); sources.add(value); if(iterator.hasNext()) { processSourcesAndNonManoSources(iterator, iterator.next()); @@ -93,16 +93,16 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { } private void processNonManoInputs(Iterator<String> iterator, String prevLine) { - if(prevLine.trim().equals(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){ + if(prevLine.trim().equals(SOURCE_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE)){ reportError(prevLine); return; } - if(!prevLine.contains(SEPERATOR_MF_ATTRIBUTE)){ + if(!prevLine.contains(SEPARATOR_MF_ATTRIBUTE)){ reportError(prevLine); return; } - String[] metaSplit = prevLine.trim().split(SEPERATOR_MF_ATTRIBUTE); + String[] metaSplit = prevLine.trim().split(SEPARATOR_MF_ATTRIBUTE); if (metaSplit.length > 1){ reportError(prevLine); return; @@ -122,8 +122,8 @@ public class SOL004ManifestOnboarding extends AbstractOnboardingManifest { String line = iterator.next(); if(line.isEmpty()){ processNonManoSource(iterator, key, sources); - }else if(line.trim().startsWith(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)){ - String value = line.replace(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE, "").trim(); + }else if(line.trim().startsWith(SOURCE_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE)){ + String value = line.replace(SOURCE_MF_ATTRIBUTE + SEPARATOR_MF_ATTRIBUTE, "").trim(); sources.add(value); processNonManoSource(iterator, key, sources); }else { |