From 78f88751aa64fb72fd6321346929bd1d94f716a9 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 30 Aug 2019 18:20:32 +0100 Subject: Fix and refactor manifest parsing Fix a CMS signature reading expected token. Fix the necessity of a empty line in the end of the manifest. Implement CMS signature, Source checksum algorithm and digest reading. Indicate the line number and content when a manifest error occurs. Remove unnecessary recursive reading. Centralize manifest tokens. Improve tests by checking the expected error. Document the code. Change-Id: I7d12020d8922fc5d4c8d9f238557dfbcc0b65757 Issue-ID: SDC-2563 Signed-off-by: andre.schmid --- .../sdc/tosca/csar/ManifestParsingTest.java | 127 ------ .../tosca/csar/SOL004ManifestOnboardingTest.java | 436 +++++++++++++++++++++ .../manifest/InValidNonManoTosca.mf | 2 +- .../manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf | 34 -- .../vspmanager.csar/manifest/InvalidTosca1.mf | 11 - .../vspmanager.csar/manifest/InvalidTosca2.mf | 4 +- .../vspmanager.csar/manifest/InvalidTosca3.mf | 2 +- .../vspmanager.csar/manifest/InvalidTosca4.mf | 12 - .../manifest/InvalidToscaNonManoGarbageAtEnd.mf | 34 ++ .../vspmanager.csar/manifest/ValidNonManoTosca.mf | 2 +- .../vspmanager.csar/manifest/ValidTosca.mf | 2 +- .../manifest/invalid/double-signed.mf | 35 ++ .../manifest/invalid/empty-manifest.mf | 5 + .../manifest/invalid/empty-metadata-with-source.mf | 12 + .../manifest/invalid/empty-metadata.mf | 1 + .../invalid/metadata-duplicated-entries.mf | 4 + .../manifest/invalid/metadata-incorrect-entry.mf | 5 + .../manifest/invalid/metadata-mixed-entries.mf | 5 + .../manifest/invalid/metadata-no-entry.mf | 3 + .../manifest/invalid/metadata-no-value.mf | 3 + .../manifest/invalid/no-metadata.mf | 11 + .../invalid/non-mano-key-with-empty-source.mf | 11 + .../invalid/non-mano-key-with-no-sources.mf | 10 + .../invalid/source-algorithm-without-hash.mf | 8 + .../invalid/source-algorithm-without-value.mf | 9 + .../invalid/source-hash-without-algorithm.mf | 8 + .../manifest/invalid/source-hash-without-value.mf | 9 + .../manifest/valid/metadata-pnfd.mf | 27 ++ .../manifest/valid/signed-with-non-mano.mf | 30 ++ .../vspmanager.csar/manifest/valid/signed.mf | 27 ++ 30 files changed, 700 insertions(+), 189 deletions(-) delete mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java delete mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf delete mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf delete mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf create mode 100644 openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test') diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java deleted file mode 100644 index b083cfad3a..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * 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.openecomp.sdc.tosca.csar; - -import org.junit.Before; -import org.junit.Test; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.common.errors.Messages; -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; - -import static junit.framework.TestCase.assertTrue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - - -public class ManifestParsingTest { - - private Manifest manifest; - - @Before - public void setUp(){ - manifest = new SOL004ManifestOnboarding(); - } - - @Test - public void testSuccessfulParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) { - manifest.parse(is); - assertTrue(manifest.isValid()); - assertEquals(manifest.getMetadata().size(), 4); - assertEquals(manifest.getSources().size(), 5); - Optional resourceTypeEnum = manifest.getType(); - if(resourceTypeEnum.isPresent()){ - assertTrue(resourceTypeEnum.get() == ResourceTypeEnum.VF); - } - } - } - - @Test - public void testNoMetadataParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - assertTrue(manifest.getErrors().stream().anyMatch(error -> error - .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))); - } - } - - @Test - public void testBrokenMDParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - assertTrue(manifest.getErrors().stream().anyMatch(error -> error - .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))); - } - } - - @Test - public void testNoMetaParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - assertTrue(manifest.getErrors().stream().anyMatch(error -> error - .contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10)))); - } - } - - @Test - public void testSuccessfulNonManoParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) { - manifest.parse(is); - assertTrue(manifest.isValid()); - assertEquals(manifest.getMetadata().size(), 4); - assertEquals(manifest.getSources().size(), 5); - assertEquals(manifest.getNonManoSources().size(), 2); - } - } - - @Test - public void testFailfulNonManoParsing() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/InValidNonManoTosca.mf")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - } - } - - @Test - public void testFailfulNonManoParsingWithGarbadge() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - } - } - - @Test - public void testParseManifestWithNoFile() throws IOException { - try (InputStream is = getClass() - .getResourceAsStream("/vspmanager.csar/manifest/SOME_WRONG_FILE")) { - manifest.parse(is); - assertFalse(manifest.isValid()); - } - } -} diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java new file mode 100644 index 0000000000..7cb1511a32 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java @@ -0,0 +1,436 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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.openecomp.sdc.tosca.csar; + +import static junit.framework.TestCase.assertSame; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +import com.google.common.collect.ImmutableMap; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.common.errors.Messages; + +public class SOL004ManifestOnboardingTest { + + private Manifest manifest; + + @Before + public void setUp() { + manifest = new SOL004ManifestOnboarding(); + } + + @Test + public void testSuccessfulParsing() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(4, 5, Collections.emptyMap(), ResourceTypeEnum.VF); + } + } + + @Test + public void testNoMetadataParsing() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/no-metadata.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(3, "Source: MainServiceTemplate.yaml", Messages.MANIFEST_START_METADATA) + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testBrokenMDParsing() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(Messages.MANIFEST_INVALID_LINE.formatMessage(9, "vnf_package_version: 1.0")); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testNoMetaParsing() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(4, "Source: MainServiceTemplate.yaml", + Messages.MANIFEST_METADATA_INVALID_ENTRY1, "Source: MainServiceTemplate.yaml") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testSuccessfulNonManoParsing() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(4, 5, + ImmutableMap.of("foo_bar", 3, "prv.happy-nfv.cool", 3), ResourceTypeEnum.VF); + } + } + + @Test + public void testInvalidNonManoParsing() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/InValidNonManoTosca.mf")) { + manifest.parse(manifestAsStream); + final List errorList = Collections.singletonList( + buildErrorMessage(34, "vnf_product_name: Mock", Messages.MANIFEST_INVALID_NON_MANO_KEY, + "vnf_product_name") + ); + assertInvalidManifest(errorList); + } + } + + private String buildErrorMessage(final int lineNumber, final String line, final Messages message, + final Object... params) { + return Messages.MANIFEST_ERROR_WITH_LINE.formatMessage(message.formatMessage(params), lineNumber, line); + } + + @Test + public void testNonManoParsingWithGarbage() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf")) { + manifest.parse(manifestAsStream); + final List errorList = Collections.singletonList( + Messages.MANIFEST_ERROR_WITH_LINE.formatMessage( + Messages.MANIFEST_INVALID_NON_MANO_KEY.formatMessage("some garbage"), + 34, "some garbage") + ); + assertInvalidManifest(errorList); + } + } + + @Test + public void testInvalidManifestFile() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/SOME_WRONG_FILE")) { + manifest.parse(manifestAsStream); + assertInvalidManifest(Collections.singletonList(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage())); + } + } + + @Test + public void testManifestSigned() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/valid/signed.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(4, 3, Collections.emptyMap(), ResourceTypeEnum.VF); + } + } + + @Test + public void testManifestSignedWithNonManoArtifacts() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/valid/signed-with-non-mano.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(4, 3, ImmutableMap.of("foo_bar", 3), ResourceTypeEnum.VF); + manifest.getType().ifPresent(typeEnum -> assertSame(typeEnum, ResourceTypeEnum.VF)); + } + } + + @Test + public void testManifestWithPnf() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/valid/metadata-pnfd.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(4, 3, new HashMap<>(), ResourceTypeEnum.PNF); + } + } + + @Test + public void testMetadataWithNoValue() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-no-value.mf")) { + manifest.parse(manifestAsStream); + + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(3, "vnf_provider_id", Messages.MANIFEST_METADATA_INVALID_ENTRY1, "vnf_provider_id") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testMetadataWithValueButNoEntry() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-no-entry.mf")) { + manifest.parse(manifestAsStream); + + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(3, ": no-entry-value", Messages.MANIFEST_METADATA_INVALID_ENTRY1, ": no-entry-value") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testMetadataWithIncorrectEntry() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(4, "vnf_release_data_time: 2019-08-29T22:17:39.275281", + Messages.MANIFEST_METADATA_INVALID_ENTRY1, "vnf_release_data_time: 2019-08-29T22:17:39.275281") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testMetadataWithMixedEntries() throws IOException { + try (final InputStream manifestAsStream = getClass() + .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(6, "", Messages.MANIFEST_METADATA_UNEXPECTED_ENTRY_TYPE)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testMetadataWithDuplicatedEntries() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(4, "vnf_product_name: vPP", Messages.MANIFEST_METADATA_DUPLICATED_ENTRY, + "vnf_product_name") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestNonManoKeyWithoutSources() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(11, "", Messages.MANIFEST_EMPTY_NON_MANO_KEY, + "foo_bar") + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestNonManoKeyWithEmptySourceEntry() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add( + buildErrorMessage(11, "Source:", Messages.MANIFEST_EMPTY_NON_MANO_SOURCE) + ); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestWithEmptyMetadata() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-metadata.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(2, "", Messages.MANIFEST_NO_METADATA)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestSourceAlgorithmWithoutHash() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(9, "", Messages.MANIFEST_EXPECTED_HASH_ENTRY)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestSourceHashWithoutAlgorithm() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(8, "Hash: 3b119b37da5b76ec7c933168b21cedd8", Messages.MANIFEST_EXPECTED_ALGORITHM_BEFORE_HASH)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestSourceAlgorithmWithoutValue() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(8, "Algorithm:", Messages.MANIFEST_EXPECTED_ALGORITHM_VALUE)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestSourceHashWithoutValue() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-hash-without-value.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(buildErrorMessage(9, "Hash:", Messages.MANIFEST_EXPECTED_HASH_VALUE)); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testEmptyManifest() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-manifest.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList.add(Messages.MANIFEST_EMPTY.getErrorMessage()); + assertInvalidManifest(expectedErrorList); + } + } + + @Test + public void testManifestWithDuplicatedCmsSignature() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/double-signed.mf")) { + manifest.parse(manifestAsStream); + final List expectedErrorList = new ArrayList<>(); + expectedErrorList + .add(buildErrorMessage(26, "-----BEGIN CMS-----", Messages.MANIFEST_DUPLICATED_CMS_SIGNATURE)); + assertInvalidManifest(expectedErrorList); + } + } + + + @Test + public void testGetEntry() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + final Method getEntryMethod = AbstractOnboardingManifest.class.getDeclaredMethod("readEntryName", String.class); + getEntryMethod.setAccessible(true); + final Optional noEntry = (Optional) getEntryMethod.invoke(manifest, ":"); + assertThat("Entry should not be present", noEntry.isPresent(), is(false)); + + final Optional blankEntry = (Optional) getEntryMethod.invoke(manifest, " :"); + assertThat("Entry should not be present", blankEntry.isPresent(), is(false)); + + final Optional noColon = (Optional) getEntryMethod.invoke(manifest, "anyKeyWithoutColon "); + assertThat("Entry should not be present", noColon.isPresent(), is(false)); + + final Optional blank = (Optional) getEntryMethod.invoke(manifest, " "); + assertThat("Entry should not be present", blank.isPresent(), is(false)); + + final Optional empty = (Optional) getEntryMethod.invoke(manifest, ""); + assertThat("Entry should not be present", empty.isPresent(), is(false)); + + final Optional nul1 = (Optional) getEntryMethod.invoke(manifest, new Object[]{null}); + assertThat("Entry should not be present", nul1.isPresent(), is(false)); + + final Optional entry = (Optional) getEntryMethod + .invoke(manifest, " entry to test : : a value ::: test test: "); + assertThat("Entry should be present", entry.isPresent(), is(true)); + assertThat("Entry should be as expected", entry.get(), equalTo("entry to test")); + } + + @Test + public void testGetValue() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + final Method getValueMethod = AbstractOnboardingManifest.class.getDeclaredMethod("readEntryValue", String.class); + getValueMethod.setAccessible(true); + final Optional noValue = (Optional) getValueMethod.invoke(manifest, ":"); + assertThat("Value should not be present", noValue.isPresent(), is(false)); + + final Optional blankValue = (Optional) getValueMethod.invoke(manifest, ": "); + assertThat("Value should not be present", blankValue.isPresent(), is(false)); + + final Optional noColon = (Optional) getValueMethod.invoke(manifest, "anyKeyWithoutColon "); + assertThat("Value should not be present", noColon.isPresent(), is(false)); + + final Optional blank = (Optional) getValueMethod.invoke(manifest, " "); + assertThat("Value should not be present", blank.isPresent(), is(false)); + + final Optional empty = (Optional) getValueMethod.invoke(manifest, ""); + assertThat("Value should not be present", empty.isPresent(), is(false)); + + final Optional nul1 = (Optional) getValueMethod.invoke(manifest, new Object[]{null}); + assertThat("Value should not be present", nul1.isPresent(), is(false)); + + final Optional value = (Optional) getValueMethod + .invoke(manifest, "attribute : : a value ::: test test: "); + assertThat("Value should be present", value.isPresent(), is(true)); + assertThat("Value should be as expected", value.get(), equalTo(": a value ::: test test:")); + } + + private void assertValidManifest(final int expectedMetadataSize, final int expectedSourcesSize, + final Map expectedNonManoKeySize, + final ResourceTypeEnum resourceType) { + assertThat("Should have no errors", manifest.getErrors(), is(empty())); + assertThat("Should be valid", manifest.isValid(), is(true)); + assertThat("Metadata should have the expected size", + manifest.getMetadata().keySet(), hasSize(expectedMetadataSize)); + assertThat("Sources should have the expected size", manifest.getSources(), hasSize(expectedSourcesSize)); + assertThat("Non Mano Sources keys should have the expected size", + manifest.getNonManoSources().keySet(), hasSize(expectedNonManoKeySize.keySet().size())); + for (final Entry nonManoKeyAndSize : expectedNonManoKeySize.entrySet()) { + final String nonManoKey = nonManoKeyAndSize.getKey(); + assertThat("Should contain expected Non Mano Sources key", + manifest.getNonManoSources().keySet(), hasItem(nonManoKey)); + assertThat(String.format("Non Mano Sources keys %s should have the expected sources size", nonManoKey), + manifest.getNonManoSources().get(nonManoKey).size(), equalTo(nonManoKeyAndSize.getValue())); + } + assertThat("Should have a type", manifest.getType().isPresent(), is(true)); + assertThat("Type should be as expected", manifest.getType().get(), equalTo(resourceType)); + } + + private void assertInvalidManifest(final List expectedErrorList) { + assertThat("Should be invalid", manifest.isValid(), is(false)); + assertThat("Should have the expected error quantity", manifest.getErrors(), hasSize(expectedErrorList.size())); + assertThat("Should have expected errors", manifest.getErrors(), + containsInAnyOrder(expectedErrorList.toArray(new String[0]))); + } +} diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf index 9cced6b371..02215a6cfb 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf @@ -2,7 +2,7 @@ metadata: vnf_product_name: Mock vnf_provider_id: ZTE vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 + vnf_release_date_time: 2017.01.01T10:00+03:00 Source: MainServiceTemplate.yaml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf deleted file mode 100644 index cfe6bc48da..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf +++ /dev/null @@ -1,34 +0,0 @@ -metadata: - vnf_product_name: Mock - vnf_provider_id: ZTE - vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 - -Source: MainServiceTemplate.yaml - -Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml - -Source: Artifacts/install.sh - -Source: Artifacts/create_stack.sh - -Source: Licenses/license.xml - -non_mano_artifact_sets: - foo_bar: - Source: foobar/foo/foo.yaml - - Source: foobar/foo/foo.script - - Source: foobar/bar/descriptor.xml - - prv.happy-nfv.cool: - - Source: happy/cool/123.html - - Source: happy/cool/cool.json - - Source: happy/cool/hot/hot_or_cool.json - - -some garbadge \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf deleted file mode 100644 index ebdec213d3..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf +++ /dev/null @@ -1,11 +0,0 @@ - - -Source: MainServiceTemplate.yaml - -Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml - -Source: Artifacts/install.sh - -Source: Artifacts/create_stack.sh - -Source: Licenses/license.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf index 057f54867b..54bb5cd65f 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf @@ -1,11 +1,13 @@ metadata: vnf_product_name: Mock vnf_provider_id: ZTE + vnf_package_version: 1.0 + vnf_release_date_time: 2017.01.01T10:00+03:00 Source: MainServiceTemplate.yaml vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 + vnf_release_date_time: 2017.01.01T10:00+03:00 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf index 64e9445f7f..060207f120 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf @@ -2,6 +2,6 @@ metadata: vnf_product_name: Mock vnf_provider_id: ZTE vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 + vnf_release_date_time: 2017.01.01T10:00+03:00 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf deleted file mode 100644 index d8e291c4a3..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf +++ /dev/null @@ -1,12 +0,0 @@ -metadata: - - -Source: MainServiceTemplate.yaml - -Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml - -Source: Artifacts/install.sh - -Source: Artifacts/create_stack.sh - -Source: Licenses/license.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf new file mode 100644 index 0000000000..15c2833c22 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf @@ -0,0 +1,34 @@ +metadata: + vnf_product_name: Mock + vnf_provider_id: ZTE + vnf_package_version: 1.0 + vnf_release_date_time: 2017.01.01T10:00+03:00 + +Source: MainServiceTemplate.yaml + +Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml + +Source: Artifacts/install.sh + +Source: Artifacts/create_stack.sh + +Source: Licenses/license.xml + +non_mano_artifact_sets: + foo_bar: + Source: foobar/foo/foo.yaml + + Source: foobar/foo/foo.script + + Source: foobar/bar/descriptor.xml + + prv.happy-nfv.cool: + + Source: happy/cool/123.html + + Source: happy/cool/cool.json + + Source: happy/cool/hot/hot_or_cool.json + + +some garbage \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf index 25ec14c7cc..03f2b3cf3b 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf @@ -2,7 +2,7 @@ metadata: vnf_product_name: Mock vnf_provider_id: ZTE vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 + vnf_release_date_time: 2017.01.01T10:00+03:00 Source: MainServiceTemplate.yaml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf index b2accb7a1c..b9d3844d53 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf @@ -2,7 +2,7 @@ metadata: vnf_product_name: Mock vnf_provider_id: ZTE vnf_package_version: 1.0 - vnf_release_data_time: 2017.01.01T10:00+03:00 + vnf_release_date_time: 2017.01.01T10:00+03:00 Source: MainServiceTemplate.yaml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf new file mode 100644 index 0000000000..88098a1006 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf @@ -0,0 +1,35 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file +Algorithm: md5 +Hash: 3b119b37da5b76ec7c933168b21cedd8 + +-----BEGIN CMS----- +MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI +hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl +AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp +mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/ +MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6 +0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT +igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE +O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9 +-----END CMS----- + +Source: scripts/userdata.file.sm +Algorithm: md5 +Hash: 3b119b37da5b76ec7c933168b21cedd7 + +-----BEGIN CMS----- +MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI +hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl +AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp +mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/ +MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6 +0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT +igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE +O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9 +-----END CMS----- diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf new file mode 100644 index 0000000000..3f2ff2d6cc --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf @@ -0,0 +1,5 @@ + + + + + diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf new file mode 100644 index 0000000000..d8e291c4a3 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf @@ -0,0 +1,12 @@ +metadata: + + +Source: MainServiceTemplate.yaml + +Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml + +Source: Artifacts/install.sh + +Source: Artifacts/create_stack.sh + +Source: Licenses/license.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf new file mode 100644 index 0000000000..7b518cbe81 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf @@ -0,0 +1 @@ +metadata: \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf new file mode 100644 index 0000000000..696265eab1 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf @@ -0,0 +1,4 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_product_name: vPP diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf new file mode 100644 index 0000000000..139e18e267 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf @@ -0,0 +1,5 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_release_data_time: 2019-08-29T22:17:39.275281 + vnf_package_version: R24A583 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf new file mode 100644 index 0000000000..0d26e2de98 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf @@ -0,0 +1,5 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_release_date_time: 2019-08-29T22:17:39.275281 + pnfd_archive_version: 1.0 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf new file mode 100644 index 0000000000..bc6db7ebf4 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf @@ -0,0 +1,3 @@ +metadata: + vnf_product_name: vPP + : no-entry-value \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf new file mode 100644 index 0000000000..9d286d6dd9 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf @@ -0,0 +1,3 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf new file mode 100644 index 0000000000..ebdec213d3 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf @@ -0,0 +1,11 @@ + + +Source: MainServiceTemplate.yaml + +Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml + +Source: Artifacts/install.sh + +Source: Artifacts/create_stack.sh + +Source: Licenses/license.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf new file mode 100644 index 0000000000..e4544d487a --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf @@ -0,0 +1,11 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm + +non_mano_artifact_sets: + foo_bar: + Source: \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf new file mode 100644 index 0000000000..a7533bbf45 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf @@ -0,0 +1,10 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm + +non_mano_artifact_sets: + foo_bar: diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf new file mode 100644 index 0000000000..a9a988735b --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf @@ -0,0 +1,8 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm +Algorithm: md5 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf new file mode 100644 index 0000000000..79797d7b8c --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf @@ -0,0 +1,9 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm +Algorithm: +Hash: 3b119b37da5b76ec7c933168b21cedd8 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf new file mode 100644 index 0000000000..ec10bc800f --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf @@ -0,0 +1,8 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm +Hash: 3b119b37da5b76ec7c933168b21cedd8 diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf new file mode 100644 index 0000000000..2d786f1e54 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf @@ -0,0 +1,9 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: scripts/userdata.file.sm +Algorithm: md5 +Hash: diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf new file mode 100644 index 0000000000..8bf73ede63 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf @@ -0,0 +1,27 @@ +metadata: + pnfd_name: Name + pnfd_provider: Provider + pnfd_archive_version: 1.0 + pnfd_release_date_time: 2017-01-01T10:00:00+03:00 + +Source: TOSCA-Metadata/TOSCA.meta + +Source: scripts/userdata.file +Algorithm: md5 +Hash: 3b119b37da5b76ec7c933168b21cedd8 + +Source: scripts/userdata.file.sm + + + + +-----BEGIN CMS----- +MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI +hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl +AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp +mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/ +MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6 +0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT +igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE +O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9 +-----END CMS----- diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf new file mode 100644 index 0000000000..dee6384892 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf @@ -0,0 +1,30 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: TOSCA-Metadata/TOSCA.meta + +Source: scripts/userdata.file +Algorithm: md5 +Hash: 3b119b37da5b76ec7c933168b21cedd8 + +Source: scripts/userdata.file.sm + +-----BEGIN CMS----- +MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI +hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl +AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp +mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/ +MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6 +0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT +igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE +O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9 +-----END CMS----- + +non_mano_artifact_sets: + foo_bar: + Source: foobar/foo/foo.yaml + Source: foobar/foo/foo.script + Source: foobar/bar/descriptor.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf new file mode 100644 index 0000000000..fe43239d29 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf @@ -0,0 +1,27 @@ +metadata: + vnf_product_name: vPP + vnf_provider_id: Ericsson + vnf_package_version: R24A583 + vnf_release_date_time: 2019-08-29T22:17:39.275281 + +Source: TOSCA-Metadata/TOSCA.meta + +Source: scripts/userdata.file +Algorithm: md5 +Hash: 3b119b37da5b76ec7c933168b21cedd8 + +Source: scripts/userdata.file.sm + + + + +-----BEGIN CMS----- +MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI +hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl +AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp +mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/ +MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6 +0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT +igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE +O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9 +-----END CMS----- -- cgit 1.2.3-korg